From: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
To: davem@davemloft.net
Cc: Anjali Singhai Jain <anjali.singhai@intel.com>,
netdev@vger.kernel.org, gospo@redhat.com, sassmann@redhat.com,
Catherine Sullivan <catherine.sullivan@intel.com>,
Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Subject: [net-next v2 03/14] i40e: Fix a bug in the update logic for FDIR SB filter.
Date: Fri, 14 Mar 2014 16:34:24 -0700 [thread overview]
Message-ID: <1394840075-6851-4-git-send-email-jeffrey.t.kirsher@intel.com> (raw)
In-Reply-To: <1394840075-6851-1-git-send-email-jeffrey.t.kirsher@intel.com>
From: Anjali Singhai Jain <anjali.singhai@intel.com>
The update filter logic was causing a kernel panic in the original code.
We need to compare the input set to decide whether or not to delete a
filter since we do not have a hash stored. This new design helps fix the issue.
Change-ID: I2462b108e58ca4833312804cda730b4660cc18c9
Signed-off-by: Anjali Singhai Jain <anjali.singhai@intel.com>
Signed-off-by: Catherine Sullivan <catherine.sullivan@intel.com>
Tested-by: Kavindya Deegala <kavindya.s.deegala@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 27 +++++++++++++++++++++-----
1 file changed, 22 insertions(+), 5 deletions(-)
diff --git a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
index d34ff31..718a3e0 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
@@ -1357,6 +1357,24 @@ static int i40e_set_rss_hash_opt(struct i40e_pf *pf, struct ethtool_rxnfc *nfc)
}
/**
+ * i40e_match_fdir_input_set - Match a new filter against an existing one
+ * @rule: The filter already added
+ * @input: The new filter to comapre against
+ *
+ * Returns true if the two input set match
+ **/
+static bool i40e_match_fdir_input_set(struct i40e_fdir_filter *rule,
+ struct i40e_fdir_filter *input)
+{
+ if ((rule->dst_ip[0] != input->dst_ip[0]) ||
+ (rule->src_ip[0] != input->src_ip[0]) ||
+ (rule->dst_port != input->dst_port) ||
+ (rule->src_port != input->src_port))
+ return false;
+ return true;
+}
+
+/**
* i40e_update_ethtool_fdir_entry - Updates the fdir filter entry
* @vsi: Pointer to the targeted VSI
* @input: The filter to update or NULL to indicate deletion
@@ -1391,11 +1409,10 @@ static int i40e_update_ethtool_fdir_entry(struct i40e_vsi *vsi,
/* if there is an old rule occupying our place remove it */
if (rule && (rule->fd_id == sw_idx)) {
- if (!input || (rule->fd_id != input->fd_id)) {
- cmd->fs.flow_type = rule->flow_type;
- err = i40e_add_del_fdir_ethtool(vsi, cmd, false);
- }
-
+ if (input && !i40e_match_fdir_input_set(rule, input))
+ err = i40e_add_del_fdir(vsi, rule, false);
+ else if (!input)
+ err = i40e_add_del_fdir(vsi, rule, false);
hlist_del(&rule->fdir_node);
kfree(rule);
pf->fdir_pf_active_filters--;
--
1.8.3.1
next prev parent reply other threads:[~2014-03-14 23:35 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-14 23:34 [net-next v2 00/14][pull request] Intel Wired LAN Driver Updates Jeff Kirsher
2014-03-14 23:34 ` [net-next v2 01/14] igb: Fix code comment Jeff Kirsher
2014-03-14 23:34 ` [net-next v2 02/14] i40e: delete netdev after deleting napi and vectors Jeff Kirsher
2014-03-14 23:34 ` Jeff Kirsher [this message]
2014-03-14 23:34 ` [net-next v2 04/14] i40e/i40evf: Some flow director HW definition fixes Jeff Kirsher
2014-03-14 23:34 ` [net-next v2 05/14] i40e: make string references to q be queue Jeff Kirsher
2014-03-14 23:34 ` [net-next v2 06/14] i40e: cleanup strings Jeff Kirsher
2014-03-14 23:34 ` [net-next v2 07/14] i40e: simplified init string Jeff Kirsher
2014-03-14 23:34 ` [net-next v2 08/14] i40e: Fix function comments Jeff Kirsher
2014-03-14 23:34 ` [net-next v2 09/14] i40e: Define a new state variable to keep track of feature auto disable Jeff Kirsher
2014-03-14 23:34 ` [net-next v2 10/14] i40e: Add code to handle FD table full condition Jeff Kirsher
2014-03-14 23:34 ` [net-next v2 11/14] i40e: Bug fix for FDIR replay logic Jeff Kirsher
2014-03-14 23:34 ` [net-next v2 12/14] i40e: Let MDD events be handled by MDD handler Jeff Kirsher
2014-03-14 23:34 ` [net-next v2 13/14] i40e/i40evf: Use correct number of VF vectors Jeff Kirsher
2014-03-14 23:34 ` [net-next v2 14/14] i40e/i40evf: Use dma_set_mask_and_coherent Jeff Kirsher
2014-03-15 2:19 ` [net-next v2 00/14][pull request] Intel Wired LAN Driver Updates David Miller
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=1394840075-6851-4-git-send-email-jeffrey.t.kirsher@intel.com \
--to=jeffrey.t.kirsher@intel.com \
--cc=anjali.singhai@intel.com \
--cc=catherine.sullivan@intel.com \
--cc=davem@davemloft.net \
--cc=gospo@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=sassmann@redhat.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).