diff options
author | David S. Miller <davem@davemloft.net> | 2010-05-02 05:21:44 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-05-02 05:21:44 -0400 |
commit | 47d29646a2c1c147d8a7598aeac2c87dd71ed638 (patch) | |
tree | b38f05d82883b5c0fc885812172a546af966d419 | |
parent | 43815482370c510c569fd18edb57afcb0fa8cab6 (diff) |
net: Inline skb_pull() in eth_type_trans().
In commit 6be8ac2f ("[NET]: uninline skb_pull, de-bloats a lot")
we uninlined skb_pull.
But in some critical paths it makes sense to inline this thing
and it helps performance significantly.
Create an skb_pull_inline() so that we can do this in a way that
serves also as annotation.
Based upon a patch by Eric Dumazet.
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | include/linux/skbuff.h | 5 | ||||
-rw-r--r-- | net/core/skbuff.c | 2 | ||||
-rw-r--r-- | net/ethernet/eth.c | 2 |
3 files changed, 7 insertions, 2 deletions
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index 82f5116a89e4..746a652b9f6f 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h | |||
@@ -1128,6 +1128,11 @@ static inline unsigned char *__skb_pull(struct sk_buff *skb, unsigned int len) | |||
1128 | return skb->data += len; | 1128 | return skb->data += len; |
1129 | } | 1129 | } |
1130 | 1130 | ||
1131 | static inline unsigned char *skb_pull_inline(struct sk_buff *skb, unsigned int len) | ||
1132 | { | ||
1133 | return unlikely(len > skb->len) ? NULL : __skb_pull(skb, len); | ||
1134 | } | ||
1135 | |||
1131 | extern unsigned char *__pskb_pull_tail(struct sk_buff *skb, int delta); | 1136 | extern unsigned char *__pskb_pull_tail(struct sk_buff *skb, int delta); |
1132 | 1137 | ||
1133 | static inline unsigned char *__pskb_pull(struct sk_buff *skb, unsigned int len) | 1138 | static inline unsigned char *__pskb_pull(struct sk_buff *skb, unsigned int len) |
diff --git a/net/core/skbuff.c b/net/core/skbuff.c index 4218ff49bf13..8b9c109166a7 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c | |||
@@ -1051,7 +1051,7 @@ EXPORT_SYMBOL(skb_push); | |||
1051 | */ | 1051 | */ |
1052 | unsigned char *skb_pull(struct sk_buff *skb, unsigned int len) | 1052 | unsigned char *skb_pull(struct sk_buff *skb, unsigned int len) |
1053 | { | 1053 | { |
1054 | return unlikely(len > skb->len) ? NULL : __skb_pull(skb, len); | 1054 | return skb_pull_inline(skb, len); |
1055 | } | 1055 | } |
1056 | EXPORT_SYMBOL(skb_pull); | 1056 | EXPORT_SYMBOL(skb_pull); |
1057 | 1057 | ||
diff --git a/net/ethernet/eth.c b/net/ethernet/eth.c index 0c0d272a9888..61ec0329316c 100644 --- a/net/ethernet/eth.c +++ b/net/ethernet/eth.c | |||
@@ -162,7 +162,7 @@ __be16 eth_type_trans(struct sk_buff *skb, struct net_device *dev) | |||
162 | 162 | ||
163 | skb->dev = dev; | 163 | skb->dev = dev; |
164 | skb_reset_mac_header(skb); | 164 | skb_reset_mac_header(skb); |
165 | skb_pull(skb, ETH_HLEN); | 165 | skb_pull_inline(skb, ETH_HLEN); |
166 | eth = eth_hdr(skb); | 166 | eth = eth_hdr(skb); |
167 | 167 | ||
168 | if (unlikely(is_multicast_ether_addr(eth->h_dest))) { | 168 | if (unlikely(is_multicast_ether_addr(eth->h_dest))) { |