i40e: Prevent link flow control settings when PFC is enabled
authorNeerav Parikh <neerav.parikh@intel.com>
Wed, 12 Nov 2014 00:18:57 +0000 (00:18 +0000)
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>
Tue, 18 Nov 2014 09:09:27 +0000 (01:09 -0800)
When PFC is enabled we should not proceed with setting the link flow control
parameters.  Also, always report the link flow Tx/Rx settings as off when
PFC is enabled.

Change-ID: Ib09ec58afdf0b2e587ac9d8851a5c80ad58206c4
Signed-off-by: Neerav Parikh <neerav.parikh@intel.com>
Tested-By: Jack Morgan <jack.morgan@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
drivers/net/ethernet/intel/i40e/i40e_ethtool.c

index afad5aa5a12b5efc4ac392940044242215f4473a..bb1698a7b3d125a5e8bc7839d3aa4cfb3c79318c 100644 (file)
@@ -644,11 +644,19 @@ static void i40e_get_pauseparam(struct net_device *netdev,
        struct i40e_pf *pf = np->vsi->back;
        struct i40e_hw *hw = &pf->hw;
        struct i40e_link_status *hw_link_info = &hw->phy.link_info;
+       struct i40e_dcbx_config *dcbx_cfg = &hw->local_dcbx_config;
 
        pause->autoneg =
                ((hw_link_info->an_info & I40E_AQ_AN_COMPLETED) ?
                  AUTONEG_ENABLE : AUTONEG_DISABLE);
 
+       /* PFC enabled so report LFC as off */
+       if (dcbx_cfg->pfc.pfcenable) {
+               pause->rx_pause = 0;
+               pause->tx_pause = 0;
+               return;
+       }
+
        if (hw->fc.current_mode == I40E_FC_RX_PAUSE) {
                pause->rx_pause = 1;
        } else if (hw->fc.current_mode == I40E_FC_TX_PAUSE) {
@@ -672,6 +680,7 @@ static int i40e_set_pauseparam(struct net_device *netdev,
        struct i40e_vsi *vsi = np->vsi;
        struct i40e_hw *hw = &pf->hw;
        struct i40e_link_status *hw_link_info = &hw->phy.link_info;
+       struct i40e_dcbx_config *dcbx_cfg = &hw->local_dcbx_config;
        bool link_up = hw_link_info->link_info & I40E_AQ_LINK_UP;
        i40e_status status;
        u8 aq_failures;
@@ -693,8 +702,9 @@ static int i40e_set_pauseparam(struct net_device *netdev,
                netdev_info(netdev, "Autoneg did not complete so changing settings may not result in an actual change.\n");
        }
 
-       if (hw->fc.current_mode == I40E_FC_PFC) {
-               netdev_info(netdev, "Priority flow control enabled. Cannot set link flow control.\n");
+       if (dcbx_cfg->pfc.pfcenable) {
+               netdev_info(netdev,
+                           "Priority flow control enabled. Cannot set link flow control.\n");
                return -EOPNOTSUPP;
        }