Commit 56d7b53f authored by stephen hemminger's avatar stephen hemminger Committed by David S. Miller

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: default avatarStephen Hemminger <stephen@networkplumber.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 12861b7b
...@@ -179,12 +179,13 @@ __be16 eth_type_trans(struct sk_buff *skb, struct net_device *dev) ...@@ -179,12 +179,13 @@ __be16 eth_type_trans(struct sk_buff *skb, struct net_device *dev)
* variants has been configured on the receiving interface, * variants has been configured on the receiving interface,
* and if so, set skb->protocol without looking at the packet. * 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); return htons(ETH_P_DSA);
if (netdev_uses_trailer_tags(dev))
if (unlikely(netdev_uses_trailer_tags(dev)))
return htons(ETH_P_TRAILER); 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; return eth->h_proto;
/* /*
...@@ -193,7 +194,7 @@ __be16 eth_type_trans(struct sk_buff *skb, struct net_device *dev) ...@@ -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 * 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. * 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); return htons(ETH_P_802_3);
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment