sfc: Cleanup RX event processing

Make efx_process_channel() and falcon_process_eventq() return the
number of packets received rather than updating the quota, consistent
with new NAPI.

Since channels and RX queues are mapped one-to-one, remove return
value from falcon_handle_rx_event() and add a warning for events
with the wrong RX queue number.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
This commit is contained in:
Ben Hutchings 2008-09-01 12:48:08 +01:00 committed by Jeff Garzik
parent d307402534
commit 42cbe2d73c
3 changed files with 23 additions and 36 deletions

View file

@ -160,14 +160,16 @@ static void efx_fini_channels(struct efx_nic *efx);
*/
static int efx_process_channel(struct efx_channel *channel, int rx_quota)
{
int rxdmaqs;
struct efx_rx_queue *rx_queue;
struct efx_nic *efx = channel->efx;
int rx_packets;
if (unlikely(channel->efx->reset_pending != RESET_TYPE_NONE ||
if (unlikely(efx->reset_pending != RESET_TYPE_NONE ||
!channel->enabled))
return rx_quota;
return 0;
rxdmaqs = falcon_process_eventq(channel, &rx_quota);
rx_packets = falcon_process_eventq(channel, rx_quota);
if (rx_packets == 0)
return 0;
/* Deliver last RX packet. */
if (channel->rx_pkt) {
@ -179,16 +181,9 @@ static int efx_process_channel(struct efx_channel *channel, int rx_quota)
efx_flush_lro(channel);
efx_rx_strategy(channel);
/* Refill descriptor rings as necessary */
rx_queue = &channel->efx->rx_queue[0];
while (rxdmaqs) {
if (rxdmaqs & 0x01)
efx_fast_push_rx_descriptors(rx_queue);
rx_queue++;
rxdmaqs >>= 1;
}
efx_fast_push_rx_descriptors(&efx->rx_queue[channel->channel]);
return rx_quota;
return rx_packets;
}
/* Mark channel as finished processing
@ -218,14 +213,12 @@ static int efx_poll(struct napi_struct *napi, int budget)
struct efx_channel *channel =
container_of(napi, struct efx_channel, napi_str);
struct net_device *napi_dev = channel->napi_dev;
int unused;
int rx_packets;
EFX_TRACE(channel->efx, "channel %d NAPI poll executing on CPU %d\n",
channel->channel, raw_smp_processor_id());
unused = efx_process_channel(channel, budget);
rx_packets = (budget - unused);
rx_packets = efx_process_channel(channel, budget);
if (rx_packets < budget) {
/* There is no race here; although napi_disable() will