aboutsummaryrefslogtreecommitdiffstats
path: root/unmaintained/open-vm-tools-grsec/0001-Fix-vmxnet-module-on-kernels-3.16.patch
blob: 4f76f76f0af0117eee4c9b05f652972f5860b55f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
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/modules/linux/shared/compat_netdevice.h
+++ b/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/modules/linux/vmxnet/vmxnet.c
+++ b/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