Skip to content

Commit 1b5286b

Browse files
vyasevichgregkh
authored andcommitted
vlan: Fix tcp checksum offloads in Q-in-Q vlans
commit 35d2f80b07bbe03fb358afb0bdeff7437a7d67ff upstream. It appears that TCP checksum offloading has been broken for Q-in-Q vlans. The behavior was execerbated by the series commit afb0bc9 ("Merge branch 'stacked_vlan_tso'") that that enabled accleleration features on stacked vlans. However, event without that series, it is possible to trigger this issue. It just requires a lot more specialized configuration. The root cause is the interaction between how netdev_intersect_features() works, the features actually set on the vlan devices and HW having the ability to run checksum with longer headers. The issue starts when netdev_interesect_features() replaces NETIF_F_HW_CSUM with a combination of NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM, if the HW advertises IP|IPV6 specific checksums. This happens for tagged and multi-tagged packets. However, HW that enables IP|IPV6 checksum offloading doesn't gurantee that packets with arbitrarily long headers can be checksummed. This patch disables IP|IPV6 checksums on the packet for multi-tagged packets. CC: Toshiaki Makita <makita.toshiaki@lab.ntt.co.jp> CC: Michal Kubecek <mkubecek@suse.cz> Signed-off-by: Vladislav Yasevich <vyasevic@redhat.com> Acked-by: Toshiaki Makita <makita.toshiaki@lab.ntt.co.jp> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent e989f9b commit 1b5286b

1 file changed

Lines changed: 10 additions & 9 deletions

File tree

include/linux/if_vlan.h

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -616,15 +616,16 @@ static inline bool skb_vlan_tagged_multi(const struct sk_buff *skb)
616616
static inline netdev_features_t vlan_features_check(const struct sk_buff *skb,
617617
netdev_features_t features)
618618
{
619-
if (skb_vlan_tagged_multi(skb))
620-
features = netdev_intersect_features(features,
621-
NETIF_F_SG |
622-
NETIF_F_HIGHDMA |
623-
NETIF_F_FRAGLIST |
624-
NETIF_F_GEN_CSUM |
625-
NETIF_F_HW_VLAN_CTAG_TX |
626-
NETIF_F_HW_VLAN_STAG_TX);
627-
619+
if (skb_vlan_tagged_multi(skb)) {
620+
/* In the case of multi-tagged packets, use a direct mask
621+
* instead of using netdev_interesect_features(), to make
622+
* sure that only devices supporting NETIF_F_HW_CSUM will
623+
* have checksum offloading support.
624+
*/
625+
features &= NETIF_F_SG | NETIF_F_HIGHDMA | NETIF_F_HW_CSUM |
626+
NETIF_F_FRAGLIST | NETIF_F_HW_VLAN_CTAG_TX |
627+
NETIF_F_HW_VLAN_STAG_TX;
628+
}
628629
return features;
629630
}
630631

0 commit comments

Comments
 (0)