Skip to content

Commit d8a8785

Browse files
mawilli1Jeff Kirsher
authored andcommitted
i40e: check for invalid DCB config
The driver (and the entire netdev layer for that matter) assumes that TC0 will always be present in our DCB configuration. Unfortunately, this isn't always the case. Rather than fail to configure the VSI, let's go ahead and try to make it work, even though DCB will end up being disabled by the kernel. If the driver fails to configure DCB, the driver queries what's valid, then writes that back to the hardware, always forcing TC0. This fixes a bug where the driver could fail to adhere to ETS BW allocations if 8 TCs were configured on the switch. Signed-off-by: Mitch Williams <[email protected]> Tested-by: Andrew Bowers <[email protected]> Signed-off-by: Jeff Kirsher <[email protected]>
1 parent 07d4419 commit d8a8785

File tree

1 file changed

+33
-1
lines changed

1 file changed

+33
-1
lines changed

drivers/net/ethernet/intel/i40e/i40e_main.c

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5244,6 +5244,8 @@ static void i40e_vsi_update_queue_map(struct i40e_vsi *vsi,
52445244
static int i40e_vsi_config_tc(struct i40e_vsi *vsi, u8 enabled_tc)
52455245
{
52465246
u8 bw_share[I40E_MAX_TRAFFIC_CLASS] = {0};
5247+
struct i40e_pf *pf = vsi->back;
5248+
struct i40e_hw *hw = &pf->hw;
52475249
struct i40e_vsi_context ctxt;
52485250
int ret = 0;
52495251
int i;
@@ -5261,10 +5263,40 @@ static int i40e_vsi_config_tc(struct i40e_vsi *vsi, u8 enabled_tc)
52615263

52625264
ret = i40e_vsi_configure_bw_alloc(vsi, enabled_tc, bw_share);
52635265
if (ret) {
5266+
struct i40e_aqc_query_vsi_bw_config_resp bw_config = {0};
5267+
52645268
dev_info(&vsi->back->pdev->dev,
52655269
"Failed configuring TC map %d for VSI %d\n",
52665270
enabled_tc, vsi->seid);
5267-
goto out;
5271+
ret = i40e_aq_query_vsi_bw_config(hw, vsi->seid,
5272+
&bw_config, NULL);
5273+
if (ret) {
5274+
dev_info(&pf->pdev->dev,
5275+
"Failed querying vsi bw info, err %s aq_err %s\n",
5276+
i40e_stat_str(hw, ret),
5277+
i40e_aq_str(hw, hw->aq.asq_last_status));
5278+
goto out;
5279+
}
5280+
if ((bw_config.tc_valid_bits & enabled_tc) != enabled_tc) {
5281+
u8 valid_tc = bw_config.tc_valid_bits & enabled_tc;
5282+
5283+
if (!valid_tc)
5284+
valid_tc = bw_config.tc_valid_bits;
5285+
/* Always enable TC0, no matter what */
5286+
valid_tc |= 1;
5287+
dev_info(&pf->pdev->dev,
5288+
"Requested tc 0x%x, but FW reports 0x%x as valid. Attempting to use 0x%x.\n",
5289+
enabled_tc, bw_config.tc_valid_bits, valid_tc);
5290+
enabled_tc = valid_tc;
5291+
}
5292+
5293+
ret = i40e_vsi_configure_bw_alloc(vsi, enabled_tc, bw_share);
5294+
if (ret) {
5295+
dev_err(&pf->pdev->dev,
5296+
"Unable to configure TC map %d for VSI %d\n",
5297+
enabled_tc, vsi->seid);
5298+
goto out;
5299+
}
52685300
}
52695301

52705302
/* Update Queue Pairs Mapping for currently enabled UPs */

0 commit comments

Comments
 (0)