aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/sfc/rx.c
diff options
context:
space:
mode:
authorBen Hutchings <bhutchings@solarflare.com>2009-11-23 11:02:25 -0500
committerDavid S. Miller <davem@davemloft.net>2009-11-24 13:58:28 -0500
commit1241e951af060c16cd851a83a045ca3a80288383 (patch)
tree3b266428426577063ccb0dcdc185fa7292980145 /drivers/net/sfc/rx.c
parent3139e62827b9f2b9b553816de664edfe4573c954 (diff)
sfc: Move assertions and buffer cleanup earlier in efx_rx_packet_lro()
This removes the need to use a label and goto, and makes the two branches mirror each other more closely. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/sfc/rx.c')
-rw-r--r--drivers/net/sfc/rx.c26
1 files changed, 14 insertions, 12 deletions
diff --git a/drivers/net/sfc/rx.c b/drivers/net/sfc/rx.c
index c4073522c0a8..9e33391db355 100644
--- a/drivers/net/sfc/rx.c
+++ b/drivers/net/sfc/rx.c
@@ -449,15 +449,19 @@ static void efx_rx_packet_lro(struct efx_channel *channel,
449 449
450 /* Pass the skb/page into the LRO engine */ 450 /* Pass the skb/page into the LRO engine */
451 if (rx_buf->page) { 451 if (rx_buf->page) {
452 struct sk_buff *skb = napi_get_frags(napi); 452 struct page *page = rx_buf->page;
453 struct sk_buff *skb;
453 454
455 EFX_BUG_ON_PARANOID(rx_buf->skb);
456 rx_buf->page = NULL;
457
458 skb = napi_get_frags(napi);
454 if (!skb) { 459 if (!skb) {
455 put_page(rx_buf->page); 460 put_page(page);
456 gro_result = GRO_DROP; 461 return;
457 goto out;
458 } 462 }
459 463
460 skb_shinfo(skb)->frags[0].page = rx_buf->page; 464 skb_shinfo(skb)->frags[0].page = page;
461 skb_shinfo(skb)->frags[0].page_offset = 465 skb_shinfo(skb)->frags[0].page_offset =
462 efx_rx_buf_offset(rx_buf); 466 efx_rx_buf_offset(rx_buf);
463 skb_shinfo(skb)->frags[0].size = rx_buf->len; 467 skb_shinfo(skb)->frags[0].size = rx_buf->len;
@@ -470,16 +474,14 @@ static void efx_rx_packet_lro(struct efx_channel *channel,
470 checksummed ? CHECKSUM_UNNECESSARY : CHECKSUM_NONE; 474 checksummed ? CHECKSUM_UNNECESSARY : CHECKSUM_NONE;
471 475
472 gro_result = napi_gro_frags(napi); 476 gro_result = napi_gro_frags(napi);
473
474out:
475 EFX_BUG_ON_PARANOID(rx_buf->skb);
476 rx_buf->page = NULL;
477 } else { 477 } else {
478 EFX_BUG_ON_PARANOID(!rx_buf->skb); 478 struct sk_buff *skb = rx_buf->skb;
479 EFX_BUG_ON_PARANOID(!checksummed);
480 479
481 gro_result = napi_gro_receive(napi, rx_buf->skb); 480 EFX_BUG_ON_PARANOID(!skb);
481 EFX_BUG_ON_PARANOID(!checksummed);
482 rx_buf->skb = NULL; 482 rx_buf->skb = NULL;
483
484 gro_result = napi_gro_receive(napi, skb);
483 } 485 }
484 486
485 if (gro_result == GRO_NORMAL) { 487 if (gro_result == GRO_NORMAL) {