aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorEric Dumazet <eric.dumazet@gmail.com>2010-08-27 01:03:08 -0400
committerDavid S. Miller <davem@davemloft.net>2010-08-27 01:03:08 -0400
commit40d0802b3eb47d57e2d57a5244a18cbbe9632e13 (patch)
treefd45987286080e1f711c2448f6fbdc7d362a0241 /net
parent250ad8f55c06eb866cfb57f8d3ea6ff961a7d1d7 (diff)
gro: __napi_gro_receive() optimizations
compare_ether_header() can have a special implementation on 64 bit arches if CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS is defined. __napi_gro_receive() and vlan_gro_common() can avoid a conditional branch to perform device match. On x86_64, __napi_gro_receive() has now 38 instructions instead of 53 As gcc-4.4.3 still choose to not inline it, add inline keyword to this performance critical function. Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com> CC: 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.c9
-rw-r--r--net/core/dev.c10
2 files changed, 12 insertions, 7 deletions
diff --git a/net/8021q/vlan_core.c b/net/8021q/vlan_core.c
index 07eeb5b99dce..3438c01bbacf 100644
--- a/net/8021q/vlan_core.c
+++ b/net/8021q/vlan_core.c
@@ -105,9 +105,12 @@ vlan_gro_common(struct napi_struct *napi, struct vlan_group *grp,
105 goto drop; 105 goto drop;
106 106
107 for (p = napi->gro_list; p; p = p->next) { 107 for (p = napi->gro_list; p; p = p->next) {
108 NAPI_GRO_CB(p)->same_flow = 108 unsigned long diffs;
109 p->dev == skb->dev && !compare_ether_header( 109
110 skb_mac_header(p), skb_gro_mac_header(skb)); 110 diffs = (unsigned long)p->dev ^ (unsigned long)skb->dev;
111 diffs |= compare_ether_header(skb_mac_header(p),
112 skb_gro_mac_header(skb));
113 NAPI_GRO_CB(p)->same_flow = !diffs;
111 NAPI_GRO_CB(p)->flush = 0; 114 NAPI_GRO_CB(p)->flush = 0;
112 } 115 }
113 116
diff --git a/net/core/dev.c b/net/core/dev.c
index 859e30ff044a..63bd20a75929 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -3169,16 +3169,18 @@ normal:
3169} 3169}
3170EXPORT_SYMBOL(dev_gro_receive); 3170EXPORT_SYMBOL(dev_gro_receive);
3171 3171
3172static gro_result_t 3172static inline gro_result_t
3173__napi_gro_receive(struct napi_struct *napi, struct sk_buff *skb) 3173__napi_gro_receive(struct napi_struct *napi, struct sk_buff *skb)
3174{ 3174{
3175 struct sk_buff *p; 3175 struct sk_buff *p;
3176 3176
3177 for (p = napi->gro_list; p; p = p->next) { 3177 for (p = napi->gro_list; p; p = p->next) {
3178 NAPI_GRO_CB(p)->same_flow = 3178 unsigned long diffs;
3179 (p->dev == skb->dev) && 3179
3180 !compare_ether_header(skb_mac_header(p), 3180 diffs = (unsigned long)p->dev ^ (unsigned long)skb->dev;
3181 diffs |= compare_ether_header(skb_mac_header(p),
3181 skb_gro_mac_header(skb)); 3182 skb_gro_mac_header(skb));
3183 NAPI_GRO_CB(p)->same_flow = !diffs;
3182 NAPI_GRO_CB(p)->flush = 0; 3184 NAPI_GRO_CB(p)->flush = 0;
3183 } 3185 }
3184 3186