| @@ -1,36 +1,36 @@ | | | @@ -1,36 +1,36 @@ |
1 | /* $NetBSD: if_lagg.c,v 1.38 2022/03/31 02:00:27 yamaguchi Exp $ */ | | 1 | /* $NetBSD: if_lagg.c,v 1.39 2022/03/31 03:07:05 yamaguchi Exp $ */ |
2 | | | 2 | |
3 | /* | | 3 | /* |
4 | * Copyright (c) 2005, 2006 Reyk Floeter <reyk@openbsd.org> | | 4 | * Copyright (c) 2005, 2006 Reyk Floeter <reyk@openbsd.org> |
5 | * Copyright (c) 2007 Andrew Thompson <thompsa@FreeBSD.org> | | 5 | * Copyright (c) 2007 Andrew Thompson <thompsa@FreeBSD.org> |
6 | * Copyright (c) 2014, 2016 Marcelo Araujo <araujo@FreeBSD.org> | | 6 | * Copyright (c) 2014, 2016 Marcelo Araujo <araujo@FreeBSD.org> |
7 | * Copyright (c) 2021, Internet Initiative Japan Inc. | | 7 | * Copyright (c) 2021, Internet Initiative Japan Inc. |
8 | * | | 8 | * |
9 | * Permission to use, copy, modify, and distribute this software for any | | 9 | * Permission to use, copy, modify, and distribute this software for any |
10 | * purpose with or without fee is hereby granted, provided that the above | | 10 | * purpose with or without fee is hereby granted, provided that the above |
11 | * copyright notice and this permission notice appear in all copies. | | 11 | * copyright notice and this permission notice appear in all copies. |
12 | * | | 12 | * |
13 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | | 13 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES |
14 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | | 14 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF |
15 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | | 15 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR |
16 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | | 16 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
17 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | | 17 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN |
18 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | | 18 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
19 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | | 19 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
20 | */ | | 20 | */ |
21 | | | 21 | |
22 | #include <sys/cdefs.h> | | 22 | #include <sys/cdefs.h> |
23 | __KERNEL_RCSID(0, "$NetBSD: if_lagg.c,v 1.38 2022/03/31 02:00:27 yamaguchi Exp $"); | | 23 | __KERNEL_RCSID(0, "$NetBSD: if_lagg.c,v 1.39 2022/03/31 03:07:05 yamaguchi Exp $"); |
24 | | | 24 | |
25 | #ifdef _KERNEL_OPT | | 25 | #ifdef _KERNEL_OPT |
26 | #include "opt_inet.h" | | 26 | #include "opt_inet.h" |
27 | #include "opt_lagg.h" | | 27 | #include "opt_lagg.h" |
28 | #endif | | 28 | #endif |
29 | | | 29 | |
30 | #include <sys/param.h> | | 30 | #include <sys/param.h> |
31 | #include <sys/types.h> | | 31 | #include <sys/types.h> |
32 | | | 32 | |
33 | #include <sys/cprng.h> | | 33 | #include <sys/cprng.h> |
34 | #include <sys/cpu.h> | | 34 | #include <sys/cpu.h> |
35 | #include <sys/device.h> | | 35 | #include <sys/device.h> |
36 | #include <sys/evcnt.h> | | 36 | #include <sys/evcnt.h> |
| @@ -1939,31 +1939,37 @@ lagg_ethercap_update(struct lagg_softc * | | | @@ -1939,31 +1939,37 @@ lagg_ethercap_update(struct lagg_softc * |
1939 | struct lagg_port *lp; | | 1939 | struct lagg_port *lp; |
1940 | int cap, ena, pena; | | 1940 | int cap, ena, pena; |
1941 | size_t i; | | 1941 | size_t i; |
1942 | | | 1942 | |
1943 | KASSERT(LAGG_LOCKED(sc)); | | 1943 | KASSERT(LAGG_LOCKED(sc)); |
1944 | | | 1944 | |
1945 | if (sc->sc_if.if_type != IFT_ETHER) | | 1945 | if (sc->sc_if.if_type != IFT_ETHER) |
1946 | return; | | 1946 | return; |
1947 | | | 1947 | |
1948 | /* Get common enabled capabilities for the lagg ports */ | | 1948 | /* Get common enabled capabilities for the lagg ports */ |
1949 | ena = ~0; | | 1949 | ena = ~0; |
1950 | cap = ~0; | | 1950 | cap = ~0; |
1951 | LAGG_PORTS_FOREACH(sc, lp) { | | 1951 | LAGG_PORTS_FOREACH(sc, lp) { |
1952 | if (lp->lp_iftype == IFT_ETHER) { | | 1952 | switch (lp->lp_iftype) { |
| | | 1953 | case IFT_ETHER: |
1953 | ec = (struct ethercom *)lp->lp_ifp; | | 1954 | ec = (struct ethercom *)lp->lp_ifp; |
1954 | ena &= ec->ec_capenable; | | 1955 | ena &= ec->ec_capenable; |
1955 | cap &= ec->ec_capabilities; | | 1956 | cap &= ec->ec_capabilities; |
1956 | } else { | | 1957 | break; |
| | | 1958 | case IFT_L2TP: |
| | | 1959 | ena &= (ETHERCAP_VLAN_MTU | ETHERCAP_JUMBO_MTU); |
| | | 1960 | cap &= (ETHERCAP_VLAN_MTU | ETHERCAP_JUMBO_MTU); |
| | | 1961 | break; |
| | | 1962 | default: |
1957 | ena = 0; | | 1963 | ena = 0; |
1958 | cap = 0; | | 1964 | cap = 0; |
1959 | } | | 1965 | } |
1960 | } | | 1966 | } |
1961 | | | 1967 | |
1962 | if (ena == ~0) | | 1968 | if (ena == ~0) |
1963 | ena = 0; | | 1969 | ena = 0; |
1964 | if (cap == ~0) | | 1970 | if (cap == ~0) |
1965 | cap = 0; | | 1971 | cap = 0; |
1966 | | | 1972 | |
1967 | /* | | 1973 | /* |
1968 | * Apply common enabled capabilities back to the lagg ports. | | 1974 | * Apply common enabled capabilities back to the lagg ports. |
1969 | * May require several iterations if they are dependent. | | 1975 | * May require several iterations if they are dependent. |