Module Name:src
Committed By: martin
Date: Mon Nov 27 20:05:57 UTC 2023
Modified Files:
src/sys/net/lagg [netbsd-10]: if_lagg.c if_lagg_lacp.c
Log Message:
Pull up following revision(s) (requested by yamaguchi in ticket #476):
sys/net/lagg/if_lagg.c: revision 1.52
sys/net/lagg/if_lagg.c: revision 1.53
sys/net/lagg/if_lagg_lacp.c: revision 1.26
sys/net/lagg/if_lagg_lacp.c: revision 1.27
Change LACPDU sending interval by TIMEOUT bit in partner's state
Update sending interval when the partner's state is changed
lagg(4): Fix missing pfil_run_hooks() and bpf_mtap()
Set ETHERCAP_VLAN_HWTAGGING on lagg(4)
that doesn't has physical interfaces
To generate a diff of this commit:
cvs rdiff -u -r1.48.4.1 -r1.48.4.2 src/sys/net/lagg/if_lagg.c
cvs rdiff -u -r1.25 -r1.25.4.1 src/sys/net/lagg/if_lagg_lacp.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/net/lagg/if_lagg.c
diff -u src/sys/net/lagg/if_lagg.c:1.48.4.1 src/sys/net/lagg/if_lagg.c:1.48.4.2
--- src/sys/net/lagg/if_lagg.c:1.48.4.1 Thu Oct 19 07:23:50 2023
+++ src/sys/net/lagg/if_lagg.c Mon Nov 27 20:05:57 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: if_lagg.c,v 1.48.4.1 2023/10/19 07:23:50 martin Exp $ */
+/* $NetBSD: if_lagg.c,v 1.48.4.2 2023/11/27 20:05:57 martin Exp $ */
/*
* Copyright (c) 2005, 2006 Reyk Floeter
@@ -20,7 +20,7 @@
*/
#include
-__KERNEL_RCSID(0, "$NetBSD: if_lagg.c,v 1.48.4.1 2023/10/19 07:23:50 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_lagg.c,v 1.48.4.2 2023/11/27 20:05:57 martin Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@@ -365,6 +365,7 @@ lagg_clone_create(struct if_clone *ifc,
{
struct lagg_softc *sc;
struct ifnet *ifp;
+ struct ethercom *ec;
int error;
sc = lagg_softc_alloc(lagg_iftype);
@@ -406,11 +407,19 @@ lagg_clone_create(struct if_clone *ifc,
switch (lagg_iftype) {
case LAGG_IF_TYPE_ETHERNET:
+ ec = (struct ethercom *)ifp;
cprng_fast(sc->sc_lladdr_rand, sizeof(sc->sc_lladdr_rand));
sc->sc_lladdr_rand[0] &= 0xFE; /* clear I/G bit */
sc->sc_lladdr_rand[0] |= 0x02; /* set G/L bit */
lagg_lladdr_cpy(sc->sc_lladdr, sc->sc_lladdr_rand);
- ether_set_vlan_cb((struct ethercom *)ifp, lagg_vlan_cb);
+ ether_set_vlan_cb(ec, lagg_vlan_cb);
+
+ /*
+ * notify ETHERCAP_VLAN_HWTAGGING to ether_ifattach
+ * to handle VLAN tag, stripped by hardware, in bpf(4)
+ */
+ ec->ec_capabilities = ETHERCAP_VLAN_HWTAGGING;
+
ether_ifattach(ifp, sc->sc_lladdr_rand);
break;
default:
@@ -1056,6 +1065,11 @@ lagg_output(struct lagg_softc *sc, struc
len = m->m_pkthdr.len;
mflags = m->m_flags;
+ error = pfil_run_hooks(ifp->if_pfil, , ifp, PFIL_OUT);
+ if (error != 0)
+ return;
+ bpf_mtap(ifp, m, BPF_D_OUT);
+
error = lagg_port_xmit(lp, m);
if (error) {
/* mbuf is already freed */
@@ -1967,31 +1981,31 @@ lagg_ethercap_update(struct lagg_softc *
if (sc->sc_if.if_type != IFT_ETHER)
return;
- /* Get common enabled capabilities for the lagg ports */
- ena = ~0;
- cap = ~0;
- LAGG_PORTS_FOREACH(sc, lp) {
- switch (lp->lp_iftype) {
- case IFT_ETHER:
- ec = (struct ethercom *)lp->lp_ifp;
- ena &= ec->ec_capenable;
- cap &= ec->ec_capabilities;
- break;
- case IFT_L2TP:
- ena &= (ETHERCAP_VLAN_MTU | ETHERCAP_JUMBO_MTU);
- cap &= (ETHERCAP_VLAN_MTU | ETHERCAP_JUMBO_MTU);
- break;
- default:
- ena = 0;
- cap = 0;
+ if (SIMPLEQ_EMPTY(>sc_ports)) {
+ ena = 0;
+ cap = ETHERCAP_VLAN_HWTAGGING;
+ } else {
+ /* Get common enabled capabilities for the lagg ports */
+ ena = ~0;
+ cap = ~0;
+ LAGG_PORTS_FOREACH(sc, lp) {
+ switch (lp->lp_iftype) {
+ case IFT_ETHER:
+ec = (struct ethercom *)lp->lp_ifp;
+ena &= ec->ec_capenable;
+cap &= ec->ec_capabilities;
+break;
+ case IFT_L2TP:
+ena &= (ETHERCAP_VLAN_MTU | ETHERCAP_JUMBO_MTU);
+cap &= (ETHERCAP_VLAN_MTU | ETHERCAP_JUMBO_MTU);
+break;
+ default:
+ena = 0;
+cap = 0;
+ }
}
}
- if (ena == ~0)
- ena = 0;
- if (cap == ~0)
- cap = 0;
-
/*
* Apply common enabled capabilities back to the lagg ports.
* May require several iterations if they are dependent.
Index: src/sys/net/lagg/if_lagg_lacp.c
diff -u src/sys/net/lagg/if_lagg_lacp.c:1.25 src/sys/net/lagg/if_lagg_lacp.c:1.25.4.1
--- src/sys/net/lagg/if_lagg_lacp.c:1.25 Sun Apr 10 09:50:46 2022
+++ src/sys/net/lagg/if_lagg_lacp.c Mon Nov 27 20:05:57 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: if_lagg_lacp.c,v 1.25 2022/04/10 09:50:46 andvar Exp $ */
+/* $NetBSD: if_lagg_lacp.c,v 1.25.4.1 2023/11/27 20:05:57 martin Exp $ */
/*-
* SPDX-License-Identifier: BSD-2-Clause-NetBSD
@@ -31,7 +31,7 @@
*/
#include
-__KERNEL_RCSID(0, "$NetBSD: if_lagg_lacp.c,v 1.25 2022/04/10 09:50:46 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_lagg_lacp.c,v 1.25.4.1 2023/11/27 20:05:57 martin Exp $");
#ifdef _KERNEL_OPT
#include "opt_lagg.h"
@@ -1689,6 +1689,8 @@