From: Piotr Warpechowski Enhance protocol extraction in stmmac_has_ip_ethertype() by introducing MAC offset parameter and changing: __vlan_get_protocol() -> __vlan_get_protocol_offset() Add correct header length for VLAN tags, which enable Generic Receive Offload (GRO) in VLAN. Co-developed-by: Karol Jurczenia Signed-off-by: Karol Jurczenia Reviewed-by: Konrad Leszczynski Reviewed-by: Sebastian Basierski Signed-off-by: Piotr Warpechowski --- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 3823432b16f1..5ef78fb3f900 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -4585,13 +4585,14 @@ static netdev_tx_t stmmac_tso_xmit(struct sk_buff *skb, struct net_device *dev) */ static bool stmmac_has_ip_ethertype(struct sk_buff *skb) { - int depth = 0; + int depth = 0, hlen; __be16 proto; - proto = __vlan_get_protocol(skb, eth_header_parse_protocol(skb), - &depth); + proto = __vlan_get_protocol_offset(skb, skb->protocol, + skb_mac_offset(skb), &depth); + hlen = eth_type_vlan(skb->protocol) ? VLAN_ETH_HLEN : ETH_HLEN; - return (depth <= ETH_HLEN) && + return (depth <= hlen) && (proto == htons(ETH_P_IP) || proto == htons(ETH_P_IPV6)); } -- 2.34.1