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 <sys/cdefs.h>
-__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->rxr_lock);
}
- igc_enable_intr(sc);
-
sc->sc_core_stopping = false;
- callout_schedule(&sc->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->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, &phy_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);