Signed-off-by: Stefan Assmann <sassm...@kpanic.de>
---
 .../igb_ndo_set_vf_spoofchk.patch                  | 49 ----------------------
 .../0034-ndo_set_vf_spoofchk/set_vf_spoofchk.cocci | 41 ++++++++++++++++++
 2 files changed, 41 insertions(+), 49 deletions(-)
 delete mode 100644 
patches/collateral-evolutions/network/0034-ndo_set_vf_spoofchk/igb_ndo_set_vf_spoofchk.patch
 create mode 100644 
patches/collateral-evolutions/network/0034-ndo_set_vf_spoofchk/set_vf_spoofchk.cocci

diff --git 
a/patches/collateral-evolutions/network/0034-ndo_set_vf_spoofchk/igb_ndo_set_vf_spoofchk.patch
 
b/patches/collateral-evolutions/network/0034-ndo_set_vf_spoofchk/igb_ndo_set_vf_spoofchk.patch
deleted file mode 100644
index 879312d..0000000
--- 
a/patches/collateral-evolutions/network/0034-ndo_set_vf_spoofchk/igb_ndo_set_vf_spoofchk.patch
+++ /dev/null
@@ -1,49 +0,0 @@
---- a/drivers/net/ethernet/intel/igb/igb_main.c
-+++ b/drivers/net/ethernet/intel/igb/igb_main.c
-@@ -178,8 +178,10 @@ static int igb_ndo_set_vf_mac(struct net
- static int igb_ndo_set_vf_vlan(struct net_device *netdev,
-                              int vf, u16 vlan, u8 qos);
- static int igb_ndo_set_vf_bw(struct net_device *, int, int, int);
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0)
- static int igb_ndo_set_vf_spoofchk(struct net_device *netdev, int vf,
-                                  bool setting);
-+#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0) */
- static int igb_ndo_get_vf_config(struct net_device *netdev, int vf,
-                                struct ifla_vf_info *ivi);
- static void igb_check_vf_rate_limit(struct igb_adapter *);
-@@ -2100,7 +2102,9 @@ static const struct net_device_ops igb_n
-       .ndo_set_vf_mac         = igb_ndo_set_vf_mac,
-       .ndo_set_vf_vlan        = igb_ndo_set_vf_vlan,
-       .ndo_set_vf_rate        = igb_ndo_set_vf_bw,
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0)
-       .ndo_set_vf_spoofchk    = igb_ndo_set_vf_spoofchk,
-+#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0) */
-       .ndo_get_vf_config      = igb_ndo_get_vf_config,
- #ifdef CONFIG_NET_POLL_CONTROLLER
-       .ndo_poll_controller    = igb_netpoll,
-@@ -7918,6 +7922,7 @@ static int igb_ndo_set_vf_bw(struct net_
-       return 0;
- }
- 
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0)
- static int igb_ndo_set_vf_spoofchk(struct net_device *netdev, int vf,
-                                  bool setting)
- {
-@@ -7944,6 +7949,7 @@ static int igb_ndo_set_vf_spoofchk(struc
-       adapter->vf_data[vf].spoofchk_enabled = setting;
-       return 0;
- }
-+#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0) */
- 
- static int igb_ndo_get_vf_config(struct net_device *netdev,
-                                int vf, struct ifla_vf_info *ivi)
-@@ -7957,7 +7963,9 @@ static int igb_ndo_get_vf_config(struct
-       ivi->min_tx_rate = 0;
-       ivi->vlan = adapter->vf_data[vf].pf_vlan;
-       ivi->qos = adapter->vf_data[vf].pf_qos;
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0)
-       ivi->spoofchk = adapter->vf_data[vf].spoofchk_enabled;
-+#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0) */
-       return 0;
- }
- 
diff --git 
a/patches/collateral-evolutions/network/0034-ndo_set_vf_spoofchk/set_vf_spoofchk.cocci
 
b/patches/collateral-evolutions/network/0034-ndo_set_vf_spoofchk/set_vf_spoofchk.cocci
new file mode 100644
index 0000000..7be32c0
--- /dev/null
+++ 
b/patches/collateral-evolutions/network/0034-ndo_set_vf_spoofchk/set_vf_spoofchk.cocci
@@ -0,0 +1,41 @@
+@r1@
+identifier s, func;
+@@
+
+struct net_device_ops s = {
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0)
+.ndo_set_vf_spoofchk = func,
++#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0) */
+};
+
+@r2@
+identifier s, func2;
+@@
+
+struct net_device_ops s = {
+.ndo_get_vf_config = func2,
+};
+
+// ----------------------------------------------------------------------
+
+@@
+identifier r1.func;
+@@
+
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0)
+func(...) { ... }
++#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0) */
+
+@@
+identifier r2.func2, ivi;
+expression assign;
+@@
+
+func2(...  ,struct ifla_vf_info *ivi)
+{
+ <...
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0)
+ ivi->spoofchk = assign;
++#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0) */
+ ...>
+}
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe backports" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to