From: VMware, Inc <> Date: Fri, 18 Sep 2009 21:43:42 +0000 (-0700) Subject: VMXNET,VMXNET3: fix compilation on RHEL 5.4 X-Git-Tag: 2009.09.18-193784~14 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=f77444ea2fd185ecb214922e26be92639941bc01;p=thirdparty%2Fopen-vm-tools.git VMXNET,VMXNET3: fix compilation on RHEL 5.4 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 --- diff --git a/open-vm-tools/modules/linux/shared/compat_netdevice.h b/open-vm-tools/modules/linux/shared/compat_netdevice.h index 495e7800e..fa1422025 100644 --- a/open-vm-tools/modules/linux/shared/compat_netdevice.h +++ b/open-vm-tools/modules/linux/shared/compat_netdevice.h @@ -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__ */ diff --git a/open-vm-tools/modules/linux/vmxnet3/vmxnet3_int.h b/open-vm-tools/modules/linux/vmxnet3/vmxnet3_int.h index 11201e67f..f49723510 100644 --- a/open-vm-tools/modules/linux/vmxnet3/vmxnet3_int.h +++ b/open-vm-tools/modules/linux/vmxnet3/vmxnet3_int.h @@ -26,7 +26,12 @@ #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