]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
VMXNET,VMXNET3: fix compilation on RHEL 5.4
authorVMware, Inc <>
Fri, 18 Sep 2009 21:43:42 +0000 (14:43 -0700)
committerMarcelo Vanzin <mvanzin@mvanzin-dev1.eng.vmware.com>
Sat, 19 Sep 2009 01:49:11 +0000 (18:49 -0700)
RedHat backported GRO patch to 2.6.18 which brought napi_sturct
definition to that kernel; it conflicts with our stub. For pre-2.6.24
kernels check if NETIF_F_GRO is defined and if it is assume that
struct napi_struct is present.

Signed-off-by: Marcelo Vanzin <mvanzin@vmware.com>
open-vm-tools/modules/linux/shared/compat_netdevice.h
open-vm-tools/modules/linux/vmxnet3/vmxnet3_int.h

index 495e7800eff65e5e12b2243e9fa0f2835efee4f4..fa1422025305cf634e54ec5b447faa1bb33ec578 100644 (file)
@@ -281,6 +281,7 @@ static inline int compat_unregister_netdevice_notifier(struct notifier_block *nb
 #endif
 
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 24)
+
 #   define compat_netif_napi_add(dev, napi, poll, quota) \
       netif_napi_add(dev, napi, poll, quota)
 
@@ -295,20 +296,28 @@ static inline int compat_unregister_netdevice_notifier(struct notifier_block *nb
 
 #   define compat_napi_enable(dev, napi)  napi_enable(napi)
 #   define compat_napi_disable(dev, napi) napi_disable(napi)
+
 #else
-struct napi_struct {
-   int dummy;
-};
 
 #   define compat_netif_napi_add(dev, napi, pollcb, quota) \
    do {                        \
       (dev)->poll = (pollcb);    \
       (dev)->weight = (quota);\
    } while (0)
-#   define compat_napi_complete(dev, napi) netif_rx_complete(dev)
 #   define compat_napi_schedule(dev, napi) netif_rx_schedule(dev)
 #   define compat_napi_enable(dev, napi)   netif_poll_enable(dev)
 #   define compat_napi_disable(dev, napi)  netif_poll_disable(dev)
+
+/* RedHat ported GRO to 2.6.18 bringing new napi_struct with it */
+#   if defined NETIF_F_GRO
+#      define compat_napi_complete(dev, napi) napi_complete(napi)
+#   else
+#      define compat_napi_complete(dev, napi) netif_rx_complete(dev)
+       struct napi_struct {
+          int dummy;
+       };
+#   endif
+
 #endif
 
 #endif /* __COMPAT_NETDEVICE_H__ */
index 11201e67fc580c9a6d1f06924340cf675ef174cb..f4972351004823b472282921568f9ca8decf76bc 100644 (file)
 
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0) && !defined(VMXNET3_NO_NAPI)
 #   define VMXNET3_NAPI
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 24)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 24) || defined NETIF_F_GRO
+/*
+ * The new NAPI initially appeared only in 2.6.24 but Redhat backported it
+ * to 2.6.18 in RHEL5.4. We assume that iwe need to use the new style
+ * whenever NETIF_F_GRO is present.
+ */
 #   define VMXNET3_NEW_NAPI
 #endif
 #endif