-/* $OpenBSD: if.c,v 1.690 2023/04/18 22:01:24 mvs Exp $ */
+/* $OpenBSD: if.c,v 1.691 2023/04/21 14:31:41 jan Exp $ */
/* $NetBSD: if.c,v 1.35 1996/05/07 05:26:04 thorpej Exp $ */
/*
#include <net/if.h>
#include <net/if_dl.h>
#include <net/if_types.h>
+#include <net/if_vlan_var.h>
#include <net/route.h>
#include <net/netisr.h>
else
goto out;
+ /* Change TSO flag also on attached vlan(4)/svlan(4) interfaces. */
+ vlan_flags_from_parent(ifp, IFXF_TSO);
+
+ /* restart interface */
if (ISSET(ifp->if_flags, IFF_UP)) {
/* go down for a moment... */
CLR(ifp->if_flags, IFF_UP);
-/* $OpenBSD: if_vlan.c,v 1.211 2023/02/02 13:28:31 claudio Exp $ */
+/* $OpenBSD: if_vlan.c,v 1.212 2023/04/21 14:31:41 jan Exp $ */
/*
* Copyright 1998 Massachusetts Institute of Technology
if (!ISSET(sc->sc_flags, IFVF_LLADDR))
if_setlladdr(ifp, LLADDR(ifp0->if_sadl));
+ /* Inherit flags from parent interface. */
+ vlan_flags_from_parent(ifp0, IFXF_TSO);
+
put:
if_put(ifp0);
return (error);
return (0);
}
+void
+vlan_flags_from_parent(struct ifnet *ifp0, int flags)
+{
+ struct ifnet *ifp;
+ struct vlan_softc *sc;
+
+ TAILQ_FOREACH(ifp, &ifnetlist, if_list) {
+ if ((sc = ifp->if_softc) == NULL)
+ continue;
+
+ if (sc->sc_type != ETHERTYPE_VLAN &&
+ sc->sc_type != ETHERTYPE_QINQ)
+ continue;
+
+ /* 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(ifp->if_xflags, flags);
+ else
+ CLR(ifp->if_xflags, flags);
+ }
+ }
+}
+
int
vlan_set_compat(struct ifnet *ifp, struct ifreq *ifr)
{
-/* $OpenBSD: if_vlan_var.h,v 1.43 2021/08/19 10:22:00 dlg Exp $ */
+/* $OpenBSD: if_vlan_var.h,v 1.44 2023/04/21 14:31:41 jan Exp $ */
/*
* Copyright 1998 Massachusetts Institute of Technology
#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_ */