提交 43fddb75 编写于 作者: A Anjali Singhai Jain 提交者: Jeff Kirsher

i40e: Fix a bug in the update logic for FDIR SB filter.

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: NAnjali Singhai Jain <anjali.singhai@intel.com>
Signed-off-by: NCatherine Sullivan <catherine.sullivan@intel.com>
Tested-by: NKavindya Deegala <kavindya.s.deegala@intel.com>
Signed-off-by: NJeff Kirsher <jeffrey.t.kirsher@intel.com>
上级 a4866597
......@@ -1356,6 +1356,24 @@ static int i40e_set_rss_hash_opt(struct i40e_pf *pf, struct ethtool_rxnfc *nfc)
return 0;
}
/**
* 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
......@@ -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--;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册