All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
To: intel-wired-lan@osuosl.org
Subject: [Intel-wired-lan] [S87 v5 4/7] i40e: track filter type statistics when deleting invalid filters
Date: Thu,  8 Mar 2018 14:52:08 -0800	[thread overview]
Message-ID: <20180308225211.12254-4-jeffrey.t.kirsher@intel.com> (raw)
In-Reply-To: <20180308225211.12254-1-jeffrey.t.kirsher@intel.com>

From: Jacob Keller <jacob.e.keller@intel.com>

When hardware has trouble with a particular filter, we delete it from
the list. Unfortunately, we did not properly update the per-filter
statistic when doing so.

Create a helper function to handle this, and properly reduce the
necessary counter so that it tracks the number of active filters
properly.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
---
 drivers/net/ethernet/intel/i40e/i40e_main.c | 56 ++++++++++++++++++++++++-----
 1 file changed, 48 insertions(+), 8 deletions(-)

diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c
index 183c8b84b7ea..0b45650b7e31 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_main.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
@@ -8136,6 +8136,51 @@ u32 i40e_get_global_fd_count(struct i40e_pf *pf)
 	return fcnt_prog;
 }
 
+/**
+ * i40e_delete_invalid_filter - Delete an invalid FDIR filter
+ * @pf: board private structure
+ * @filter: FDir filter to remove
+ */
+static void i40e_delete_invalid_filter(struct i40e_pf *pf,
+				       struct i40e_fdir_filter *filter)
+{
+	/* Update counters */
+	pf->fdir_pf_active_filters--;
+	pf->fd_inv = 0;
+
+	switch (filter->flow_type) {
+	case TCP_V4_FLOW:
+		pf->fd_tcp4_filter_cnt--;
+		break;
+	case UDP_V4_FLOW:
+		pf->fd_udp4_filter_cnt--;
+		break;
+	case SCTP_V4_FLOW:
+		pf->fd_sctp4_filter_cnt--;
+		break;
+	case IP_USER_FLOW:
+		switch (filter->ip4_proto) {
+		case IPPROTO_TCP:
+			pf->fd_tcp4_filter_cnt--;
+			break;
+		case IPPROTO_UDP:
+			pf->fd_udp4_filter_cnt--;
+			break;
+		case IPPROTO_SCTP:
+			pf->fd_sctp4_filter_cnt--;
+			break;
+		case IPPROTO_IP:
+			pf->fd_ip4_filter_cnt--;
+			break;
+		}
+		break;
+	}
+
+	/* Remove the filter from the list and free memory */
+	hlist_del(&filter->fdir_node);
+	kfree(filter);
+}
+
 /**
  * i40e_fdir_check_and_reenable - Function to reenabe FD ATR or SB if disabled
  * @pf: board private structure
@@ -8180,14 +8225,9 @@ void i40e_fdir_check_and_reenable(struct i40e_pf *pf)
 	/* if hw had a problem adding a filter, delete it */
 	if (pf->fd_inv > 0) {
 		hlist_for_each_entry_safe(filter, node,
-					  &pf->fdir_filter_list, fdir_node) {
-			if (filter->fd_id == pf->fd_inv) {
-				hlist_del(&filter->fdir_node);
-				kfree(filter);
-				pf->fdir_pf_active_filters--;
-				pf->fd_inv = 0;
-			}
-		}
+					  &pf->fdir_filter_list, fdir_node)
+			if (filter->fd_id == pf->fd_inv)
+				i40e_delete_invalid_filter(pf, filter);
 	}
 }
 
-- 
2.14.3


  parent reply	other threads:[~2018-03-08 22:52 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-08 22:52 [Intel-wired-lan] [S87 v5 1/7] i40e: Fix attach VF to VM issue Jeff Kirsher
2018-03-08 22:52 ` [Intel-wired-lan] [S87 v5 2/7] i40e: Cleanup i40e_vlan_rx_register Jeff Kirsher
2018-03-09  0:28   ` Shannon Nelson
2018-03-12 19:29   ` Bowers, AndrewX
2018-03-08 22:52 ` [Intel-wired-lan] [S87 v5 3/7] i40e: Fix permission check for VF MAC filters Jeff Kirsher
2018-03-12 21:09   ` Bowers, AndrewX
2018-03-08 22:52 ` Jeff Kirsher [this message]
2018-03-12 21:20   ` [Intel-wired-lan] [S87 v5 4/7] i40e: track filter type statistics when deleting invalid filters Bowers, AndrewX
2018-03-08 22:52 ` [Intel-wired-lan] [S87 v5 5/7] i40e: factor out re-enable functions for ATR and SB Jeff Kirsher
2018-03-12 21:21   ` Bowers, AndrewX
2018-03-08 22:52 ` [Intel-wired-lan] [S87 v5 6/7] i40e: fix for wrong partition id calculation on OCP mezz cards Jeff Kirsher
2018-03-12 21:21   ` Bowers, AndrewX
2018-03-08 22:52 ` [Intel-wired-lan] [S87 v5 7/7] i40e: restore TCPv4 input set when re-enabling ATR Jeff Kirsher
2018-03-12 21:22   ` Bowers, AndrewX
2018-03-12 19:29 ` [Intel-wired-lan] [S87 v5 1/7] i40e: Fix attach VF to VM issue Bowers, AndrewX

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180308225211.12254-4-jeffrey.t.kirsher@intel.com \
    --to=jeffrey.t.kirsher@intel.com \
    --cc=intel-wired-lan@osuosl.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.