]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
ixgbe: fix flags relating to perfect filters to support coexistence
authorAlexander Duyck <alexander.h.duyck@intel.com>
Fri, 20 May 2011 07:36:17 +0000 (07:36 +0000)
committerJoe Jin <joe.jin@oracle.com>
Fri, 3 Feb 2012 01:13:21 +0000 (09:13 +0800)
I am removing the requirement that Ntuple filters have the same
number of queues and requirements as ATR.  As a result this change will
make it so that all the Ntuple flag does is disable ATR for now.

This change fixes an issue in which we were incorrectly re-enabling ATR
when we exited perfect filter mode.  This was due to the fact that the
logic assumed RSS and DCB were mutually exclusive which is no longer the
case.

To correct this we just need to add a check to guarantee DCB is disabled
before re-enabling ATR.

Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
Tested-by: Ross Brattain <ross.b.brattain@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
(cherry picked from commit 03ecf91aae757eeb70763a3393227c4597c87b23)

Signed-off-by: Joe Jin <joe.jin@oracle.com>
drivers/net/ixgbe/ixgbe_dcb_nl.c
drivers/net/ixgbe/ixgbe_ethtool.c
drivers/net/ixgbe/ixgbe_main.c

index 08c7aebe99f560ecbb8921e8011f947b6f397dc7..bd2d75265389720dae49b49e8024380bce29f424 100644 (file)
@@ -114,11 +114,12 @@ static u8 ixgbe_dcbnl_set_state(struct net_device *netdev, u8 state)
        u8 err = 0;
        struct ixgbe_adapter *adapter = netdev_priv(netdev);
 
+       /* verify there is something to do, if not then exit */
+       if (!!state != !(adapter->flags & IXGBE_FLAG_DCB_ENABLED))
+               return err;
+
        if (state > 0) {
                /* Turn on DCB */
-               if (adapter->flags & IXGBE_FLAG_DCB_ENABLED)
-                       goto out;
-
                if (!(adapter->flags & IXGBE_FLAG_MSIX_ENABLED)) {
                        e_err(drv, "Enable failed, needs MSI-X\n");
                        err = 1;
@@ -143,9 +144,6 @@ static u8 ixgbe_dcbnl_set_state(struct net_device *netdev, u8 state)
                ixgbe_setup_tc(netdev, MAX_TRAFFIC_CLASS);
        } else {
                /* Turn off DCB */
-               if (!(adapter->flags & IXGBE_FLAG_DCB_ENABLED))
-                       goto out;
-
                adapter->hw.fc.requested_mode = adapter->last_lfc_mode;
                adapter->temp_dcb_cfg.pfc_mode_enable = false;
                adapter->dcb_cfg.pfc_mode_enable = false;
@@ -153,7 +151,8 @@ static u8 ixgbe_dcbnl_set_state(struct net_device *netdev, u8 state)
                switch (adapter->hw.mac.type) {
                case ixgbe_mac_82599EB:
                case ixgbe_mac_X540:
-                       adapter->flags |= IXGBE_FLAG_FDIR_HASH_CAPABLE;
+                       if (!(adapter->flags & IXGBE_FLAG_FDIR_PERFECT_CAPABLE))
+                               adapter->flags |= IXGBE_FLAG_FDIR_HASH_CAPABLE;
                        break;
                default:
                        break;
index 5904f68887da7c939eecba5291a138e6c94acbb0..c2dd1c46433f4312808384bfa81c0b0ef226265d 100644 (file)
@@ -2314,20 +2314,20 @@ static int ixgbe_set_flags(struct net_device *netdev, u32 data)
         * Check if Flow Director n-tuple support was enabled or disabled.  If
         * the state changed, we need to reset.
         */
-       if ((adapter->flags & IXGBE_FLAG_FDIR_PERFECT_CAPABLE) &&
-           (!(data & ETH_FLAG_NTUPLE))) {
-               /* turn off Flow Director perfect, set hash and reset */
+       if (!(adapter->flags & IXGBE_FLAG_FDIR_PERFECT_CAPABLE)) {
+               /* turn off ATR, enable perfect filters and reset */
+               if (data & ETH_FLAG_NTUPLE) {
+                       adapter->flags &= ~IXGBE_FLAG_FDIR_HASH_CAPABLE;
+                       adapter->flags |= IXGBE_FLAG_FDIR_PERFECT_CAPABLE;
+                       need_reset = true;
+               }
+       } else if (!(data & ETH_FLAG_NTUPLE)) {
+               /* turn off Flow Director, set ATR and reset */
                adapter->flags &= ~IXGBE_FLAG_FDIR_PERFECT_CAPABLE;
-               adapter->flags |= IXGBE_FLAG_FDIR_HASH_CAPABLE;
-               need_reset = true;
-       } else if ((!(adapter->flags & IXGBE_FLAG_FDIR_PERFECT_CAPABLE)) &&
-                  (data & ETH_FLAG_NTUPLE)) {
-               /* turn off Flow Director hash, enable perfect and reset */
-               adapter->flags &= ~IXGBE_FLAG_FDIR_HASH_CAPABLE;
-               adapter->flags |= IXGBE_FLAG_FDIR_PERFECT_CAPABLE;
+               if ((adapter->flags & IXGBE_FLAG_RSS_ENABLED) &&
+                   !(adapter->flags & IXGBE_FLAG_DCB_ENABLED))
+                       adapter->flags |= IXGBE_FLAG_FDIR_HASH_CAPABLE;
                need_reset = true;
-       } else {
-               /* no state change */
        }
 
        if (need_reset) {
index c9be5fd2fbca2d19f5161fb65ae667e14075c605..f4706338a45d4874d387f02db6bc6bbc05b40903 100644 (file)
@@ -1611,9 +1611,8 @@ static void ixgbe_configure_msix(struct ixgbe_adapter *adapter)
                        q_vector->eitr = adapter->rx_eitr_param;
 
                ixgbe_write_eitr(q_vector);
-               /* If Flow Director is enabled, set interrupt affinity */
-               if ((adapter->flags & IXGBE_FLAG_FDIR_HASH_CAPABLE) ||
-                   (adapter->flags & IXGBE_FLAG_FDIR_PERFECT_CAPABLE)) {
+               /* If ATR is enabled, set interrupt affinity */
+               if (adapter->flags & IXGBE_FLAG_FDIR_HASH_CAPABLE) {
                        /*
                         * Allocate the affinity_hint cpumask, assign the mask
                         * for this vector, and set our affinity_hint for
@@ -2524,8 +2523,7 @@ static inline void ixgbe_irq_enable(struct ixgbe_adapter *adapter, bool queues,
        default:
                break;
        }
-       if (adapter->flags & IXGBE_FLAG_FDIR_HASH_CAPABLE ||
-           adapter->flags & IXGBE_FLAG_FDIR_PERFECT_CAPABLE)
+       if (adapter->flags & IXGBE_FLAG_FDIR_HASH_CAPABLE)
                mask |= IXGBE_EIMS_FLOW_DIR;
 
        IXGBE_WRITE_REG(&adapter->hw, IXGBE_EIMS, mask);
@@ -3823,8 +3821,6 @@ static void ixgbe_configure(struct ixgbe_adapter *adapter)
                        adapter->tx_ring[i]->atr_sample_rate =
                                                       adapter->atr_sample_rate;
                ixgbe_init_fdir_signature_82599(hw, adapter->fdir_pballoc);
-       } else if (adapter->flags & IXGBE_FLAG_FDIR_PERFECT_CAPABLE) {
-               ixgbe_init_fdir_perfect_82599(hw, adapter->fdir_pballoc);
        }
        ixgbe_configure_virtualization(adapter);
 
@@ -4390,15 +4386,13 @@ static inline bool ixgbe_set_fdir_queues(struct ixgbe_adapter *adapter)
        f_fdir->mask = 0;
 
        /* Flow Director must have RSS enabled */
-       if (adapter->flags & IXGBE_FLAG_RSS_ENABLED &&
-           ((adapter->flags & IXGBE_FLAG_FDIR_HASH_CAPABLE ||
-            (adapter->flags & IXGBE_FLAG_FDIR_PERFECT_CAPABLE)))) {
+       if ((adapter->flags & IXGBE_FLAG_RSS_ENABLED) &&
+           (adapter->flags & IXGBE_FLAG_FDIR_HASH_CAPABLE)) {
                adapter->num_tx_queues = f_fdir->indices;
                adapter->num_rx_queues = f_fdir->indices;
                ret = true;
        } else {
                adapter->flags &= ~IXGBE_FLAG_FDIR_HASH_CAPABLE;
-               adapter->flags &= ~IXGBE_FLAG_FDIR_PERFECT_CAPABLE;
        }
        return ret;
 }
@@ -4428,12 +4422,12 @@ static inline bool ixgbe_set_fcoe_queues(struct ixgbe_adapter *adapter)
 
        if (adapter->flags & IXGBE_FLAG_RSS_ENABLED) {
                e_info(probe, "FCoE enabled with RSS\n");
-               if ((adapter->flags & IXGBE_FLAG_FDIR_HASH_CAPABLE) ||
-                   (adapter->flags & IXGBE_FLAG_FDIR_PERFECT_CAPABLE))
+               if (adapter->flags & IXGBE_FLAG_FDIR_HASH_CAPABLE)
                        ixgbe_set_fdir_queues(adapter);
                else
                        ixgbe_set_rss_queues(adapter);
        }
+
        /* adding FCoE rx rings to the end */
        f->mask = adapter->num_rx_queues;
        adapter->num_rx_queues += f->indices;
@@ -4726,9 +4720,8 @@ static inline bool ixgbe_cache_ring_fdir(struct ixgbe_adapter *adapter)
        int i;
        bool ret = false;
 
-       if (adapter->flags & IXGBE_FLAG_RSS_ENABLED &&
-           ((adapter->flags & IXGBE_FLAG_FDIR_HASH_CAPABLE) ||
-            (adapter->flags & IXGBE_FLAG_FDIR_PERFECT_CAPABLE))) {
+       if ((adapter->flags & IXGBE_FLAG_RSS_ENABLED) &&
+           (adapter->flags & IXGBE_FLAG_FDIR_HASH_CAPABLE)) {
                for (i = 0; i < adapter->num_rx_queues; i++)
                        adapter->rx_ring[i]->reg_idx = i;
                for (i = 0; i < adapter->num_tx_queues; i++)
@@ -4757,8 +4750,7 @@ static inline bool ixgbe_cache_ring_fcoe(struct ixgbe_adapter *adapter)
                return false;
 
        if (adapter->flags & IXGBE_FLAG_RSS_ENABLED) {
-               if ((adapter->flags & IXGBE_FLAG_FDIR_HASH_CAPABLE) ||
-                   (adapter->flags & IXGBE_FLAG_FDIR_PERFECT_CAPABLE))
+               if (adapter->flags & IXGBE_FLAG_FDIR_HASH_CAPABLE)
                        ixgbe_cache_ring_fdir(adapter);
                else
                        ixgbe_cache_ring_rss(adapter);
@@ -4938,14 +4930,12 @@ static int ixgbe_set_interrupt_capability(struct ixgbe_adapter *adapter)
 
        adapter->flags &= ~IXGBE_FLAG_DCB_ENABLED;
        adapter->flags &= ~IXGBE_FLAG_RSS_ENABLED;
-       if (adapter->flags & (IXGBE_FLAG_FDIR_HASH_CAPABLE |
-                             IXGBE_FLAG_FDIR_PERFECT_CAPABLE)) {
+       if (adapter->flags & IXGBE_FLAG_FDIR_HASH_CAPABLE) {
                e_err(probe,
-                     "Flow Director is not supported while multiple "
+                     "ATR is not supported while multiple "
                      "queues are disabled.  Disabling Flow Director\n");
        }
        adapter->flags &= ~IXGBE_FLAG_FDIR_HASH_CAPABLE;
-       adapter->flags &= ~IXGBE_FLAG_FDIR_PERFECT_CAPABLE;
        adapter->atr_sample_rate = 0;
        if (adapter->flags & IXGBE_FLAG_SRIOV_ENABLED)
                ixgbe_disable_sriov(adapter);