summaryrefslogtreecommitdiff
path: root/patches/collateral-evolutions/network/0043-ndo_set_vf_rate/igb.patch
diff options
context:
space:
mode:
authorHauke Mehrtens <hauke@hauke-m.de>2014-06-08 17:49:43 +0200
committerHauke Mehrtens <hauke@hauke-m.de>2014-06-16 20:23:38 +0200
commit4d35cb8518ca9ef0c179d322487b131f3c9d20d7 (patch)
treef6dfd8e16aadf4cc888afc8f1c56c763086a7c47 /patches/collateral-evolutions/network/0043-ndo_set_vf_rate/igb.patch
parent06c4c951bcb7d584dba92d3e7762ff93505cd912 (diff)
backports: handle rename of ndo_set_vf_tx_rate to ndo_set_vf_rate
This member of struct net_device_ops was renamed and the function signature was also changed a bit. Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Diffstat (limited to 'patches/collateral-evolutions/network/0043-ndo_set_vf_rate/igb.patch')
-rw-r--r--patches/collateral-evolutions/network/0043-ndo_set_vf_rate/igb.patch78
1 files changed, 78 insertions, 0 deletions
diff --git a/patches/collateral-evolutions/network/0043-ndo_set_vf_rate/igb.patch b/patches/collateral-evolutions/network/0043-ndo_set_vf_rate/igb.patch
new file mode 100644
index 00000000..59a22e54
--- /dev/null
+++ b/patches/collateral-evolutions/network/0043-ndo_set_vf_rate/igb.patch
@@ -0,0 +1,78 @@
+--- a/drivers/net/ethernet/intel/igb/igb_main.c
++++ b/drivers/net/ethernet/intel/igb/igb_main.c
+@@ -177,7 +177,11 @@ static void igb_restore_vf_multicasts(st
+ static int igb_ndo_set_vf_mac(struct net_device *netdev, int vf, u8 *mac);
+ static int igb_ndo_set_vf_vlan(struct net_device *netdev,
+ int vf, u16 vlan, u8 qos);
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,16,0)
+ static int igb_ndo_set_vf_bw(struct net_device *, int, int, int);
++#else
++static int igb_ndo_set_vf_bw(struct net_device *, int, int);
++#endif
+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0)
+ static int igb_ndo_set_vf_spoofchk(struct net_device *netdev, int vf,
+ bool setting);
+@@ -2102,7 +2106,11 @@ static const struct net_device_ops igb_n
+ .ndo_vlan_rx_kill_vid = igb_vlan_rx_kill_vid,
+ .ndo_set_vf_mac = igb_ndo_set_vf_mac,
+ .ndo_set_vf_vlan = igb_ndo_set_vf_vlan,
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,16,0)
+ .ndo_set_vf_rate = igb_ndo_set_vf_bw,
++#else
++ .ndo_set_vf_tx_rate = igb_ndo_set_vf_bw,
++#endif
+ #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) */
+@@ -7929,8 +7937,12 @@ static void igb_check_vf_rate_limit(stru
+ }
+ }
+
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,16,0)
+ static int igb_ndo_set_vf_bw(struct net_device *netdev, int vf,
+ int min_tx_rate, int max_tx_rate)
++#else
++static int igb_ndo_set_vf_bw(struct net_device *netdev, int vf, int tx_rate)
++#endif
+ {
+ struct igb_adapter *adapter = netdev_priv(netdev);
+ struct e1000_hw *hw = &adapter->hw;
+@@ -7939,6 +7951,7 @@ static int igb_ndo_set_vf_bw(struct net_
+ if (hw->mac.type != e1000_82576)
+ return -EOPNOTSUPP;
+
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,16,0)
+ if (min_tx_rate)
+ return -EINVAL;
+
+@@ -7952,7 +7965,17 @@ static int igb_ndo_set_vf_bw(struct net_
+ adapter->vf_rate_link_speed = actual_link_speed;
+ adapter->vf_data[vf].tx_rate = (u16)max_tx_rate;
+ igb_set_vf_rate_limit(hw, vf, max_tx_rate, actual_link_speed);
++#else
++ actual_link_speed = igb_link_mbps(adapter->link_speed);
++ if ((vf >= adapter->vfs_allocated_count) ||
++ (!(rd32(E1000_STATUS) & E1000_STATUS_LU)) ||
++ (tx_rate < 0) || (tx_rate > actual_link_speed))
++ return -EINVAL;
+
++ adapter->vf_rate_link_speed = actual_link_speed;
++ adapter->vf_data[vf].tx_rate = (u16)tx_rate;
++ igb_set_vf_rate_limit(hw, vf, tx_rate, actual_link_speed);
++#endif
+ return 0;
+ }
+
+@@ -7993,8 +8016,12 @@ static int igb_ndo_get_vf_config(struct
+ return -EINVAL;
+ ivi->vf = vf;
+ memcpy(&ivi->mac, adapter->vf_data[vf].vf_mac_addresses, ETH_ALEN);
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,16,0)
+ ivi->max_tx_rate = adapter->vf_data[vf].tx_rate;
+ ivi->min_tx_rate = 0;
++#else
++ ivi->tx_rate = adapter->vf_data[vf].tx_rate;
++#endif
+ 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)