aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorEric Dumazet <edumazet@google.com>2012-12-10 08:28:16 -0500
committerDavid S. Miller <davem@davemloft.net>2012-12-11 12:49:53 -0500
commit89c5fa3369a47db0df904c45c1c26e64c0404430 (patch)
tree5ec8a34731214875b458d812f5c007a260f004ce /net
parentf8e8f97c11d5ff3cc47d85b97c7c35e443dcf490 (diff)
net: gro: dev_gro_receive() cleanup
__napi_gro_receive() is inlined from two call sites for no good reason. Lets move the prep stuff in a function of its own, called only if/when needed. This saves 300 bytes on x86 : # size net/core/dev.o.after net/core/dev.o.before text data bss dec hex filename 51968 1238 1040 54246 d3e6 net/core/dev.o.before 51664 1238 1040 53942 d2b6 net/core/dev.o.after Signed-off-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/core/dev.c52
1 files changed, 26 insertions, 26 deletions
diff --git a/net/core/dev.c b/net/core/dev.c
index a4c4a1bf07d..47838509f5f 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -3603,6 +3603,28 @@ void napi_gro_flush(struct napi_struct *napi, bool flush_old)
3603} 3603}
3604EXPORT_SYMBOL(napi_gro_flush); 3604EXPORT_SYMBOL(napi_gro_flush);
3605 3605
3606static void gro_list_prepare(struct napi_struct *napi, struct sk_buff *skb)
3607{
3608 struct sk_buff *p;
3609 unsigned int maclen = skb->dev->hard_header_len;
3610
3611 for (p = napi->gro_list; p; p = p->next) {
3612 unsigned long diffs;
3613
3614 diffs = (unsigned long)p->dev ^ (unsigned long)skb->dev;
3615 diffs |= p->vlan_tci ^ skb->vlan_tci;
3616 if (maclen == ETH_HLEN)
3617 diffs |= compare_ether_header(skb_mac_header(p),
3618 skb_gro_mac_header(skb));
3619 else if (!diffs)
3620 diffs = memcmp(skb_mac_header(p),
3621 skb_gro_mac_header(skb),
3622 maclen);
3623 NAPI_GRO_CB(p)->same_flow = !diffs;
3624 NAPI_GRO_CB(p)->flush = 0;
3625 }
3626}
3627
3606static enum gro_result dev_gro_receive(struct napi_struct *napi, struct sk_buff *skb) 3628static enum gro_result dev_gro_receive(struct napi_struct *napi, struct sk_buff *skb)
3607{ 3629{
3608 struct sk_buff **pp = NULL; 3630 struct sk_buff **pp = NULL;
@@ -3619,6 +3641,8 @@ static enum gro_result dev_gro_receive(struct napi_struct *napi, struct sk_buff
3619 if (skb_is_gso(skb) || skb_has_frag_list(skb)) 3641 if (skb_is_gso(skb) || skb_has_frag_list(skb))
3620 goto normal; 3642 goto normal;
3621 3643
3644 gro_list_prepare(napi, skb);
3645
3622 rcu_read_lock(); 3646 rcu_read_lock();
3623 list_for_each_entry_rcu(ptype, head, list) { 3647 list_for_each_entry_rcu(ptype, head, list) {
3624 if (ptype->type != type || !ptype->callbacks.gro_receive) 3648 if (ptype->type != type || !ptype->callbacks.gro_receive)
@@ -3695,30 +3719,6 @@ normal:
3695 goto pull; 3719 goto pull;
3696} 3720}
3697 3721
3698static inline gro_result_t
3699__napi_gro_receive(struct napi_struct *napi, struct sk_buff *skb)
3700{
3701 struct sk_buff *p;
3702 unsigned int maclen = skb->dev->hard_header_len;
3703
3704 for (p = napi->gro_list; p; p = p->next) {
3705 unsigned long diffs;
3706
3707 diffs = (unsigned long)p->dev ^ (unsigned long)skb->dev;
3708 diffs |= p->vlan_tci ^ skb->vlan_tci;
3709 if (maclen == ETH_HLEN)
3710 diffs |= compare_ether_header(skb_mac_header(p),
3711 skb_gro_mac_header(skb));
3712 else if (!diffs)
3713 diffs = memcmp(skb_mac_header(p),
3714 skb_gro_mac_header(skb),
3715 maclen);
3716 NAPI_GRO_CB(p)->same_flow = !diffs;
3717 NAPI_GRO_CB(p)->flush = 0;
3718 }
3719
3720 return dev_gro_receive(napi, skb);
3721}
3722 3722
3723static gro_result_t napi_skb_finish(gro_result_t ret, struct sk_buff *skb) 3723static gro_result_t napi_skb_finish(gro_result_t ret, struct sk_buff *skb)
3724{ 3724{
@@ -3768,7 +3768,7 @@ gro_result_t napi_gro_receive(struct napi_struct *napi, struct sk_buff *skb)
3768{ 3768{
3769 skb_gro_reset_offset(skb); 3769 skb_gro_reset_offset(skb);
3770 3770
3771 return napi_skb_finish(__napi_gro_receive(napi, skb), skb); 3771 return napi_skb_finish(dev_gro_receive(napi, skb), skb);
3772} 3772}
3773EXPORT_SYMBOL(napi_gro_receive); 3773EXPORT_SYMBOL(napi_gro_receive);
3774 3774
@@ -3866,7 +3866,7 @@ gro_result_t napi_gro_frags(struct napi_struct *napi)
3866 if (!skb) 3866 if (!skb)
3867 return GRO_DROP; 3867 return GRO_DROP;
3868 3868
3869 return napi_frags_finish(napi, skb, __napi_gro_receive(napi, skb)); 3869 return napi_frags_finish(napi, skb, dev_gro_receive(napi, skb));
3870} 3870}
3871EXPORT_SYMBOL(napi_gro_frags); 3871EXPORT_SYMBOL(napi_gro_frags);
3872 3872