Module Name: src Committed By: martin Date: Wed Oct 18 11:53:22 UTC 2023
Modified Files: src/sys/dev/pci/ixgbe [netbsd-10]: ix_txrx.c ixgbe.c ixgbe.h ixgbe_type.h ixv.c Log Message: Pull up following revision(s) (requested by msaitoh in ticket #420): sys/dev/pci/ixgbe/ixgbe.c: revision 1.340 sys/dev/pci/ixgbe/ixgbe.c: revision 1.341 sys/dev/pci/ixgbe/ixgbe.c: revision 1.342 sys/dev/pci/ixgbe/ixgbe.c: revision 1.343 sys/dev/pci/ixgbe/ixgbe.c: revision 1.344 sys/dev/pci/ixgbe/ixgbe_type.h: revision 1.61 sys/dev/pci/ixgbe/ix_txrx.c: revision 1.104 sys/dev/pci/ixgbe/ixv.c: revision 1.190 sys/dev/pci/ixgbe/ixv.c: revision 1.191 sys/dev/pci/ixgbe/ixv.c: revision 1.192 sys/dev/pci/ixgbe/ixgbe.h: revision 1.93 ixg(4): Print DEVICE_CAPS register. ixgbe: Whitespace. No functional change. ixg(4): Don't print wrong error message about ixgbe_num_queues. Don't override the ixgbe_num_queues global variable. It's the default value of the number of queues and should not override it because it will be referenced by later device attach. For example, the number of MSI-X vector is 64 on X540 and 18 on 82599. When both cards are inserted to a machine that the number of CPU is 24 and X540 is probed earlier, ixgbe_num_queues is overridden to 24 and the following error message is printed when attaching 82599: ixg2: autoconfiguration error: ixgbe_num_queues (24) is too large, using reduced amount (17). Note that the number of queues is in sc->num_queuss and referenced by hw.ixgN.num_queues sysctl. ixgbe: Don't override the {ixgbe,ixv}_max_interrupt_rate global variable. Fix a bug that changing hw.ix[gv]X.qY.interrupt_rate would change all devices all queues default interrupt rate. ixgbe: Whitespace. No functional change. To generate a diff of this commit: cvs rdiff -u -r1.100.4.3 -r1.100.4.4 src/sys/dev/pci/ixgbe/ix_txrx.c cvs rdiff -u -r1.324.2.4 -r1.324.2.5 src/sys/dev/pci/ixgbe/ixgbe.c cvs rdiff -u -r1.86.4.3 -r1.86.4.4 src/sys/dev/pci/ixgbe/ixgbe.h cvs rdiff -u -r1.55.4.4 -r1.55.4.5 src/sys/dev/pci/ixgbe/ixgbe_type.h cvs rdiff -u -r1.183.4.3 -r1.183.4.4 src/sys/dev/pci/ixgbe/ixv.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/ix_txrx.c diff -u src/sys/dev/pci/ixgbe/ix_txrx.c:1.100.4.3 src/sys/dev/pci/ixgbe/ix_txrx.c:1.100.4.4 --- src/sys/dev/pci/ixgbe/ix_txrx.c:1.100.4.3 Fri Oct 13 18:55:12 2023 +++ src/sys/dev/pci/ixgbe/ix_txrx.c Wed Oct 18 11:53:22 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: ix_txrx.c,v 1.100.4.3 2023/10/13 18:55:12 martin Exp $ */ +/* $NetBSD: ix_txrx.c,v 1.100.4.4 2023/10/18 11:53:22 martin Exp $ */ /****************************************************************************** @@ -64,7 +64,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: ix_txrx.c,v 1.100.4.3 2023/10/13 18:55:12 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ix_txrx.c,v 1.100.4.4 2023/10/18 11:53:22 martin Exp $"); #include "opt_inet.h" #include "opt_inet6.h" @@ -1274,9 +1274,9 @@ ixgbe_rsc_count(union ixgbe_adv_rx_desc static void ixgbe_setup_hw_rsc(struct rx_ring *rxr) { - struct ixgbe_softc *sc = rxr->sc; - struct ixgbe_hw *hw = &sc->hw; - u32 rscctrl, rdrxctl; + struct ixgbe_softc *sc = rxr->sc; + struct ixgbe_hw *hw = &sc->hw; + u32 rscctrl, rdrxctl; /* If turning LRO/RSC off we need to disable it */ if ((sc->ifp->if_capenable & IFCAP_LRO) == 0) { Index: src/sys/dev/pci/ixgbe/ixgbe.c diff -u src/sys/dev/pci/ixgbe/ixgbe.c:1.324.2.4 src/sys/dev/pci/ixgbe/ixgbe.c:1.324.2.5 --- src/sys/dev/pci/ixgbe/ixgbe.c:1.324.2.4 Fri Oct 13 18:55:12 2023 +++ src/sys/dev/pci/ixgbe/ixgbe.c Wed Oct 18 11:53:21 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: ixgbe.c,v 1.324.2.4 2023/10/13 18:55:12 martin Exp $ */ +/* $NetBSD: ixgbe.c,v 1.324.2.5 2023/10/18 11:53:21 martin Exp $ */ /****************************************************************************** @@ -64,7 +64,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: ixgbe.c,v 1.324.2.4 2023/10/13 18:55:12 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ixgbe.c,v 1.324.2.5 2023/10/18 11:53:21 martin Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -809,7 +809,7 @@ ixgbe_attach(device_t parent, device_t d struct ixgbe_hw *hw; int error = -1; u32 ctrl_ext; - u16 high, low, nvmreg; + u16 high, low, nvmreg, dev_caps; pcireg_t id, subid; const ixgbe_vendor_info_t *ent; struct pci_attach_args *pa = aux; @@ -1277,10 +1277,15 @@ ixgbe_attach(device_t parent, device_t d if (sc->feat_en & IXGBE_FEATURE_NETMAP) ixgbe_netmap_attach(sc); + /* Print some flags */ snprintb(buf, sizeof(buf), IXGBE_FEATURE_FLAGS, sc->feat_cap); aprint_verbose_dev(dev, "feature cap %s\n", buf); snprintb(buf, sizeof(buf), IXGBE_FEATURE_FLAGS, sc->feat_en); aprint_verbose_dev(dev, "feature ena %s\n", buf); + if (ixgbe_get_device_caps(hw, &dev_caps) == 0) { + snprintb(buf, sizeof(buf), IXGBE_DEVICE_CAPS_FLAGS, dev_caps); + aprint_verbose_dev(dev, "device cap %s\n", buf); + } if (pmf_device_register(dev, ixgbe_suspend, ixgbe_resume)) pmf_class_network_register(dev, sc->ifp); @@ -3374,9 +3379,9 @@ ixgbe_sysctl_interrupt_rate_handler(SYSC && (reg < IXGBE_MIN_RSC_EITR_10G1G)) return EINVAL; } - ixgbe_max_interrupt_rate = rate; + sc->max_interrupt_rate = rate; } else - ixgbe_max_interrupt_rate = 0; + sc->max_interrupt_rate = 0; ixgbe_eitr_write(sc, que->msix, reg); return (0); @@ -3481,6 +3486,7 @@ ixgbe_add_device_sysctls(struct ixgbe_so aprint_error_dev(dev, "could not create sysctl\n"); sc->enable_aim = ixgbe_enable_aim; + sc->max_interrupt_rate = ixgbe_max_interrupt_rate; if (sysctl_createv(log, 0, &rnode, &cnode, CTLFLAG_READWRITE, CTLTYPE_BOOL, "enable_aim", SYSCTL_DESCR("Interrupt Moderation"), NULL, 0, &sc->enable_aim, 0, CTL_CREATE, CTL_EOL) != 0) @@ -4389,8 +4395,8 @@ ixgbe_configure_ivars(struct ixgbe_softc struct ix_queue *que = sc->queues; u32 newitr; - if (ixgbe_max_interrupt_rate > 0) - newitr = (4000000 / ixgbe_max_interrupt_rate) & 0x0FF8; + if (sc->max_interrupt_rate > 0) + newitr = (4000000 / sc->max_interrupt_rate) & 0x0FF8; else { /* * Disable DMA coalescing if interrupt moderation is @@ -5074,7 +5080,7 @@ ixgbe_update_link_status(struct ixgbe_so for (int i = 0; i < sc->num_queues; i++, que++) que->eitr_setting = 0; - if (sc->link_speed == IXGBE_LINK_SPEED_10GB_FULL){ + if (sc->link_speed == IXGBE_LINK_SPEED_10GB_FULL) { /* * Discard count for both MAC Local Fault and * Remote Fault because those registers are @@ -5302,7 +5308,7 @@ ixgbe_legacy_irq(void *arg) struct ixgbe_softc *sc = que->sc; struct ixgbe_hw *hw = &sc->hw; struct ifnet *ifp = sc->ifp; - struct tx_ring *txr = sc->tx_rings; + struct tx_ring *txr = sc->tx_rings; u32 eicr; u32 eims_orig; u32 eims_enable = 0; @@ -6037,7 +6043,7 @@ ixgbe_sysctl_phy_overtemp_occurred(SYSCT return (EPERM); if ((hw->device_id != IXGBE_DEV_ID_X550EM_X_10G_T) && - (hw->device_id != IXGBE_DEV_ID_X550EM_A_10G_T)){ + (hw->device_id != IXGBE_DEV_ID_X550EM_A_10G_T)) { device_printf(sc->dev, "Device has no supported external thermal sensor.\n"); return (ENODEV); @@ -6863,8 +6869,8 @@ static int ixgbe_allocate_msix(struct ixgbe_softc *sc, const struct pci_attach_args *pa) { device_t dev = sc->dev; - struct ix_queue *que = sc->queues; - struct tx_ring *txr = sc->tx_rings; + struct ix_queue *que = sc->queues; + struct tx_ring *txr = sc->tx_rings; pci_chipset_tag_t pc; char intrbuf[PCI_INTRSTR_LEN]; char intr_xname[32]; @@ -7116,9 +7122,6 @@ ixgbe_configure_interrupts(struct ixgbe_ queues = uimin(queues, uimin(mac->max_tx_queues, mac->max_rx_queues)); - /* reflect correct sysctl value */ - ixgbe_num_queues = queues; - /* * Want one vector (RX/TX pair) per queue * plus an additional for Link. Index: src/sys/dev/pci/ixgbe/ixgbe.h diff -u src/sys/dev/pci/ixgbe/ixgbe.h:1.86.4.3 src/sys/dev/pci/ixgbe/ixgbe.h:1.86.4.4 --- src/sys/dev/pci/ixgbe/ixgbe.h:1.86.4.3 Fri Oct 13 18:55:12 2023 +++ src/sys/dev/pci/ixgbe/ixgbe.h Wed Oct 18 11:53:22 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: ixgbe.h,v 1.86.4.3 2023/10/13 18:55:12 martin Exp $ */ +/* $NetBSD: ixgbe.h,v 1.86.4.4 2023/10/18 11:53:22 martin Exp $ */ /****************************************************************************** SPDX-License-Identifier: BSD-3-Clause @@ -499,6 +499,7 @@ struct ixgbe_softc { /* Info about the interface */ int advertise; /* link speeds */ bool enable_aim; /* adaptive interrupt moderation */ + int max_interrupt_rate; int link_active; /* Use LINK_STATE_* value */ u16 max_frame_size; u16 num_segs; Index: src/sys/dev/pci/ixgbe/ixgbe_type.h diff -u src/sys/dev/pci/ixgbe/ixgbe_type.h:1.55.4.4 src/sys/dev/pci/ixgbe/ixgbe_type.h:1.55.4.5 --- src/sys/dev/pci/ixgbe/ixgbe_type.h:1.55.4.4 Fri Oct 13 18:55:12 2023 +++ src/sys/dev/pci/ixgbe/ixgbe_type.h Wed Oct 18 11:53:22 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: ixgbe_type.h,v 1.55.4.4 2023/10/13 18:55:12 martin Exp $ */ +/* $NetBSD: ixgbe_type.h,v 1.55.4.5 2023/10/18 11:53:22 martin Exp $ */ /****************************************************************************** SPDX-License-Identifier: BSD-3-Clause @@ -2553,6 +2553,10 @@ enum { #define IXGBE_DEVICE_CAPS_WOL_PORT0 0x8 /* WoL supported on port 0 */ #define IXGBE_DEVICE_CAPS_WOL_MASK 0xC /* Mask for WoL capabilities */ +#define IXGBE_DEVICE_CAPS_FLAGS "\20" \ + "\1ALLOW_ANY_SFP" "\2FCOE_OFFLOAD" "\3WOL_PORT0_1" "\4WOL_PORT0" \ + "\10NO_CROSSTALK_WR" + /* PCI Bus Info */ #define IXGBE_PCI_DEVICE_STATUS 0xAA #define IXGBE_PCI_DEVICE_STATUS_TRANSACTION_PENDING 0x0020 Index: src/sys/dev/pci/ixgbe/ixv.c diff -u src/sys/dev/pci/ixgbe/ixv.c:1.183.4.3 src/sys/dev/pci/ixgbe/ixv.c:1.183.4.4 --- src/sys/dev/pci/ixgbe/ixv.c:1.183.4.3 Fri Oct 13 18:55:12 2023 +++ src/sys/dev/pci/ixgbe/ixv.c Wed Oct 18 11:53:22 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: ixv.c,v 1.183.4.3 2023/10/13 18:55:12 martin Exp $ */ +/* $NetBSD: ixv.c,v 1.183.4.4 2023/10/18 11:53:22 martin 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.183.4.3 2023/10/13 18:55:12 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ixv.c,v 1.183.4.4 2023/10/18 11:53:22 martin Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -550,6 +550,7 @@ ixv_attach(device_t parent, device_t dev /* hw.ix defaults init */ sc->enable_aim = ixv_enable_aim; + sc->max_interrupt_rate = ixv_max_interrupt_rate; sc->txrx_use_workqueue = ixv_txrx_workqueue; @@ -572,7 +573,7 @@ ixv_attach(device_t parent, device_t dev /* Check if VF was disabled by PF */ error = hw->mac.ops.get_link_state(hw, &sc->link_enabled); - if (error) { + if (error) { /* PF is not capable of controlling VF state. Enable the link. */ sc->link_enabled = TRUE; } @@ -806,7 +807,7 @@ ixv_init_locked(struct ixgbe_softc *sc) /* Config/Enable Link */ error = hw->mac.ops.get_link_state(hw, &sc->link_enabled); - if (error) { + if (error) { /* PF is not capable of controlling VF state. Enable the link. */ sc->link_enabled = TRUE; } else if (sc->link_enabled == FALSE) @@ -1603,7 +1604,7 @@ ixv_free_deferred_handlers(struct ixgbe_ static void ixv_free_pci_resources(struct ixgbe_softc *sc) { - struct ix_queue *que = sc->queues; + struct ix_queue *que = sc->queues; int rid; /* @@ -2529,9 +2530,9 @@ ixv_sysctl_interrupt_rate_handler(SYSCTL && (reg < IXGBE_MIN_RSC_EITR_10G1G)) return EINVAL; } - ixv_max_interrupt_rate = rate; + sc->max_interrupt_rate = rate; } else - ixv_max_interrupt_rate = 0; + sc->max_interrupt_rate = 0; ixv_eitr_write(sc, que->msix, reg); return (0); @@ -3377,7 +3378,7 @@ ixv_allocate_msix(struct ixgbe_softc *sc { device_t dev = sc->dev; struct ix_queue *que = sc->queues; - struct tx_ring *txr = sc->tx_rings; + struct tx_ring *txr = sc->tx_rings; int error, msix_ctrl, rid, vector = 0; pci_chipset_tag_t pc; pcitag_t tag;