From cda57d0377ca523a2a5207ddf7c3244bf7cf7faa Mon Sep 17 00:00:00 2001 From: sf Date: Wed, 11 Jul 2018 14:20:18 +0000 Subject: [PATCH] Fix comment about VLAN encapsulation and checksum offload Document that some chips actually could do hardware checksum offload for encapsulated packets, though that would need special handling in those drivers. discussions and ok naddy@ --- sys/net/if_vlan.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/sys/net/if_vlan.c b/sys/net/if_vlan.c index 37f60b8fb01..8f279e22c5e 100644 --- a/sys/net/if_vlan.c +++ b/sys/net/if_vlan.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_vlan.c,v 1.177 2018/04/03 02:52:50 dlg Exp $ */ +/* $OpenBSD: if_vlan.c,v 1.178 2018/07/11 14:20:18 sf Exp $ */ /* * Copyright 1998 Massachusetts Institute of Technology @@ -473,6 +473,11 @@ vlan_up(struct ifvlan *ifv) ifp->if_hardmtu = hardmtu; SET(ifp->if_flags, ifp0->if_flags & IFF_SIMPLEX); + /* + * Note: In cases like vio(4) and em(4) where the offsets of the + * csum can be freely defined, we could actually do csum offload + * for VLAN and QINQ packets. + */ if (ifv->ifv_type != ETHERTYPE_VLAN) { /* * Hardware offload only works with the default VLAN @@ -481,12 +486,8 @@ vlan_up(struct ifvlan *ifv) ifp->if_capabilities = 0; } else if (ISSET(ifp0->if_capabilities, IFCAP_VLAN_HWTAGGING)) { /* - * If the parent interface can do hardware-assisted - * VLAN encapsulation, then propagate its hardware- - * assisted checksumming flags. - * - * If the card cannot handle hardware tagging, it cannot - * possibly compute the correct checksums for tagged packets. + * Chips that can do hardware-assisted VLAN encapsulation, can + * calculate the correct checksum for VLAN tagged packets. */ ifp->if_capabilities = ifp0->if_capabilities & IFCAP_CSUM_MASK; } -- 2.20.1