diff options
author | Ben Hutchings <bhutchings@solarflare.com> | 2008-09-01 07:48:08 -0400 |
---|---|---|
committer | Jeff Garzik <jgarzik@redhat.com> | 2008-09-03 09:53:47 -0400 |
commit | 42cbe2d73c9bc2574f86d63c2b57da93e3b3060d (patch) | |
tree | 8a85d4e92eeefbe3c55b921ac920527d12c33461 /drivers/net/sfc/efx.c | |
parent | d3074025345ae27fbb076a92425f28b40b6fa4c0 (diff) |
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>
Diffstat (limited to 'drivers/net/sfc/efx.c')
-rw-r--r-- | drivers/net/sfc/efx.c | 27 |
1 files changed, 10 insertions, 17 deletions
diff --git a/drivers/net/sfc/efx.c b/drivers/net/sfc/efx.c index 22004a612d2c..864095ea5b37 100644 --- a/drivers/net/sfc/efx.c +++ b/drivers/net/sfc/efx.c | |||
@@ -160,14 +160,16 @@ static void efx_fini_channels(struct efx_nic *efx); | |||
160 | */ | 160 | */ |
161 | static int efx_process_channel(struct efx_channel *channel, int rx_quota) | 161 | static int efx_process_channel(struct efx_channel *channel, int rx_quota) |
162 | { | 162 | { |
163 | int rxdmaqs; | 163 | struct efx_nic *efx = channel->efx; |
164 | struct efx_rx_queue *rx_queue; | 164 | int rx_packets; |
165 | 165 | ||
166 | if (unlikely(channel->efx->reset_pending != RESET_TYPE_NONE || | 166 | if (unlikely(efx->reset_pending != RESET_TYPE_NONE || |
167 | !channel->enabled)) | 167 | !channel->enabled)) |
168 | return rx_quota; | 168 | return 0; |
169 | 169 | ||
170 | rxdmaqs = falcon_process_eventq(channel, &rx_quota); | 170 | rx_packets = falcon_process_eventq(channel, rx_quota); |
171 | if (rx_packets == 0) | ||
172 | return 0; | ||
171 | 173 | ||
172 | /* Deliver last RX packet. */ | 174 | /* Deliver last RX packet. */ |
173 | if (channel->rx_pkt) { | 175 | if (channel->rx_pkt) { |
@@ -179,16 +181,9 @@ static int efx_process_channel(struct efx_channel *channel, int rx_quota) | |||
179 | efx_flush_lro(channel); | 181 | efx_flush_lro(channel); |
180 | efx_rx_strategy(channel); | 182 | efx_rx_strategy(channel); |
181 | 183 | ||
182 | /* Refill descriptor rings as necessary */ | 184 | efx_fast_push_rx_descriptors(&efx->rx_queue[channel->channel]); |
183 | rx_queue = &channel->efx->rx_queue[0]; | ||
184 | while (rxdmaqs) { | ||
185 | if (rxdmaqs & 0x01) | ||
186 | efx_fast_push_rx_descriptors(rx_queue); | ||
187 | rx_queue++; | ||
188 | rxdmaqs >>= 1; | ||
189 | } | ||
190 | 185 | ||
191 | return rx_quota; | 186 | return rx_packets; |
192 | } | 187 | } |
193 | 188 | ||
194 | /* Mark channel as finished processing | 189 | /* Mark channel as finished processing |
@@ -218,14 +213,12 @@ static int efx_poll(struct napi_struct *napi, int budget) | |||
218 | struct efx_channel *channel = | 213 | struct efx_channel *channel = |
219 | container_of(napi, struct efx_channel, napi_str); | 214 | container_of(napi, struct efx_channel, napi_str); |
220 | struct net_device *napi_dev = channel->napi_dev; | 215 | struct net_device *napi_dev = channel->napi_dev; |
221 | int unused; | ||
222 | int rx_packets; | 216 | int rx_packets; |
223 | 217 | ||
224 | EFX_TRACE(channel->efx, "channel %d NAPI poll executing on CPU %d\n", | 218 | EFX_TRACE(channel->efx, "channel %d NAPI poll executing on CPU %d\n", |
225 | channel->channel, raw_smp_processor_id()); | 219 | channel->channel, raw_smp_processor_id()); |
226 | 220 | ||
227 | unused = efx_process_channel(channel, budget); | 221 | rx_packets = efx_process_channel(channel, budget); |
228 | rx_packets = (budget - unused); | ||
229 | 222 | ||
230 | if (rx_packets < budget) { | 223 | if (rx_packets < budget) { |
231 | /* There is no race here; although napi_disable() will | 224 | /* There is no race here; although napi_disable() will |