Skip to content

Commit 6da5912

Browse files
Vince BridgersDinh Nguyen
authored andcommitted
FogBugz #171833: Strip VLAN tags in EMAC Receive path so GRO works as expected
The EMAC driver was advertising the NETIF_F_HW_VLAN_TAG_RX feature flag, which indicates that the hardware supports VLAN tag stripping in receive frames, but the hardware does not support VLAN tag stripping, and the driver was not stripping the VLANs either. This causes a slow processing path to be taken in the GRO portion of the stack's receive processing, drastically impacting receive performance. The fix is for the driver to detect and strip the VLAN tag correctly, and correctly setting any detected and received VLAN tag into the skb. Signed-off-by: Vince Bridgers <[email protected]>
1 parent 7850c5f commit 6da5912

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

drivers/net/ethernet/stmicro/stmmac/stmmac_main.c

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1994,6 +1994,21 @@ static inline void stmmac_rx_refill(struct stmmac_priv *priv)
19941994
}
19951995
}
19961996

1997+
static inline void stmmac_rx_vlan(struct net_device *dev, struct sk_buff *skb)
1998+
{
1999+
struct ethhdr *eth_hdr;
2000+
u16 vid;
2001+
if ((dev->features & NETIF_F_HW_VLAN_CTAG_RX) ==
2002+
NETIF_F_HW_VLAN_CTAG_RX &&
2003+
!__vlan_get_tag(skb, &vid)) {
2004+
/* pop the VLAN tag, fix up the packet */
2005+
eth_hdr = (struct ethhdr *)skb->data;
2006+
memmove(skb->data + VLAN_HLEN, eth_hdr, ETH_ALEN * 2);
2007+
skb_pull(skb, VLAN_HLEN);
2008+
__vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), vid);
2009+
}
2010+
}
2011+
19972012
/**
19982013
* stmmac_rx_refill: refill used skb preallocated buffers
19992014
* @priv: driver private structure
@@ -2099,6 +2114,8 @@ static int stmmac_rx(struct stmmac_priv *priv, int limit)
20992114
print_pkt(skb->data, frame_len);
21002115
}
21012116

2117+
stmmac_rx_vlan(priv->dev, skb);
2118+
21022119
skb->protocol = eth_type_trans(skb, priv->dev);
21032120

21042121
if (unlikely(!coe))

0 commit comments

Comments
 (0)