summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorJan Klemkow <jan@cvs.openbsd.org>2023-04-26 00:14:22 +0000
committerJan Klemkow <jan@cvs.openbsd.org>2023-04-26 00:14:22 +0000
commit39f499bb8b2635fc8b7b2eff69e2898f53c28302 (patch)
treeaa1d641dfcf79c815952f24c52f1d62d52389c99 /sys
parente1a5582b5286260de811ccad36eb299e00d2055f (diff)
Also set TSO flag on vlan interfaces.
with tweaks from bluhm, claudio and dlg I fine with it from claudio looks good to me from dlg ok bluhm
Diffstat (limited to 'sys')
-rw-r--r--sys/net/if.c13
-rw-r--r--sys/net/if_vlan.c27
-rw-r--r--sys/net/if_vlan_var.h3
3 files changed, 40 insertions, 3 deletions
diff --git a/sys/net/if.c b/sys/net/if.c
index e06e8e8b769..58db412810d 100644
--- a/sys/net/if.c
+++ b/sys/net/if.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if.c,v 1.692 2023/04/22 04:39:46 dlg Exp $ */
+/* $OpenBSD: if.c,v 1.693 2023/04/26 00:14:21 jan Exp $ */
/* $NetBSD: if.c,v 1.35 1996/05/07 05:26:04 thorpej Exp $ */
/*
@@ -95,6 +95,11 @@
#include <net/route.h>
#include <net/netisr.h>
+#include "vlan.h"
+#if NVLAN > 0
+#include <net/if_vlan_var.h>
+#endif
+
#include <netinet/in.h>
#include <netinet/if_ether.h>
#include <netinet/igmp.h>
@@ -3149,6 +3154,12 @@ ifsettso(struct ifnet *ifp, int on)
else
goto out;
+#if NVLAN > 0
+ /* Change TSO flag also on attached vlan(4) interfaces. */
+ vlan_flags_from_parent(ifp, IFXF_TSO);
+#endif
+
+ /* restart interface */
if (ISSET(ifp->if_flags, IFF_UP)) {
/* go down for a moment... */
CLR(ifp->if_flags, IFF_UP);
diff --git a/sys/net/if_vlan.c b/sys/net/if_vlan.c
index 8958233348b..86bb5a757c9 100644
--- a/sys/net/if_vlan.c
+++ b/sys/net/if_vlan.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_vlan.c,v 1.213 2023/04/22 04:39:46 dlg Exp $ */
+/* $OpenBSD: if_vlan.c,v 1.214 2023/04/26 00:14:21 jan Exp $ */
/*
* Copyright 1998 Massachusetts Institute of Technology
@@ -560,6 +560,9 @@ vlan_up(struct vlan_softc *sc)
/* configure the parent to handle packets for this vlan */
vlan_multi_apply(sc, ifp0, SIOCADDMULTI);
+ /* Inherit flags from parent interface. */
+ vlan_flags_from_parent(ifp0, IFXF_TSO);
+
/* we're running now */
SET(ifp->if_flags, IFF_RUNNING);
vlan_link_state(sc, ifp0->if_link_state, ifp0->if_baudrate);
@@ -962,6 +965,28 @@ vlan_del_parent(struct vlan_softc *sc)
return (0);
}
+void
+vlan_flags_from_parent(struct ifnet *ifp0, int flags)
+{
+ struct vlan_softc *sc;
+ int i;
+
+ for (i = 0; i < TAG_HASH_SIZE; i++) {
+ SMR_SLIST_FOREACH_LOCKED(sc, &vlan_tagh[i], sc_list) {
+ /* vlan and tso only works with hw tagging */
+ if (!ISSET(ifp0->if_capabilities, IFCAP_VLAN_HWTAGGING))
+ CLR(flags, IFXF_TSO);
+
+ if (sc->sc_ifidx0 == ifp0->if_index) {
+ if (ISSET(ifp0->if_xflags, flags))
+ SET(sc->sc_if.if_xflags, flags);
+ else
+ CLR(sc->sc_if.if_xflags, flags);
+ }
+ }
+ }
+}
+
int
vlan_set_compat(struct ifnet *ifp, struct ifreq *ifr)
{
diff --git a/sys/net/if_vlan_var.h b/sys/net/if_vlan_var.h
index 9e408cd71ef..df51cc186f0 100644
--- a/sys/net/if_vlan_var.h
+++ b/sys/net/if_vlan_var.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_vlan_var.h,v 1.45 2023/04/22 04:39:46 dlg Exp $ */
+/* $OpenBSD: if_vlan_var.h,v 1.46 2023/04/26 00:14:21 jan Exp $ */
/*
* Copyright 1998 Massachusetts Institute of Technology
@@ -49,6 +49,7 @@ struct vlanreq {
#ifdef _KERNEL
struct mbuf *vlan_input(struct ifnet *, struct mbuf *, unsigned int *);
struct mbuf *vlan_inject(struct mbuf *, uint16_t, uint16_t);
+void vlan_flags_from_parent(struct ifnet *, int);
#endif /* _KERNEL */
#endif /* _NET_IF_VLAN_VAR_H_ */