netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next 1/2] ethernet: cleanup eth_type_trans
@ 2013-09-28  0:19 Stephen Hemminger
  2013-09-28  0:21 ` [PATCH net-next 2/2] ethernet: use likely() for common Ethernet encap Stephen Hemminger
  2013-10-01  4:53 ` [PATCH net-next 1/2] ethernet: cleanup eth_type_trans David Miller
  0 siblings, 2 replies; 4+ messages in thread
From: Stephen Hemminger @ 2013-09-28  0:19 UTC (permalink / raw)
  To: David Miller; +Cc: netdev

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 <stephen@networkplumber.org>

--- a/net/ethernet/eth.c	2013-09-26 17:25:54.093639280 -0700
+++ b/net/ethernet/eth.c	2013-09-26 17:34:35.363115182 -0700
@@ -169,20 +169,9 @@ __be16 eth_type_trans(struct sk_buff *sk
 		else
 			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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH net-next 2/2] ethernet: use likely() for common Ethernet encap
  2013-09-28  0:19 [PATCH net-next 1/2] ethernet: cleanup eth_type_trans Stephen Hemminger
@ 2013-09-28  0:21 ` Stephen Hemminger
  2013-10-01  4:53   ` David Miller
  2013-10-01  4:53 ` [PATCH net-next 1/2] ethernet: cleanup eth_type_trans David Miller
  1 sibling, 1 reply; 4+ messages in thread
From: Stephen Hemminger @ 2013-09-28  0:21 UTC (permalink / raw)
  To: David Miller; +Cc: netdev

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>


--- a/net/ethernet/eth.c	2013-09-26 17:34:35.363115182 -0700
+++ b/net/ethernet/eth.c	2013-09-26 17:34:38.915070453 -0700
@@ -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);
 
 	/*

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH net-next 1/2] ethernet: cleanup eth_type_trans
  2013-09-28  0:19 [PATCH net-next 1/2] ethernet: cleanup eth_type_trans Stephen Hemminger
  2013-09-28  0:21 ` [PATCH net-next 2/2] ethernet: use likely() for common Ethernet encap Stephen Hemminger
@ 2013-10-01  4:53 ` David Miller
  1 sibling, 0 replies; 4+ messages in thread
From: David Miller @ 2013-10-01  4:53 UTC (permalink / raw)
  To: stephen; +Cc: netdev

From: Stephen Hemminger <stephen@networkplumber.org>
Date: Fri, 27 Sep 2013 17:19:41 -0700

> 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 <stephen@networkplumber.org>

Applied.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH net-next 2/2] ethernet: use likely() for common Ethernet encap
  2013-09-28  0:21 ` [PATCH net-next 2/2] ethernet: use likely() for common Ethernet encap Stephen Hemminger
@ 2013-10-01  4:53   ` David Miller
  0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2013-10-01  4:53 UTC (permalink / raw)
  To: stephen; +Cc: netdev

From: Stephen Hemminger <stephen@networkplumber.org>
Date: Fri, 27 Sep 2013 17:21:27 -0700

> 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>

Applied.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-10-01  4:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-28  0:19 [PATCH net-next 1/2] ethernet: cleanup eth_type_trans Stephen Hemminger
2013-09-28  0:21 ` [PATCH net-next 2/2] ethernet: use likely() for common Ethernet encap Stephen Hemminger
2013-10-01  4:53   ` David Miller
2013-10-01  4:53 ` [PATCH net-next 1/2] ethernet: cleanup eth_type_trans David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).