aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/sfc/efx.c
diff options
context:
space:
mode:
authorSteve Hodgson <shodgson@solarflare.com>2010-09-10 02:42:22 -0400
committerDavid S. Miller <davem@davemloft.net>2010-09-10 15:27:33 -0400
commitecc910f520ba8f22848982ee816ad75c449b805d (patch)
treee934380209532b831b7e7e334ddc33d75db7eef5 /drivers/net/sfc/efx.c
parent8313aca38b3937947fffebca6e34bac8e24300c8 (diff)
sfc: Make the dmaq size a run-time setting (rather than compile-time)
- Allow the ring size to be specified in non power-of-two sizes (for instance to limit the amount of receive buffers). - Automatically size the event queue. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/sfc/efx.c')
-rw-r--r--drivers/net/sfc/efx.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/drivers/net/sfc/efx.c b/drivers/net/sfc/efx.c
index 4b42e61e3c7d..6166e2207160 100644
--- a/drivers/net/sfc/efx.c
+++ b/drivers/net/sfc/efx.c
@@ -348,7 +348,7 @@ void efx_process_channel_now(struct efx_channel *channel)
348 napi_disable(&channel->napi_str); 348 napi_disable(&channel->napi_str);
349 349
350 /* Poll the channel */ 350 /* Poll the channel */
351 efx_process_channel(channel, EFX_EVQ_SIZE); 351 efx_process_channel(channel, channel->eventq_mask + 1);
352 352
353 /* Ack the eventq. This may cause an interrupt to be generated 353 /* Ack the eventq. This may cause an interrupt to be generated
354 * when they are reenabled */ 354 * when they are reenabled */
@@ -365,9 +365,18 @@ void efx_process_channel_now(struct efx_channel *channel)
365 */ 365 */
366static int efx_probe_eventq(struct efx_channel *channel) 366static int efx_probe_eventq(struct efx_channel *channel)
367{ 367{
368 struct efx_nic *efx = channel->efx;
369 unsigned long entries;
370
368 netif_dbg(channel->efx, probe, channel->efx->net_dev, 371 netif_dbg(channel->efx, probe, channel->efx->net_dev,
369 "chan %d create event queue\n", channel->channel); 372 "chan %d create event queue\n", channel->channel);
370 373
374 /* Build an event queue with room for one event per tx and rx buffer,
375 * plus some extra for link state events and MCDI completions. */
376 entries = roundup_pow_of_two(efx->rxq_entries + efx->txq_entries + 128);
377 EFX_BUG_ON_PARANOID(entries > EFX_MAX_EVQ_SIZE);
378 channel->eventq_mask = max(entries, EFX_MIN_EVQ_SIZE) - 1;
379
371 return efx_nic_probe_eventq(channel); 380 return efx_nic_probe_eventq(channel);
372} 381}
373 382
@@ -1191,6 +1200,7 @@ static int efx_probe_all(struct efx_nic *efx)
1191 } 1200 }
1192 1201
1193 /* Create channels */ 1202 /* Create channels */
1203 efx->rxq_entries = efx->txq_entries = EFX_DEFAULT_DMAQ_SIZE;
1194 efx_for_each_channel(channel, efx) { 1204 efx_for_each_channel(channel, efx) {
1195 rc = efx_probe_channel(channel); 1205 rc = efx_probe_channel(channel);
1196 if (rc) { 1206 if (rc) {
@@ -2101,9 +2111,6 @@ static int efx_init_struct(struct efx_nic *efx, struct efx_nic_type *type,
2101 2111
2102 efx->type = type; 2112 efx->type = type;
2103 2113
2104 /* As close as we can get to guaranteeing that we don't overflow */
2105 BUILD_BUG_ON(EFX_EVQ_SIZE < EFX_TXQ_SIZE + EFX_RXQ_SIZE);
2106
2107 EFX_BUG_ON_PARANOID(efx->type->phys_addr_channels > EFX_MAX_CHANNELS); 2114 EFX_BUG_ON_PARANOID(efx->type->phys_addr_channels > EFX_MAX_CHANNELS);
2108 2115
2109 /* Higher numbered interrupt modes are less capable! */ 2116 /* Higher numbered interrupt modes are less capable! */