diff options
author | stephen hemminger <stephen@networkplumber.org> | 2013-09-28 02:21:27 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-10-01 06:52:53 +0200 |
commit | 56d7b53f47e7c9a0ab1c6289f2669a8d3a65cf17 (patch) | |
tree | d07ed00e0c65e64622b53182ad063e7cd51675c4 /net/ethernet/eth.c | |
parent | ethernet: cleanup eth_type_trans (diff) | |
download | linux-56d7b53f47e7c9a0ab1c6289f2669a8d3a65cf17.tar.xz linux-56d7b53f47e7c9a0ab1c6289f2669a8d3a65cf17.zip |
ethernet: use likely() for common Ethernet encap
Mark code path's likely/unlikely based on most common usage.
* Very few devices use dsa tags.
* Most traffic is Ethernet (not 802.2)
* No sane person uses trailer type or Novell encapsulation
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ethernet/eth.c')
-rw-r--r-- | net/ethernet/eth.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/net/ethernet/eth.c b/net/ethernet/eth.c index f777e17d28c8..8f032bae60ad 100644 --- a/net/ethernet/eth.c +++ b/net/ethernet/eth.c @@ -179,12 +179,13 @@ __be16 eth_type_trans(struct sk_buff *skb, struct net_device *dev) * variants has been configured on the receiving interface, * and if so, set skb->protocol without looking at the packet. */ - if (netdev_uses_dsa_tags(dev)) + if (unlikely(netdev_uses_dsa_tags(dev))) return htons(ETH_P_DSA); - if (netdev_uses_trailer_tags(dev)) + + if (unlikely(netdev_uses_trailer_tags(dev))) return htons(ETH_P_TRAILER); - if (ntohs(eth->h_proto) >= ETH_P_802_3_MIN) + if (likely(ntohs(eth->h_proto) >= ETH_P_802_3_MIN)) return eth->h_proto; /* @@ -193,7 +194,7 @@ __be16 eth_type_trans(struct sk_buff *skb, struct net_device *dev) * layer. We look for FFFF which isn't a used 802.2 SSAP/DSAP. This * won't work for fault tolerant netware but does for the rest. */ - if (skb->len >= 2 && *(unsigned short *)(skb->data) == 0xFFFF) + if (unlikely(skb->len >= 2 && *(unsigned short *)(skb->data) == 0xFFFF)) return htons(ETH_P_802_3); /* |