blob: 5e086bff49daed15b879be8b9f9f6b692c667159 [file] [log] [blame]
--- a/drivers/net/ethernet/intel/igb/igb_main.c
+++ b/drivers/net/ethernet/intel/igb/igb_main.c
@@ -8013,6 +8013,7 @@ static int igb_ndo_set_vf_bw(struct net_
if (hw->mac.type != e1000_82576)
return -EOPNOTSUPP;
+#if LINUX_VERSION_IS_GEQ(3,16,0)
if (min_tx_rate)
return -EINVAL;
@@ -8026,7 +8027,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 /* LINUX_VERSION_IS_GEQ(3,16,0) */
return 0;
}