CVS commit: src/sys/dev/pci/igc

2024-06-27 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Thu Jun 27 07:31:42 UTC 2024

Modified Files:
src/sys/dev/pci/igc: if_igc.h

Log Message:
igc: Use __HAVE_ATOMIC64_LOADSTORE instead of __HAVE_ATOMIC64_OPS

to detect atomic_loadstore(9) is applicable to 64-bit integers.

Thanks riastradh@ for explanation in PR kern/58340


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/pci/igc/if_igc.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.h
diff -u src/sys/dev/pci/igc/if_igc.h:1.2 src/sys/dev/pci/igc/if_igc.h:1.3
--- src/sys/dev/pci/igc/if_igc.h:1.2	Wed Oct  4 07:35:27 2023
+++ src/sys/dev/pci/igc/if_igc.h	Thu Jun 27 07:31:41 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_igc.h,v 1.2 2023/10/04 07:35:27 rin Exp $	*/
+/*	$NetBSD: if_igc.h,v 1.3 2024/06/27 07:31:41 rin Exp $	*/
 /*	$OpenBSD: if_igc.h,v 1.2 2022/01/09 05:42:50 jsg Exp $	*/
 /*-
  * SPDX-License-Identifier: BSD-2-Clause
@@ -39,13 +39,14 @@
 #endif
 
 #include 
+#include 
 #include 
 #include 
 
 #include 
 #include 
 
-#ifdef __HAVE_ATOMIC64_OPS
+#ifdef __HAVE_ATOMIC64_LOADSTORE
 #define	IGC_EVENT_COUNTERS
 #endif
 



CVS commit: src/sys/dev/pci/igc

2024-06-27 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Thu Jun 27 07:31:42 UTC 2024

Modified Files:
src/sys/dev/pci/igc: if_igc.h

Log Message:
igc: Use __HAVE_ATOMIC64_LOADSTORE instead of __HAVE_ATOMIC64_OPS

to detect atomic_loadstore(9) is applicable to 64-bit integers.

Thanks riastradh@ for explanation in PR kern/58340


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/pci/igc/if_igc.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/pci/igc

2024-06-12 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed Jun 12 06:21:37 UTC 2024

Modified Files:
src/sys/dev/pci/igc: if_igc.c

Log Message:
igc: Add missing '\n' to a DPRINTF message


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 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.13 src/sys/dev/pci/igc/if_igc.c:1.14
--- src/sys/dev/pci/igc/if_igc.c:1.13	Wed Feb 21 12:39:39 2024
+++ src/sys/dev/pci/igc/if_igc.c	Wed Jun 12 06:21:37 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_igc.c,v 1.13 2024/02/21 12:39:39 msaitoh Exp $	*/
+/*	$NetBSD: if_igc.c,v 1.14 2024/06/12 06:21:37 rin 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.13 2024/02/21 12:39:39 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_igc.c,v 1.14 2024/06/12 06:21:37 rin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_if_igc.h"
@@ -2806,7 +2806,7 @@ igc_intr(void *arg)
 
 	/* Definitely not our interrupt. */
 	if (reg_icr == 0x0) {
-		DPRINTF(MISC, "not for me");
+		DPRINTF(MISC, "not for me\n");
 		return 0;
 	}
 



CVS commit: src/sys/dev/pci/igc

2024-06-12 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed Jun 12 06:21:37 UTC 2024

Modified Files:
src/sys/dev/pci/igc: if_igc.c

Log Message:
igc: Add missing '\n' to a DPRINTF message


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 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.



CVS commit: src/sys/dev/pci/igc

2024-02-21 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Feb 21 12:39:39 UTC 2024

Modified Files:
src/sys/dev/pci/igc: if_igc.c igc_defines.h

Log Message:
igc(4): Print EtrackID.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/dev/pci/igc/if_igc.c
cvs rdiff -u -r1.2 -r1.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.12 src/sys/dev/pci/igc/if_igc.c:1.13
--- src/sys/dev/pci/igc/if_igc.c:1.12	Wed Feb 21 12:34:06 2024
+++ src/sys/dev/pci/igc/if_igc.c	Wed Feb 21 12:39:39 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_igc.c,v 1.12 2024/02/21 12:34:06 msaitoh Exp $	*/
+/*	$NetBSD: if_igc.c,v 1.13 2024/02/21 12:39:39 msaitoh 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.12 2024/02/21 12:34:06 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_igc.c,v 1.13 2024/02/21 12:39:39 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_if_igc.h"
@@ -3850,7 +3850,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 */
@@ -3873,10 +3873,15 @@ igc_print_devinfo(struct igc_softc *sc)
 	phy->ops.read_reg(hw, 0x1e, _ver);
 	aprint_normal(", PHY FW version 0x%04hx\n", phy_ver);
 
-	/* Get NVM version */
+	/* NVM version */
 	hw->nvm.ops.read(hw, NVM_VERSION, 1, _ver);
 
-	aprint_normal_dev(dev, "ROM image version %x.%02x\n",
+	/* 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,
+	"NVM image version %x.%02x, EtrackID %04hx%04hx\n",
 	(nvm_ver & NVM_VERSION_MAJOR) >> NVM_VERSION_MAJOR_SHIFT,
-	(nvm_ver & NVM_VERSION_MINOR));
+	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 src/sys/dev/pci/igc/igc_defines.h:1.3
--- src/sys/dev/pci/igc/igc_defines.h:1.2	Wed Oct  4 07:35:27 2023
+++ src/sys/dev/pci/igc/igc_defines.h	Wed Feb 21 12:39:39 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: igc_defines.h,v 1.2 2023/10/04 07:35:27 rin Exp $	*/
+/*	$NetBSD: igc_defines.h,v 1.3 2024/02/21 12:39:39 msaitoh Exp $	*/
 /*	$OpenBSD: igc_defines.h,v 1.1 2021/10/31 14:52:57 patrick Exp $	*/
 
 /*-
@@ -982,6 +982,8 @@
 #define NVM_CFG0x0012
 #define NVM_ALT_MAC_ADDR_PTR		0x0037
 #define NVM_CHECKSUM_REG		0x003F
+#define NVM_ETKID_LO			0x0042
+#define NVM_ETKID_HI			0x0043
 
 #define IGC_NVM_CFG_DONE_PORT_0	0x04 /* MNG config cycle done */
 #define IGC_NVM_CFG_DONE_PORT_1	0x08 /* ...for second port */



CVS commit: src/sys/dev/pci/igc

2024-02-21 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Feb 21 12:39:39 UTC 2024

Modified Files:
src/sys/dev/pci/igc: if_igc.c igc_defines.h

Log Message:
igc(4): Print EtrackID.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/dev/pci/igc/if_igc.c
cvs rdiff -u -r1.2 -r1.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: src/sys/dev/pci/igc

2024-02-21 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Feb 21 12:34:06 UTC 2024

Modified Files:
src/sys/dev/pci/igc: if_igc.c

Log Message:
igc(4): Modify dmesg output of PHY and NVM info.

 - Print PHY info first and then print NVM info.
 - Remove debug output.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 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.11 src/sys/dev/pci/igc/if_igc.c:1.12
--- src/sys/dev/pci/igc/if_igc.c:1.11	Thu Feb  8 09:59:35 2024
+++ src/sys/dev/pci/igc/if_igc.c	Wed Feb 21 12:34:06 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_igc.c,v 1.11 2024/02/08 09:59:35 msaitoh Exp $	*/
+/*	$NetBSD: if_igc.c,v 1.12 2024/02/21 12:34:06 msaitoh 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.11 2024/02/08 09:59:35 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_igc.c,v 1.12 2024/02/21 12:34:06 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_if_igc.h"
@@ -3862,23 +3862,21 @@ 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);
 
+	/* PHY FW version */
+	phy->ops.read_reg(hw, 0x1e, _ver);
+	aprint_normal(", PHY FW version 0x%04hx\n", phy_ver);
+
 	/* Get NVM version */
 	hw->nvm.ops.read(hw, NVM_VERSION, 1, _ver);
 
-	/* Get PHY FW version */
-	phy->ops.read_reg(hw, 0x1e, _ver);
-
-	aprint_normal_dev(dev, "ROM image version %x.%02x",
+	aprint_normal_dev(dev, "ROM image version %x.%02x\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);
 }



CVS commit: src/sys/dev/pci/igc

2024-02-21 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Feb 21 12:34:06 UTC 2024

Modified Files:
src/sys/dev/pci/igc: if_igc.c

Log Message:
igc(4): Modify dmesg output of PHY and NVM info.

 - Print PHY info first and then print NVM info.
 - Remove debug output.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 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.



CVS commit: src/sys/dev/pci/igc

2024-02-08 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Feb  8 09:59:35 UTC 2024

Modified Files:
src/sys/dev/pci/igc: if_igc.c

Log Message:
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.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 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.



CVS commit: src/sys/dev/pci/igc

2024-02-08 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Feb  8 09:59:35 UTC 2024

Modified Files:
src/sys/dev/pci/igc: if_igc.c

Log Message:
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.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 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.10 src/sys/dev/pci/igc/if_igc.c:1.11
--- src/sys/dev/pci/igc/if_igc.c:1.10	Thu Jan 25 05:48:56 2024
+++ src/sys/dev/pci/igc/if_igc.c	Thu Feb  8 09:59:35 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_igc.c,v 1.10 2024/01/25 05:48:56 msaitoh Exp $	*/
+/*	$NetBSD: if_igc.c,v 1.11 2024/02/08 09:59:35 msaitoh 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.10 2024/01/25 05:48:56 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_igc.c,v 1.11 2024/02/08 09:59:35 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_if_igc.h"
@@ -2548,6 +2548,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,



CVS commit: src/sys/dev/pci/igc

2024-01-24 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Jan 25 05:48:56 UTC 2024

Modified Files:
src/sys/dev/pci/igc: if_igc.c

Log Message:
igc(4): Count iqdrops.

 TODO: RQDPC should be visible via evcnt(9).


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 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.9 src/sys/dev/pci/igc/if_igc.c:1.10
--- src/sys/dev/pci/igc/if_igc.c:1.9	Wed Dec 20 18:09:19 2023
+++ src/sys/dev/pci/igc/if_igc.c	Thu Jan 25 05:48:56 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_igc.c,v 1.9 2023/12/20 18:09:19 skrll Exp $	*/
+/*	$NetBSD: if_igc.c,v 1.10 2024/01/25 05:48:56 msaitoh 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.9 2023/12/20 18:09:19 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_igc.c,v 1.10 2024/01/25 05:48:56 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_if_igc.h"
@@ -1116,11 +1116,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
 }
 



CVS commit: src/sys/dev/pci/igc

2024-01-24 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Jan 25 05:48:56 UTC 2024

Modified Files:
src/sys/dev/pci/igc: if_igc.c

Log Message:
igc(4): Count iqdrops.

 TODO: RQDPC should be visible via evcnt(9).


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 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.



CVS commit: src/sys/dev/pci/igc

2023-11-02 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Thu Nov  2 09:29:30 UTC 2023

Modified Files:
src/sys/dev/pci/igc: if_igc.c

Log Message:
igc(4): Notify which of 64- or 32-bit DMA is used


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 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.7 src/sys/dev/pci/igc/if_igc.c:1.8
--- src/sys/dev/pci/igc/if_igc.c:1.7	Sun Oct 15 22:36:52 2023
+++ src/sys/dev/pci/igc/if_igc.c	Thu Nov  2 09:29:30 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_igc.c,v 1.7 2023/10/15 22:36:52 oster Exp $	*/
+/*	$NetBSD: if_igc.c,v 1.8 2023/11/02 09:29:30 rin 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.7 2023/10/15 22:36:52 oster Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_igc.c,v 1.8 2023/11/02 09:29:30 rin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -354,7 +354,6 @@ igc_attach(device_t parent, device_t sel
 
 	const struct igc_product *igcp = igc_lookup(pa);
 	KASSERT(igcp != NULL);
-	pci_aprint_devinfo_fancy(pa, "Ethernet controller", igcp->igcp_name, 1);
 
 	sc->sc_dev = self;
 	callout_init(>sc_tick_ch, CALLOUT_MPSAFE);
@@ -363,17 +362,23 @@ igc_attach(device_t parent, device_t sel
 
 	sc->osdep.os_sc = sc;
 	sc->osdep.os_pa = *pa;
-#ifdef __aarch64__
+#ifndef __aarch64__
 	/*
 	 * XXX PR port-arm/57643
 	 * 64-bit DMA does not work at least for LX2K with 32/64GB memory.
 	 * smmu(4) support may be required.
 	 */
-	sc->osdep.os_dmat = pa->pa_dmat;
-#else
-	sc->osdep.os_dmat = pci_dma64_available(pa) ?
-	pa->pa_dmat64 : pa->pa_dmat;
+	if (pci_dma64_available(pa)) {
+		aprint_verbose(", 64-bit DMA");
+		sc->osdep.os_dmat = pa->pa_dmat64;
+	} else
 #endif
+	{
+		aprint_verbose(", 32-bit DMA");
+		sc->osdep.os_dmat = pa->pa_dmat;
+	}
+
+	pci_aprint_devinfo_fancy(pa, "Ethernet controller", igcp->igcp_name, 1);
 
 	/* Determine hardware and mac info */
 	igc_identify_hardware(sc);



CVS commit: src/sys/dev/pci/igc

2023-11-02 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Thu Nov  2 09:29:30 UTC 2023

Modified Files:
src/sys/dev/pci/igc: if_igc.c

Log Message:
igc(4): Notify which of 64- or 32-bit DMA is used


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 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.



Re: CVS commit: src/sys/dev/pci/igc

2023-10-16 Thread Greg Oster




On 2023-10-15 17.06, Joerg Sonnenberger wrote:

On Sun, Oct 15, 2023 at 10:36:53PM +, Greg Oster wrote:

Module Name:src
Committed By:   oster
Date:   Sun Oct 15 22:36:53 UTC 2023

Modified Files:
src/sys/dev/pci/igc: if_igc.c

Log Message:
Fix build of the MODULAR kernel, which explicitly excludes vlans.


Please fix the macro to not expand to nothing instead.


I think you're referring to the change I made to src/sys/dev/sequencer.c 
instead of this one...  Done!


Later...

Greg Oster



Re: CVS commit: src/sys/dev/pci/igc

2023-10-15 Thread Joerg Sonnenberger
On Sun, Oct 15, 2023 at 10:36:53PM +, Greg Oster wrote:
> Module Name:  src
> Committed By: oster
> Date: Sun Oct 15 22:36:53 UTC 2023
> 
> Modified Files:
>   src/sys/dev/pci/igc: if_igc.c
> 
> Log Message:
> Fix build of the MODULAR kernel, which explicitly excludes vlans.

Please fix the macro to not expand to nothing instead.

Joerg


CVS commit: src/sys/dev/pci/igc

2023-10-15 Thread Greg Oster
Module Name:src
Committed By:   oster
Date:   Sun Oct 15 22:36:53 UTC 2023

Modified Files:
src/sys/dev/pci/igc: if_igc.c

Log Message:
Fix build of the MODULAR kernel, which explicitly excludes vlans.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 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.6 src/sys/dev/pci/igc/if_igc.c:1.7
--- src/sys/dev/pci/igc/if_igc.c:1.6	Thu Oct 12 04:08:44 2023
+++ src/sys/dev/pci/igc/if_igc.c	Sun Oct 15 22:36:52 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_igc.c,v 1.6 2023/10/12 04:08:44 rin Exp $	*/
+/*	$NetBSD: if_igc.c,v 1.7 2023/10/15 22:36:52 oster 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.6 2023/10/12 04:08:44 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_igc.c,v 1.7 2023/10/15 22:36:52 oster Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -2095,7 +2095,9 @@ igc_rxeof(struct rx_ring *rxr, u_int lim
 		const bool eop = staterr & IGC_RXD_STAT_EOP;
 		const uint16_t len = le16toh(rxdesc->wb.upper.length);
 
+#if NVLAN > 0
 		const uint16_t vtag = le16toh(rxdesc->wb.upper.vlan);
+#endif
 
 		const uint32_t ptype = le32toh(rxdesc->wb.lower.lo_dword.data) &
 		IGC_PKTTYPE_MASK;



CVS commit: src/sys/dev/pci/igc

2023-10-15 Thread Greg Oster
Module Name:src
Committed By:   oster
Date:   Sun Oct 15 22:36:53 UTC 2023

Modified Files:
src/sys/dev/pci/igc: if_igc.c

Log Message:
Fix build of the MODULAR kernel, which explicitly excludes vlans.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 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.



CVS commit: src/sys/dev/pci/igc

2023-10-11 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Thu Oct 12 04:08:44 UTC 2023

Modified Files:
src/sys/dev/pci/igc: if_igc.c

Log Message:
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.

XXX
Check other drivers.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 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.5 src/sys/dev/pci/igc/if_igc.c:1.6
--- src/sys/dev/pci/igc/if_igc.c:1.5	Wed Oct 11 18:19:43 2023
+++ src/sys/dev/pci/igc/if_igc.c	Thu Oct 12 04:08:44 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_igc.c,v 1.5 2023/10/11 18:19:43 riastradh Exp $	*/
+/*	$NetBSD: if_igc.c,v 1.6 2023/10/12 04:08:44 rin 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.5 2023/10/11 18:19:43 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_igc.c,v 1.6 2023/10/12 04:08:44 rin 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;
 }
 



CVS commit: src/sys/dev/pci/igc

2023-10-11 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Thu Oct 12 04:08:44 UTC 2023

Modified Files:
src/sys/dev/pci/igc: if_igc.c

Log Message:
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.

XXX
Check other drivers.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 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.



CVS commit: src/sys/dev/pci/igc

2023-10-11 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Oct 11 18:19:43 UTC 2023

Modified Files:
src/sys/dev/pci/igc: if_igc.c

Log Message:
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.

XXX pullup-10


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 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.4 src/sys/dev/pci/igc/if_igc.c:1.5
--- src/sys/dev/pci/igc/if_igc.c:1.4	Tue Oct 10 06:21:09 2023
+++ src/sys/dev/pci/igc/if_igc.c	Wed Oct 11 18:19:43 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_igc.c,v 1.4 2023/10/10 06:21:09 msaitoh Exp $	*/
+/*	$NetBSD: if_igc.c,v 1.5 2023/10/11 18:19:43 riastradh 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.4 2023/10/10 06:21:09 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_igc.c,v 1.5 2023/10/11 18:19:43 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -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: src/sys/dev/pci/igc

2023-10-11 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Oct 11 18:19:43 UTC 2023

Modified Files:
src/sys/dev/pci/igc: if_igc.c

Log Message:
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.

XXX pullup-10


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 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.



CVS commit: src/sys/dev/pci/igc

2023-10-10 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue Oct 10 06:21:09 UTC 2023

Modified Files:
src/sys/dev/pci/igc: if_igc.c

Log Message:
igc(4): Fix half duplex setting

 From FreeBSD: 3b8d04f845b416d29a258658b8a48d1afb4a2e81


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 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 src/sys/dev/pci/igc/if_igc.c:1.4
--- src/sys/dev/pci/igc/if_igc.c:1.3	Wed Oct  4 07:41:55 2023
+++ src/sys/dev/pci/igc/if_igc.c	Tue Oct 10 06:21:09 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_igc.c,v 1.3 2023/10/04 07:41:55 rin Exp $	*/
+/*	$NetBSD: if_igc.c,v 1.4 2023/10/10 06:21:09 msaitoh 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 2023/10/04 07:41:55 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_igc.c,v 1.4 2023/10/10 06:21:09 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -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;



CVS commit: src/sys/dev/pci/igc

2023-10-10 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue Oct 10 06:21:09 UTC 2023

Modified Files:
src/sys/dev/pci/igc: if_igc.c

Log Message:
igc(4): Fix half duplex setting

 From FreeBSD: 3b8d04f845b416d29a258658b8a48d1afb4a2e81


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 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.



CVS commit: src/sys/dev/pci/igc

2023-10-04 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed Oct  4 07:41:55 UTC 2023

Modified Files:
src/sys/dev/pci/igc: if_igc.c

Log Message:
igc(4): XXX: Temporally disable 64-bit DMA for aarch64

Until PR port-arm/57643 is properly addressed.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.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.2 src/sys/dev/pci/igc/if_igc.c:1.3
--- src/sys/dev/pci/igc/if_igc.c:1.2	Wed Oct  4 07:35:27 2023
+++ src/sys/dev/pci/igc/if_igc.c	Wed Oct  4 07:41:55 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_igc.c,v 1.2 2023/10/04 07:35:27 rin Exp $	*/
+/*	$NetBSD: if_igc.c,v 1.3 2023/10/04 07:41:55 rin 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.2 2023/10/04 07:35:27 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_igc.c,v 1.3 2023/10/04 07:41:55 rin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -363,8 +363,17 @@ igc_attach(device_t parent, device_t sel
 
 	sc->osdep.os_sc = sc;
 	sc->osdep.os_pa = *pa;
+#ifdef __aarch64__
+	/*
+	 * XXX PR port-arm/57643
+	 * 64-bit DMA does not work at least for LX2K with 32/64GB memory.
+	 * smmu(4) support may be required.
+	 */
+	sc->osdep.os_dmat = pa->pa_dmat;
+#else
 	sc->osdep.os_dmat = pci_dma64_available(pa) ?
 	pa->pa_dmat64 : pa->pa_dmat;
+#endif
 
 	/* Determine hardware and mac info */
 	igc_identify_hardware(sc);



CVS commit: src/sys/dev/pci/igc

2023-10-04 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed Oct  4 07:41:55 UTC 2023

Modified Files:
src/sys/dev/pci/igc: if_igc.c

Log Message:
igc(4): XXX: Temporally disable 64-bit DMA for aarch64

Until PR port-arm/57643 is properly addressed.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.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.