Skip to content

Commit

Permalink
net/i40e: fix exception with multi-driver
Browse files Browse the repository at this point in the history
[ upstream commit 39de80b ]

If support-multi-driver is enabled, the global registers should not
be configured. But with the current code base, if creating a flow
with rte_flow API, the global register GLQF_FD_MSK may be changed.

Fixes: cfdfca4 ("net/i40e: fix multiple driver support")

Signed-off-by: Alvin Zhang <alvinx.zhang@intel.com>
Reviewed-by: Xiaolong Ye <xiaolong.ye@intel.com>
  • Loading branch information
Alvin Zhang authored and kevintraynor committed Dec 9, 2019
1 parent 34afffb commit 33c64c2
Showing 1 changed file with 31 additions and 7 deletions.
38 changes: 31 additions & 7 deletions drivers/net/i40e/i40e_flow.c
Expand Up @@ -2350,6 +2350,37 @@ i40e_flow_set_fdir_inset(struct i40e_pf *pf,
if (num < 0)
return -EINVAL;

if (pf->support_multi_driver) {
for (i = 0; i < num; i++)
if (i40e_read_rx_ctl(hw,
I40E_GLQF_FD_MSK(i, pctype)) !=
mask_reg[i]) {
PMD_DRV_LOG(ERR, "Input set setting is not"
" supported with"
" `support-multi-driver`"
" enabled!");
return -EPERM;
}
for (i = num; i < I40E_INSET_MASK_NUM_REG; i++)
if (i40e_read_rx_ctl(hw,
I40E_GLQF_FD_MSK(i, pctype)) != 0) {
PMD_DRV_LOG(ERR, "Input set setting is not"
" supported with"
" `support-multi-driver`"
" enabled!");
return -EPERM;
}

} else {
for (i = 0; i < num; i++)
i40e_check_write_reg(hw, I40E_GLQF_FD_MSK(i, pctype),
mask_reg[i]);
/*clear unused mask registers of the pctype */
for (i = num; i < I40E_INSET_MASK_NUM_REG; i++)
i40e_check_write_reg(hw,
I40E_GLQF_FD_MSK(i, pctype), 0);
}

inset_reg |= i40e_translate_input_set_reg(hw->mac.type, input_set);

i40e_check_write_reg(hw, I40E_PRTQF_FD_INSET(pctype, 0),
Expand All @@ -2358,13 +2389,6 @@ i40e_flow_set_fdir_inset(struct i40e_pf *pf,
(uint32_t)((inset_reg >>
I40E_32_BIT_WIDTH) & UINT32_MAX));

for (i = 0; i < num; i++)
i40e_check_write_reg(hw, I40E_GLQF_FD_MSK(i, pctype),
mask_reg[i]);

/*clear unused mask registers of the pctype */
for (i = num; i < I40E_INSET_MASK_NUM_REG; i++)
i40e_check_write_reg(hw, I40E_GLQF_FD_MSK(i, pctype), 0);
I40E_WRITE_FLUSH(hw);

pf->fdir.input_set[pctype] = input_set;
Expand Down

0 comments on commit 33c64c2

Please sign in to comment.