Module Name: src Committed By: yamaguchi Date: Thu Nov 2 09:40:47 UTC 2023
Modified Files: src/sys/dev/pci/ixgbe: ixgbe.c ixv.c src/sys/net: if_ethersubr.c Log Message: Use ether_bpf_mtap only when the device supports vlan harware tagging The function is bpf_mtap() for ethernet devices and *currently* it is just handling VLAN tag stripped by the hardware. To generate a diff of this commit: cvs rdiff -u -r1.346 -r1.347 src/sys/dev/pci/ixgbe/ixgbe.c cvs rdiff -u -r1.193 -r1.194 src/sys/dev/pci/ixgbe/ixv.c cvs rdiff -u -r1.325 -r1.326 src/sys/net/if_ethersubr.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/dev/pci/ixgbe/ixgbe.c diff -u src/sys/dev/pci/ixgbe/ixgbe.c:1.346 src/sys/dev/pci/ixgbe/ixgbe.c:1.347 --- src/sys/dev/pci/ixgbe/ixgbe.c:1.346 Thu Nov 2 05:07:57 2023 +++ src/sys/dev/pci/ixgbe/ixgbe.c Thu Nov 2 09:40:47 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: ixgbe.c,v 1.346 2023/11/02 05:07:57 msaitoh Exp $ */ +/* $NetBSD: ixgbe.c,v 1.347 2023/11/02 09:40:47 yamaguchi Exp $ */ /****************************************************************************** @@ -64,7 +64,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: ixgbe.c,v 1.346 2023/11/02 05:07:57 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ixgbe.c,v 1.347 2023/11/02 09:40:47 yamaguchi Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -1411,14 +1411,10 @@ ixgbe_setup_interface(device_t dev, stru if_initialize(ifp); sc->ipq = if_percpuq_create(&sc->osdep.ec.ec_if); - ether_ifattach(ifp, sc->hw.mac.addr); - aprint_normal_dev(dev, "Ethernet address %s\n", - ether_sprintf(sc->hw.mac.addr)); /* * We use per TX queue softint, so if_deferred_start_init() isn't * used. */ - ether_set_ifflags_cb(ec, ixgbe_ifflags_cb); sc->max_frame_size = ifp->if_mtu + ETHER_HDR_LEN + ETHER_CRC_LEN; @@ -1442,6 +1438,11 @@ ixgbe_setup_interface(device_t dev, stru /* Enable the above capabilities by default */ ec->ec_capenable = ec->ec_capabilities; + ether_ifattach(ifp, sc->hw.mac.addr); + aprint_normal_dev(dev, "Ethernet address %s\n", + ether_sprintf(sc->hw.mac.addr)); + ether_set_ifflags_cb(ec, ixgbe_ifflags_cb); + /* * Don't turn this on by default, if vlans are * created on another pseudo device (eg. lagg) Index: src/sys/dev/pci/ixgbe/ixv.c diff -u src/sys/dev/pci/ixgbe/ixv.c:1.193 src/sys/dev/pci/ixgbe/ixv.c:1.194 --- src/sys/dev/pci/ixgbe/ixv.c:1.193 Thu Nov 2 05:07:57 2023 +++ src/sys/dev/pci/ixgbe/ixv.c Thu Nov 2 09:40:47 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: ixv.c,v 1.193 2023/11/02 05:07:57 msaitoh Exp $ */ +/* $NetBSD: ixv.c,v 1.194 2023/11/02 09:40:47 yamaguchi Exp $ */ /****************************************************************************** @@ -35,7 +35,7 @@ /*$FreeBSD: head/sys/dev/ixgbe/if_ixv.c 331224 2018-03-19 20:55:05Z erj $*/ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: ixv.c,v 1.193 2023/11/02 05:07:57 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ixv.c,v 1.194 2023/11/02 09:40:47 yamaguchi Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -1678,14 +1678,10 @@ ixv_setup_interface(device_t dev, struct if_initialize(ifp); sc->ipq = if_percpuq_create(&sc->osdep.ec.ec_if); - ether_ifattach(ifp, sc->hw.mac.addr); - aprint_normal_dev(dev, "Ethernet address %s\n", - ether_sprintf(sc->hw.mac.addr)); /* * We use per TX queue softint, so if_deferred_start_init() isn't * used. */ - ether_set_ifflags_cb(ec, ixv_ifflags_cb); sc->max_frame_size = ifp->if_mtu + IXGBE_MTU_HDR; @@ -1709,6 +1705,11 @@ ixv_setup_interface(device_t dev, struct /* Enable the above capabilities by default */ ec->ec_capenable = ec->ec_capabilities; + ether_ifattach(ifp, sc->hw.mac.addr); + aprint_normal_dev(dev, "Ethernet address %s\n", + ether_sprintf(sc->hw.mac.addr)); + ether_set_ifflags_cb(ec, ixv_ifflags_cb); + /* Don't enable LRO by default */ #if 0 /* NetBSD doesn't support LRO yet */ Index: src/sys/net/if_ethersubr.c diff -u src/sys/net/if_ethersubr.c:1.325 src/sys/net/if_ethersubr.c:1.326 --- src/sys/net/if_ethersubr.c:1.325 Thu Nov 2 09:36:27 2023 +++ src/sys/net/if_ethersubr.c Thu Nov 2 09:40:47 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: if_ethersubr.c,v 1.325 2023/11/02 09:36:27 yamaguchi Exp $ */ +/* $NetBSD: if_ethersubr.c,v 1.326 2023/11/02 09:40:47 yamaguchi Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -61,7 +61,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: if_ethersubr.c,v 1.325 2023/11/02 09:36:27 yamaguchi Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_ethersubr.c,v 1.326 2023/11/02 09:40:47 yamaguchi Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -1051,7 +1051,8 @@ ether_ifattach(struct ifnet *ifp, const ifp->if_mtu = ETHERMTU; ifp->if_output = ether_output; ifp->_if_input = ether_input; - ifp->if_bpf_mtap = ether_bpf_mtap; + if (ec->ec_capabilities & ETHERCAP_VLAN_HWTAGGING) + ifp->if_bpf_mtap = ether_bpf_mtap; if (ifp->if_baudrate == 0) ifp->if_baudrate = IF_Mbps(10); /* just a default */