CVS commit: src/sys/arch/newsmips/apbus

2009-04-17 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Fri Apr 17 14:48:17 UTC 2009

Modified Files:
src/sys/arch/newsmips/apbus: if_tlp_ap.c

Log Message:
Split device_t/softc, use aprint_*().


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/newsmips/apbus/if_tlp_ap.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/newsmips/apbus/if_tlp_ap.c
diff -u src/sys/arch/newsmips/apbus/if_tlp_ap.c:1.10 src/sys/arch/newsmips/apbus/if_tlp_ap.c:1.11
--- src/sys/arch/newsmips/apbus/if_tlp_ap.c:1.10	Mon Apr 28 20:23:30 2008
+++ src/sys/arch/newsmips/apbus/if_tlp_ap.c	Fri Apr 17 14:48:17 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_tlp_ap.c,v 1.10 2008/04/28 20:23:30 martin Exp $	*/
+/*	$NetBSD: if_tlp_ap.c,v 1.11 2009/04/17 14:48:17 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_tlp_ap.c,v 1.10 2008/04/28 20:23:30 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_tlp_ap.c,v 1.11 2009/04/17 14:48:17 tsutsui Exp $");
 
 #include 
 #include 
@@ -78,10 +78,10 @@
 	bus_space_handle_t sc_cfsh;
 };
 
-static int	tlp_ap_match(struct device *, struct cfdata *, void *);
-static void	tlp_ap_attach(struct device *, struct device *, void *);
+static int	tlp_ap_match(device_t, cfdata_t, void *);
+static void	tlp_ap_attach(device_t, device_t, void *);
 
-CFATTACH_DECL(tlp_ap, sizeof(struct tulip_ap_softc),
+CFATTACH_DECL_NEW(tlp_ap, sizeof(struct tulip_ap_softc),
 tlp_ap_match, tlp_ap_attach, NULL, NULL);
 
 static void tlp_ap_preinit(struct tulip_softc *);
@@ -94,7 +94,7 @@
 };
 
 static int
-tlp_ap_match(struct device *parent, struct cfdata *cf, void *aux)
+tlp_ap_match(device_t parent, cfdata_t cf, void *aux)
 {
 	struct apbus_attach_args *apa = aux;
 
@@ -108,16 +108,18 @@
  * Install interface into kernel networking data structures
  */
 static void
-tlp_ap_attach(struct device *parent, struct device *self, void *aux)
+tlp_ap_attach(device_t parent, device_t self, void *aux)
 {
-	struct tulip_ap_softc *psc = (void *) self;
+	struct tulip_ap_softc *psc = device_private(self);
 	struct tulip_softc *sc = &psc->sc_tulip;
 	struct apbus_attach_args *apa = aux;
 	uint8_t enaddr[ETHER_ADDR_LEN];
 	u_int intrmask;
 	int i;
 
-	printf(" slot%d addr 0x%lx", apa->apa_slotno, apa->apa_hwbase);
+	sc->sc_dev = self;
+
+	aprint_normal(" slot%d addr 0x%lx", apa->apa_slotno, apa->apa_hwbase);
 
 	/* PCI configuration register */
 	psc->sc_cfst = 0;
@@ -133,11 +135,11 @@
 			sc->sc_chip = TULIP_CHIP_21140;
 		break;
 	default:
-		printf(": unable to handle your board\n");
+		aprint_error(": unable to handle your board\n");
 		return;
 	}
 
-	printf(": %s Ethernet, pass %d.%d\n",
+	aprint_normal(": %s Ethernet, pass %d.%d\n",
 	tlp_chip_names[sc->sc_chip],
 	(sc->sc_rev >> 4) & 0xf, sc->sc_rev & 0xf);
 
@@ -146,7 +148,7 @@
 	sc->sc_sh = apa->apa_hwbase + TLP_AP_CSR;
 	sc->sc_dmat = apbus_dmatag_init(apa);
 	if (sc->sc_dmat == NULL) {
-		printf("%s: cannot allocate memory\n", sc->sc_dev.dv_xname);
+		aprint_error_dev(self, "cannot allocate memory\n");
 		return;
 	}
 
@@ -202,7 +204,7 @@
 	TULIP_WRITE(sc, CSR_GPP, 0xcf);			/* mask abort/DMA err */
 
 	if (tlp_read_srom(sc) == 0) {
-		printf("%s: srom read failed\n", sc->sc_dev.dv_xname);
+		aprint_error_dev(self, "srom read failed\n");
 		free(sc->sc_dmat, M_DEVBUF);
 		return;
 	}



CVS commit: src/sys/arch/newsmips/apbus

2011-07-15 Thread Havard Eidnes
Module Name:src
Committed By:   he
Date:   Fri Jul 15 07:49:20 UTC 2011

Modified Files:
src/sys/arch/newsmips/apbus: if_tlp_ap.c

Log Message:
Track the changes to tulipvar.h -- use the recently introduced
tlp_chip_name() to get the chip name for aprint output.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/newsmips/apbus/if_tlp_ap.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/newsmips/apbus/if_tlp_ap.c
diff -u src/sys/arch/newsmips/apbus/if_tlp_ap.c:1.12 src/sys/arch/newsmips/apbus/if_tlp_ap.c:1.13
--- src/sys/arch/newsmips/apbus/if_tlp_ap.c:1.12	Sun Feb 20 07:56:31 2011
+++ src/sys/arch/newsmips/apbus/if_tlp_ap.c	Fri Jul 15 07:49:20 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_tlp_ap.c,v 1.12 2011/02/20 07:56:31 matt Exp $	*/
+/*	$NetBSD: if_tlp_ap.c,v 1.13 2011/07/15 07:49:20 he Exp $	*/
 
 /*
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_tlp_ap.c,v 1.12 2011/02/20 07:56:31 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_tlp_ap.c,v 1.13 2011/07/15 07:49:20 he Exp $");
 
 #include 
 #include 
@@ -140,7 +140,7 @@
 	}
 
 	aprint_normal(": %s Ethernet, pass %d.%d\n",
-	tlp_chip_names[sc->sc_chip],
+	tlp_chip_name(sc->sc_chip),
 	(sc->sc_rev >> 4) & 0xf, sc->sc_rev & 0xf);
 
 	/* CSR */



CVS commit: src/sys/arch/newsmips/apbus

2012-10-12 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Oct 13 06:24:15 UTC 2012

Modified Files:
src/sys/arch/newsmips/apbus: if_sn.c

Log Message:
Fix botch on device_t/softc split inside #ifdef SNDEBUG part. from chs@


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/arch/newsmips/apbus/if_sn.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/newsmips/apbus/if_sn.c
diff -u src/sys/arch/newsmips/apbus/if_sn.c:1.33 src/sys/arch/newsmips/apbus/if_sn.c:1.34
--- src/sys/arch/newsmips/apbus/if_sn.c:1.33	Mon Apr  5 07:19:31 2010
+++ src/sys/arch/newsmips/apbus/if_sn.c	Sat Oct 13 06:24:15 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_sn.c,v 1.33 2010/04/05 07:19:31 joerg Exp $	*/
+/*	$NetBSD: if_sn.c,v 1.34 2012/10/13 06:24:15 tsutsui Exp $	*/
 
 /*
  * National Semiconductor  DP8393X SONIC Driver
@@ -16,7 +16,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_sn.c,v 1.33 2010/04/05 07:19:31 joerg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_sn.c,v 1.34 2012/10/13 06:24:15 tsutsui Exp $");
 
 #include "opt_inet.h"
 
@@ -204,7 +204,7 @@ snsetup(struct sn_softc	*sc, uint8_t *ll
 
 #ifdef SNDEBUG
 	aprint_debug_dev(sc->sc_dev, "buffers: rra=%p cda=%p rda=%p tda=%p\n",
-	sc->sc_dev.dv_xname, sc->p_rra[0], sc->p_cda,
+	device_xname(sc->sc_dev), sc->p_rra[0], sc->p_cda,
 	sc->p_rda, sc->mtda[0].mtd_txp);
 #endif
 



CVS commit: src/sys/arch/newsmips/apbus

2017-07-28 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Jul 29 02:21:30 UTC 2017

Modified Files:
src/sys/arch/newsmips/apbus: if_sn.c

Log Message:
Avoid memory leak in sonic_get.

If this is the first time around, top is null and nothing else will
free m.

>From Ilja Van Sprundel.


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/sys/arch/newsmips/apbus/if_sn.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/newsmips/apbus/if_sn.c
diff -u src/sys/arch/newsmips/apbus/if_sn.c:1.38 src/sys/arch/newsmips/apbus/if_sn.c:1.39
--- src/sys/arch/newsmips/apbus/if_sn.c:1.38	Wed Feb 22 09:45:16 2017
+++ src/sys/arch/newsmips/apbus/if_sn.c	Sat Jul 29 02:21:30 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_sn.c,v 1.38 2017/02/22 09:45:16 nonaka Exp $	*/
+/*	$NetBSD: if_sn.c,v 1.39 2017/07/29 02:21:30 riastradh Exp $	*/
 
 /*
  * National Semiconductor  DP8393X SONIC Driver
@@ -16,7 +16,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_sn.c,v 1.38 2017/02/22 09:45:16 nonaka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_sn.c,v 1.39 2017/07/29 02:21:30 riastradh Exp $");
 
 #include "opt_inet.h"
 
@@ -1090,7 +1090,10 @@ sonic_get(struct sn_softc *sc, void *pkt
 		if (datalen >= MINCLSIZE) {
 			MCLGET(m, M_DONTWAIT);
 			if ((m->m_flags & M_EXT) == 0) {
-if (top) m_freem(top);
+if (top)
+	m_freem(top);
+else
+	m_freem(m);
 return 0;
 			}
 			len = MCLBYTES;



CVS commit: src/sys/arch/newsmips/apbus

2018-09-30 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sun Sep 30 14:09:35 UTC 2018

Modified Files:
src/sys/arch/newsmips/apbus: apbus.c

Log Message:
Account APbus interrupts by evcnt(9).


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/newsmips/apbus/apbus.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/newsmips/apbus/apbus.c
diff -u src/sys/arch/newsmips/apbus/apbus.c:1.23 src/sys/arch/newsmips/apbus/apbus.c:1.24
--- src/sys/arch/newsmips/apbus/apbus.c:1.23	Sun Sep 30 06:14:23 2018
+++ src/sys/arch/newsmips/apbus/apbus.c	Sun Sep 30 14:09:35 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: apbus.c,v 1.23 2018/09/30 06:14:23 tsutsui Exp $	*/
+/*	$NetBSD: apbus.c,v 1.24 2018/09/30 14:09:35 tsutsui Exp $	*/
 
 /*-
  * Copyright (C) 1999 SHIMIZU Ryo.  All rights reserved.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: apbus.c,v 1.23 2018/09/30 06:14:23 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: apbus.c,v 1.24 2018/09/30 14:09:35 tsutsui Exp $");
 
 #define __INTR_PRIVATE
 
@@ -201,8 +201,10 @@ apbus_intr_dispatch(int level, int stat)
 
 	nintr = 0;
 	LIST_FOREACH(ih, &ip->intr_q, ih_q) {
-		if (ih->ih_mask & stat)
+		if (ih->ih_mask & stat) {
 			nintr += (*ih->ih_func)(ih->ih_arg);
+			ih->intr_count.ev_count++;
+		}
 	}
 	return nintr;
 }
@@ -227,6 +229,8 @@ apbus_intr_establish(int level, int mask
 	ih->ih_priority = priority;
 	ih->ih_func = func;
 	ih->ih_arg = arg;
+	evcnt_attach_dynamic(&ih->intr_count, EVCNT_TYPE_INTR,
+	NULL, "apbus", name);
 
 	if (LIST_EMPTY(&ip->intr_q)) {
 		LIST_INSERT_HEAD(&ip->intr_q, ih, ih_q);



CVS commit: src/sys/arch/newsmips/apbus

2018-09-30 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sun Sep 30 14:23:24 UTC 2018

Modified Files:
src/sys/arch/newsmips/apbus: if_sn_ap.c if_tlp_ap.c kb_ap.c ms_ap.c
spifi.c zs_ap.c

Log Message:
Avoid reference of APbus workarea that can't be read via kvm(3).


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/newsmips/apbus/if_sn_ap.c \
src/sys/arch/newsmips/apbus/ms_ap.c
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/newsmips/apbus/if_tlp_ap.c
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/newsmips/apbus/kb_ap.c
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/newsmips/apbus/spifi.c
cvs rdiff -u -r1.27 -r1.28 src/sys/arch/newsmips/apbus/zs_ap.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/newsmips/apbus/if_sn_ap.c
diff -u src/sys/arch/newsmips/apbus/if_sn_ap.c:1.11 src/sys/arch/newsmips/apbus/if_sn_ap.c:1.12
--- src/sys/arch/newsmips/apbus/if_sn_ap.c:1.11	Wed Apr  9 15:40:30 2008
+++ src/sys/arch/newsmips/apbus/if_sn_ap.c	Sun Sep 30 14:23:24 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_sn_ap.c,v 1.11 2008/04/09 15:40:30 tsutsui Exp $	*/
+/*	$NetBSD: if_sn_ap.c,v 1.12 2018/09/30 14:23:24 tsutsui Exp $	*/
 
 /*
  * Copyright (C) 1997 Allen Briggs
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_sn_ap.c,v 1.11 2008/04/09 15:40:30 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_sn_ap.c,v 1.12 2018/09/30 14:23:24 tsutsui Exp $");
 
 #include "opt_inet.h"
 
@@ -117,7 +117,7 @@ sn_ap_attach(device_t parent, device_t s
 	apbus_intr_establish(0, /* interrupt level (0 or 1) */
 	intrmask,
 	0, /* priority */
-	snintr, sc, apa->apa_name, apa->apa_ctlnum);
+	snintr, sc, device_xname(self), apa->apa_ctlnum);
 }
 
 int
Index: src/sys/arch/newsmips/apbus/ms_ap.c
diff -u src/sys/arch/newsmips/apbus/ms_ap.c:1.11 src/sys/arch/newsmips/apbus/ms_ap.c:1.12
--- src/sys/arch/newsmips/apbus/ms_ap.c:1.11	Sat Oct 13 06:25:20 2012
+++ src/sys/arch/newsmips/apbus/ms_ap.c	Sun Sep 30 14:23:24 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ms_ap.c,v 1.11 2012/10/13 06:25:20 tsutsui Exp $	*/
+/*	$NetBSD: ms_ap.c,v 1.12 2018/09/30 14:23:24 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 2000 Tsubai Masanari.  All rights reserved.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ms_ap.c,v 1.11 2012/10/13 06:25:20 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ms_ap.c,v 1.12 2018/09/30 14:23:24 tsutsui Exp $");
 
 #include 
 #include 
@@ -101,7 +101,7 @@ ms_ap_attach(device_t parent, device_t s
 	reg->ms_intr_en = 0;
 
 	apbus_intr_establish(1, NEWS5000_INT1_KBD, 0, ms_ap_intr, sc,
-	"", apa->apa_ctlnum);
+	device_xname(self), apa->apa_ctlnum);
 
 	aa.accessops = &ms_ap_accessops;
 	aa.accesscookie = sc;

Index: src/sys/arch/newsmips/apbus/if_tlp_ap.c
diff -u src/sys/arch/newsmips/apbus/if_tlp_ap.c:1.13 src/sys/arch/newsmips/apbus/if_tlp_ap.c:1.14
--- src/sys/arch/newsmips/apbus/if_tlp_ap.c:1.13	Fri Jul 15 07:49:20 2011
+++ src/sys/arch/newsmips/apbus/if_tlp_ap.c	Sun Sep 30 14:23:24 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_tlp_ap.c,v 1.13 2011/07/15 07:49:20 he Exp $	*/
+/*	$NetBSD: if_tlp_ap.c,v 1.14 2018/09/30 14:23:24 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_tlp_ap.c,v 1.13 2011/07/15 07:49:20 he Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_tlp_ap.c,v 1.14 2018/09/30 14:23:24 tsutsui Exp $");
 
 #include 
 #include 
@@ -222,7 +222,7 @@ tlp_ap_attach(device_t parent, device_t 
 	apbus_intr_establish(0, /* interrupt level (0 or 1) */
 	intrmask,
 	0, /* priority */
-	tlp_intr, sc, apa->apa_name, apa->apa_ctlnum);
+	tlp_intr, sc, device_xname(self), apa->apa_ctlnum);
 }
 
 static void

Index: src/sys/arch/newsmips/apbus/kb_ap.c
diff -u src/sys/arch/newsmips/apbus/kb_ap.c:1.10 src/sys/arch/newsmips/apbus/kb_ap.c:1.11
--- src/sys/arch/newsmips/apbus/kb_ap.c:1.10	Sat Oct 13 06:25:20 2012
+++ src/sys/arch/newsmips/apbus/kb_ap.c	Sun Sep 30 14:23:24 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: kb_ap.c,v 1.10 2012/10/13 06:25:20 tsutsui Exp $	*/
+/*	$NetBSD: kb_ap.c,v 1.11 2018/09/30 14:23:24 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 2000 Tsubai Masanari.  All rights reserved.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kb_ap.c,v 1.10 2012/10/13 06:25:20 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kb_ap.c,v 1.11 2018/09/30 14:23:24 tsutsui Exp $");
 
 #include 
 #include 
@@ -144,7 +144,7 @@ kb_ap_attach(device_t parent, device_t s
 	reg->kb_tx_intr_en = 0;
 
 	apbus_intr_establish(1, NEWS5000_INT1_KBD, 0, kb_ap_intr, sc,
-	"", apa->apa_ctlnum);
+	device_xname(self), apa->apa_ctlnum);
 
 	waa.console = cons;
 	waa.keymap = &kb_ap_keymapdata;

Index: src/sys/arch/newsmips/apbus/spifi.c
diff -u src/sys/arch/newsmips/apbus/spifi.c:1.18 src/sys/arch/newsmips/apbus/spifi.c:1.19
--- src/sys/arch/newsmips/apbus/spifi.c:1.18	Fri Mar 31 08:38:13 2017
+++ src/

CVS commit: src/sys/arch/newsmips/apbus

2020-02-03 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Feb  4 07:36:42 UTC 2020

Modified Files:
src/sys/arch/newsmips/apbus: if_sn.c

Log Message:
Adopt 


To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.47 src/sys/arch/newsmips/apbus/if_sn.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/newsmips/apbus/if_sn.c
diff -u src/sys/arch/newsmips/apbus/if_sn.c:1.46 src/sys/arch/newsmips/apbus/if_sn.c:1.47
--- src/sys/arch/newsmips/apbus/if_sn.c:1.46	Fri Sep 13 07:55:06 2019
+++ src/sys/arch/newsmips/apbus/if_sn.c	Tue Feb  4 07:36:42 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_sn.c,v 1.46 2019/09/13 07:55:06 msaitoh Exp $	*/
+/*	$NetBSD: if_sn.c,v 1.47 2020/02/04 07:36:42 skrll Exp $	*/
 
 /*
  * National Semiconductor  DP8393X SONIC Driver
@@ -16,7 +16,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_sn.c,v 1.46 2019/09/13 07:55:06 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_sn.c,v 1.47 2020/02/04 07:36:42 skrll Exp $");
 
 #include "opt_inet.h"
 
@@ -347,7 +347,7 @@ outloop:
 	sc->mtd_prev = sc->mtd_free;
 	sc->mtd_free = mtd_next;
 
-	ifp->if_opackets++;		/* # of pkts */
+	if_statinc(ifp, if_opackets);		/* # of pkts */
 
 	/* Jump back for possibly more punishment. */
 	goto outloop;
@@ -916,11 +916,11 @@ sonictxint(struct sn_softc *sc)
 
 		txp_status = SRO(sc->bitmode, txp, TXP_STATUS);
 
-		ifp->if_collisions += (txp_status & TCR_EXC) ? 16 :
-			((txp_status & TCR_NC) >> 12);
+		if_statadd(ifp, if_collisions, (txp_status & TCR_EXC) ? 16 :
+			((txp_status & TCR_NC) >> 12));
 
 		if ((txp_status & TCR_PTX) == 0) {
-			ifp->if_oerrors++;
+			if_statinc(ifp, if_oerrors);
 			printf("%s: Tx packet status=0x%x\n",
 			device_xname(sc->sc_dev), txp_status);
 



CVS commit: src/sys/arch/newsmips/apbus

2020-02-03 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Feb  4 07:41:01 UTC 2020

Modified Files:
src/sys/arch/newsmips/apbus: if_sn.c

Log Message:
Trailing whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.47 -r1.48 src/sys/arch/newsmips/apbus/if_sn.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/newsmips/apbus/if_sn.c
diff -u src/sys/arch/newsmips/apbus/if_sn.c:1.47 src/sys/arch/newsmips/apbus/if_sn.c:1.48
--- src/sys/arch/newsmips/apbus/if_sn.c:1.47	Tue Feb  4 07:36:42 2020
+++ src/sys/arch/newsmips/apbus/if_sn.c	Tue Feb  4 07:41:01 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_sn.c,v 1.47 2020/02/04 07:36:42 skrll Exp $	*/
+/*	$NetBSD: if_sn.c,v 1.48 2020/02/04 07:41:01 skrll Exp $	*/
 
 /*
  * National Semiconductor  DP8393X SONIC Driver
@@ -16,7 +16,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_sn.c,v 1.47 2020/02/04 07:36:42 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_sn.c,v 1.48 2020/02/04 07:41:01 skrll Exp $");
 
 #include "opt_inet.h"
 
@@ -365,7 +365,7 @@ snreset(struct sn_softc *sc)
 	sninit(sc);
 }
 
-static int 
+static int
 sninit(struct sn_softc *sc)
 {
 	u_long	s_rcr;
@@ -443,7 +443,7 @@ sninit(struct sn_softc *sc)
  * Called on final close of device, or if sninit() fails
  * part way through.
  */
-static int 
+static int
 snstop(struct sn_softc *sc)
 {
 	struct mtd *mtd;
@@ -589,7 +589,7 @@ sonicput(struct sn_softc *sc, struct mbu
 /*
  * CAM support
  */
-static void 
+static void
 caminitialise(struct sn_softc *sc)
 {
 	void	*p_cda = sc->p_cda;
@@ -606,7 +606,7 @@ caminitialise(struct sn_softc *sc)
 	SWO(bitmode, p_cda, CDA_ENABLE, 0);
 }
 
-static void 
+static void
 camentry(struct sn_softc *sc, int entry, const u_char *ea)
 {
 	void	*p_cda = sc->p_cda;
@@ -616,11 +616,11 @@ camentry(struct sn_softc *sc, int entry,
 	SWO(bitmode, p_cda, camoffset + CDA_CAMAP2, (ea[5] << 8) | ea[4]);
 	SWO(bitmode, p_cda, camoffset + CDA_CAMAP1, (ea[3] << 8) | ea[2]);
 	SWO(bitmode, p_cda, camoffset + CDA_CAMAP0, (ea[1] << 8) | ea[0]);
-	SWO(bitmode, p_cda, CDA_ENABLE, 
+	SWO(bitmode, p_cda, CDA_ENABLE,
 	(SRO(bitmode, p_cda, CDA_ENABLE) | (1 << entry)));
 }
 
-static void 
+static void
 camprogram(struct sn_softc *sc)
 {
 	struct ethercom *ec = &sc->sc_ethercom;
@@ -696,7 +696,7 @@ camprogram(struct sn_softc *sc)
 }
 
 #ifdef SNDEBUG
-static void 
+static void
 camdump(struct sn_softc *sc)
 {
 	int	i;
@@ -721,7 +721,7 @@ camdump(struct sn_softc *sc)
 }
 #endif
 
-static void 
+static void
 initialise_tda(struct sn_softc *sc)
 {
 	struct mtd *mtd;
@@ -868,7 +868,7 @@ snintr(void *arg)
 /*
  * Transmit interrupt routine
  */
-static void 
+static void
 sonictxint(struct sn_softc *sc)
 {
 	struct mtd	*mtd;
@@ -943,7 +943,7 @@ sonictxint(struct sn_softc *sc)
 /*
  * Receive interrupt routine
  */
-static void 
+static void
 sonicrxint(struct sn_softc *sc)
 {
 	void *	rda;
@@ -1032,7 +1032,7 @@ sonicrxint(struct sn_softc *sc)
  * sonic_read -- pull packet off interface and forward to
  * appropriate protocol handler
  */
-static inline int 
+static inline int
 sonic_read(struct sn_softc *sc, void *pkt, int len)
 {
 	struct ifnet *ifp = &sc->sc_if;
@@ -1102,10 +1102,10 @@ sonic_get(struct sn_softc *sc, void *pkt
 
 		if (mp == &top) {
 			char *newdata = (char *)
-			ALIGN((char *)m->m_data + 
+			ALIGN((char *)m->m_data +
 sizeof(struct ether_header)) -
 			sizeof(struct ether_header);
-			len -= newdata - m->m_data; 
+			len -= newdata - m->m_data;
 			m->m_data = newdata;
 		}
 



CVS commit: src/sys/arch/newsmips/apbus

2020-02-05 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Feb  5 13:08:19 UTC 2020

Modified Files:
src/sys/arch/newsmips/apbus: if_sn.c

Log Message:
Fix if_stats access.


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.49 src/sys/arch/newsmips/apbus/if_sn.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/newsmips/apbus/if_sn.c
diff -u src/sys/arch/newsmips/apbus/if_sn.c:1.48 src/sys/arch/newsmips/apbus/if_sn.c:1.49
--- src/sys/arch/newsmips/apbus/if_sn.c:1.48	Tue Feb  4 07:41:01 2020
+++ src/sys/arch/newsmips/apbus/if_sn.c	Wed Feb  5 13:08:19 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_sn.c,v 1.48 2020/02/04 07:41:01 skrll Exp $	*/
+/*	$NetBSD: if_sn.c,v 1.49 2020/02/05 13:08:19 martin Exp $	*/
 
 /*
  * National Semiconductor  DP8393X SONIC Driver
@@ -16,7 +16,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_sn.c,v 1.48 2020/02/04 07:41:01 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_sn.c,v 1.49 2020/02/05 13:08:19 martin Exp $");
 
 #include "opt_inet.h"
 
@@ -966,9 +966,9 @@ sonicrxint(struct sn_softc *sc)
 			(char *)sc->rbuf[orra & RBAMASK] +
  (rxpkt_ptr & PGOFSET);
 			if (sonic_read(sc, pkt, len) == 0)
-sc->sc_if.if_ierrors++;
+if_statinc(&sc->sc_if, if_ierrors);
 		} else
-			sc->sc_if.if_ierrors++;
+			if_statinc(&sc->sc_if, if_ierrors);
 
 		/*
 		 * give receive buffer area back to chip.