aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
diff options
context:
space:
mode:
authorAlexander Duyck <alexander.h.duyck@intel.com>2012-02-11 02:18:57 -0500
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>2012-03-19 16:43:34 -0400
commit567d2de291b5ddb83654c5e87c14b4c6fa7216ed (patch)
treedb6880b7bf8ced1a59c1ea47d60ae22408292914 /drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
parentef6afc0caceebb3b49cd384f8c634f89f5089997 (diff)
ixgbe: Correct flag values set by ixgbe_fix_features
This patch replaces the variable name data with the variable name features for ixgbe_fix_features and ixgbe_set_features. This helps to make some issues more obvious such as the fact that we were disabling Rx VLAN tag stripping when we should have been forcing it to be enabled when DCB is enabled. In addition there was deprecated code present that was disabling the LRO flag if we had the itr value set too low. I have updated this logic so that we will now allow the LRO flag to be set, but will not enable RSC until the rx-usecs value is high enough to allow enough time for Rx packet coalescing. Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com> Tested-by: Stephen Ko <stephen.s.ko@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Diffstat (limited to 'drivers/net/ethernet/intel/ixgbe/ixgbe_main.c')
-rw-r--r--drivers/net/ethernet/intel/ixgbe/ixgbe_main.c75
1 files changed, 36 insertions, 39 deletions
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
index 5c7e7d83d394..e9d9fca084a9 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
@@ -7492,54 +7492,52 @@ void ixgbe_do_reset(struct net_device *netdev)
7492} 7492}
7493 7493
7494static netdev_features_t ixgbe_fix_features(struct net_device *netdev, 7494static netdev_features_t ixgbe_fix_features(struct net_device *netdev,
7495 netdev_features_t data) 7495 netdev_features_t features)
7496{ 7496{
7497 struct ixgbe_adapter *adapter = netdev_priv(netdev); 7497 struct ixgbe_adapter *adapter = netdev_priv(netdev);
7498 7498
7499#ifdef CONFIG_DCB 7499#ifdef CONFIG_DCB
7500 if (adapter->flags & IXGBE_FLAG_DCB_ENABLED) 7500 if (adapter->flags & IXGBE_FLAG_DCB_ENABLED)
7501 data &= ~NETIF_F_HW_VLAN_RX; 7501 features &= ~NETIF_F_HW_VLAN_RX;
7502#endif 7502#endif
7503 7503
7504 /* return error if RXHASH is being enabled when RSS is not supported */ 7504 /* return error if RXHASH is being enabled when RSS is not supported */
7505 if (!(adapter->flags & IXGBE_FLAG_RSS_ENABLED)) 7505 if (!(adapter->flags & IXGBE_FLAG_RSS_ENABLED))
7506 data &= ~NETIF_F_RXHASH; 7506 features &= ~NETIF_F_RXHASH;
7507 7507
7508 /* If Rx checksum is disabled, then RSC/LRO should also be disabled */ 7508 /* If Rx checksum is disabled, then RSC/LRO should also be disabled */
7509 if (!(data & NETIF_F_RXCSUM)) 7509 if (!(features & NETIF_F_RXCSUM))
7510 data &= ~NETIF_F_LRO; 7510 features &= ~NETIF_F_LRO;
7511 7511
7512 /* Turn off LRO if not RSC capable or invalid ITR settings */ 7512 /* Turn off LRO if not RSC capable */
7513 if (!(adapter->flags2 & IXGBE_FLAG2_RSC_CAPABLE)) { 7513 if (!(adapter->flags2 & IXGBE_FLAG2_RSC_CAPABLE))
7514 data &= ~NETIF_F_LRO; 7514 features &= ~NETIF_F_LRO;
7515 } else if (!(adapter->flags2 & IXGBE_FLAG2_RSC_ENABLED) && 7515
7516 (adapter->rx_itr_setting != 1 &&
7517 adapter->rx_itr_setting > IXGBE_MAX_RSC_INT_RATE)) {
7518 data &= ~NETIF_F_LRO;
7519 e_info(probe, "rx-usecs set too low, not enabling RSC\n");
7520 }
7521 7516
7522 return data; 7517 return features;
7523} 7518}
7524 7519
7525static int ixgbe_set_features(struct net_device *netdev, 7520static int ixgbe_set_features(struct net_device *netdev,
7526 netdev_features_t data) 7521 netdev_features_t features)
7527{ 7522{
7528 struct ixgbe_adapter *adapter = netdev_priv(netdev); 7523 struct ixgbe_adapter *adapter = netdev_priv(netdev);
7529 netdev_features_t changed = netdev->features ^ data; 7524 netdev_features_t changed = netdev->features ^ features;
7530 bool need_reset = false; 7525 bool need_reset = false;
7531 7526
7532 /* Make sure RSC matches LRO, reset if change */ 7527 /* Make sure RSC matches LRO, reset if change */
7533 if (!!(data & NETIF_F_LRO) != 7528 if (!(features & NETIF_F_LRO)) {
7534 !!(adapter->flags2 & IXGBE_FLAG2_RSC_ENABLED)) { 7529 if (adapter->flags2 & IXGBE_FLAG2_RSC_ENABLED)
7535 adapter->flags2 ^= IXGBE_FLAG2_RSC_ENABLED;
7536 switch (adapter->hw.mac.type) {
7537 case ixgbe_mac_X540:
7538 case ixgbe_mac_82599EB:
7539 need_reset = true; 7530 need_reset = true;
7540 break; 7531 adapter->flags2 &= ~IXGBE_FLAG2_RSC_ENABLED;
7541 default: 7532 } else if ((adapter->flags2 & IXGBE_FLAG2_RSC_CAPABLE) &&
7542 break; 7533 !(adapter->flags2 & IXGBE_FLAG2_RSC_ENABLED)) {
7534 if (adapter->rx_itr_setting == 1 ||
7535 adapter->rx_itr_setting > IXGBE_MIN_RSC_ITR) {
7536 adapter->flags2 |= IXGBE_FLAG2_RSC_ENABLED;
7537 need_reset = true;
7538 } else if ((changed ^ features) & NETIF_F_LRO) {
7539 e_info(probe, "rx-usecs set too low, "
7540 "disabling RSC\n");
7543 } 7541 }
7544 } 7542 }
7545 7543
@@ -7547,31 +7545,30 @@ static int ixgbe_set_features(struct net_device *netdev,
7547 * Check if Flow Director n-tuple support was enabled or disabled. If 7545 * Check if Flow Director n-tuple support was enabled or disabled. If
7548 * the state changed, we need to reset. 7546 * the state changed, we need to reset.
7549 */ 7547 */
7550 if (!(adapter->flags & IXGBE_FLAG_FDIR_PERFECT_CAPABLE)) { 7548 if (!(features & NETIF_F_NTUPLE)) {
7551 /* turn off ATR, enable perfect filters and reset */ 7549 if (adapter->flags & IXGBE_FLAG_FDIR_PERFECT_CAPABLE) {
7552 if (data & NETIF_F_NTUPLE) { 7550 /* turn off Flow Director, set ATR and reset */
7553 adapter->flags &= ~IXGBE_FLAG_FDIR_HASH_CAPABLE; 7551 if ((adapter->flags & IXGBE_FLAG_RSS_ENABLED) &&
7554 adapter->flags |= IXGBE_FLAG_FDIR_PERFECT_CAPABLE; 7552 !(adapter->flags & IXGBE_FLAG_DCB_ENABLED))
7553 adapter->flags |= IXGBE_FLAG_FDIR_HASH_CAPABLE;
7555 need_reset = true; 7554 need_reset = true;
7556 } 7555 }
7557 } else if (!(data & NETIF_F_NTUPLE)) {
7558 /* turn off Flow Director, set ATR and reset */
7559 adapter->flags &= ~IXGBE_FLAG_FDIR_PERFECT_CAPABLE; 7556 adapter->flags &= ~IXGBE_FLAG_FDIR_PERFECT_CAPABLE;
7560 if ((adapter->flags & IXGBE_FLAG_RSS_ENABLED) && 7557 } else if (!(adapter->flags & IXGBE_FLAG_FDIR_PERFECT_CAPABLE)) {
7561 !(adapter->flags & IXGBE_FLAG_DCB_ENABLED)) 7558 /* turn off ATR, enable perfect filters and reset */
7562 adapter->flags |= IXGBE_FLAG_FDIR_HASH_CAPABLE; 7559 adapter->flags &= ~IXGBE_FLAG_FDIR_HASH_CAPABLE;
7560 adapter->flags |= IXGBE_FLAG_FDIR_PERFECT_CAPABLE;
7563 need_reset = true; 7561 need_reset = true;
7564 } 7562 }
7565 7563
7566 if (changed & NETIF_F_RXALL) 7564 if (changed & NETIF_F_RXALL)
7567 need_reset = true; 7565 need_reset = true;
7568 7566
7569 netdev->features = data; 7567 netdev->features = features;
7570 if (need_reset) 7568 if (need_reset)
7571 ixgbe_do_reset(netdev); 7569 ixgbe_do_reset(netdev);
7572 7570
7573 return 0; 7571 return 0;
7574
7575} 7572}
7576 7573
7577static const struct net_device_ops ixgbe_netdev_ops = { 7574static const struct net_device_ops ixgbe_netdev_ops = {
@@ -7611,7 +7608,7 @@ static const struct net_device_ops ixgbe_netdev_ops = {
7611}; 7608};
7612 7609
7613static void __devinit ixgbe_probe_vf(struct ixgbe_adapter *adapter, 7610static void __devinit ixgbe_probe_vf(struct ixgbe_adapter *adapter,
7614 const struct ixgbe_info *ii) 7611 const struct ixgbe_info *ii)
7615{ 7612{
7616#ifdef CONFIG_PCI_IOV 7613#ifdef CONFIG_PCI_IOV
7617 struct ixgbe_hw *hw = &adapter->hw; 7614 struct ixgbe_hw *hw = &adapter->hw;