diff options
author | Ben Hutchings <bhutchings@solarflare.com> | 2012-05-04 21:31:23 -0400 |
---|---|---|
committer | Ben Hutchings <bhutchings@solarflare.com> | 2012-05-08 13:26:40 -0400 |
commit | 3132d2827d92c2ee47fdf4dbec75bba0a2f291cb (patch) | |
tree | 5664c1ad5ecd6ab7f0bf16354002eeed93619f9c /drivers | |
parent | 1c430a727fa512500a422ffe4712166c550ea06a (diff) |
sfc: Fix division by zero when using one RX channel and no SR-IOV
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>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/ethernet/sfc/efx.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/net/ethernet/sfc/efx.c b/drivers/net/ethernet/sfc/efx.c index 3cbfbffe3f00..4a0005342e65 100644 --- a/drivers/net/ethernet/sfc/efx.c +++ b/drivers/net/ethernet/sfc/efx.c | |||
@@ -1349,7 +1349,7 @@ static int efx_probe_interrupts(struct efx_nic *efx) | |||
1349 | } | 1349 | } |
1350 | 1350 | ||
1351 | /* RSS might be usable on VFs even if it is disabled on the PF */ | 1351 | /* RSS might be usable on VFs even if it is disabled on the PF */ |
1352 | efx->rss_spread = (efx->n_rx_channels > 1 ? | 1352 | efx->rss_spread = ((efx->n_rx_channels > 1 || !efx_sriov_wanted(efx)) ? |
1353 | efx->n_rx_channels : efx_vf_size(efx)); | 1353 | efx->n_rx_channels : efx_vf_size(efx)); |
1354 | 1354 | ||
1355 | return 0; | 1355 | return 0; |