Skip to content

Commit

Permalink
sfc: Fix division by zero when using one RX channel and no SR-IOV
Browse files Browse the repository at this point in the history
If RSS is disabled on the PF (efx->n_rx_channels == 1) we try to set
up the indirection table so that VFs can use it, setting
efx->rss_spread = efx_vf_size(efx).  But if SR-IOV was disabled at
compile time, this evaluates to 0 and we end up dividing by zero when
initialising the table.

I considered changing the fallback definition of efx_vf_size() to
return 1, but its value is really meaningless if we are not going to
enable VFs.  Therefore add a condition of efx_sriov_wanted(efx) in
efx_probe_interrupts().

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
  • Loading branch information
Ben Hutchings committed May 8, 2012
1 parent 1c430a7 commit 3132d28
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/net/ethernet/sfc/efx.c
Original file line number Diff line number Diff line change
Expand Up @@ -1349,7 +1349,7 @@ static int efx_probe_interrupts(struct efx_nic *efx)
}

/* RSS might be usable on VFs even if it is disabled on the PF */
efx->rss_spread = (efx->n_rx_channels > 1 ?
efx->rss_spread = ((efx->n_rx_channels > 1 || !efx_sriov_wanted(efx)) ?
efx->n_rx_channels : efx_vf_size(efx));

return 0;
Expand Down

0 comments on commit 3132d28

Please sign in to comment.