i40e: Strip VEB stats if they are disabled in HW
authorAnjali Singhai Jain <anjali.singhai@intel.com>
Thu, 23 Jul 2015 20:54:40 +0000 (16:54 -0400)
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>
Wed, 30 Sep 2015 12:35:45 +0000 (05:35 -0700)
Due to performance reasons, VEB stats have been disabled in the hw. This
patch adds code to check for that condition before accumulating these
stats.

Change-ID: I7d805669476fedabb073790403703798ae5d878e
Signed-off-by: Anjali Singhai Jain <anjali.singhai@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
drivers/net/ethernet/intel/i40e/i40e.h
drivers/net/ethernet/intel/i40e/i40e_ethtool.c
drivers/net/ethernet/intel/i40e/i40e_main.c

index 0044cb062f4fd1224521da59197312a46cb3a8ed..f6d97ad811bb93b4db48bcbb826c9fd25ea9de2b 100644 (file)
@@ -325,6 +325,7 @@ struct i40e_pf {
 #define I40E_FLAG_OUTER_UDP_CSUM_CAPABLE       BIT_ULL(33)
 #define I40E_FLAG_128_QP_RSS_CAPABLE           BIT_ULL(34)
 #define I40E_FLAG_WB_ON_ITR_CAPABLE            BIT_ULL(35)
+#define I40E_FLAG_VEB_STATS_ENABLED            BIT_ULL(37)
 #define I40E_FLAG_MULTIPLE_TCP_UDP_RSS_PCTYPE  BIT_ULL(38)
 #define I40E_FLAG_VEB_MODE_ENABLED             BIT_ULL(40)
 
index dd2b6208d91abaea87d2c84c6b57ff685131e894..1345de2ef614787efb283a0fe33817c0075753c0 100644 (file)
@@ -1264,7 +1264,8 @@ static int i40e_get_sset_count(struct net_device *netdev, int sset)
                if (vsi == pf->vsi[pf->lan_vsi] && pf->hw.partition_id == 1) {
                        int len = I40E_PF_STATS_LEN(netdev);
 
-                       if (pf->lan_veb != I40E_NO_VEB)
+                       if ((pf->lan_veb != I40E_NO_VEB) &&
+                           (pf->flags & I40E_FLAG_VEB_STATS_ENABLED))
                                len += I40E_VEB_STATS_TOTAL;
                        return len;
                } else {
@@ -1337,7 +1338,8 @@ static void i40e_get_ethtool_stats(struct net_device *netdev,
        if (vsi != pf->vsi[pf->lan_vsi] || pf->hw.partition_id != 1)
                return;
 
-       if (pf->lan_veb != I40E_NO_VEB) {
+       if ((pf->lan_veb != I40E_NO_VEB) &&
+           (pf->flags & I40E_FLAG_VEB_STATS_ENABLED)) {
                struct i40e_veb *veb = pf->veb[pf->lan_veb];
                for (j = 0; j < I40E_VEB_STATS_LEN; j++) {
                        p = (char *)veb;
@@ -1410,7 +1412,8 @@ static void i40e_get_strings(struct net_device *netdev, u32 stringset,
                if (vsi != pf->vsi[pf->lan_vsi] || pf->hw.partition_id != 1)
                        return;
 
-               if (pf->lan_veb != I40E_NO_VEB) {
+               if ((pf->lan_veb != I40E_NO_VEB) &&
+                   (pf->flags & I40E_FLAG_VEB_STATS_ENABLED)) {
                        for (i = 0; i < I40E_VEB_STATS_LEN; i++) {
                                snprintf(p, ETH_GSTRING_LEN, "veb.%s",
                                        i40e_gstrings_veb_stats[i].stat_string);
index 8952ab76699214cd9765cdb889b50322223de7ae..43e21bd0cec340580a1dd1502d0daf6a4efd9f7a 100644 (file)
@@ -5907,10 +5907,12 @@ static void i40e_watchdog_subtask(struct i40e_pf *pf)
                if (pf->vsi[i] && pf->vsi[i]->netdev)
                        i40e_update_stats(pf->vsi[i]);
 
-       /* Update the stats for the active switching components */
-       for (i = 0; i < I40E_MAX_VEB; i++)
-               if (pf->veb[i])
-                       i40e_update_veb_stats(pf->veb[i]);
+       if (pf->flags & I40E_FLAG_VEB_STATS_ENABLED) {
+               /* Update the stats for the active switching components */
+               for (i = 0; i < I40E_MAX_VEB; i++)
+                       if (pf->veb[i])
+                               i40e_update_veb_stats(pf->veb[i]);
+       }
 
        i40e_ptp_rx_hang(pf->vsi[pf->lan_vsi]);
 }
@@ -7998,6 +8000,9 @@ static int i40e_sw_init(struct i40e_pf *pf)
        pf->lan_veb = I40E_NO_VEB;
        pf->lan_vsi = I40E_NO_VSI;
 
+       /* By default FW has this off for performance reasons */
+       pf->flags &= ~I40E_FLAG_VEB_STATS_ENABLED;
+
        /* set up queue assignment tracking */
        size = sizeof(struct i40e_lump_tracking)
                + (sizeof(u16) * pf->hw.func_caps.num_tx_qp);