enic: Cleanups in port profile helper code
authorRoopa Prabhu <roprabhu@cisco.com>
Tue, 29 Mar 2011 20:36:02 +0000 (20:36 +0000)
committerDavid S. Miller <davem@davemloft.net>
Thu, 31 Mar 2011 04:39:25 +0000 (21:39 -0700)
This patch does the following:
- Introduces a new macro VIC_PROVINFO_ADD_TLV
- Adds a new OS type in vic_generic_prov_os_type
- Changes some vic_provinfo* helper routine args to constants

Signed-off-by: Roopa Prabhu <roprabhu@cisco.com>
Signed-off-by: David Wang <dwang2@cisco.com>
Signed-off-by: Christian Benvenuti <benve@cisco.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/enic/vnic_vic.c
drivers/net/enic/vnic_vic.h

index 4725b79de0ef1686484e71dda80e9ae2aad48bc1..24ef8cd40545a012d99f85558a166c1462ed679f 100644 (file)
@@ -23,7 +23,8 @@
 
 #include "vnic_vic.h"
 
-struct vic_provinfo *vic_provinfo_alloc(gfp_t flags, u8 *oui, u8 type)
+struct vic_provinfo *vic_provinfo_alloc(gfp_t flags, const u8 *oui,
+       const u8 type)
 {
        struct vic_provinfo *vp;
 
@@ -47,7 +48,7 @@ void vic_provinfo_free(struct vic_provinfo *vp)
 }
 
 int vic_provinfo_add_tlv(struct vic_provinfo *vp, u16 type, u16 length,
-       void *value)
+       const void *value)
 {
        struct vic_provinfo_tlv *tlv;
 
index f700f5d9e81d8eb3f02305238484d69e1e71b7cc..9ef81f14835169513063e8b459abb088242306ca 100644 (file)
@@ -47,6 +47,7 @@ enum vic_generic_prov_os_type {
        VIC_GENERIC_PROV_OS_TYPE_ESX = 1,
        VIC_GENERIC_PROV_OS_TYPE_LINUX = 2,
        VIC_GENERIC_PROV_OS_TYPE_WINDOWS = 3,
+       VIC_GENERIC_PROV_OS_TYPE_SOLARIS = 4,
 };
 
 struct vic_provinfo {
@@ -61,14 +62,22 @@ struct vic_provinfo {
        } tlv[0];
 } __packed;
 
+#define VIC_PROVINFO_ADD_TLV(vp, tlvtype, tlvlen, data) \
+       do { \
+               err = vic_provinfo_add_tlv(vp, tlvtype, tlvlen, data); \
+               if (err) \
+                       goto add_tlv_failure; \
+       } while (0)
+
 #define VIC_PROVINFO_MAX_DATA          1385
 #define VIC_PROVINFO_MAX_TLV_DATA (VIC_PROVINFO_MAX_DATA - \
        sizeof(struct vic_provinfo))
 
-struct vic_provinfo *vic_provinfo_alloc(gfp_t flags, u8 *oui, u8 type);
+struct vic_provinfo *vic_provinfo_alloc(gfp_t flags, const u8 *oui,
+       const u8 type);
 void vic_provinfo_free(struct vic_provinfo *vp);
 int vic_provinfo_add_tlv(struct vic_provinfo *vp, u16 type, u16 length,
-       void *value);
+       const void *value);
 size_t vic_provinfo_size(struct vic_provinfo *vp);
 
 #endif /* _VNIC_VIC_H_ */