public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ethernet: call __skb_pull() in eth_type_trans()
@ 2010-05-02 22:50 Changli Gao
  2010-05-03  7:59 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Changli Gao @ 2010-05-02 22:50 UTC (permalink / raw)
  To: David Miller; +Cc: eric.dumazet, netdev, Changli Gao

call __skb_pull() in eth_type_trans().

Since the callers of eth_type_trans() always feed it long enough packets,
we can use __skb_pull() to save some cycles.

Signed-off-by: Changli Gao <xiaosuo@gmail.com>
----
 net/ethernet/eth.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/ethernet/eth.c b/net/ethernet/eth.c
index 61ec032..aacbaf7 100644
--- a/net/ethernet/eth.c
+++ b/net/ethernet/eth.c
@@ -162,7 +162,7 @@ __be16 eth_type_trans(struct sk_buff *skb, struct net_device *dev)
 
 	skb->dev = dev;
 	skb_reset_mac_header(skb);
-	skb_pull_inline(skb, ETH_HLEN);
+	__skb_pull(skb, ETH_HLEN);
 	eth = eth_hdr(skb);
 
 	if (unlikely(is_multicast_ether_addr(eth->h_dest))) {

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

* Re: [PATCH] ethernet: call __skb_pull() in eth_type_trans()
  2010-05-02 22:50 [PATCH] ethernet: call __skb_pull() in eth_type_trans() Changli Gao
@ 2010-05-03  7:59 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2010-05-03  7:59 UTC (permalink / raw)
  To: xiaosuo; +Cc: eric.dumazet, netdev

From: Changli Gao <xiaosuo@gmail.com>
Date: Mon,  3 May 2010 06:50:17 +0800

> call __skb_pull() in eth_type_trans().
> 
> Since the callers of eth_type_trans() always feed it long enough packets,
> we can use __skb_pull() to save some cycles.
> 
> Signed-off-by: Changli Gao <xiaosuo@gmail.com>

Although they should, assuming that some runts won't show up here and
never check for that condition at all is dangerous.

At least we should have a WARN_ON() check for skb->len < ETH_ZLEN here
or similar.

So many other things get layered into ethernet, which means adding
this length assumption without any checks is bound to lead to
unpleasant surprises for somebody.

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

end of thread, other threads:[~2010-05-03  7:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-02 22:50 [PATCH] ethernet: call __skb_pull() in eth_type_trans() Changli Gao
2010-05-03  7:59 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox