milis/talimatname/genel/o/open-vm-tools-kernel/0001-Fix-vmxnet-module-on-k...

75 lines
2.2 KiB
Diff
Raw Normal View History

2018-06-09 00:06:58 +02:00
From 08836a47c56b47b658025e41a20027c5d915f836 Mon Sep 17 00:00:00 2001
From: "Scott M. Kroll" <skroll@gmail.com>
Date: Fri, 15 Aug 2014 10:40:38 -0400
Subject: [PATCH 1/3] Fix vmxnet module on kernels >= 3.16
* Add compat check for ethtool_ops in net_device struct.
* SET_ETHTOOL_OPS is no longer defined, but can be manually.
---
open-vm-tools/modules/linux/shared/compat_netdevice.h | 4 ++++
open-vm-tools/modules/linux/vmxnet/vmxnet.c | 13 ++++++++-----
2 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/open-vm-tools/modules/linux/shared/compat_netdevice.h b/open-vm-tools/modules/linux/shared/compat_netdevice.h
index 3aec25b..a65d59b 100644
--- a/open-vm-tools/modules/linux/shared/compat_netdevice.h
+++ b/open-vm-tools/modules/linux/shared/compat_netdevice.h
@@ -337,4 +337,8 @@ typedef netdev_features_t compat_netdev_features_t;
typedef u32 compat_netdev_features_t;
#endif
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 16, 0) || defined(SET_ETHTOOL_OPS)
+#define VMW_HAVE_ETHTOOL_OPS 1
+#endif
+
#endif /* __COMPAT_NETDEVICE_H__ */
diff --git a/open-vm-tools/modules/linux/vmxnet/vmxnet.c b/open-vm-tools/modules/linux/vmxnet/vmxnet.c
index 33afb9b..40abde5 100644
--- a/open-vm-tools/modules/linux/vmxnet/vmxnet.c
+++ b/open-vm-tools/modules/linux/vmxnet/vmxnet.c
@@ -279,8 +279,7 @@ vmxnet_change_mtu(struct net_device *dev, int new_mtu)
#endif
-
-#ifdef SET_ETHTOOL_OPS
+#ifdef VMW_HAVE_ETHTOOL_OPS
/*
*----------------------------------------------------------------------------
*
@@ -526,7 +525,7 @@ vmxnet_ethtool_ops = {
};
-#else /* !defined(SET_ETHTOOL_OPS) */
+#else /* !defined(VMW_HAVE_ETHTOOL_OPS) */
/*
@@ -739,7 +738,7 @@ vmxnet_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
}
return -EOPNOTSUPP;
}
-#endif /* SET_ETHTOOL_OPS */
+#endif /* !defined(VMW_HAVE_ETHTOOL_OPS) */
/*
@@ -1142,8 +1141,12 @@ vmxnet_probe_device(struct pci_dev *pdev, // IN: vmxnet PCI device
dev->watchdog_timeo = VMXNET_WATCHDOG_TIMEOUT;
#endif
-#ifdef SET_ETHTOOL_OPS
+#ifdef VMW_HAVE_ETHTOOL_OPS
+# ifdef SET_ETHTOOL_OPS
SET_ETHTOOL_OPS(dev, &vmxnet_ethtool_ops);
+# else
+ dev->ethtool_ops = &vmxnet_ethtool_ops;
+# endif
#else
dev->do_ioctl = vmxnet_ioctl;
#endif
--
2.3.4