aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/intel
diff options
context:
space:
mode:
authorAnjali Singhai Jain <anjali.singhai@intel.com>2014-06-04 00:22:47 -0400
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>2014-06-26 07:45:30 -0400
commit129573883c5b39d978c4a7fbe513f8e54898e27e (patch)
tree8d7e8f6a4c264eccaa23f10776ee27667716a8d1 /drivers/net/ethernet/intel
parent12be846ddda83b9f641be6cdbfd6891594fda4ec (diff)
i40e: Fix the FD sideband logic to detect a FD table full condition
Hardware does not have a way of telling a PF how much of the global shared FD table space is still available or is consumed. Previously, every PF but PF0 would think there was still space available when there wasn't. The PFs would continue to try to add filters and fail. With this new logic if a filter programming error is detected we just check if we are close to the guaranteed space full and that can be used as a hint to say, there might not be space and we should turn off the features. This way we can turn off the feature in SW for all PFs in time. Change-ID: I725cb2fab16c033f883056362b4542c1400503c5 Signed-off-by: Anjali Singhai Jain <anjali.singhai@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Diffstat (limited to 'drivers/net/ethernet/intel')
-rw-r--r--drivers/net/ethernet/intel/i40e/i40e.h3
-rw-r--r--drivers/net/ethernet/intel/i40e/i40e_main.c20
-rw-r--r--drivers/net/ethernet/intel/i40e/i40e_txrx.c4
3 files changed, 20 insertions, 7 deletions
diff --git a/drivers/net/ethernet/intel/i40e/i40e.h b/drivers/net/ethernet/intel/i40e/i40e.h
index 2ec6e8a11ee1..0fbb32a8ad42 100644
--- a/drivers/net/ethernet/intel/i40e/i40e.h
+++ b/drivers/net/ethernet/intel/i40e/i40e.h
@@ -154,7 +154,7 @@ struct i40e_lump_tracking {
154#define I40E_DEFAULT_ATR_SAMPLE_RATE 20 154#define I40E_DEFAULT_ATR_SAMPLE_RATE 20
155#define I40E_FDIR_MAX_RAW_PACKET_SIZE 512 155#define I40E_FDIR_MAX_RAW_PACKET_SIZE 512
156#define I40E_FDIR_BUFFER_FULL_MARGIN 10 156#define I40E_FDIR_BUFFER_FULL_MARGIN 10
157#define I40E_FDIR_BUFFER_HEAD_ROOM 200 157#define I40E_FDIR_BUFFER_HEAD_ROOM 32
158 158
159enum i40e_fd_stat_idx { 159enum i40e_fd_stat_idx {
160 I40E_FD_STAT_ATR, 160 I40E_FD_STAT_ATR,
@@ -582,6 +582,7 @@ int i40e_add_del_fdir(struct i40e_vsi *vsi,
582 struct i40e_fdir_filter *input, bool add); 582 struct i40e_fdir_filter *input, bool add);
583void i40e_fdir_check_and_reenable(struct i40e_pf *pf); 583void i40e_fdir_check_and_reenable(struct i40e_pf *pf);
584int i40e_get_current_fd_count(struct i40e_pf *pf); 584int i40e_get_current_fd_count(struct i40e_pf *pf);
585int i40e_get_cur_guaranteed_fd_count(struct i40e_pf *pf);
585bool i40e_set_ntuple(struct i40e_pf *pf, netdev_features_t features); 586bool i40e_set_ntuple(struct i40e_pf *pf, netdev_features_t features);
586void i40e_set_ethtool_ops(struct net_device *netdev); 587void i40e_set_ethtool_ops(struct net_device *netdev);
587struct i40e_mac_filter *i40e_add_filter(struct i40e_vsi *vsi, 588struct i40e_mac_filter *i40e_add_filter(struct i40e_vsi *vsi,
diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c
index 5980d6b3fb1a..17b1295bf35a 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_main.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
@@ -4944,7 +4944,20 @@ static void i40e_service_event_complete(struct i40e_pf *pf)
4944} 4944}
4945 4945
4946/** 4946/**
4947 * i40e_get_current_fd_count - Get the count of FD filters programmed in the HW 4947 * i40e_get_cur_guaranteed_fd_count - Get the consumed guaranteed FD filters
4948 * @pf: board private structure
4949 **/
4950int i40e_get_cur_guaranteed_fd_count(struct i40e_pf *pf)
4951{
4952 int val, fcnt_prog;
4953
4954 val = rd32(&pf->hw, I40E_PFQF_FDSTAT);
4955 fcnt_prog = (val & I40E_PFQF_FDSTAT_GUARANT_CNT_MASK);
4956 return fcnt_prog;
4957}
4958
4959/**
4960 * i40e_get_current_fd_count - Get the count of total FD filters programmed
4948 * @pf: board private structure 4961 * @pf: board private structure
4949 **/ 4962 **/
4950int i40e_get_current_fd_count(struct i40e_pf *pf) 4963int i40e_get_current_fd_count(struct i40e_pf *pf)
@@ -4956,7 +4969,6 @@ int i40e_get_current_fd_count(struct i40e_pf *pf)
4956 I40E_PFQF_FDSTAT_BEST_CNT_SHIFT); 4969 I40E_PFQF_FDSTAT_BEST_CNT_SHIFT);
4957 return fcnt_prog; 4970 return fcnt_prog;
4958} 4971}
4959
4960/** 4972/**
4961 * i40e_fdir_check_and_reenable - Function to reenabe FD ATR or SB if disabled 4973 * i40e_fdir_check_and_reenable - Function to reenabe FD ATR or SB if disabled
4962 * @pf: board private structure 4974 * @pf: board private structure
@@ -4971,8 +4983,8 @@ void i40e_fdir_check_and_reenable(struct i40e_pf *pf)
4971 if ((pf->flags & I40E_FLAG_FD_ATR_ENABLED) && 4983 if ((pf->flags & I40E_FLAG_FD_ATR_ENABLED) &&
4972 (pf->flags & I40E_FLAG_FD_SB_ENABLED)) 4984 (pf->flags & I40E_FLAG_FD_SB_ENABLED))
4973 return; 4985 return;
4974 fcnt_prog = i40e_get_current_fd_count(pf); 4986 fcnt_prog = i40e_get_cur_guaranteed_fd_count(pf);
4975 fcnt_avail = i40e_get_fd_cnt_all(pf); 4987 fcnt_avail = pf->fdir_pf_filter_count;
4976 if (fcnt_prog < (fcnt_avail - I40E_FDIR_BUFFER_HEAD_ROOM)) { 4988 if (fcnt_prog < (fcnt_avail - I40E_FDIR_BUFFER_HEAD_ROOM)) {
4977 if ((pf->flags & I40E_FLAG_FD_SB_ENABLED) && 4989 if ((pf->flags & I40E_FLAG_FD_SB_ENABLED) &&
4978 (pf->auto_disable_flags & I40E_FLAG_FD_SB_ENABLED)) { 4990 (pf->auto_disable_flags & I40E_FLAG_FD_SB_ENABLED)) {
diff --git a/drivers/net/ethernet/intel/i40e/i40e_txrx.c b/drivers/net/ethernet/intel/i40e/i40e_txrx.c
index 4d96b743f991..c5749d6526ea 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_txrx.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_txrx.c
@@ -437,8 +437,8 @@ static void i40e_fd_handle_status(struct i40e_ring *rx_ring,
437 rx_desc->wb.qword0.hi_dword.fd_id); 437 rx_desc->wb.qword0.hi_dword.fd_id);
438 438
439 /* filter programming failed most likely due to table full */ 439 /* filter programming failed most likely due to table full */
440 fcnt_prog = i40e_get_current_fd_count(pf); 440 fcnt_prog = i40e_get_cur_guaranteed_fd_count(pf);
441 fcnt_avail = i40e_get_fd_cnt_all(pf); 441 fcnt_avail = pf->fdir_pf_filter_count;
442 /* If ATR is running fcnt_prog can quickly change, 442 /* If ATR is running fcnt_prog can quickly change,
443 * if we are very close to full, it makes sense to disable 443 * if we are very close to full, it makes sense to disable
444 * FD ATR/SB and then re-enable it when there is room. 444 * FD ATR/SB and then re-enable it when there is room.