CVS commit: src/sys/dev/pci

2020-01-28 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Jan 29 06:46:59 UTC 2020

Modified Files:
src/sys/dev/pci: if_pcn.c

Log Message:
Adopt .


To generate a diff of this commit:
cvs rdiff -u -r1.72 -r1.73 src/sys/dev/pci/if_pcn.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/if_pcn.c
diff -u src/sys/dev/pci/if_pcn.c:1.72 src/sys/dev/pci/if_pcn.c:1.73
--- src/sys/dev/pci/if_pcn.c:1.72	Fri Oct 11 14:22:46 2019
+++ src/sys/dev/pci/if_pcn.c	Wed Jan 29 06:46:58 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_pcn.c,v 1.72 2019/10/11 14:22:46 msaitoh Exp $	*/
+/*	$NetBSD: if_pcn.c,v 1.73 2020/01/29 06:46:58 thorpej Exp $	*/
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -65,7 +65,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_pcn.c,v 1.72 2019/10/11 14:22:46 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_pcn.c,v 1.73 2020/01/29 06:46:58 thorpej Exp $");
 
 #include 
 #include 
@@ -1163,7 +1163,7 @@ pcn_watchdog(struct ifnet *ifp)
 	if (sc->sc_txfree != PCN_NTXDESC) {
 		printf("%s: device timeout (txfree %d txsfree %d)\n",
 		device_xname(sc->sc_dev), sc->sc_txfree, sc->sc_txsfree);
-		ifp->if_oerrors++;
+		if_statinc(ifp, if_oerrors);
 
 		/* Reset the interface. */
 		(void) pcn_init(ifp);
@@ -1248,11 +1248,11 @@ pcn_intr(void *arg)
 		if (csr0 & LE_C0_ERR) {
 			if (csr0 & LE_C0_BABL) {
 PCN_EVCNT_INCR(>sc_ev_babl);
-ifp->if_oerrors++;
+if_statinc(ifp, if_oerrors);
 			}
 			if (csr0 & LE_C0_MISS) {
 PCN_EVCNT_INCR(>sc_ev_miss);
-ifp->if_ierrors++;
+if_statinc(ifp, if_ierrors);
 			}
 			if (csr0 & LE_C0_MERR) {
 PCN_EVCNT_INCR(>sc_ev_merr);
@@ -1266,14 +1266,14 @@ pcn_intr(void *arg)
 		if ((csr0 & LE_C0_RXON) == 0) {
 			printf("%s: receiver disabled\n",
 			device_xname(sc->sc_dev));
-			ifp->if_ierrors++;
+			if_statinc(ifp, if_ierrors);
 			wantinit = 1;
 		}
 
 		if ((csr0 & LE_C0_TXON) == 0) {
 			printf("%s: transmitter disabled\n",
 			device_xname(sc->sc_dev));
-			ifp->if_oerrors++;
+			if_statinc(ifp, if_oerrors);
 			wantinit = 1;
 		}
 	}
@@ -1349,7 +1349,7 @@ pcn_txintr(struct pcn_softc *sc)
 		for (j = txs->txs_firstdesc;; j = PCN_NEXTTX(j)) {
 			tmd = le32toh(sc->sc_txdescs[j].tmd1);
 			if (tmd & LE_T1_ERR) {
-ifp->if_oerrors++;
+if_statinc(ifp, if_oerrors);
 if (sc->sc_swstyle == LE_B20_SSTYLE_PCNETPCI3)
 	tmd2 = le32toh(sc->sc_txdescs[j].tmd0);
 else
@@ -1380,21 +1380,21 @@ pcn_txintr(struct pcn_softc *sc)
 	device_xname(sc->sc_dev));
 }
 if (tmd2 & LE_T2_LCOL)
-	ifp->if_collisions++;
+	if_statinc(ifp, if_collisions);
 if (tmd2 & LE_T2_RTRY)
-	ifp->if_collisions += 16;
+	if_statadd(ifp, if_collisions, 16);
 goto next_packet;
 			}
 			if (j == txs->txs_lastdesc)
 break;
 		}
 		if (tmd1 & LE_T1_ONE)
-			ifp->if_collisions++;
+			if_statinc(ifp, if_collisions);
 		else if (tmd & LE_T1_MORE) {
 			/* Real number is unknown. */
-			ifp->if_collisions += 2;
+			if_statadd(ifp, if_collisions, 2);
 		}
-		ifp->if_opackets++;
+		if_statinc(ifp, if_opackets);
  next_packet:
 		sc->sc_txfree += txs->txs_dmamap->dm_nsegs;
 		bus_dmamap_sync(sc->sc_dmat, txs->txs_dmamap,
@@ -1461,7 +1461,7 @@ pcn_rxintr(struct pcn_softc *sc)
 			 * buffer.
 			 */
 			if (rmd1 & LE_R1_ERR) {
-ifp->if_ierrors++;
+if_statinc(ifp, if_ierrors);
 /*
  * If we got an overflow error, chances
  * are there will be a CRC error.  In
@@ -1530,7 +1530,7 @@ pcn_rxintr(struct pcn_softc *sc)
 			m = rxs->rxs_mbuf;
 			if (pcn_add_rxbuf(sc, i) != 0) {
  dropit:
-ifp->if_ierrors++;
+if_statinc(ifp, if_ierrors);
 PCN_INIT_RXDESC(sc, i);
 bus_dmamap_sync(sc->sc_dmat,
 rxs->rxs_dmamap, 0,



CVS commit: src/sys/dev/pci

2020-01-28 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Jan 29 06:44:27 UTC 2020

Modified Files:
src/sys/dev/pci: if_wm.c

Log Message:
Adopt .


To generate a diff of this commit:
cvs rdiff -u -r1.662 -r1.663 src/sys/dev/pci/if_wm.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/if_wm.c
diff -u src/sys/dev/pci/if_wm.c:1.662 src/sys/dev/pci/if_wm.c:1.663
--- src/sys/dev/pci/if_wm.c:1.662	Fri Jan 24 02:50:41 2020
+++ src/sys/dev/pci/if_wm.c	Wed Jan 29 06:44:27 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.662 2020/01/24 02:50:41 knakahara Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.663 2020/01/29 06:44:27 thorpej Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -82,7 +82,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.662 2020/01/24 02:50:41 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.663 2020/01/29 06:44:27 thorpej Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -3266,7 +3266,7 @@ wm_watchdog_txq_locked(struct ifnet *ifp
 		"%s: device timeout (txfree %d txsfree %d txnext %d)\n",
 		device_xname(sc->sc_dev), txq->txq_free, txq->txq_sfree,
 		txq->txq_next);
-		ifp->if_oerrors++;
+		if_statinc(ifp, if_oerrors);
 #ifdef WM_DEBUG
 		for (i = txq->txq_sdirty; i != txq->txq_snext;
 		i = WM_NEXTTXS(txq, i)) {
@@ -3331,15 +3331,16 @@ wm_tick(void *arg)
 		WM_EVCNT_ADD(>sc_ev_rx_macctl, CSR_READ(sc, WMREG_FCRUC));
 	}
 
-	ifp->if_collisions += CSR_READ(sc, WMREG_COLC);
-	ifp->if_ierrors += 0ULL /* ensure quad_t */
+	net_stat_ref_t nsr = IF_STAT_GETREF(ifp);
+	if_statadd_ref(nsr, if_collisions, CSR_READ(sc, WMREG_COLC));
+	if_statadd_ref(nsr, if_ierrors, 0ULL /* ensure quad_t */
 	+ CSR_READ(sc, WMREG_CRCERRS)
 	+ CSR_READ(sc, WMREG_ALGNERRC)
 	+ CSR_READ(sc, WMREG_SYMERRC)
 	+ CSR_READ(sc, WMREG_RXERRC)
 	+ CSR_READ(sc, WMREG_SEC)
 	+ CSR_READ(sc, WMREG_CEXTERR)
-	+ CSR_READ(sc, WMREG_RLEC);
+	+ CSR_READ(sc, WMREG_RLEC));
 	/*
 	 * WMREG_RNBC is incremented when there is no available buffers in host
 	 * memory. It does not mean the number of dropped packet. Because
@@ -3349,7 +3350,8 @@ wm_tick(void *arg)
 	 * If you want to know the nubmer of WMREG_RMBC, you should use such as
 	 * own EVCNT instead of if_iqdrops.
 	 */
-	ifp->if_iqdrops += CSR_READ(sc, WMREG_MPC);
+	if_statadd_ref(nsr, if_iqdrops, CSR_READ(sc, WMREG_MPC));
+	IF_STAT_PUTREF(ifp);
 
 	if (sc->sc_flags & WM_F_HAS_MII)
 		mii_tick(>sc_mii);
@@ -5847,8 +5849,8 @@ wm_init_locked(struct ifnet *ifp)
 	wm_stop_locked(ifp, 0);
 
 	/* Update statistics before reset */
-	ifp->if_collisions += CSR_READ(sc, WMREG_COLC);
-	ifp->if_ierrors += CSR_READ(sc, WMREG_RXERRC);
+	if_statadd2(ifp, if_collisions, CSR_READ(sc, WMREG_COLC),
+	if_ierrors, CSR_READ(sc, WMREG_RXERRC));
 
 	/* PCH_SPT hardware workaround */
 	if (sc->sc_type == WM_T_PCH_SPT)
@@ -7562,7 +7564,7 @@ wm_start(struct ifnet *ifp)
 	KASSERT(if_is_mpsafe(ifp));
 #endif
 	/*
-	 * ifp->if_obytes and ifp->if_omcasts are added in if_transmit()@if.c.
+	 * if_obytes and if_omcasts are added in if_transmit()@if.c.
 	 */
 
 	mutex_enter(txq->txq_lock);
@@ -7596,10 +7598,11 @@ wm_transmit(struct ifnet *ifp, struct mb
 		return ENOBUFS;
 	}
 
-	/* XXX NOMPSAFE: ifp->if_data should be percpu. */
-	ifp->if_obytes += m->m_pkthdr.len;
+	net_stat_ref_t nsr = IF_STAT_GETREF(ifp);
+	if_statadd_ref(nsr, if_obytes, m->m_pkthdr.len);
 	if (m->m_flags & M_MCAST)
-		ifp->if_omcasts++;
+		if_statinc_ref(nsr, if_omcasts);
+	IF_STAT_PUTREF(ifp);
 
 	if (mutex_tryenter(txq->txq_lock)) {
 		if (!txq->txq_stopping)
@@ -8167,7 +8170,7 @@ wm_nq_start(struct ifnet *ifp)
 	KASSERT(if_is_mpsafe(ifp));
 #endif
 	/*
-	 * ifp->if_obytes and ifp->if_omcasts are added in if_transmit()@if.c.
+	 * if_obytes and if_omcasts are added in if_transmit()@if.c.
 	 */
 
 	mutex_enter(txq->txq_lock);
@@ -8201,10 +8204,11 @@ wm_nq_transmit(struct ifnet *ifp, struct
 		return ENOBUFS;
 	}
 
-	/* XXX NOMPSAFE: ifp->if_data should be percpu. */
-	ifp->if_obytes += m->m_pkthdr.len;
+	net_stat_ref_t nsr = IF_STAT_GETREF(ifp);
+	if_statadd_ref(nsr, if_obytes, m->m_pkthdr.len);
 	if (m->m_flags & M_MCAST)
-		ifp->if_omcasts++;
+		if_statinc_ref(nsr, if_omcasts);
+	IF_STAT_PUTREF(ifp);
 
 	/*
 	 * The situations which this mutex_tryenter() fails at running time
@@ -8649,18 +8653,18 @@ wm_txeof(struct wm_txqueue *txq, u_int l
 		if (((status & (WTX_ST_EC | WTX_ST_LC)) != 0)
 		&& ((sc->sc_type < WM_T_82574)
 			|| (sc->sc_type == WM_T_80003))) {
-			ifp->if_oerrors++;
+			if_statinc(ifp, if_oerrors);
 			if (status & WTX_ST_LC)
 log(LOG_WARNING, "%s: late collision\n",
 device_xname(sc->sc_dev));
 			else if (status & WTX_ST_EC) {
-ifp->if_collisions +=
-TX_COLLISION_THRESHOLD + 1;
+if_statadd(ifp, if_collisions, 
+TX_COLLISION_THRESHOLD + 1);
 log(LOG_WARNING, "%s: 

CVS commit: src/sys/dev/usb

2020-01-28 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Jan 29 06:39:07 UTC 2020

Modified Files:
src/sys/dev/usb: if_ure.c if_url.c if_urndis.c if_urtw.c if_urtwn.c
if_zyd.c uhso.c usbnet.c

Log Message:
Adopt .


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/dev/usb/if_ure.c
cvs rdiff -u -r1.72 -r1.73 src/sys/dev/usb/if_url.c
cvs rdiff -u -r1.35 -r1.36 src/sys/dev/usb/if_urndis.c
cvs rdiff -u -r1.20 -r1.21 src/sys/dev/usb/if_urtw.c
cvs rdiff -u -r1.80 -r1.81 src/sys/dev/usb/if_urtwn.c
cvs rdiff -u -r1.55 -r1.56 src/sys/dev/usb/if_zyd.c
cvs rdiff -u -r1.31 -r1.32 src/sys/dev/usb/uhso.c
cvs rdiff -u -r1.33 -r1.34 src/sys/dev/usb/usbnet.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/usb/if_ure.c
diff -u src/sys/dev/usb/if_ure.c:1.34 src/sys/dev/usb/if_ure.c:1.35
--- src/sys/dev/usb/if_ure.c:1.34	Tue Jan  7 06:42:26 2020
+++ src/sys/dev/usb/if_ure.c	Wed Jan 29 06:39:07 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ure.c,v 1.34 2020/01/07 06:42:26 maxv Exp $	*/
+/*	$NetBSD: if_ure.c,v 1.35 2020/01/29 06:39:07 thorpej Exp $	*/
 /*	$OpenBSD: if_ure.c,v 1.10 2018/11/02 21:32:30 jcs Exp $	*/
 
 /*-
@@ -30,7 +30,7 @@
 /* RealTek RTL8152/RTL8153 10/100/Gigabit USB Ethernet device */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_ure.c,v 1.34 2020/01/07 06:42:26 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ure.c,v 1.35 2020/01/29 06:39:07 thorpej Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -1007,7 +1007,7 @@ ure_rx_loop(struct usbnet *un, struct us
 	do {
 		if (total_len < sizeof(rxhdr)) {
 			DPRINTF(("too few bytes left for a packet header\n"));
-			ifp->if_ierrors++;
+			if_statinc(ifp, if_ierrors);
 			return;
 		}
 
@@ -1020,7 +1020,7 @@ ure_rx_loop(struct usbnet *un, struct us
 		DPRINTFN(4, ("next packet is %d bytes\n", pkt_len));
 		if (pkt_len > total_len) {
 			DPRINTF(("not enough bytes left for next packet\n"));
-			ifp->if_ierrors++;
+			if_statinc(ifp, if_ierrors);
 			return;
 		}
 

Index: src/sys/dev/usb/if_url.c
diff -u src/sys/dev/usb/if_url.c:1.72 src/sys/dev/usb/if_url.c:1.73
--- src/sys/dev/usb/if_url.c:1.72	Tue Jan  7 06:42:26 2020
+++ src/sys/dev/usb/if_url.c	Wed Jan 29 06:39:07 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_url.c,v 1.72 2020/01/07 06:42:26 maxv Exp $	*/
+/*	$NetBSD: if_url.c,v 1.73 2020/01/29 06:39:07 thorpej Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002
@@ -44,7 +44,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_url.c,v 1.72 2020/01/07 06:42:26 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_url.c,v 1.73 2020/01/29 06:39:07 thorpej Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -576,7 +576,7 @@ url_rx_loop(struct usbnet *un, struct us
 	DPRINTF(("%s: %s: enter\n", device_xname(un->un_dev),__func__));
 
 	if (total_len <= ETHER_CRC_LEN || total_len <= sizeof(rxhdr)) {
-		ifp->if_ierrors++;
+		if_statinc(ifp, if_ierrors);
 		return;
 	}
 
@@ -591,7 +591,7 @@ url_rx_loop(struct usbnet *un, struct us
 		 UGETW(rxhdr) & URL_RXHDR_MCASTPKT_MASK ? ", Multicast" : ""));
 
 	if ((UGETW(rxhdr) & URL_RXHDR_VALID_MASK) == 0) {
-		ifp->if_ierrors++;
+		if_statinc(ifp, if_ierrors);
 		return;
 	}
 

Index: src/sys/dev/usb/if_urndis.c
diff -u src/sys/dev/usb/if_urndis.c:1.35 src/sys/dev/usb/if_urndis.c:1.36
--- src/sys/dev/usb/if_urndis.c:1.35	Tue Jan  7 06:42:26 2020
+++ src/sys/dev/usb/if_urndis.c	Wed Jan 29 06:39:07 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_urndis.c,v 1.35 2020/01/07 06:42:26 maxv Exp $ */
+/*	$NetBSD: if_urndis.c,v 1.36 2020/01/29 06:39:07 thorpej Exp $ */
 /*	$OpenBSD: if_urndis.c,v 1.31 2011/07/03 15:47:17 matthew Exp $ */
 
 /*
@@ -21,7 +21,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_urndis.c,v 1.35 2020/01/07 06:42:26 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_urndis.c,v 1.36 2020/01/29 06:39:07 thorpej Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -820,7 +820,7 @@ urndis_rx_loop(struct usbnet * un, struc
 		}
 
 		if (le32toh(msg->rm_datalen) < sizeof(struct ether_header)) {
-			ifp->if_ierrors++;
+			if_statinc(ifp, if_ierrors);
 			printf("%s: urndis_decap invalid ethernet size "
 			"%d < %zu\n",
 			DEVNAME(un),

Index: src/sys/dev/usb/if_urtw.c
diff -u src/sys/dev/usb/if_urtw.c:1.20 src/sys/dev/usb/if_urtw.c:1.21
--- src/sys/dev/usb/if_urtw.c:1.20	Thu Nov 28 17:09:10 2019
+++ src/sys/dev/usb/if_urtw.c	Wed Jan 29 06:39:07 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_urtw.c,v 1.20 2019/11/28 17:09:10 maxv Exp $	*/
+/*	$NetBSD: if_urtw.c,v 1.21 2020/01/29 06:39:07 thorpej Exp $	*/
 /*	$OpenBSD: if_urtw.c,v 1.39 2011/07/03 15:47:17 matthew Exp $	*/
 
 /*-
@@ -19,7 +19,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_urtw.c,v 1.20 2019/11/28 17:09:10 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_urtw.c,v 1.21 2020/01/29 06:39:07 thorpej Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -2489,7 +2489,7 @@ urtw_start(struct ifnet *ifp)
 			if (urtw_tx_start(sc, ni, m0, 

CVS commit: src/sys/dev/usb

2020-01-28 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Jan 29 06:35:28 UTC 2020

Modified Files:
src/sys/dev/usb: if_otus.c if_rum.c if_run.c if_smsc.c if_udav.c
if_umb.c if_upgt.c if_upl.c if_ural.c

Log Message:
Adopt .


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/sys/dev/usb/if_otus.c
cvs rdiff -u -r1.65 -r1.66 src/sys/dev/usb/if_rum.c
cvs rdiff -u -r1.35 -r1.36 src/sys/dev/usb/if_run.c
cvs rdiff -u -r1.62 -r1.63 src/sys/dev/usb/if_smsc.c
cvs rdiff -u -r1.73 -r1.74 src/sys/dev/usb/if_udav.c
cvs rdiff -u -r1.10 -r1.11 src/sys/dev/usb/if_umb.c
cvs rdiff -u -r1.27 -r1.28 src/sys/dev/usb/if_upgt.c
cvs rdiff -u -r1.69 -r1.70 src/sys/dev/usb/if_upl.c
cvs rdiff -u -r1.61 -r1.62 src/sys/dev/usb/if_ural.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/usb/if_otus.c
diff -u src/sys/dev/usb/if_otus.c:1.40 src/sys/dev/usb/if_otus.c:1.41
--- src/sys/dev/usb/if_otus.c:1.40	Wed Jan 15 08:20:13 2020
+++ src/sys/dev/usb/if_otus.c	Wed Jan 29 06:35:28 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_otus.c,v 1.40 2020/01/15 08:20:13 skrll Exp $	*/
+/*	$NetBSD: if_otus.c,v 1.41 2020/01/29 06:35:28 thorpej Exp $	*/
 /*	$OpenBSD: if_otus.c,v 1.18 2010/08/27 17:08:00 jsg Exp $	*/
 
 /*-
@@ -23,7 +23,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_otus.c,v 1.40 2020/01/15 08:20:13 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_otus.c,v 1.41 2020/01/29 06:35:28 thorpej Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -1734,7 +1734,7 @@ otus_sub_rxeof(struct otus_softc *sc, ui
 	/* Received MPDU. */
 	if (__predict_false(len < AR_PLCP_HDR_LEN + sizeof(*tail))) {
 		DPRINTFN(DBG_RX, sc, "MPDU too short %d\n", len);
-		ifp->if_ierrors++;
+		if_statinc(ifp, if_ierrors);
 		return;
 	}
 	tail = (void *)(plcp + len - sizeof(*tail));
@@ -1749,7 +1749,7 @@ otus_sub_rxeof(struct otus_softc *sc, ui
 			/* Report Michael MIC failures to net80211. */
 			ieee80211_notify_michael_failure(ic, wh, 0 /* XXX: keyix */);
 		}
-		ifp->if_ierrors++;
+		if_statinc(ifp, if_ierrors);
 		return;
 	}
 	/* Compute MPDU's length. */
@@ -1761,7 +1761,7 @@ otus_sub_rxeof(struct otus_softc *sc, ui
 	 * want this in IEEE80211_M_MONITOR mode?
 	 */
 	if (__predict_false(mlen < sizeof(*wh))) {
-		ifp->if_ierrors++;
+		if_statinc(ifp, if_ierrors);
 		return;
 	}
 
@@ -1770,13 +1770,13 @@ otus_sub_rxeof(struct otus_softc *sc, ui
 
 	MGETHDR(m, M_DONTWAIT, MT_DATA);
 	if (__predict_false(m == NULL)) {
-		ifp->if_ierrors++;
+		if_statinc(ifp, if_ierrors);
 		return;
 	}
 	if (align + mlen > MHLEN) {
 		MCLGET(m, M_DONTWAIT);
 		if (__predict_false(!(m->m_flags & M_EXT))) {
-			ifp->if_ierrors++;
+			if_statinc(ifp, if_ierrors);
 			m_freem(m);
 			return;
 		}
@@ -1917,10 +1917,10 @@ otus_txeof(struct usbd_xfer *xfer, void 
 		DPRINTFN(DBG_TX, sc, "TX status=%d\n", status);
 		if (status == USBD_STALLED)
 			usbd_clear_endpoint_stall_async(sc->sc_data_tx_pipe);
-		ifp->if_oerrors++;
+		if_statinc(ifp, if_oerrors);
 		return;
 	}
-	ifp->if_opackets++;
+	if_statinc(ifp, if_opackets);
 
 	s = splnet();
 	sc->sc_tx_timer = 0;
@@ -2114,7 +2114,7 @@ otus_start(struct ifnet *ifp)
 
 		if (m->m_len < (int)sizeof(*eh) &&
 		(m = m_pullup(m, sizeof(*eh))) == NULL) {
-			ifp->if_oerrors++;
+			if_statinc(ifp, if_oerrors);
 			continue;
 		}
 
@@ -2122,7 +2122,7 @@ otus_start(struct ifnet *ifp)
 		ni = ieee80211_find_txnode(ic, eh->ether_dhost);
 		if (ni == NULL) {
 			m_freem(m);
-			ifp->if_oerrors++;
+			if_statinc(ifp, if_oerrors);
 			continue;
 		}
 
@@ -2131,7 +2131,7 @@ otus_start(struct ifnet *ifp)
 		if ((m = ieee80211_encap(ic, m, ni)) == NULL) {
 			/* original m was freed by ieee80211_encap() */
 			ieee80211_free_node(ni);
-			ifp->if_oerrors++;
+			if_statinc(ifp, if_oerrors);
 			continue;
 		}
  sendit:
@@ -2140,7 +2140,7 @@ otus_start(struct ifnet *ifp)
 		if (otus_tx(sc, m, ni, data) != 0) {
 			m_freem(m);
 			ieee80211_free_node(ni);
-			ifp->if_oerrors++;
+			if_statinc(ifp, if_oerrors);
 			continue;
 		}
 
@@ -2175,7 +2175,7 @@ otus_watchdog(struct ifnet *ifp)
 		if (--sc->sc_tx_timer == 0) {
 			aprint_error_dev(sc->sc_dev, "device timeout\n");
 			/* otus_init(ifp); XXX needs a process context! */
-			ifp->if_oerrors++;
+			if_statinc(ifp, if_oerrors);
 			return;
 		}
 		ifp->if_timer = 1;

Index: src/sys/dev/usb/if_rum.c
diff -u src/sys/dev/usb/if_rum.c:1.65 src/sys/dev/usb/if_rum.c:1.66
--- src/sys/dev/usb/if_rum.c:1.65	Sun May  5 03:17:54 2019
+++ src/sys/dev/usb/if_rum.c	Wed Jan 29 06:35:28 2020
@@ -1,5 +1,5 @@
 /*	$OpenBSD: if_rum.c,v 1.40 2006/09/18 16:20:20 damien Exp $	*/
-/*	$NetBSD: if_rum.c,v 1.65 2019/05/05 03:17:54 mrg Exp $	*/
+/*	$NetBSD: if_rum.c,v 1.66 2020/01/29 06:35:28 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2005-2007 Damien Bergamini 
@@ -24,7 +24,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_rum.c,v 1.65 2019/05/05 03:17:54 mrg Exp $");
+__KERNEL_RCSID(0, 

CVS commit: src/sys/dev/usb

2020-01-28 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Jan 29 06:26:32 UTC 2020

Modified Files:
src/sys/dev/usb: if_bwfm_usb.c if_cdce.c if_cue.c if_kue.c if_mos.c
if_mue.c

Log Message:
Adopt .


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/dev/usb/if_bwfm_usb.c
cvs rdiff -u -r1.68 -r1.69 src/sys/dev/usb/if_cdce.c
cvs rdiff -u -r1.88 -r1.89 src/sys/dev/usb/if_cue.c
cvs rdiff -u -r1.101 -r1.102 src/sys/dev/usb/if_kue.c
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/usb/if_mos.c
cvs rdiff -u -r1.56 -r1.57 src/sys/dev/usb/if_mue.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/usb/if_bwfm_usb.c
diff -u src/sys/dev/usb/if_bwfm_usb.c:1.9 src/sys/dev/usb/if_bwfm_usb.c:1.10
--- src/sys/dev/usb/if_bwfm_usb.c:1.9	Sun Jan 27 02:08:42 2019
+++ src/sys/dev/usb/if_bwfm_usb.c	Wed Jan 29 06:26:32 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: if_bwfm_usb.c,v 1.9 2019/01/27 02:08:42 pgoyette Exp $ */
+/* $NetBSD: if_bwfm_usb.c,v 1.10 2020/01/29 06:26:32 thorpej Exp $ */
 /* $OpenBSD: if_bwfm_usb.c,v 1.2 2017/10/15 14:55:13 patrick Exp $ */
 /*
  * Copyright (c) 2010-2016 Broadcom Corporation
@@ -18,7 +18,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_bwfm_usb.c,v 1.9 2019/01/27 02:08:42 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_bwfm_usb.c,v 1.10 2020/01/29 06:26:32 thorpej Exp $");
 
 #include 
 #include 
@@ -617,12 +617,12 @@ bwfm_usb_txeof(struct usbd_xfer *xfer, v
 	if (__predict_false(status != USBD_NORMAL_COMPLETION)) {
 		if (status == USBD_CANCELLED)
 			usbd_clear_endpoint_stall_async(sc->sc_tx_pipeh);
-		ifp->if_oerrors++;
+		if_statinc(ifp, if_oerrors);
 		splx(s);
 		return;
 	}
 
-	ifp->if_opackets++;
+	if_statinc(ifp, if_opackets);
 
 	/* We just released a Tx buffer, notify Tx. */
 	if ((ifp->if_flags & IFF_OACTIVE) != 0) {

Index: src/sys/dev/usb/if_cdce.c
diff -u src/sys/dev/usb/if_cdce.c:1.68 src/sys/dev/usb/if_cdce.c:1.69
--- src/sys/dev/usb/if_cdce.c:1.68	Tue Jan  7 06:42:26 2020
+++ src/sys/dev/usb/if_cdce.c	Wed Jan 29 06:26:32 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_cdce.c,v 1.68 2020/01/07 06:42:26 maxv Exp $ */
+/*	$NetBSD: if_cdce.c,v 1.69 2020/01/29 06:26:32 thorpej Exp $ */
 
 /*
  * Copyright (c) 1997, 1998, 1999, 2000-2003 Bill Paul 
@@ -40,7 +40,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_cdce.c,v 1.68 2020/01/07 06:42:26 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_cdce.c,v 1.69 2020/01/29 06:26:32 thorpej Exp $");
 
 #include 
 
@@ -282,7 +282,7 @@ cdce_rx_loop(struct usbnet * un, struct 
 		total_len -= 4;
 
 	if (total_len < sizeof(struct ether_header)) {
-		ifp->if_ierrors++;
+		if_statinc(ifp, if_ierrors);
 		return;
 	}
 

Index: src/sys/dev/usb/if_cue.c
diff -u src/sys/dev/usb/if_cue.c:1.88 src/sys/dev/usb/if_cue.c:1.89
--- src/sys/dev/usb/if_cue.c:1.88	Tue Jan  7 06:42:26 2020
+++ src/sys/dev/usb/if_cue.c	Wed Jan 29 06:26:32 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_cue.c,v 1.88 2020/01/07 06:42:26 maxv Exp $	*/
+/*	$NetBSD: if_cue.c,v 1.89 2020/01/29 06:26:32 thorpej Exp $	*/
 
 /*
  * Copyright (c) 1997, 1998, 1999, 2000
@@ -57,7 +57,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_cue.c,v 1.88 2020/01/07 06:42:26 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_cue.c,v 1.89 2020/01/29 06:26:32 thorpej Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -545,12 +545,17 @@ cue_tick(struct usbnet *un)
 {
 	struct ifnet		*ifp = usbnet_ifp(un);
 
+	net_stat_ref_t nsr = IF_STAT_GETREF(ifp);
 	if (cue_csr_read_2(un, CUE_RX_FRAMEERR))
-		ifp->if_ierrors++;
+		if_statinc_ref(nsr, if_ierrors);
 
-	ifp->if_collisions += cue_csr_read_2(un, CUE_TX_SINGLECOLL);
-	ifp->if_collisions += cue_csr_read_2(un, CUE_TX_MULTICOLL);
-	ifp->if_collisions += cue_csr_read_2(un, CUE_TX_EXCESSCOLL);
+	if_statadd_ref(nsr, if_collisions,
+	cue_csr_read_2(un, CUE_TX_SINGLECOLL));
+	if_statadd_ref(nsr, if_collisions,
+	cue_csr_read_2(un, CUE_TX_MULTICOLL));
+	if_statadd_ref(nsr, if_collisions,
+	cue_csr_read_2(un, CUE_TX_EXCESSCOLL));
+	IF_STAT_PUTREF(ifp);
 }
 
 static void
@@ -568,7 +573,7 @@ cue_rx_loop(struct usbnet *un, struct us
 	if (total_len < 2 ||
 	len > total_len - 2 ||
 	len < sizeof(struct ether_header)) {
-		ifp->if_ierrors++;
+		if_statinc(ifp, if_ierrors);
 		return;
 	}
 

Index: src/sys/dev/usb/if_kue.c
diff -u src/sys/dev/usb/if_kue.c:1.101 src/sys/dev/usb/if_kue.c:1.102
--- src/sys/dev/usb/if_kue.c:1.101	Tue Jan  7 06:42:26 2020
+++ src/sys/dev/usb/if_kue.c	Wed Jan 29 06:26:32 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_kue.c,v 1.101 2020/01/07 06:42:26 maxv Exp $	*/
+/*	$NetBSD: if_kue.c,v 1.102 2020/01/29 06:26:32 thorpej Exp $	*/
 
 /*
  * Copyright (c) 1997, 1998, 1999, 2000
@@ -71,7 +71,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_kue.c,v 1.101 2020/01/07 06:42:26 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_kue.c,v 1.102 2020/01/29 06:26:32 thorpej Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ 

CVS commit: src/sys/dev/usb

2020-01-28 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Jan 29 06:24:10 UTC 2020

Modified Files:
src/sys/dev/usb: if_athn_usb.c if_atu.c if_aue.c if_axe.c if_axen.c

Log Message:
Adopt .


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/sys/dev/usb/if_athn_usb.c
cvs rdiff -u -r1.69 -r1.70 src/sys/dev/usb/if_atu.c src/sys/dev/usb/if_axen.c
cvs rdiff -u -r1.162 -r1.163 src/sys/dev/usb/if_aue.c
cvs rdiff -u -r1.121 -r1.122 src/sys/dev/usb/if_axe.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/usb/if_athn_usb.c
diff -u src/sys/dev/usb/if_athn_usb.c:1.35 src/sys/dev/usb/if_athn_usb.c:1.36
--- src/sys/dev/usb/if_athn_usb.c:1.35	Sat Sep 14 12:36:35 2019
+++ src/sys/dev/usb/if_athn_usb.c	Wed Jan 29 06:24:10 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_athn_usb.c,v 1.35 2019/09/14 12:36:35 maxv Exp $	*/
+/*	$NetBSD: if_athn_usb.c,v 1.36 2020/01/29 06:24:10 thorpej Exp $	*/
 /*	$OpenBSD: if_athn_usb.c,v 1.12 2013/01/14 09:50:31 jsing Exp $	*/
 
 /*-
@@ -22,7 +22,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_athn_usb.c,v 1.35 2019/09/14 12:36:35 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_athn_usb.c,v 1.36 2020/01/29 06:24:10 thorpej Exp $");
 
 #ifdef	_KERNEL_OPT
 #include "opt_inet.h"
@@ -2429,13 +2429,13 @@ athn_usb_txeof(struct usbd_xfer *xfer, v
 		DPRINTFN(DBG_TX, sc, "TX status=%d\n", status);
 		if (status == USBD_STALLED)
 			usbd_clear_endpoint_stall_async(usc->usc_tx_data_pipe);
-		ifp->if_oerrors++;
+		if_statinc(ifp, if_oerrors);
 		splx(s);
 		/* XXX Why return? */
 		return;
 	}
 	sc->sc_tx_timer = 0;
-	ifp->if_opackets++;
+	if_statinc(ifp, if_opackets);
 
 	/* We just released a Tx buffer, notify Tx. */
 	if (ifp->if_flags & IFF_OACTIVE) {
@@ -2608,14 +2608,14 @@ athn_usb_start(struct ifnet *ifp)
 
 		if (m->m_len < (int)sizeof(*eh) &&
 		(m = m_pullup(m, sizeof(*eh))) == NULL) {
-			ifp->if_oerrors++;
+			if_statinc(ifp, if_oerrors);
 			continue;
 		}
 		eh = mtod(m, struct ether_header *);
 		ni = ieee80211_find_txnode(ic, eh->ether_dhost);
 		if (ni == NULL) {
 			m_freem(m);
-			ifp->if_oerrors++;
+			if_statinc(ifp, if_oerrors);
 			continue;
 		}
 
@@ -2623,7 +2623,7 @@ athn_usb_start(struct ifnet *ifp)
 
 		if ((m = ieee80211_encap(ic, m, ni)) == NULL) {
 			ieee80211_free_node(ni);
-			ifp->if_oerrors++;
+			if_statinc(ifp, if_oerrors);
 			continue;
 		}
  sendit:
@@ -2632,7 +2632,7 @@ athn_usb_start(struct ifnet *ifp)
 		if (athn_usb_tx(sc, m, ni, data) != 0) {
 			m_freem(m);
 			ieee80211_free_node(ni);
-			ifp->if_oerrors++;
+			if_statinc(ifp, if_oerrors);
 			continue;
 		}
 		data = NULL;
@@ -2661,7 +2661,7 @@ athn_usb_watchdog(struct ifnet *ifp)
 		if (--sc->sc_tx_timer == 0) {
 			aprint_error_dev(sc->sc_dev, "device timeout\n");
 			/* athn_usb_init(ifp); XXX needs a process context! */
-			ifp->if_oerrors++;
+			if_statinc(ifp, if_oerrors);
 			return;
 		}
 		ifp->if_timer = 1;

Index: src/sys/dev/usb/if_atu.c
diff -u src/sys/dev/usb/if_atu.c:1.69 src/sys/dev/usb/if_atu.c:1.70
--- src/sys/dev/usb/if_atu.c:1.69	Fri Dec 27 09:41:51 2019
+++ src/sys/dev/usb/if_atu.c	Wed Jan 29 06:24:10 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_atu.c,v 1.69 2019/12/27 09:41:51 msaitoh Exp $ */
+/*	$NetBSD: if_atu.c,v 1.70 2020/01/29 06:24:10 thorpej Exp $ */
 /*	$OpenBSD: if_atu.c,v 1.48 2004/12/30 01:53:21 dlg Exp $ */
 /*
  * Copyright (c) 2003, 2004
@@ -48,7 +48,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_atu.c,v 1.69 2019/12/27 09:41:51 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_atu.c,v 1.70 2020/01/29 06:24:10 thorpej Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -1689,12 +1689,12 @@ atu_rxeof(struct usbd_xfer *xfer, void *
 	wh = mtod(m, struct ieee80211_frame_min *);
 	ni = ieee80211_find_rxnode(ic, wh);
 
-	ifp->if_ipackets++;
+	if_statinc(ifp, if_ipackets);
 
 	s = splnet();
 
 	if (atu_newbuf(sc, c, NULL) == ENOBUFS) {
-		ifp->if_ierrors++;
+		if_statinc(ifp, if_ierrors);
 		goto done1; /* XXX if we can't allocate, why restart it? */
 	}
 
@@ -1754,9 +1754,9 @@ atu_txeof(struct usbd_xfer *xfer, void *
 	usbd_get_xfer_status(c->atu_xfer, NULL, NULL, NULL, );
 
 	if (err)
-		ifp->if_oerrors++;
+		if_statinc(ifp, if_oerrors);
 	else
-		ifp->if_opackets++;
+		if_statinc(ifp, if_opackets);
 
 	s = splnet();
 	SLIST_INSERT_HEAD(>atu_cdata.atu_tx_free, c, atu_list);
@@ -1945,7 +1945,7 @@ bad:
 			atu_list);
 			cd->atu_tx_inuse--;
 			splx(s);
-			/* ifp_if_oerrors++; */
+			/* if_statinc(ifp, if_oerrors); */
 			if (ni != NULL)
 ieee80211_free_node(ni);
 			continue;
@@ -2183,7 +2183,7 @@ atu_watchdog(struct ifnet *ifp)
 
 	sc = ifp->if_softc;
 	s = splnet();
-	ifp->if_oerrors++;
+	if_statinc(ifp, if_oerrors);
 	DPRINTF(("%s: watchdog timeout\n", device_xname(sc->atu_dev)));
 
 	/*
Index: src/sys/dev/usb/if_axen.c
diff -u src/sys/dev/usb/if_axen.c:1.69 src/sys/dev/usb/if_axen.c:1.70
--- src/sys/dev/usb/if_axen.c:1.69	Wed 

CVS commit: src/sys/dev/isa

2020-01-28 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Jan 29 06:21:40 UTC 2020

Modified Files:
src/sys/dev/isa: cs89x0isa.c if_eg.c if_el.c if_iy.c

Log Message:
Adopt .


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/dev/isa/cs89x0isa.c
cvs rdiff -u -r1.96 -r1.97 src/sys/dev/isa/if_eg.c
cvs rdiff -u -r1.98 -r1.99 src/sys/dev/isa/if_el.c
cvs rdiff -u -r1.112 -r1.113 src/sys/dev/isa/if_iy.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/isa/cs89x0isa.c
diff -u src/sys/dev/isa/cs89x0isa.c:1.18 src/sys/dev/isa/cs89x0isa.c:1.19
--- src/sys/dev/isa/cs89x0isa.c:1.18	Fri Jun 10 13:27:14 2016
+++ src/sys/dev/isa/cs89x0isa.c	Wed Jan 29 06:21:40 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: cs89x0isa.c,v 1.18 2016/06/10 13:27:14 ozaki-r Exp $ */
+/* $NetBSD: cs89x0isa.c,v 1.19 2020/01/29 06:21:40 thorpej Exp $ */
 
 /*
  * Copyright 1997
@@ -36,7 +36,7 @@
 /* isa DMA routines for cs89x0 */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cs89x0isa.c,v 1.18 2016/06/10 13:27:14 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cs89x0isa.c,v 1.19 2020/01/29 06:21:40 thorpej Exp $");
 
 #include 
 #include 
@@ -226,7 +226,7 @@ void cs_process_rx_dma(struct cs_softc *
 printf("%s: cs_process_rx_dma: "
 "DMA buffer out of sync about to reset\n",
 device_xname(sc->sc_dev));
-ifp->if_ierrors++;
+if_statinc(ifp, if_ierrors);
 
 /* skip the rest of the DMA buffer */
 isa_dmaabort(isc->sc_ic, isc->sc_drq);
@@ -243,7 +243,7 @@ void cs_process_rx_dma(struct cs_softc *
 	printf("%s: cs_process_rx_dma: "
 	"unable to allocate mbuf\n",
 	device_xname(sc->sc_dev));
-	ifp->if_ierrors++;
+	if_statinc(ifp, if_ierrors);
 	/*
 	 * couldn't allocate an mbuf so
 	 * things are not good, may as well
@@ -352,7 +352,7 @@ void cs_process_rx_dma(struct cs_softc *
 			else {
 /* the frame was not received OK */
 /* Increment the input error count */
-ifp->if_ierrors++;
+if_statinc(ifp, if_ierrors);
 
 /*
  * If debugging is enabled then log error

Index: src/sys/dev/isa/if_eg.c
diff -u src/sys/dev/isa/if_eg.c:1.96 src/sys/dev/isa/if_eg.c:1.97
--- src/sys/dev/isa/if_eg.c:1.96	Tue Feb  5 06:17:02 2019
+++ src/sys/dev/isa/if_eg.c	Wed Jan 29 06:21:40 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_eg.c,v 1.96 2019/02/05 06:17:02 msaitoh Exp $	*/
+/*	$NetBSD: if_eg.c,v 1.97 2020/01/29 06:21:40 thorpej Exp $	*/
 
 /*
  * Copyright (c) 1993 Dean Huxley 
@@ -40,7 +40,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_eg.c,v 1.96 2019/02/05 06:17:02 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_eg.c,v 1.97 2020/01/29 06:21:40 thorpej Exp $");
 
 #include "opt_inet.h"
 
@@ -589,7 +589,7 @@ loop:
 	if (egwritePCB(iot, ioh, sc->eg_pcb) != 0) {
 		aprint_error_dev(sc->sc_dev,
 		"can't send Send Packet command\n");
-		ifp->if_oerrors++;
+		if_statinc(ifp, if_oerrors);
 		ifp->if_flags &= ~IFF_OACTIVE;
 		m_freem(m0);
 		goto loop;
@@ -620,6 +620,7 @@ int
 egintr(void *arg)
 {
 	struct eg_softc *sc = arg;
+	struct ifnet *ifp = >sc_ethercom.ec_if;
 	bus_space_tag_t iot = sc->sc_iot;
 	bus_space_handle_t ioh = sc->sc_ioh;
 	int i, len, serviced;
@@ -657,11 +658,12 @@ egintr(void *arg)
 			if (sc->eg_pcb[6] || sc->eg_pcb[7]) {
 DPRINTF(("%s: packet dropped\n",
 device_xname(sc->sc_dev)));
-sc->sc_ethercom.ec_if.if_oerrors++;
+if_statinc(ifp, if_oerrors);
 			} else
-sc->sc_ethercom.ec_if.if_opackets++;
-			sc->sc_ethercom.ec_if.if_collisions +=
-			sc->eg_pcb[8] & 0xf;
+if_statinc(ifp, if_opackets);
+			if (sc->eg_pcb[8] & 0xf)
+if_statadd(ifp, if_collisions,
+sc->eg_pcb[8] & 0xf);
 			sc->sc_ethercom.ec_if.if_flags &= ~IFF_OACTIVE;
 			egstart(>sc_ethercom.ec_if);
 			serviced = 1;
@@ -712,14 +714,14 @@ egread(struct eg_softc *sc, void *buf, i
 	len > ETHER_MAX_LEN) {
 		aprint_error_dev(sc->sc_dev,
 		"invalid packet size %d; dropping\n", len);
-		ifp->if_ierrors++;
+		if_statinc(ifp, if_ierrors);
 		return;
 	}
 
 	/* Pull packet off interface. */
 	m = egget(sc, buf, len);
 	if (m == 0) {
-		ifp->if_ierrors++;
+		if_statinc(ifp, if_ierrors);
 		return;
 	}
 
@@ -861,7 +863,7 @@ egwatchdog(struct ifnet *ifp)
 	struct eg_softc *sc = ifp->if_softc;
 
 	log(LOG_ERR, "%s: device timeout\n", device_xname(sc->sc_dev));
-	sc->sc_ethercom.ec_if.if_oerrors++;
+	if_statinc(ifp, if_oerrors);
 
 	egreset(sc);
 }

Index: src/sys/dev/isa/if_el.c
diff -u src/sys/dev/isa/if_el.c:1.98 src/sys/dev/isa/if_el.c:1.99
--- src/sys/dev/isa/if_el.c:1.98	Tue Feb  5 06:17:02 2019
+++ src/sys/dev/isa/if_el.c	Wed Jan 29 06:21:40 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_el.c,v 1.98 2019/02/05 06:17:02 msaitoh Exp $	*/
+/*	$NetBSD: if_el.c,v 1.99 2020/01/29 06:21:40 thorpej Exp $	*/
 
 /*
  * Copyright (c) 1994, Matthew E. Kimmel.  Permission is hereby granted
@@ -19,7 +19,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: 

CVS commit: src/sys/dev/ieee1394

2020-01-28 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Jan 29 06:19:39 UTC 2020

Modified Files:
src/sys/dev/ieee1394: if_fwip.c

Log Message:
Adopt .


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sys/dev/ieee1394/if_fwip.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/ieee1394/if_fwip.c
diff -u src/sys/dev/ieee1394/if_fwip.c:1.29 src/sys/dev/ieee1394/if_fwip.c:1.30
--- src/sys/dev/ieee1394/if_fwip.c:1.29	Thu Nov 15 10:23:55 2018
+++ src/sys/dev/ieee1394/if_fwip.c	Wed Jan 29 06:19:39 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_fwip.c,v 1.29 2018/11/15 10:23:55 maxv Exp $	*/
+/*	$NetBSD: if_fwip.c,v 1.30 2020/01/29 06:19:39 thorpej Exp $	*/
 /*-
  * Copyright (c) 2004
  *	Doug Rabson
@@ -38,7 +38,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_fwip.c,v 1.29 2018/11/15 10:23:55 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_fwip.c,v 1.30 2020/01/29 06:19:39 thorpej Exp $");
 
 #include 
 #include 
@@ -270,7 +270,7 @@ fwip_start(struct ifnet *ifp)
 			IF_DEQUEUE(>if_snd, m);
 			if (m != NULL)
 m_freem(m);
-			ifp->if_oerrors++;
+			if_statinc(ifp, if_oerrors);
 		} while (m != NULL);
 
 		return;
@@ -511,7 +511,7 @@ fwip_output_callback(struct fw_xfer *xfe
 	/* XXX error check */
 	FWIPDEBUG(ifp, "resp = %d\n", xfer->resp);
 	if (xfer->resp != 0)
-		ifp->if_oerrors++;
+		if_statinc(ifp, if_oerrors);
 
 	m_freem(xfer->mbuf);
 	fw_xfer_unload(xfer);
@@ -625,7 +625,7 @@ fwip_async_output(struct fwip_softc *sc,
 fd = fw_noderesolve_eui64(fc, );
 if (!fd) {
 	/* error */
-	ifp->if_oerrors++;
+	if_statinc(ifp, if_oerrors);
 	/* XXX set error code */
 	fwip_output_callback(xfer);
 	continue;
@@ -668,12 +668,12 @@ fwip_async_output(struct fwip_softc *sc,
 		}
 		if (error) {
 			/* error */
-			ifp->if_oerrors++;
+			if_statinc(ifp, if_oerrors);
 			/* XXX set error code */
 			fwip_output_callback(xfer);
 			continue;
 		} else {
-			ifp->if_opackets++;
+			if_statinc(ifp, if_opackets);
 			i++;
 		}
 	}
@@ -726,7 +726,7 @@ fwip_stream_input(struct fw_xferq *xferq
 		if (sxfer->resp != 0 ||
 		fp->mode.stream.len < 2 * sizeof(uint32_t)) {
 			m_freem(m);
-			ifp->if_ierrors++;
+			if_statinc(ifp, if_ierrors);
 			continue;
 		}
 		m->m_len = m->m_pkthdr.len = fp->mode.stream.len
@@ -753,7 +753,7 @@ fwip_stream_input(struct fw_xferq *xferq
 			FWIPDEBUG(ifp, "Unrecognised GASP header %#08x %#08x\n",
 			ntohl(p[1]), ntohl(p[2]));
 			m_freem(m);
-			ifp->if_ierrors++;
+			if_statinc(ifp, if_ierrors);
 			continue;
 		}
 
@@ -788,7 +788,7 @@ fwip_stream_input(struct fw_xferq *xferq
 		m_adj(m, 3*sizeof(uint32_t));
 		m_set_rcvif(m, ifp);
 		ieee1394_input(ifp, m, src);
-		ifp->if_ipackets++;
+		if_statinc(ifp, if_ipackets);
 	}
 	if (STAILQ_FIRST(>stfree) != NULL)
 		sc->sc_fd.fc->irx_enable(sc->sc_fd.fc, sc->sc_dma_ch);
@@ -857,7 +857,7 @@ fwip_unicast_input(struct fw_xfer *xfer)
 	 */
 	if (rtcode != FWRCODE_COMPLETE) {
 		m_freem(m);
-		ifp->if_ierrors++;
+		if_statinc(ifp, if_ierrors);
 		return;
 	}
 
@@ -893,5 +893,5 @@ fwip_unicast_input(struct fw_xfer *xfer)
 	m->m_len = m->m_pkthdr.len = fp->mode.wreqb.len;
 	m_set_rcvif(m, ifp);
 	ieee1394_input(ifp, m, fp->mode.wreqb.src);
-	ifp->if_ipackets++;
+	if_statinc(ifp, if_ipackets);
 }



CVS commit: src/sys/dev/ofw

2020-01-28 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Jan 29 06:18:17 UTC 2020

Modified Files:
src/sys/dev/ofw: ofnet.c

Log Message:
Adopt .


To generate a diff of this commit:
cvs rdiff -u -r1.62 -r1.63 src/sys/dev/ofw/ofnet.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/ofw/ofnet.c
diff -u src/sys/dev/ofw/ofnet.c:1.62 src/sys/dev/ofw/ofnet.c:1.63
--- src/sys/dev/ofw/ofnet.c:1.62	Tue Feb  5 06:17:02 2019
+++ src/sys/dev/ofw/ofnet.c	Wed Jan 29 06:18:17 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: ofnet.c,v 1.62 2019/02/05 06:17:02 msaitoh Exp $	*/
+/*	$NetBSD: ofnet.c,v 1.63 2020/01/29 06:18:17 thorpej Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ofnet.c,v 1.62 2019/02/05 06:17:02 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ofnet.c,v 1.63 2020/01/29 06:18:17 thorpej Exp $");
 
 #include "ofnet.h"
 #include "opt_inet.h"
@@ -156,7 +156,7 @@ ofnet_read(struct ofnet_softc *of)
 		if (len == -2 || len == 0)
 			break;
 		if (len < sizeof(struct ether_header)) {
-			ifp->if_ierrors++;
+			if_statinc(ifp, if_ierrors);
 			continue;
 		}
 		bufp = buf;
@@ -175,7 +175,7 @@ ofnet_read(struct ofnet_softc *of)
 		/* Allocate a header mbuf */
 		MGETHDR(m, M_DONTWAIT, MT_DATA);
 		if (m == 0) {
-			ifp->if_ierrors++;
+			if_statinc(ifp, if_ierrors);
 			continue;
 		}
 		m_set_rcvif(m, ifp);
@@ -189,7 +189,7 @@ ofnet_read(struct ofnet_softc *of)
 			if (head) {
 MGET(m, M_DONTWAIT, MT_DATA);
 if (m == 0) {
-	ifp->if_ierrors++;
+	if_statinc(ifp, if_ierrors);
 	m_freem(head);
 	head = 0;
 	break;
@@ -199,7 +199,7 @@ ofnet_read(struct ofnet_softc *of)
 			if (len >= MINCLSIZE) {
 MCLGET(m, M_DONTWAIT);
 if ((m->m_flags & M_EXT) == 0) {
-	ifp->if_ierrors++;
+	if_statinc(ifp, if_ierrors);
 	m_free(m);
 	m_freem(head);
 	head = 0;
@@ -297,7 +297,7 @@ ofnet_start(struct ifnet *ifp)
 
 		if (len > ETHERMTU + sizeof(struct ether_header)) {
 			/* packet too large, toss it */
-			ifp->if_oerrors++;
+			if_statinc(ifp, if_oerrors);
 			m_freem(m0);
 			continue;
 		}
@@ -321,9 +321,9 @@ ofnet_start(struct ifnet *ifp)
 			len = bufp - buf;
 
 		if (OF_write(of->sc_ihandle, buf, len) != len)
-			ifp->if_oerrors++;
+			if_statinc(ifp, if_oerrors);
 		else
-			ifp->if_opackets++;
+			if_statinc(ifp, if_opackets);
 	}
 }
 
@@ -381,7 +381,7 @@ ofnet_watchdog(struct ifnet *ifp)
 	struct ofnet_softc *of = ifp->if_softc;
 
 	log(LOG_ERR, "%s: device timeout\n", device_xname(of->sc_dev));
-	ifp->if_oerrors++;
+	if_statinc(ifp, if_oerrors);
 	ofnet_stop(of);
 	ofnet_init(of);
 }



CVS commit: src/sys/dev/ic

2020-01-28 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Jan 29 06:17:07 UTC 2020

Modified Files:
src/sys/dev/ic: am7990.c lance.c

Log Message:
Adopt .


To generate a diff of this commit:
cvs rdiff -u -r1.80 -r1.81 src/sys/dev/ic/am7990.c
cvs rdiff -u -r1.59 -r1.60 src/sys/dev/ic/lance.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/ic/am7990.c
diff -u src/sys/dev/ic/am7990.c:1.80 src/sys/dev/ic/am7990.c:1.81
--- src/sys/dev/ic/am7990.c:1.80	Thu Nov 28 05:07:27 2019
+++ src/sys/dev/ic/am7990.c	Wed Jan 29 06:17:07 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: am7990.c,v 1.80 2019/11/28 05:07:27 isaki Exp $	*/
+/*	$NetBSD: am7990.c,v 1.81 2020/01/29 06:17:07 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@@ -65,7 +65,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: am7990.c,v 1.80 2019/11/28 05:07:27 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: am7990.c,v 1.81 2020/01/29 06:17:07 thorpej Exp $");
 
 #include 
 #include 
@@ -242,12 +242,12 @@ am7990_rint(struct lance_softc *sc)
 			if (rmd.rmd1_bits & LE_R1_BUFF)
 printf("%s: receive buffer error\n",
 device_xname(sc->sc_dev));
-			ifp->if_ierrors++;
+			if_statinc(ifp, if_ierrors);
 		} else if ((rmd.rmd1_bits & (LE_R1_STP | LE_R1_ENP)) !=
 		(LE_R1_STP | LE_R1_ENP)) {
 			printf("%s: dropping chained buffer\n",
 			device_xname(sc->sc_dev));
-			ifp->if_ierrors++;
+			if_statinc(ifp, if_ierrors);
 		} else {
 #ifdef LEDEBUG
 			if (sc->sc_debug > 1)
@@ -328,23 +328,23 @@ am7990_tint(struct lance_softc *sc)
 	device_xname(sc->sc_dev));
 			}
 			if (tmd.tmd3 & LE_T3_LCOL)
-ifp->if_collisions++;
+if_statinc(ifp, if_collisions);
 			if (tmd.tmd3 & LE_T3_RTRY) {
 #ifdef LEDEBUG
 printf("%s: excessive collisions, tdr %d\n",
 device_xname(sc->sc_dev),
 tmd.tmd3 & LE_T3_TDR_MASK);
 #endif
-ifp->if_collisions += 16;
+if_statadd(ifp, if_collisions, 16);
 			}
-			ifp->if_oerrors++;
+			if_statinc(ifp, if_oerrors);
 		} else {
 			if (tmd.tmd1_bits & LE_T1_ONE)
-ifp->if_collisions++;
+if_statinc(ifp, if_collisions);
 			else if (tmd.tmd1_bits & LE_T1_MORE)
 /* Real number is unknown. */
-ifp->if_collisions += 2;
-			ifp->if_opackets++;
+if_statadd(ifp, if_collisions, 2);
+			if_statinc(ifp, if_opackets);
 		}
 
 		if (++bix == sc->sc_ntbuf)
@@ -398,20 +398,20 @@ am7990_intr(void *arg)
 #ifdef LEDEBUG
 			printf("%s: babble\n", device_xname(sc->sc_dev));
 #endif
-			ifp->if_oerrors++;
+			if_statinc(ifp, if_oerrors);
 		}
 #if 0
 		if (isr & LE_C0_CERR) {
 			printf("%s: collision error\n",
 			device_xname(sc->sc_dev));
-			ifp->if_collisions++;
+			if_statinc(ifp, if_collisions);
 		}
 #endif
 		if (isr & LE_C0_MISS) {
 #ifdef LEDEBUG
 			printf("%s: missed packet\n", device_xname(sc->sc_dev));
 #endif
-			ifp->if_ierrors++;
+			if_statinc(ifp, if_ierrors);
 		}
 		if (isr & LE_C0_MERR) {
 			printf("%s: memory error\n", device_xname(sc->sc_dev));
@@ -422,13 +422,13 @@ am7990_intr(void *arg)
 
 	if ((isr & LE_C0_RXON) == 0) {
 		printf("%s: receiver disabled\n", device_xname(sc->sc_dev));
-		ifp->if_ierrors++;
+		if_statinc(ifp, if_ierrors);
 		lance_reset(sc);
 		return (1);
 	}
 	if ((isr & LE_C0_TXON) == 0) {
 		printf("%s: transmitter disabled\n", device_xname(sc->sc_dev));
-		ifp->if_oerrors++;
+		if_statinc(ifp, if_oerrors);
 		lance_reset(sc);
 		return (1);
 	}

Index: src/sys/dev/ic/lance.c
diff -u src/sys/dev/ic/lance.c:1.59 src/sys/dev/ic/lance.c:1.60
--- src/sys/dev/ic/lance.c:1.59	Fri Dec 27 09:32:10 2019
+++ src/sys/dev/ic/lance.c	Wed Jan 29 06:17:07 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: lance.c,v 1.59 2019/12/27 09:32:10 msaitoh Exp $	*/
+/*	$NetBSD: lance.c,v 1.60 2020/01/29 06:17:07 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@@ -65,7 +65,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: lance.c,v 1.59 2019/12/27 09:32:10 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lance.c,v 1.60 2020/01/29 06:17:07 thorpej Exp $");
 
 #include 
 #include 
@@ -430,14 +430,14 @@ lance_read(struct lance_softc *sc, int b
 		printf("%s: invalid packet size %d; dropping\n",
 		device_xname(sc->sc_dev), len);
 #endif
-		ifp->if_ierrors++;
+		if_statinc(ifp, if_ierrors);
 		return;
 	}
 
 	/* Pull packet off interface. */
 	m = lance_get(sc, boff, len);
 	if (m == 0) {
-		ifp->if_ierrors++;
+		if_statinc(ifp, if_ierrors);
 		return;
 	}
 
@@ -479,7 +479,7 @@ lance_watchdog(struct ifnet *ifp)
 	struct lance_softc *sc = ifp->if_softc;
 
 	log(LOG_ERR, "%s: device timeout\n", device_xname(sc->sc_dev));
-	++ifp->if_oerrors;
+	if_statinc(ifp, if_oerrors);
 
 	lance_reset(sc);
 }



CVS commit: src/sys/rump/net/lib/libnet

2020-01-28 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Jan 29 06:13:02 UTC 2020

Modified Files:
src/sys/rump/net/lib/libnet: Makefile

Log Message:
Add if_stats.c to rumpnet.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/sys/rump/net/lib/libnet/Makefile

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

Modified files:

Index: src/sys/rump/net/lib/libnet/Makefile
diff -u src/sys/rump/net/lib/libnet/Makefile:1.32 src/sys/rump/net/lib/libnet/Makefile:1.33
--- src/sys/rump/net/lib/libnet/Makefile:1.32	Sun Oct 13 07:28:14 2019
+++ src/sys/rump/net/lib/libnet/Makefile	Wed Jan 29 06:13:02 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.32 2019/10/13 07:28:14 mrg Exp $
+#	$NetBSD: Makefile,v 1.33 2020/01/29 06:13:02 thorpej Exp $
 #
 
 
@@ -9,7 +9,7 @@ COMMENT=Network interface and routing su
 
 IOCONF=	NET.ioconf
 # iffy stuff
-SRCS=	if.c if_loop.c route.c rtsock.c raw_usrreq.c			\
+SRCS=	if.c if_loop.c if_stats.c route.c rtsock.c raw_usrreq.c		\
 	raw_cb.c if_media.c link_proto.c net_stats.c if_ethersubr.c	\
 	if_spppsubr.c
 SRCS+=	if_43.c



CVS commit: src/sys/arch/arm

2020-01-28 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Jan 29 06:05:31 UTC 2020

Modified Files:
src/sys/arch/arm/imx: if_enet.c
src/sys/arch/arm/sunxi: sun4i_emac.c sunxi_can.c sunxi_emac.c
src/sys/arch/arm/ti: if_cpsw.c
src/sys/arch/arm/xscale: ixp425_if_npe.c

Log Message:
Adopt .


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/arch/arm/imx/if_enet.c
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/arm/sunxi/sun4i_emac.c
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/sunxi/sunxi_can.c
cvs rdiff -u -r1.28 -r1.29 src/sys/arch/arm/sunxi/sunxi_emac.c
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/arm/ti/if_cpsw.c
cvs rdiff -u -r1.44 -r1.45 src/sys/arch/arm/xscale/ixp425_if_npe.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/arch/arm/imx/if_enet.c
diff -u src/sys/arch/arm/imx/if_enet.c:1.30 src/sys/arch/arm/imx/if_enet.c:1.31
--- src/sys/arch/arm/imx/if_enet.c:1.30	Wed Jan 15 01:09:56 2020
+++ src/sys/arch/arm/imx/if_enet.c	Wed Jan 29 06:05:31 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_enet.c,v 1.30 2020/01/15 01:09:56 jmcneill Exp $	*/
+/*	$NetBSD: if_enet.c,v 1.31 2020/01/29 06:05:31 thorpej Exp $	*/
 
 /*
  * Copyright (c) 2014 Ryo Shimizu 
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_enet.c,v 1.30 2020/01/15 01:09:56 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_enet.c,v 1.31 2020/01/29 06:05:31 thorpej Exp $");
 
 #include "vlan.h"
 
@@ -381,9 +381,10 @@ enet_tick(void *arg)
 #endif
 
 	/* update counters */
-	ifp->if_ierrors += ENET_REG_READ(sc, ENET_RMON_R_UNDERSIZE);
-	ifp->if_ierrors += ENET_REG_READ(sc, ENET_RMON_R_FRAG);
-	ifp->if_ierrors += ENET_REG_READ(sc, ENET_RMON_R_JAB);
+	if_statadd(ifp, if_ierrors,
+	(uint64_t)ENET_REG_READ(sc, ENET_RMON_R_UNDERSIZE) +
+	(uint64_t)ENET_REG_READ(sc, ENET_RMON_R_FRAG) +
+	(uint64_t)ENET_REG_READ(sc, ENET_RMON_R_JAB));
 
 	/* clear counters */
 	ENET_REG_WRITE(sc, ENET_MIBC, ENET_MIBC_MIB_CLEAR);
@@ -461,7 +462,7 @@ enet_tx_intr(void *arg)
 			bus_dmamap_unload(sc->sc_dmat,
 			txs->txs_dmamap);
 			m_freem(txs->txs_mbuf);
-			ifp->if_opackets++;
+			if_statinc(ifp, if_opackets);
 		}
 
 		/* checking error */
@@ -488,7 +489,7 @@ enet_tx_intr(void *arg)
 	"flags2=%s\n", idx, flagsbuf);
 }
 #endif /* DEBUG_ENET */
-ifp->if_oerrors++;
+if_statinc(ifp, if_oerrors);
 			}
 		}
 
@@ -589,7 +590,7 @@ enet_rx_intr(void *arg)
 	idx, flags1buf, flags2buf, amount);
 }
 #endif /* DEBUG_ENET */
-ifp->if_ierrors++;
+if_statinc(ifp, if_ierrors);
 m_freem(m0);
 
 			} else {
@@ -873,7 +874,7 @@ enet_start(struct ifnet *ifp)
 			DEVICE_DPRINTF(
 			"TX descriptor is full. dropping packet\n");
 			m_freem(m);
-			ifp->if_oerrors++;
+			if_statinc(ifp, if_oerrors);
 			break;
 		}
 
@@ -929,7 +930,7 @@ enet_watchdog(struct ifnet *ifp)
 	s = splnet();
 
 	device_printf(sc->sc_dev, "watchdog timeout\n");
-	ifp->if_oerrors++;
+	if_statinc(ifp, if_oerrors);
 
 	/* salvage packets left in descriptors */
 	enet_tx_intr(sc);
@@ -1322,7 +1323,7 @@ enet_drain_txbuf(struct enet_softc *sc)
 			txs->txs_dmamap);
 			m_freem(txs->txs_mbuf);
 
-			ifp->if_oerrors++;
+			if_statinc(ifp, if_oerrors);
 		}
 		sc->sc_tx_free++;
 	}

Index: src/sys/arch/arm/sunxi/sun4i_emac.c
diff -u src/sys/arch/arm/sunxi/sun4i_emac.c:1.11 src/sys/arch/arm/sunxi/sun4i_emac.c:1.12
--- src/sys/arch/arm/sunxi/sun4i_emac.c:1.11	Tue May 28 07:41:46 2019
+++ src/sys/arch/arm/sunxi/sun4i_emac.c	Wed Jan 29 06:05:31 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: sun4i_emac.c,v 1.11 2019/05/28 07:41:46 msaitoh Exp $ */
+/* $NetBSD: sun4i_emac.c,v 1.12 2020/01/29 06:05:31 thorpej Exp $ */
 
 /*-
  * Copyright (c) 2013-2017 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 
 
-__KERNEL_RCSID(1, "$NetBSD: sun4i_emac.c,v 1.11 2019/05/28 07:41:46 msaitoh Exp $");
+__KERNEL_RCSID(1, "$NetBSD: sun4i_emac.c,v 1.12 2020/01/29 06:05:31 thorpej Exp $");
 
 #include 
 #include 
@@ -569,13 +569,13 @@ sun4i_emac_rx_intr(struct sun4i_emac_sof
 		uint32_t rxsts = __SHIFTOUT(rxhdr, EMAC_RXHDR_STS);
 
 		if (rxlen < ETHER_MIN_LEN || (rxsts & EMAC_RX_STA_PKTOK) == 0) {
-			sc->sc_ec.ec_if.if_ierrors++;
+			if_statinc(>sc_ec.ec_if, if_ierrors);
 			continue;
 		}
 
 		m = sun4i_emac_mgethdr(sc, rxlen);
 		if (m == NULL) {
-			sc->sc_ec.ec_if.if_ierrors++;
+			if_statinc(>sc_ec.ec_if, if_ierrors);
 			sun4i_emac_rxfifo_consume(sc, rxlen);
 			return;
 		}
@@ -831,7 +831,7 @@ sun4i_emac_ifwatchdog(struct ifnet *ifp)
 
 	device_printf(sc->sc_dev, "device timeout\n");
 
-	ifp->if_oerrors++;
+	if_statinc(ifp, if_oerrors);
 	sun4i_emac_ifinit(ifp);
 	sun4i_emac_ifstart(ifp);
 }

Index: src/sys/arch/arm/sunxi/sunxi_can.c
diff -u src/sys/arch/arm/sunxi/sunxi_can.c:1.2 src/sys/arch/arm/sunxi/sunxi_can.c:1.3
--- src/sys/arch/arm/sunxi/sunxi_can.c:1.2	Mon Oct 21 08:00:58 2019
+++ src/sys/arch/arm/sunxi/sunxi_can.c	Wed Jan 29 

CVS commit: src/sys/dev/sdmmc

2020-01-28 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Jan 29 06:00:27 UTC 2020

Modified Files:
src/sys/dev/sdmmc: if_bwfm_sdio.c

Log Message:
Adopt .


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/dev/sdmmc/if_bwfm_sdio.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/sdmmc/if_bwfm_sdio.c
diff -u src/sys/dev/sdmmc/if_bwfm_sdio.c:1.12 src/sys/dev/sdmmc/if_bwfm_sdio.c:1.13
--- src/sys/dev/sdmmc/if_bwfm_sdio.c:1.12	Sat Jan  4 14:52:52 2020
+++ src/sys/dev/sdmmc/if_bwfm_sdio.c	Wed Jan 29 06:00:27 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: if_bwfm_sdio.c,v 1.12 2020/01/04 14:52:52 mlelstv Exp $ */
+/* $NetBSD: if_bwfm_sdio.c,v 1.13 2020/01/29 06:00:27 thorpej Exp $ */
 /* $OpenBSD: if_bwfm_sdio.c,v 1.1 2017/10/11 17:19:50 patrick Exp $ */
 /*
  * Copyright (c) 2010-2016 Broadcom Corporation
@@ -1610,7 +1610,7 @@ bwfm_sdio_tx_frames(struct bwfm_sdio_sof
 			bwfm_sdio_tx_ctrlframe(sc, m);
 		else {
 			bwfm_sdio_tx_dataframe(sc, m);  
-			ifp->if_opackets++;
+			if_statinc(ifp, if_opackets);
 			ifstart = true;
 		}
 



CVS commit: src/sys/dev/scsipi

2020-01-28 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Jan 29 05:59:50 UTC 2020

Modified Files:
src/sys/dev/scsipi: if_se.c

Log Message:
Adopt .


To generate a diff of this commit:
cvs rdiff -u -r1.103 -r1.104 src/sys/dev/scsipi/if_se.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/scsipi/if_se.c
diff -u src/sys/dev/scsipi/if_se.c:1.103 src/sys/dev/scsipi/if_se.c:1.104
--- src/sys/dev/scsipi/if_se.c:1.103	Sun Nov 10 21:16:37 2019
+++ src/sys/dev/scsipi/if_se.c	Wed Jan 29 05:59:50 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_se.c,v 1.103 2019/11/10 21:16:37 chs Exp $	*/
+/*	$NetBSD: if_se.c,v 1.104 2020/01/29 05:59:50 thorpej Exp $	*/
 
 /*
  * Copyright (c) 1997 Ian W. Dall 
@@ -59,7 +59,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_se.c,v 1.103 2019/11/10 21:16:37 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_se.c,v 1.104 2020/01/29 05:59:50 thorpej Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -467,10 +467,10 @@ se_ifstart(struct ifnet *ifp)
 	SETIMEOUT, NULL, XS_CTL_NOSLEEP | XS_CTL_ASYNC | XS_CTL_DATA_OUT);
 	if (error) {
 		aprint_error_dev(sc->sc_dev, "not queued, error %d\n", error);
-		ifp->if_oerrors++;
+		if_statinc(ifp, if_oerrors);
 		ifp->if_flags &= ~IFF_OACTIVE;
 	} else
-		ifp->if_opackets++;
+		if_statinc(ifp, if_opackets);
 	if (sc->sc_flags & SE_NEED_RECV) {
 		sc->sc_flags &= ~SE_NEED_RECV;
 		se_recv((void *) sc);
@@ -648,7 +648,7 @@ se_read(struct se_softc *sc, char *data,
 			printf("%s: invalid packet size %d; dropping\n",
 			   device_xname(sc->sc_dev), len);
 #endif
-			ifp->if_ierrors++;
+			if_statinc(ifp, if_ierrors);
 			goto next_packet;
 		}
 
@@ -659,7 +659,7 @@ se_read(struct se_softc *sc, char *data,
 			if (sc->sc_debug)
 printf("se_read: se_get returned null\n");
 #endif
-			ifp->if_ierrors++;
+			if_statinc(ifp, if_ierrors);
 			goto next_packet;
 		}
 		if ((ifp->if_flags & IFF_PROMISC) != 0) {
@@ -684,7 +684,7 @@ sewatchdog(struct ifnet *ifp)
 	struct se_softc *sc = ifp->if_softc;
 
 	log(LOG_ERR, "%s: device timeout\n", device_xname(sc->sc_dev));
-	++ifp->if_oerrors;
+	if_statinc(ifp, if_oerrors);
 
 	se_reset(sc);
 }



CVS commit: src/sys/dev/sbus

2020-01-28 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Jan 29 05:59:06 UTC 2020

Modified Files:
src/sys/dev/sbus: be.c qe.c

Log Message:
Adopt .


To generate a diff of this commit:
cvs rdiff -u -r1.94 -r1.95 src/sys/dev/sbus/be.c
cvs rdiff -u -r1.75 -r1.76 src/sys/dev/sbus/qe.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/sbus/be.c
diff -u src/sys/dev/sbus/be.c:1.94 src/sys/dev/sbus/be.c:1.95
--- src/sys/dev/sbus/be.c:1.94	Wed May 29 10:07:30 2019
+++ src/sys/dev/sbus/be.c	Wed Jan 29 05:59:06 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: be.c,v 1.94 2019/05/29 10:07:30 msaitoh Exp $	*/
+/*	$NetBSD: be.c,v 1.95 2020/01/29 05:59:06 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -57,7 +57,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: be.c,v 1.94 2019/05/29 10:07:30 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: be.c,v 1.95 2020/01/29 05:59:06 thorpej Exp $");
 
 #include "opt_ddb.h"
 #include "opt_inet.h"
@@ -550,7 +550,7 @@ be_read(struct be_softc *sc, int idx, in
 			printf("%s: invalid packet size %d; dropping\n",
 			ifp->if_xname, len);
 #endif
-		ifp->if_ierrors++;
+		if_statinc(ifp, if_ierrors);
 		return;
 	}
 
@@ -559,7 +559,7 @@ be_read(struct be_softc *sc, int idx, in
 	 */
 	m = be_get(sc, idx, len);
 	if (m == NULL) {
-		ifp->if_ierrors++;
+		if_statinc(ifp, if_ierrors);
 		return;
 	}
 
@@ -686,7 +686,7 @@ bewatchdog(struct ifnet *ifp)
 	struct be_softc *sc = ifp->if_softc;
 
 	log(LOG_ERR, "%s: device timeout\n", device_xname(sc->sc_dev));
-	++sc->sc_ethercom.ec_if.if_oerrors;
+	if_statinc(ifp, if_oerrors);
 
 	bereset(sc);
 }
@@ -850,11 +850,11 @@ betint(struct be_softc *sc)
 	/*
 	 * Unload collision counters
 	 */
-	ifp->if_collisions +=
+	if_statadd(ifp, if_collisions, 
 	bus_space_read_4(t, br, BE_BRI_NCCNT) +
 	bus_space_read_4(t, br, BE_BRI_FCCNT) +
 	bus_space_read_4(t, br, BE_BRI_EXCNT) +
-	bus_space_read_4(t, br, BE_BRI_LTCNT);
+	bus_space_read_4(t, br, BE_BRI_LTCNT));
 
 	/*
 	 * the clear the hardware counters
@@ -876,7 +876,7 @@ betint(struct be_softc *sc)
 			break;
 
 		ifp->if_flags &= ~IFF_OACTIVE;
-		ifp->if_opackets++;
+		if_statinc(ifp, if_opackets);
 
 		if (++bix == QEC_XD_RING_MAXSIZE)
 			bix = 0;

Index: src/sys/dev/sbus/qe.c
diff -u src/sys/dev/sbus/qe.c:1.75 src/sys/dev/sbus/qe.c:1.76
--- src/sys/dev/sbus/qe.c:1.75	Wed May 29 10:07:30 2019
+++ src/sys/dev/sbus/qe.c	Wed Jan 29 05:59:06 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: qe.c,v 1.75 2019/05/29 10:07:30 msaitoh Exp $	*/
+/*	$NetBSD: qe.c,v 1.76 2020/01/29 05:59:06 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -66,7 +66,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: qe.c,v 1.75 2019/05/29 10:07:30 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: qe.c,v 1.76 2020/01/29 05:59:06 thorpej Exp $");
 
 #define QEDEBUG
 
@@ -406,7 +406,7 @@ qe_read(struct qe_softc *sc, int idx, in
 		printf("%s: invalid packet size %d; dropping\n",
 			ifp->if_xname, len);
 
-		ifp->if_ierrors++;
+		if_statinc(ifp, if_ierrors);
 		return;
 	}
 
@@ -415,7 +415,7 @@ qe_read(struct qe_softc *sc, int idx, in
 	 */
 	m = qe_get(sc, idx, len);
 	if (m == NULL) {
-		ifp->if_ierrors++;
+		if_statinc(ifp, if_ierrors);
 		return;
 	}
 
@@ -532,7 +532,7 @@ qewatchdog(struct ifnet *ifp)
 	struct qe_softc *sc = ifp->if_softc;
 
 	log(LOG_ERR, "%s: device timeout\n", device_xname(sc->sc_dev));
-	ifp->if_oerrors++;
+	if_statinc(ifp, if_oerrors);
 
 	qereset(sc);
 }
@@ -627,7 +627,7 @@ qe_tint(struct qe_softc *sc)
 			break;
 
 		ifp->if_flags &= ~IFF_OACTIVE;
-		ifp->if_opackets++;
+		if_statinc(ifp, if_opackets);
 
 		if (++bix == QEC_XD_RING_MAXSIZE)
 			bix = 0;
@@ -705,21 +705,23 @@ qe_eint(struct qe_softc *sc, uint32_t wh
 	const char *xname = device_xname(self);
 	int r = 0, rst = 0;
 
+	net_stat_ref_t nsr = IF_STAT_GETREF(ifp);
+
 	if (why & QE_CR_STAT_EDEFER) {
 		printf("%s: excessive tx defers.\n", xname);
 		r |= 1;
-		ifp->if_oerrors++;
+		if_statinc_ref(nsr, if_oerrors);
 	}
 
 	if (why & QE_CR_STAT_CLOSS) {
 		printf("%s: no carrier, link down?\n", xname);
-		ifp->if_oerrors++;
+		if_statinc_ref(nsr, if_oerrors);
 		r |= 1;
 	}
 
 	if (why & QE_CR_STAT_ERETRIES) {
 		printf("%s: excessive tx retries\n", xname);
-		ifp->if_oerrors++;
+		if_statinc_ref(nsr, if_oerrors);
 		r |= 1;
 		rst = 1;
 	}
@@ -727,14 +729,14 @@ qe_eint(struct qe_softc *sc, uint32_t wh
 
 	if (why & QE_CR_STAT_LCOLL) {
 		printf("%s: late tx transmission\n", xname);
-		ifp->if_oerrors++;
+		if_statinc_ref(nsr, if_oerrors);
 		r |= 1;
 		rst = 1;
 	}
 
 	if (why & QE_CR_STAT_FUFLOW) {
 		printf("%s: tx fifo underflow\n", xname);
-		ifp->if_oerrors++;
+		if_statinc_ref(nsr, if_oerrors);
 		r |= 1;
 		rst = 1;
 	}
@@ -750,8 +752,8 @@ qe_eint(struct qe_softc *sc, uint32_t wh
 	}
 
 	if (why & QE_CR_STAT_TCCOFLOW) {
-		ifp->if_collisions += 256;
-		ifp->if_oerrors += 256;
+		

CVS commit: src/sys/dev/qbus

2020-01-28 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Jan 29 05:57:21 UTC 2020

Modified Files:
src/sys/dev/qbus: if_de.c if_qt.c

Log Message:
Adopt .


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/dev/qbus/if_de.c
cvs rdiff -u -r1.24 -r1.25 src/sys/dev/qbus/if_qt.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/qbus/if_de.c
diff -u src/sys/dev/qbus/if_de.c:1.34 src/sys/dev/qbus/if_de.c:1.35
--- src/sys/dev/qbus/if_de.c:1.34	Tue Jun 26 06:48:02 2018
+++ src/sys/dev/qbus/if_de.c	Wed Jan 29 05:57:21 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_de.c,v 1.34 2018/06/26 06:48:02 msaitoh Exp $	*/
+/*	$NetBSD: if_de.c,v 1.35 2020/01/29 05:57:21 thorpej Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1989 Regents of the University of California.
@@ -72,7 +72,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_de.c,v 1.34 2018/06/26 06:48:02 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_de.c,v 1.35 2020/01/29 05:57:21 thorpej Exp $");
 
 #include "opt_inet.h"
 
@@ -480,19 +480,19 @@ deintr(void *arg)
 		if (rp->r_flags & XFLG_OWN)
 			break;
 
-		sc->sc_if.if_opackets++;
+		if_statinc(>sc_if, if_opackets);
 		ifxp = >sc_ifw[sc->sc_xindex];
 		/* check for unusual conditions */
 		if (rp->r_flags & (XFLG_ERRS|XFLG_MTCH|XFLG_ONE|XFLG_MORE)) {
 			if (rp->r_flags & XFLG_ERRS) {
 /* output error */
-sc->sc_if.if_oerrors++;
+if_statinc(>sc_if, if_oerrors);
 			} else if (rp->r_flags & XFLG_ONE) {
 /* one collision */
-sc->sc_if.if_collisions++;
+if_statinc(>sc_if, if_collisions);
 			} else if (rp->r_flags & XFLG_MORE) {
-/* more than one collision */
-sc->sc_if.if_collisions += 2;	/* guess */
+/* more than one collision (guess...) */
+if_statadd(>sc_if, if_collisions, 2);
 			}
 		}
 		if_ubaend(>sc_ifuba, ifxp);
@@ -534,13 +534,13 @@ derecv(struct de_softc *sc)
 		/* check for errors */
 		if ((rp->r_flags & (RFLG_ERRS|RFLG_FRAM|RFLG_OFLO|RFLG_CRC)) ||
 		(rp->r_lenerr & (RERR_BUFL|RERR_UBTO))) {
-			sc->sc_if.if_ierrors++;
+			if_statinc(>sc_if, if_ierrors);
 			goto next;
 		}
 		m = if_ubaget(>sc_ifuba, >sc_ifr[sc->sc_rindex],
 		ifp, len);
 		if (m == 0) {
-			sc->sc_if.if_ierrors++;
+			if_statinc(>sc_if, if_ierrors);
 			goto next;
 		}
 

Index: src/sys/dev/qbus/if_qt.c
diff -u src/sys/dev/qbus/if_qt.c:1.24 src/sys/dev/qbus/if_qt.c:1.25
--- src/sys/dev/qbus/if_qt.c:1.24	Mon Oct 21 08:22:06 2019
+++ src/sys/dev/qbus/if_qt.c	Wed Jan 29 05:57:21 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_qt.c,v 1.24 2019/10/21 08:22:06 msaitoh Exp $	*/
+/*	$NetBSD: if_qt.c,v 1.25 2020/01/29 05:57:21 thorpej Exp $	*/
 /*
  * Copyright (c) 1992 Steven M. Schultz
  * All rights reserved.
@@ -80,7 +80,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_qt.c,v 1.24 2019/10/21 08:22:06 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_qt.c,v 1.25 2020/01/29 05:57:21 thorpej Exp $");
 
 #include "opt_inet.h"
 
@@ -507,37 +507,35 @@ qtintr(void *arg)
 
 void
 qttint(struct qt_softc *sc)
-	{
+{
 	struct qt_tring *rp;
 
-	while (sc->nxmit > 0)
-		{
+	while (sc->nxmit > 0) {
 		rp = >sc_ib->qc_t[sc->xlast];
 		if ((rp->tmd3 & TMD3_OWN) == 0)
 			break;
-		sc->is_if.if_opackets++;
+		if_statinc(>is_if, if_opackets);
 /*
  * Collisions don't count as output errors, but babbling and missing packets
  * do count as output errors.
 */
-		if	(rp->tmd2 & TMD2_CER)
-			sc->is_if.if_collisions++;
-		if	((rp->tmd0 & TMD0_ERR1) ||
-			 ((rp->tmd2 & TMD2_ERR2) && (rp->tmd2 & BBLMIS)))
-			{
+		if (rp->tmd2 & TMD2_CER)
+			if_statinc(>is_if, if_collisions);
+		if ((rp->tmd0 & TMD0_ERR1) ||
+		((rp->tmd2 & TMD2_ERR2) && (rp->tmd2 & BBLMIS))) {
 #ifdef QTDEBUG
 			char buf[100];
 			snprintb(buf, sizeof(buf), TMD2_BITS, rp->tmd2);
 			printf("%s: tmd2 %s\n", device_xname(sc->sc_dev), buf);
 #endif
-			sc->is_if.if_oerrors++;
-			}
+			if_statinc(>is_if, if_oerrors);
+		}
 		if_ubaend(>sc_ifuba, >sc_ifw[sc->xlast]);
-		if	(++sc->xlast >= NXMT)
+		if (++sc->xlast >= NXMT)
 			sc->xlast = 0;
 		sc->nxmit--;
-		}
 	}
+}
 
 /*
  * Receive interrupt service.  Pull packet off the interface and put into
@@ -555,16 +553,14 @@ qtrint(struct qt_softc *sc)
 	while	(sc->sc_ib->qc_r[(int)sc->rindex].rmd3 & RMD3_OWN)
 		{
 		rp = >sc_ib->qc_r[(int)sc->rindex];
-		if ((rp->rmd0 & (RMD0_STP|RMD0_ENP)) != (RMD0_STP|RMD0_ENP))
-			{
+		if ((rp->rmd0 & (RMD0_STP|RMD0_ENP)) != (RMD0_STP|RMD0_ENP)) {
 			printf("%s: chained packet\n", device_xname(sc->sc_dev));
-			sc->is_if.if_ierrors++;
+			if_statinc(>is_if, if_ierrors);
 			goto rnext;
-			}
+		}
 		len = (rp->rmd1 & RMD1_MCNT) - 4;	/* -4 for CRC */
 
-		if	((rp->rmd0 & RMD0_ERR3) || (rp->rmd2 & RMD2_ERR4))
-			{
+		if ((rp->rmd0 & RMD0_ERR3) || (rp->rmd2 & RMD2_ERR4)) {
 #ifdef QTDEBUG
 			char buf[100];
 			snprintb(buf, sizeof(buf), RMD0_BITS, rp->rmd0);
@@ -572,13 +568,13 @@ qtrint(struct qt_softc *sc)
 			snprintb(buf, 

CVS commit: src/sys/dev/hyperv

2020-01-28 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Jan 29 05:55:16 UTC 2020

Modified Files:
src/sys/dev/hyperv: if_hvn.c

Log Message:
Adopt .


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/dev/hyperv/if_hvn.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/hyperv/if_hvn.c
diff -u src/sys/dev/hyperv/if_hvn.c:1.15 src/sys/dev/hyperv/if_hvn.c:1.16
--- src/sys/dev/hyperv/if_hvn.c:1.15	Fri Dec 27 05:59:53 2019
+++ src/sys/dev/hyperv/if_hvn.c	Wed Jan 29 05:55:16 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_hvn.c,v 1.15 2019/12/27 05:59:53 nonaka Exp $	*/
+/*	$NetBSD: if_hvn.c,v 1.16 2020/01/29 05:55:16 thorpej Exp $	*/
 /*	$OpenBSD: if_hvn.c,v 1.39 2018/03/11 14:31:34 mikeb Exp $	*/
 
 /*-
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_hvn.c,v 1.15 2019/12/27 05:59:53 nonaka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_hvn.c,v 1.16 2020/01/29 05:55:16 thorpej Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -498,7 +498,7 @@ hvn_start(struct ifnet *ifp)
 
 		if (hvn_encap(sc, m, )) {
 			/* the chain is too large */
-			ifp->if_oerrors++;
+			if_statinc(ifp, if_oerrors);
 			m_freem(m);
 			continue;
 		}
@@ -507,7 +507,7 @@ hvn_start(struct ifnet *ifp)
 
 		if (hvn_rndis_output(sc, txd)) {
 			hvn_decap(sc, txd);
-			ifp->if_oerrors++;
+			if_statinc(ifp, if_oerrors);
 			m_freem(m);
 			continue;
 		}
@@ -678,7 +678,7 @@ hvn_txeof(struct hvn_softc *sc, uint64_t
 	BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE);
 	bus_dmamap_unload(sc->sc_dmat, txd->txd_dmap);
 	m_freem(m);
-	ifp->if_opackets++;
+	if_statinc(ifp, if_opackets);
 
 	txd->txd_ready = 1;
 
@@ -1560,7 +1560,7 @@ hvn_rxeof(struct hvn_softc *sc, uint8_t 
 
 	if ((m = hvn_devget(sc, buf + RNDIS_HEADER_OFFSET + pkt->rm_dataoffset,
 	pkt->rm_datalen)) == NULL) {
-		ifp->if_ierrors++;
+		if_statinc(ifp, if_ierrors);
 		return;
 	}
 



CVS commit: src/sys/dev/cadence

2020-01-28 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Jan 29 05:54:29 UTC 2020

Modified Files:
src/sys/dev/cadence: if_cemac.c

Log Message:
Adopt .


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/dev/cadence/if_cemac.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/cadence/if_cemac.c
diff -u src/sys/dev/cadence/if_cemac.c:1.21 src/sys/dev/cadence/if_cemac.c:1.22
--- src/sys/dev/cadence/if_cemac.c:1.21	Tue May 28 07:41:48 2019
+++ src/sys/dev/cadence/if_cemac.c	Wed Jan 29 05:54:29 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_cemac.c,v 1.21 2019/05/28 07:41:48 msaitoh Exp $	*/
+/*	$NetBSD: if_cemac.c,v 1.22 2020/01/29 05:54:29 thorpej Exp $	*/
 
 /*
  * Copyright (c) 2015  Genetec Corporation.  All rights reserved.
@@ -40,7 +40,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_cemac.c,v 1.21 2019/05/28 07:41:48 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_cemac.c,v 1.22 2020/01/29 05:54:29 thorpej Exp $");
 
 #include 
 #include 
@@ -296,20 +296,21 @@ cemac_intr(void *arg)
 #endif
 	DPRINTFN(2, ("%s: isr=0x%08X rsr=0x%08X imr=0x%08X\n", __FUNCTION__, isr, rsr, imr));
 
+	net_stat_ref_t nsr = IF_STAT_GETREF(ifp);
 	if (isr & ETH_ISR_RBNA) {		// out of receive buffers
 		CEMAC_WRITE(ETH_RSR, ETH_RSR_BNA);	// clear interrupt
 		ctl = CEMAC_READ(ETH_CTL);		// get current control register value
 		CEMAC_WRITE(ETH_CTL, ctl & ~ETH_CTL_RE);	// disable receiver
 		CEMAC_WRITE(ETH_RSR, ETH_RSR_BNA);	// clear BNA bit
 		CEMAC_WRITE(ETH_CTL, ctl |  ETH_CTL_RE);	// re-enable receiver
-		ifp->if_ierrors++;
-		ifp->if_ipackets++;
+		if_statinc_ref(nsr, if_ierrors);
+		if_statinc_ref(nsr, if_ipackets);
 		DPRINTFN(1,("%s: out of receive buffers\n", __FUNCTION__));
 	}
 	if (isr & ETH_ISR_ROVR) {
 		CEMAC_WRITE(ETH_RSR, ETH_RSR_OVR);	// clear interrupt
-		ifp->if_ierrors++;
-		ifp->if_ipackets++;
+		if_statinc_ref(nsr, if_ierrors);
+		if_statinc_ref(nsr, if_ipackets);
 		DPRINTFN(1,("%s: receive overrun\n", __FUNCTION__));
 	}
 
@@ -373,12 +374,14 @@ cemac_intr(void *arg)
  */
 if (m != NULL)
 	m_freem(m);
-ifp->if_ierrors++;
+if_statinc_ref(nsr, if_ierrors);
 			}
 			sc->rxqi++;
 		}
 	}
 
+	IF_STAT_PUTREF(ifp);
+
 	if (cemac_gctx(sc) > 0)
 		if_schedule_deferred_start(ifp);
 #if 0 // reloop
@@ -719,9 +722,11 @@ cemac_tick(void *arg)
 	int s;
 
 	if (ISSET(sc->cemac_flags, CEMAC_FLAG_GEM))
-		ifp->if_collisions += CEMAC_READ(GEM_SCOL) + CEMAC_READ(GEM_MCOL);
+		if_statadd(ifp, if_collisions,
+		CEMAC_READ(GEM_SCOL) + CEMAC_READ(GEM_MCOL));
 	else
-		ifp->if_collisions += CEMAC_READ(ETH_SCOL) + CEMAC_READ(ETH_MCOL);
+		if_statadd(ifp, if_collisions,
+		CEMAC_READ(ETH_SCOL) + CEMAC_READ(ETH_MCOL));
 
 	/* These misses are ok, they will happen if the RAM/CPU can't keep up */
 	if (!ISSET(sc->cemac_flags, CEMAC_FLAG_GEM)) {



CVS commit: src/sys/dist/pf/net

2020-01-28 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Jan 29 05:52:27 UTC 2020

Modified Files:
src/sys/dist/pf/net: if_pflog.c if_pfsync.c

Log Message:
Adopt .


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/dist/pf/net/if_pflog.c
cvs rdiff -u -r1.19 -r1.20 src/sys/dist/pf/net/if_pfsync.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/dist/pf/net/if_pflog.c
diff -u src/sys/dist/pf/net/if_pflog.c:1.21 src/sys/dist/pf/net/if_pflog.c:1.22
--- src/sys/dist/pf/net/if_pflog.c:1.21	Tue Jun 26 06:48:02 2018
+++ src/sys/dist/pf/net/if_pflog.c	Wed Jan 29 05:52:27 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_pflog.c,v 1.21 2018/06/26 06:48:02 msaitoh Exp $	*/
+/*	$NetBSD: if_pflog.c,v 1.22 2020/01/29 05:52:27 thorpej Exp $	*/
 /*	$OpenBSD: if_pflog.c,v 1.24 2007/05/26 17:13:30 jason Exp $	*/
 
 /*
@@ -36,7 +36,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_pflog.c,v 1.21 2018/06/26 06:48:02 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_pflog.c,v 1.22 2020/01/29 05:52:27 thorpej Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -294,8 +294,12 @@ pflog_packet(struct pfi_kif *kif, struct
 	}
 #endif /* INET */
 
+#ifdef __NetBSD__
+	if_statadd2(ifn, if_opackets, 1, if_obytes, m->m_pkthdr.len);
+#else
 	ifn->if_opackets++;
 	ifn->if_obytes += m->m_pkthdr.len;
+#endif /* __NetBSD__ */
 
 #ifdef __NetBSD__
 	bpf_mtap2(ifn->if_bpf, , PFLOG_HDRLEN, m, BPF_D_OUT);

Index: src/sys/dist/pf/net/if_pfsync.c
diff -u src/sys/dist/pf/net/if_pfsync.c:1.19 src/sys/dist/pf/net/if_pfsync.c:1.20
--- src/sys/dist/pf/net/if_pfsync.c:1.19	Sat Dec 22 14:28:56 2018
+++ src/sys/dist/pf/net/if_pfsync.c	Wed Jan 29 05:52:27 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_pfsync.c,v 1.19 2018/12/22 14:28:56 maxv Exp $	*/
+/*	$NetBSD: if_pfsync.c,v 1.20 2020/01/29 05:52:27 thorpej Exp $	*/
 /*	$OpenBSD: if_pfsync.c,v 1.83 2007/06/26 14:44:12 mcbride Exp $	*/
 
 /*
@@ -28,7 +28,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_pfsync.c,v 1.19 2018/12/22 14:28:56 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_pfsync.c,v 1.20 2020/01/29 05:52:27 thorpej Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -1045,7 +1045,11 @@ pfsync_get_mbuf(struct pfsync_softc *sc,
 
 	MGETHDR(m, M_DONTWAIT, MT_DATA);
 	if (m == NULL) {
+#ifdef __NetBSD__
+		if_statinc(>sc_if, if_oerrors);
+#else
 		sc->sc_if.if_oerrors++;
+#endif /* __NetBSD__ */
 		return (NULL);
 	}
 
@@ -1084,7 +1088,11 @@ pfsync_get_mbuf(struct pfsync_softc *sc,
 		MCLGET(m, M_DONTWAIT);
 		if ((m->m_flags & M_EXT) == 0) {
 			m_free(m);
+#ifdef __NetBSD__
+			if_statinc(>sc_if, if_oerrors);
+#else
 			sc->sc_if.if_oerrors++;
+#endif /* __NetBSD__ */
 			return (NULL);
 		}
 		m->m_data += (MCLBYTES - len) &~ (sizeof(long) - 1);



CVS commit: src/sys/sys

2020-01-28 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Jan 29 05:50:35 UTC 2020

Modified Files:
src/sys/sys: param.h

Log Message:
NetBSD 9.99.44 -- new if_export_if_data() is now used by modules.


To generate a diff of this commit:
cvs rdiff -u -r1.646 -r1.647 src/sys/sys/param.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/sys/param.h
diff -u src/sys/sys/param.h:1.646 src/sys/sys/param.h:1.647
--- src/sys/sys/param.h:1.646	Tue Jan 28 20:35:04 2020
+++ src/sys/sys/param.h	Wed Jan 29 05:50:34 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: param.h,v 1.646 2020/01/28 20:35:04 ad Exp $	*/
+/*	$NetBSD: param.h,v 1.647 2020/01/29 05:50:34 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 1982, 1986, 1989, 1993
@@ -67,7 +67,7 @@
  *	2.99.9		(299000900)
  */
 
-#define	__NetBSD_Version__	999004300	/* NetBSD 9.99.43 */
+#define	__NetBSD_Version__	999004400	/* NetBSD 9.99.44 */
 
 #define __NetBSD_Prereq__(M,m,p) (M) * 1) + \
 (m) * 100) + (p) * 100) <= __NetBSD_Version__)



CVS commit: src/sys/compat/common

2020-01-28 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Jan 29 05:48:22 UTC 2020

Modified Files:
src/sys/compat/common: uipc_syscalls_50.c

Log Message:
Don't reference ifp->if_data directly; use if_export_if_data().


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/compat/common/uipc_syscalls_50.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/compat/common/uipc_syscalls_50.c
diff -u src/sys/compat/common/uipc_syscalls_50.c:1.10 src/sys/compat/common/uipc_syscalls_50.c:1.11
--- src/sys/compat/common/uipc_syscalls_50.c:1.10	Sun Dec 15 16:48:26 2019
+++ src/sys/compat/common/uipc_syscalls_50.c	Wed Jan 29 05:48:22 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: uipc_syscalls_50.c,v 1.10 2019/12/15 16:48:26 tsutsui Exp $	*/
+/*	$NetBSD: uipc_syscalls_50.c,v 1.11 2020/01/29 05:48:22 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -58,6 +58,7 @@
 static int
 compat_ifdatareq(struct lwp *l, u_long cmd, void *data)
 {
+	struct if_data ifi;
 	struct oifdatareq *ifdr = data;
 	struct ifnet *ifp;
 	int error;
@@ -78,7 +79,8 @@ compat_ifdatareq(struct lwp *l, u_long c
 	/* Do work. */
 	switch (cmd) {
 	case OSIOCGIFDATA:
-		ifdatan2o(>ifdr_data, >if_data);
+		if_export_if_data(ifp, , false);
+		ifdatan2o(>ifdr_data, );
 		return 0;
 
 	case OSIOCZIFDATA:
@@ -90,13 +92,9 @@ compat_ifdatareq(struct lwp *l, u_long c
 			if (error != 0)
 return error;
 		}
-		ifdatan2o(>ifdr_data, >if_data);
-		/*
-		 * Assumes that the volatile counters that can be
-		 * zero'ed are at the end of if_data.
-		 */
-		memset(>if_data.ifi_ipackets, 0, sizeof(ifp->if_data) -
-		offsetof(struct if_data, ifi_ipackets));
+		if_export_if_data(ifp, , true);
+		ifdatan2o(>ifdr_data, );
+		/* XXX if_lastchange? */
 		return 0;
 
 	default:



CVS commit: src/sys/compat/common

2020-01-28 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Jan 29 05:47:12 UTC 2020

Modified Files:
src/sys/compat/common: rtsock_14.c rtsock_50.c

Log Message:
Don't reference ifp->if_data directly; use if_export_if_data().


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/compat/common/rtsock_14.c
cvs rdiff -u -r1.15 -r1.16 src/sys/compat/common/rtsock_50.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/compat/common/rtsock_14.c
diff -u src/sys/compat/common/rtsock_14.c:1.9 src/sys/compat/common/rtsock_14.c:1.10
--- src/sys/compat/common/rtsock_14.c:1.9	Thu Dec 12 02:15:42 2019
+++ src/sys/compat/common/rtsock_14.c	Wed Jan 29 05:47:12 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: rtsock_14.c,v 1.9 2019/12/12 02:15:42 pgoyette Exp $	*/
+/*	$NetBSD: rtsock_14.c,v 1.10 2020/01/29 05:47:12 thorpej Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -61,7 +61,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rtsock_14.c,v 1.9 2019/12/12 02:15:42 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rtsock_14.c,v 1.10 2020/01/29 05:47:12 thorpej Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_compat_netbsd.h"
@@ -99,6 +99,7 @@ void
 compat_14_rt_oifmsg(struct ifnet *ifp)
 {
 	struct if_msghdr14 oifm;
+	struct if_data ifi;
 	struct mbuf *m;
 	struct rt_addrinfo info;
 	struct timeval tv;
@@ -107,26 +108,27 @@ compat_14_rt_oifmsg(struct ifnet *ifp)
 		return;
 	(void)memset(, 0, sizeof(info));
 	(void)memset(, 0, sizeof(oifm));
+	if_export_if_data(ifp, , false);
 	oifm.ifm_index = ifp->if_index;
 	oifm.ifm_flags = ifp->if_flags;
-	oifm.ifm_data.ifi_type = ifp->if_data.ifi_type;
-	oifm.ifm_data.ifi_addrlen = ifp->if_data.ifi_addrlen;
-	oifm.ifm_data.ifi_hdrlen = ifp->if_data.ifi_hdrlen;
-	oifm.ifm_data.ifi_mtu = ifp->if_data.ifi_mtu;
-	oifm.ifm_data.ifi_metric = ifp->if_data.ifi_metric;
-	oifm.ifm_data.ifi_baudrate = ifp->if_data.ifi_baudrate;
-	oifm.ifm_data.ifi_ipackets = ifp->if_data.ifi_ipackets;
-	oifm.ifm_data.ifi_ierrors = ifp->if_data.ifi_ierrors;
-	oifm.ifm_data.ifi_opackets = ifp->if_data.ifi_opackets;
-	oifm.ifm_data.ifi_oerrors = ifp->if_data.ifi_oerrors;
-	oifm.ifm_data.ifi_collisions = ifp->if_data.ifi_collisions;
-	oifm.ifm_data.ifi_ibytes = ifp->if_data.ifi_ibytes;
-	oifm.ifm_data.ifi_obytes = ifp->if_data.ifi_obytes;
-	oifm.ifm_data.ifi_imcasts = ifp->if_data.ifi_imcasts;
-	oifm.ifm_data.ifi_omcasts = ifp->if_data.ifi_omcasts;
-	oifm.ifm_data.ifi_iqdrops = ifp->if_data.ifi_iqdrops;
-	oifm.ifm_data.ifi_noproto = ifp->if_data.ifi_noproto;
-	TIMESPEC_TO_TIMEVAL(, >if_data.ifi_lastchange);
+	oifm.ifm_data.ifi_type = ifi.ifi_type;
+	oifm.ifm_data.ifi_addrlen = ifi.ifi_addrlen;
+	oifm.ifm_data.ifi_hdrlen = ifi.ifi_hdrlen;
+	oifm.ifm_data.ifi_mtu = ifi.ifi_mtu;
+	oifm.ifm_data.ifi_metric = ifi.ifi_metric;
+	oifm.ifm_data.ifi_baudrate = ifi.ifi_baudrate;
+	oifm.ifm_data.ifi_ipackets = ifi.ifi_ipackets;
+	oifm.ifm_data.ifi_ierrors = ifi.ifi_ierrors;
+	oifm.ifm_data.ifi_opackets = ifi.ifi_opackets;
+	oifm.ifm_data.ifi_oerrors = ifi.ifi_oerrors;
+	oifm.ifm_data.ifi_collisions = ifi.ifi_collisions;
+	oifm.ifm_data.ifi_ibytes = ifi.ifi_ibytes;
+	oifm.ifm_data.ifi_obytes = ifi.ifi_obytes;
+	oifm.ifm_data.ifi_imcasts = ifi.ifi_imcasts;
+	oifm.ifm_data.ifi_omcasts = ifi.ifi_omcasts;
+	oifm.ifm_data.ifi_iqdrops = ifi.ifi_iqdrops;
+	oifm.ifm_data.ifi_noproto = ifi.ifi_noproto;
+	TIMESPEC_TO_TIMEVAL(, _lastchange);
 	timeval_to_timeval50(, _data.ifi_lastchange);
 	oifm.ifm_addrs = 0;
 	m = compat_50_rt_msg1(RTM_OOIFINFO, , (void *), sizeof(oifm));
@@ -140,30 +142,32 @@ compat_14_iflist(struct ifnet *ifp, stru
 struct rt_addrinfo *info, size_t len)
 {
 	struct if_msghdr14 *ifm;
+	struct if_data ifi;
 	struct timeval tv;
 	int error;
 
 	ifm = (struct if_msghdr14 *)w->w_tmem;
+	if_export_if_data(ifp, , false);
 	ifm->ifm_index = ifp->if_index;
 	ifm->ifm_flags = ifp->if_flags;
-	ifm->ifm_data.ifi_type = ifp->if_data.ifi_type;
-	ifm->ifm_data.ifi_addrlen = ifp->if_data.ifi_addrlen;
-	ifm->ifm_data.ifi_hdrlen = ifp->if_data.ifi_hdrlen;
-	ifm->ifm_data.ifi_mtu = ifp->if_data.ifi_mtu;
-	ifm->ifm_data.ifi_metric = ifp->if_data.ifi_metric;
-	ifm->ifm_data.ifi_baudrate = ifp->if_data.ifi_baudrate;
-	ifm->ifm_data.ifi_ipackets = ifp->if_data.ifi_ipackets;
-	ifm->ifm_data.ifi_ierrors = ifp->if_data.ifi_ierrors;
-	ifm->ifm_data.ifi_opackets = ifp->if_data.ifi_opackets;
-	ifm->ifm_data.ifi_oerrors = ifp->if_data.ifi_oerrors;
-	ifm->ifm_data.ifi_collisions = ifp->if_data.ifi_collisions;
-	ifm->ifm_data.ifi_ibytes = ifp->if_data.ifi_ibytes;
-	ifm->ifm_data.ifi_obytes = ifp->if_data.ifi_obytes;
-	ifm->ifm_data.ifi_imcasts = ifp->if_data.ifi_imcasts;
-	ifm->ifm_data.ifi_omcasts = ifp->if_data.ifi_omcasts;
-	ifm->ifm_data.ifi_iqdrops = ifp->if_data.ifi_iqdrops;
-	ifm->ifm_data.ifi_noproto = ifp->if_data.ifi_noproto;
-	TIMESPEC_TO_TIMEVAL(, >if_data.ifi_lastchange);
+	

CVS commit: src/sys/arch/xen/xen

2020-01-28 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Jan 29 05:41:48 UTC 2020

Modified Files:
src/sys/arch/xen/xen: if_xennet_xenbus.c xennetback_xenbus.c

Log Message:
Adopt .


To generate a diff of this commit:
cvs rdiff -u -r1.87 -r1.88 src/sys/arch/xen/xen/if_xennet_xenbus.c
cvs rdiff -u -r1.75 -r1.76 src/sys/arch/xen/xen/xennetback_xenbus.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/arch/xen/xen/if_xennet_xenbus.c
diff -u src/sys/arch/xen/xen/if_xennet_xenbus.c:1.87 src/sys/arch/xen/xen/if_xennet_xenbus.c:1.88
--- src/sys/arch/xen/xen/if_xennet_xenbus.c:1.87	Wed Oct 30 07:40:06 2019
+++ src/sys/arch/xen/xen/if_xennet_xenbus.c	Wed Jan 29 05:41:48 2020
@@ -1,4 +1,4 @@
-/*  $NetBSD: if_xennet_xenbus.c,v 1.87 2019/10/30 07:40:06 maxv Exp $  */
+/*  $NetBSD: if_xennet_xenbus.c,v 1.88 2020/01/29 05:41:48 thorpej Exp $  */
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -84,7 +84,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_xennet_xenbus.c,v 1.87 2019/10/30 07:40:06 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_xennet_xenbus.c,v 1.88 2020/01/29 05:41:48 thorpej Exp $");
 
 #include "opt_xen.h"
 #include "opt_nfs_boot.h"
@@ -953,9 +953,9 @@ again:
 		if (__predict_false(
 		RING_GET_RESPONSE(>sc_tx_ring, i)->status !=
 		NETIF_RSP_OKAY))
-			ifp->if_oerrors++;
+			if_statinc(ifp, if_oerrors);
 		else
-			ifp->if_opackets++;
+			if_statinc(ifp, if_opackets);
 		xengnt_revoke_access(req->txreq_gntref);
 		m_freem(req->txreq_m);
 		SLIST_INSERT_HEAD(>sc_txreq_head, req, txreq_next);
@@ -1033,7 +1033,7 @@ again:
  * we can't free this rxreq as no page will be mapped
  * here. Instead give it back immediatly to backend.
  */
-ifp->if_ierrors++;
+if_statinc(ifp, if_ierrors);
 RING_GET_REQUEST(>sc_rx_ring,
 sc->sc_rx_ring.req_prod_pvt)->id = req->rxreq_id;
 RING_GET_REQUEST(>sc_rx_ring,
@@ -1087,7 +1087,7 @@ again:
 		MGETHDR(m, M_DONTWAIT, MT_DATA);
 		if (__predict_false(m == NULL)) {
 			printf("%s: rx no mbuf\n", ifp->if_xname);
-			ifp->if_ierrors++;
+			if_statinc(ifp, if_ierrors);
 			xennet_rx_free_req(req);
 			continue;
 		}
@@ -1105,7 +1105,7 @@ again:
 			if_xennetrxbuf_cache, PR_NOWAIT, >rxreq_pa);
 			if (__predict_false(req->rxreq_va == 0)) {
 printf("%s: rx no buf\n", ifp->if_xname);
-ifp->if_ierrors++;
+if_statinc(ifp, if_ierrors);
 req->rxreq_va = va;
 req->rxreq_pa = pa;
 xennet_rx_free_req(req);
@@ -1121,7 +1121,7 @@ again:
 		if ((rx->flags & NETRXF_csum_blank) != 0) {
 			xennet_checksum_fill();
 			if (m == NULL) {
-ifp->if_ierrors++;
+if_statinc(ifp, if_ierrors);
 xennet_rx_free_req(req);
 continue;
 			}

Index: src/sys/arch/xen/xen/xennetback_xenbus.c
diff -u src/sys/arch/xen/xen/xennetback_xenbus.c:1.75 src/sys/arch/xen/xen/xennetback_xenbus.c:1.76
--- src/sys/arch/xen/xen/xennetback_xenbus.c:1.75	Sat Mar  9 08:42:25 2019
+++ src/sys/arch/xen/xen/xennetback_xenbus.c	Wed Jan 29 05:41:48 2020
@@ -1,4 +1,4 @@
-/*  $NetBSD: xennetback_xenbus.c,v 1.75 2019/03/09 08:42:25 maxv Exp $  */
+/*  $NetBSD: xennetback_xenbus.c,v 1.76 2020/01/29 05:41:48 thorpej Exp $  */
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -25,7 +25,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xennetback_xenbus.c,v 1.75 2019/03/09 08:42:25 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xennetback_xenbus.c,v 1.76 2020/01/29 05:41:48 thorpej Exp $");
 
 #include "opt_xen.h"
 
@@ -788,7 +788,7 @@ xennetback_evthandler(void *arg)
 			ifp->if_xname, txreq.size, msg);
 			xennetback_tx_response(xneti, txreq.id,
 			NETIF_RSP_ERROR);
-			ifp->if_ierrors++;
+			if_statinc(ifp, if_ierrors);
 			continue;
 		}
 
@@ -801,7 +801,7 @@ xennetback_evthandler(void *arg)
 ifp->if_xname);
 			xennetback_tx_response(xneti, txreq.id,
 			NETIF_RSP_DROPPED);
-			ifp->if_ierrors++;
+			if_statinc(ifp, if_ierrors);
 			continue;
 		}
 
@@ -817,7 +817,7 @@ xennetback_evthandler(void *arg)
 ifp->if_xname);
 			xennetback_tx_response(xneti, txreq.id,
 			NETIF_RSP_DROPPED);
-			ifp->if_ierrors++;
+			if_statinc(ifp, if_ierrors);
 			m_freem(m);
 			continue;
 		}
@@ -826,7 +826,7 @@ xennetback_evthandler(void *arg)
 		if (__predict_false(err == ENOMEM)) {
 			xennetback_tx_response(xneti, txreq.id,
 			NETIF_RSP_DROPPED);
-			ifp->if_ierrors++;
+			if_statinc(ifp, if_ierrors);
 			pool_put(_pkt_pool, pkt);
 			m_freem(m);
 			continue;
@@ -837,7 +837,7 @@ xennetback_evthandler(void *arg)
 			xneti->xni_if.if_xname, err);
 			xennetback_tx_response(xneti, txreq.id,
 			NETIF_RSP_ERROR);
-			ifp->if_ierrors++;
+			if_statinc(ifp, if_ierrors);
 			pool_put(_pkt_pool, pkt);
 			m_freem(m);
 			continue;
@@ -879,7 +879,7 @@ xennetback_evthandler(void *arg)
 			(void *)(pkt_va + txreq.offset));
 			xni_pkt_unmap(pkt, pkt_va);
 			if (m->m_pkthdr.len < 

CVS commit: src/sys/arch

2020-01-28 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Jan 29 05:39:48 UTC 2020

Modified Files:
src/sys/arch/sun2/dev: if_ec.c
src/sys/arch/sun3/dev: if_ie.c

Log Message:
Adopt .


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/arch/sun2/dev/if_ec.c
cvs rdiff -u -r1.70 -r1.71 src/sys/arch/sun3/dev/if_ie.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/arch/sun2/dev/if_ec.c
diff -u src/sys/arch/sun2/dev/if_ec.c:1.34 src/sys/arch/sun2/dev/if_ec.c:1.35
--- src/sys/arch/sun2/dev/if_ec.c:1.34	Wed May 29 10:07:29 2019
+++ src/sys/arch/sun2/dev/if_ec.c	Wed Jan 29 05:39:48 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ec.c,v 1.34 2019/05/29 10:07:29 msaitoh Exp $	*/
+/*	$NetBSD: if_ec.c,v 1.35 2020/01/29 05:39:48 thorpej Exp $	*/
 
 /*
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_ec.c,v 1.34 2019/05/29 10:07:29 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ec.c,v 1.35 2020/01/29 05:39:48 thorpej Exp $");
 
 #include "opt_inet.h"
 #include "opt_ns.h"
@@ -419,7 +419,7 @@ ec_intr(void *arg)
 		if (ECREG_CSR_RD & EC_CSR_JAM) {
 			ECREG_CSR_WR(ECREG_CSR_RD &
 			(EC_CSR_BINT | EC_CSR_AINT | EC_CSR_PAMASK));
-			sc->sc_ethercom.ec_if.if_collisions++;
+			if_statinc(ifp, if_collisions);
 			retval++;
 			ec_coll(sc);
 
@@ -429,7 +429,7 @@ ec_intr(void *arg)
 			ECREG_CSR_WR(ECREG_CSR_RD &
 			(EC_CSR_BINT | EC_CSR_AINT | EC_CSR_PAMASK));
 			retval++;
-			sc->sc_ethercom.ec_if.if_opackets++;
+			if_statinc(ifp, if_opackets);
 			sc->sc_jammed = 0;
 			ifp->if_flags &= ~IFF_OACTIVE;
 			if_schedule_deferred_start(ifp);
@@ -526,7 +526,7 @@ ec_recv(struct ec_softc *sc, int intbit)
 		/* Something went wrong. */
 		if (m0 != NULL)
 			m_freem(m0);
-		ifp->if_ierrors++;
+		if_statinc(ifp, if_ierrors);
 	}
 
 	/* Give the receive buffer back to the card. */
@@ -629,7 +629,7 @@ ec_coll(struct ec_softc *sc)
 	u_short jams;
 
 	if ((++sc->sc_colliding) >= EC_COLLISIONS_JAMMED) {
-		sc->sc_ethercom.ec_if.if_oerrors++;
+		if_statinc(ifp, if_oerrors);
 		if (!sc->sc_jammed)
 			printf("%s: ethernet jammed\n",
 			device_xname(sc->sc_dev));
@@ -658,7 +658,7 @@ ec_watchdog(struct ifnet *ifp)
 	struct ec_softc *sc = ifp->if_softc;
 
 	log(LOG_ERR, "%s: device timeout\n", device_xname(sc->sc_dev));
-	sc->sc_ethercom.ec_if.if_oerrors++;
+	if_statinc(ifp, if_oerrors);
 
 	ec_reset(ifp);
 }

Index: src/sys/arch/sun3/dev/if_ie.c
diff -u src/sys/arch/sun3/dev/if_ie.c:1.70 src/sys/arch/sun3/dev/if_ie.c:1.71
--- src/sys/arch/sun3/dev/if_ie.c:1.70	Tue May 28 07:41:48 2019
+++ src/sys/arch/sun3/dev/if_ie.c	Wed Jan 29 05:39:48 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ie.c,v 1.70 2019/05/28 07:41:48 msaitoh Exp $ */
+/*	$NetBSD: if_ie.c,v 1.71 2020/01/29 05:39:48 thorpej Exp $ */
 
 /*-
  * Copyright (c) 1993, 1994, 1995 Charles M. Hannum.
@@ -98,7 +98,7 @@
 */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_ie.c,v 1.70 2019/05/28 07:41:48 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ie.c,v 1.71 2020/01/29 05:39:48 thorpej Exp $");
 
 #include "opt_inet.h"
 #include "opt_ns.h"
@@ -432,7 +432,7 @@ iewatchdog(struct ifnet *ifp)
 	struct ie_softc *sc = ifp->if_softc;
 
 	log(LOG_ERR, "%s: device timeout\n", device_xname(sc->sc_dev));
-	++ifp->if_oerrors;
+	if_statinc(ifp, if_oerrors);
 	iereset(sc);
 }
 
@@ -504,7 +504,7 @@ ie_intr(void *arg)
 #ifdef IEDEBUG
 		printf("%s: receiver not ready\n", device_xname(sc->sc_dev));
 #endif
-		sc->sc_if.if_ierrors++;
+		if_statinc(>sc_if, if_ierrors);
 		iereset(sc);
 	}
 
@@ -542,11 +542,11 @@ ierint(struct ie_softc *sc)
 
 		if ((status & IE_FD_COMPLETE) && (status & IE_FD_OK)) {
 			if (!--timesthru) {
-sc->sc_if.if_ierrors +=
+if_statadd(>sc_if, if_ierrors,
 SWAP(scb->ie_err_crc) +
 SWAP(scb->ie_err_align) +
 SWAP(scb->ie_err_resource) +
-SWAP(scb->ie_err_overrun);
+SWAP(scb->ie_err_overrun));
 scb->ie_err_crc = 0;
 scb->ie_err_align = 0;
 scb->ie_err_resource = 0;
@@ -591,10 +591,10 @@ ietint(struct ie_softc *sc)
 		printf("%s: command still busy!\n", __func__);
 
 	if (status & IE_STAT_OK) {
-		ifp->if_opackets++;
-		ifp->if_collisions += SWAP(status & IE_XS_MAXCOLL);
+		if_statadd2(ifp, if_opackets, 1,
+			if_collisions, SWAP(status & IE_XS_MAXCOLL));
 	} else {
-		ifp->if_oerrors++;
+		if_statinc(ifp, if_oerrors);
 		/*
 		 * XXX
 		 * Check SQE and DEFERRED?
@@ -613,7 +613,7 @@ ietint(struct ie_softc *sc)
 			printf("%s: DMA underrun\n", device_xname(sc->sc_dev));
 		if (status & IE_XS_EXCMAX) {
 			/* Do not print this one (too noisy). */
-			ifp->if_collisions += 16;
+			if_statadd(ifp, if_collisions, 16);
 		}
 	}
 
@@ -896,7 +896,7 @@ ie_readframe(struct ie_softc *sc, int nu
 		ie_drop_packet_buffer(sc);
 	}
 	if (m == 0) {
-		sc->sc_if.if_ierrors++;
+		if_statinc(>sc_if, if_ierrors);
 		return;
 	}
 



CVS commit: src/sys/arch/sgimips

2020-01-28 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Jan 29 05:37:08 UTC 2020

Modified Files:
src/sys/arch/sgimips/hpc: if_sq.c
src/sys/arch/sgimips/mace: if_mec.c

Log Message:
Adopt .


To generate a diff of this commit:
cvs rdiff -u -r1.52 -r1.53 src/sys/arch/sgimips/hpc/if_sq.c
cvs rdiff -u -r1.62 -r1.63 src/sys/arch/sgimips/mace/if_mec.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/arch/sgimips/hpc/if_sq.c
diff -u src/sys/arch/sgimips/hpc/if_sq.c:1.52 src/sys/arch/sgimips/hpc/if_sq.c:1.53
--- src/sys/arch/sgimips/hpc/if_sq.c:1.52	Thu May 23 13:10:51 2019
+++ src/sys/arch/sgimips/hpc/if_sq.c	Wed Jan 29 05:37:08 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_sq.c,v 1.52 2019/05/23 13:10:51 msaitoh Exp $	*/
+/*	$NetBSD: if_sq.c,v 1.53 2020/01/29 05:37:08 thorpej Exp $	*/
 
 /*
  * Copyright (c) 2001 Rafal K. Boni
@@ -33,7 +33,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_sq.c,v 1.52 2019/05/23 13:10:51 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_sq.c,v 1.53 2020/01/29 05:37:08 thorpej Exp $");
 
 
 #include 
@@ -860,7 +860,7 @@ sq_watchdog(struct ifnet *ifp)
 	memset(>sq_trace, 0, sizeof(sc->sq_trace));
 	sc->sq_trace_idx = 0;
 
-	++ifp->if_oerrors;
+	if_statinc(ifp, if_oerrors);
 
 	sq_init(ifp);
 }
@@ -988,7 +988,7 @@ sq_rxintr(struct sq_softc *sc)
 		pktstat = *((uint8_t *)m->m_data + framelen + 2);
 
 		if ((pktstat & RXSTAT_GOOD) == 0) {
-			ifp->if_ierrors++;
+			if_statinc(ifp, if_ierrors);
 
 			if (pktstat & RXSTAT_OFLOW)
 printf("%s: receive FIFO overflow\n",
@@ -1003,7 +1003,7 @@ sq_rxintr(struct sq_softc *sc)
 		}
 
 		if (sq_add_rxbuf(sc, i) != 0) {
-			ifp->if_ierrors++;
+			if_statinc(ifp, if_ierrors);
 			bus_dmamap_sync(sc->sc_dmat, sc->sc_rxmap[i], 0,
 			sc->sc_rxmap[i]->dm_mapsize, BUS_DMASYNC_PREREAD);
 			SQ_INIT_RXDESC(sc, i);
@@ -1074,24 +1074,26 @@ sq_txintr(struct sq_softc *sc)
 
 	SQ_TRACE(SQ_TXINTR_ENTER, sc, sc->sc_prevtx, status);
 
+	net_stats_ref_t nsr = IF_STAT_GETREF(ifp);
 	tmp = (sc->hpc_regs->enetx_ctl_active >> shift) | TXSTAT_GOOD;
 	if ((status & tmp) == 0) {
 		if (status & TXSTAT_COLL)
-			ifp->if_collisions++;
+			if_statinc_ref(nsr, if_collisions);
 
 		if (status & TXSTAT_UFLOW) {
 			printf("%s: transmit underflow\n",
 			device_xname(sc->sc_dev));
-			ifp->if_oerrors++;
+			if_statinc_ref(nsr, if_oerrors);
 		}
 
 		if (status & TXSTAT_16COLL) {
 			printf("%s: max collisions reached\n",
 			device_xname(sc->sc_dev));
-			ifp->if_oerrors++;
-			ifp->if_collisions += 16;
+			if_statinc_ref(nsr, if_oerrors);
+			if_statadd_ref(nsr, if_collisions, 16);
 		}
 	}
+	IF_STAT_PUTREF(ifp);
 
 	/* prevtx now points to next xmit packet not yet finished */
 	if (sc->hpc_regs->revision == 3)
@@ -1161,7 +1163,7 @@ sq_txring_hpc1(struct sq_softc *sc)
 		m_freem(sc->sc_txmbuf[i]);
 		sc->sc_txmbuf[i] = NULL;
 
-		ifp->if_opackets++;
+		if_statinc(ifp, if_opackets);
 		sc->sc_nfreetx++;
 
 		SQ_TRACE(SQ_DONE_DMA, sc, i, status);
@@ -1249,7 +1251,7 @@ sq_txring_hpc3(struct sq_softc *sc)
 		m_freem(sc->sc_txmbuf[i]);
 		sc->sc_txmbuf[i] = NULL;
 
-		ifp->if_opackets++;
+		if_statinc(ifp, if_opackets);
 		sc->sc_nfreetx++;
 
 		SQ_TRACE(SQ_DONE_DMA, sc, i, status);

Index: src/sys/arch/sgimips/mace/if_mec.c
diff -u src/sys/arch/sgimips/mace/if_mec.c:1.62 src/sys/arch/sgimips/mace/if_mec.c:1.63
--- src/sys/arch/sgimips/mace/if_mec.c:1.62	Thu Dec 26 04:53:11 2019
+++ src/sys/arch/sgimips/mace/if_mec.c	Wed Jan 29 05:37:08 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: if_mec.c,v 1.62 2019/12/26 04:53:11 msaitoh Exp $ */
+/* $NetBSD: if_mec.c,v 1.63 2020/01/29 05:37:08 thorpej Exp $ */
 
 /*-
  * Copyright (c) 2004, 2008 Izumi Tsutsui.  All rights reserved.
@@ -61,7 +61,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_mec.c,v 1.62 2019/12/26 04:53:11 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_mec.c,v 1.63 2020/01/29 05:37:08 thorpej Exp $");
 
 #include "opt_ddb.h"
 
@@ -1470,7 +1470,7 @@ mec_watchdog(struct ifnet *ifp)
 	struct mec_softc *sc = ifp->if_softc;
 
 	printf("%s: device timeout\n", device_xname(sc->sc_dev));
-	ifp->if_oerrors++;
+	if_statinc(ifp, if_oerrors);
 
 	mec_init(ifp);
 }
@@ -1665,7 +1665,7 @@ mec_rxintr(struct mec_softc *sc)
 			DPRINTF(MEC_DEBUG_RXINTR,
 			("%s: wrong packet\n", __func__));
  dropit:
-			ifp->if_ierrors++;
+			if_statinc(ifp, if_ierrors);
 			rxd->rxd_stat = 0;
 			MEC_RXSTATSYNC(sc, i, BUS_DMASYNC_PREREAD);
 			bus_space_write_8(st, sh, MEC_MCL_RX_FIFO,
@@ -1880,14 +1880,15 @@ mec_txintr(struct mec_softc *sc, uint32_
 		}
 
 		col = (txstat & MEC_TXSTAT_COLCNT) >> MEC_TXSTAT_COLCNT_SHIFT;
-		ifp->if_collisions += col;
+		if (col)
+			if_statadd(ifp, if_collisions, col);
 
 		if ((txstat & MEC_TXSTAT_SUCCESS) == 0) {
 			printf("%s: TX error: txstat = 0x%016"PRIx64"\n",
 			device_xname(sc->sc_dev), txstat);
-			ifp->if_oerrors++;
+			if_statinc(ifp, if_oerrors);
 		} else
-			

CVS commit: src/sys/arch/powerpc

2020-01-28 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Jan 29 05:35:28 UTC 2020

Modified Files:
src/sys/arch/powerpc/booke/dev: pq3etsec.c
src/sys/arch/powerpc/ibm4xx/dev: if_emac.c

Log Message:
Adopt .


To generate a diff of this commit:
cvs rdiff -u -r1.47 -r1.48 src/sys/arch/powerpc/booke/dev/pq3etsec.c
cvs rdiff -u -r1.51 -r1.52 src/sys/arch/powerpc/ibm4xx/dev/if_emac.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/arch/powerpc/booke/dev/pq3etsec.c
diff -u src/sys/arch/powerpc/booke/dev/pq3etsec.c:1.47 src/sys/arch/powerpc/booke/dev/pq3etsec.c:1.48
--- src/sys/arch/powerpc/booke/dev/pq3etsec.c:1.47	Wed Oct 30 10:12:37 2019
+++ src/sys/arch/powerpc/booke/dev/pq3etsec.c	Wed Jan 29 05:35:28 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pq3etsec.c,v 1.47 2019/10/30 10:12:37 msaitoh Exp $	*/
+/*	$NetBSD: pq3etsec.c,v 1.48 2020/01/29 05:35:28 thorpej Exp $	*/
 /*-
  * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -41,7 +41,7 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: pq3etsec.c,v 1.47 2019/10/30 10:12:37 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pq3etsec.c,v 1.48 2020/01/29 05:35:28 thorpej Exp $");
 
 #include 
 #include 
@@ -1683,7 +1683,7 @@ pq3etsec_rxq_consume(
 			 * We encountered an error, take the mbufs and add
 			 * then to the rx bufcache so we can reuse them.
 			 */
-			ifp->if_ierrors++;
+			if_statinc(ifp, if_ierrors);
 			for (m = rxq->rxq_mhead;
 			 m != rxq->rxq_mconsumer;
 			 m = m->m_next) {
@@ -2226,12 +2226,14 @@ pq3etsec_txq_consume(
 			if (m->m_flags & M_HASFCB)
 m_adj(m, sizeof(struct txfcb));
 			bpf_mtap(ifp, m, BPF_D_OUT);
-			ifp->if_opackets++;
-			ifp->if_obytes += m->m_pkthdr.len;
+			net_stats_ref_t nsr = IF_STAT_GETREF(ifp);
+			if_statinc_ref(nsr, if_opackets);
+			if_statadd_ref(nsr, if_obytes, m->m_pkthdr.len);
 			if (m->m_flags & M_MCAST)
-ifp->if_omcasts++;
+if_statinc_ref(nsr, if_omcasts);
 			if (txbd_flags & TXBD_ERRORS)
-ifp->if_oerrors++;
+if_statinc_ref(nsr, if_oerrors);
+			IF_STAT_PUTREF(ifp);
 			m_freem(m);
 #ifdef ETSEC_DEBUG
 			txq->txq_lmbufs[consumer - txq->txq_first] = NULL;

Index: src/sys/arch/powerpc/ibm4xx/dev/if_emac.c
diff -u src/sys/arch/powerpc/ibm4xx/dev/if_emac.c:1.51 src/sys/arch/powerpc/ibm4xx/dev/if_emac.c:1.52
--- src/sys/arch/powerpc/ibm4xx/dev/if_emac.c:1.51	Tue May 28 07:41:48 2019
+++ src/sys/arch/powerpc/ibm4xx/dev/if_emac.c	Wed Jan 29 05:35:28 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_emac.c,v 1.51 2019/05/28 07:41:48 msaitoh Exp $	*/
+/*	$NetBSD: if_emac.c,v 1.52 2020/01/29 05:35:28 thorpej Exp $	*/
 
 /*
  * Copyright 2001, 2002 Wasabi Systems, Inc.
@@ -52,7 +52,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_emac.c,v 1.51 2019/05/28 07:41:48 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_emac.c,v 1.52 2020/01/29 05:35:28 thorpej Exp $");
 
 #include "opt_emac.h"
 
@@ -1108,7 +1108,7 @@ emac_watchdog(struct ifnet *ifp)
 		aprint_error_ifnet(ifp,
 		"device timeout (txfree %d txsfree %d txnext %d)\n",
 		sc->sc_txfree, sc->sc_txsfree, sc->sc_txnext);
-		ifp->if_oerrors++;
+		if_statinc(ifp, if_oerrors);
 
 		/* Reset the interface. */
 		(void)emac_init(ifp);
@@ -1281,7 +1281,7 @@ emac_txreap(struct emac_softc *sc)
 		 * Check for errors and collisions.
 		 */
 		if (txstat & (EMAC_TXS_UR | EMAC_TXS_ED))
-			ifp->if_oerrors++;
+			if_statinc(ifp, if_oerrors);
 
 #ifdef EMAC_EVENT_COUNTERS
 		if (txstat & EMAC_TXS_UR)
@@ -1291,15 +1291,15 @@ emac_txreap(struct emac_softc *sc)
 		if (txstat &
 		(EMAC_TXS_EC | EMAC_TXS_MC | EMAC_TXS_SC | EMAC_TXS_LC)) {
 			if (txstat & EMAC_TXS_EC)
-ifp->if_collisions += 16;
+if_statadd(ifp, if_collisions, 16);
 			else if (txstat & EMAC_TXS_MC)
-ifp->if_collisions += 2;	/* XXX? */
+if_statadd(ifp, if_collisions, 2); /* XXX? */
 			else if (txstat & EMAC_TXS_SC)
-ifp->if_collisions++;
+if_statinc(ifp, if_collisions);
 			if (txstat & EMAC_TXS_LC)
-ifp->if_collisions++;
+if_statinc(ifp, if_collisions);
 		} else
-			ifp->if_opackets++;
+			if_statinc(ifp, if_opackets);
 
 		if (ifp->if_flags & IFF_DEBUG) {
 			if (txstat & EMAC_TXS_ED)
@@ -1615,7 +1615,7 @@ emac_rxeob_intr(void *arg)
 			if (rxstat & (bit))			\
 aprint_error_ifnet(ifp,		\
 "receive error: %s\n", str)
-			ifp->if_ierrors++;
+			if_statinc(ifp, if_ierrors);
 			PRINTERR(EMAC_RXS_OE, "overrun error");
 			PRINTERR(EMAC_RXS_BP, "bad packet");
 			PRINTERR(EMAC_RXS_RP, "runt packet");
@@ -1664,7 +1664,7 @@ emac_rxeob_intr(void *arg)
 			m = rxs->rxs_mbuf;
 			if (emac_add_rxbuf(sc, i) != 0) {
  dropit:
-ifp->if_ierrors++;
+if_statinc(ifp, if_ierrors);
 EMAC_INIT_RXDESC(sc, i);
 bus_dmamap_sync(sc->sc_dmat,
 rxs->rxs_dmamap, 0,



CVS commit: src/sys/arch/playstation2/dev

2020-01-28 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Jan 29 05:32:04 UTC 2020

Modified Files:
src/sys/arch/playstation2/dev: if_smap.c

Log Message:
Adopt .


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/arch/playstation2/dev/if_smap.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/arch/playstation2/dev/if_smap.c
diff -u src/sys/arch/playstation2/dev/if_smap.c:1.31 src/sys/arch/playstation2/dev/if_smap.c:1.32
--- src/sys/arch/playstation2/dev/if_smap.c:1.31	Sun Nov 10 21:16:31 2019
+++ src/sys/arch/playstation2/dev/if_smap.c	Wed Jan 29 05:32:04 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_smap.c,v 1.31 2019/11/10 21:16:31 chs Exp $	*/
+/*	$NetBSD: if_smap.c,v 1.32 2020/01/29 05:32:04 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_smap.c,v 1.31 2019/11/10 21:16:31 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_smap.c,v 1.32 2020/01/29 05:32:04 thorpej Exp $");
 
 #include "debug_playstation2.h"
 
@@ -336,7 +336,7 @@ smap_rxeof(void *arg)
 		if ((stat & SMAP_RXDESC_EMPTY) != 0) {
 			break;
 		} else if (stat & 0x7fff) {
-			ifp->if_ierrors++;
+			if_statinc(ifp, if_ierrors);
 			goto next_packet;
 		}
 
@@ -357,7 +357,7 @@ smap_rxeof(void *arg)
 		MGETHDR(m, M_DONTWAIT, MT_DATA);
 		if (m == NULL) {
 			printf("%s: unable to allocate Rx mbuf\n", DEVNAME);
-			ifp->if_ierrors++;
+			if_statinc(ifp, if_ierrors);
 			goto next_packet;
 		}
 
@@ -368,7 +368,7 @@ smap_rxeof(void *arg)
 DEVNAME);
 m_freem(m);
 m = NULL;
-ifp->if_ierrors++;
+if_statinc(ifp, if_ierrors);
 goto next_packet;
 			}
 		}
@@ -426,11 +426,11 @@ smap_txeof(void *arg)
 		} else if (stat & 0x7fff) {
 			if (stat & (SMAP_TXDESC_ECOLL | SMAP_TXDESC_LCOLL |
 			SMAP_TXDESC_MCOLL | SMAP_TXDESC_SCOLL))
-ifp->if_collisions++;
+if_statinc(ifp, if_collisions);
 			else
-ifp->if_oerrors++;
+if_statinc(ifp, if_oerrors);
 		} else {
-			ifp->if_opackets++;
+			if_statinc(ifp, if_opackets);
 		}
 
 		if (sc->tx_desc_cnt == 0)
@@ -546,7 +546,7 @@ smap_watchdog(struct ifnet *ifp)
 	struct smap_softc *sc = ifp->if_softc;
 
 	printf("%s: watchdog timeout\n", DEVNAME);
-	sc->ethercom.ec_if.if_oerrors++;
+	if_statinc(ifp, if_oerrors);
 
 	smap_fifo_init(sc);
 	smap_desc_init(sc);



CVS commit: src/sys/arch/next68k/dev

2020-01-28 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Jan 29 05:31:10 UTC 2020

Modified Files:
src/sys/arch/next68k/dev: mb8795.c

Log Message:
Adopt .


To generate a diff of this commit:
cvs rdiff -u -r1.65 -r1.66 src/sys/arch/next68k/dev/mb8795.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/arch/next68k/dev/mb8795.c
diff -u src/sys/arch/next68k/dev/mb8795.c:1.65 src/sys/arch/next68k/dev/mb8795.c:1.66
--- src/sys/arch/next68k/dev/mb8795.c:1.65	Wed May 29 10:07:29 2019
+++ src/sys/arch/next68k/dev/mb8795.c	Wed Jan 29 05:31:10 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: mb8795.c,v 1.65 2019/05/29 10:07:29 msaitoh Exp $	*/
+/*	$NetBSD: mb8795.c,v 1.66 2020/01/29 05:31:10 thorpej Exp $	*/
 /*
  * Copyright (c) 1998 Darrin B. Jewell
  * All rights reserved.
@@ -25,7 +25,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mb8795.c,v 1.65 2019/05/29 10:07:29 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mb8795.c,v 1.66 2020/01/29 05:31:10 thorpej Exp $");
 
 #include "opt_inet.h"
 
@@ -283,7 +283,7 @@ mb8795_rint(struct mb8795_softc *sc)
 	}
 
 	if (error) {
-		ifp->if_ierrors++;
+		if_statinc(ifp, if_ierrors);
 		/* @@@ handle more gracefully, free memory, etc. */
 	}
 
@@ -385,20 +385,20 @@ mb8795_tint(struct mb8795_softc *sc)
 
 	if (txstat & MB8795_TXSTAT_SHORTED) {
 		printf("%s: tx cable shorted\n", device_xname(sc->sc_dev));
-		ifp->if_oerrors++;
+		if_statinc(ifp, if_oerrors);
 	}
 	if (txstat & MB8795_TXSTAT_UNDERFLOW) {
 		printf("%s: tx underflow\n", device_xname(sc->sc_dev));
-		ifp->if_oerrors++;
+		if_statinc(ifp, if_oerrors);
 	}
 	if (txstat & MB8795_TXSTAT_COLLERR) {
 		DPRINTF(("%s: tx collision\n", device_xname(sc->sc_dev)));
-		ifp->if_collisions++;
+		if_statinc(ifp, if_collisions);
 	}
 	if (txstat & MB8795_TXSTAT_COLLERR16) {
 		printf("%s: tx 16th collision\n", device_xname(sc->sc_dev));
-		ifp->if_oerrors++;
-		ifp->if_collisions += 16;
+		if_statinc(ifp, if_oerrors);
+		if_statadd(ifp, if_collisions, 16);
 	}
 
 #if 0
@@ -483,10 +483,7 @@ mb8795_watchdog(struct ifnet *ifp)
 	struct mb8795_softc *sc = ifp->if_softc;
 
 	log(LOG_ERR, "%s: device timeout\n", device_xname(sc->sc_dev));
-	++ifp->if_oerrors;
-
-	DPRINTF(("%s: %lld input errors, %lld input packets\n",
-		device_xname(sc->sc_dev), ifp->if_ierrors, ifp->if_ipackets));
+	if_statinc(ifp, if_oerrors);
 
 	ifp->if_flags &= ~IFF_RUNNING;
 	mb8795_init(sc);
@@ -762,7 +759,7 @@ mb8795_start_dma(struct mb8795_softc *sc
 		MB_WRITE_REG(sc, MB8795_TXMODE,
 		MB8795_TXMODE_TURBO1 | MB8795_TXMODE_TURBOSTART);
 
-	ifp->if_opackets++;
+	if_statinc(ifp, if_opackets);
 }
 
 //



CVS commit: src/sys/arch/mips

2020-01-28 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Jan 29 05:30:14 UTC 2020

Modified Files:
src/sys/arch/mips/adm5120/dev: if_admsw.c
src/sys/arch/mips/alchemy/dev: if_aumac.c
src/sys/arch/mips/atheros/dev: if_ae.c
src/sys/arch/mips/cavium/dev: if_cnmac.c octeon_gmx.c octeon_pip.c
src/sys/arch/mips/ralink: ralink_eth.c
src/sys/arch/mips/sibyte/dev: sbmac.c

Log Message:
Adopt .


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sys/arch/mips/adm5120/dev/if_admsw.c
cvs rdiff -u -r1.47 -r1.48 src/sys/arch/mips/alchemy/dev/if_aumac.c
cvs rdiff -u -r1.37 -r1.38 src/sys/arch/mips/atheros/dev/if_ae.c
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/mips/cavium/dev/if_cnmac.c
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/mips/cavium/dev/octeon_gmx.c
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/mips/cavium/dev/octeon_pip.c
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/mips/ralink/ralink_eth.c
cvs rdiff -u -r1.61 -r1.62 src/sys/arch/mips/sibyte/dev/sbmac.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/arch/mips/adm5120/dev/if_admsw.c
diff -u src/sys/arch/mips/adm5120/dev/if_admsw.c:1.27 src/sys/arch/mips/adm5120/dev/if_admsw.c:1.28
--- src/sys/arch/mips/adm5120/dev/if_admsw.c:1.27	Thu Dec  5 06:25:33 2019
+++ src/sys/arch/mips/adm5120/dev/if_admsw.c	Wed Jan 29 05:30:14 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: if_admsw.c,v 1.27 2019/12/05 06:25:33 msaitoh Exp $ */
+/* $NetBSD: if_admsw.c,v 1.28 2020/01/29 05:30:14 thorpej Exp $ */
 
 /*-
  * Copyright (c) 2007 Ruslan Ermilov and Vsevolod Lobko.
@@ -76,7 +76,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_admsw.c,v 1.27 2019/12/05 06:25:33 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_admsw.c,v 1.28 2020/01/29 05:30:14 thorpej Exp $");
 
 
 #include 
@@ -871,7 +871,7 @@ admsw_txintr(struct admsw_softc *sc, int
 		gotone = 1;
 		/* printf("clear tx slot %d\n", i); */
 
-		ifp->if_opackets++;
+		if_statinc(ifp, if_opackets);
 
 		sc->sc_txfree++;
 	}
@@ -995,7 +995,7 @@ admsw_rxintr(struct admsw_softc *sc, int
 
 		m = ds->ds_mbuf;
 		if (admsw_add_rxlbuf(sc, i) != 0) {
-			ifp->if_ierrors++;
+			if_statinc(ifp, if_ierrors);
 			ADMSW_INIT_RXLDESC(sc, i);
 			bus_dmamap_sync(sc->sc_dmat, ds->ds_dmamap, 0,
 			ds->ds_dmamap->dm_mapsize, BUS_DMASYNC_PREREAD);

Index: src/sys/arch/mips/alchemy/dev/if_aumac.c
diff -u src/sys/arch/mips/alchemy/dev/if_aumac.c:1.47 src/sys/arch/mips/alchemy/dev/if_aumac.c:1.48
--- src/sys/arch/mips/alchemy/dev/if_aumac.c:1.47	Tue May 28 07:41:47 2019
+++ src/sys/arch/mips/alchemy/dev/if_aumac.c	Wed Jan 29 05:30:14 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: if_aumac.c,v 1.47 2019/05/28 07:41:47 msaitoh Exp $ */
+/* $NetBSD: if_aumac.c,v 1.48 2020/01/29 05:30:14 thorpej Exp $ */
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -46,7 +46,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_aumac.c,v 1.47 2019/05/28 07:41:47 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_aumac.c,v 1.48 2020/01/29 05:30:14 thorpej Exp $");
 
 
 
@@ -565,16 +565,18 @@ aumac_txintr(struct aumac_softc *sc)
 		stat = bus_space_read_4(sc->sc_st, sc->sc_dma_sh,
 		MACDMA_TX_STAT(i));
 
+		net_stat_ref_t nsr = IF_STAT_GETREF(ifp);
 		if (stat & TX_STAT_FA) {
 			/* XXX STATS */
-			ifp->if_oerrors++;
+			if_statinc_ref(nsr, if_oerrors);
 		} else
-			ifp->if_opackets++;
+			if_statinc_ref(nsr, if_opackets);
 
 		if (stat & TX_STAT_EC)
-			ifp->if_collisions += 16;
-		else
-			ifp->if_collisions += TX_STAT_CC(stat);
+			if_statadd_ref(nsr, if_collisions, 16);
+		else if (TX_STAT_CC(stat))
+			if_statadd_ref(nsr, if_collisions, TX_STAT_CC(stat));
+		IF_STAT_PUTREF(ifp);
 
 		sc->sc_txfree++;
 		ifp->if_flags &= ~IFF_OACTIVE;
@@ -670,7 +672,7 @@ aumac_rxintr(struct aumac_softc *sc)
 	PRINTERR("dribbling bit");
 			}
 #undef PRINTERR
-			ifp->if_ierrors++;
+			if_statinc(ifp, if_ierrors);
 
  dropit:
 			/* reuse the current descriptor */

Index: src/sys/arch/mips/atheros/dev/if_ae.c
diff -u src/sys/arch/mips/atheros/dev/if_ae.c:1.37 src/sys/arch/mips/atheros/dev/if_ae.c:1.38
--- src/sys/arch/mips/atheros/dev/if_ae.c:1.37	Fri Sep 13 07:55:06 2019
+++ src/sys/arch/mips/atheros/dev/if_ae.c	Wed Jan 29 05:30:14 2020
@@ -1,4 +1,4 @@
-/* $Id: if_ae.c,v 1.37 2019/09/13 07:55:06 msaitoh Exp $ */
+/* $Id: if_ae.c,v 1.38 2020/01/29 05:30:14 thorpej Exp $ */
 /*-
  * Copyright (c) 2006 Urbana-Champaign Independent Media Center.
  * Copyright (c) 2006 Garrett D'Amore.
@@ -98,7 +98,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_ae.c,v 1.37 2019/09/13 07:55:06 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ae.c,v 1.38 2020/01/29 05:30:14 thorpej Exp $");
 
 
 #include 
@@ -784,7 +784,7 @@ ae_watchdog(struct ifnet *ifp)
 
 	if (doing_transmit) {
 		printf("%s: transmit timeout\n", device_xname(sc->sc_dev));
-		ifp->if_oerrors++;
+		if_statinc(ifp, if_oerrors);
 	}
 	else
 		printf("%s: spurious watchdog timeout\n", 

CVS commit: src/sys/dev/i2c

2020-01-28 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Jan 29 05:27:05 UTC 2020

Modified Files:
src/sys/dev/i2c: files.i2c
Added Files:
src/sys/dev/i2c: pcagpio.c

Log Message:
the beginning of a driver for Philips Semiconductors PCA 9555 and 9556
GPIO controllers, found in Sun Fire v210 and some G5 macs.
Only prints configuration and line status so far.


To generate a diff of this commit:
cvs rdiff -u -r1.108 -r1.109 src/sys/dev/i2c/files.i2c
cvs rdiff -u -r0 -r1.1 src/sys/dev/i2c/pcagpio.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/i2c/files.i2c
diff -u src/sys/dev/i2c/files.i2c:1.108 src/sys/dev/i2c/files.i2c:1.109
--- src/sys/dev/i2c/files.i2c:1.108	Sun Jan 12 17:48:42 2020
+++ src/sys/dev/i2c/files.i2c	Wed Jan 29 05:27:05 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: files.i2c,v 1.108 2020/01/12 17:48:42 thorpej Exp $
+#	$NetBSD: files.i2c,v 1.109 2020/01/29 05:27:05 macallan Exp $
 
 obsolete defflag	opt_i2cbus.h		I2C_SCAN
 define	i2cbus { }
@@ -385,3 +385,8 @@ file	dev/i2c/es8316ac.c			es8316ac
 device	cwfg: sysmon_envsys
 attach	cwfg at iic
 file	dev/i2c/cwfg.ccwfg
+
+# Philips PCA955x GPIO
+device	pcagpio
+attach	pcagpio at iic
+file	dev/i2c/pcagpio.c			pcagpio

Added files:

Index: src/sys/dev/i2c/pcagpio.c
diff -u /dev/null src/sys/dev/i2c/pcagpio.c:1.1
--- /dev/null	Wed Jan 29 05:27:05 2020
+++ src/sys/dev/i2c/pcagpio.c	Wed Jan 29 05:27:05 2020
@@ -0,0 +1,182 @@
+/* $NetBSD: pcagpio.c,v 1.1 2020/01/29 05:27:05 macallan Exp $ */
+
+/*-
+ * Copyright (c) 2018 Michael Lorenz
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * a driver for Philips Semiconductor PCA9555 GPIO controllers
+ */
+
+#include 
+__KERNEL_RCSID(0, "$NetBSD: pcagpio.c,v 1.1 2020/01/29 05:27:05 macallan Exp $");
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+/* commands */
+#define PCAGPIO_INPUT	0x00	/* line status */
+#define PCAGPIO_OUTPUT	0x01	/* output status */
+#define PCAGPIO_REVERT	0x02	/* revert input if set */
+#define PCAGPIO_CONFIG	0x03	/* input if set, output if not */
+
+static int	pcagpio_match(device_t, cfdata_t, void *);
+static void	pcagpio_attach(device_t, device_t, void *);
+
+struct pcagpio_softc {
+	device_t	sc_dev;
+	i2c_tag_t	sc_i2c;
+	i2c_addr_t	sc_addr;
+
+	int		sc_is_16bit;
+};
+
+
+static void 	pcagpio_writereg(struct pcagpio_softc *, int, uint32_t);
+static uint32_t pcagpio_readreg(struct pcagpio_softc *, int);
+
+CFATTACH_DECL_NEW(pcagpio, sizeof(struct pcagpio_softc),
+pcagpio_match, pcagpio_attach, NULL, NULL);
+
+static const struct device_compatible_entry compat_data[] = {
+	{ "i2c-pca9555",	1 },
+	{ "pca9555",		1 },
+	{ "i2c-pca9556",	0 },
+	{ "pca9556",		0 },
+	{ NULL,			0 }
+};
+
+static int
+pcagpio_match(device_t parent, cfdata_t match, void *aux)
+{
+	struct i2c_attach_args *ia = aux;
+	int match_result;
+
+	if (iic_use_direct_match(ia, match, compat_data, _result))
+		return match_result;
+
+	return 0;
+}
+
+static void
+printdir(uint32_t val, uint32_t mask, char letter)
+{
+	char flags[17], bits[17];
+	uint32_t bit = 0x8000;
+	int i;
+
+	val &= mask;
+	for (i = 0; i < 16; i++) {
+		flags[i] = (mask & bit) ? letter : '-';
+		bits[i] = (val & bit) ? 'X' : ' ';
+		bit = bit >> 1;
+	}
+	flags[16] = 0;
+	bits[16] = 0;
+	printf("dir: %s\n", flags);
+	printf("lvl: %s\n", bits);
+}	
+
+static void
+pcagpio_attach(device_t parent, device_t self, void *aux)
+{
+	struct pcagpio_softc *sc = device_private(self);
+	struct i2c_attach_args *ia = aux;
+	const struct device_compatible_entry *dce;
+	uint32_t dir, in, out;
+
+	sc->sc_dev = self;
+	sc->sc_i2c 

CVS commit: src/sys/arch/mac68k

2020-01-28 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Jan 29 05:25:42 UTC 2020

Modified Files:
src/sys/arch/mac68k/dev: if_mc.c
src/sys/arch/mac68k/nubus: if_netdock_nubus.c

Log Message:
Adopt .


To generate a diff of this commit:
cvs rdiff -u -r1.52 -r1.53 src/sys/arch/mac68k/dev/if_mc.c
cvs rdiff -u -r1.31 -r1.32 src/sys/arch/mac68k/nubus/if_netdock_nubus.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/arch/mac68k/dev/if_mc.c
diff -u src/sys/arch/mac68k/dev/if_mc.c:1.52 src/sys/arch/mac68k/dev/if_mc.c:1.53
--- src/sys/arch/mac68k/dev/if_mc.c:1.52	Fri Dec 27 09:32:09 2019
+++ src/sys/arch/mac68k/dev/if_mc.c	Wed Jan 29 05:25:41 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_mc.c,v 1.52 2019/12/27 09:32:09 msaitoh Exp $	*/
+/*	$NetBSD: if_mc.c,v 1.53 2020/01/29 05:25:41 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 1997 David Huang 
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_mc.c,v 1.52 2019/12/27 09:32:09 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_mc.c,v 1.53 2020/01/29 05:25:41 thorpej Exp $");
 
 #include "opt_ddb.h"
 #include "opt_inet.h"
@@ -266,7 +266,7 @@ mcstart(struct ifnet *ifp)
 		ifp->if_flags |= IFF_OACTIVE;
 		maceput(sc, m);
 
-		ifp->if_opackets++;		/* # of pkts */
+		if_statinc(ifp, if_opackets);	/* # of pkts */
 	}
 }
 
@@ -434,21 +434,21 @@ struct mc_softc *sc = arg;
 #ifdef MCDEBUG
 		printf("%s: jabber error\n", device_xname(sc->sc_dev));
 #endif
-		sc->sc_if.if_oerrors++;
+		if_statinc(>sc_if, if_oerrors);
 	}
 
 	if (ir & BABL) {
 #ifdef MCDEBUG
 		printf("%s: babble\n", device_xname(sc->sc_dev));
 #endif
-		sc->sc_if.if_oerrors++;
+		if_statinc(>sc_if, if_oerrors);
 	}
 
 	if (ir & CERR) {
 #ifdef MCDEBUG
 		printf("%s: collision error\n", device_xname(sc->sc_dev));
 #endif
-		sc->sc_if.if_collisions++;
+		if_statinc(>sc_if, if_collisions);
 	}
 
 	/*
@@ -481,29 +481,33 @@ mc_tint(struct mc_softc *sc)
 		return;
 	}
 
+	net_stat_ref_t nsr = IF_STAT_GETREF(>sc_if);
+
 	if (xmtfs & LCOL) {
 		printf("%s: late collision\n", device_xname(sc->sc_dev));
-		sc->sc_if.if_oerrors++;
-		sc->sc_if.if_collisions++;
+		if_statinc_ref(nsr, if_oerrors);
+		if_statinc_ref(nsr, if_collisions);
 	}
 
 	if (xmtfs & MORE)
 		/* Real number is unknown. */
-		sc->sc_if.if_collisions += 2;
+		if_statadd_ref(nsr, if_collsions, 2);
 	else if (xmtfs & ONE)
-		sc->sc_if.if_collisions++;
+		if_statinc_ref(nsr, if_collisions);
 	else if (xmtfs & RTRY) {
 		printf("%s: excessive collisions\n", device_xname(sc->sc_dev));
-		sc->sc_if.if_collisions += 16;
-		sc->sc_if.if_oerrors++;
+		if_statadd_ref(nsr, if_collsions, 16);
+		if_statinc_ref(nsr, if_oerrors);
 	}
 
 	if (xmtfs & LCAR) {
 		sc->sc_havecarrier = 0;
 		printf("%s: lost carrier\n", device_xname(sc->sc_dev));
-		sc->sc_if.if_oerrors++;
+		if_statinc_ref(nsr, if_oerrors);
 	}
 
+	IF_STAT_PUTREF(>sc_if);
+
 	sc->sc_if.if_flags &= ~IFF_OACTIVE;
 	sc->sc_if.if_timer = 0;
 	if_schedule_deferred_start(>sc_if);
@@ -526,18 +530,18 @@ mc_rint(struct mc_softc *sc)
 
 	if (rxf.rx_rcvsts & OFLO) {
 		printf("%s: receive FIFO overflow\n", device_xname(sc->sc_dev));
-		sc->sc_if.if_ierrors++;
+		if_statinc(>sc_if, if_ierrors);
 		return;
 	}
 
 	if (rxf.rx_rcvsts & CLSN)
-		sc->sc_if.if_collisions++;
+		if_statinc(>sc_if, if_collisions);
 
 	if (rxf.rx_rcvsts & FRAM) {
 #ifdef MCDEBUG
 		printf("%s: framing error\n", device_xname(sc->sc_dev));
 #endif
-		sc->sc_if.if_ierrors++;
+		if_statinc(>sc_if, if_ierrors);
 		return;
 	}
 
@@ -545,7 +549,7 @@ mc_rint(struct mc_softc *sc)
 #ifdef MCDEBUG
 		printf("%s: frame control checksum error\n", device_xname(sc->sc_dev));
 #endif
-		sc->sc_if.if_ierrors++;
+		if_statinc(>sc_if, if_ierrors);
 		return;
 	}
 
@@ -565,13 +569,13 @@ mace_read(struct mc_softc *sc, void *pkt
 		printf("%s: invalid packet size %d; dropping\n",
 		device_xname(sc->sc_dev), len);
 #endif
-		ifp->if_ierrors++;
+		if_statinc(ifp, if_ierrors);
 		return;
 	}
 
 	m = mace_get(sc, pkt, len);
 	if (m == NULL) {
-		ifp->if_ierrors++;
+		if_statinc(ifp, if_ierrors);
 		return;
 	}
 

Index: src/sys/arch/mac68k/nubus/if_netdock_nubus.c
diff -u src/sys/arch/mac68k/nubus/if_netdock_nubus.c:1.31 src/sys/arch/mac68k/nubus/if_netdock_nubus.c:1.32
--- src/sys/arch/mac68k/nubus/if_netdock_nubus.c:1.31	Mon Oct 21 08:22:06 2019
+++ src/sys/arch/mac68k/nubus/if_netdock_nubus.c	Wed Jan 29 05:25:42 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_netdock_nubus.c,v 1.31 2019/10/21 08:22:06 msaitoh Exp $	*/
+/*	$NetBSD: if_netdock_nubus.c,v 1.32 2020/01/29 05:25:42 thorpej Exp $	*/
 
 /*
  * Copyright (C) 2000,2002 Daishi Kato 
@@ -43,7 +43,7 @@
 /***/
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_netdock_nubus.c,v 1.31 2019/10/21 08:22:06 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_netdock_nubus.c,v 1.32 2020/01/29 05:25:42 thorpej Exp $");
 
 #include 
 #include 
@@ -458,7 +458,7 @@ netdock_start(struct ifnet 

CVS commit: src/sys/arch/amiga/dev

2020-01-28 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Jan 29 05:23:16 UTC 2020

Modified Files:
src/sys/arch/amiga/dev: if_es.c if_qn.c

Log Message:
Adopt .


To generate a diff of this commit:
cvs rdiff -u -r1.64 -r1.65 src/sys/arch/amiga/dev/if_es.c
cvs rdiff -u -r1.48 -r1.49 src/sys/arch/amiga/dev/if_qn.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/arch/amiga/dev/if_es.c
diff -u src/sys/arch/amiga/dev/if_es.c:1.64 src/sys/arch/amiga/dev/if_es.c:1.65
--- src/sys/arch/amiga/dev/if_es.c:1.64	Wed May 29 10:07:28 2019
+++ src/sys/arch/amiga/dev/if_es.c	Wed Jan 29 05:23:16 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_es.c,v 1.64 2019/05/29 10:07:28 msaitoh Exp $ */
+/*	$NetBSD: if_es.c,v 1.65 2020/01/29 05:23:16 thorpej Exp $ */
 
 /*
  * Copyright (c) 1995 Michael L. Hitch
@@ -33,7 +33,7 @@
 #include "opt_ns.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_es.c,v 1.64 2019/05/29 10:07:28 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_es.c,v 1.65 2020/01/29 05:23:16 thorpej Exp $");
 
 
 #include 
@@ -389,7 +389,7 @@ esintr(void *arg)
 		intsts);
 		smc->b2.ist = ACK_RX_OVRN;
 		printf ("->%02x\n", smc->b2.ist);
-		ifp->if_ierrors++;
+		if_statinc(ifp, if_ierrors);
 	}
 	if (intact & IST_TX_EMPTY) {
 		u_short ecr;
@@ -417,8 +417,8 @@ esintr(void *arg)
 			smc->b0.bsr = BSR_BANK0;
 			ecr = smc->b0.ecr;	/* Get error counters */
 			if (ecr & 0xff00)
-ifp->if_collisions += ((ecr >> 8) & 15) +
-((ecr >> 11) & 0x1e);
+if_statadd(ifp, if_collisions,
+((ecr >> 8) & 15) + ((ecr >> 11) & 0x1e));
 			smc->b2.bsr = BSR_BANK2;
 #if 0
 			smc->b2.mmucr = MMUCR_RESET_TX; /* XXX reset TX FIFO */
@@ -468,7 +468,7 @@ :
 			smc->b0.bsr = BSR_BANK0;
 			smc->b0.tcr |= TCR_TXENA;
 			smc->b2.bsr = BSR_BANK2;
-			ifp->if_oerrors++;
+			if_statinc(ifp, if_oerrors);
 			sc->sc_intctl |= MSK_TX_EMPTY | MSK_TX;
 		} else {
 			/*
@@ -509,7 +509,7 @@ :
 		}
 	}
 	if (intact & IST_EPHINT) {
-		ifp->if_oerrors++;
+		if_statinc(ifp, if_oerrors);
 		esreset(sc);
 	}
 	/* output packets */
@@ -601,7 +601,7 @@ esrint(struct es_softc *sc)
 		smc->b2.mmucr = MMUCR_REMRLS_RX;
 		while (smc->b2.mmucr & MMUCR_BUSY)
 			;
-		++ifp->if_ierrors;
+		if_statinc(ifp, if_ierrors);
 #ifdef ESDEBUG
 		if (--sc->sc_smcbusy) {
 			printf("%s: esrintr busy on bad packet exit\n",
@@ -922,7 +922,8 @@ esstart(struct ifnet *ifp)
 			device_xname(sc->sc_dev), active_pnr, smc->b2.pnr);
 		bpf_mtap(>sc_ethercom.ec_if, m0, BPF_D_OUT);
 		m_freem(m0);
-		sc->sc_ethercom.ec_if.if_opackets++;	/* move to interrupt? */
+/* move to interrupt? */
+		if_statinc(>sc_ethercom.ec_if, if_opackets);
 		sc->sc_intctl |= MSK_TX_EMPTY | MSK_TX;
 		sc->sc_ethercom.ec_if.if_timer = 5;
 	}
@@ -1048,7 +1049,7 @@ eswatchdog(struct ifnet *ifp)
 	struct es_softc *sc = ifp->if_softc;
 
 	log(LOG_ERR, "%s: device timeout\n", device_xname(sc->sc_dev));
-	++ifp->if_oerrors;
+	if_statinc(ifp, if_oerrors);
 
 	esreset(sc);
 }

Index: src/sys/arch/amiga/dev/if_qn.c
diff -u src/sys/arch/amiga/dev/if_qn.c:1.48 src/sys/arch/amiga/dev/if_qn.c:1.49
--- src/sys/arch/amiga/dev/if_qn.c:1.48	Tue Nov 12 13:17:43 2019
+++ src/sys/arch/amiga/dev/if_qn.c	Wed Jan 29 05:23:16 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_qn.c,v 1.48 2019/11/12 13:17:43 msaitoh Exp $ */
+/*	$NetBSD: if_qn.c,v 1.49 2020/01/29 05:23:16 thorpej Exp $ */
 
 /*
  * Copyright (c) 1995 Mika Kortelainen
@@ -66,7 +66,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_qn.c,v 1.48 2019/11/12 13:17:43 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_qn.c,v 1.49 2020/01/29 05:23:16 thorpej Exp $");
 
 #include "qn.h"
 #if NQN > 0
@@ -305,7 +305,7 @@ qnwatchdog(struct ifnet *ifp)
 	struct qn_softc *sc = ifp->if_softc;
 
 	log(LOG_INFO, "qn: device timeout (watchdog)\n");
-	++sc->sc_ethercom.ec_if.if_oerrors;
+	if_statinc(ifp, if_oerrors);
 
 	qnreset(sc);
 }
@@ -613,19 +613,19 @@ qn_rint(struct qn_softc *sc, u_short rst
 #ifdef QN_DEBUG
 		log(LOG_INFO, "Overflow\n");
 #endif
-		++sc->sc_ethercom.ec_if.if_ierrors;
+		if_statinc(>sc_ethercom.ec_if, if_ierrors);
 	}
 	if (rstat & R_INT_CRC_ERR) {
 #ifdef QN_DEBUG
 		log(LOG_INFO, "CRC Error\n");
 #endif
-		++sc->sc_ethercom.ec_if.if_ierrors;
+		if_statinc(>sc_ethercom.ec_if, if_ierrors);
 	}
 	if (rstat & R_INT_ALG_ERR) {
 #ifdef QN_DEBUG
 		log(LOG_INFO, "Alignment error\n");
 #endif
-		++sc->sc_ethercom.ec_if.if_ierrors;
+		if_statinc(>sc_ethercom.ec_if, if_ierrors);
 	}
 	if (rstat & R_INT_SRT_PKT) {
 		/* Short packet (these may occur and are
@@ -635,13 +635,13 @@ qn_rint(struct qn_softc *sc, u_short rst
 #ifdef QN_DEBUG
 		log(LOG_INFO, "Short packet\n");
 #endif
-		++sc->sc_ethercom.ec_if.if_ierrors;
+		if_statinc(>sc_ethercom.ec_if, if_ierrors);
 	}
 	if (rstat & 0x4040) {
 #ifdef QN_DEBUG
 		log(LOG_INFO, "Bus read error\n");
 #endif
-		++sc->sc_ethercom.ec_if.if_ierrors;
+		if_statinc(>sc_ethercom.ec_if, if_ierrors);
 		

CVS commit: src/sys/netcan

2020-01-28 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Jan 29 05:20:27 UTC 2020

Modified Files:
src/sys/netcan: can.c if_canloop.c

Log Message:
Adopt .


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/netcan/can.c src/sys/netcan/if_canloop.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/netcan/can.c
diff -u src/sys/netcan/can.c:1.8 src/sys/netcan/can.c:1.9
--- src/sys/netcan/can.c:1.8	Mon Aug 19 03:24:38 2019
+++ src/sys/netcan/can.c	Wed Jan 29 05:20:26 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: can.c,v 1.8 2019/08/19 03:24:38 ozaki-r Exp $	*/
+/*	$NetBSD: can.c,v 1.9 2020/01/29 05:20:26 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2003, 2017 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: can.c,v 1.8 2019/08/19 03:24:38 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: can.c,v 1.9 2020/01/29 05:20:26 thorpej Exp $");
 
 #include 
 #include 
@@ -249,7 +249,7 @@ can_output(struct mbuf *m, struct canpcb
 		
 	sotag = m_tag_get(PACKET_TAG_SO, sizeof(struct socket *), PR_NOWAIT);
 	if (sotag == NULL) {
-		ifp->if_oerrors++;
+		if_statinc(ifp, if_oerrors);
 		return ENOMEM;
 	}
 	mutex_enter(>canp_mtx);
@@ -307,8 +307,7 @@ can_input(struct ifnet *ifp, struct mbuf
 	} else {
 		IF_ENQUEUE(inq, m);
 		IFQ_UNLOCK(inq);
-		ifp->if_ipackets++;
-		ifp->if_ibytes += m->m_pkthdr.len;
+		if_statadd2(ifp, if_ipackets, 1, if_ibytes, m->m_pkthdr.len);
 		schednetisr(NETISR_CAN);
 	}
 }
Index: src/sys/netcan/if_canloop.c
diff -u src/sys/netcan/if_canloop.c:1.8 src/sys/netcan/if_canloop.c:1.9
--- src/sys/netcan/if_canloop.c:1.8	Sat Apr 27 08:49:19 2019
+++ src/sys/netcan/if_canloop.c	Wed Jan 29 05:20:26 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_canloop.c,v 1.8 2019/04/27 08:49:19 pgoyette Exp $	*/
+/*	$NetBSD: if_canloop.c,v 1.9 2020/01/29 05:20:26 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2017 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_canloop.c,v 1.8 2019/04/27 08:49:19 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_canloop.c,v 1.9 2020/01/29 05:20:26 thorpej Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_can.h"
@@ -170,8 +170,7 @@ canloop_ifstart(struct ifnet *ifp)
 			can_bpf_mtap(ifp, m, 0);
 
 		pktlen = m->m_pkthdr.len;
-		ifp->if_opackets++;
-		ifp->if_obytes += pktlen;
+		if_statadd2(ifp, if_opackets, 1, if_obytes, pktlen);
 
 #ifdef CAN
 		can_mbuf_tag_clean(m);



CVS commit: src/sys/net80211

2020-01-28 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Jan 29 05:21:14 UTC 2020

Modified Files:
src/sys/net80211: ieee80211_input.c

Log Message:
Adopt .


To generate a diff of this commit:
cvs rdiff -u -r1.115 -r1.116 src/sys/net80211/ieee80211_input.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/net80211/ieee80211_input.c
diff -u src/sys/net80211/ieee80211_input.c:1.115 src/sys/net80211/ieee80211_input.c:1.116
--- src/sys/net80211/ieee80211_input.c:1.115	Sat Dec 22 13:11:37 2018
+++ src/sys/net80211/ieee80211_input.c	Wed Jan 29 05:21:14 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: ieee80211_input.c,v 1.115 2018/12/22 13:11:37 maxv Exp $	*/
+/*	$NetBSD: ieee80211_input.c,v 1.116 2020/01/29 05:21:14 thorpej Exp $	*/
 
 /*
  * Copyright (c) 2001 Atsushi Onoe
@@ -37,7 +37,7 @@
 __FBSDID("$FreeBSD: src/sys/net80211/ieee80211_input.c,v 1.81 2005/08/10 16:22:29 sam Exp $");
 #endif
 #ifdef __NetBSD__
-__KERNEL_RCSID(0, "$NetBSD: ieee80211_input.c,v 1.115 2018/12/22 13:11:37 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ieee80211_input.c,v 1.116 2020/01/29 05:21:14 thorpej Exp $");
 #endif
 
 #ifdef _KERNEL_OPT
@@ -361,7 +361,7 @@ ieee80211_input_data(struct ieee80211com
 		}
 	}
 
-	ifp->if_ipackets++;
+	if_statinc(ifp, if_ipackets);
 	IEEE80211_NODE_STAT(ni, rx_data);
 	IEEE80211_NODE_STAT_ADD(ni, rx_bytes, m->m_pkthdr.len);
 
@@ -371,7 +371,7 @@ ieee80211_input_data(struct ieee80211com
 	return 0;
 
 err:
-	ifp->if_ierrors++;
+	if_statinc(ifp, if_ierrors);
 out:
 	*mp = m;
 	return -1;
@@ -460,7 +460,7 @@ ieee80211_input_management(struct ieee80
 	return 0;
 
 err:
-	ifp->if_ierrors++;
+	if_statinc(ifp, if_ierrors);
 out:
 	*mp = m;
 	return -1;
@@ -742,7 +742,7 @@ ieee80211_input(struct ieee80211com *ic,
 	}
 
 err:
-	ifp->if_ierrors++;
+	if_statinc(ifp, if_ierrors);
 
 out:
 	if (m != NULL) {
@@ -868,7 +868,7 @@ ieee80211_deliver_data(struct ieee80211c
 		if (ETHER_IS_MULTICAST(eh->ether_dhost)) {
 			m1 = m_copypacket(m, M_DONTWAIT);
 			if (m1 == NULL)
-ifp->if_oerrors++;
+if_statinc(ifp, if_oerrors);
 			else
 m1->m_flags |= M_MCAST;
 		} else {
@@ -907,11 +907,11 @@ ieee80211_deliver_data(struct ieee80211c
 			len = m1->m_pkthdr.len;
 			IFQ_ENQUEUE(>if_snd, m1, error);
 			if (error) {
-ifp->if_oerrors++;
+if_statinc(ifp, if_oerrors);
 m_freem(m);
 m = NULL;
 			}
-			ifp->if_obytes += len;
+			if_statadd(ifp, if_obytes, len);
 		}
 	}
 



CVS commit: src/sys/netinet

2020-01-28 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Jan 29 04:37:24 UTC 2020

Modified Files:
src/sys/netinet: in_l2tp.c ip_carp.c

Log Message:
Adopt .


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/netinet/in_l2tp.c
cvs rdiff -u -r1.107 -r1.108 src/sys/netinet/ip_carp.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/netinet/in_l2tp.c
diff -u src/sys/netinet/in_l2tp.c:1.17 src/sys/netinet/in_l2tp.c:1.18
--- src/sys/netinet/in_l2tp.c:1.17	Thu Sep 19 06:07:25 2019
+++ src/sys/netinet/in_l2tp.c	Wed Jan 29 04:37:24 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: in_l2tp.c,v 1.17 2019/09/19 06:07:25 knakahara Exp $	*/
+/*	$NetBSD: in_l2tp.c,v 1.18 2020/01/29 04:37:24 thorpej Exp $	*/
 
 /*
  * Copyright (c) 2017 Internet Initiative Japan Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: in_l2tp.c,v 1.17 2019/09/19 06:07:25 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: in_l2tp.c,v 1.18 2020/01/29 04:37:24 thorpej Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_l2tp.h"
@@ -239,7 +239,7 @@ in_l2tp_output(struct l2tp_variant *var,
 
 looped:
 	if (error)
-		ifp->if_oerrors++;
+		if_statinc(ifp, if_oerrors);
 
 out:
 	return error;

Index: src/sys/netinet/ip_carp.c
diff -u src/sys/netinet/ip_carp.c:1.107 src/sys/netinet/ip_carp.c:1.108
--- src/sys/netinet/ip_carp.c:1.107	Mon Jan 20 18:38:22 2020
+++ src/sys/netinet/ip_carp.c	Wed Jan 29 04:37:24 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: ip_carp.c,v 1.107 2020/01/20 18:38:22 thorpej Exp $	*/
+/*	$NetBSD: ip_carp.c,v 1.108 2020/01/29 04:37:24 thorpej Exp $	*/
 /*	$OpenBSD: ip_carp.c,v 1.113 2005/11/04 08:11:54 mcbride Exp $	*/
 
 /*
@@ -33,7 +33,7 @@
 #endif
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ip_carp.c,v 1.107 2020/01/20 18:38:22 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip_carp.c,v 1.108 2020/01/29 04:37:24 thorpej Exp $");
 
 /*
  * TODO:
@@ -712,13 +712,12 @@ carp_proto_input_c(struct mbuf *m, struc
 	}
 
 	nanotime(>sc_if.if_lastchange);
-	sc->sc_if.if_ipackets++;
-	sc->sc_if.if_ibytes += m->m_pkthdr.len;
+	if_statadd2(>sc_if, if_ipackets, 1, if_ibytes, m->m_pkthdr.len);
 
 	/* verify the CARP version. */
 	if (ch->carp_version != CARP_VERSION) {
 		CARP_STATINC(CARP_STAT_BADVER);
-		sc->sc_if.if_ierrors++;
+		if_statinc(>sc_if, if_ierrors);
 		CARP_LOG(sc, ("invalid version %d != %d",
 		ch->carp_version, CARP_VERSION));
 		m_freem(m);
@@ -735,7 +734,7 @@ carp_proto_input_c(struct mbuf *m, struc
 #endif
 
 		CARP_STATINC(CARP_STAT_BADAUTH);
-		sc->sc_if.if_ierrors++;
+		if_statinc(>sc_if, if_ierrors);
 
 		switch(af) {
 		case AF_INET:
@@ -1038,7 +1037,7 @@ carp_send_ad(void *v)
 
 	advbase = advskew = 0; /* Sh compiler */
 	if (sc->sc_carpdev == NULL) {
-		sc->sc_if.if_oerrors++;
+		if_statinc(>sc_if, if_oerrors);
 		goto retry_later;
 	}
 
@@ -1075,7 +1074,7 @@ carp_send_ad(void *v)
 
 		MGETHDR(m, M_DONTWAIT, MT_HEADER);
 		if (m == NULL) {
-			sc->sc_if.if_oerrors++;
+			if_statinc(>sc_if, if_oerrors);
 			CARP_STATINC(CARP_STAT_ONOMEM);
 			/* XXX maybe less ? */
 			goto retry_later;
@@ -1119,8 +1118,7 @@ carp_send_ad(void *v)
 		m->m_data -= sizeof(*ip);
 
 		nanotime(>sc_if.if_lastchange);
-		sc->sc_if.if_opackets++;
-		sc->sc_if.if_obytes += len;
+		if_statadd2(>sc_if, if_opackets, 1, if_obytes, len);
 		CARP_STATINC(CARP_STAT_OPACKETS);
 
 		error = ip_output(m, NULL, NULL, IP_RAWOUTPUT, >sc_imo,
@@ -1130,7 +1128,7 @@ carp_send_ad(void *v)
 CARP_STATINC(CARP_STAT_ONOMEM);
 			else
 CARP_LOG(sc, ("ip_output failed: %d", error));
-			sc->sc_if.if_oerrors++;
+			if_statinc(>sc_if, if_oerrors);
 			if (sc->sc_sendad_errors < INT_MAX)
 sc->sc_sendad_errors++;
 			if (sc->sc_sendad_errors == CARP_SENDAD_MAX_ERRORS) {
@@ -1159,7 +1157,7 @@ carp_send_ad(void *v)
 
 		MGETHDR(m, M_DONTWAIT, MT_HEADER);
 		if (m == NULL) {
-			sc->sc_if.if_oerrors++;
+			if_statinc(>sc_if, if_oerrors);
 			CARP_STATINC(CARP_STAT_ONOMEM);
 			/* XXX maybe less ? */
 			goto retry_later;
@@ -1193,7 +1191,7 @@ carp_send_ad(void *v)
 		ip6->ip6_dst.s6_addr16[0] = htons(0xff02);
 		ip6->ip6_dst.s6_addr8[15] = 0x12;
 		if (in6_setscope(>ip6_dst, >sc_if, NULL) != 0) {
-			sc->sc_if.if_oerrors++;
+			if_statinc(>sc_if, if_oerrors);
 			m_freem(m);
 			CARP_LOG(sc, ("in6_setscope failed"));
 			goto retry_later;
@@ -1207,8 +1205,7 @@ carp_send_ad(void *v)
 		len - sizeof(*ip6));
 
 		nanotime(>sc_if.if_lastchange);
-		sc->sc_if.if_opackets++;
-		sc->sc_if.if_obytes += len;
+		if_statadd2(>sc_if, if_opackets, 1, if_obytes, len);
 		CARP_STATINC(CARP_STAT_OPACKETS6);
 
 		error = ip6_output(m, NULL, NULL, 0, >sc_im6o, NULL, NULL);
@@ -1217,7 +1214,7 @@ carp_send_ad(void *v)
 CARP_STATINC(CARP_STAT_ONOMEM);
 			else
 CARP_LOG(sc, ("ip6_output failed: %d", error));
-			sc->sc_if.if_oerrors++;
+			if_statinc(>sc_if, if_oerrors);
 			if (sc->sc_sendad_errors < INT_MAX)
 sc->sc_sendad_errors++;
 			if 

CVS commit: src/sys/netinet6

2020-01-28 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Jan 29 04:38:06 UTC 2020

Modified Files:
src/sys/netinet6: in6_l2tp.c

Log Message:
Adopt .


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/netinet6/in6_l2tp.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/netinet6/in6_l2tp.c
diff -u src/sys/netinet6/in6_l2tp.c:1.18 src/sys/netinet6/in6_l2tp.c:1.19
--- src/sys/netinet6/in6_l2tp.c:1.18	Thu Sep 19 06:07:25 2019
+++ src/sys/netinet6/in6_l2tp.c	Wed Jan 29 04:38:06 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: in6_l2tp.c,v 1.18 2019/09/19 06:07:25 knakahara Exp $	*/
+/*	$NetBSD: in6_l2tp.c,v 1.19 2020/01/29 04:38:06 thorpej Exp $	*/
 
 /*
  * Copyright (c) 2017 Internet Initiative Japan Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: in6_l2tp.c,v 1.18 2019/09/19 06:07:25 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: in6_l2tp.c,v 1.19 2020/01/29 04:38:06 thorpej Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_l2tp.h"
@@ -231,7 +231,7 @@ in6_l2tp_output(struct l2tp_variant *var
 
 looped:
 	if (error)
-		ifp->if_oerrors++;
+		if_statinc(ifp, if_oerrors);
 
 	return error;
 }



CVS commit: src/sys/net

2020-01-28 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Jan 29 04:35:13 UTC 2020

Modified Files:
src/sys/net: rtsock.c rtsock_shared.c

Log Message:
Do not reference ifp->if_data directly; use if_export_if_data().


To generate a diff of this commit:
cvs rdiff -u -r1.252 -r1.253 src/sys/net/rtsock.c
cvs rdiff -u -r1.11 -r1.12 src/sys/net/rtsock_shared.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/net/rtsock.c
diff -u src/sys/net/rtsock.c:1.252 src/sys/net/rtsock.c:1.253
--- src/sys/net/rtsock.c:1.252	Sun Sep  1 18:54:38 2019
+++ src/sys/net/rtsock.c	Wed Jan 29 04:35:13 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: rtsock.c,v 1.252 2019/09/01 18:54:38 roy Exp $	*/
+/*	$NetBSD: rtsock.c,v 1.253 2020/01/29 04:35:13 thorpej Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -61,7 +61,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rtsock.c,v 1.252 2019/09/01 18:54:38 roy Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rtsock.c,v 1.253 2020/01/29 04:35:13 thorpej Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -239,7 +239,7 @@ sysctl_iflist_if(struct ifnet *ifp, stru
 	ifm = (struct if_xmsghdr *)w->w_tmem;
 	ifm->ifm_index = ifp->if_index;
 	ifm->ifm_flags = ifp->if_flags;
-	ifm->ifm_data = ifp->if_data;
+	if_export_if_data(ifp, >ifm_data, false);
 	ifm->ifm_addrs = info->rti_addrs;
 	if ((error = copyout(ifm, w->w_where, len)) == 0)
 		w->w_where = (char *)w->w_where + len;

Index: src/sys/net/rtsock_shared.c
diff -u src/sys/net/rtsock_shared.c:1.11 src/sys/net/rtsock_shared.c:1.12
--- src/sys/net/rtsock_shared.c:1.11	Mon Oct 14 16:43:04 2019
+++ src/sys/net/rtsock_shared.c	Wed Jan 29 04:35:13 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: rtsock_shared.c,v 1.11 2019/10/14 16:43:04 maxv Exp $	*/
+/*	$NetBSD: rtsock_shared.c,v 1.12 2020/01/29 04:35:13 thorpej Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -61,7 +61,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rtsock_shared.c,v 1.11 2019/10/14 16:43:04 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rtsock_shared.c,v 1.12 2020/01/29 04:35:13 thorpej Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -1348,7 +1348,7 @@ COMPATNAME(rt_ifmsg)(struct ifnet *ifp)
 	(void)memset(, 0, sizeof(ifm));
 	ifm.ifm_index = ifp->if_index;
 	ifm.ifm_flags = ifp->if_flags;
-	ifm.ifm_data = ifp->if_data;
+	if_export_if_data(ifp, _data, false);
 	ifm.ifm_addrs = 0;
 	m = COMPATNAME(rt_msg1)(RTM_IFINFO, , , sizeof(ifm));
 	if (m == NULL)



CVS commit: src/sys/net

2020-01-28 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Jan 29 04:34:10 UTC 2020

Modified Files:
src/sys/net: if_ipsec.c if_tun.c

Log Message:
Adopt .


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/sys/net/if_ipsec.c
cvs rdiff -u -r1.157 -r1.158 src/sys/net/if_tun.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/net/if_ipsec.c
diff -u src/sys/net/if_ipsec.c:1.25 src/sys/net/if_ipsec.c:1.26
--- src/sys/net/if_ipsec.c:1.25	Fri Nov  1 04:28:14 2019
+++ src/sys/net/if_ipsec.c	Wed Jan 29 04:34:10 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ipsec.c,v 1.25 2019/11/01 04:28:14 knakahara Exp $  */
+/*	$NetBSD: if_ipsec.c,v 1.26 2020/01/29 04:34:10 thorpej Exp $  */
 
 /*
  * Copyright (c) 2017 Internet Initiative Japan Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_ipsec.c,v 1.25 2019/11/01 04:28:14 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ipsec.c,v 1.26 2020/01/29 04:34:10 thorpej Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -538,7 +538,7 @@ end:
 	curlwp_bindx(bound);
 noref_end:
 	if (error)
-		ifp->if_oerrors++;
+		if_statinc(ifp, if_oerrors);
 
 	return error;
 }
@@ -566,8 +566,7 @@ if_ipsec_out_direct(struct ipsec_variant
 	if (error)
 		return error;
 
-	ifp->if_opackets++;
-	ifp->if_obytes += len;
+	if_statadd2(ifp, if_opackets, 1, if_obytes, len);
 
 	return 0;
 }
@@ -609,7 +608,7 @@ if_ipsec_in_enqueue(struct mbuf *m, int 
 		break;
 #endif
 	default:
-		ifp->if_ierrors++;
+		if_statinc(ifp, if_ierrors);
 		m_freem(m);
 		return;
 	}
@@ -621,10 +620,9 @@ if_ipsec_in_enqueue(struct mbuf *m, int 
 #endif
 	pktlen = m->m_pkthdr.len;
 	if (__predict_true(pktq_enqueue(pktq, m, h))) {
-		ifp->if_ibytes += pktlen;
-		ifp->if_ipackets++;
+		if_statadd2(ifp, if_ibytes, pktlen, if_ipackets, 1);
 	} else {
-		ifp->if_iqdrops++;
+		if_statinc(ifp, if_iqdrops);
 		m_freem(m);
 	}
 

Index: src/sys/net/if_tun.c
diff -u src/sys/net/if_tun.c:1.157 src/sys/net/if_tun.c:1.158
--- src/sys/net/if_tun.c:1.157	Fri Dec 13 14:13:55 2019
+++ src/sys/net/if_tun.c	Wed Jan 29 04:34:10 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_tun.c,v 1.157 2019/12/13 14:13:55 maxv Exp $	*/
+/*	$NetBSD: if_tun.c,v 1.158 2020/01/29 04:34:10 thorpej Exp $	*/
 
 /*
  * Copyright (c) 1988, Julian Onions 
@@ -19,7 +19,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_tun.c,v 1.157 2019/12/13 14:13:55 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_tun.c,v 1.158 2020/01/29 04:34:10 thorpej Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -259,13 +259,6 @@ tunattach0(struct tun_softc *tp)
 	ifp->if_extflags = IFEF_NO_LINK_STATE_CHANGE;
 	ifp->if_type = IFT_TUNNEL;
 	ifp->if_snd.ifq_maxlen = ifqmaxlen;
-	ifp->if_collisions = 0;
-	ifp->if_ierrors = 0;
-	ifp->if_oerrors = 0;
-	ifp->if_ipackets = 0;
-	ifp->if_opackets = 0;
-	ifp->if_ibytes   = 0;
-	ifp->if_obytes   = 0;
 	ifp->if_dlt = DLT_NULL;
 	IFQ_SET_READY(>if_snd);
 	if_attach(ifp);
@@ -612,13 +605,12 @@ tun_output(struct ifnet *ifp, struct mbu
 		mlen = m0->m_pkthdr.len;
 		IFQ_ENQUEUE(>if_snd, m0, error);
 		if (error) {
-			ifp->if_collisions++;
+			if_statinc(ifp, if_collisions);
 			error = EAFNOSUPPORT;
 			m0 = NULL;
 			goto out;
 		}
-		ifp->if_opackets++;
-		ifp->if_obytes += mlen;
+		if_statadd2(ifp, if_opackets, 1, if_obytes, mlen);
 		break;
 #endif
 	default:
@@ -828,7 +820,7 @@ tunread(dev_t dev, struct uio *uio, int 
 		m_freem(m0);
 	}
 	if (error)
-		ifp->if_ierrors++;
+		if_statinc(ifp, if_ierrors);
 
 	return error;
 
@@ -946,7 +938,7 @@ tunwrite(dev_t dev, struct uio *uio, int
 	if (error) {
 		if (top != NULL)
 			m_freem(top);
-		ifp->if_ierrors++;
+		if_statinc(ifp, if_ierrors);
 		goto out0;
 	}
 
@@ -967,14 +959,13 @@ tunwrite(dev_t dev, struct uio *uio, int
 		goto out;
 	}
 	if (__predict_false(!pktq_enqueue(pktq, top, 0))) {
-		ifp->if_collisions++;
+		if_statinc(ifp, if_collisions);
 		mutex_exit(>tun_lock);
 		error = ENOBUFS;
 		m_freem(top);
 		goto out0;
 	}
-	ifp->if_ipackets++;
-	ifp->if_ibytes += tlen;
+	if_statadd2(ifp, if_ipackets, 1, if_ibytes, tlen);
 out:
 	mutex_exit(>tun_lock);
 out0:



CVS commit: src/sys/net

2020-01-28 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Jan 29 04:30:42 UTC 2020

Modified Files:
src/sys/net/agr: ieee8023ad_lacp.c if_agr.c
src/sys/net/npf: npf_ext_log.c

Log Message:
Adopt .


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/net/agr/ieee8023ad_lacp.c
cvs rdiff -u -r1.50 -r1.51 src/sys/net/agr/if_agr.c
cvs rdiff -u -r1.15 -r1.16 src/sys/net/npf/npf_ext_log.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/net/agr/ieee8023ad_lacp.c
diff -u src/sys/net/agr/ieee8023ad_lacp.c:1.10 src/sys/net/agr/ieee8023ad_lacp.c:1.11
--- src/sys/net/agr/ieee8023ad_lacp.c:1.10	Fri Jul  1 02:46:24 2011
+++ src/sys/net/agr/ieee8023ad_lacp.c	Wed Jan 29 04:30:41 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: ieee8023ad_lacp.c,v 1.10 2011/07/01 02:46:24 joerg Exp $	*/
+/*	$NetBSD: ieee8023ad_lacp.c,v 1.11 2020/01/29 04:30:41 thorpej Exp $	*/
 
 /*-
  * Copyright (c)2005 YAMAMOTO Takashi,
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ieee8023ad_lacp.c,v 1.10 2011/07/01 02:46:24 joerg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ieee8023ad_lacp.c,v 1.11 2020/01/29 04:30:41 thorpej Exp $");
 
 #include 
 #include 
@@ -503,7 +503,7 @@ ieee8023ad_select_tx_port(struct agr_sof
 	if (__predict_false(lsc->lsc_suppress_distributing &&
 	!AGR_ROUNDROBIN(sc))) {
 		LACP_DPRINTF((NULL, "%s: waiting transit\n", __func__));
-		sc->sc_if.if_collisions++; /* XXX abuse */
+		if_statinc(>sc_if, if_collisions);	/* XXX abuse */
 		return NULL;
 	}
 

Index: src/sys/net/agr/if_agr.c
diff -u src/sys/net/agr/if_agr.c:1.50 src/sys/net/agr/if_agr.c:1.51
--- src/sys/net/agr/if_agr.c:1.50	Sun Oct  6 15:11:17 2019
+++ src/sys/net/agr/if_agr.c	Wed Jan 29 04:30:41 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_agr.c,v 1.50 2019/10/06 15:11:17 uwe Exp $	*/
+/*	$NetBSD: if_agr.c,v 1.51 2020/01/29 04:30:41 thorpej Exp $	*/
 
 /*-
  * Copyright (c)2005 YAMAMOTO Takashi,
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_agr.c,v 1.50 2019/10/06 15:11:17 uwe Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_agr.c,v 1.51 2020/01/29 04:30:41 thorpej Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -156,7 +156,7 @@ agr_input(struct ifnet *ifp_port, struct
 	ifp = port->port_agrifp;
 	if ((port->port_flags & AGRPORT_COLLECTING) == 0) {
 		m_freem(m);
-		ifp->if_ierrors++;
+		if_statinc(ifp, if_ierrors);
 		return;
 	}
 
@@ -390,19 +390,21 @@ agr_start(struct ifnet *ifp)
 		}
 		bpf_mtap(ifp, m, BPF_D_OUT);
 		port = agr_select_tx_port(sc, m);
+		net_stat_ref_t nsr = IF_STAT_GETREF(ifp);
 		if (port) {
 			int error;
 
 			error = agr_xmit_frame(port->port_ifp, m);
 			if (error) {
-ifp->if_oerrors++;
+if_statinc_ref(nsr, if_oerrors);
 			} else {
-ifp->if_opackets++;
+if_statinc_ref(nsr, if_opackets);
 			}
 		} else {
 			m_freem(m);
-			ifp->if_oerrors++;
+			if_statinc_ref(nsr, if_oerrors);
 		}
+		IF_STAT_PUTREF(ifp);
 	}
 
 	AGR_UNLOCK(sc);

Index: src/sys/net/npf/npf_ext_log.c
diff -u src/sys/net/npf/npf_ext_log.c:1.15 src/sys/net/npf/npf_ext_log.c:1.16
--- src/sys/net/npf/npf_ext_log.c:1.15	Sat Sep 29 14:41:36 2018
+++ src/sys/net/npf/npf_ext_log.c	Wed Jan 29 04:30:41 2020
@@ -33,7 +33,7 @@
 
 #ifdef _KERNEL
 #include 
-__KERNEL_RCSID(0, "$NetBSD: npf_ext_log.c,v 1.15 2018/09/29 14:41:36 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: npf_ext_log.c,v 1.16 2020/01/29 04:30:41 thorpej Exp $");
 
 #include 
 #include 
@@ -140,8 +140,7 @@ npf_log(npf_cache_t *npc, void *meta, co
 	}
 
 	/* Pass through BPF. */
-	ifp->if_opackets++;
-	ifp->if_obytes += m->m_pkthdr.len;
+	if_statadd2(ifp, if_opackets, 1, if_obytes, m->m_pkthdr.len);
 	if (ifp->if_bpf) {
 		bpf_mtap2(ifp->if_bpf, , NPFLOG_HDRLEN, m, BPF_D_OUT);
 	}



CVS commit: src/sys/net

2020-01-28 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Jan 29 04:28:27 UTC 2020

Modified Files:
src/sys/net: if_ppp.c if_pppoe.c if_sl.c if_spppsubr.c if_srt.c
if_stf.c if_tap.c if_vlan.c ppp_tty.c

Log Message:
Adopt .


To generate a diff of this commit:
cvs rdiff -u -r1.166 -r1.167 src/sys/net/if_ppp.c
cvs rdiff -u -r1.147 -r1.148 src/sys/net/if_pppoe.c
cvs rdiff -u -r1.131 -r1.132 src/sys/net/if_sl.c
cvs rdiff -u -r1.184 -r1.185 src/sys/net/if_spppsubr.c
cvs rdiff -u -r1.30 -r1.31 src/sys/net/if_srt.c
cvs rdiff -u -r1.106 -r1.107 src/sys/net/if_stf.c
cvs rdiff -u -r1.115 -r1.116 src/sys/net/if_tap.c
cvs rdiff -u -r1.149 -r1.150 src/sys/net/if_vlan.c
cvs rdiff -u -r1.66 -r1.67 src/sys/net/ppp_tty.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/net/if_ppp.c
diff -u src/sys/net/if_ppp.c:1.166 src/sys/net/if_ppp.c:1.167
--- src/sys/net/if_ppp.c:1.166	Fri Sep 20 08:45:29 2019
+++ src/sys/net/if_ppp.c	Wed Jan 29 04:28:27 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ppp.c,v 1.166 2019/09/20 08:45:29 maxv Exp $	*/
+/*	$NetBSD: if_ppp.c,v 1.167 2020/01/29 04:28:27 thorpej Exp $	*/
 /*	Id: if_ppp.c,v 1.6 1997/03/04 03:33:00 paulus Exp 	*/
 
 /*
@@ -102,7 +102,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_ppp.c,v 1.166 2019/09/20 08:45:29 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ppp.c,v 1.167 2020/01/29 04:28:27 thorpej Exp $");
 
 #ifdef _KERNEL_OPT
 #include "ppp.h"
@@ -1013,14 +1013,13 @@ pppoutput(struct ifnet *ifp, struct mbuf
 		ifq = (m0->m_flags & M_HIGHPRI) ? >sc_fastq : NULL;
 		if ((error = ifq_enqueue2(>sc_if, ifq, m0)) != 0) {
 			splx(s);
-			sc->sc_if.if_oerrors++;
+			if_statinc(>sc_if, if_oerrors);
 			sc->sc_stats.ppp_oerrors++;
 			return (error);
 		}
 		ppp_restart(sc);
 	}
-	ifp->if_opackets++;
-	ifp->if_obytes += len;
+	if_statadd2(ifp, if_opackets, 1, if_obytes, len);
 
 	splx(s);
 	return (0);
@@ -1065,7 +1064,7 @@ ppp_requeue(struct ppp_softc *sc)
 			m->m_nextpkt = NULL;
 			ifq = (m->m_flags & M_HIGHPRI) ? >sc_fastq : NULL;
 			if ((error = ifq_enqueue2(>sc_if, ifq, m)) != 0) {
-sc->sc_if.if_oerrors++;
+if_statinc(>sc_if, if_oerrors);
 sc->sc_stats.ppp_oerrors++;
 			}
 			break;
@@ -1715,11 +1714,10 @@ ppp_inproc(struct ppp_softc *sc, struct 
 	if (__predict_true(pktq)) {
 		if (__predict_false(!pktq_enqueue(pktq, m, 0))) {
 			splx(s);
-			ifp->if_iqdrops++;
+			if_statinc(ifp, if_iqdrops);
 			goto bad;
 		}
-		ifp->if_ipackets++;
-		ifp->if_ibytes += ilen;
+		if_statadd2(ifp, if_ipackets, 1, if_ibytes, ilen);
 		splx(s);
 		return;
 	}
@@ -1734,13 +1732,12 @@ ppp_inproc(struct ppp_softc *sc, struct 
 		splx(s);
 		if (sc->sc_flags & SC_DEBUG)
 			printf("%s: input queue full\n", ifp->if_xname);
-		ifp->if_iqdrops++;
+		if_statinc(ifp, if_iqdrops);
 		goto bad;
 	}
 	IF_ENQUEUE(inq, m);
 	splx(s);
-	ifp->if_ipackets++;
-	ifp->if_ibytes += ilen;
+	if_statadd2(ifp, if_ipackets, 1, if_ibytes, ilen);
 
 	(*sc->sc_ctlp)(sc);
 
@@ -1748,7 +1745,7 @@ ppp_inproc(struct ppp_softc *sc, struct 
 
 bad:
 	m_freem(m);
-	sc->sc_if.if_ierrors++;
+	if_statinc(>sc_if, if_ierrors);
 	sc->sc_stats.ppp_ierrors++;
 }
 

Index: src/sys/net/if_pppoe.c
diff -u src/sys/net/if_pppoe.c:1.147 src/sys/net/if_pppoe.c:1.148
--- src/sys/net/if_pppoe.c:1.147	Mon Mar 18 11:38:03 2019
+++ src/sys/net/if_pppoe.c	Wed Jan 29 04:28:27 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: if_pppoe.c,v 1.147 2019/03/18 11:38:03 msaitoh Exp $ */
+/* $NetBSD: if_pppoe.c,v 1.148 2020/01/29 04:28:27 thorpej Exp $ */
 
 /*
  * Copyright (c) 2002, 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_pppoe.c,v 1.147 2019/03/18 11:38:03 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_pppoe.c,v 1.148 2020/01/29 04:28:27 thorpej Exp $");
 
 #ifdef _KERNEL_OPT
 #include "pppoe.h"
@@ -1125,7 +1125,7 @@ pppoe_data_input(struct mbuf *m)
 	m_set_rcvif(m, >sc_sppp.pp_if);
 
 	/* pass packet up and account for it */
-	sc->sc_sppp.pp_if.if_ipackets++;
+	if_statinc(>sc_sppp.pp_if, if_ipackets);
 	sppp_input(>sc_sppp.pp_if, m);
 	return;
 
@@ -1161,7 +1161,7 @@ pppoe_output(struct pppoe_softc *sc, str
 #endif
 
 	m->m_flags &= ~(M_BCAST|M_MCAST);
-	sc->sc_sppp.pp_if.if_opackets++;
+	if_statinc(>sc_sppp.pp_if, if_opackets);
 	return if_output_lock(sc->sc_eth_if, sc->sc_eth_if, m, , NULL);
 }
 
@@ -1865,7 +1865,7 @@ pppoe_start(struct ifnet *ifp)
 		len = m->m_pkthdr.len;
 		M_PREPEND(m, PPPOE_HEADERLEN, M_DONTWAIT);
 		if (m == NULL) {
-			ifp->if_oerrors++;
+			if_statinc(ifp, if_oerrors);
 			continue;
 		}
 		p = mtod(m, uint8_t *);
@@ -1901,7 +1901,7 @@ pppoe_transmit(struct ifnet *ifp, struct
 	M_PREPEND(m, PPPOE_HEADERLEN, M_DONTWAIT);
 	if (m == NULL) {
 		PPPOE_UNLOCK(sc);
-		ifp->if_oerrors++;
+		if_statinc(ifp, if_oerrors);
 		return ENETDOWN;
 	}
 	p = mtod(m, uint8_t *);

Index: src/sys/net/if_sl.c
diff -u src/sys/net/if_sl.c:1.131 src/sys/net/if_sl.c:1.132

CVS commit: src/sys/net

2020-01-28 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Jan 29 04:18:34 UTC 2020

Modified Files:
src/sys/net: if_bridge.c if_faith.c if_gif.c if_gre.c if_l2tp.c
if_loop.c if_mpls.c

Log Message:
Adopt .


To generate a diff of this commit:
cvs rdiff -u -r1.165 -r1.166 src/sys/net/if_bridge.c
cvs rdiff -u -r1.60 -r1.61 src/sys/net/if_faith.c
cvs rdiff -u -r1.150 -r1.151 src/sys/net/if_gif.c
cvs rdiff -u -r1.176 -r1.177 src/sys/net/if_gre.c
cvs rdiff -u -r1.40 -r1.41 src/sys/net/if_l2tp.c
cvs rdiff -u -r1.109 -r1.110 src/sys/net/if_loop.c
cvs rdiff -u -r1.35 -r1.36 src/sys/net/if_mpls.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/net/if_bridge.c
diff -u src/sys/net/if_bridge.c:1.165 src/sys/net/if_bridge.c:1.166
--- src/sys/net/if_bridge.c:1.165	Mon Aug  5 13:30:21 2019
+++ src/sys/net/if_bridge.c	Wed Jan 29 04:18:34 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_bridge.c,v 1.165 2019/08/05 13:30:21 msaitoh Exp $	*/
+/*	$NetBSD: if_bridge.c,v 1.166 2020/01/29 04:18:34 thorpej Exp $	*/
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -80,7 +80,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_bridge.c,v 1.165 2019/08/05 13:30:21 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_bridge.c,v 1.166 2020/01/29 04:18:34 thorpej Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_bridge_ipf.h"
@@ -1461,14 +1461,16 @@ bridge_enqueue(struct bridge_softc *sc, 
 	error = if_transmit_lock(dst_ifp, m);
 	if (error) {
 		/* mbuf is already freed */
-		sc->sc_if.if_oerrors++;
+		if_statinc(>sc_if, if_oerrors);
 		return;
 	}
 
-	sc->sc_if.if_opackets++;
-	sc->sc_if.if_obytes += len;
+	net_stat_ref_t nsr = IF_STAT_GETREF(>sc_if);
+	if_statinc_ref(nsr, if_opackets);
+	if_statadd_ref(nsr, if_obytes, len);
 	if (mflags & M_MCAST)
-		sc->sc_if.if_omcasts++;
+		if_statinc_ref(nsr, if_omcasts);
+	IF_STAT_PUTREF(>sc_if);
 }
 
 /*
@@ -1649,7 +1651,7 @@ bridge_output(struct ifnet *ifp, struct 
 			} else {
 mc = m_copypacket(m, M_DONTWAIT);
 if (mc == NULL) {
-	sc->sc_if.if_oerrors++;
+	if_statinc(>sc_if, if_oerrors);
 	goto next;
 }
 			}
@@ -1667,7 +1669,8 @@ bridge_output(struct ifnet *ifp, struct 
 } else {
 	mc = m_copypacket(m, M_DONTWAIT);
 	if (mc == NULL) {
-		sc->sc_if.if_oerrors++;
+		if_statinc(>sc_if,
+		if_oerrors);
 		goto next;
 	}
 }
@@ -1750,8 +1753,7 @@ bridge_forward(struct bridge_softc *sc, 
 		goto out;
 	}
 
-	sc->sc_if.if_ipackets++;
-	sc->sc_if.if_ibytes += m->m_pkthdr.len;
+	if_statadd2(>sc_if, if_ipackets, 1, if_ibytes, m->m_pkthdr.len);
 
 	/*
 	 * Look up the bridge_iflist.
@@ -1819,7 +1821,7 @@ bridge_forward(struct bridge_softc *sc, 
 		}
 	} else {
 		/* ...forward it to all interfaces. */
-		sc->sc_if.if_imcasts++;
+		if_statinc(>sc_if, if_imcasts);
 		dst_if = NULL;
 	}
 
@@ -2081,7 +2083,7 @@ bridge_broadcast(struct bridge_softc *sc
 		if (dst_if != src_if) {
 			mc = m_copypacket(m, M_DONTWAIT);
 			if (mc == NULL) {
-sc->sc_if.if_oerrors++;
+if_statinc(>sc_if, if_oerrors);
 goto next;
 			}
 			/*
@@ -2099,7 +2101,7 @@ bridge_broadcast(struct bridge_softc *sc
 		if (bmcast) {
 			mc = m_copypacket(m, M_DONTWAIT);
 			if (mc == NULL) {
-sc->sc_if.if_oerrors++;
+if_statinc(>sc_if, if_oerrors);
 goto next;
 			}
 

Index: src/sys/net/if_faith.c
diff -u src/sys/net/if_faith.c:1.60 src/sys/net/if_faith.c:1.61
--- src/sys/net/if_faith.c:1.60	Sat Apr 27 06:18:15 2019
+++ src/sys/net/if_faith.c	Wed Jan 29 04:18:34 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_faith.c,v 1.60 2019/04/27 06:18:15 pgoyette Exp $	*/
+/*	$NetBSD: if_faith.c,v 1.61 2020/01/29 04:18:34 thorpej Exp $	*/
 /*	$KAME: if_faith.c,v 1.21 2001/02/20 07:59:26 itojun Exp $	*/
 
 /*
@@ -40,7 +40,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_faith.c,v 1.60 2019/04/27 06:18:15 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_faith.c,v 1.61 2020/01/29 04:18:34 thorpej Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -201,8 +201,7 @@ faithoutput(struct ifnet *ifp, struct mb
 		rt->rt_flags & RTF_HOST ? EHOSTUNREACH : ENETUNREACH);
 	}
 	pktlen = m->m_pkthdr.len;
-	ifp->if_opackets++;
-	ifp->if_obytes += pktlen;
+	if_statadd2(ifp, if_opackets, 1, if_obytes, pktlen);
 	switch (af) {
 #ifdef INET
 	case AF_INET:
@@ -225,8 +224,7 @@ faithoutput(struct ifnet *ifp, struct mb
 
 	s = splnet();
 	if (__predict_true(pktq_enqueue(pktq, m, 0))) {
-		ifp->if_ipackets++;
-		ifp->if_ibytes += pktlen;
+		if_statadd2(ifp, if_ipackets, 1, if_ibytes, pktlen);
 		error = 0;
 	} else {
 		m_freem(m);

Index: src/sys/net/if_gif.c
diff -u src/sys/net/if_gif.c:1.150 src/sys/net/if_gif.c:1.151
--- src/sys/net/if_gif.c:1.150	Wed Oct 30 03:45:59 2019
+++ src/sys/net/if_gif.c	Wed Jan 29 04:18:34 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_gif.c,v 1.150 2019/10/30 03:45:59 knakahara Exp $	*/
+/*	$NetBSD: if_gif.c,v 1.151 2020/01/29 04:18:34 thorpej Exp $	*/
 

CVS commit: src/sys/net

2020-01-28 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Jan 29 04:11:35 UTC 2020

Modified Files:
src/sys/net: if_arcsubr.c if_ethersubr.c

Log Message:
Adopt .


To generate a diff of this commit:
cvs rdiff -u -r1.80 -r1.81 src/sys/net/if_arcsubr.c
cvs rdiff -u -r1.281 -r1.282 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/net/if_arcsubr.c
diff -u src/sys/net/if_arcsubr.c:1.80 src/sys/net/if_arcsubr.c:1.81
--- src/sys/net/if_arcsubr.c:1.80	Wed May  9 06:35:10 2018
+++ src/sys/net/if_arcsubr.c	Wed Jan 29 04:11:35 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_arcsubr.c,v 1.80 2018/05/09 06:35:10 maxv Exp $	*/
+/*	$NetBSD: if_arcsubr.c,v 1.81 2020/01/29 04:11:35 thorpej Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Ignatios Souvatzis
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_arcsubr.c,v 1.80 2018/05/09 06:35:10 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_arcsubr.c,v 1.81 2020/01/29 04:11:35 thorpej Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -358,7 +358,7 @@ arc_defrag(struct ifnet *ifp, struct mbu
 	if (m->m_len < ARC_HDRNEWLEN) {
 		m = m_pullup(m, ARC_HDRNEWLEN);
 		if (m == NULL) {
-			++ifp->if_ierrors;
+			if_statinc(ifp, if_ierrors);
 			return NULL;
 		}
 	}
@@ -378,7 +378,7 @@ arc_defrag(struct ifnet *ifp, struct mbu
 		if (m->m_len < ARC_HDRNEWLEN) {
 			m = m_pullup(m, ARC_HDRNEWLEN);
 			if (m == NULL) {
-++ifp->if_ierrors;
+if_statinc(ifp, if_ierrors);
 return NULL;
 			}
 		}
@@ -524,11 +524,11 @@ arc_input(struct ifnet *ifp, struct mbuf
 
 	ah = mtod(m, struct arc_header *);
 
-	ifp->if_ibytes += m->m_pkthdr.len;
+	if_statadd(ifp, if_ibytes, m->m_pkthdr.len);
 
 	if (arcbroadcastaddr == ah->arc_dhost) {
 		m->m_flags |= M_BCAST|M_MCAST;
-		ifp->if_imcasts++;
+		if_statinc(ifp, if_imcasts);
 	}
 
 	atype = ah->arc_type;

Index: src/sys/net/if_ethersubr.c
diff -u src/sys/net/if_ethersubr.c:1.281 src/sys/net/if_ethersubr.c:1.282
--- src/sys/net/if_ethersubr.c:1.281	Thu Jan 16 13:16:59 2020
+++ src/sys/net/if_ethersubr.c	Wed Jan 29 04:11:35 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ethersubr.c,v 1.281 2020/01/16 13:16:59 kardel Exp $	*/
+/*	$NetBSD: if_ethersubr.c,v 1.282 2020/01/29 04:11:35 thorpej Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -61,7 +61,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_ethersubr.c,v 1.281 2020/01/16 13:16:59 kardel Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ethersubr.c,v 1.282 2020/01/29 04:11:35 thorpej Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -438,7 +438,7 @@ ether_output(struct ifnet * const ifp0, 
 
 #if NCARP > 0
 	if (ifp != ifp0)
-		ifp0->if_obytes += m->m_pkthdr.len + ETHER_HDR_LEN;
+		if_statadd(ifp0, if_obytes, m->m_pkthdr.len + ETHER_HDR_LEN);
 #endif
 
 #ifdef ALTQ
@@ -623,7 +623,7 @@ ether_input(struct ifnet *ifp, struct mb
 		}
 		mutex_exit(_lock);
 #endif
-		ifp->if_iqdrops++;
+		if_statinc(ifp, if_iqdrops);
 		m_freem(m);
 		return;
 	}
@@ -645,7 +645,7 @@ ether_input(struct ifnet *ifp, struct mb
 			m->m_flags |= M_BCAST;
 		else
 			m->m_flags |= M_MCAST;
-		ifp->if_imcasts++;
+		if_statinc(ifp, if_imcasts);
 	}
 
 	/* If the CRC is still on the packet, trim it off. */
@@ -654,7 +654,7 @@ ether_input(struct ifnet *ifp, struct mb
 		m->m_flags &= ~M_HASFCS;
 	}
 
-	ifp->if_ibytes += m->m_pkthdr.len;
+	if_statadd(ifp, if_ibytes, m->m_pkthdr.len);
 
 #if NCARP > 0
 	if (__predict_false(ifp->if_carp && ifp->if_type != IFT_CARP)) {



CVS commit: src/tests/lib/libc/sys

2020-01-28 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Wed Jan 29 03:51:56 UTC 2020

Modified Files:
src/tests/lib/libc/sys: t_ptrace_wait.c

Log Message:
Add new fork/vfork/posix_spawn ATF tests in t_ptrace_wait*

Add unrelated tracer variation of tests: fork1-16, vfork1-16,
posix_spawn1-16.

All tests pass.


To generate a diff of this commit:
cvs rdiff -u -r1.148 -r1.149 src/tests/lib/libc/sys/t_ptrace_wait.c

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

Modified files:

Index: src/tests/lib/libc/sys/t_ptrace_wait.c
diff -u src/tests/lib/libc/sys/t_ptrace_wait.c:1.148 src/tests/lib/libc/sys/t_ptrace_wait.c:1.149
--- src/tests/lib/libc/sys/t_ptrace_wait.c:1.148	Thu Jan 23 06:17:21 2020
+++ src/tests/lib/libc/sys/t_ptrace_wait.c	Wed Jan 29 03:51:56 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_ptrace_wait.c,v 1.148 2020/01/23 06:17:21 martin Exp $	*/
+/*	$NetBSD: t_ptrace_wait.c,v 1.149 2020/01/29 03:51:56 kamil Exp $	*/
 
 /*-
  * Copyright (c) 2016, 2017, 2018, 2019 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: t_ptrace_wait.c,v 1.148 2020/01/23 06:17:21 martin Exp $");
+__RCSID("$NetBSD: t_ptrace_wait.c,v 1.149 2020/01/29 03:51:56 kamil Exp $");
 
 #define __LEGACY_PT_LWPINFO
 
@@ -3312,6 +3312,374 @@ FORK_TEST(posix_spawn16, "spawn", true, 
 
 #if defined(TWAIT_HAVE_PID)
 static void
+unrelated_tracer_fork_body(const char *fn, bool trackspawn, bool trackfork,
+bool trackvfork, bool trackvforkdone)
+{
+	const int sigval = SIGSTOP;
+	struct msg_fds parent_tracee, parent_tracer;
+	const int exitval = 10;
+	const int exitval2 = 0; /* This matched exit status from /bin/echo */
+	pid_t tracee, tracer, wpid;
+	pid_t tracee2 = 0;
+	uint8_t msg = 0xde; /* dummy message for IPC based on pipe(2) */
+#if defined(TWAIT_HAVE_STATUS)
+	int status;
+#endif
+
+	struct ptrace_siginfo info;
+	ptrace_state_t state;
+	const int slen = sizeof(state);
+	ptrace_event_t event;
+	const int elen = sizeof(event);
+
+	char * const arg[] = { __UNCONST("/bin/echo"), NULL };
+
+	DPRINTF("Spawn tracee\n");
+	SYSCALL_REQUIRE(msg_open(_tracee) == 0);
+	tracee = atf_utils_fork();
+	if (tracee == 0) {
+		// Wait for parent to let us crash
+		CHILD_FROM_PARENT("exit tracee", parent_tracee, msg);
+
+		DPRINTF("Before raising %s from child\n", strsignal(sigval));
+		FORKEE_ASSERT(raise(sigval) == 0);
+
+		if (strcmp(fn, "spawn") == 0) {
+			FORKEE_ASSERT_EQ(posix_spawn(,
+			arg[0], NULL, NULL, arg, NULL), 0);
+		} else {
+			if (strcmp(fn, "fork") == 0) {
+FORKEE_ASSERT((tracee2 = fork()) != -1);
+			} else if (strcmp(fn, "vfork") == 0) {
+FORKEE_ASSERT((tracee2 = vfork()) != -1);
+			}
+
+			if (tracee2 == 0)
+_exit(exitval2);
+		}
+		FORKEE_REQUIRE_SUCCESS
+		(wpid = TWAIT_GENERIC(tracee2, , 0), tracee2);
+
+		forkee_status_exited(status, exitval2);
+
+		DPRINTF("Before exiting of the child process\n");
+		_exit(exitval);
+	}
+
+	DPRINTF("Spawn debugger\n");
+	SYSCALL_REQUIRE(msg_open(_tracer) == 0);
+	tracer = atf_utils_fork();
+	if (tracer == 0) {
+		/* Fork again and drop parent to reattach to PID 1 */
+		tracer = atf_utils_fork();
+		if (tracer != 0)
+			_exit(exitval);
+
+		DPRINTF("Before calling PT_ATTACH from tracee %d\n", getpid());
+		FORKEE_ASSERT(ptrace(PT_ATTACH, tracee, NULL, 0) != -1);
+
+		/* Wait for tracee and assert that it was stopped w/ SIGSTOP */
+		FORKEE_REQUIRE_SUCCESS(
+		wpid = TWAIT_GENERIC(tracee, , 0), tracee);
+
+		forkee_status_stopped(status, SIGSTOP);
+
+		DPRINTF("Before calling ptrace(2) with PT_GET_SIGINFO for the "
+		"traced process\n");
+		SYSCALL_REQUIRE(
+		ptrace(PT_GET_SIGINFO, tracee, , sizeof(info)) != -1);
+
+		DPRINTF("Signal traced to lwpid=%d\n", info.psi_lwpid);
+		DPRINTF("Signal properties: si_signo=%#x si_code=%#x "
+		"si_errno=%#x\n", info.psi_siginfo.si_signo,
+		info.psi_siginfo.si_code, info.psi_siginfo.si_errno);
+
+		FORKEE_ASSERT_EQ(info.psi_siginfo.si_signo, SIGSTOP);
+		FORKEE_ASSERT_EQ(info.psi_siginfo.si_code, SI_USER);
+
+		/* Resume tracee with PT_CONTINUE */
+		FORKEE_ASSERT(ptrace(PT_CONTINUE, tracee, (void *)1, 0) != -1);
+
+		/* Inform parent that tracer has attached to tracee */
+		CHILD_TO_PARENT("tracer ready", parent_tracer, msg);
+
+		/* Wait for parent to tell use that tracee should have exited */
+		CHILD_FROM_PARENT("wait for tracee exit", parent_tracer, msg);
+
+		/* Wait for tracee and assert that it exited */
+		FORKEE_REQUIRE_SUCCESS(
+		wpid = TWAIT_GENERIC(tracee, , 0), tracee);
+
+		forkee_status_stopped(status, sigval);
+
+		DPRINTF("Before calling ptrace(2) with PT_GET_SIGINFO for the "
+		"traced process\n");
+		SYSCALL_REQUIRE(
+		ptrace(PT_GET_SIGINFO, tracee, , sizeof(info)) != -1);
+
+		DPRINTF("Signal traced to lwpid=%d\n", info.psi_lwpid);
+		DPRINTF("Signal properties: si_signo=%#x si_code=%#x "
+		"si_errno=%#x\n", info.psi_siginfo.si_signo,
+		info.psi_siginfo.si_code, 

CVS commit: src/distrib/sets/lists/comp

2020-01-28 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Jan 29 03:17:34 UTC 2020

Modified Files:
src/distrib/sets/lists/comp: mi

Log Message:
Add .


To generate a diff of this commit:
cvs rdiff -u -r1.2305 -r1.2306 src/distrib/sets/lists/comp/mi

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

Modified files:

Index: src/distrib/sets/lists/comp/mi
diff -u src/distrib/sets/lists/comp/mi:1.2305 src/distrib/sets/lists/comp/mi:1.2306
--- src/distrib/sets/lists/comp/mi:1.2305	Mon Jan 20 18:38:18 2020
+++ src/distrib/sets/lists/comp/mi	Wed Jan 29 03:17:34 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: mi,v 1.2305 2020/01/20 18:38:18 thorpej Exp $
+#	$NetBSD: mi,v 1.2306 2020/01/29 03:17:34 thorpej Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 ./etc/mtree/set.compcomp-sys-root
@@ -2363,6 +2363,7 @@
 ./usr/include/net/if_slvar.h			comp-obsolete		obsolete
 ./usr/include/net/if_sppp.h			comp-c-include
 ./usr/include/net/if_srt.h			comp-c-include
+./usr/include/net/if_stats.h			comp-c-include
 ./usr/include/net/if_stf.h			comp-c-include
 ./usr/include/net/if_stripvar.h			comp-obsolete		obsolete
 ./usr/include/net/if_tap.h			comp-c-include



CVS commit: src/sys/net

2020-01-28 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Jan 29 03:16:28 UTC 2020

Modified Files:
src/sys/net: Makefile files.net if.c if.h
Added Files:
src/sys/net: if_stats.c if_stats.h

Log Message:
Add support for MP-safe network interface statistics by maintaining them
in per-cpu storage, and collecting them for export in an if_data structure
when user-space wants them.

The new if_stat API is structured to make a gradual transition to the
new way in network drivers possible, and per-cpu stats are currently
disabled (thus there is no kernel ABI change).  Once all drivers have
been converted, the old ABI will be removed, and per-cpu stats will be
enabled universally.


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/sys/net/Makefile
cvs rdiff -u -r1.24 -r1.25 src/sys/net/files.net
cvs rdiff -u -r1.468 -r1.469 src/sys/net/if.c
cvs rdiff -u -r1.277 -r1.278 src/sys/net/if.h
cvs rdiff -u -r0 -r1.1 src/sys/net/if_stats.c src/sys/net/if_stats.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/net/Makefile
diff -u src/sys/net/Makefile:1.41 src/sys/net/Makefile:1.42
--- src/sys/net/Makefile:1.41	Mon Jan 20 18:38:18 2020
+++ src/sys/net/Makefile	Wed Jan 29 03:16:28 2020
@@ -1,12 +1,12 @@
-#	$NetBSD: Makefile,v 1.41 2020/01/20 18:38:18 thorpej Exp $
+#	$NetBSD: Makefile,v 1.42 2020/01/29 03:16:28 thorpej Exp $
 
 INCSDIR= /usr/include/net
 
 INCS=	bpf.h bpfjit.h bpfdesc.h dlt.h ethertypes.h if.h if_arc.h if_arp.h \
 	if_bridgevar.h if_dl.h if_ether.h if_gif.h \
 	if_gre.h if_ieee1394.h if_ipsec.h if_llc.h if_media.h if_mpls.h \
-	if_pflog.h if_ppp.h if_pppoe.h if_l2tp.h if_sppp.h if_srt.h if_stf.h \
-	if_tap.h if_tun.h if_types.h if_vlanvar.h net_stats.h \
+	if_pflog.h if_ppp.h if_pppoe.h if_l2tp.h if_sppp.h if_srt.h if_stats.h \
+	if_stf.h if_tap.h if_tun.h if_types.h if_vlanvar.h net_stats.h \
 	netisr.h pfil.h pfkeyv2.h pfvar.h ppp-comp.h ppp_defs.h radix.h \
 	raw_cb.h route.h slcompress.h slip.h zlib.h
 

Index: src/sys/net/files.net
diff -u src/sys/net/files.net:1.24 src/sys/net/files.net:1.25
--- src/sys/net/files.net:1.24	Mon Jan 20 18:38:18 2020
+++ src/sys/net/files.net	Wed Jan 29 03:16:28 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: files.net,v 1.24 2020/01/20 18:38:18 thorpej Exp $
+#	$NetBSD: files.net,v 1.25 2020/01/29 03:16:28 thorpej Exp $
 
 # XXX CLEANUP
 define	net
@@ -25,6 +25,7 @@ file	net/if_media.c			net
 file	net/if_mpls.c			mpls			needs-flag
 file	net/if_ppp.c			ppp			needs-flag
 file	net/if_srt.c			srt
+file	net/if_stats.c			net
 file	net/if_stf.c			stf & inet & inet6	needs-flag
 file	net/if_sl.c			sl			needs-flag
 file	net/if_spppsubr.c		sppp

Index: src/sys/net/if.c
diff -u src/sys/net/if.c:1.468 src/sys/net/if.c:1.469
--- src/sys/net/if.c:1.468	Mon Jan 20 18:38:18 2020
+++ src/sys/net/if.c	Wed Jan 29 03:16:28 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if.c,v 1.468 2020/01/20 18:38:18 thorpej Exp $	*/
+/*	$NetBSD: if.c,v 1.469 2020/01/29 03:16:28 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2008 The NetBSD Foundation, Inc.
@@ -90,7 +90,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.468 2020/01/20 18:38:18 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.469 2020/01/29 03:16:28 thorpej Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_inet.h"
@@ -733,6 +733,9 @@ if_initialize(ifnet_t *ifp)
 	psref_target_init(>if_psref, ifnet_psref_class);
 	ifp->if_ioctl_lock = mutex_obj_alloc(MUTEX_DEFAULT, IPL_NONE);
 	LIST_INIT(>if_multiaddrs);
+	if ((rv = if_stats_init(ifp)) != 0) {
+		goto fail;
+	}
 
 	IFNET_GLOBAL_LOCK();
 	if_getindex(ifp);
@@ -816,7 +819,7 @@ if_percpuq_softint(void *arg)
 	struct mbuf *m;
 
 	while ((m = if_percpuq_dequeue(ipq)) != NULL) {
-		ifp->if_ipackets++;
+		if_statinc(ifp, if_ipackets);
 		bpf_mtap(ifp, m, BPF_D_IN);
 
 		ifp->_if_input(ifp, m);
@@ -1110,7 +1113,7 @@ if_input(struct ifnet *ifp, struct mbuf 
 	KASSERT(ifp->if_percpuq == NULL);
 	KASSERT(!cpu_intr_p());
 
-	ifp->if_ipackets++;
+	if_statinc(ifp, if_ipackets);
 	bpf_mtap(ifp, m, BPF_D_IN);
 
 	ifp->_if_input(ifp, m);
@@ -1521,6 +1524,7 @@ restart:
 	mutex_obj_free(ifp->if_ioctl_lock);
 	ifp->if_ioctl_lock = NULL;
 	mutex_obj_free(ifp->if_snd.ifq_lock);
+	if_stats_fini(ifp);
 
 	splx(s);
 
@@ -2959,6 +2963,22 @@ void if_tunnel_ro_percpu_rtcache_free(pe
 	percpu_foreach(ro_percpu, if_tunnel_rtcache_free_pc, NULL);
 }
 
+void
+if_export_if_data(ifnet_t * const ifp, struct if_data *ifi, bool zero_stats)
+{
+
+	/* Collet the volatile stats first; this zeros *ifi. */
+	if_stats_to_if_data(ifp, ifi, zero_stats);
+
+	ifi->ifi_type = ifp->if_type;
+	ifi->ifi_addrlen = ifp->if_addrlen;
+	ifi->ifi_hdrlen = ifp->if_hdrlen;
+	ifi->ifi_link_state = ifp->if_link_state;
+	ifi->ifi_mtu = ifp->if_mtu;
+	ifi->ifi_metric = ifp->if_metric;
+	ifi->ifi_baudrate = ifp->if_baudrate;
+	ifi->ifi_lastchange = ifp->if_lastchange;
+}
 
 /* common */
 int
@@ -3083,7 +3103,7 @@ 

CVS commit: src/sys/net

2020-01-28 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Jan 29 03:04:55 UTC 2020

Modified Files:
src/sys/net: net_stats.h

Log Message:
- Make _NET_STAT_GETREF()'s return value a net_stat_ref_t, which is
  defined as a "void *" to prevent using a net_stat_ref_t as an array.
- For each _NET_STATADD(), etc. macro, also define a _NET_STATADD_REF()
  macro that takes a ref returned by _NET_STAT_GETREF() as an argument.
  This is intended to replace direct subscripting of the refernce;
  consumers of this API will be updated in future commits.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/net/net_stats.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/net/net_stats.h
diff -u src/sys/net/net_stats.h:1.4 src/sys/net/net_stats.h:1.5
--- src/sys/net/net_stats.h:1.4	Fri Sep  5 06:01:24 2014
+++ src/sys/net/net_stats.h	Wed Jan 29 03:04:55 2020
@@ -1,7 +1,7 @@
-/*	$NetBSD: net_stats.h,v 1.4 2014/09/05 06:01:24 matt Exp $	*/
+/*	$NetBSD: net_stats.h,v 1.5 2020/01/29 03:04:55 thorpej Exp $	*/
 
 /*-
- * Copyright (c) 2008 The NetBSD Foundation, Inc.
+ * Copyright (c) 2008, 2020 The NetBSD Foundation, Inc.
  * All rights reserved.
  *
  * This code is derived from software contributed to The NetBSD Foundation
@@ -35,34 +35,60 @@
 #ifdef _KERNEL
 #include 
 
-#define	_NET_STAT_GETREF(stat)	((uint64_t *)percpu_getref((stat)))
+typedef void *net_stat_ref_t;
+
+#define	_NET_STAT_GETREF(stat)	((net_stat_ref_t)percpu_getref((stat)))
 #define	_NET_STAT_PUTREF(stat)	percpu_putref((stat))
 
-#define	_NET_STATINC(stat, x)		\
+#define	_NET_STATINC_REF(r, x)		\
 do {	\
-	uint64_t *_stat_ = _NET_STAT_GETREF(stat);			\
+	uint64_t *_stat_ = (r);		\
 	_stat_[x]++;			\
+} while (/*CONSTCOND*/0)
+
+#define	_NET_STATINC(stat, x)		\
+do {	\
+	net_stat_ref_t _nsr_ = _NET_STAT_GETREF(stat);			\
+	_NET_STATINC_REF(_nsr_, x);	\
 	_NET_STAT_PUTREF(stat);		\
 } while (/*CONSTCOND*/0)
 
-#define	_NET_STATDEC(stat, x)		\
+#define	_NET_STATDEC_REF(r, x)		\
 do {	\
-	uint64_t *_stat_ = _NET_STAT_GETREF(stat);			\
+	uint64_t *_stat_ = (r);		\
 	_stat_[x]--;			\
+} while (/*CONSTCOND*/0)
+
+#define	_NET_STATDEC(stat, x)		\
+do {	\
+	net_stat_ref_t _nsr_ = _NET_STAT_GETREF(stat);			\
+	_NET_STATDEC_REF(_nsr_, x);	\
 	_NET_STAT_PUTREF(stat);		\
 } while (/*CONSTCOND*/0)
 
-#define	_NET_STATADD(stat, x, v)	\
+#define	_NET_STATADD_REF(r, x, v)	\
 do {	\
-	uint64_t *_stat_ = _NET_STAT_GETREF(stat);			\
+	uint64_t *_stat_ = (r);		\
 	_stat_[x] += (v);		\
+} while (/*CONSTCOND*/0)
+
+#define	_NET_STATADD(stat, x, v)	\
+do {	\
+	net_stat_ref_t _nsr_ = _NET_STAT_GETREF(stat);			\
+	_NET_STATADD_REF(_nsr_, x, v);	\
 	_NET_STAT_PUTREF(stat);		\
 } while (/*CONSTCOND*/0)
 
-#define	_NET_STATSUB(stat, x, v)	\
+#define	_NET_STATSUB_REF(r, x, v)	\
 do {	\
-	uint64_t *_stat_ = _NET_STAT_GETREF(stat);			\
+	uint64_t *_stat_ = (r);		\
 	_stat_[x] -= (v);		\
+} while (/*CONSTCOND*/0)
+
+#define	_NET_STATSUB(stat, x, v)	\
+do {	\
+	net_stat_ref_t _nsr_ = _NET_STAT_GETREF(stat);			\
+	_NET_STATSUB_REF(_nsr_, x, v);	\
 	_NET_STAT_PUTREF(stat);		\
 } while (/*CONSTCOND*/0)
 



CVS commit: src/sys/arch/x86/pci

2020-01-28 Thread Kengo NAKAHARA
Module Name:src
Committed By:   knakahara
Date:   Wed Jan 29 02:58:51 UTC 2020

Modified Files:
src/sys/arch/x86/pci: if_vmx.c

Log Message:
Fix typo in evcnt description.  Pointed out by yamaguchi@n.o.


To generate a diff of this commit:
cvs rdiff -u -r1.54 -r1.55 src/sys/arch/x86/pci/if_vmx.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/arch/x86/pci/if_vmx.c
diff -u src/sys/arch/x86/pci/if_vmx.c:1.54 src/sys/arch/x86/pci/if_vmx.c:1.55
--- src/sys/arch/x86/pci/if_vmx.c:1.54	Mon Jan  6 07:15:03 2020
+++ src/sys/arch/x86/pci/if_vmx.c	Wed Jan 29 02:58:51 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_vmx.c,v 1.54 2020/01/06 07:15:03 msaitoh Exp $	*/
+/*	$NetBSD: if_vmx.c,v 1.55 2020/01/29 02:58:51 knakahara Exp $	*/
 /*	$OpenBSD: if_vmx.c,v 1.16 2014/01/22 06:04:17 brad Exp $	*/
 
 /*
@@ -19,7 +19,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_vmx.c,v 1.54 2020/01/06 07:15:03 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_vmx.c,v 1.55 2020/01/29 02:58:51 knakahara Exp $");
 
 #include 
 #include 
@@ -1966,9 +1966,9 @@ vmxnet3_setup_stats(struct vmxnet3_softc
 		evcnt_attach_dynamic(>vxtxq_transmitdef, EVCNT_TYPE_MISC,
 		NULL, txq->vxtxq_name, "Deferred transmit");
 		evcnt_attach_dynamic(>vxtxq_watchdogto, EVCNT_TYPE_MISC,
-		NULL, txq->vxtxq_name, "Watchdog timeount");
+		NULL, txq->vxtxq_name, "Watchdog timeout");
 		evcnt_attach_dynamic(>vxtxq_defragged, EVCNT_TYPE_MISC,
-		NULL, txq->vxtxq_name, "m_defrag sucessed");
+		NULL, txq->vxtxq_name, "m_defrag successed");
 		evcnt_attach_dynamic(>vxtxq_defrag_failed, EVCNT_TYPE_MISC,
 		NULL, txq->vxtxq_name, "m_defrag failed");
 	}



CVS commit: src/sys/dev/pci

2020-01-28 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Jan 29 02:16:02 UTC 2020

Modified Files:
src/sys/dev/pci: if_casreg.h if_casvar.h

Log Message:
u_int{32,64}_t -> uint{32,64}_t. No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/pci/if_casreg.h
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/pci/if_casvar.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/if_casreg.h
diff -u src/sys/dev/pci/if_casreg.h:1.2 src/sys/dev/pci/if_casreg.h:1.3
--- src/sys/dev/pci/if_casreg.h:1.2	Thu Dec 26 17:51:08 2019
+++ src/sys/dev/pci/if_casreg.h	Wed Jan 29 02:16:02 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_casreg.h,v 1.2 2019/12/26 17:51:08 msaitoh Exp $ */
+/*	$NetBSD: if_casreg.h,v 1.3 2020/01/29 02:16:02 msaitoh Exp $ */
 /*	$OpenBSD: if_casreg.h,v 1.10 2008/05/31 22:49:03 kettenis Exp $	*/
 
 /*
@@ -586,7 +586,7 @@ struct cas_desc {
 
 /* Completion ring */
 struct cas_comp {
-	u_int64_t	cc_word[4];
+	uint64_t	cc_word[4];
 };
 
 #define	CAS_RC0_TYPE		0xc000ULL

Index: src/sys/dev/pci/if_casvar.h
diff -u src/sys/dev/pci/if_casvar.h:1.7 src/sys/dev/pci/if_casvar.h:1.8
--- src/sys/dev/pci/if_casvar.h:1.7	Thu Dec 26 17:51:08 2019
+++ src/sys/dev/pci/if_casvar.h	Wed Jan 29 02:16:02 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_casvar.h,v 1.7 2019/12/26 17:51:08 msaitoh Exp $ */
+/*	$NetBSD: if_casvar.h,v 1.8 2020/01/29 02:16:02 msaitoh Exp $ */
 /*	$OpenBSD: if_casvar.h,v 1.6 2009/06/13 12:18:58 kettenis Exp $	*/
 
 /*
@@ -183,7 +183,7 @@ struct cas_softc {
 	 * Software state for transmit and receive descriptors.
 	 */
 	struct cas_sxd sc_txd[CAS_NTXDESC];
-	u_int32_t sc_tx_cnt, sc_tx_prod, sc_tx_cons;
+	uint32_t sc_tx_cnt, sc_tx_prod, sc_tx_cons;
 
 	struct cas_rxsoft sc_rxsoft[CAS_NRXDESC];
 	struct cas_rxsoft sc_rxsoft2[CAS_NRXDESC];



CVS commit: src/sys/arch/x86/x86

2020-01-28 Thread Emmanuel Dreyfus
Module Name:src
Committed By:   manu
Date:   Wed Jan 29 01:54:34 UTC 2020

Modified Files:
src/sys/arch/x86/x86: x86_machdep.c

Log Message:
Fix startup crashes caused by wrong memory map handling

init_x86_vm() takes the memory map from BIOS and EFI and selects
regions suitable for memory allocation. This involves removing
areas used by the kernel, but the logic missed some corner cases,
which led to possible allocation in regions for which later memory
access would cause a panic.

The typical panic from this bug in GENERIC is at SVS startup:
cpu_svs_init / uvm_pagealloc_strat / pagezero

We fix the bug by adding logic for the missing cases of memory
regions overlapping with the kernel. While there, add more #idef'ed
debug output.


To generate a diff of this commit:
cvs rdiff -u -r1.134 -r1.135 src/sys/arch/x86/x86/x86_machdep.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/arch/x86/x86/x86_machdep.c
diff -u src/sys/arch/x86/x86/x86_machdep.c:1.134 src/sys/arch/x86/x86/x86_machdep.c:1.135
--- src/sys/arch/x86/x86/x86_machdep.c:1.134	Sat Dec 28 00:38:08 2019
+++ src/sys/arch/x86/x86/x86_machdep.c	Wed Jan 29 01:54:34 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: x86_machdep.c,v 1.134 2019/12/28 00:38:08 pgoyette Exp $	*/
+/*	$NetBSD: x86_machdep.c,v 1.135 2020/01/29 01:54:34 manu Exp $	*/
 
 /*-
  * Copyright (c) 2002, 2006, 2007 YAMAMOTO Takashi,
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: x86_machdep.c,v 1.134 2019/12/28 00:38:08 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: x86_machdep.c,v 1.135 2020/01/29 01:54:34 manu Exp $");
 
 #include "opt_modular.h"
 #include "opt_physmem.h"
@@ -669,7 +669,7 @@ x86_parse_clusters(struct btinfo_memmap 
 		type = bim->entry[x].type;
 #ifdef DEBUG_MEMLOAD
 		printf("MEMMAP: 0x%016" PRIx64 "-0x%016" PRIx64
-		", size=0x%016" PRIx64 ", type=%d(%s)\n",
+		"\n\tsize=0x%016" PRIx64 ", type=%d(%s)\n",
 		addr, addr + size - 1, size, type,
 		(type == BIM_Memory) ?  "Memory" :
 		(type == BIM_Reserved) ?  "Reserved" :
@@ -909,27 +909,95 @@ init_x86_vm(paddr_t pa_kend)
 		seg_start1 = 0;
 		seg_end1 = 0;
 
+#ifdef DEBUG_MEMLOAD
+		printf("segment %" PRIx64 " - %" PRIx64 "\n",
+		seg_start, seg_end);
+#endif
+
 		/* Skip memory before our available starting point. */
-		if (seg_end <= lowmem_rsvd)
+		if (seg_end <= lowmem_rsvd) {
+#ifdef DEBUG_MEMLOAD
+			printf("discard segment below starting point "
+			"%" PRIx64 " - %" PRIx64 "\n", seg_start, seg_end);
+#endif
 			continue;
+		}
 
 		if (seg_start <= lowmem_rsvd && lowmem_rsvd < seg_end) {
 			seg_start = lowmem_rsvd;
-			if (seg_start == seg_end)
+			if (seg_start == seg_end) {
+#ifdef DEBUG_MEMLOAD
+printf("discard segment below starting point "
+"%" PRIx64 " - %" PRIx64 "\n",
+seg_start, seg_end);
+
+
+#endif
 continue;
+			}
 		}
 
 		/*
 		 * If this segment contains the kernel, split it in two, around
 		 * the kernel.
+		 *  [seg_start   seg_end]
+		 * [pa_kstart  pa_kend]
 		 */
 		if (seg_start <= pa_kstart && pa_kend <= seg_end) {
+#ifdef DEBUG_MEMLOAD
+			printf("split kernel overlapping to "
+			"%" PRIx64 " - %lx and %lx - %" PRIx64 "\n",
+			seg_start, pa_kstart, pa_kend, seg_end);
+#endif
 			seg_start1 = pa_kend;
 			seg_end1 = seg_end;
 			seg_end = pa_kstart;
 			KASSERT(seg_end < seg_end1);
 		}
 
+		/*
+		 * Discard a segment inside the kernel
+		 *  [pa_kstart   pa_kend]
+		 * [seg_start  seg_end]
+		 */
+		if (pa_kstart < seg_start && seg_end < pa_kend) {
+#ifdef DEBUG_MEMLOAD
+			printf("discard complete kernel overlap "
+			"%" PRIx64 " - %" PRIx64 "\n", seg_start, seg_end);
+#endif
+			continue;
+		}
+
+		/*
+		 * Discard leading hunk that overlaps the kernel
+		 *  [pa_kstart pa_kend]
+		 *[seg_startseg_end]
+		 */
+		if (pa_kstart < seg_start &&
+		seg_start < pa_kend &&
+		pa_kend < seg_end) {
+#ifdef DEBUG_MEMLOAD
+			printf("discard leading kernel overlap "
+			"%" PRIx64 " - %lx\n", seg_start, pa_kend);
+#endif
+			seg_start = pa_kend;
+		}
+
+		/*
+		 * Discard trailing hunk that overlaps the kernel
+		 * [pa_kstartpa_kend]
+		 *  [seg_start  seg_end]
+		 */
+		if (seg_start < pa_kstart &&
+		pa_kstart < seg_end &&
+		seg_end < pa_kend) {
+#ifdef DEBUG_MEMLOAD
+			printf("discard trailing kernel overlap "
+			"%lx - %" PRIx64 "\n", pa_kstart, seg_end);
+#endif
+			seg_end = pa_kstart;
+		}
+		
 		/* First hunk */
 		if (seg_start != seg_end) {
 			x86_load_region(seg_start, seg_end);



CVS commit: src/sys/external/bsd/drm2/ttm

2020-01-28 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Tue Jan 28 23:24:09 UTC 2020

Modified Files:
src/sys/external/bsd/drm2/ttm: ttm_bo_vm.c

Log Message:
Do not extract mmap flags from the bus_space_mmap cookie as they may
conflict with the bo's existing protection flags. This caused VRAM to
be incorrectly mapped as Device-nGnRE on Arm64 instead of Normal-NC. Ok
riastradh@.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/external/bsd/drm2/ttm/ttm_bo_vm.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/external/bsd/drm2/ttm/ttm_bo_vm.c
diff -u src/sys/external/bsd/drm2/ttm/ttm_bo_vm.c:1.12 src/sys/external/bsd/drm2/ttm/ttm_bo_vm.c:1.13
--- src/sys/external/bsd/drm2/ttm/ttm_bo_vm.c:1.12	Sat Mar  9 01:59:47 2019
+++ src/sys/external/bsd/drm2/ttm/ttm_bo_vm.c	Tue Jan 28 23:24:09 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: ttm_bo_vm.c,v 1.12 2019/03/09 01:59:47 mrg Exp $	*/
+/*	$NetBSD: ttm_bo_vm.c,v 1.13 2020/01/28 23:24:09 jmcneill Exp $	*/
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ttm_bo_vm.c,v 1.12 2019/03/09 01:59:47 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ttm_bo_vm.c,v 1.13 2020/01/28 23:24:09 jmcneill Exp $");
 
 #include 
 
@@ -89,7 +89,6 @@ ttm_bo_uvm_fault(struct uvm_faultinfo *u
 	unsigned i;
 	vm_prot_t vm_prot;	/* VM_PROT_* */
 	pgprot_t pgprot;	/* VM_PROT_* | PMAP_* cacheability flags */
-	unsigned mmapflags;
 	int ret;
 
 	/* Thanks, uvm, but we don't need this lock.  */
@@ -189,13 +188,11 @@ ttm_bo_uvm_fault(struct uvm_faultinfo *u
 			0);
 
 			paddr = pmap_phys_address(cookie);
-			mmapflags = pmap_mmap_flags(cookie);
 		} else {
 			paddr = page_to_phys(u.ttm->pages[startpage + i]);
-			mmapflags = 0;
 		}
 		ret = -pmap_enter(ufi->orig_map->pmap, vaddr + i*PAGE_SIZE,
-		paddr, vm_prot, (PMAP_CANFAIL | pgprot | mmapflags));
+		paddr, vm_prot, (PMAP_CANFAIL | pgprot));
 		if (ret)
 			goto out3;
 	}



CVS commit: src/sys/external/bsd/drm2/dist/drm/ttm

2020-01-28 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Tue Jan 28 23:21:05 UTC 2020

Modified Files:
src/sys/external/bsd/drm2/dist/drm/ttm: ttm_bo_util.c

Log Message:
ttm_io_prot: follow linux semantics and set either PMAP_WRITE_COMBINE or
PMAP_NOCACHE when existing cache flags are not set


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 \
src/sys/external/bsd/drm2/dist/drm/ttm/ttm_bo_util.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/external/bsd/drm2/dist/drm/ttm/ttm_bo_util.c
diff -u src/sys/external/bsd/drm2/dist/drm/ttm/ttm_bo_util.c:1.14 src/sys/external/bsd/drm2/dist/drm/ttm/ttm_bo_util.c:1.15
--- src/sys/external/bsd/drm2/dist/drm/ttm/ttm_bo_util.c:1.14	Thu Aug 30 01:19:49 2018
+++ src/sys/external/bsd/drm2/dist/drm/ttm/ttm_bo_util.c	Tue Jan 28 23:21:05 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: ttm_bo_util.c,v 1.14 2018/08/30 01:19:49 riastradh Exp $	*/
+/*	$NetBSD: ttm_bo_util.c,v 1.15 2020/01/28 23:21:05 jmcneill Exp $	*/
 
 /**
  *
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ttm_bo_util.c,v 1.14 2018/08/30 01:19:49 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ttm_bo_util.c,v 1.15 2020/01/28 23:21:05 jmcneill Exp $");
 
 #include 
 #include 
@@ -565,17 +565,11 @@ pgprot_t ttm_io_prot(uint32_t caching_fl
 		return tmp;
 
 #ifdef __NetBSD__
-	switch (caching_flags & TTM_PL_MASK_CACHING) {
-	case TTM_PL_FLAG_CACHED:
-		return (tmp | PMAP_WRITE_BACK);
-	case TTM_PL_FLAG_WC:
+	tmp &= ~PMAP_CACHE_MASK;
+	if (caching_flags & TTM_PL_FLAG_WC)
 		return (tmp | PMAP_WRITE_COMBINE);
-	case TTM_PL_FLAG_UNCACHED:
+	else
 		return (tmp | PMAP_NOCACHE);
-	default:
-		panic("invalid caching flags: %"PRIx32"\n",
-		(caching_flags & TTM_PL_MASK_CACHING));
-	}
 #else
 #if defined(__i386__) || defined(__x86_64__)
 	if (caching_flags & TTM_PL_FLAG_WC)



CVS commit: src/common/lib/libc/gen

2020-01-28 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Tue Jan 28 22:20:45 UTC 2020

Modified Files:
src/common/lib/libc/gen: radixtree.c

Log Message:
gang_lookup_scan(): if a dense scan and the first sibling doesn't match,
the scan is finished.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/common/lib/libc/gen/radixtree.c

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

Modified files:

Index: src/common/lib/libc/gen/radixtree.c
diff -u src/common/lib/libc/gen/radixtree.c:1.22 src/common/lib/libc/gen/radixtree.c:1.23
--- src/common/lib/libc/gen/radixtree.c:1.22	Tue Jan 28 16:33:34 2020
+++ src/common/lib/libc/gen/radixtree.c	Tue Jan 28 22:20:45 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: radixtree.c,v 1.22 2020/01/28 16:33:34 ad Exp $	*/
+/*	$NetBSD: radixtree.c,v 1.23 2020/01/28 22:20:45 ad Exp $	*/
 
 /*-
  * Copyright (c)2011,2012,2013 YAMAMOTO Takashi,
@@ -112,7 +112,7 @@
 #include 
 
 #if defined(_KERNEL) || defined(_STANDALONE)
-__KERNEL_RCSID(0, "$NetBSD: radixtree.c,v 1.22 2020/01/28 16:33:34 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: radixtree.c,v 1.23 2020/01/28 22:20:45 ad Exp $");
 #include 
 #include 
 #include 
@@ -122,7 +122,7 @@ __KERNEL_RCSID(0, "$NetBSD: radixtree.c,
 #include 
 #endif /* defined(_STANDALONE) */
 #else /* defined(_KERNEL) || defined(_STANDALONE) */
-__RCSID("$NetBSD: radixtree.c,v 1.22 2020/01/28 16:33:34 ad Exp $");
+__RCSID("$NetBSD: radixtree.c,v 1.23 2020/01/28 22:20:45 ad Exp $");
 #include 
 #include 
 #include 
@@ -843,34 +843,16 @@ scan_siblings:
 			break;
 		}
 		n = path_node(t, path, lastidx - 1);
-		/*
-		 * we used to have an integer counter in the node, and this
-		 * optimization made sense then, even though marginal.  it
-		 * no longer provides benefit with the structure cache line
-		 * aligned and the counter replaced by an unrolled sequence
-		 * testing the pointers in batch.
-		 */
-#if 0
-		if (*vpp != NULL && radix_tree_node_count_ptrs(n) == 1) {
-			/*
-			 * optimization; if the node has only a single pointer
-			 * and we've already visited it, there's no point to
-			 * keep scanning in this node.
-			 */
-			goto no_siblings;
-		}
-#endif /* 0 */
 		for (i = vpp - n->n_ptrs + step; i != guard; i += step) {
 			KASSERT(i < RADIX_TREE_PTR_PER_NODE);
 			if (entry_match_p(n->n_ptrs[i], tagmask)) {
 vpp = >n_ptrs[i];
 break;
+			} else if (dense) {
+return nfound;
 			}
 		}
 		if (i == guard) {
-#if 0
-no_siblings:
-#endif /* 0 */
 			/*
 			 * not found.  go to parent.
 			 */



CVS commit: src/sys/sys

2020-01-28 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Tue Jan 28 20:35:04 UTC 2020

Modified Files:
src/sys/sys: param.h

Log Message:
NetBSD 9.99.43 - struct lwp, pri_t changed


To generate a diff of this commit:
cvs rdiff -u -r1.645 -r1.646 src/sys/sys/param.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/sys/param.h
diff -u src/sys/sys/param.h:1.645 src/sys/sys/param.h:1.646
--- src/sys/sys/param.h:1.645	Thu Jan 23 17:03:20 2020
+++ src/sys/sys/param.h	Tue Jan 28 20:35:04 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: param.h,v 1.645 2020/01/23 17:03:20 ad Exp $	*/
+/*	$NetBSD: param.h,v 1.646 2020/01/28 20:35:04 ad Exp $	*/
 
 /*-
  * Copyright (c) 1982, 1986, 1989, 1993
@@ -67,7 +67,7 @@
  *	2.99.9		(299000900)
  */
 
-#define	__NetBSD_Version__	999004200	/* NetBSD 9.99.42 */
+#define	__NetBSD_Version__	999004300	/* NetBSD 9.99.43 */
 
 #define __NetBSD_Prereq__(M,m,p) (M) * 1) + \
 (m) * 100) + (p) * 100) <= __NetBSD_Version__)



CVS commit: src/tests/lib/libarchive

2020-01-28 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Jan 28 18:18:32 UTC 2020

Modified Files:
src/tests/lib/libarchive: t_libarchive.sh

Log Message:
Bump timeout to 3600 - the libarchive tests take quite a while to
complete (on a nearly 1 GHz dual armv7 machine it takes more than 700s)


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/lib/libarchive/t_libarchive.sh

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

Modified files:

Index: src/tests/lib/libarchive/t_libarchive.sh
diff -u src/tests/lib/libarchive/t_libarchive.sh:1.1 src/tests/lib/libarchive/t_libarchive.sh:1.2
--- src/tests/lib/libarchive/t_libarchive.sh:1.1	Fri Jan 17 16:24:03 2020
+++ src/tests/lib/libarchive/t_libarchive.sh	Tue Jan 28 18:18:32 2020
@@ -1,4 +1,4 @@
-#   $NetBSD: t_libarchive.sh,v 1.1 2020/01/17 16:24:03 christos Exp $
+#   $NetBSD: t_libarchive.sh,v 1.2 2020/01/28 18:18:32 martin Exp $
 #
 # Copyright (c) 2020 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -30,6 +30,7 @@ atf_test_case libarchive
 libarchive_head()
 {
 atf_set "descr" "test libarchive"
+	atf_set	"timeout" "3600"
 }
 
 libarchive_body()



CVS commit: src/sys/arch/aarch64/include

2020-01-28 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Tue Jan 28 18:02:30 UTC 2020

Modified Files:
src/sys/arch/aarch64/include: armreg.h

Log Message:
More SCTLR.


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/arch/aarch64/include/armreg.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/arch/aarch64/include/armreg.h
diff -u src/sys/arch/aarch64/include/armreg.h:1.33 src/sys/arch/aarch64/include/armreg.h:1.34
--- src/sys/arch/aarch64/include/armreg.h:1.33	Tue Jan 28 17:47:51 2020
+++ src/sys/arch/aarch64/include/armreg.h	Tue Jan 28 18:02:30 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: armreg.h,v 1.33 2020/01/28 17:47:51 maxv Exp $ */
+/* $NetBSD: armreg.h,v 1.34 2020/01/28 18:02:30 maxv Exp $ */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -710,19 +710,35 @@ AARCH64REG_WRITE_INLINE(sctlr_el1)
 #define	SCTLR_ITD		__BIT(7)
 #define	SCTLR_SED		__BIT(8)
 #define	SCTLR_UMA		__BIT(9)
+#define	SCTLR_EnRCTX		__BIT(10)
+#define	SCTLR_EOS		__BIT(11)
 #define	SCTLR_I			__BIT(12)
+#define	SCTLR_EnDB		__BIT(13)
 #define	SCTLR_DZE		__BIT(14)
 #define	SCTLR_UCT		__BIT(15)
 #define	SCTLR_nTWI		__BIT(16)
 #define	SCTLR_nTWE		__BIT(18)
 #define	SCTLR_WXN		__BIT(19)
+#define	SCTLR_TSCXT		__BIT(20)
 #define	SCTLR_IESB		__BIT(21)
+#define	SCTLR_EIS		__BIT(22)
 #define	SCTLR_SPAN		__BIT(23)
 #define	SCTLR_EOE		__BIT(24)
 #define	SCTLR_EE		__BIT(25)
 #define	SCTLR_UCI		__BIT(26)
+#define	SCTLR_EnDA		__BIT(27)
 #define	SCTLR_nTLSMD		__BIT(28)
 #define	SCTLR_LSMAOE		__BIT(29)
+#define	SCTLR_EnIB		__BIT(30)
+#define	SCTLR_EnIA		__BIT(31)
+#define	SCTLR_BT0		__BIT(35)
+#define	SCTLR_BT1		__BIT(36)
+#define	SCTLR_ITFSB		__BIT(37)
+#define	SCTLR_TCF0		__BITS(39,38)
+#define	SCTLR_TCF		__BITS(41,40)
+#define	SCTLR_ATA0		__BIT(42)
+#define	SCTLR_ATA		__BIT(43)
+#define	SCTLR_DSSBS		__BIT(44)
 
 // current EL stack pointer
 static __inline uint64_t



CVS commit: src/sys/arch/aarch64

2020-01-28 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Tue Jan 28 17:47:51 UTC 2020

Modified Files:
src/sys/arch/aarch64/aarch64: cpu.c
src/sys/arch/aarch64/include: armreg.h

Log Message:
Fetch ID_AA64MMFR2_EL1. Okayed by Nick the other day.


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/sys/arch/aarch64/aarch64/cpu.c
cvs rdiff -u -r1.32 -r1.33 src/sys/arch/aarch64/include/armreg.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/arch/aarch64/aarch64/cpu.c
diff -u src/sys/arch/aarch64/aarch64/cpu.c:1.38 src/sys/arch/aarch64/aarch64/cpu.c:1.39
--- src/sys/arch/aarch64/aarch64/cpu.c:1.38	Mon Jan 27 16:25:08 2020
+++ src/sys/arch/aarch64/aarch64/cpu.c	Tue Jan 28 17:47:50 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu.c,v 1.38 2020/01/27 16:25:08 skrll Exp $ */
+/* $NetBSD: cpu.c,v 1.39 2020/01/28 17:47:50 maxv Exp $ */
 
 /*
  * Copyright (c) 2017 Ryo Shimizu 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(1, "$NetBSD: cpu.c,v 1.38 2020/01/27 16:25:08 skrll Exp $");
+__KERNEL_RCSID(1, "$NetBSD: cpu.c,v 1.39 2020/01/28 17:47:50 maxv Exp $");
 
 #include "locators.h"
 #include "opt_arm_debug.h"
@@ -460,8 +460,7 @@ cpu_setup_id(struct cpu_info *ci)
 
 	id->ac_aa64mmfr0 = reg_id_aa64mmfr0_el1_read();
 	id->ac_aa64mmfr1 = reg_id_aa64mmfr1_el1_read();
-	/* Only in ARMv8.2. */
-	id->ac_aa64mmfr2 = 0 /* reg_id_aa64mmfr2_el1_read() */;
+	id->ac_aa64mmfr2 = reg_id_aa64mmfr2_el1_read();
 
 	id->ac_mvfr0 = reg_mvfr0_el1_read();
 	id->ac_mvfr1 = reg_mvfr1_el1_read();

Index: src/sys/arch/aarch64/include/armreg.h
diff -u src/sys/arch/aarch64/include/armreg.h:1.32 src/sys/arch/aarch64/include/armreg.h:1.33
--- src/sys/arch/aarch64/include/armreg.h:1.32	Tue Jan 28 17:33:07 2020
+++ src/sys/arch/aarch64/include/armreg.h	Tue Jan 28 17:47:51 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: armreg.h,v 1.32 2020/01/28 17:33:07 maxv Exp $ */
+/* $NetBSD: armreg.h,v 1.33 2020/01/28 17:47:51 maxv Exp $ */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -35,8 +35,8 @@
 #include 
 #include 
 
-#define AARCH64REG_READ_INLINE2(regname, regdesc)		\
-static __inline uint64_t	\
+#define AARCH64REG_READ_INLINE3(regname, regdesc, fnattrs)	\
+static __inline uint64_t fnattrs\
 reg_##regname##_read(void)	\
 {\
 	uint64_t __rv;		\
@@ -44,13 +44,19 @@ reg_##regname##_read(void)	\
 	return __rv;		\
 }
 
-#define AARCH64REG_WRITE_INLINE2(regname, regdesc)		\
-static __inline void		\
+#define AARCH64REG_READ_INLINE2(regname, regdesc)		\
+	AARCH64REG_READ_INLINE3(regname, regdesc, )
+
+#define AARCH64REG_WRITE_INLINE3(regname, regdesc, fnattrs)	\
+static __inline void fnattrs	\
 reg_##regname##_write(uint64_t __val)\
 {\
 	__asm __volatile("msr " #regdesc ", %0" :: "r"(__val));	\
 }
 
+#define AARCH64REG_WRITE_INLINE2(regname, regdesc)		\
+	AARCH64REG_WRITE_INLINE3(regname, regdesc, )
+
 #define AARCH64REG_WRITEIMM_INLINE2(regname, regdesc)		\
 static __inline void		\
 reg_##regname##_write(uint64_t __val)\
@@ -329,7 +335,8 @@ AARCH64REG_READ_INLINE(id_aa64mmfr1_el1)
 #define	 ID_AA64MMFR1_EL1_HAFDBS_A	 1
 #define	 ID_AA64MMFR1_EL1_HAFDBS_AD	 2
 
-AARCH64REG_READ_INLINE(id_aa64mmfr2_el1)
+AARCH64REG_READ_INLINE3(id_aa64mmfr2_el1, id_aa64mmfr2_el1,
+__attribute__((target("arch=armv8.2-a"
 
 #define	ID_AA64MMFR2_EL1_E0PD		__BITS(63,60)
 #define	 ID_AA64MMFR2_EL1_E0PD_NONE	 0



CVS commit: src/usr.sbin/cpuctl/arch

2020-01-28 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Tue Jan 28 17:36:42 UTC 2020

Modified Files:
src/usr.sbin/cpuctl/arch: aarch64.c

Log Message:
More identification.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/usr.sbin/cpuctl/arch/aarch64.c

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

Modified files:

Index: src/usr.sbin/cpuctl/arch/aarch64.c
diff -u src/usr.sbin/cpuctl/arch/aarch64.c:1.7 src/usr.sbin/cpuctl/arch/aarch64.c:1.8
--- src/usr.sbin/cpuctl/arch/aarch64.c:1.7	Thu May  9 07:38:44 2019
+++ src/usr.sbin/cpuctl/arch/aarch64.c	Tue Jan 28 17:36:42 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: aarch64.c,v 1.7 2019/05/09 07:38:44 mrg Exp $	*/
+/*	$NetBSD: aarch64.c,v 1.8 2020/01/28 17:36:42 maxv Exp $	*/
 
 /*
  * Copyright (c) 2018 Ryo Shimizu 
@@ -29,7 +29,7 @@
 #include 
 
 #ifndef lint
-__RCSID("$NetBSD: aarch64.c,v 1.7 2019/05/09 07:38:44 mrg Exp $");
+__RCSID("$NetBSD: aarch64.c,v 1.8 2020/01/28 17:36:42 maxv Exp $");
 #endif /* no lint */
 
 #include 
@@ -158,6 +158,41 @@ struct fieldinfo id_aa64pfr0_fieldinfo[]
 	{ .bitwidth = 0 }	/* end of table */
 };
 
+/* ID_AA64PFR1_EL1 - AArch64 Processor Feature Register 1 */
+struct fieldinfo id_aa64pfr1_fieldinfo[] = {
+	{
+		.bitpos = 0, .bitwidth = 4, .name = "BT",
+		.info = (const char *[16]) { /* 16=4bit */
+			[0] = "Branch Target Identification not implemented",
+			[1] = "Branch Target Identification implemented",
+		}
+	},
+	{
+		.bitpos = 4, .bitwidth = 4, .name = "SSBS",
+		.info = (const char *[16]) { /* 16=4bit */
+			[0] = "Speculative Store Bypassing control not implemented",
+			[1] = "Speculative Store Bypassing control implemented",
+			[2] = "Speculative Store Bypassing control implemented, plus MSR/MRS"
+		}
+	},
+	{
+		.bitpos = 8, .bitwidth = 4, .name = "MTE",
+		.info = (const char *[16]) { /* 16=4bit */
+			[0] = "Tagged Memory Extension not implemented",
+			[1] = "Tagged Memory Extension implemented, EL0 only",
+			[2] = "Tagged Memory Extension implemented"
+		}
+	},
+	{
+		.bitpos = 12, .bitwidth = 4, .name = "RAS_frac",
+		.info = (const char *[16]) { /* 16=4bit */
+			[0] = "Regular RAS",
+			[1] = "RAS plus registers",
+		}
+	},
+	{ .bitwidth = 0 }	/* end of table */
+};
+
 /* ID_AA64ISAR0_EL1 - AArch64 Instruction Set Attribute Register 0 */
 struct fieldinfo id_aa64isar0_fieldinfo[] = {
 	{
@@ -258,6 +293,70 @@ struct fieldinfo id_aa64mmfr0_fieldinfo[
 	{ .bitwidth = 0 }	/* end of table */
 };
 
+/* ID_AA64MMFR1_EL1 - AArch64 Memory Model Feature Register 1 */
+struct fieldinfo id_aa64mmfr1_fieldinfo[] = {
+	{
+		.bitpos = 0, .bitwidth = 4, .name = "HAFDBS",
+		.info = (const char *[16]) { /* 16=4bit */
+			[0] = "Access and Dirty flags not supported",
+			[1] = "Access flag supported",
+			[2] = "Access and Dirty flags supported",
+		}
+	},
+	{
+		.bitpos = 4, .bitwidth = 4, .name = "VMIDBits",
+		.info = (const char *[16]) { /* 16=4bit */
+			[0] = "8bits",
+			[2] = "16bits"
+		}
+	},
+	{
+		.bitpos = 8, .bitwidth = 4, .name = "VH",
+		.info = (const char *[16]) { /* 16=4bit */
+			[0] = "Virtualization Host Extensions not supported",
+			[1] = "Virtualization Host Extensions supported",
+		}
+	},
+	{
+		.bitpos = 12, .bitwidth = 4, .name = "HPDS",
+		.info = (const char *[16]) { /* 16=4bit */
+			[0] = "Disabling of hierarchical controls not supported",
+			[1] = "Disabling of hierarchical controls supported",
+			[2] = "Disabling of hierarchical controls supported, plus PTD"
+		}
+	},
+	{
+		.bitpos = 16, .bitwidth = 4, .name = "LO",
+		.info = (const char *[16]) { /* 16=4bit */
+			[0] = "LORegions not supported",
+			[1] = "LORegions supported"
+		}
+	},
+	{
+		.bitpos = 20, .bitwidth = 4, .name = "PAN",
+		.info = (const char *[16]) { /* 16=4bit */
+			[0] = "PAN not supported",
+			[1] = "PAN supported",
+			[2] = "PAN supported, and instructions supported"
+		}
+	},
+	{
+		.bitpos = 24, .bitwidth = 4, .name = "SpecSEI",
+		.info = (const char *[16]) { /* 16=4bit */
+			[0] = "SError interrupt not supported",
+			[1] = "SError interrupt supported"
+		}
+	},
+	{
+		.bitpos = 28, .bitwidth = 4, .name = "XNX",
+		.info = (const char *[16]) { /* 16=4bit */
+			[0] = "Distinction between EL0 and EL1 XN control at stage 2 not supported",
+			[1] = "Distinction between EL0 and EL1 XN control at stage 2 supported"
+		}
+	},
+	{ .bitwidth = 0 }	/* end of table */
+};
+
 /* ID_AA64DFR0_EL1 - AArch64 Debug Feature Register 0 */
 struct fieldinfo id_aa64dfr0_fieldinfo[] = {
 	{
@@ -610,8 +709,12 @@ identifycpu(int fd, const char *cpuname)
 	id_aa64isar0_fieldinfo, id->ac_aa64isar0);
 	print_fieldinfo(cpuname, "memory model 0",
 	id_aa64mmfr0_fieldinfo, id->ac_aa64mmfr0);
+	print_fieldinfo(cpuname, "memory model 1",
+	id_aa64mmfr1_fieldinfo, id->ac_aa64mmfr1);
 	print_fieldinfo(cpuname, "processor feature 0",
 	id_aa64pfr0_fieldinfo, id->ac_aa64pfr0);
+	print_fieldinfo(cpuname, "processor feature 1",
+	

CVS commit: src/sys/arch/aarch64

2020-01-28 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Tue Jan 28 17:33:07 UTC 2020

Modified Files:
src/sys/arch/aarch64/aarch64: genassym.cf locore.S
src/sys/arch/aarch64/include: armreg.h

Log Message:
Jazelle and T32EE are not part of ARMv8, fix the bits to their real
meanings. No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/aarch64/aarch64/genassym.cf
cvs rdiff -u -r1.53 -r1.54 src/sys/arch/aarch64/aarch64/locore.S
cvs rdiff -u -r1.31 -r1.32 src/sys/arch/aarch64/include/armreg.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/arch/aarch64/aarch64/genassym.cf
diff -u src/sys/arch/aarch64/aarch64/genassym.cf:1.18 src/sys/arch/aarch64/aarch64/genassym.cf:1.19
--- src/sys/arch/aarch64/aarch64/genassym.cf:1.18	Wed Jan  8 17:38:41 2020
+++ src/sys/arch/aarch64/aarch64/genassym.cf	Tue Jan 28 17:33:07 2020
@@ -1,4 +1,4 @@
-# $NetBSD: genassym.cf,v 1.18 2020/01/08 17:38:41 ad Exp $
+# $NetBSD: genassym.cf,v 1.19 2020/01/28 17:33:07 maxv Exp $
 #-
 # Copyright (c) 2014 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -348,7 +348,7 @@ define	SCTLR_C			SCTLR_C
 define	SCTLR_SA		SCTLR_SA
 define	SCTLR_SA0		SCTLR_SA0
 define	SCTLR_CP15BEN		SCTLR_CP15BEN
-define	SCTLR_THEE		SCTLR_THEE
+define	SCTLR_nAA		SCTLR_nAA
 define	SCTLR_ITD		SCTLR_ITD
 define	SCTLR_SED		SCTLR_SED
 define	SCTLR_UMA		SCTLR_UMA

Index: src/sys/arch/aarch64/aarch64/locore.S
diff -u src/sys/arch/aarch64/aarch64/locore.S:1.53 src/sys/arch/aarch64/aarch64/locore.S:1.54
--- src/sys/arch/aarch64/aarch64/locore.S:1.53	Sun Jan 19 16:12:56 2020
+++ src/sys/arch/aarch64/aarch64/locore.S	Tue Jan 28 17:33:07 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.S,v 1.53 2020/01/19 16:12:56 skrll Exp $	*/
+/*	$NetBSD: locore.S,v 1.54 2020/01/28 17:33:07 maxv Exp $	*/
 
 /*
  * Copyright (c) 2017 Ryo Shimizu 
@@ -38,7 +38,7 @@
 #include 
 #include "assym.h"
 
-RCSID("$NetBSD: locore.S,v 1.53 2020/01/19 16:12:56 skrll Exp $")
+RCSID("$NetBSD: locore.S,v 1.54 2020/01/28 17:33:07 maxv Exp $")
 
 #ifdef AARCH64_DEVICE_MEM_STRONGLY_ORDERED
 #define	MAIR_DEVICE_MEM		MAIR_DEVICE_nGnRnE
@@ -1016,7 +1016,7 @@ sctlr_clear:
 	SCTLR_WXN | /* Write permission implies Execute Never (W^X) */ \
 	SCTLR_UMA | /* EL0 Controls access to interrupt masks */ \
 	SCTLR_ITD | /* IT instruction disable */ \
-	SCTLR_THEE |/* T32EE is not implemented */ \
+	SCTLR_nAA | /* ? */ \
 	SCTLR_CP15BEN | /* CP15 barrier enable */ \
 	SCTLR_SA0 | /* Enable EL0 stack alignment check */ \
 	SCTLR_SA |  /* Enable SP alignment check */ \

Index: src/sys/arch/aarch64/include/armreg.h
diff -u src/sys/arch/aarch64/include/armreg.h:1.31 src/sys/arch/aarch64/include/armreg.h:1.32
--- src/sys/arch/aarch64/include/armreg.h:1.31	Tue Jan 28 17:23:30 2020
+++ src/sys/arch/aarch64/include/armreg.h	Tue Jan 28 17:33:07 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: armreg.h,v 1.31 2020/01/28 17:23:30 maxv Exp $ */
+/* $NetBSD: armreg.h,v 1.32 2020/01/28 17:33:07 maxv Exp $ */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -699,7 +699,7 @@ AARCH64REG_WRITE_INLINE(sctlr_el1)
 #define	SCTLR_SA		__BIT(3)
 #define	SCTLR_SA0		__BIT(4)
 #define	SCTLR_CP15BEN		__BIT(5)
-#define	SCTLR_THEE		__BIT(6)
+#define	SCTLR_nAA		__BIT(6)
 #define	SCTLR_ITD		__BIT(7)
 #define	SCTLR_SED		__BIT(8)
 #define	SCTLR_UMA		__BIT(9)
@@ -743,9 +743,8 @@ AARCH64REG_WRITE_INLINE(spsr_el1)
 #define	 SPSR_C	 		__BIT(29)	// Carry
 #define	 SPSR_V	 		__BIT(28)	// oVerflow
 #define	SPSR_A32_Q 		__BIT(27)	// A32: Overflow
-#define	SPSR_A32_J 		__BIT(24)	// A32: Jazelle Mode
-#define	SPSR_A32_IT1 		__BIT(23)	// A32: IT[1]
-#define	SPSR_A32_IT0 		__BIT(22)	// A32: IT[0]
+#define	SPSR_A32_IT1 		__BIT(26)	// A32: IT[1]
+#define	SPSR_A32_IT0 		__BIT(25)	// A32: IT[0]
 #define	SPSR_SS	 		__BIT(21)	// Software Step
 #define	SPSR_SS_SHIFT		21
 #define	SPSR_IL	 		__BIT(20)	// Instruction Length



CVS commit: src/sys/arch/aarch64/include

2020-01-28 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Tue Jan 28 17:23:30 UTC 2020

Modified Files:
src/sys/arch/aarch64/include: armreg.h

Log Message:
More definitions.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/arch/aarch64/include/armreg.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/arch/aarch64/include/armreg.h
diff -u src/sys/arch/aarch64/include/armreg.h:1.30 src/sys/arch/aarch64/include/armreg.h:1.31
--- src/sys/arch/aarch64/include/armreg.h:1.30	Sat Dec 28 00:22:08 2019
+++ src/sys/arch/aarch64/include/armreg.h	Tue Jan 28 17:23:30 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: armreg.h,v 1.30 2019/12/28 00:22:08 rjs Exp $ */
+/* $NetBSD: armreg.h,v 1.31 2020/01/28 17:23:30 maxv Exp $ */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -229,6 +229,45 @@ AARCH64REG_READ_INLINE(id_aa64isar0_el1)
 #define	 ID_AA64ISAR0_EL1_AES_PMUL	 2
 
 AARCH64REG_READ_INLINE(id_aa64isar1_el1)
+
+#define	ID_AA64ISAR1_EL1_SPECRES	__BITS(43,40)
+#define	 ID_AA64ISAR1_EL1_SPECRES_NONE	 0
+#define	 ID_AA64ISAR1_EL1_SPECRES_SUPPORTED 1
+#define	ID_AA64ISAR1_EL1_SB		__BITS(39,36)
+#define	 ID_AA64ISAR1_EL1_SB_NONE	 0
+#define	 ID_AA64ISAR1_EL1_SB_SUPPORTED	 1
+#define	ID_AA64ISAR1_EL1_FRINTTS	__BITS(35,32)
+#define	 ID_AA64ISAR1_EL1_FRINTTS_NONE	 0
+#define	 ID_AA64ISAR1_EL1_FRINTTS_SUPPORTED 1
+#define	ID_AA64ISAR1_EL1_GPI		__BITS(31,28)
+#define	 ID_AA64ISAR1_EL1_GPI_NONE	 0
+#define	 ID_AA64ISAR1_EL1_GPI_SUPPORTED	 1
+#define	ID_AA64ISAR1_EL1_GPA		__BITS(27,24)
+#define	 ID_AA64ISAR1_EL1_GPA_NONE	 0
+#define	 ID_AA64ISAR1_EL1_GPA_QARMA	 1
+#define	ID_AA64ISAR1_EL1_LRCPC		__BITS(23,20)
+#define	 ID_AA64ISAR1_EL1_LRCPC_NONE	 0
+#define	 ID_AA64ISAR1_EL1_LRCPC_PR	 1
+#define	 ID_AA64ISAR1_EL1_LRCPC_PR_UR	 2
+#define	ID_AA64ISAR1_EL1_FCMA		__BITS(19,16)
+#define	 ID_AA64ISAR1_EL1_FCMA_NONE	 0
+#define	 ID_AA64ISAR1_EL1_FCMA_SUPPORTED 1
+#define	ID_AA64ISAR1_EL1_JSCVT		__BITS(15,12)
+#define	 ID_AA64ISAR1_EL1_JSCVT_NONE	 0
+#define	 ID_AA64ISAR1_EL1_JSCVT_SUPPORTED 1
+#define	ID_AA64ISAR1_EL1_API		__BITS(11,8)
+#define	 ID_AA64ISAR1_EL1_API_NONE	 0
+#define	 ID_AA64ISAR1_EL1_API_SUPPORTED	 1
+#define	 ID_AA64ISAR1_EL1_API_ENHANCED	 2
+#define	ID_AA64ISAR1_EL1_APA		__BITS(7,4)
+#define	 ID_AA64ISAR1_EL1_APA_NONE	 0
+#define	 ID_AA64ISAR1_EL1_APA_QARMA	 1
+#define	 ID_AA64ISAR1_EL1_APA_QARMA_ENH	 2
+#define	ID_AA64ISAR1_EL1_DPB		__BITS(3,0)
+#define	 ID_AA64ISAR1_EL1_DPB_NONE	 0
+#define	 ID_AA64ISAR1_EL1_DPB_CVAP	 1
+#define	 ID_AA64ISAR1_EL1_DPB_CVAP_CVADP 2
+
 AARCH64REG_READ_INLINE(id_aa64mmfr0_el1)
 
 #define	ID_AA64MMFR0_EL1_TGRAN4		__BITS(31,28)
@@ -260,11 +299,106 @@ AARCH64REG_READ_INLINE(id_aa64mmfr0_el1)
 #define	 ID_AA64MMFR0_EL1_PARANGE_16T	 4
 #define	 ID_AA64MMFR0_EL1_PARANGE_256T	 5
 
-AARCH64REG_READ_INLINE2(a72_cpuactlr_el1, s3_1_c15_c2_0)
 AARCH64REG_READ_INLINE(id_aa64mmfr1_el1)
+
+#define	ID_AA64MMFR1_EL1_XNX		__BITS(31,28)
+#define	 ID_AA64MMFR1_EL1_XNX_NONE	 0
+#define	 ID_AA64MMFR1_EL1_XNX_SUPPORTED	 1
+#define	ID_AA64MMFR1_EL1_SPECSEI	__BITS(27,24)
+#define	 ID_AA64MMFR1_EL1_SPECSEI_NONE	 0
+#define	 ID_AA64MMFR1_EL1_SPECSEI_EXTINT 1
+#define	ID_AA64MMFR1_EL1_PAN		__BITS(23,20)
+#define	 ID_AA64MMFR1_EL1_PAN_NONE	 0
+#define	 ID_AA64MMFR1_EL1_PAN_SUPPORTED	 1
+#define	 ID_AA64MMFR1_EL1_PAN_S1E1	 2
+#define	ID_AA64MMFR1_EL1_LO		__BITS(19,16)
+#define	 ID_AA64MMFR1_EL1_LO_NONE	 0
+#define	 ID_AA64MMFR1_EL1_LO_SUPPORTED	 1
+#define	ID_AA64MMFR1_EL1_HPDS		__BITS(15,12)
+#define	 ID_AA64MMFR1_EL1_HPDS_NONE	 0
+#define	 ID_AA64MMFR1_EL1_HPDS_SUPPORTED 1
+#define	 ID_AA64MMFR1_EL1_HPDS_EXTRA_PTD 2
+#define	ID_AA64MMFR1_EL1_VH		__BITS(11,8)
+#define	 ID_AA64MMFR1_EL1_VH_NONE	 0
+#define	 ID_AA64MMFR1_EL1_VH_SUPPORTED	 1
+#define	ID_AA64MMFR1_EL1_VMIDBITS	__BITS(7,4)
+#define	 ID_AA64MMFR1_EL1_VMIDBITS_8BIT	 0
+#define	 ID_AA64MMFR1_EL1_VMIDBITS_16BIT 2
+#define	ID_AA64MMFR1_EL1_HAFDBS		__BITS(3,0)
+#define	 ID_AA64MMFR1_EL1_HAFDBS_NONE	 0
+#define	 ID_AA64MMFR1_EL1_HAFDBS_A	 1
+#define	 ID_AA64MMFR1_EL1_HAFDBS_AD	 2
+
 AARCH64REG_READ_INLINE(id_aa64mmfr2_el1)
+
+#define	ID_AA64MMFR2_EL1_E0PD		__BITS(63,60)
+#define	 ID_AA64MMFR2_EL1_E0PD_NONE	 0
+#define	 ID_AA64MMFR2_EL1_E0PD_SUPPORTED 1
+#define	ID_AA64MMFR2_EL1_EVT		__BITS(59,56)
+#define	 ID_AA64MMFR2_EL1_EVT_NONE	 0
+#define	 ID_AA64MMFR2_EL1_EVT_TO_TI	 1
+#define	 ID_AA64MMFR2_EL1_EVT_TO_TI_TTL	 2
+#define	ID_AA64MMFR2_EL1_BBM		__BITS(55,52)
+#define	 ID_AA64MMFR2_EL1_BBM_L0	 0
+#define	 ID_AA64MMFR2_EL1_BBM_L1	 1
+#define	 ID_AA64MMFR2_EL1_BBM_L2	 2
+#define	ID_AA64MMFR2_EL1_TTL		__BITS(51,48)
+#define	 ID_AA64MMFR2_EL1_TTL_NONE	 0
+#define	 ID_AA64MMFR2_EL1_TTL_SUPPORTED	 1
+#define	ID_AA64MMFR2_EL1_FWB		__BITS(43,40)
+#define	 ID_AA64MMFR2_EL1_FWB_NONE	 0
+#define	 ID_AA64MMFR2_EL1_FWB_SUPPORTED	 1
+#define	ID_AA64MMFR2_EL1_IDS		__BITS(39,36)
+#define	 ID_AA64MMFR2_EL1_IDS_0X0	 0
+#define	 

CVS commit: src/sys/sys

2020-01-28 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Tue Jan 28 16:40:27 UTC 2020

Modified Files:
src/sys/sys: lwp.h types.h

Log Message:
Put pri_t back to an int.  It looks like there might be a sign extension
issue somewhere but it's not worth the hassle trying to find it.


To generate a diff of this commit:
cvs rdiff -u -r1.198 -r1.199 src/sys/sys/lwp.h
cvs rdiff -u -r1.103 -r1.104 src/sys/sys/types.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/sys/lwp.h
diff -u src/sys/sys/lwp.h:1.198 src/sys/sys/lwp.h:1.199
--- src/sys/sys/lwp.h:1.198	Sat Jan 25 15:41:52 2020
+++ src/sys/sys/lwp.h	Tue Jan 28 16:40:27 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: lwp.h,v 1.198 2020/01/25 15:41:52 ad Exp $	*/
+/*	$NetBSD: lwp.h,v 1.199 2020/01/28 16:40:27 ad Exp $	*/
 
 /*
  * Copyright (c) 2001, 2006, 2007, 2008, 2009, 2010, 2019, 2020
@@ -103,7 +103,7 @@ struct lwp {
 	int		l_biglocks;	/* l: biglock count before sleep */
 	short		l_stat;		/* l: overall LWP status */
 	short		l_class;	/* l: scheduling class */
-	short		l_kpriority;	/* !: has kernel priority boost */
+	int		l_kpriority;	/* !: has kernel priority boost */
 	pri_t		l_kpribase;	/* !: kernel priority base level */
 	pri_t		l_priority;	/* l: scheduler priority */
 	pri_t		l_inheritedprio;/* l: inherited priority */

Index: src/sys/sys/types.h
diff -u src/sys/sys/types.h:1.103 src/sys/sys/types.h:1.104
--- src/sys/sys/types.h:1.103	Sun Jan 12 21:40:44 2020
+++ src/sys/sys/types.h	Tue Jan 28 16:40:27 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: types.h,v 1.103 2020/01/12 21:40:44 ad Exp $	*/
+/*	$NetBSD: types.h,v 1.104 2020/01/28 16:40:27 ad Exp $	*/
 
 /*-
  * Copyright (c) 1982, 1986, 1991, 1993, 1994
@@ -317,7 +317,7 @@ typedef	_BSD_USECONDS_T_	useconds_t;
 
 typedef struct kauth_cred *kauth_cred_t;
 
-typedef short pri_t;
+typedef int pri_t;
 
 #endif
 



CVS commit: src/sys/kern

2020-01-28 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Tue Jan 28 16:35:39 UTC 2020

Modified Files:
src/sys/kern: init_main.c

Log Message:
Call radix_tree_init() earlier, so more stuff can make use of radixtree.


To generate a diff of this commit:
cvs rdiff -u -r1.518 -r1.519 src/sys/kern/init_main.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/kern/init_main.c
diff -u src/sys/kern/init_main.c:1.518 src/sys/kern/init_main.c:1.519
--- src/sys/kern/init_main.c:1.518	Wed Jan  8 17:38:42 2020
+++ src/sys/kern/init_main.c	Tue Jan 28 16:35:39 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: init_main.c,v 1.518 2020/01/08 17:38:42 ad Exp $	*/
+/*	$NetBSD: init_main.c,v 1.519 2020/01/28 16:35:39 ad Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009, 2019 The NetBSD Foundation, Inc.
@@ -97,7 +97,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: init_main.c,v 1.518 2020/01/08 17:38:42 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: init_main.c,v 1.519 2020/01/28 16:35:39 ad Exp $");
 
 #include "opt_ddb.h"
 #include "opt_inet.h"
@@ -329,6 +329,9 @@ main(void)
 	mutex_obj_init();
 	rw_obj_init();
 
+	/* Initialize radix trees (used by numerous subsystems). */
+	radix_tree_init();
+
 	/* Passive serialization. */
 	pserialize_init();
 
@@ -480,7 +483,6 @@ main(void)
 	/* Initialize fstrans. */
 	fstrans_init();
 
-	radix_tree_init(); /* used for page cache */
 	vfsinit();
 	lf_init();
 



CVS commit: src

2020-01-28 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Tue Jan 28 16:33:34 UTC 2020

Modified Files:
src/common/lib/libc/gen: radixtree.c
src/sys/sys: radixtree.h

Log Message:
Add a radix_tree_await_memory(), for kernel use.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/common/lib/libc/gen/radixtree.c
cvs rdiff -u -r1.6 -r1.7 src/sys/sys/radixtree.h

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

Modified files:

Index: src/common/lib/libc/gen/radixtree.c
diff -u src/common/lib/libc/gen/radixtree.c:1.21 src/common/lib/libc/gen/radixtree.c:1.22
--- src/common/lib/libc/gen/radixtree.c:1.21	Sun Jan 12 20:00:41 2020
+++ src/common/lib/libc/gen/radixtree.c	Tue Jan 28 16:33:34 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: radixtree.c,v 1.21 2020/01/12 20:00:41 para Exp $	*/
+/*	$NetBSD: radixtree.c,v 1.22 2020/01/28 16:33:34 ad Exp $	*/
 
 /*-
  * Copyright (c)2011,2012,2013 YAMAMOTO Takashi,
@@ -112,7 +112,7 @@
 #include 
 
 #if defined(_KERNEL) || defined(_STANDALONE)
-__KERNEL_RCSID(0, "$NetBSD: radixtree.c,v 1.21 2020/01/12 20:00:41 para Exp $");
+__KERNEL_RCSID(0, "$NetBSD: radixtree.c,v 1.22 2020/01/28 16:33:34 ad Exp $");
 #include 
 #include 
 #include 
@@ -122,7 +122,7 @@ __KERNEL_RCSID(0, "$NetBSD: radixtree.c,
 #include 
 #endif /* defined(_STANDALONE) */
 #else /* defined(_KERNEL) || defined(_STANDALONE) */
-__RCSID("$NetBSD: radixtree.c,v 1.21 2020/01/12 20:00:41 para Exp $");
+__RCSID("$NetBSD: radixtree.c,v 1.22 2020/01/28 16:33:34 ad Exp $");
 #include 
 #include 
 #include 
@@ -349,6 +349,23 @@ radix_tree_init(void)
 	radix_tree_node_ctor, NULL, NULL);
 	KASSERT(radix_tree_node_cache != NULL);
 }
+
+/*
+ * radix_tree_await_memory:
+ *
+ * after an insert has failed with ENOMEM, wait for memory to become
+ * available, so the caller can retry.
+ */
+
+void
+radix_tree_await_memory(void)
+{
+	struct radix_tree_node *n;
+
+	n = pool_cache_get(radix_tree_node_cache, PR_WAITOK);
+	pool_cache_put(radix_tree_node_cache, n);
+}
+
 #endif /* defined(_KERNEL) */
 
 static bool __unused

Index: src/sys/sys/radixtree.h
diff -u src/sys/sys/radixtree.h:1.6 src/sys/sys/radixtree.h:1.7
--- src/sys/sys/radixtree.h:1.6	Thu Dec  5 18:32:25 2019
+++ src/sys/sys/radixtree.h	Tue Jan 28 16:33:34 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: radixtree.h,v 1.6 2019/12/05 18:32:25 ad Exp $	*/
+/*	$NetBSD: radixtree.h,v 1.7 2020/01/28 16:33:34 ad Exp $	*/
 
 /*-
  * Copyright (c)2011 YAMAMOTO Takashi,
@@ -47,6 +47,7 @@ struct radix_tree {
 
 #if defined(_KERNEL)
 void radix_tree_init(void);
+void radix_tree_await_memory(void);
 #endif /* defined(_KERNEL) */
 
 /*



CVS commit: src/lib/libpthread

2020-01-28 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Tue Jan 28 13:08:40 UTC 2020

Modified Files:
src/lib/libpthread: pthread_int.h

Log Message:
- A bit more alignment in __pthread_st especially for the rbtree node.
- Use COHERENCY_UNIT from sys/param.h.


To generate a diff of this commit:
cvs rdiff -u -r1.99 -r1.100 src/lib/libpthread/pthread_int.h

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

Modified files:

Index: src/lib/libpthread/pthread_int.h
diff -u src/lib/libpthread/pthread_int.h:1.99 src/lib/libpthread/pthread_int.h:1.100
--- src/lib/libpthread/pthread_int.h:1.99	Mon Jan 27 20:50:05 2020
+++ src/lib/libpthread/pthread_int.h	Tue Jan 28 13:08:40 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pthread_int.h,v 1.99 2020/01/27 20:50:05 ad Exp $	*/
+/*	$NetBSD: pthread_int.h,v 1.100 2020/01/28 13:08:40 ad Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2002, 2003, 2006, 2007, 2008, 2020
@@ -47,6 +47,7 @@
 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -96,7 +97,6 @@ struct	__pthread_st {
 #endif
 	unsigned int	pt_magic;	/* Magic number */
 	int		pt_state;	/* running, blocked, etc. */
-	pthread_mutex_t	pt_lock;	/* lock on state */
 	int		pt_flags;	/* see PT_FLAG_* below */
 	int		pt_cancel;	/* Deferred cancellation */
 	int		pt_errno;	/* Thread-specific errno. */
@@ -120,15 +120,25 @@ struct	__pthread_st {
 
 	/* LWP ID and entry on the list of all threads. */
 	lwpid_t		pt_lid;
-	rb_node_t	pt_alltree;
-	PTQ_ENTRY(__pthread_st) pt_allq;
 	PTQ_ENTRY(__pthread_st)	pt_deadq;
 
 	/*
+	 * rbtree node and entry on the list of all threads.  pt_alltree in
+	 * its own cacheline, so pthread__find() is not needlessly impacted
+	 * by threads going about their normal business.  pt_allq is
+	 * adjusted at the same time as pt_alltree.
+	 */
+	rb_node_t	pt_alltree __aligned(COHERENCY_UNIT);
+	PTQ_ENTRY(__pthread_st) pt_allq;
+
+	/* Lock on state also gets its own line. */
+	pthread_mutex_t	pt_lock __aligned(COHERENCY_UNIT);
+
+	/*
 	 * General synchronization data.  We try to align, as threads
 	 * on other CPUs will access this data frequently.
 	 */
-	int		pt_dummy1 __aligned(128);
+	int		pt_dummy1 __aligned(COHERENCY_UNIT);
 	struct lwpctl 	*pt_lwpctl;	/* Kernel/user comms area */
 	volatile int	pt_rwlocked;	/* Handed rwlock successfully */
 	volatile int	pt_signalled;	/* Received pthread_cond_signal() */
@@ -137,10 +147,9 @@ struct	__pthread_st {
 	void * volatile	pt_sleepobj;	/* Object slept on */
 	PTQ_ENTRY(__pthread_st) pt_sleep;
 	void		(*pt_early)(void *);
-	int		pt_dummy2 __aligned(128);
 
 	/* Thread-specific data.  Large so it sits close to the end. */
-	int		pt_havespecific;
+	int		pt_havespecific __aligned(COHERENCY_UNIT);
 	struct pt_specific {
 		void *pts_value;
 		PTQ_ENTRY(pt_specific) pts_next;



CVS commit: src/sys/arch/x68k/stand/xxboot

2020-01-28 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Tue Jan 28 12:02:02 UTC 2020

Modified Files:
src/sys/arch/x68k/stand/xxboot: Makefile.xxboot boot.S

Log Message:
Set heap area explicitly.
Until the load address was moved, the heap was placed at _end (it's default)
and it was large space.  After moving, this default space was too small.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/x68k/stand/xxboot/Makefile.xxboot \
src/sys/arch/x68k/stand/xxboot/boot.S

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

Modified files:

Index: src/sys/arch/x68k/stand/xxboot/Makefile.xxboot
diff -u src/sys/arch/x68k/stand/xxboot/Makefile.xxboot:1.11 src/sys/arch/x68k/stand/xxboot/Makefile.xxboot:1.12
--- src/sys/arch/x68k/stand/xxboot/Makefile.xxboot:1.11	Sat Jan 18 07:25:12 2020
+++ src/sys/arch/x68k/stand/xxboot/Makefile.xxboot	Tue Jan 28 12:02:02 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.xxboot,v 1.11 2020/01/18 07:25:12 isaki Exp $
+#	$NetBSD: Makefile.xxboot,v 1.12 2020/01/28 12:02:02 isaki Exp $
 
 NOMAN=		# defined
 
@@ -36,6 +36,7 @@ CPPFLAGS+= -DTEXTADDR="$(TEXT)" -DBOOT_T
 CPPFLAGS+= -DTDSIZE="$(TEXTDATASIZE)"
 CPPFLAGS+= -DPROG=\"$(PROG)\" -DBOOT_VERS=\"$(VERSION)\"
 CPPFLAGS+= -DBOOT_STAGE1 $(BOOTCPPFLAGS)
+CPPFLAGS+= -DHEAP_START=0x0010
 CPPFLAGS+= -nostdinc -I${.OBJDIR} -I${S}
 CPPFLAGS+= -I$M/stand/libiocs -I$M/stand/libsa -I$M/stand/common
 AFLAGS=	   ${CFLAGS:M-[ID]*}
Index: src/sys/arch/x68k/stand/xxboot/boot.S
diff -u src/sys/arch/x68k/stand/xxboot/boot.S:1.11 src/sys/arch/x68k/stand/xxboot/boot.S:1.12
--- src/sys/arch/x68k/stand/xxboot/boot.S:1.11	Tue Jan 28 11:57:22 2020
+++ src/sys/arch/x68k/stand/xxboot/boot.S	Tue Jan 28 12:02:02 2020
@@ -2,7 +2,7 @@
 | author: chapuni(webmas...@chapuni.com)
 | ITOH Yasufumi
 |
-| $NetBSD: boot.S,v 1.11 2020/01/28 11:57:22 isaki Exp $
+| $NetBSD: boot.S,v 1.12 2020/01/28 12:02:02 isaki Exp $
 
 |
 | (1) IPL (or previous stage loader) loads first 1KB of this primary
@@ -37,6 +37,7 @@
 |  ~~~~~~
 |  ::::<-SP::<-SP
 |  + - - - - - -++ - - - - - -++ - - - - - -+0x10
+|  :::(heap)  ::(heap)  :
 |  ::::::
 |
 



CVS commit: src/sys/arch/x68k/stand

2020-01-28 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Tue Jan 28 11:57:22 UTC 2020

Modified Files:
src/sys/arch/x68k/stand/boot_ufs: boot.S boot_ufs.ldscript
src/sys/arch/x68k/stand/xxboot: boot.S xxboot.ldscript

Log Message:
Revert placing .bss right after .data, and make .bss fixed at 0x5000.
.bss placed right after .data was overwritten when first 1KB loads full
.text+.data.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/x68k/stand/boot_ufs/boot.S
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/x68k/stand/boot_ufs/boot_ufs.ldscript
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/x68k/stand/xxboot/boot.S
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/x68k/stand/xxboot/xxboot.ldscript

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

Modified files:

Index: src/sys/arch/x68k/stand/boot_ufs/boot.S
diff -u src/sys/arch/x68k/stand/boot_ufs/boot.S:1.18 src/sys/arch/x68k/stand/boot_ufs/boot.S:1.19
--- src/sys/arch/x68k/stand/boot_ufs/boot.S:1.18	Tue Jan 28 11:52:21 2020
+++ src/sys/arch/x68k/stand/boot_ufs/boot.S	Tue Jan 28 11:57:22 2020
@@ -2,7 +2,7 @@
 | author: chapuni(webmas...@chapuni.com)
 | ITOH Yasufumi
 |
-| $NetBSD: boot.S,v 1.18 2020/01/28 11:52:21 isaki Exp $
+| $NetBSD: boot.S,v 1.19 2020/01/28 11:57:22 isaki Exp $
 
 |
 | (1) IPL (or previous stage loader) loads first 1KB of this primary
@@ -27,9 +27,10 @@
 |  ::++++0x003000
 |  ::|full primary||full primary|
 |  ::|boot loader ||boot loader |
-|  ::++++
-|  ::::::
-|  ::::++0x006000
+|  ::|(text+data) ||(text+data) |
+|  ::++++0x005000
+|  ::|(bss)   ||(bss)   |
+|  ::++++0x006000
 |  ::::| /boot  |
 |  ::::++
 |  ::::::

Index: src/sys/arch/x68k/stand/boot_ufs/boot_ufs.ldscript
diff -u src/sys/arch/x68k/stand/boot_ufs/boot_ufs.ldscript:1.7 src/sys/arch/x68k/stand/boot_ufs/boot_ufs.ldscript:1.8
--- src/sys/arch/x68k/stand/boot_ufs/boot_ufs.ldscript:1.7	Sat Jan 18 07:25:11 2020
+++ src/sys/arch/x68k/stand/boot_ufs/boot_ufs.ldscript	Tue Jan 28 11:57:22 2020
@@ -35,6 +35,7 @@ SECTIONS
 edata  =  .;
 _edata  =  .;
   }
+  . = TEXTADDR + 0x2000;
   .bss :
   {
 __bss_start = .;

Index: src/sys/arch/x68k/stand/xxboot/boot.S
diff -u src/sys/arch/x68k/stand/xxboot/boot.S:1.10 src/sys/arch/x68k/stand/xxboot/boot.S:1.11
--- src/sys/arch/x68k/stand/xxboot/boot.S:1.10	Tue Jan 28 11:52:21 2020
+++ src/sys/arch/x68k/stand/xxboot/boot.S	Tue Jan 28 11:57:22 2020
@@ -2,7 +2,7 @@
 | author: chapuni(webmas...@chapuni.com)
 | ITOH Yasufumi
 |
-| $NetBSD: boot.S,v 1.10 2020/01/28 11:52:21 isaki Exp $
+| $NetBSD: boot.S,v 1.11 2020/01/28 11:57:22 isaki Exp $
 
 |
 | (1) IPL (or previous stage loader) loads first 1KB of this primary
@@ -27,9 +27,10 @@
 |  ::++++0x003000
 |  ::|full primary||full primary|
 |  ::|boot loader ||boot loader |
-|  ::++++
-|  ::::::
-|  ::::++0x006000
+|  ::|(text+data) ||(text+data) |
+|  ::++++0x005000
+|  ::|(bss)   ||(bss)   |
+|  ::++++0x006000
 |  ::::| /boot  |
 |  ::::++
 |  ::::::

Index: src/sys/arch/x68k/stand/xxboot/xxboot.ldscript
diff -u src/sys/arch/x68k/stand/xxboot/xxboot.ldscript:1.6 src/sys/arch/x68k/stand/xxboot/xxboot.ldscript:1.7
--- src/sys/arch/x68k/stand/xxboot/xxboot.ldscript:1.6	Sat Jan 18 07:25:12 2020
+++ src/sys/arch/x68k/stand/xxboot/xxboot.ldscript	Tue Jan 28 11:57:22 2020
@@ -35,6 +35,7 @@ SECTIONS
 edata  =  .;
 _edata  =  .;
   }
+  . = TEXTADDR + TEXTDATASIZE;
   .bss :
   {
 __bss_start = .;



CVS commit: src/sys/arch/x68k/stand

2020-01-28 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Tue Jan 28 11:52:21 UTC 2020

Modified Files:
src/sys/arch/x68k/stand/boot_ufs: boot.S
src/sys/arch/x68k/stand/xxboot: boot.S

Log Message:
Use __bss_start rather than edata to point the beginning of .bss.
Currently the .bss is placed right after .data.  In that case, edata
points to the beginning of .bss so that there is no visible changes at
least currently.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/x68k/stand/boot_ufs/boot.S
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/x68k/stand/xxboot/boot.S

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

Modified files:

Index: src/sys/arch/x68k/stand/boot_ufs/boot.S
diff -u src/sys/arch/x68k/stand/boot_ufs/boot.S:1.17 src/sys/arch/x68k/stand/boot_ufs/boot.S:1.18
--- src/sys/arch/x68k/stand/boot_ufs/boot.S:1.17	Sat Jan 18 06:34:29 2020
+++ src/sys/arch/x68k/stand/boot_ufs/boot.S	Tue Jan 28 11:52:21 2020
@@ -2,7 +2,7 @@
 | author: chapuni(webmas...@chapuni.com)
 | ITOH Yasufumi
 |
-| $NetBSD: boot.S,v 1.17 2020/01/18 06:34:29 isaki Exp $
+| $NetBSD: boot.S,v 1.18 2020/01/28 11:52:21 isaki Exp $
 
 |
 | (1) IPL (or previous stage loader) loads first 1KB of this primary
@@ -67,7 +67,7 @@ ASENTRY_NOPROFILE(entry0)
 #define ASRELOC(var)	_RELOC(_ASM_LABEL(var))
 #define RELOC(var)	_RELOC(_C_LABEL(var))
 
-		lea	RELOC(edata),%a1
+		lea	RELOC(__bss_start),%a1
 		bra	_ASM_LABEL(entry)
 
 |	Disklabel= 404bytes

Index: src/sys/arch/x68k/stand/xxboot/boot.S
diff -u src/sys/arch/x68k/stand/xxboot/boot.S:1.9 src/sys/arch/x68k/stand/xxboot/boot.S:1.10
--- src/sys/arch/x68k/stand/xxboot/boot.S:1.9	Sat Jan 18 06:34:30 2020
+++ src/sys/arch/x68k/stand/xxboot/boot.S	Tue Jan 28 11:52:21 2020
@@ -2,7 +2,7 @@
 | author: chapuni(webmas...@chapuni.com)
 | ITOH Yasufumi
 |
-| $NetBSD: boot.S,v 1.9 2020/01/18 06:34:30 isaki Exp $
+| $NetBSD: boot.S,v 1.10 2020/01/28 11:52:21 isaki Exp $
 
 |
 | (1) IPL (or previous stage loader) loads first 1KB of this primary
@@ -69,7 +69,7 @@ ASENTRY_NOPROFILE(entry0)
 #define ASRELOC(var)	_RELOC(_ASM_LABEL(var))
 #define RELOC(var)	_RELOC(_C_LABEL(var))
 
-		lea	RELOC(edata),%a1
+		lea	RELOC(__bss_start),%a1
 		bra	_ASM_LABEL(entry)
 
 |	Disklabel= 404bytes



CVS commit: [netbsd-9] src/doc

2020-01-28 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Jan 28 11:14:16 UTC 2020

Modified Files:
src/doc [netbsd-9]: CHANGES-9.0

Log Message:
Tickets #661 - #664 and #667


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.169 -r1.1.2.170 src/doc/CHANGES-9.0

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

Modified files:

Index: src/doc/CHANGES-9.0
diff -u src/doc/CHANGES-9.0:1.1.2.169 src/doc/CHANGES-9.0:1.1.2.170
--- src/doc/CHANGES-9.0:1.1.2.169	Tue Jan 28 10:21:39 2020
+++ src/doc/CHANGES-9.0	Tue Jan 28 11:14:15 2020
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-9.0,v 1.1.2.169 2020/01/28 10:21:39 msaitoh Exp $
+# $NetBSD: CHANGES-9.0,v 1.1.2.170 2020/01/28 11:14:15 martin Exp $
 
 A complete list of changes from the initial NetBSD 9.0 branch on 2019-07-30
 until the 9.0 release:
@@ -8474,3 +8474,69 @@ distrib/zaurus/ramdisk/dot.profile		1.4
 	PR install/54780: in the (of course totally unlikely) case that sysinst
 	should crash, run "stty sane".
 	[martin, ticket #669]
+
+external/bsd/dhcpcd/dist/src/defs.h up to 1.1.1.37
+external/bsd/dhcpcd/dist/src/dhcp.c up to 1.32
+external/bsd/dhcpcd/dist/src/if-bsd.c   up to 1.16
+external/bsd/dhcpcd/dist/src/ipv6.c up to 1.8
+external/bsd/dhcpcd/dist/src/ipv6.h up to 1.8
+external/bsd/dhcpcd/dist/src/ipv6nd.c   up to 1.16
+external/bsd/dhcpcd/dist/src/script.c   up to 1.2
+doc/3RDPARTY	manually edited
+
+	Import dhcpcd-8.1.6.
+	[roy, #661]
+
+sys/arch/arm/omap/if_cpsw.c			1.26
+sys/arch/arm/ti/if_cpsw.c			1.10
+sys/arch/x86/pci/if_vmx.c			1.54
+sys/dev/isa/if_iy.c1.112
+sys/dev/pci/if_de.c1.165
+sys/dev/pcmcia/if_ray.c1.96
+sys/dev/pcmcia/if_xi.c1.93
+
+	Protect multicast data by lock for NET_MPSAFE.
+	[msaitoh, ticket #662]
+
+sys/dev/mii/makphy.c			1.61, 1.63-1.64 via patch
+sys/dev/mii/makphyreg.h			1.10
+
+	- Remove ESSR_FIBER_LINK bit check in makphyattach(). This bit is
+	  valid only when the link is up, so it's not good to check in the
+	  attach function.
+	- There is an environment that both copper and fiber bits are set in
+	  EXTSR but it support copper only. To resolve this problem, check the
+	  ESSR register's HWCFG_MODE bit and drop unsupported bits.
+	- If the chip is in Fiber/Copper auto select mode, check which media is
+	  selected. Currently, the code supports 88E1011, 88E and 88E1112
+	  only.
+	- Fix comment. KNF.
+	[msaitoh, ticket #663]
+
+sys/dev/pci/ixgbe/ixgbe.c			1.219
+sys/dev/pci/ixgbe/ixgbe_82598.c			1.13
+sys/dev/pci/ixgbe/ixgbe_82599.c			1.22
+sys/dev/pci/ixgbe/ixgbe_phy.c			1.20
+sys/dev/pci/ixgbe/ixgbe_type.h			1.44
+sys/dev/pci/ixgbe/ixgbe_x550.c			1.17
+
+	Before this commit, if an unsupported SFP module was inserted before
+	booting, the driver attach failed and there was no way to recover form
+	it without reboot or detaching/reattaching driver. After this commit,
+	we can automatically recover any time by replacing it with a supported
+	module.
+	[msaitoh, ticket #664]
+
+sys/dev/ic/rtl8169.c1.160,1.161
+sys/dev/ic/rtl81x9.c1.107
+sys/dev/ic/rtl81x9reg.h1.51,1.52
+sys/dev/ic/rtl81x9var.h1.57
+
+	- Use unsigned in rtk_setmulti() to avoid undefined behavior.
+	- Add new quirk for 8168H to linkup correctly.
+	- Improve 8168FP, 8411, 8168G, 8401E, 8105E, 8105E_SPIN1, 8106E and
+	  8402 support.
+	- Renumber RTK_HWREV_8103E from 0x24C0 to 0x34c0. 0x24C0
+	  is newly used as RTK_HWREV_8102EL_SPIN1.
+	[msaitoh, ticket #667]
+



CVS commit: [netbsd-9] src/sys/dev/ic

2020-01-28 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Jan 28 11:12:30 UTC 2020

Modified Files:
src/sys/dev/ic [netbsd-9]: rtl8169.c rtl81x9.c rtl81x9reg.h
rtl81x9var.h

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #667):

sys/dev/ic/rtl81x9var.h: revision 1.57
sys/dev/ic/rtl81x9.c: revision 1.107
sys/dev/ic/rtl81x9reg.h: revision 1.51
sys/dev/ic/rtl8169.c: revision 1.160
sys/dev/ic/rtl81x9reg.h: revision 1.52
sys/dev/ic/rtl8169.c: revision 1.161

 Use unsigned in rtk_setmulti() to avoid undefined behavior. Found bk kUBSan.
8168H model didn't link up well. some models seems to require to enable TX/RX 
after configuration.
RTKQ_TXRXEN_LATER quirk flag added. it may be able to unify with 
RTKQ_RXDV_GATED flag?
 Sort RTK_HWREV_* by value.

Improve some chip revisions support:
 - Add 8168FP, 8411, 8168G, 8401E, 8105E, 8105E_SPIN1, 8106E and 8402 from
   {Free,Open}BSD.
 - Renumber RTK_HWREV_8103E from 0x24C0 to 0x34c0. 0x24C0 is newly
   used as RTK_HWREV_8102EL_SPIN1. Same as {Free,Open}BSD.


To generate a diff of this commit:
cvs rdiff -u -r1.159 -r1.159.2.1 src/sys/dev/ic/rtl8169.c
cvs rdiff -u -r1.106 -r1.106.2.1 src/sys/dev/ic/rtl81x9.c
cvs rdiff -u -r1.50 -r1.50.4.1 src/sys/dev/ic/rtl81x9reg.h
cvs rdiff -u -r1.56 -r1.56.18.1 src/sys/dev/ic/rtl81x9var.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/ic/rtl8169.c
diff -u src/sys/dev/ic/rtl8169.c:1.159 src/sys/dev/ic/rtl8169.c:1.159.2.1
--- src/sys/dev/ic/rtl8169.c:1.159	Thu May 30 02:32:18 2019
+++ src/sys/dev/ic/rtl8169.c	Tue Jan 28 11:12:30 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: rtl8169.c,v 1.159 2019/05/30 02:32:18 msaitoh Exp $	*/
+/*	$NetBSD: rtl8169.c,v 1.159.2.1 2020/01/28 11:12:30 martin Exp $	*/
 
 /*
  * Copyright (c) 1997, 1998-2003
@@ -33,7 +33,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rtl8169.c,v 1.159 2019/05/30 02:32:18 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rtl8169.c,v 1.159.2.1 2020/01/28 11:12:30 martin Exp $");
 /* $FreeBSD: /repoman/r/ncvs/src/sys/dev/re/if_re.c,v 1.20 2004/04/11 20:34:08 ru Exp $ */
 
 /*
@@ -607,17 +607,24 @@ re_attach(struct rtk_softc *sc)
 			sc->sc_quirk |= RTKQ_NOJUMBO;
 			break;
 		case RTK_HWREV_8168E:
-		case RTK_HWREV_8168H:
 		case RTK_HWREV_8168H_SPIN1:
 			sc->sc_quirk |= RTKQ_DESCV2 | RTKQ_NOEECMD |
 			RTKQ_MACSTAT | RTKQ_CMDSTOP | RTKQ_PHYWAKE_PM |
 			RTKQ_NOJUMBO;
 			break;
+		case RTK_HWREV_8168H:
+		case RTK_HWREV_8168FP:
+			sc->sc_quirk |= RTKQ_DESCV2 | RTKQ_NOEECMD |
+			RTKQ_MACSTAT | RTKQ_CMDSTOP | RTKQ_PHYWAKE_PM |
+			RTKQ_NOJUMBO | RTKQ_RXDV_GATED | RTKQ_TXRXEN_LATER;
+			break;
 		case RTK_HWREV_8168E_VL:
 		case RTK_HWREV_8168F:
+		case RTK_HWREV_8411:
 			sc->sc_quirk |= RTKQ_DESCV2 | RTKQ_NOEECMD |
 			RTKQ_MACSTAT | RTKQ_CMDSTOP | RTKQ_NOJUMBO;
 			break;
+		case RTK_HWREV_8168EP:
 		case RTK_HWREV_8168G:
 		case RTK_HWREV_8168G_SPIN1:
 		case RTK_HWREV_8168G_SPIN2:
@@ -633,10 +640,27 @@ re_attach(struct rtk_softc *sc)
 			break;
 		case RTK_HWREV_8102E:
 		case RTK_HWREV_8102EL:
-		case RTK_HWREV_8103E:
+		case RTK_HWREV_8102EL_SPIN1:
 			sc->sc_quirk |= RTKQ_DESCV2 | RTKQ_NOEECMD |
 			RTKQ_MACSTAT | RTKQ_CMDSTOP | RTKQ_NOJUMBO;
 			break;
+		case RTK_HWREV_8103E:
+			sc->sc_quirk |= RTKQ_DESCV2 | RTKQ_NOEECMD |
+			RTKQ_MACSTAT | RTKQ_CMDSTOP;
+			break;
+		case RTK_HWREV_8401E:
+		case RTK_HWREV_8105E:
+		case RTK_HWREV_8105E_SPIN1:
+		case RTK_HWREV_8106E:
+			sc->sc_quirk |= RTKQ_PHYWAKE_PM |
+			RTKQ_DESCV2 | RTKQ_NOEECMD | RTKQ_MACSTAT |
+			RTKQ_CMDSTOP;
+			break;
+		case RTK_HWREV_8402:
+			sc->sc_quirk |= RTKQ_PHYWAKE_PM |
+			RTKQ_DESCV2 | RTKQ_NOEECMD | RTKQ_MACSTAT |
+			RTKQ_CMDSTOP; /* CMDSTOP_WAIT_TXQ */
+			break;
 		default:
 			aprint_normal_dev(sc->sc_dev,
 			"Unknown revision (0x%08x)\n", hwrev);
@@ -1873,7 +1897,8 @@ re_init(struct ifnet *ifp)
 	/*
 	 * Enable transmit and receive.
 	 */
-	CSR_WRITE_1(sc, RTK_COMMAND, RTK_CMD_TX_ENB | RTK_CMD_RX_ENB);
+	if ((sc->sc_quirk & RTKQ_TXRXEN_LATER) == 0)
+		CSR_WRITE_1(sc, RTK_COMMAND, RTK_CMD_TX_ENB | RTK_CMD_RX_ENB);
 
 	/*
 	 * Set the initial TX and RX configuration.
@@ -1915,6 +1940,12 @@ re_init(struct ifnet *ifp)
 	rtk_setmulti(sc);
 
 	/*
+	 * some chips require to enable TX/RX *AFTER* TX/RX configuration
+	 */
+	if ((sc->sc_quirk & RTKQ_TXRXEN_LATER) != 0)
+		CSR_WRITE_1(sc, RTK_COMMAND, RTK_CMD_TX_ENB | RTK_CMD_RX_ENB);
+
+	/*
 	 * Enable interrupts.
 	 */
 	if (sc->re_testmode)

Index: src/sys/dev/ic/rtl81x9.c
diff -u src/sys/dev/ic/rtl81x9.c:1.106 src/sys/dev/ic/rtl81x9.c:1.106.2.1
--- src/sys/dev/ic/rtl81x9.c:1.106	Tue May 28 07:41:48 2019
+++ src/sys/dev/ic/rtl81x9.c	Tue Jan 28 11:12:30 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: rtl81x9.c,v 1.106 2019/05/28 07:41:48 msaitoh Exp $	*/
+/*	$NetBSD: rtl81x9.c,v 1.106.2.1 2020/01/28 

CVS commit: [netbsd-9] src/sys/dev/pci/ixgbe

2020-01-28 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Jan 28 11:09:27 UTC 2020

Modified Files:
src/sys/dev/pci/ixgbe [netbsd-9]: ixgbe.c ixgbe_82598.c ixgbe_82599.c
ixgbe_phy.c ixgbe_type.h ixgbe_x550.c

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #664):

sys/dev/pci/ixgbe/ixgbe_82598.c: revision 1.13
sys/dev/pci/ixgbe/ixgbe.c: revision 1.219
sys/dev/pci/ixgbe/ixgbe_phy.c: revision 1.20
sys/dev/pci/ixgbe/ixgbe_x550.c: revision 1.17
sys/dev/pci/ixgbe/ixgbe_82599.c: revision 1.22
sys/dev/pci/ixgbe/ixgbe_type.h: revision 1.44

Add recovery code for unsupported SFP+.

Before this commit:
   If an unsupported SFP module is inserted before booting, the driver attach
   failed and there was no way to recover form it without rebooting or
   detaching/reattaching driver (drvctl -d && drvctl -r pciN).

After this commit:
   We can automatically recover any time by replacing it with a supported
   module.


To generate a diff of this commit:
cvs rdiff -u -r1.199.2.9 -r1.199.2.10 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.12.8.1 -r1.12.8.2 src/sys/dev/pci/ixgbe/ixgbe_82598.c
cvs rdiff -u -r1.21 -r1.21.4.1 src/sys/dev/pci/ixgbe/ixgbe_82599.c
cvs rdiff -u -r1.18.4.1 -r1.18.4.2 src/sys/dev/pci/ixgbe/ixgbe_phy.c
cvs rdiff -u -r1.41.2.1 -r1.41.2.2 src/sys/dev/pci/ixgbe/ixgbe_type.h
cvs rdiff -u -r1.15.2.1 -r1.15.2.2 src/sys/dev/pci/ixgbe/ixgbe_x550.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.199.2.9 src/sys/dev/pci/ixgbe/ixgbe.c:1.199.2.10
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.199.2.9	Sun Jan 26 11:03:17 2020
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Tue Jan 28 11:09:27 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.199.2.9 2020/01/26 11:03:17 martin Exp $ */
+/* $NetBSD: ixgbe.c,v 1.199.2.10 2020/01/28 11:09:27 martin Exp $ */
 
 /**
 
@@ -776,6 +776,7 @@ ixgbe_attach(device_t parent, device_t d
 	pcireg_t	id, subid;
 	const ixgbe_vendor_info_t *ent;
 	struct pci_attach_args *pa = aux;
+	bool unsupported_sfp = false;
 	const char *str;
 	char buf[256];
 
@@ -959,8 +960,8 @@ ixgbe_attach(device_t parent, device_t d
 		error = IXGBE_SUCCESS;
 	} else if (error == IXGBE_ERR_SFP_NOT_SUPPORTED) {
 		aprint_error_dev(dev, "Unsupported SFP+ module detected!\n");
-		error = EIO;
-		goto err_late;
+		unsupported_sfp = true;
+		error = IXGBE_SUCCESS;
 	} else if (error) {
 		aprint_error_dev(dev, "Hardware initialization failed\n");
 		error = EIO;
@@ -1129,13 +1130,6 @@ ixgbe_attach(device_t parent, device_t d
 		"please contact your Intel or hardware representative "
 		"who provided you with this hardware.\n");
 		break;
-	case IXGBE_ERR_SFP_NOT_SUPPORTED:
-		aprint_error_dev(dev, "Unsupported SFP+ Module\n");
-		error = EIO;
-		goto err_late;
-	case IXGBE_ERR_SFP_NOT_PRESENT:
-		aprint_error_dev(dev, "No SFP+ Module found\n");
-		/* falls thru */
 	default:
 		break;
 	}
@@ -1168,16 +1162,22 @@ ixgbe_attach(device_t parent, device_t d
 			oui, model, rev);
 	}
 
-	/* Enable the optics for 82599 SFP+ fiber */
-	ixgbe_enable_tx_laser(hw);
-
 	/* Enable EEE power saving */
 	if (adapter->feat_cap & IXGBE_FEATURE_EEE)
 		hw->mac.ops.setup_eee(hw,
 		adapter->feat_en & IXGBE_FEATURE_EEE);
 
 	/* Enable power to the phy. */
-	ixgbe_set_phy_power(hw, TRUE);
+	if (!unsupported_sfp) {
+		/* Enable the optics for 82599 SFP+ fiber */
+		ixgbe_enable_tx_laser(hw);
+
+		/*
+		 * XXX Currently, ixgbe_set_phy_power() supports only copper
+		 * PHY, so it's not required to test with !unsupported_sfp.
+		 */
+		ixgbe_set_phy_power(hw, TRUE);
+	}
 
 	/* Initialize statistics */
 	ixgbe_update_stats_counters(adapter);
@@ -3896,6 +3896,7 @@ ixgbe_init_locked(struct adapter *adapte
 	u32		txdctl, mhadd;
 	u32		rxdctl, rxctrl;
 	u32		ctrl_ext;
+	bool		unsupported_sfp = false;
 	int		i, j, err;
 
 	/* XXX check IFF_UP and IFF_RUNNING, power-saving state! */
@@ -3903,6 +3904,7 @@ ixgbe_init_locked(struct adapter *adapte
 	KASSERT(mutex_owned(>core_mtx));
 	INIT_DEBUGOUT("ixgbe_init_locked: begin");
 
+	hw->need_unsupported_sfp_recovery = false;
 	hw->adapter_stopped = FALSE;
 	ixgbe_stop_adapter(hw);
 	callout_stop(>timer);
@@ -4076,12 +4078,14 @@ ixgbe_init_locked(struct adapter *adapte
 	 */
 	if (hw->phy.type == ixgbe_phy_none) {
 		err = hw->phy.ops.identify(hw);
-		if (err == IXGBE_ERR_SFP_NOT_SUPPORTED) {
-			device_printf(dev,
-			"Unsupported SFP+ module type was detected.\n");
-			return;
-		}
-	}
+		if (err == IXGBE_ERR_SFP_NOT_SUPPORTED)
+			unsupported_sfp = true;
+	} else if (hw->phy.type == ixgbe_phy_sfp_unsupported)
+		unsupported_sfp = true;
+
+	if (unsupported_sfp)
+		device_printf(dev,
+		"Unsupported SFP+ module type was detected.\n");
 
 	/* Set moderation on the Link 

CVS commit: [netbsd-9] src/sys/dev/mii

2020-01-28 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Jan 28 11:04:14 UTC 2020

Modified Files:
src/sys/dev/mii [netbsd-9]: makphy.c makphyreg.h

Log Message:
Pull up the following, requested by msaitoh in ticket #663:

sys/dev/mii/makphy.c1.61, 1.63-1.64 via patch
sys/dev/mii/makphyreg.h 1.10

- Remove ESSR_FIBER_LINK bit check in makphyattach(). This bit is
  valid only when the link is up, so it's not good to check in the
  attach function.
- There is an environment that both copper and fiber bits are set in
  EXTSR but it support copper only. To resolve this problem, check the
  ESSR register's HWCFG_MODE bit and drop unsupported bits.
- If the chip is in Fiber/Copper auto select mode, check which media is
  selected. Currently, the code supports 88E1011, 88E and 88E1112
  only.
- Fix comment. KNF.


To generate a diff of this commit:
cvs rdiff -u -r1.60 -r1.60.2.1 src/sys/dev/mii/makphy.c
cvs rdiff -u -r1.9 -r1.9.6.1 src/sys/dev/mii/makphyreg.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/mii/makphy.c
diff -u src/sys/dev/mii/makphy.c:1.60 src/sys/dev/mii/makphy.c:1.60.2.1
--- src/sys/dev/mii/makphy.c:1.60	Wed Jul  3 17:40:29 2019
+++ src/sys/dev/mii/makphy.c	Tue Jan 28 11:04:14 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: makphy.c,v 1.60 2019/07/03 17:40:29 maxv Exp $	*/
+/*	$NetBSD: makphy.c,v 1.60.2.1 2020/01/28 11:04:14 martin Exp $	*/
 
 /*-
  * Copyright (c) 1998, 1999, 2000, 2001 The NetBSD Foundation, Inc.
@@ -59,7 +59,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: makphy.c,v 1.60 2019/07/03 17:40:29 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: makphy.c,v 1.60.2.1 2020/01/28 11:04:14 martin Exp $");
 
 #include 
 #include 
@@ -201,21 +201,6 @@ page0:
 		break;
 	}
 
-	switch (model) {
-	case MII_MODEL_xxMARVELL_E1011:
-	case MII_MODEL_xxMARVELL_E1112:
-		if (PHY_READ(sc, MAKPHY_ESSR, ) != 0) {
-			aprint_verbose_dev(self,
-			"Failed to read MAKPHY_ESSR\n");
-			break;
-		}
-		if (reg & ESSR_FIBER_LINK)
-			sc->mii_flags |= MIIF_HAVEFIBER;
-		break;
-	default:
-		break;
-	}
-
 	PHY_RESET(sc);
 
 	PHY_READ(sc, MII_BMSR, >mii_capabilities);
@@ -223,6 +208,55 @@ page0:
 	if (sc->mii_capabilities & BMSR_EXTSTAT)
 		PHY_READ(sc, MII_EXTSR, >mii_extcapabilities);
 
+	if (((sc->mii_extcapabilities & (EXTSR_1000TFDX | EXTSR_1000THDX))
+		!= 0)
+	&& ((sc->mii_extcapabilities & (EXTSR_1000XFDX | EXTSR_1000XHDX))
+		!= 0)) {
+		bool fiberonly = false, copperonly = false;
+
+		/* Both copper and fiber are set. check MODE[] */
+		switch (sc->mii_mpd_model) {
+		case MII_MODEL_xxMARVELL_E1011:
+		case MII_MODEL_xxMARVELL_E:
+			/* These devices have ESSR register */
+			PHY_READ(sc, MAKPHY_ESSR, );
+			if ((reg & ESSR_AUTOSEL_DISABLE) != 0) {
+switch (reg & ESSR_HWCFG_MODE) {
+case ESSR_RTBI_FIBER:
+case ESSR_RGMII_FIBER:
+case ESSR_RGMII_SGMII: /* right? */
+case ESSR_TBI_FIBER:
+case ESSR_GMII_FIBER:
+	fiberonly = true;
+	break;
+case ESSR_SGMII_WC_COPPER:
+case ESSR_SGMII_WOC_COPPER:
+case ESSR_RTBI_COPPER:
+case ESSR_RGMII_COPPER:
+case ESSR_GMII_COPPER:
+	copperonly = true;
+default:
+	break;
+}
+			}
+			break;
+		default:
+			break;
+		}
+		if (fiberonly || copperonly)
+			aprint_debug_dev(self, "both copper and fiber are set "
+			"but MODE[] is %s only.\n",
+			fiberonly ? "fiber" : "copper");
+		if (fiberonly)
+			sc->mii_extcapabilities
+			&= ~(EXTSR_1000TFDX | EXTSR_1000THDX);
+		else if (copperonly) {
+			sc->mii_extcapabilities
+			&= ~(EXTSR_1000XFDX | EXTSR_1000XHDX);
+			sc->mii_flags &= ~MIIF_IS_1000X;
+		}
+	}
+
 	aprint_normal_dev(self, "");
 	if ((sc->mii_capabilities & BMSR_MEDIAMASK) == 0 &&
 	(sc->mii_extcapabilities & EXTSR_MEDIAMASK) == 0)
@@ -240,9 +274,7 @@ makphy_reset(struct mii_softc *sc)
 
 	mii_phy_reset(sc);
 
-	/*
-	 * Initialize PHY Specific Control Register.
-	 */
+	/* Initialize PHY Specific Control Register. */
 	PHY_READ(sc, MAKPHY_PSCR, );
 
 	/* Assert CRS on transmit. */
@@ -387,7 +419,7 @@ static void
 makphy_status(struct mii_softc *sc)
 {
 	struct mii_data *mii = sc->mii_pdata;
-	uint16_t bmcr, gsr, pssr;
+	uint16_t bmcr, gsr, pssr, essr;
 
 	mii->mii_media_status = IFM_AVALID;
 	mii->mii_media_active = IFM_ETHER;
@@ -425,10 +457,45 @@ makphy_status(struct mii_softc *sc)
 		}
 	}
 
-	/* XXX FIXME: Use different page for Fiber on newer chips */
+	/*
+	 * XXX The following code support Fiber/Copper auto select mode
+	 * only for 88E1011, 88E and 88E1112. For other chips, the document
+	 * is required.
+	 */
 	if (sc->mii_flags & MIIF_IS_1000X) {
+		/* Not in Fiber/Copper auto select mode */
+		mii->mii_media_active |= IFM_1000_SX;
+	} else if ((sc->mii_mpd_model == MII_MODEL_xxMARVELL_E1011) ||
+	(sc->mii_mpd_model == MII_MODEL_xxMARVELL_E)) {
+		/* Fiber/Copper auto select mode */
+
+		

CVS commit: [netbsd-9] src/sys

2020-01-28 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Jan 28 11:01:37 UTC 2020

Modified Files:
src/sys/arch/arm/omap [netbsd-9]: if_cpsw.c
src/sys/arch/arm/ti [netbsd-9]: if_cpsw.c
src/sys/arch/x86/pci [netbsd-9]: if_vmx.c
src/sys/dev/isa [netbsd-9]: if_iy.c
src/sys/dev/pci [netbsd-9]: if_de.c
src/sys/dev/pcmcia [netbsd-9]: if_ray.c if_xi.c

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #662):

sys/dev/pcmcia/if_xi.c: revision 1.93
sys/arch/x86/pci/if_vmx.c: revision 1.54
sys/dev/pci/if_de.c: revision 1.165
sys/arch/arm/ti/if_cpsw.c: revision 1.10
sys/arch/arm/omap/if_cpsw.c: revision 1.26
sys/dev/isa/if_iy.c: revision 1.112
sys/dev/pcmcia/if_ray.c: revision 1.96

Add ETHER_LOCK() and ETHER_UNLOCK() to protect ec_multiaddrs.

XXX These drivers don't check whether enm_addrlo and enm_addrhi are the same
or not, so it won't work correctly if an multicast address entry has a range.

Protect ec_multicnt.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.25.2.1 src/sys/arch/arm/omap/if_cpsw.c
cvs rdiff -u -r1.6.2.1 -r1.6.2.2 src/sys/arch/arm/ti/if_cpsw.c
cvs rdiff -u -r1.45.2.5 -r1.45.2.6 src/sys/arch/x86/pci/if_vmx.c
cvs rdiff -u -r1.109.2.1 -r1.109.2.2 src/sys/dev/isa/if_iy.c
cvs rdiff -u -r1.163 -r1.163.2.1 src/sys/dev/pci/if_de.c
cvs rdiff -u -r1.94.2.1 -r1.94.2.2 src/sys/dev/pcmcia/if_ray.c
cvs rdiff -u -r1.90.2.1 -r1.90.2.2 src/sys/dev/pcmcia/if_xi.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/arch/arm/omap/if_cpsw.c
diff -u src/sys/arch/arm/omap/if_cpsw.c:1.25 src/sys/arch/arm/omap/if_cpsw.c:1.25.2.1
--- src/sys/arch/arm/omap/if_cpsw.c:1.25	Wed May 29 06:17:27 2019
+++ src/sys/arch/arm/omap/if_cpsw.c	Tue Jan 28 11:01:37 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_cpsw.c,v 1.25 2019/05/29 06:17:27 msaitoh Exp $	*/
+/*	$NetBSD: if_cpsw.c,v 1.25.2.1 2020/01/28 11:01:37 martin Exp $	*/
 
 /*
  * Copyright (c) 2013 Jonathan A. Kollasch
@@ -53,7 +53,7 @@
  */
 
 #include 
-__KERNEL_RCSID(1, "$NetBSD: if_cpsw.c,v 1.25 2019/05/29 06:17:27 msaitoh Exp $");
+__KERNEL_RCSID(1, "$NetBSD: if_cpsw.c,v 1.25.2.1 2020/01/28 11:01:37 martin Exp $");
 
 #include 
 #include 
@@ -1543,9 +1543,11 @@ cpsw_ale_update_addresses(struct cpsw_so
 		cpsw_ale_remove_all_mc_entries(sc);
 
 	/* Set other multicast addrs desired. */
+	ETHER_LOCK(ec);
 	LIST_FOREACH(ifma, >ec_multiaddrs, enm_list) {
 		cpsw_ale_mc_entry_set(sc, ALE_PORT_MASK_ALL, ifma->enm_addrlo);
 	}
+	ETHER_UNLOCK(ec);
 
 	return 0;
 }

Index: src/sys/arch/arm/ti/if_cpsw.c
diff -u src/sys/arch/arm/ti/if_cpsw.c:1.6.2.1 src/sys/arch/arm/ti/if_cpsw.c:1.6.2.2
--- src/sys/arch/arm/ti/if_cpsw.c:1.6.2.1	Wed Nov 27 13:46:45 2019
+++ src/sys/arch/arm/ti/if_cpsw.c	Tue Jan 28 11:01:37 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_cpsw.c,v 1.6.2.1 2019/11/27 13:46:45 martin Exp $	*/
+/*	$NetBSD: if_cpsw.c,v 1.6.2.2 2020/01/28 11:01:37 martin Exp $	*/
 
 /*
  * Copyright (c) 2013 Jonathan A. Kollasch
@@ -53,7 +53,7 @@
  */
 
 #include 
-__KERNEL_RCSID(1, "$NetBSD: if_cpsw.c,v 1.6.2.1 2019/11/27 13:46:45 martin Exp $");
+__KERNEL_RCSID(1, "$NetBSD: if_cpsw.c,v 1.6.2.2 2020/01/28 11:01:37 martin Exp $");
 
 #include 
 #include 
@@ -1555,9 +1555,11 @@ cpsw_ale_update_addresses(struct cpsw_so
 		cpsw_ale_remove_all_mc_entries(sc);
 
 	/* Set other multicast addrs desired. */
+	ETHER_LOCK(ec);
 	LIST_FOREACH(ifma, >ec_multiaddrs, enm_list) {
 		cpsw_ale_mc_entry_set(sc, ALE_PORT_MASK_ALL, ifma->enm_addrlo);
 	}
+	ETHER_UNLOCK(ec);
 
 	return 0;
 }

Index: src/sys/arch/x86/pci/if_vmx.c
diff -u src/sys/arch/x86/pci/if_vmx.c:1.45.2.5 src/sys/arch/x86/pci/if_vmx.c:1.45.2.6
--- src/sys/arch/x86/pci/if_vmx.c:1.45.2.5	Thu Dec 26 20:19:37 2019
+++ src/sys/arch/x86/pci/if_vmx.c	Tue Jan 28 11:01:37 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_vmx.c,v 1.45.2.5 2019/12/26 20:19:37 martin Exp $	*/
+/*	$NetBSD: if_vmx.c,v 1.45.2.6 2020/01/28 11:01:37 martin Exp $	*/
 /*	$OpenBSD: if_vmx.c,v 1.16 2014/01/22 06:04:17 brad Exp $	*/
 
 /*
@@ -19,7 +19,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_vmx.c,v 1.45.2.5 2019/12/26 20:19:37 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_vmx.c,v 1.45.2.6 2020/01/28 11:01:37 martin Exp $");
 
 #include 
 #include 
@@ -3320,16 +3320,15 @@ vmxnet3_set_rxfilter(struct vmxnet3_soft
 	 */
 	mode = VMXNET3_RXMODE_BCAST | VMXNET3_RXMODE_UCAST;
 
+	ETHER_LOCK(ec);
 	if (ISSET(ifp->if_flags, IFF_PROMISC) ||
 	ec->ec_multicnt > VMXNET3_MULTICAST_MAX)
 		goto allmulti;
 
 	p = sc->vmx_mcast;
-	ETHER_LOCK(ec);
 	ETHER_FIRST_MULTI(step, ec, enm);
 	while (enm != NULL) {
 		if (memcmp(enm->enm_addrlo, enm->enm_addrhi, ETHER_ADDR_LEN)) {
-			ETHER_UNLOCK(ec);
 			/*
 			 * We must listen to a range of multicast addresses.
 			 * For now, just accept all multicasts, rather than
@@ -3346,17 +3345,16 @@ vmxnet3_set_rxfilter(struct 

CVS commit: [netbsd-9] src/doc

2020-01-28 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue Jan 28 10:21:39 UTC 2020

Modified Files:
src/doc [netbsd-9]: CHANGES-9.0

Log Message:
 Ticket #668 and #669.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.168 -r1.1.2.169 src/doc/CHANGES-9.0

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

Modified files:

Index: src/doc/CHANGES-9.0
diff -u src/doc/CHANGES-9.0:1.1.2.168 src/doc/CHANGES-9.0:1.1.2.169
--- src/doc/CHANGES-9.0:1.1.2.168	Tue Jan 28 09:10:10 2020
+++ src/doc/CHANGES-9.0	Tue Jan 28 10:21:39 2020
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-9.0,v 1.1.2.168 2020/01/28 09:10:10 msaitoh Exp $
+# $NetBSD: CHANGES-9.0,v 1.1.2.169 2020/01/28 10:21:39 msaitoh Exp $
 
 A complete list of changes from the initial NetBSD 9.0 branch on 2019-07-30
 until the 9.0 release:
@@ -8362,3 +8362,115 @@ distrib/evbmips/instkernel/ramdisk/Makef
 
 	PR install/54777: Add dhcpcd to the install ramdisk.
 	[martin, ticket #666]
+
+usr.sbin/sysinst/arch/arc/md.c			1.11-1.12
+usr.sbin/sysinst/arch/bebox/md.c		1.7-1.8
+usr.sbin/sysinst/arch/cobalt/md.c		1.11-1.12
+usr.sbin/sysinst/arch/evbarm/md.c		1.11-1.14
+usr.sbin/sysinst/arch/evbarm/md.h		1.4-1.5
+usr.sbin/sysinst/arch/evbmips/md.c		1.7-1.8
+usr.sbin/sysinst/arch/evbppc/md.c		1.7-1.8
+usr.sbin/sysinst/arch/hpcarm/md.c		1.7-1.8
+usr.sbin/sysinst/arch/hpcmips/md.c		1.7-1.8
+usr.sbin/sysinst/arch/hpcsh/md.c		1.8-1.9
+usr.sbin/sysinst/arch/i386/md.c			1.28-1.29
+usr.sbin/sysinst/arch/landisk/md.c		1.12-1.13
+usr.sbin/sysinst/arch/luna68k/md.c		1.8
+usr.sbin/sysinst/arch/ofppc/md.c		1.9-1.10
+usr.sbin/sysinst/arch/playstation2/md.c		1.7-1.8
+usr.sbin/sysinst/arch/prep/md.c			1.11-1.12
+usr.sbin/sysinst/arch/sandpoint/md.c		1.7-1.8
+usr.sbin/sysinst/arch/zaurus/md.c		1.7-1.8
+usr.sbin/sysinst/bsddisklabel.c			1.34-1.38
+usr.sbin/sysinst/defs.h1.50-1.54
+usr.sbin/sysinst/disklabel.c			1.28-1.34
+usr.sbin/sysinst/disks.c			1.59-1.62
+usr.sbin/sysinst/gpt.c1.14-1.16
+usr.sbin/sysinst/install.c			1.14
+usr.sbin/sysinst/label.c			1.18-1.20
+usr.sbin/sysinst/main.c1.20
+usr.sbin/sysinst/mbr.c1.24-1.30
+usr.sbin/sysinst/menus.mi			1.20-1.21
+usr.sbin/sysinst/menus.pm			1.3
+usr.sbin/sysinst/msg.mi.de			1.20
+usr.sbin/sysinst/msg.mi.en			1.27
+usr.sbin/sysinst/msg.mi.es			1.21
+usr.sbin/sysinst/msg.mi.fr			1.25
+usr.sbin/sysinst/msg.mi.pl			1.28
+usr.sbin/sysinst/msg.pm.de			1.2
+usr.sbin/sysinst/msg.pm.en			1.2
+usr.sbin/sysinst/msg.pm.es			1.2
+usr.sbin/sysinst/msg.pm.fr			1.2
+usr.sbin/sysinst/msg.pm.pl			1.2
+usr.sbin/sysinst/net.c1.35
+usr.sbin/sysinst/part_edit.c			1.14-1.16
+usr.sbin/sysinst/partitions.c			1.9-1.10
+usr.sbin/sysinst/partitions.h			1.13-1.15
+usr.sbin/sysinst/partman.c			1.43, 1.46-1.49
+usr.sbin/sysinst/sizemultname.c			1.4
+usr.sbin/sysinst/target.c			1.11
+usr.sbin/sysinst/upgrade.c			1.14
+usr.sbin/sysinst/util.c1.41-1.42
+
+	Various sysinst fixes:
+	 - Fix extended partitioning.
+	 - Fix retrying after set extraction/download failure.
+	 - Fix support for non 512 byte/sector disks.
+	 - Remove runtime dependency on ofctl(8).
+	 - Fix various small partitioning bugs and fixes, including
+	   PR install/54787, PR install/54872 and a workaround
+	   for PR kern/54882.
+	 - Add tmpfs on /tmp by default when enough RAM is available.
+	 - Adapt to evbarm GENERIC{,64} changes and efiboot.
+	[martin, ticket #668]
+
+distrib/acorn32/ramdisk/dot.profile		1.4
+distrib/alpha/instkernel/ramdisk/dot.profile	1.11
+distrib/amd64/ramdisks/common/dot.profile	1.4
+distrib/arc/ramdisk/dot.profile			1.5
+distrib/atari/floppies/common/dot.profile	1.8
+distrib/bebox/ramdisk/dot.profile		1.2
+distrib/cats/ramdisk/dot.profile		1.5
+distrib/cobalt/ramdisk/dot.profile		1.2
+distrib/dreamcast/ramdisk/dot.profile		1.3
+distrib/emips/miniroot/dot.profile		1.2
+distrib/emips/ramdisk/dot.profile		1.3
+distrib/evbarm/instkernel/ramdisk/dot.profile	1.3
+distrib/evbmips/instkernel/ramdisk/dot.profile	1.2
+distrib/evbppc/ramdisk/dot.profile		1.5
+distrib/evbsh3/instkernel/ramdisk/dot.profile	1.2
+distrib/ews4800mips/floppies/ramdisk/dot.profile 1.2
+distrib/hp300/ramdisk/dot.profile		1.7
+distrib/hpcarm/miniroot/dot.profile		1.3
+distrib/hpcmips/miniroot/dot.profile		1.8
+distrib/hpcsh/miniroot/dot.profile		1.5
+distrib/hppa/ramdisk/dot.profile		1.2
+distrib/i386/ramdisks/common/dot.profile	1.7
+distrib/landisk/ramdisk/dot.profile		1.3
+distrib/luna68k/ramdisk/dot.profile		1.2
+distrib/mac68k/instkernel/ramdisk/dot.profile	1.9
+distrib/macppc/floppies/ramdisk/dot.profile	1.14
+distrib/mipsco/ramdisk/dot.profile		1.3
+distrib/mvme68k/miniroot/dot.profile		1.9
+distrib/news68k/floppies/ramdisk/dot.profile	1.8
+distrib/newsmips/floppies/ramdisk/dot.profile	1.7
+distrib/ofppc/ramdisks/common/dot.profile	1.2
+distrib/playstation2/miniroot/dot.profile	1.5
+distrib/pmax/miniroot/dot.profile		1.3
+distrib/pmax/ramdisk/dot.profile		1.11
+distrib/prep/floppies/ramdisk/dot.profile	1.3

CVS commit: [netbsd-9] src/distrib

2020-01-28 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue Jan 28 10:20:28 UTC 2020

Modified Files:
src/distrib/acorn32/ramdisk [netbsd-9]: dot.profile
src/distrib/alpha/instkernel/ramdisk [netbsd-9]: dot.profile
src/distrib/amd64/ramdisks/common [netbsd-9]: dot.profile
src/distrib/arc/ramdisk [netbsd-9]: dot.profile
src/distrib/atari/floppies/common [netbsd-9]: dot.profile
src/distrib/bebox/ramdisk [netbsd-9]: dot.profile
src/distrib/cats/ramdisk [netbsd-9]: dot.profile
src/distrib/cobalt/ramdisk [netbsd-9]: dot.profile
src/distrib/dreamcast/ramdisk [netbsd-9]: dot.profile
src/distrib/emips/miniroot [netbsd-9]: dot.profile
src/distrib/emips/ramdisk [netbsd-9]: dot.profile
src/distrib/evbarm/instkernel/ramdisk [netbsd-9]: dot.profile
src/distrib/evbmips/instkernel/ramdisk [netbsd-9]: dot.profile
src/distrib/evbppc/ramdisk [netbsd-9]: dot.profile
src/distrib/evbsh3/instkernel/ramdisk [netbsd-9]: dot.profile
src/distrib/ews4800mips/floppies/ramdisk [netbsd-9]: dot.profile
src/distrib/hp300/ramdisk [netbsd-9]: dot.profile
src/distrib/hpcarm/miniroot [netbsd-9]: dot.profile
src/distrib/hpcmips/miniroot [netbsd-9]: dot.profile
src/distrib/hpcsh/miniroot [netbsd-9]: dot.profile
src/distrib/hppa/ramdisk [netbsd-9]: dot.profile
src/distrib/i386/ramdisks/common [netbsd-9]: dot.profile
src/distrib/landisk/ramdisk [netbsd-9]: dot.profile
src/distrib/luna68k/ramdisk [netbsd-9]: dot.profile
src/distrib/mac68k/instkernel/ramdisk [netbsd-9]: dot.profile
src/distrib/macppc/floppies/ramdisk [netbsd-9]: dot.profile
src/distrib/mipsco/ramdisk [netbsd-9]: dot.profile
src/distrib/mvme68k/miniroot [netbsd-9]: dot.profile
src/distrib/news68k/floppies/ramdisk [netbsd-9]: dot.profile
src/distrib/newsmips/floppies/ramdisk [netbsd-9]: dot.profile
src/distrib/ofppc/ramdisks/common [netbsd-9]: dot.profile
src/distrib/playstation2/miniroot [netbsd-9]: dot.profile
src/distrib/pmax/miniroot [netbsd-9]: dot.profile
src/distrib/pmax/ramdisk [netbsd-9]: dot.profile
src/distrib/prep/floppies/ramdisk [netbsd-9]: dot.profile
src/distrib/riscv/ramdisk [netbsd-9]: dot.profile
src/distrib/rs6000/ramdisk [netbsd-9]: dot.profile
src/distrib/sandpoint/ramdisk [netbsd-9]: dot.profile
src/distrib/sgimips/miniroot [netbsd-9]: dot.profile
src/distrib/sgimips/ramdisk [netbsd-9]: dot.profile
src/distrib/shark/instkernel/ramdisk [netbsd-9]: dot.profile
src/distrib/sparc/miniroot [netbsd-9]: dot.profile
src/distrib/sparc64/instfs [netbsd-9]: dot.profile
src/distrib/vax/ramdisk [netbsd-9]: dot.profile
src/distrib/x68k/floppies/ramdisk [netbsd-9]: dot.profile
src/distrib/zaurus/ramdisk [netbsd-9]: dot.profile

Log Message:
Pull up following revision(s) (requested by martin in ticket #669):
distrib/playstation2/miniroot/dot.profile: revision 1.5
distrib/sparc64/instfs/dot.profile: revision 1.8
distrib/hpcarm/miniroot/dot.profile: revision 1.3
distrib/emips/miniroot/dot.profile: revision 1.2
distrib/x68k/floppies/ramdisk/dot.profile: revision 1.16
distrib/zaurus/ramdisk/dot.profile: revision 1.4
distrib/i386/ramdisks/common/dot.profile: revision 1.7
distrib/cobalt/ramdisk/dot.profile: revision 1.2
distrib/hpcsh/miniroot/dot.profile: revision 1.5
distrib/evbarm/instkernel/ramdisk/dot.profile: revision 1.3
distrib/riscv/ramdisk/dot.profile: revision 1.2
distrib/sandpoint/ramdisk/dot.profile: revision 1.2
distrib/landisk/ramdisk/dot.profile: revision 1.3
distrib/amd64/ramdisks/common/dot.profile: revision 1.4
distrib/macppc/floppies/ramdisk/dot.profile: revision 1.14
distrib/mipsco/ramdisk/dot.profile: revision 1.3
distrib/evbmips/instkernel/ramdisk/dot.profile: revision 1.2
distrib/acorn32/ramdisk/dot.profile: revision 1.4
distrib/cats/ramdisk/dot.profile: revision 1.5
distrib/vax/ramdisk/dot.profile: revision 1.10
distrib/pmax/miniroot/dot.profile: revision 1.3
distrib/sparc/miniroot/dot.profile: revision 1.16
distrib/hpcmips/miniroot/dot.profile: revision 1.8
distrib/prep/floppies/ramdisk/dot.profile: revision 1.3
distrib/news68k/floppies/ramdisk/dot.profile: revision 1.8
distrib/alpha/instkernel/ramdisk/dot.profile: revision 1.11
distrib/ofppc/ramdisks/common/dot.profile: revision 1.2
distrib/mac68k/instkernel/ramdisk/dot.profile: revision 1.9
distrib/hp300/ramdisk/dot.profile: revision 1.7
distrib/ews4800mips/floppies/ramdisk/dot.profile: revision 1.2
distrib/emips/ramdisk/dot.profile: revision 1.3

CVS commit: [netbsd-9] src

2020-01-28 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Jan 28 09:48:34 UTC 2020

Modified Files:
src/doc [netbsd-9]: 3RDPARTY
src/external/bsd/dhcpcd/dist/src [netbsd-9]: defs.h dhcp.c if-bsd.c
ipv6.c ipv6.h ipv6nd.c script.c

Log Message:
Pull up the following, requested by roy in ticket # 661:

external/bsd/dhcpcd/dist/src/defs.h up to 1.1.1.37
external/bsd/dhcpcd/dist/src/dhcp.c up to 1.32
external/bsd/dhcpcd/dist/src/if-bsd.c   up to 1.16
external/bsd/dhcpcd/dist/src/ipv6.c up to 1.8
external/bsd/dhcpcd/dist/src/ipv6.h up to 1.8
external/bsd/dhcpcd/dist/src/ipv6nd.c   up to 1.16
external/bsd/dhcpcd/dist/src/script.c   up to 1.2
doc/3RDPARTYmanually edited

Update to dhcpcd-8.1.6 with the following changes:

 * INET6: Support a /128 prefix advertised via RA
 * BSD: More address validation from route(4) messages
 * DHCP: Fix a potential segfault on DaD failure
 * IPv4LL: Fix a potential segfault when dropping IPv4LL addresses


To generate a diff of this commit:
cvs rdiff -u -r1.1640.2.11 -r1.1640.2.12 src/doc/3RDPARTY
cvs rdiff -u -r1.1.1.25.2.5 -r1.1.1.25.2.6 \
src/external/bsd/dhcpcd/dist/src/defs.h
cvs rdiff -u -r1.23.2.5 -r1.23.2.6 src/external/bsd/dhcpcd/dist/src/dhcp.c
cvs rdiff -u -r1.10.2.3 -r1.10.2.4 src/external/bsd/dhcpcd/dist/src/if-bsd.c
cvs rdiff -u -r1.3.2.4 -r1.3.2.5 src/external/bsd/dhcpcd/dist/src/ipv6.c
cvs rdiff -u -r1.3.2.3 -r1.3.2.4 src/external/bsd/dhcpcd/dist/src/ipv6.h
cvs rdiff -u -r1.10.2.4 -r1.10.2.5 src/external/bsd/dhcpcd/dist/src/ipv6nd.c
cvs rdiff -u -r1.1.1.10.2.2 -r1.1.1.10.2.3 \
src/external/bsd/dhcpcd/dist/src/script.c

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

Modified files:

Index: src/doc/3RDPARTY
diff -u src/doc/3RDPARTY:1.1640.2.11 src/doc/3RDPARTY:1.1640.2.12
--- src/doc/3RDPARTY:1.1640.2.11	Mon Jan 27 07:26:41 2020
+++ src/doc/3RDPARTY	Tue Jan 28 09:48:33 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: 3RDPARTY,v 1.1640.2.11 2020/01/27 07:26:41 martin Exp $
+#	$NetBSD: 3RDPARTY,v 1.1640.2.12 2020/01/28 09:48:33 martin Exp $
 #
 # This file contains a list of the software that has been integrated into
 # NetBSD where we are not the primary maintainer.
@@ -341,12 +341,12 @@ Notes:
 Use the dhcp2netbsd script.
 
 Package:	dhcpcd
-Version:	8.1.5
-Current Vers:	8.1.5
+Version:	8.1.6
+Current Vers:	8.1.6
 Maintainer:	roy
 Archive Site:	ftp://roy.marples.name/pub/dhcpcd/
 Home Page:	http://roy.marples.name/projects/dhcpcd/
-Date:		2020-01-03
+Date:		2020-01-27
 Mailing List: 	dhcpcd-disc...@marples.name
 License:	BSD (2-clause)
 Location:	external/bsd/dhcpcd/dist

Index: src/external/bsd/dhcpcd/dist/src/defs.h
diff -u src/external/bsd/dhcpcd/dist/src/defs.h:1.1.1.25.2.5 src/external/bsd/dhcpcd/dist/src/defs.h:1.1.1.25.2.6
--- src/external/bsd/dhcpcd/dist/src/defs.h:1.1.1.25.2.5	Sun Jan  5 09:38:28 2020
+++ src/external/bsd/dhcpcd/dist/src/defs.h	Tue Jan 28 09:48:34 2020
@@ -29,7 +29,7 @@
 #define CONFIG_H
 
 #define PACKAGE			"dhcpcd"
-#define VERSION			"8.1.5"
+#define VERSION			"8.1.6"
 
 #ifndef CONFIG
 # define CONFIG			SYSCONFDIR "/" PACKAGE ".conf"

Index: src/external/bsd/dhcpcd/dist/src/dhcp.c
diff -u src/external/bsd/dhcpcd/dist/src/dhcp.c:1.23.2.5 src/external/bsd/dhcpcd/dist/src/dhcp.c:1.23.2.6
--- src/external/bsd/dhcpcd/dist/src/dhcp.c:1.23.2.5	Sun Jan  5 09:38:28 2020
+++ src/external/bsd/dhcpcd/dist/src/dhcp.c	Tue Jan 28 09:48:34 2020
@@ -2335,9 +2335,10 @@ dhcp_message_new(struct bootp **bootp,
 static void
 dhcp_arp_defend_failed(struct arp_state *astate)
 {
+	struct interface *ifp = astate->iface;
 
-	dhcp_drop(astate->iface, "EXPIRED");
-	dhcp_start1(astate->iface);
+	dhcp_drop(ifp, "EXPIRED");
+	dhcp_start1(ifp);
 }
 #endif
 

Index: src/external/bsd/dhcpcd/dist/src/if-bsd.c
diff -u src/external/bsd/dhcpcd/dist/src/if-bsd.c:1.10.2.3 src/external/bsd/dhcpcd/dist/src/if-bsd.c:1.10.2.4
--- src/external/bsd/dhcpcd/dist/src/if-bsd.c:1.10.2.3	Fri Nov 22 08:01:50 2019
+++ src/external/bsd/dhcpcd/dist/src/if-bsd.c	Tue Jan 28 09:48:34 2020
@@ -860,8 +860,6 @@ if_address(unsigned char cmd, const stru
 	return r;
 }
 
-
-
 #if !(defined(HAVE_IFADDRS_ADDRFLAGS) && defined(HAVE_IFAM_ADDRFLAGS))
 int
 if_addrflags(const struct interface *ifp, const struct in_addr *addr,
@@ -1194,7 +1192,7 @@ if_ifa(struct dhcpcd_ctx *ctx, const str
 {
 	struct interface *ifp;
 	const struct sockaddr *rti_info[RTAX_MAX];
-	int addrflags;
+	int flags;
 	pid_t pid;
 
 	if (ifam->ifam_msglen < sizeof(*ifam)) {
@@ -1216,9 +1214,6 @@ if_ifa(struct dhcpcd_ctx *ctx, const str
 	pid = 0;
 #endif
 
-#ifdef HAVE_IFAM_ADDRFLAGS
-	addrflags = ifam->ifam_addrflags;
-#endif
 	switch (rti_info[RTAX_IFA]->sa_family) {
 	case AF_LINK:
 	{
@@ -1252,78 +1247,70 @@ if_ifa(struct dhcpcd_ctx *ctx, const str
 		bcast.s_addr = sin != 

CVS commit: [netbsd-8] src/doc

2020-01-28 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Jan 28 09:36:21 UTC 2020

Modified Files:
src/doc [netbsd-8]: CHANGES-8.2

Log Message:
Ticket #1493


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.91 -r1.1.2.92 src/doc/CHANGES-8.2

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

Modified files:

Index: src/doc/CHANGES-8.2
diff -u src/doc/CHANGES-8.2:1.1.2.91 src/doc/CHANGES-8.2:1.1.2.92
--- src/doc/CHANGES-8.2:1.1.2.91	Fri Jan 24 18:50:19 2020
+++ src/doc/CHANGES-8.2	Tue Jan 28 09:36:21 2020
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-8.2,v 1.1.2.91 2020/01/24 18:50:19 martin Exp $
+# $NetBSD: CHANGES-8.2,v 1.1.2.92 2020/01/28 09:36:21 martin Exp $
 
 A complete list of changes from the NetBSD 8.1 release to the NetBSD 8.2
 release:
@@ -1960,3 +1960,19 @@ sys/dev/pci/if_wmreg.h			1.116-1.117
 	- Fix comment. Add comment.
 	- KNF.
 	[msaitoh, ticket #1492]
+
+sys/dev/mii/makphy.c			1.61, 1.63-1.64 via patch
+sys/dev/mii/makphyreg.h			1.10
+
+	- Remove ESSR_FIBER_LINK bit check in makphyattach(). This bit is
+	  valid only when the link is up, so it's not good to check in the
+	  attach function.
+	- There is an environment that both copper and fiber bits are set in
+	  EXTSR but it support copper only. To resolve this problem, check the
+	  ESSR register's HWCFG_MODE bit and drop unsupported bits.
+	- If the chip is in Fiber/Copper auto select mode, check which media is
+	  selected. Currently, the code supports 88E1011, 88E and 88E1112
+	  only.
+	- Fix comment. KNF.
+	[msaitoh, ticket #1493]
+



CVS commit: [netbsd-8] src/sys/dev/mii

2020-01-28 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Jan 28 09:34:29 UTC 2020

Modified Files:
src/sys/dev/mii [netbsd-8]: makphy.c makphyreg.h

Log Message:
Pull up the following, requested by msaitoh in ticket #1493:

sys/dev/mii/makphy.c1.61, 1.63-1.64 via patch
sys/dev/mii/makphyreg.h 1.10

- Remove ESSR_FIBER_LINK bit check in makphyattach(). This bit is
  valid only when the link is up, so it's not good to check in the
  attach function.
- There is an environment that both copper and fiber bits are set in
  EXTSR but it support copper only. To resolve this problem, check the
  ESSR register's HWCFG_MODE bit and drop unsupported bits.
- If the chip is in Fiber/Copper auto select mode, check which media is
  selected. Currently, the code supports 88E1011, 88E and 88E1112
  only.
- Fix comment. KNF.


To generate a diff of this commit:
cvs rdiff -u -r1.42.8.3 -r1.42.8.4 src/sys/dev/mii/makphy.c
cvs rdiff -u -r1.6.20.1 -r1.6.20.2 src/sys/dev/mii/makphyreg.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/mii/makphy.c
diff -u src/sys/dev/mii/makphy.c:1.42.8.3 src/sys/dev/mii/makphy.c:1.42.8.4
--- src/sys/dev/mii/makphy.c:1.42.8.3	Thu Aug  1 14:27:30 2019
+++ src/sys/dev/mii/makphy.c	Tue Jan 28 09:34:29 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: makphy.c,v 1.42.8.3 2019/08/01 14:27:30 martin Exp $	*/
+/*	$NetBSD: makphy.c,v 1.42.8.4 2020/01/28 09:34:29 martin Exp $	*/
 
 /*-
  * Copyright (c) 1998, 1999, 2000, 2001 The NetBSD Foundation, Inc.
@@ -59,7 +59,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: makphy.c,v 1.42.8.3 2019/08/01 14:27:30 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: makphy.c,v 1.42.8.4 2020/01/28 09:34:29 martin Exp $");
 
 #include 
 #include 
@@ -204,7 +204,7 @@ makphyattach(device_t parent, device_t s
 	const struct mii_phydesc *mpd;
 	struct makphy_softc *maksc = (struct makphy_softc *)sc;
 	const char *name;
-	int model, val;
+	int reg, model;
 
 	mpd = mii_phy_match(ma, makphys);
 	aprint_naive(": Media interface\n");
@@ -245,24 +245,61 @@ page0:
 		break;
 	}
 
-	switch (model) {
-	case MII_MODEL_xxMARVELL_E1011:
-	case MII_MODEL_xxMARVELL_E1112:
-		val = PHY_READ(sc, MAKPHY_ESSR);
-		if ((val != 0) && (((u_int)val & 0xU) != 0xU)
-		&& ((val & ESSR_FIBER_LINK) != 0))
-			sc->mii_flags |= MIIF_HAVEFIBER;
-		break;
-	default:
-		break;
-	}
-
 	PHY_RESET(sc);
 
 	sc->mii_capabilities = PHY_READ(sc, MII_BMSR) & ma->mii_capmask;
 	if (sc->mii_capabilities & BMSR_EXTSTAT)
 		sc->mii_extcapabilities = PHY_READ(sc, MII_EXTSR);
 
+	if (((sc->mii_extcapabilities & (EXTSR_1000TFDX | EXTSR_1000THDX))
+		!= 0)
+	&& ((sc->mii_extcapabilities & (EXTSR_1000XFDX | EXTSR_1000XHDX))
+		!= 0)) {
+		bool fiberonly = false, copperonly = false;
+
+		/* Both copper and fiber are set. check MODE[] */
+		switch (sc->mii_mpd_model) {
+		case MII_MODEL_xxMARVELL_E1011:
+		case MII_MODEL_xxMARVELL_E:
+			/* These devices have ESSR register */
+			reg = PHY_READ(sc, MAKPHY_ESSR);
+			if ((reg & ESSR_AUTOSEL_DISABLE) != 0) {
+switch (reg & ESSR_HWCFG_MODE) {
+case ESSR_RTBI_FIBER:
+case ESSR_RGMII_FIBER:
+case ESSR_RGMII_SGMII: /* right? */
+case ESSR_TBI_FIBER:
+case ESSR_GMII_FIBER:
+	fiberonly = true;
+	break;
+case ESSR_SGMII_WC_COPPER:
+case ESSR_SGMII_WOC_COPPER:
+case ESSR_RTBI_COPPER:
+case ESSR_RGMII_COPPER:
+case ESSR_GMII_COPPER:
+	copperonly = true;
+default:
+	break;
+}
+			}
+			break;
+		default:
+			break;
+		}
+		if (fiberonly || copperonly)
+			aprint_debug_dev(self, "both copper and fiber are set "
+			"but MODE[] is %s only.\n",
+			fiberonly ? "fiber" : "copper");
+		if (fiberonly)
+			sc->mii_extcapabilities
+			&= ~(EXTSR_1000TFDX | EXTSR_1000THDX);
+		else if (copperonly) {
+			sc->mii_extcapabilities
+			&= ~(EXTSR_1000XFDX | EXTSR_1000XHDX);
+			sc->mii_flags &= ~MIIF_IS_1000X;
+		}
+	}
+
 	aprint_normal_dev(self, "");
 	if ((sc->mii_capabilities & BMSR_MEDIAMASK) == 0 &&
 	(sc->mii_extcapabilities & EXTSR_MEDIAMASK) == 0)
@@ -280,9 +317,7 @@ makphy_reset(struct mii_softc *sc)
 
 	mii_phy_reset(sc);
 
-	/*
-	 * Initialize PHY Specific Control Register.
-	 */
+	/* Initialize PHY Specific Control Register. */
 	reg = PHY_READ(sc, MAKPHY_PSCR);
 
 	/* Assert CRS on transmit. */
@@ -425,7 +460,7 @@ static void
 makphy_status(struct mii_softc *sc)
 {
 	struct mii_data *mii = sc->mii_pdata;
-	int bmcr, gsr, pssr;
+	int bmcr, gsr, pssr, essr;
 
 	mii->mii_media_status = IFM_AVALID;
 	mii->mii_media_active = IFM_ETHER;
@@ -463,10 +498,45 @@ makphy_status(struct mii_softc *sc)
 		}
 	}
 
-	/* XXX FIXME: Use different page for Fiber on newer chips */
+	/*
+	 * XXX The following code support Fiber/Copper auto select mode
+	 * only for 88E1011, 88E and 88E1112. For other chips, the document
+	 * is required.
+	 

CVS commit: src/lib/libpthread

2020-01-28 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Tue Jan 28 09:23:15 UTC 2020

Modified Files:
src/lib/libpthread: pthread.c

Log Message:
pthread_join(): add a temporary hack to make lib/libpthread/t_detach pass.
The correct fix is to do this in kernel (I have that change, but it's part
of the wider change to index LWPs in a tree).


To generate a diff of this commit:
cvs rdiff -u -r1.157 -r1.158 src/lib/libpthread/pthread.c

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

Modified files:

Index: src/lib/libpthread/pthread.c
diff -u src/lib/libpthread/pthread.c:1.157 src/lib/libpthread/pthread.c:1.158
--- src/lib/libpthread/pthread.c:1.157	Mon Jan 27 20:50:05 2020
+++ src/lib/libpthread/pthread.c	Tue Jan 28 09:23:15 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pthread.c,v 1.157 2020/01/27 20:50:05 ad Exp $	*/
+/*	$NetBSD: pthread.c,v 1.158 2020/01/28 09:23:15 ad Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2002, 2003, 2006, 2007, 2008, 2020
@@ -31,7 +31,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: pthread.c,v 1.157 2020/01/27 20:50:05 ad Exp $");
+__RCSID("$NetBSD: pthread.c,v 1.158 2020/01/28 09:23:15 ad Exp $");
 
 #define	__EXPOSE_STACK	1
 
@@ -713,6 +713,10 @@ pthread_join(pthread_t thread, void **va
 	if (thread == self)
 		return EDEADLK;
 
+	/* XXX temporary - kernel should handle. */
+	if ((thread->pt_flags & PT_FLAG_DETACHED) != 0)
+		return EINVAL;
+
 	/* IEEE Std 1003.1 says pthread_join() never returns EINTR. */
 	for (;;) {
 		pthread__testcancel(self);



CVS commit: [netbsd-9] src/doc

2020-01-28 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue Jan 28 09:10:10 UTC 2020

Modified Files:
src/doc [netbsd-9]: CHANGES-9.0

Log Message:
 Ticket #665 and #666.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.167 -r1.1.2.168 src/doc/CHANGES-9.0

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

Modified files:

Index: src/doc/CHANGES-9.0
diff -u src/doc/CHANGES-9.0:1.1.2.167 src/doc/CHANGES-9.0:1.1.2.168
--- src/doc/CHANGES-9.0:1.1.2.167	Mon Jan 27 07:29:56 2020
+++ src/doc/CHANGES-9.0	Tue Jan 28 09:10:10 2020
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-9.0,v 1.1.2.167 2020/01/27 07:29:56 martin Exp $
+# $NetBSD: CHANGES-9.0,v 1.1.2.168 2020/01/28 09:10:10 msaitoh Exp $
 
 A complete list of changes from the initial NetBSD 9.0 branch on 2019-07-30
 until the 9.0 release:
@@ -8352,3 +8352,13 @@ doc/3RDPARTY	(manually edited)
 	Import OpenSSL 1.1.1d.
 	[christos, ticket #660]
 
+sys/dev/fdt/fdtbus.c1.32
+
+	First arg of cpu_setmodel needs to be a format string - fix the llvm
+	build.
+	[martin, ticket #665]
+
+distrib/evbmips/instkernel/ramdisk/Makefile	1.14
+
+	PR install/54777: Add dhcpcd to the install ramdisk.
+	[martin, ticket #666]



CVS commit: [netbsd-9] src/distrib/evbmips/instkernel/ramdisk

2020-01-28 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue Jan 28 09:08:10 UTC 2020

Modified Files:
src/distrib/evbmips/instkernel/ramdisk [netbsd-9]: Makefile

Log Message:
Pull up following revision(s) (requested by martin in ticket #666):
distrib/evbmips/instkernel/ramdisk/Makefile: revision 1.14
PR install/54777: add dhcpcd to the install ramdisk


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.13.14.1 \
src/distrib/evbmips/instkernel/ramdisk/Makefile

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

Modified files:

Index: src/distrib/evbmips/instkernel/ramdisk/Makefile
diff -u src/distrib/evbmips/instkernel/ramdisk/Makefile:1.13 src/distrib/evbmips/instkernel/ramdisk/Makefile:1.13.14.1
--- src/distrib/evbmips/instkernel/ramdisk/Makefile:1.13	Tue Jan 24 18:04:02 2017
+++ src/distrib/evbmips/instkernel/ramdisk/Makefile	Tue Jan 28 09:08:10 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.13 2017/01/24 18:04:02 christos Exp $
+#	$NetBSD: Makefile,v 1.13.14.1 2020/01/28 09:08:10 msaitoh Exp $
 
 .include 
 .include "${NETBSDSRCDIR}/distrib/common/Makefile.distrib"
@@ -33,6 +33,7 @@ HACKSRC=	${DISTRIBDIR}/utils/libhack
 ${CRUNCHBIN}:	libhack.o
 
 .include "${DISTRIBDIR}/common/Makefile.crunch"
+.include "${DISTRIBDIR}/common/Makefile.dhcpcd"
 .include "${DISTRIBDIR}/common/Makefile.makedev"
 .include "${DISTRIBDIR}/common/Makefile.image"
 



CVS commit: [netbsd-9] src/sys/dev/fdt

2020-01-28 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue Jan 28 09:06:37 UTC 2020

Modified Files:
src/sys/dev/fdt [netbsd-9]: fdtbus.c

Log Message:
Pull up following revision(s) (requested by martin in ticket #665):
sys/dev/fdt/fdtbus.c: revision 1.32
First arg of cpu_setmodel needs to be a format string - fix the llvm build.
>From maxv.


To generate a diff of this commit:
cvs rdiff -u -r1.29.2.2 -r1.29.2.3 src/sys/dev/fdt/fdtbus.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/fdt/fdtbus.c
diff -u src/sys/dev/fdt/fdtbus.c:1.29.2.2 src/sys/dev/fdt/fdtbus.c:1.29.2.3
--- src/sys/dev/fdt/fdtbus.c:1.29.2.2	Thu Jan  9 17:16:47 2020
+++ src/sys/dev/fdt/fdtbus.c	Tue Jan 28 09:06:37 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: fdtbus.c,v 1.29.2.2 2020/01/09 17:16:47 snj Exp $ */
+/* $NetBSD: fdtbus.c,v 1.29.2.3 2020/01/28 09:06:37 msaitoh Exp $ */
 
 /*-
  * Copyright (c) 2015 Jared D. McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fdtbus.c,v 1.29.2.2 2020/01/09 17:16:47 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fdtbus.c,v 1.29.2.3 2020/01/28 09:06:37 msaitoh Exp $");
 
 #include 
 #include 
@@ -145,9 +145,9 @@ fdt_attach(device_t parent, device_t sel
 	/* Set hw.model if available */
 	model = fdtbus_get_string(phandle, "compatible");
 	if (model)
-		cpu_setmodel(model);
+		cpu_setmodel("%s", model);
 	else if (descr)
-		cpu_setmodel(descr);
+		cpu_setmodel("%s", descr);
 
 	/* Scan devices */
 	fdt_rescan(self, NULL, NULL);



CVS commit: src/sys/dev/fdt

2020-01-28 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Jan 28 08:09:19 UTC 2020

Modified Files:
src/sys/dev/fdt: fdtbus.c

Log Message:
First arg of cpu_setmodel needs to be a format string - fix the llvm build.
>From maxv.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/dev/fdt/fdtbus.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/fdt/fdtbus.c
diff -u src/sys/dev/fdt/fdtbus.c:1.31 src/sys/dev/fdt/fdtbus.c:1.32
--- src/sys/dev/fdt/fdtbus.c:1.31	Thu Jan  9 16:23:41 2020
+++ src/sys/dev/fdt/fdtbus.c	Tue Jan 28 08:09:19 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: fdtbus.c,v 1.31 2020/01/09 16:23:41 martin Exp $ */
+/* $NetBSD: fdtbus.c,v 1.32 2020/01/28 08:09:19 martin Exp $ */
 
 /*-
  * Copyright (c) 2015 Jared D. McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fdtbus.c,v 1.31 2020/01/09 16:23:41 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fdtbus.c,v 1.32 2020/01/28 08:09:19 martin Exp $");
 
 #include 
 #include 
@@ -145,9 +145,9 @@ fdt_attach(device_t parent, device_t sel
 	/* Set hw.model if available */
 	model = fdtbus_get_string(phandle, "compatible");
 	if (model)
-		cpu_setmodel(model);
+		cpu_setmodel("%s", model);
 	else if (descr)
-		cpu_setmodel(descr);
+		cpu_setmodel("%s", descr);
 
 	/* Scan devices */
 	fdt_rescan(self, NULL, NULL);