i40e: Fix configure TCs after initial DCB disable

in commit a036244c06 a fix
was put into place to avoid a kernel panic when a non-
supported traffic class configuration was put into place
and then lldp was enabled/disabled on the link partner
switch.  This fix caused it to be necessary to
unload/reload the driver to reenable DCB once a supported
TC config was in place.

The root cause of the original panic was that the function
i40e_pf_get_default_tc was allowing for a default TC other
than TC 0, and only TC 0 is supported as a default.

This patch removes the get_default_tc function and replaces
it with a #define since there is only one TC supported as
a default.

Change-Id: I448371974e946386d0a7718d73668b450b7c72ef
Signed-off-by: Dave Ertman <david.m.ertman@intel.com>
Tested-by: Ronald Bynoe <ronald.j.bynoe@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
This commit is contained in:
David Ertman 2016-09-20 07:10:50 -07:00 committed by Jeff Kirsher
parent a3b8cb1f84
commit ea6acb7ef7
2 changed files with 5 additions and 27 deletions

View File

@ -92,6 +92,7 @@
#define I40E_AQ_LEN 256 #define I40E_AQ_LEN 256
#define I40E_AQ_WORK_LIMIT 66 /* max number of VFs + a little */ #define I40E_AQ_WORK_LIMIT 66 /* max number of VFs + a little */
#define I40E_MAX_USER_PRIORITY 8 #define I40E_MAX_USER_PRIORITY 8
#define I40E_DEFAULT_TRAFFIC_CLASS BIT(0)
#define I40E_DEFAULT_MSG_ENABLE 4 #define I40E_DEFAULT_MSG_ENABLE 4
#define I40E_QUEUE_WAIT_RETRY_LIMIT 10 #define I40E_QUEUE_WAIT_RETRY_LIMIT 10
#define I40E_INT_NAME_STR_LEN (IFNAMSIZ + 16) #define I40E_INT_NAME_STR_LEN (IFNAMSIZ + 16)

View File

@ -4640,29 +4640,6 @@ static u8 i40e_pf_get_num_tc(struct i40e_pf *pf)
return num_tc; return num_tc;
} }
/**
* i40e_pf_get_default_tc - Get bitmap for first enabled TC
* @pf: PF being queried
*
* Return a bitmap for first enabled traffic class for this PF.
**/
static u8 i40e_pf_get_default_tc(struct i40e_pf *pf)
{
u8 enabled_tc = pf->hw.func_caps.enabled_tcmap;
u8 i = 0;
if (!enabled_tc)
return 0x1; /* TC0 */
/* Find the first enabled TC */
for (i = 0; i < I40E_MAX_TRAFFIC_CLASS; i++) {
if (enabled_tc & BIT(i))
break;
}
return BIT(i);
}
/** /**
* i40e_pf_get_pf_tc_map - Get bitmap for enabled traffic classes * i40e_pf_get_pf_tc_map - Get bitmap for enabled traffic classes
* @pf: PF being queried * @pf: PF being queried
@ -4673,7 +4650,7 @@ static u8 i40e_pf_get_tc_map(struct i40e_pf *pf)
{ {
/* If DCB is not enabled for this PF then just return default TC */ /* If DCB is not enabled for this PF then just return default TC */
if (!(pf->flags & I40E_FLAG_DCB_ENABLED)) if (!(pf->flags & I40E_FLAG_DCB_ENABLED))
return i40e_pf_get_default_tc(pf); return I40E_DEFAULT_TRAFFIC_CLASS;
/* SFP mode we want PF to be enabled for all TCs */ /* SFP mode we want PF to be enabled for all TCs */
if (!(pf->flags & I40E_FLAG_MFP_ENABLED)) if (!(pf->flags & I40E_FLAG_MFP_ENABLED))
@ -4683,7 +4660,7 @@ static u8 i40e_pf_get_tc_map(struct i40e_pf *pf)
if (pf->hw.func_caps.iscsi) if (pf->hw.func_caps.iscsi)
return i40e_get_iscsi_tc_map(pf); return i40e_get_iscsi_tc_map(pf);
else else
return i40e_pf_get_default_tc(pf); return I40E_DEFAULT_TRAFFIC_CLASS;
} }
/** /**
@ -5029,7 +5006,7 @@ static void i40e_dcb_reconfigure(struct i40e_pf *pf)
if (v == pf->lan_vsi) if (v == pf->lan_vsi)
tc_map = i40e_pf_get_tc_map(pf); tc_map = i40e_pf_get_tc_map(pf);
else else
tc_map = i40e_pf_get_default_tc(pf); tc_map = I40E_DEFAULT_TRAFFIC_CLASS;
#ifdef I40E_FCOE #ifdef I40E_FCOE
if (pf->vsi[v]->type == I40E_VSI_FCOE) if (pf->vsi[v]->type == I40E_VSI_FCOE)
tc_map = i40e_get_fcoe_tc_map(pf); tc_map = i40e_get_fcoe_tc_map(pf);
@ -5717,7 +5694,7 @@ static int i40e_handle_lldp_event(struct i40e_pf *pf,
u8 type; u8 type;
/* Not DCB capable or capability disabled */ /* Not DCB capable or capability disabled */
if (!(pf->flags & I40E_FLAG_DCB_ENABLED)) if (!(pf->flags & I40E_FLAG_DCB_CAPABLE))
return ret; return ret;
/* Ignore if event is not for Nearest Bridge */ /* Ignore if event is not for Nearest Bridge */