diff options
author | Ben Hutchings <bhutchings@solarflare.com> | 2009-10-30 00:36:53 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-10-30 00:36:53 -0400 |
commit | c7c4b3b6e976b95facbb723951bdcd554a3530a4 (patch) | |
tree | 9a53a7f850eec755b3c66d4a129d31ce4a8591da /net/core | |
parent | 5b252f0c2f98df21fadf0f6cf189b87a0b938228 (diff) |
gro: Change all receive functions to return GRO result codes
This will allow drivers to adjust their receive path dynamically
based on whether GRO is being applied successfully.
Currently all in-tree callers ignore the return values of these
functions and do not need to be changed.
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Acked-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core')
-rw-r--r-- | net/core/dev.c | 38 |
1 files changed, 15 insertions, 23 deletions
diff --git a/net/core/dev.c b/net/core/dev.c index 1dc13744684c..631cc40da197 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
@@ -2586,18 +2586,15 @@ __napi_gro_receive(struct napi_struct *napi, struct sk_buff *skb) | |||
2586 | return dev_gro_receive(napi, skb); | 2586 | return dev_gro_receive(napi, skb); |
2587 | } | 2587 | } |
2588 | 2588 | ||
2589 | int napi_skb_finish(gro_result_t ret, struct sk_buff *skb) | 2589 | gro_result_t napi_skb_finish(gro_result_t ret, struct sk_buff *skb) |
2590 | { | 2590 | { |
2591 | int err = NET_RX_SUCCESS; | ||
2592 | |||
2593 | switch (ret) { | 2591 | switch (ret) { |
2594 | case GRO_NORMAL: | 2592 | case GRO_NORMAL: |
2595 | return netif_receive_skb(skb); | 2593 | if (netif_receive_skb(skb)) |
2594 | ret = GRO_DROP; | ||
2595 | break; | ||
2596 | 2596 | ||
2597 | case GRO_DROP: | 2597 | case GRO_DROP: |
2598 | err = NET_RX_DROP; | ||
2599 | /* fall through */ | ||
2600 | |||
2601 | case GRO_MERGED_FREE: | 2598 | case GRO_MERGED_FREE: |
2602 | kfree_skb(skb); | 2599 | kfree_skb(skb); |
2603 | break; | 2600 | break; |
@@ -2607,7 +2604,7 @@ int napi_skb_finish(gro_result_t ret, struct sk_buff *skb) | |||
2607 | break; | 2604 | break; |
2608 | } | 2605 | } |
2609 | 2606 | ||
2610 | return err; | 2607 | return ret; |
2611 | } | 2608 | } |
2612 | EXPORT_SYMBOL(napi_skb_finish); | 2609 | EXPORT_SYMBOL(napi_skb_finish); |
2613 | 2610 | ||
@@ -2627,7 +2624,7 @@ void skb_gro_reset_offset(struct sk_buff *skb) | |||
2627 | } | 2624 | } |
2628 | EXPORT_SYMBOL(skb_gro_reset_offset); | 2625 | EXPORT_SYMBOL(skb_gro_reset_offset); |
2629 | 2626 | ||
2630 | int napi_gro_receive(struct napi_struct *napi, struct sk_buff *skb) | 2627 | gro_result_t napi_gro_receive(struct napi_struct *napi, struct sk_buff *skb) |
2631 | { | 2628 | { |
2632 | skb_gro_reset_offset(skb); | 2629 | skb_gro_reset_offset(skb); |
2633 | 2630 | ||
@@ -2657,26 +2654,21 @@ struct sk_buff *napi_get_frags(struct napi_struct *napi) | |||
2657 | } | 2654 | } |
2658 | EXPORT_SYMBOL(napi_get_frags); | 2655 | EXPORT_SYMBOL(napi_get_frags); |
2659 | 2656 | ||
2660 | int napi_frags_finish(struct napi_struct *napi, struct sk_buff *skb, | 2657 | gro_result_t napi_frags_finish(struct napi_struct *napi, struct sk_buff *skb, |
2661 | gro_result_t ret) | 2658 | gro_result_t ret) |
2662 | { | 2659 | { |
2663 | int err = NET_RX_SUCCESS; | ||
2664 | |||
2665 | switch (ret) { | 2660 | switch (ret) { |
2666 | case GRO_NORMAL: | 2661 | case GRO_NORMAL: |
2667 | case GRO_HELD: | 2662 | case GRO_HELD: |
2668 | skb->protocol = eth_type_trans(skb, napi->dev); | 2663 | skb->protocol = eth_type_trans(skb, napi->dev); |
2669 | 2664 | ||
2670 | if (ret == GRO_NORMAL) | 2665 | if (ret == GRO_HELD) |
2671 | return netif_receive_skb(skb); | 2666 | skb_gro_pull(skb, -ETH_HLEN); |
2672 | 2667 | else if (netif_receive_skb(skb)) | |
2673 | skb_gro_pull(skb, -ETH_HLEN); | 2668 | ret = GRO_DROP; |
2674 | break; | 2669 | break; |
2675 | 2670 | ||
2676 | case GRO_DROP: | 2671 | case GRO_DROP: |
2677 | err = NET_RX_DROP; | ||
2678 | /* fall through */ | ||
2679 | |||
2680 | case GRO_MERGED_FREE: | 2672 | case GRO_MERGED_FREE: |
2681 | napi_reuse_skb(napi, skb); | 2673 | napi_reuse_skb(napi, skb); |
2682 | break; | 2674 | break; |
@@ -2685,7 +2677,7 @@ int napi_frags_finish(struct napi_struct *napi, struct sk_buff *skb, | |||
2685 | break; | 2677 | break; |
2686 | } | 2678 | } |
2687 | 2679 | ||
2688 | return err; | 2680 | return ret; |
2689 | } | 2681 | } |
2690 | EXPORT_SYMBOL(napi_frags_finish); | 2682 | EXPORT_SYMBOL(napi_frags_finish); |
2691 | 2683 | ||
@@ -2726,12 +2718,12 @@ out: | |||
2726 | } | 2718 | } |
2727 | EXPORT_SYMBOL(napi_frags_skb); | 2719 | EXPORT_SYMBOL(napi_frags_skb); |
2728 | 2720 | ||
2729 | int napi_gro_frags(struct napi_struct *napi) | 2721 | gro_result_t napi_gro_frags(struct napi_struct *napi) |
2730 | { | 2722 | { |
2731 | struct sk_buff *skb = napi_frags_skb(napi); | 2723 | struct sk_buff *skb = napi_frags_skb(napi); |
2732 | 2724 | ||
2733 | if (!skb) | 2725 | if (!skb) |
2734 | return NET_RX_DROP; | 2726 | return GRO_DROP; |
2735 | 2727 | ||
2736 | return napi_frags_finish(napi, skb, __napi_gro_receive(napi, skb)); | 2728 | return napi_frags_finish(napi, skb, __napi_gro_receive(napi, skb)); |
2737 | } | 2729 | } |