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 | |
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')
-rw-r--r-- | net/8021q/vlan_core.c | 16 | ||||
-rw-r--r-- | net/core/dev.c | 38 |
2 files changed, 24 insertions, 30 deletions
diff --git a/net/8021q/vlan_core.c b/net/8021q/vlan_core.c index 47a80d65c3b7..8d5ca2ac4f8d 100644 --- a/net/8021q/vlan_core.c +++ b/net/8021q/vlan_core.c | |||
@@ -102,11 +102,12 @@ drop: | |||
102 | return GRO_DROP; | 102 | return GRO_DROP; |
103 | } | 103 | } |
104 | 104 | ||
105 | int vlan_gro_receive(struct napi_struct *napi, struct vlan_group *grp, | 105 | gro_result_t vlan_gro_receive(struct napi_struct *napi, struct vlan_group *grp, |
106 | unsigned int vlan_tci, struct sk_buff *skb) | 106 | unsigned int vlan_tci, struct sk_buff *skb) |
107 | { | 107 | { |
108 | if (netpoll_rx_on(skb)) | 108 | if (netpoll_rx_on(skb)) |
109 | return vlan_hwaccel_receive_skb(skb, grp, vlan_tci); | 109 | return vlan_hwaccel_receive_skb(skb, grp, vlan_tci) |
110 | ? GRO_DROP : GRO_NORMAL; | ||
110 | 111 | ||
111 | skb_gro_reset_offset(skb); | 112 | skb_gro_reset_offset(skb); |
112 | 113 | ||
@@ -114,17 +115,18 @@ int vlan_gro_receive(struct napi_struct *napi, struct vlan_group *grp, | |||
114 | } | 115 | } |
115 | EXPORT_SYMBOL(vlan_gro_receive); | 116 | EXPORT_SYMBOL(vlan_gro_receive); |
116 | 117 | ||
117 | int vlan_gro_frags(struct napi_struct *napi, struct vlan_group *grp, | 118 | gro_result_t vlan_gro_frags(struct napi_struct *napi, struct vlan_group *grp, |
118 | unsigned int vlan_tci) | 119 | unsigned int vlan_tci) |
119 | { | 120 | { |
120 | struct sk_buff *skb = napi_frags_skb(napi); | 121 | struct sk_buff *skb = napi_frags_skb(napi); |
121 | 122 | ||
122 | if (!skb) | 123 | if (!skb) |
123 | return NET_RX_DROP; | 124 | return GRO_DROP; |
124 | 125 | ||
125 | if (netpoll_rx_on(skb)) { | 126 | if (netpoll_rx_on(skb)) { |
126 | skb->protocol = eth_type_trans(skb, skb->dev); | 127 | skb->protocol = eth_type_trans(skb, skb->dev); |
127 | return vlan_hwaccel_receive_skb(skb, grp, vlan_tci); | 128 | return vlan_hwaccel_receive_skb(skb, grp, vlan_tci) |
129 | ? GRO_DROP : GRO_NORMAL; | ||
128 | } | 130 | } |
129 | 131 | ||
130 | return napi_frags_finish(napi, skb, | 132 | return napi_frags_finish(napi, skb, |
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 | } |