Skip to contentSkip to conversation

ethernet: call __skb_pull() in eth_type_trans()

PATCH Superseded Changli Gao 2 participants 2 messages May 3, 2010

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ethernet: call __skb_pull() in eth_type_trans()

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.

----

 net/ethernet/eth.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/ethernet/eth.c +1 -1
index 61ec032..aacbaf7 100644
@@ -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))) {
maintainer
#1 lore raw

From: Changli Gao <[email protected]>
Date: Mon, 3 May 2010 06:50:17 +0800

Quoted 6 lines

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.

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.