CVS commit: [netbsd-10] src/sys/dev/pci/igc
Module Name:src Committed By: martin Date: Fri Feb 23 18:41:02 UTC 2024 Modified Files: src/sys/dev/pci/igc [netbsd-10]: if_igc.c igc_defines.h Log Message: Pull up following revision(s) (requested by msaitoh in ticket #605): sys/dev/pci/igc/if_igc.c: revision 1.12 sys/dev/pci/igc/if_igc.c: revision 1.13 sys/dev/pci/igc/igc_defines.h: revision 1.3 sys/dev/pci/igc/if_igc.c: revision 1.10 sys/dev/pci/igc/if_igc.c: revision 1.11 igc(4): Count iqdrops. TODO: RQDPC should be visible via evcnt(9). igc: Add missing igc_check_for_link() call. It's required to set the collision distance, configure flow control from the negotiated result and set the LTR thresholds. With this change, ifconfig igcN show the flow control status correctly. igc(4): Modify dmesg output of PHY and NVM info. - Print PHY info first and then print NVM info. - Remove debug output. igc(4): Print EtrackID. To generate a diff of this commit: cvs rdiff -u -r1.3.2.3 -r1.3.2.4 src/sys/dev/pci/igc/if_igc.c cvs rdiff -u -r1.2.2.2 -r1.2.2.3 src/sys/dev/pci/igc/igc_defines.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [netbsd-10] src/sys/dev/pci/igc
Module Name:src Committed By: martin Date: Fri Feb 23 18:41:02 UTC 2024 Modified Files: src/sys/dev/pci/igc [netbsd-10]: if_igc.c igc_defines.h Log Message: Pull up following revision(s) (requested by msaitoh in ticket #605): sys/dev/pci/igc/if_igc.c: revision 1.12 sys/dev/pci/igc/if_igc.c: revision 1.13 sys/dev/pci/igc/igc_defines.h: revision 1.3 sys/dev/pci/igc/if_igc.c: revision 1.10 sys/dev/pci/igc/if_igc.c: revision 1.11 igc(4): Count iqdrops. TODO: RQDPC should be visible via evcnt(9). igc: Add missing igc_check_for_link() call. It's required to set the collision distance, configure flow control from the negotiated result and set the LTR thresholds. With this change, ifconfig igcN show the flow control status correctly. igc(4): Modify dmesg output of PHY and NVM info. - Print PHY info first and then print NVM info. - Remove debug output. igc(4): Print EtrackID. To generate a diff of this commit: cvs rdiff -u -r1.3.2.3 -r1.3.2.4 src/sys/dev/pci/igc/if_igc.c cvs rdiff -u -r1.2.2.2 -r1.2.2.3 src/sys/dev/pci/igc/igc_defines.h 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/igc/if_igc.c diff -u src/sys/dev/pci/igc/if_igc.c:1.3.2.3 src/sys/dev/pci/igc/if_igc.c:1.3.2.4 --- src/sys/dev/pci/igc/if_igc.c:1.3.2.3 Sat Oct 14 06:49:37 2023 +++ src/sys/dev/pci/igc/if_igc.c Fri Feb 23 18:41:02 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: if_igc.c,v 1.3.2.3 2023/10/14 06:49:37 martin Exp $ */ +/* $NetBSD: if_igc.c,v 1.3.2.4 2024/02/23 18:41:02 martin Exp $ */ /* $OpenBSD: if_igc.c,v 1.13 2023/04/28 10:18:57 bluhm Exp $ */ /*- * SPDX-License-Identifier: BSD-2-Clause @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_igc.c,v 1.3.2.3 2023/10/14 06:49:37 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_igc.c,v 1.3.2.4 2024/02/23 18:41:02 martin Exp $"); #ifdef _KERNEL_OPT #include "opt_net_mpsafe.h" @@ -1112,11 +1112,35 @@ igc_update_counters(struct igc_softc *sc /* Mac statistics */ struct igc_hw *hw = >hw; + struct ifnet *ifp = >sc_ec.ec_if; + uint64_t iqdrops = 0; for (int cnt = 0; cnt < IGC_MAC_COUNTERS; cnt++) { - IGC_MAC_COUNTER_ADD(sc, cnt, igc_read_mac_counter(hw, - igc_mac_counters[cnt].reg, igc_mac_counters[cnt].is64)); + uint64_t val; + bus_size_t regaddr = igc_mac_counters[cnt].reg; + + val = igc_read_mac_counter(hw, regaddr, + igc_mac_counters[cnt].is64); + IGC_MAC_COUNTER_ADD(sc, cnt, val); + /* XXX Count MPC to iqdrops. */ + if (regaddr == IGC_MPC) + iqdrops += val; + } + + for (int iq = 0; iq < sc->sc_nqueues; iq++) { + uint32_t val; + + /* XXX RQDPC should be visible via evcnt(9). */ + val = IGC_READ_REG(hw, IGC_RQDPC(iq)); + + /* RQDPC is not cleard on read. */ + if (val != 0) + IGC_WRITE_REG(hw, IGC_RQDPC(iq), 0); + iqdrops += val; } + + if (iqdrops != 0) + if_statadd(ifp, if_iqdrops, iqdrops); #endif } @@ -2518,6 +2542,9 @@ igc_update_link_status(struct igc_softc struct ifnet *ifp = >sc_ec.ec_if; struct igc_hw *hw = >hw; + if (hw->mac.get_link_status == true) + igc_check_for_link(hw); + if (IGC_READ_REG(>hw, IGC_STATUS) & IGC_STATUS_LU) { if (sc->link_active == 0) { igc_get_speed_and_duplex(hw, >link_speed, @@ -3817,7 +3844,7 @@ igc_print_devinfo(struct igc_softc *sc) struct igc_hw *hw = >hw; struct igc_phy_info *phy = >phy; u_int oui, model, rev; - uint16_t id1, id2, nvm_ver, phy_ver; + uint16_t id1, id2, nvm_ver, phy_ver, etk_lo, etk_hi; char descr[MII_MAX_DESCR_LEN]; /* Print PHY Info */ @@ -3829,23 +3856,26 @@ igc_print_devinfo(struct igc_softc *sc) rev = MII_REV(id2); mii_get_descr(descr, sizeof(descr), oui, model); if (descr[0]) - aprint_normal_dev(dev, "PHY: %s, rev. %d\n", + aprint_normal_dev(dev, "PHY: %s, rev. %d", descr, rev); else aprint_normal_dev(dev, - "PHY OUI 0x%06x, model 0x%04x, rev. %d\n", + "PHY OUI 0x%06x, model 0x%04x, rev. %d", oui, model, rev); - /* Get NVM version */ + /* PHY FW version */ + phy->ops.read_reg(hw, 0x1e, _ver); + aprint_normal(", PHY FW version 0x%04hx\n", phy_ver); + + /* NVM version */ hw->nvm.ops.read(hw, NVM_VERSION, 1, _ver); - /* Get PHY FW version */ - phy->ops.read_reg(hw, 0x1e, _ver); + /* EtrackID */ + hw->nvm.ops.read(hw, NVM_ETKID_LO, 1, _lo); + hw->nvm.ops.read(hw, NVM_ETKID_HI, 1, _hi); - aprint_normal_dev(dev, "ROM image version %x.%02x", + aprint_normal_dev(dev, + "NVM image version %x.%02x, EtrackID %04hx%04hx\n", (nvm_ver & NVM_VERSION_MAJOR) >> NVM_VERSION_MAJOR_SHIFT, - (nvm_ver & NVM_VERSION_MINOR)); - aprint_debug("(0x%04hx)", nvm_ver); - - aprint_normal(", PHY FW version 0x%04hx\n", phy_ver); + nvm_ver & NVM_VERSION_MINOR, etk_hi, etk_lo); } Index: src/sys/dev/pci/igc/igc_defines.h diff -u src/sys/dev/pci/igc/igc_defines.h:1.2.2.2 src/sys/dev/pci/igc/igc_defines.h:1.2.2.3 ---
CVS commit: [netbsd-10] src/sys/dev/pci/igc
Module Name:src Committed By: martin Date: Sat Oct 14 06:49:37 UTC 2023 Modified Files: src/sys/dev/pci/igc [netbsd-10]: if_igc.c Log Message: Pull up following revision(s) (requested by rin in ticket #410): sys/dev/pci/igc/if_igc.c: revision 1.4 sys/dev/pci/igc/if_igc.c: revision 1.5 sys/dev/pci/igc/if_igc.c: revision 1.6 igc(4): Fix half duplex setting From FreeBSD: 3b8d04f845b416d29a258658b8a48d1afb4a2e81 igc(4): `nvm_ver & ...' has type int, so use %x, not %hx. This happens even though nvm_ver is unsigned short (uint16_t), because of the integer promotions. Should fix clang build. igc(4): igc_init: Enable interrupt after everything is set up Inspired by "ixgbe: Enable interrupt after setting IFF_RUNNING.": http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/dev/pci/ixgbe/ixgbe.c#rev1.337 Just for sure, callout_schedule(9) for igc_tick() is also postponed. This is NFC for now, although. To generate a diff of this commit: cvs rdiff -u -r1.3.2.2 -r1.3.2.3 src/sys/dev/pci/igc/if_igc.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/igc/if_igc.c diff -u src/sys/dev/pci/igc/if_igc.c:1.3.2.2 src/sys/dev/pci/igc/if_igc.c:1.3.2.3 --- src/sys/dev/pci/igc/if_igc.c:1.3.2.2 Sun Oct 8 13:19:34 2023 +++ src/sys/dev/pci/igc/if_igc.c Sat Oct 14 06:49:37 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: if_igc.c,v 1.3.2.2 2023/10/08 13:19:34 martin Exp $ */ +/* $NetBSD: if_igc.c,v 1.3.2.3 2023/10/14 06:49:37 martin Exp $ */ /* $OpenBSD: if_igc.c,v 1.13 2023/04/28 10:18:57 bluhm Exp $ */ /*- * SPDX-License-Identifier: BSD-2-Clause @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_igc.c,v 1.3.2.2 2023/10/08 13:19:34 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_igc.c,v 1.3.2.3 2023/10/14 06:49:37 martin Exp $"); #ifdef _KERNEL_OPT #include "opt_net_mpsafe.h" @@ -1541,17 +1541,17 @@ igc_init_locked(struct igc_softc *sc) mutex_exit(>rxr_lock); } - igc_enable_intr(sc); - sc->sc_core_stopping = false; - callout_schedule(>sc_tick_ch, hz); - ifp->if_flags |= IFF_RUNNING; /* Save last flags for the callback */ sc->sc_if_flags = ifp->if_flags; + callout_schedule(>sc_tick_ch, hz); + + igc_enable_intr(sc); + return 0; } @@ -2378,16 +2378,16 @@ igc_media_change(struct ifnet *ifp) sc->hw.phy.autoneg_advertised = ADVERTISE_1000_FULL; break; case IFM_100_TX: - if ((ifm->ifm_media & IFM_GMASK) == IFM_HDX) - sc->hw.phy.autoneg_advertised = ADVERTISE_100_HALF; - else + if ((ifm->ifm_media & IFM_GMASK) == IFM_FDX) sc->hw.phy.autoneg_advertised = ADVERTISE_100_FULL; + else + sc->hw.phy.autoneg_advertised = ADVERTISE_100_HALF; break; case IFM_10_T: - if ((ifm->ifm_media & IFM_GMASK) == IFM_HDX) - sc->hw.phy.autoneg_advertised = ADVERTISE_10_HALF; - else + if ((ifm->ifm_media & IFM_GMASK) == IFM_FDX) sc->hw.phy.autoneg_advertised = ADVERTISE_10_FULL; + else + sc->hw.phy.autoneg_advertised = ADVERTISE_10_HALF; break; default: return EINVAL; @@ -3842,7 +3842,7 @@ igc_print_devinfo(struct igc_softc *sc) /* Get PHY FW version */ phy->ops.read_reg(hw, 0x1e, _ver); - aprint_normal_dev(dev, "ROM image version %x.%02hx", + aprint_normal_dev(dev, "ROM image version %x.%02x", (nvm_ver & NVM_VERSION_MAJOR) >> NVM_VERSION_MAJOR_SHIFT, (nvm_ver & NVM_VERSION_MINOR)); aprint_debug("(0x%04hx)", nvm_ver);
CVS commit: [netbsd-10] src/sys/dev/pci/igc
Module Name:src Committed By: martin Date: Sat Oct 14 06:49:37 UTC 2023 Modified Files: src/sys/dev/pci/igc [netbsd-10]: if_igc.c Log Message: Pull up following revision(s) (requested by rin in ticket #410): sys/dev/pci/igc/if_igc.c: revision 1.4 sys/dev/pci/igc/if_igc.c: revision 1.5 sys/dev/pci/igc/if_igc.c: revision 1.6 igc(4): Fix half duplex setting From FreeBSD: 3b8d04f845b416d29a258658b8a48d1afb4a2e81 igc(4): `nvm_ver & ...' has type int, so use %x, not %hx. This happens even though nvm_ver is unsigned short (uint16_t), because of the integer promotions. Should fix clang build. igc(4): igc_init: Enable interrupt after everything is set up Inspired by "ixgbe: Enable interrupt after setting IFF_RUNNING.": http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/dev/pci/ixgbe/ixgbe.c#rev1.337 Just for sure, callout_schedule(9) for igc_tick() is also postponed. This is NFC for now, although. To generate a diff of this commit: cvs rdiff -u -r1.3.2.2 -r1.3.2.3 src/sys/dev/pci/igc/if_igc.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.