diff --git a/include/linux/etherdevice.h b/include/linux/etherdevice.h index 25d62e6..94af6a7 100644 --- a/include/linux/etherdevice.h +++ b/include/linux/etherdevice.h @@ -128,7 +128,7 @@ static inline void random_ether_addr(u8 *addr) * * Compare two ethernet addresses, returns 0 if equal */ -static inline unsigned compare_ether_addr(const u8 *addr1, const u8 *addr2) +static __always_inline unsigned compare_ether_addr(const u8 *addr1, const u8 *addr2) { const u16 *a = (const u16 *) addr1; const u16 *b = (const u16 *) addr2; diff --git a/net/ethernet/eth.c b/net/ethernet/eth.c index b9d85af..30b60b2 100644 --- a/net/ethernet/eth.c +++ b/net/ethernet/eth.c @@ -162,7 +162,12 @@ __be16 eth_type_trans(struct sk_buff *skb, struct net_device *dev) skb->dev = dev; skb_reset_mac_header(skb); - skb_pull(skb, ETH_HLEN); + /* + * Hand coded skb_pull(skb, ETH_HLEN) to avoid a function call + */ + if (likely(skb->len >= ETH_HLEN)) + __skb_pull(skb, ETH_HLEN); + eth = eth_hdr(skb); if (is_multicast_ether_addr(eth->h_dest)) {