Skip to content

Commit

Permalink
net/i40e: fix flow director for common pctypes
Browse files Browse the repository at this point in the history
[ upstream commit ff04964 ]

Currently, FDIR doesn't work for all common PCTYPEs, the root cause is
that input set is not configured.

Fixes: 4a072ad ("net/i40e: fix flow director config after flow validate")

Signed-off-by: Murphy Yang <murphyx.yang@intel.com>
Acked-by: Beilei Xing <beilei.xing@intel.com>
  • Loading branch information
Murphy Yang authored and steevenlee committed May 8, 2021
1 parent abb66bf commit bd0291a
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions drivers/net/i40e/i40e_fdir.c
Original file line number Diff line number Diff line change
Expand Up @@ -1607,17 +1607,21 @@ i40e_flow_set_fdir_inset(struct i40e_pf *pf,

/* Check if the configuration is conflicted */
if (pf->fdir.inset_flag[pctype] &&
memcmp(&pf->fdir.input_set[pctype], &input_set, sizeof(uint64_t)))
return -1;
memcmp(&pf->fdir.input_set[pctype], &input_set, sizeof(uint64_t))) {
PMD_DRV_LOG(ERR, "Conflict with the first rule's input set.");
return -EINVAL;
}

if (pf->fdir.inset_flag[pctype] &&
!memcmp(&pf->fdir.input_set[pctype], &input_set, sizeof(uint64_t)))
return 0;

num = i40e_generate_inset_mask_reg(hw, input_set, mask_reg,
I40E_INSET_MASK_NUM_REG);
if (num < 0)
if (num < 0) {
PMD_DRV_LOG(ERR, "Invalid pattern mask.");
return -EINVAL;
}

if (pf->support_multi_driver) {
for (i = 0; i < num; i++)
Expand Down Expand Up @@ -1762,18 +1766,15 @@ i40e_flow_add_del_fdir_filter(struct rte_eth_dev *dev,
i40e_fdir_filter_convert(filter, &check_filter);

if (add) {
if (filter->input.flow_ext.is_flex_flow) {
/* configure the input set for common PCTYPEs*/
if (!filter->input.flow_ext.customized_pctype) {
ret = i40e_flow_set_fdir_inset(pf, pctype,
filter->input.flow_ext.input_set);
if (ret == -1) {
PMD_DRV_LOG(ERR, "Conflict with the"
" first rule's input set.");
return -EINVAL;
} else if (ret == -EINVAL) {
PMD_DRV_LOG(ERR, "Invalid pattern mask.");
return -EINVAL;
}
if (ret < 0)
return ret;
}

if (filter->input.flow_ext.is_flex_flow) {
for (i = 0; i < filter->input.flow_ext.raw_id; i++) {
layer_idx = filter->input.flow_ext.layer_idx;
field_idx = layer_idx * I40E_MAX_FLXPLD_FIED + i;
Expand Down

0 comments on commit bd0291a

Please sign in to comment.