i40e: Add a FD flush counter to ethtool
authorAnjali Singhai Jain <anjali.singhai@intel.com>
Wed, 9 Jul 2014 07:46:23 +0000 (07:46 +0000)
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>
Wed, 27 Aug 2014 07:00:54 +0000 (00:00 -0700)
This helps know how many times the interface had to flush and replay FD
filter table, which gives an indication on how often we are getting FD
table full situation.

Also check on certain pf states before proceeding to add or delete
filters since we can't add or delete filters if we are in those states.

Change-ID: I97f5bbbea7146833ea61af0e08ea794fccba1780
Signed-off-by: Anjali Singhai Jain <anjali.singhai@intel.com>
Tested-by: Jim Young <jamesx.m.young@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 0c6a9b97f7e2a5060430396359c4377b2681c4e0..85269509f420ebe1628257bfb988ea59ba0376a2 100644 (file)
@@ -252,6 +252,7 @@ struct i40e_pf {
        u16 fd_sb_cnt_idx;
        u16 fd_atr_cnt_idx;
        unsigned long fd_flush_timestamp;
+       u32 fd_flush_cnt;
        u32 fd_add_err;
        u32 fd_atr_cnt;
        u32 fd_tcp_rule;
index 7204e293dc71d39cfc2c86ddec91439f0135cf87..571d527e7920754be4d796ff5f9b16996abb260e 100644 (file)
@@ -145,6 +145,7 @@ static struct i40e_stats i40e_gstrings_stats[] = {
        I40E_PF_STAT("rx_jabber", stats.rx_jabber),
        I40E_PF_STAT("VF_admin_queue_requests", vf_aq_requests),
        I40E_PF_STAT("rx_hwtstamp_cleared", rx_hwtstamp_cleared),
+       I40E_PF_STAT("fdir_flush_cnt", fd_flush_cnt),
        I40E_PF_STAT("fdir_atr_match", stats.fd_atr_match),
        I40E_PF_STAT("fdir_sb_match", stats.fd_sb_match),
 
@@ -1977,6 +1978,10 @@ static int i40e_del_fdir_entry(struct i40e_vsi *vsi,
        struct i40e_pf *pf = vsi->back;
        int ret = 0;
 
+       if (test_bit(__I40E_RESET_RECOVERY_PENDING, &pf->state) ||
+           test_bit(__I40E_RESET_INTR_RECEIVED, &pf->state))
+               return -EBUSY;
+
        if (test_bit(__I40E_FD_FLUSH_REQUESTED, &pf->state))
                return -EBUSY;
 
@@ -2013,6 +2018,10 @@ static int i40e_add_fdir_ethtool(struct i40e_vsi *vsi,
        if (pf->auto_disable_flags & I40E_FLAG_FD_SB_ENABLED)
                return -ENOSPC;
 
+       if (test_bit(__I40E_RESET_RECOVERY_PENDING, &pf->state) ||
+           test_bit(__I40E_RESET_INTR_RECEIVED, &pf->state))
+               return -EBUSY;
+
        if (test_bit(__I40E_FD_FLUSH_REQUESTED, &pf->state))
                return -EBUSY;
 
index cab9c9e3e694039b0ac207c5671c1436561729bd..712a23b926b31ea7074de06bd2f088123718cfa2 100644 (file)
@@ -5189,6 +5189,7 @@ static void i40e_fdir_flush_and_replay(struct i40e_pf *pf)
                wr32(&pf->hw, I40E_PFQF_CTL_1,
                     I40E_PFQF_CTL_1_CLEARFDTABLE_MASK);
                i40e_flush(&pf->hw);
+               pf->fd_flush_cnt++;
                pf->fd_add_err = 0;
                do {
                        /* Check FD flush status every 5-6msec */