aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/ethernet/sfc/rx.c27
1 files changed, 20 insertions, 7 deletions
diff --git a/drivers/net/ethernet/sfc/rx.c b/drivers/net/ethernet/sfc/rx.c
index 65646cd7af8e..6af9cfda50fb 100644
--- a/drivers/net/ethernet/sfc/rx.c
+++ b/drivers/net/ethernet/sfc/rx.c
@@ -282,9 +282,9 @@ static void efx_fini_rx_buffer(struct efx_rx_queue *rx_queue,
282} 282}
283 283
284/* Recycle the pages that are used by buffers that have just been received. */ 284/* Recycle the pages that are used by buffers that have just been received. */
285static void efx_recycle_rx_buffers(struct efx_channel *channel, 285static void efx_recycle_rx_pages(struct efx_channel *channel,
286 struct efx_rx_buffer *rx_buf, 286 struct efx_rx_buffer *rx_buf,
287 unsigned int n_frags) 287 unsigned int n_frags)
288{ 288{
289 struct efx_rx_queue *rx_queue = efx_channel_get_rx_queue(channel); 289 struct efx_rx_queue *rx_queue = efx_channel_get_rx_queue(channel);
290 290
@@ -294,6 +294,20 @@ static void efx_recycle_rx_buffers(struct efx_channel *channel,
294 } while (--n_frags); 294 } while (--n_frags);
295} 295}
296 296
297static void efx_discard_rx_packet(struct efx_channel *channel,
298 struct efx_rx_buffer *rx_buf,
299 unsigned int n_frags)
300{
301 struct efx_rx_queue *rx_queue = efx_channel_get_rx_queue(channel);
302
303 efx_recycle_rx_pages(channel, rx_buf, n_frags);
304
305 do {
306 efx_free_rx_buffer(rx_buf);
307 rx_buf = efx_rx_buf_next(rx_queue, rx_buf);
308 } while (--n_frags);
309}
310
297/** 311/**
298 * efx_fast_push_rx_descriptors - push new RX descriptors quickly 312 * efx_fast_push_rx_descriptors - push new RX descriptors quickly
299 * @rx_queue: RX descriptor queue 313 * @rx_queue: RX descriptor queue
@@ -533,8 +547,7 @@ void efx_rx_packet(struct efx_rx_queue *rx_queue, unsigned int index,
533 */ 547 */
534 if (unlikely(rx_buf->flags & EFX_RX_PKT_DISCARD)) { 548 if (unlikely(rx_buf->flags & EFX_RX_PKT_DISCARD)) {
535 efx_rx_flush_packet(channel); 549 efx_rx_flush_packet(channel);
536 put_page(rx_buf->page); 550 efx_discard_rx_packet(channel, rx_buf, n_frags);
537 efx_recycle_rx_buffers(channel, rx_buf, n_frags);
538 return; 551 return;
539 } 552 }
540 553
@@ -570,9 +583,9 @@ void efx_rx_packet(struct efx_rx_queue *rx_queue, unsigned int index,
570 efx_sync_rx_buffer(efx, rx_buf, rx_buf->len); 583 efx_sync_rx_buffer(efx, rx_buf, rx_buf->len);
571 } 584 }
572 585
573 /* All fragments have been DMA-synced, so recycle buffers and pages. */ 586 /* All fragments have been DMA-synced, so recycle pages. */
574 rx_buf = efx_rx_buffer(rx_queue, index); 587 rx_buf = efx_rx_buffer(rx_queue, index);
575 efx_recycle_rx_buffers(channel, rx_buf, n_frags); 588 efx_recycle_rx_pages(channel, rx_buf, n_frags);
576 589
577 /* Pipeline receives so that we give time for packet headers to be 590 /* Pipeline receives so that we give time for packet headers to be
578 * prefetched into cache. 591 * prefetched into cache.