Commit b356dac8 authored by Mitch Williams's avatar Mitch Williams Committed by Jeff Kirsher

i40e: avoid divide by zero

In some weird circumstances with DCB enabled, the firmware can fail to
configure the VSI, leaving us with zero traffic classes. Check for this
state when we configure RSS to avoid a panic.
Signed-off-by: default avatarMitch Williams <mitch.a.williams@intel.com>
Tested-by: default avatarAndrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
parent e3a5d6e6
...@@ -10783,8 +10783,13 @@ static int i40e_pf_config_rss(struct i40e_pf *pf) ...@@ -10783,8 +10783,13 @@ static int i40e_pf_config_rss(struct i40e_pf *pf)
/* Determine the RSS size of the VSI */ /* Determine the RSS size of the VSI */
if (!vsi->rss_size) { if (!vsi->rss_size) {
u16 qcount; u16 qcount;
/* If the firmware does something weird during VSI init, we
qcount = vsi->num_queue_pairs / vsi->tc_config.numtc; * could end up with zero TCs. Check for that to avoid
* divide-by-zero. It probably won't pass traffic, but it also
* won't panic.
*/
qcount = vsi->num_queue_pairs /
(vsi->tc_config.numtc ? vsi->tc_config.numtc : 1);
vsi->rss_size = min_t(int, pf->alloc_rss_size, qcount); vsi->rss_size = min_t(int, pf->alloc_rss_size, qcount);
} }
if (!vsi->rss_size) if (!vsi->rss_size)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment