aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMitch Williams <mitch.a.williams@intel.com>2017-12-18 05:17:42 -0500
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>2018-01-23 14:29:19 -0500
commitd8a87856607ebcc5456feb96f6a639b2b0fd746f (patch)
treeb224d0404eede171d3d93822234e331c6f75033c
parent07d44190a38939adfec6177a6e1b683417da291f (diff)
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 <mitch.a.williams@intel.com> Tested-by: Andrew Bowers <andrewx.bowers@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
-rw-r--r--drivers/net/ethernet/intel/i40e/i40e_main.c34
1 files changed, 33 insertions, 1 deletions
diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c
index 69d15560fdf9..d66470d75601 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_main.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
@@ -5244,6 +5244,8 @@ static void i40e_vsi_update_queue_map(struct i40e_vsi *vsi,
5244static int i40e_vsi_config_tc(struct i40e_vsi *vsi, u8 enabled_tc) 5244static int i40e_vsi_config_tc(struct i40e_vsi *vsi, u8 enabled_tc)
5245{ 5245{
5246 u8 bw_share[I40E_MAX_TRAFFIC_CLASS] = {0}; 5246 u8 bw_share[I40E_MAX_TRAFFIC_CLASS] = {0};
5247 struct i40e_pf *pf = vsi->back;
5248 struct i40e_hw *hw = &pf->hw;
5247 struct i40e_vsi_context ctxt; 5249 struct i40e_vsi_context ctxt;
5248 int ret = 0; 5250 int ret = 0;
5249 int i; 5251 int i;
@@ -5261,10 +5263,40 @@ static int i40e_vsi_config_tc(struct i40e_vsi *vsi, u8 enabled_tc)
5261 5263
5262 ret = i40e_vsi_configure_bw_alloc(vsi, enabled_tc, bw_share); 5264 ret = i40e_vsi_configure_bw_alloc(vsi, enabled_tc, bw_share);
5263 if (ret) { 5265 if (ret) {
5266 struct i40e_aqc_query_vsi_bw_config_resp bw_config = {0};
5267
5264 dev_info(&vsi->back->pdev->dev, 5268 dev_info(&vsi->back->pdev->dev,
5265 "Failed configuring TC map %d for VSI %d\n", 5269 "Failed configuring TC map %d for VSI %d\n",
5266 enabled_tc, vsi->seid); 5270 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 }
5268 } 5300 }
5269 5301
5270 /* Update Queue Pairs Mapping for currently enabled UPs */ 5302 /* Update Queue Pairs Mapping for currently enabled UPs */