-/* $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 $ */
/*
#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>
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);
-/* $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
/* 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);
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)
{
-/* $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
#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_ */