aboutsummaryrefslogtreecommitdiffstats
path: root/net/ethernet
diff options
context:
space:
mode:
authorAlexander Duyck <alexander.h.duyck@redhat.com>2015-04-30 17:53:59 -0400
committerDavid S. Miller <davem@davemloft.net>2015-05-03 22:30:36 -0400
commit610986e7262624e2dd29ad8dea05b4e1ac3f07fb (patch)
tree3f5fe450644b92d062c9e6f52a56e9e50bcec8f5 /net/ethernet
parentd54385ce68cd18ab002b46f61246ad197cec92de (diff)
etherdev: Use skb->data to retrieve Ethernet header instead of eth_hdr
Avoid recomputing the Ethernet header location and instead just use the pointer provided by skb->data. The problem with using eth_hdr is that the compiler wasn't smart enough to realize that skb->head + skb->mac_header was the same thing as skb->data before it added ETH_HLEN. By just caching it off before calling skb_pull_inline we can avoid a few unnecessary instructions. Signed-off-by: Alexander Duyck <alexander.h.duyck@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ethernet')
-rw-r--r--net/ethernet/eth.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/net/ethernet/eth.c b/net/ethernet/eth.c
index 21c211e9fd5a..314e4c5a5a5e 100644
--- a/net/ethernet/eth.c
+++ b/net/ethernet/eth.c
@@ -156,8 +156,9 @@ __be16 eth_type_trans(struct sk_buff *skb, struct net_device *dev)
156 156
157 skb->dev = dev; 157 skb->dev = dev;
158 skb_reset_mac_header(skb); 158 skb_reset_mac_header(skb);
159
160 eth = (struct ethhdr *)skb->data;
159 skb_pull_inline(skb, ETH_HLEN); 161 skb_pull_inline(skb, ETH_HLEN);
160 eth = eth_hdr(skb);
161 162
162 if (unlikely(is_multicast_ether_addr_64bits(eth->h_dest))) { 163 if (unlikely(is_multicast_ether_addr_64bits(eth->h_dest))) {
163 if (ether_addr_equal_64bits(eth->h_dest, dev->broadcast)) 164 if (ether_addr_equal_64bits(eth->h_dest, dev->broadcast))