ethernet: cleanup eth_type_trans
Subsystems (2)
PATCH 1/2 ethernet: cleanup eth_type_trans
Remove old legacy comment and weird if condition.
The comment has outlived it's stay and is throwback to some early net code (before my time). Maybe Dave remembers what it meant.
net/ethernet/eth.c +3 -14
@@ -169,20 +169,9 @@ __be16 eth_type_trans(struct sk_buff *skelse skb->pkt_type =PACKET_MULTICAST ; } - -/* -* This ALLMULTI check should be redundant by 1.4 -* so don't forget to remove it. -* -* Seems, you forgot to remove it. All silly devices -* seems to set IFF_PROMISC. -*/ - -else if (1 /*dev->flags&IFF_PROMISC */ ) { -if (unlikely (!ether_addr_equal_64bits (eth->h_dest, - dev->dev_addr))) - skb->pkt_type =PACKET_OTHERHOST ; - } +else if (unlikely (!ether_addr_equal_64bits (eth->h_dest, + dev->dev_addr))) + skb->pkt_type =PACKET_OTHERHOST ;/* * Some variants of DSA tagging don't have an ethertype field
PATCH 2/2 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
net/ethernet/eth.c +5 -4
@@ -179,12 +179,13 @@ __be16 eth_type_trans(struct sk_buff *sk* 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 *sk* 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 );/*
Re: [PATCH net-next 2/2] ethernet: use likely() for common Ethernet encap
From: Stephen Hemminger <[email protected]>
Date: Fri, 27 Sep 2013 17:21:27 -0700
Quoted 6 lines
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 encapsulationSigned-off-by Stephen Hemminger <[email protected]>
Applied.
From: Stephen Hemminger <[email protected]>
Date: Fri, 27 Sep 2013 17:19:41 -0700
Quoted 5 lines
Remove old legacy comment and weird if condition.
The comment has outlived it's stay and is throwback to some early net code (before my time). Maybe Dave remembers what it meant.Signed-off-by Stephen Hemminger <[email protected]>
Applied.