Wed Jan 29 05:30:14 2020 UTC ()
Adopt <net/if_stats.h>.


(thorpej)
diff -r1.27 -r1.28 src/sys/arch/mips/adm5120/dev/if_admsw.c
diff -r1.47 -r1.48 src/sys/arch/mips/alchemy/dev/if_aumac.c
diff -r1.37 -r1.38 src/sys/arch/mips/atheros/dev/if_ae.c
diff -r1.15 -r1.16 src/sys/arch/mips/cavium/dev/if_cnmac.c
diff -r1.7 -r1.8 src/sys/arch/mips/cavium/dev/octeon_gmx.c
diff -r1.2 -r1.3 src/sys/arch/mips/cavium/dev/octeon_pip.c
diff -r1.19 -r1.20 src/sys/arch/mips/ralink/ralink_eth.c
diff -r1.61 -r1.62 src/sys/arch/mips/sibyte/dev/sbmac.c

cvs diff -r1.27 -r1.28 src/sys/arch/mips/adm5120/dev/if_admsw.c (expand / switch to unified diff)

--- src/sys/arch/mips/adm5120/dev/if_admsw.c 2019/12/05 06:25:33 1.27
+++ src/sys/arch/mips/adm5120/dev/if_admsw.c 2020/01/29 05:30:14 1.28
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: if_admsw.c,v 1.27 2019/12/05 06:25:33 msaitoh Exp $ */ 1/* $NetBSD: if_admsw.c,v 1.28 2020/01/29 05:30:14 thorpej Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2007 Ruslan Ermilov and Vsevolod Lobko. 4 * Copyright (c) 2007 Ruslan Ermilov and Vsevolod Lobko.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or 7 * Redistribution and use in source and binary forms, with or
8 * without modification, are permitted provided that the following 8 * without modification, are permitted provided that the following
9 * conditions are met: 9 * conditions are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above 12 * 2. Redistributions in binary form must reproduce the above
13 * copyright notice, this list of conditions and the following 13 * copyright notice, this list of conditions and the following
14 * disclaimer in the documentation and/or other materials provided 14 * disclaimer in the documentation and/or other materials provided
@@ -66,27 +66,27 @@ @@ -66,27 +66,27 @@
66 */ 66 */
67 67
68/* 68/*
69 * Device driver for Alchemy Semiconductor Au1x00 Ethernet Media 69 * Device driver for Alchemy Semiconductor Au1x00 Ethernet Media
70 * Access Controller. 70 * Access Controller.
71 * 71 *
72 * TODO: 72 * TODO:
73 * 73 *
74 * Better Rx buffer management; we want to get new Rx buffers 74 * Better Rx buffer management; we want to get new Rx buffers
75 * to the chip more quickly than we currently do. 75 * to the chip more quickly than we currently do.
76 */ 76 */
77 77
78#include <sys/cdefs.h> 78#include <sys/cdefs.h>
79__KERNEL_RCSID(0, "$NetBSD: if_admsw.c,v 1.27 2019/12/05 06:25:33 msaitoh Exp $"); 79__KERNEL_RCSID(0, "$NetBSD: if_admsw.c,v 1.28 2020/01/29 05:30:14 thorpej Exp $");
80 80
81 81
82#include <sys/param.h> 82#include <sys/param.h>
83#include <sys/bus.h> 83#include <sys/bus.h>
84#include <sys/callout.h> 84#include <sys/callout.h>
85#include <sys/device.h> 85#include <sys/device.h>
86#include <sys/endian.h> 86#include <sys/endian.h>
87#include <sys/errno.h> 87#include <sys/errno.h>
88#include <sys/intr.h> 88#include <sys/intr.h>
89#include <sys/ioctl.h> 89#include <sys/ioctl.h>
90#include <sys/kernel.h> 90#include <sys/kernel.h>
91#include <sys/malloc.h> 91#include <sys/malloc.h>
92#include <sys/mbuf.h> 92#include <sys/mbuf.h>
@@ -861,27 +861,27 @@ admsw_txintr(struct admsw_softc *sc, int @@ -861,27 +861,27 @@ admsw_txintr(struct admsw_softc *sc, int
861 bus_dmamap_sync(sc->sc_dmat, ds->ds_dmamap, 861 bus_dmamap_sync(sc->sc_dmat, ds->ds_dmamap,
862 0, ds->ds_dmamap->dm_mapsize, BUS_DMASYNC_POSTWRITE); 862 0, ds->ds_dmamap->dm_mapsize, BUS_DMASYNC_POSTWRITE);
863 bus_dmamap_unload(sc->sc_dmat, ds->ds_dmamap); 863 bus_dmamap_unload(sc->sc_dmat, ds->ds_dmamap);
864 m_freem(ds->ds_mbuf); 864 m_freem(ds->ds_mbuf);
865 ds->ds_mbuf = NULL; 865 ds->ds_mbuf = NULL;
866 866
867 vlan = ffs(desc->status & 0x3f) - 1; 867 vlan = ffs(desc->status & 0x3f) - 1;
868 if (vlan < 0 || vlan >= SW_DEVS) 868 if (vlan < 0 || vlan >= SW_DEVS)
869 panic("admsw_txintr: bad vlan\n"); 869 panic("admsw_txintr: bad vlan\n");
870 ifp = &sc->sc_ethercom[vlan].ec_if; 870 ifp = &sc->sc_ethercom[vlan].ec_if;
871 gotone = 1; 871 gotone = 1;
872 /* printf("clear tx slot %d\n", i); */ 872 /* printf("clear tx slot %d\n", i); */
873 873
874 ifp->if_opackets++; 874 if_statinc(ifp, if_opackets);
875 875
876 sc->sc_txfree++; 876 sc->sc_txfree++;
877 } 877 }
878 878
879 if (gotone) { 879 if (gotone) {
880 sc->sc_txdirty = i; 880 sc->sc_txdirty = i;
881#ifdef ADMSW_EVENT_COUNTERS 881#ifdef ADMSW_EVENT_COUNTERS
882 ADMSW_EVCNT_INCR(&sc->sc_ev_txintr); 882 ADMSW_EVCNT_INCR(&sc->sc_ev_txintr);
883#endif 883#endif
884 for (vlan = 0; vlan < SW_DEVS; vlan++) 884 for (vlan = 0; vlan < SW_DEVS; vlan++)
885 sc->sc_ethercom[vlan].ec_if.if_flags &= ~IFF_OACTIVE; 885 sc->sc_ethercom[vlan].ec_if.if_flags &= ~IFF_OACTIVE;
886 886
887 ifp = &sc->sc_ethercom[0].ec_if; 887 ifp = &sc->sc_ethercom[0].ec_if;
@@ -985,27 +985,27 @@ admsw_rxintr(struct admsw_softc *sc, int @@ -985,27 +985,27 @@ admsw_rxintr(struct admsw_softc *sc, int
985 stat = sc->sc_rxldescs[i].status; 985 stat = sc->sc_rxldescs[i].status;
986 len = (stat & ADM5120_DMA_LEN) >> ADM5120_DMA_LENSHIFT; 986 len = (stat & ADM5120_DMA_LEN) >> ADM5120_DMA_LENSHIFT;
987 len -= ETHER_CRC_LEN; 987 len -= ETHER_CRC_LEN;
988 port = (stat & ADM5120_DMA_PORTID) >> ADM5120_DMA_PORTSHIFT; 988 port = (stat & ADM5120_DMA_PORTID) >> ADM5120_DMA_PORTSHIFT;
989 for (vlan = 0; vlan < SW_DEVS; vlan++) 989 for (vlan = 0; vlan < SW_DEVS; vlan++)
990 if ((1 << port) & vlan_matrix[vlan]) 990 if ((1 << port) & vlan_matrix[vlan])
991 break; 991 break;
992 if (vlan == SW_DEVS) 992 if (vlan == SW_DEVS)
993 vlan = 0; 993 vlan = 0;
994 ifp = &sc->sc_ethercom[vlan].ec_if; 994 ifp = &sc->sc_ethercom[vlan].ec_if;
995 995
996 m = ds->ds_mbuf; 996 m = ds->ds_mbuf;
997 if (admsw_add_rxlbuf(sc, i) != 0) { 997 if (admsw_add_rxlbuf(sc, i) != 0) {
998 ifp->if_ierrors++; 998 if_statinc(ifp, if_ierrors);
999 ADMSW_INIT_RXLDESC(sc, i); 999 ADMSW_INIT_RXLDESC(sc, i);
1000 bus_dmamap_sync(sc->sc_dmat, ds->ds_dmamap, 0, 1000 bus_dmamap_sync(sc->sc_dmat, ds->ds_dmamap, 0,
1001 ds->ds_dmamap->dm_mapsize, BUS_DMASYNC_PREREAD); 1001 ds->ds_dmamap->dm_mapsize, BUS_DMASYNC_PREREAD);
1002 continue; 1002 continue;
1003 } 1003 }
1004 1004
1005 m_set_rcvif(m, ifp); 1005 m_set_rcvif(m, ifp);
1006 m->m_pkthdr.len = m->m_len = len; 1006 m->m_pkthdr.len = m->m_len = len;
1007 if ((stat & ADM5120_DMA_TYPE) == ADM5120_DMA_TYPE_IP) { 1007 if ((stat & ADM5120_DMA_TYPE) == ADM5120_DMA_TYPE_IP) {
1008 m->m_pkthdr.csum_flags |= M_CSUM_IPv4; 1008 m->m_pkthdr.csum_flags |= M_CSUM_IPv4;
1009 if (stat & ADM5120_DMA_CSUMFAIL) 1009 if (stat & ADM5120_DMA_CSUMFAIL)
1010 m->m_pkthdr.csum_flags |= M_CSUM_IPv4_BAD; 1010 m->m_pkthdr.csum_flags |= M_CSUM_IPv4_BAD;
1011 } 1011 }

cvs diff -r1.47 -r1.48 src/sys/arch/mips/alchemy/dev/if_aumac.c (expand / switch to unified diff)

--- src/sys/arch/mips/alchemy/dev/if_aumac.c 2019/05/28 07:41:47 1.47
+++ src/sys/arch/mips/alchemy/dev/if_aumac.c 2020/01/29 05:30:14 1.48
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: if_aumac.c,v 1.47 2019/05/28 07:41:47 msaitoh Exp $ */ 1/* $NetBSD: if_aumac.c,v 1.48 2020/01/29 05:30:14 thorpej Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2001 Wasabi Systems, Inc. 4 * Copyright (c) 2001 Wasabi Systems, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Written by Jason R. Thorpe for Wasabi Systems, Inc. 7 * Written by Jason R. Thorpe for Wasabi Systems, Inc.
8 * 8 *
9 * Redistribution and use in source and binary forms, with or without 9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions 10 * modification, are permitted provided that the following conditions
11 * are met: 11 * are met:
12 * 1. Redistributions of source code must retain the above copyright 12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer. 13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright 14 * 2. Redistributions in binary form must reproduce the above copyright
@@ -36,27 +36,27 @@ @@ -36,27 +36,27 @@
36 */ 36 */
37 37
38/* 38/*
39 * Device driver for Alchemy Semiconductor Au1x00 Ethernet Media 39 * Device driver for Alchemy Semiconductor Au1x00 Ethernet Media
40 * Access Controller. 40 * Access Controller.
41 * 41 *
42 * TODO: 42 * TODO:
43 * 43 *
44 * Better Rx buffer management; we want to get new Rx buffers 44 * Better Rx buffer management; we want to get new Rx buffers
45 * to the chip more quickly than we currently do. 45 * to the chip more quickly than we currently do.
46 */ 46 */
47 47
48#include <sys/cdefs.h> 48#include <sys/cdefs.h>
49__KERNEL_RCSID(0, "$NetBSD: if_aumac.c,v 1.47 2019/05/28 07:41:47 msaitoh Exp $"); 49__KERNEL_RCSID(0, "$NetBSD: if_aumac.c,v 1.48 2020/01/29 05:30:14 thorpej Exp $");
50 50
51 51
52 52
53#include <sys/param.h> 53#include <sys/param.h>
54#include <sys/bus.h> 54#include <sys/bus.h>
55#include <sys/callout.h> 55#include <sys/callout.h>
56#include <sys/device.h> 56#include <sys/device.h>
57#include <sys/endian.h> 57#include <sys/endian.h>
58#include <sys/errno.h> 58#include <sys/errno.h>
59#include <sys/intr.h> 59#include <sys/intr.h>
60#include <sys/ioctl.h> 60#include <sys/ioctl.h>
61#include <sys/kernel.h> 61#include <sys/kernel.h>
62#include <sys/mbuf.h> 62#include <sys/mbuf.h>
@@ -555,36 +555,38 @@ aumac_txintr(struct aumac_softc *sc) @@ -555,36 +555,38 @@ aumac_txintr(struct aumac_softc *sc)
555 i = AUMAC_NEXTTX(i)) { 555 i = AUMAC_NEXTTX(i)) {
556 if ((bus_space_read_4(sc->sc_st, sc->sc_dma_sh, 556 if ((bus_space_read_4(sc->sc_st, sc->sc_dma_sh,
557 MACDMA_TX_ADDR(i)) & TX_ADDR_DN) == 0) 557 MACDMA_TX_ADDR(i)) & TX_ADDR_DN) == 0)
558 break; 558 break;
559 pkts++; 559 pkts++;
560 560
561 /* ACK interrupt. */ 561 /* ACK interrupt. */
562 bus_space_write_4(sc->sc_st, sc->sc_dma_sh, 562 bus_space_write_4(sc->sc_st, sc->sc_dma_sh,
563 MACDMA_TX_ADDR(i), 0); 563 MACDMA_TX_ADDR(i), 0);
564 564
565 stat = bus_space_read_4(sc->sc_st, sc->sc_dma_sh, 565 stat = bus_space_read_4(sc->sc_st, sc->sc_dma_sh,
566 MACDMA_TX_STAT(i)); 566 MACDMA_TX_STAT(i));
567 567
 568 net_stat_ref_t nsr = IF_STAT_GETREF(ifp);
568 if (stat & TX_STAT_FA) { 569 if (stat & TX_STAT_FA) {
569 /* XXX STATS */ 570 /* XXX STATS */
570 ifp->if_oerrors++; 571 if_statinc_ref(nsr, if_oerrors);
571 } else 572 } else
572 ifp->if_opackets++; 573 if_statinc_ref(nsr, if_opackets);
573 574
574 if (stat & TX_STAT_EC) 575 if (stat & TX_STAT_EC)
575 ifp->if_collisions += 16; 576 if_statadd_ref(nsr, if_collisions, 16);
576 else 577 else if (TX_STAT_CC(stat))
577 ifp->if_collisions += TX_STAT_CC(stat); 578 if_statadd_ref(nsr, if_collisions, TX_STAT_CC(stat));
 579 IF_STAT_PUTREF(ifp);
578 580
579 sc->sc_txfree++; 581 sc->sc_txfree++;
580 ifp->if_flags &= ~IFF_OACTIVE; 582 ifp->if_flags &= ~IFF_OACTIVE;
581 583
582 /* Try to queue more packets. */ 584 /* Try to queue more packets. */
583 if_schedule_deferred_start(ifp); 585 if_schedule_deferred_start(ifp);
584 } 586 }
585 587
586 if (pkts) 588 if (pkts)
587 AUMAC_EVCNT_INCR(&sc->sc_ev_txintr); 589 AUMAC_EVCNT_INCR(&sc->sc_ev_txintr);
588 590
589 /* Update the dirty descriptor pointer. */ 591 /* Update the dirty descriptor pointer. */
590 sc->sc_txdirty = i; 592 sc->sc_txdirty = i;
@@ -660,27 +662,27 @@ aumac_rxintr(struct aumac_softc *sc) @@ -660,27 +662,27 @@ aumac_rxintr(struct aumac_softc *sc)
660 if (stat & RX_STAT_RF) 662 if (stat & RX_STAT_RF)
661 PRINTERR("runt frame (collision)"); 663 PRINTERR("runt frame (collision)");
662 if (stat & RX_STAT_WT) 664 if (stat & RX_STAT_WT)
663 PRINTERR("watch dog"); 665 PRINTERR("watch dog");
664 if (stat & RX_STAT_DB) { 666 if (stat & RX_STAT_DB) {
665 if (stat & (RX_STAT_CS | RX_STAT_RF | 667 if (stat & (RX_STAT_CS | RX_STAT_RF |
666 RX_STAT_CR)) { 668 RX_STAT_CR)) {
667 if (!error) 669 if (!error)
668 goto pktok; 670 goto pktok;
669 } else 671 } else
670 PRINTERR("dribbling bit"); 672 PRINTERR("dribbling bit");
671 } 673 }
672#undef PRINTERR 674#undef PRINTERR
673 ifp->if_ierrors++; 675 if_statinc(ifp, if_ierrors);
674 676
675 dropit: 677 dropit:
676 /* reuse the current descriptor */ 678 /* reuse the current descriptor */
677 AUMAC_INIT_RXDESC(sc, i); 679 AUMAC_INIT_RXDESC(sc, i);
678 continue; 680 continue;
679 } 681 }
680 pktok: 682 pktok:
681 len = RX_STAT_L(stat); 683 len = RX_STAT_L(stat);
682 684
683 /* 685 /*
684 * The Au1X00 MAC includes the CRC with every packet; 686 * The Au1X00 MAC includes the CRC with every packet;
685 * trim it off here. 687 * trim it off here.
686 */ 688 */

cvs diff -r1.37 -r1.38 src/sys/arch/mips/atheros/dev/if_ae.c (expand / switch to unified diff)

--- src/sys/arch/mips/atheros/dev/if_ae.c 2019/09/13 07:55:06 1.37
+++ src/sys/arch/mips/atheros/dev/if_ae.c 2020/01/29 05:30:14 1.38
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $Id: if_ae.c,v 1.37 2019/09/13 07:55:06 msaitoh Exp $ */ 1/* $Id: if_ae.c,v 1.38 2020/01/29 05:30:14 thorpej Exp $ */
2/*- 2/*-
3 * Copyright (c) 2006 Urbana-Champaign Independent Media Center. 3 * Copyright (c) 2006 Urbana-Champaign Independent Media Center.
4 * Copyright (c) 2006 Garrett D'Amore. 4 * Copyright (c) 2006 Garrett D'Amore.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code was written by Garrett D'Amore for the Champaign-Urbana 7 * This code was written by Garrett D'Amore for the Champaign-Urbana
8 * Community Wireless Network Project. 8 * Community Wireless Network Project.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or 10 * Redistribution and use in source and binary forms, with or
11 * without modification, are permitted provided that the following 11 * without modification, are permitted provided that the following
12 * conditions are met: 12 * conditions are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -88,27 +88,27 @@ @@ -88,27 +88,27 @@
88 * 88 *
89 * 1) Find out about BUS_MODE_ALIGN16B. This chip can apparently align 89 * 1) Find out about BUS_MODE_ALIGN16B. This chip can apparently align
90 * inbound packets on a half-word boundary, which would make life easier 90 * inbound packets on a half-word boundary, which would make life easier
91 * for TCP/IP. (Aligning IP headers on a word.) 91 * for TCP/IP. (Aligning IP headers on a word.)
92 * 92 *
93 * 2) There is stuff in original tulip to shut down the device when reacting 93 * 2) There is stuff in original tulip to shut down the device when reacting
94 * to a change in link status. Is that needed. 94 * to a change in link status. Is that needed.
95 * 95 *
96 * 3) Test with variety of 10/100 HDX/FDX scenarios. 96 * 3) Test with variety of 10/100 HDX/FDX scenarios.
97 * 97 *
98 */ 98 */
99 99
100#include <sys/cdefs.h> 100#include <sys/cdefs.h>
101__KERNEL_RCSID(0, "$NetBSD: if_ae.c,v 1.37 2019/09/13 07:55:06 msaitoh Exp $"); 101__KERNEL_RCSID(0, "$NetBSD: if_ae.c,v 1.38 2020/01/29 05:30:14 thorpej Exp $");
102 102
103 103
104#include <sys/param.h> 104#include <sys/param.h>
105#include <sys/bus.h> 105#include <sys/bus.h>
106#include <sys/callout.h> 106#include <sys/callout.h>
107#include <sys/device.h> 107#include <sys/device.h>
108#include <sys/endian.h> 108#include <sys/endian.h>
109#include <sys/errno.h> 109#include <sys/errno.h>
110#include <sys/intr.h> 110#include <sys/intr.h>
111#include <sys/ioctl.h> 111#include <sys/ioctl.h>
112#include <sys/kernel.h> 112#include <sys/kernel.h>
113#include <sys/malloc.h> 113#include <sys/malloc.h>
114#include <sys/mbuf.h> 114#include <sys/mbuf.h>
@@ -774,27 +774,27 @@ ae_start(struct ifnet *ifp) @@ -774,27 +774,27 @@ ae_start(struct ifnet *ifp)
774 * 774 *
775 * Watchdog timer handler. 775 * Watchdog timer handler.
776 */ 776 */
777static void 777static void
778ae_watchdog(struct ifnet *ifp) 778ae_watchdog(struct ifnet *ifp)
779{ 779{
780 struct ae_softc *sc = ifp->if_softc; 780 struct ae_softc *sc = ifp->if_softc;
781 int doing_transmit; 781 int doing_transmit;
782 782
783 doing_transmit = (! SIMPLEQ_EMPTY(&sc->sc_txdirtyq)); 783 doing_transmit = (! SIMPLEQ_EMPTY(&sc->sc_txdirtyq));
784 784
785 if (doing_transmit) { 785 if (doing_transmit) {
786 printf("%s: transmit timeout\n", device_xname(sc->sc_dev)); 786 printf("%s: transmit timeout\n", device_xname(sc->sc_dev));
787 ifp->if_oerrors++; 787 if_statinc(ifp, if_oerrors);
788 } 788 }
789 else 789 else
790 printf("%s: spurious watchdog timeout\n", device_xname(sc->sc_dev)); 790 printf("%s: spurious watchdog timeout\n", device_xname(sc->sc_dev));
791 791
792 (void) ae_init(ifp); 792 (void) ae_init(ifp);
793 793
794 /* Try to get more packets going. */ 794 /* Try to get more packets going. */
795 ae_start(ifp); 795 ae_start(ifp);
796} 796}
797 797
798/* If the interface is up and running, only modify the receive 798/* If the interface is up and running, only modify the receive
799 * filter when changing to/from promiscuous mode. Otherwise return 799 * filter when changing to/from promiscuous mode. Otherwise return
800 * ENETRESET so that ether_ioctl will reset the chip. 800 * ENETRESET so that ether_ioctl will reset the chip.
@@ -1023,44 +1023,44 @@ ae_rxintr(struct ae_softc *sc) @@ -1023,44 +1023,44 @@ ae_rxintr(struct ae_softc *sc)
1023 rxstat = sc->sc_rxdescs[i].ad_status; 1023 rxstat = sc->sc_rxdescs[i].ad_status;
1024 1024
1025 if (rxstat & ADSTAT_OWN) { 1025 if (rxstat & ADSTAT_OWN) {
1026 /* 1026 /*
1027 * We have processed all of the receive buffers. 1027 * We have processed all of the receive buffers.
1028 */ 1028 */
1029 break; 1029 break;
1030 } 1030 }
1031 1031
1032 /* 1032 /*
1033 * If any collisions were seen on the wire, count one. 1033 * If any collisions were seen on the wire, count one.
1034 */ 1034 */
1035 if (rxstat & ADSTAT_Rx_CS) 1035 if (rxstat & ADSTAT_Rx_CS)
1036 ifp->if_collisions++; 1036 if_statinc(ifp, if_collisions);
1037 1037
1038 /* 1038 /*
1039 * If an error occurred, update stats, clear the status 1039 * If an error occurred, update stats, clear the status
1040 * word, and leave the packet buffer in place. It will 1040 * word, and leave the packet buffer in place. It will
1041 * simply be reused the next time the ring comes around. 1041 * simply be reused the next time the ring comes around.
1042 * If 802.1Q VLAN MTU is enabled, ignore the Frame Too Long 1042 * If 802.1Q VLAN MTU is enabled, ignore the Frame Too Long
1043 * error. 1043 * error.
1044 */ 1044 */
1045 if (rxstat & ADSTAT_ES && 1045 if (rxstat & ADSTAT_ES &&
1046 ((sc->sc_ethercom.ec_capenable & ETHERCAP_VLAN_MTU) == 0 || 1046 ((sc->sc_ethercom.ec_capenable & ETHERCAP_VLAN_MTU) == 0 ||
1047 (rxstat & (ADSTAT_Rx_DE | ADSTAT_Rx_RF | 1047 (rxstat & (ADSTAT_Rx_DE | ADSTAT_Rx_RF |
1048 ADSTAT_Rx_DB | ADSTAT_Rx_CE)) != 0)) { 1048 ADSTAT_Rx_DB | ADSTAT_Rx_CE)) != 0)) {
1049#define PRINTERR(bit, str) \ 1049#define PRINTERR(bit, str) \
1050 if (rxstat & (bit)) \ 1050 if (rxstat & (bit)) \
1051 printf("%s: receive error: %s\n", \ 1051 printf("%s: receive error: %s\n", \
1052 device_xname(sc->sc_dev), str) 1052 device_xname(sc->sc_dev), str)
1053 ifp->if_ierrors++; 1053 if_statinc(ifp, if_ierrors);
1054 PRINTERR(ADSTAT_Rx_DE, "descriptor error"); 1054 PRINTERR(ADSTAT_Rx_DE, "descriptor error");
1055 PRINTERR(ADSTAT_Rx_RF, "runt frame"); 1055 PRINTERR(ADSTAT_Rx_RF, "runt frame");
1056 PRINTERR(ADSTAT_Rx_TL, "frame too long"); 1056 PRINTERR(ADSTAT_Rx_TL, "frame too long");
1057 PRINTERR(ADSTAT_Rx_RE, "MII error"); 1057 PRINTERR(ADSTAT_Rx_RE, "MII error");
1058 PRINTERR(ADSTAT_Rx_DB, "dribbling bit"); 1058 PRINTERR(ADSTAT_Rx_DB, "dribbling bit");
1059 PRINTERR(ADSTAT_Rx_CE, "CRC error"); 1059 PRINTERR(ADSTAT_Rx_CE, "CRC error");
1060#undef PRINTERR 1060#undef PRINTERR
1061 AE_INIT_RXDESC(sc, i); 1061 AE_INIT_RXDESC(sc, i);
1062 continue; 1062 continue;
1063 } 1063 }
1064 1064
1065 bus_dmamap_sync(sc->sc_dmat, rxs->rxs_dmamap, 0, 1065 bus_dmamap_sync(sc->sc_dmat, rxs->rxs_dmamap, 0,
1066 rxs->rxs_dmamap->dm_mapsize, BUS_DMASYNC_POSTREAD); 1066 rxs->rxs_dmamap->dm_mapsize, BUS_DMASYNC_POSTREAD);
@@ -1074,43 +1074,43 @@ ae_rxintr(struct ae_softc *sc) @@ -1074,43 +1074,43 @@ ae_rxintr(struct ae_softc *sc)
1074 /* 1074 /*
1075 * XXX: the Atheros part can align on half words. what 1075 * XXX: the Atheros part can align on half words. what
1076 * is the performance implication of this? Probably 1076 * is the performance implication of this? Probably
1077 * minimal, and we should use it... 1077 * minimal, and we should use it...
1078 */ 1078 */
1079#ifdef __NO_STRICT_ALIGNMENT 1079#ifdef __NO_STRICT_ALIGNMENT
1080 /* 1080 /*
1081 * Allocate a new mbuf cluster. If that fails, we are 1081 * Allocate a new mbuf cluster. If that fails, we are
1082 * out of memory, and must drop the packet and recycle 1082 * out of memory, and must drop the packet and recycle
1083 * the buffer that's already attached to this descriptor. 1083 * the buffer that's already attached to this descriptor.
1084 */ 1084 */
1085 m = rxs->rxs_mbuf; 1085 m = rxs->rxs_mbuf;
1086 if (ae_add_rxbuf(sc, i) != 0) { 1086 if (ae_add_rxbuf(sc, i) != 0) {
1087 ifp->if_ierrors++; 1087 if_statinc(ifp, if_ierrors);
1088 AE_INIT_RXDESC(sc, i); 1088 AE_INIT_RXDESC(sc, i);
1089 bus_dmamap_sync(sc->sc_dmat, rxs->rxs_dmamap, 0, 1089 bus_dmamap_sync(sc->sc_dmat, rxs->rxs_dmamap, 0,
1090 rxs->rxs_dmamap->dm_mapsize, BUS_DMASYNC_PREREAD); 1090 rxs->rxs_dmamap->dm_mapsize, BUS_DMASYNC_PREREAD);
1091 continue; 1091 continue;
1092 } 1092 }
1093#else 1093#else
1094 /* 1094 /*
1095 * The chip's receive buffers must be 4-byte aligned. 1095 * The chip's receive buffers must be 4-byte aligned.
1096 * But this means that the data after the Ethernet header 1096 * But this means that the data after the Ethernet header
1097 * is misaligned. We must allocate a new buffer and 1097 * is misaligned. We must allocate a new buffer and
1098 * copy the data, shifted forward 2 bytes. 1098 * copy the data, shifted forward 2 bytes.
1099 */ 1099 */
1100 MGETHDR(m, M_DONTWAIT, MT_DATA); 1100 MGETHDR(m, M_DONTWAIT, MT_DATA);
1101 if (m == NULL) { 1101 if (m == NULL) {
1102 dropit: 1102 dropit:
1103 ifp->if_ierrors++; 1103 if_statinc(ifp, if_ierrors);
1104 AE_INIT_RXDESC(sc, i); 1104 AE_INIT_RXDESC(sc, i);
1105 bus_dmamap_sync(sc->sc_dmat, rxs->rxs_dmamap, 0, 1105 bus_dmamap_sync(sc->sc_dmat, rxs->rxs_dmamap, 0,
1106 rxs->rxs_dmamap->dm_mapsize, BUS_DMASYNC_PREREAD); 1106 rxs->rxs_dmamap->dm_mapsize, BUS_DMASYNC_PREREAD);
1107 continue; 1107 continue;
1108 } 1108 }
1109 MCLAIM(m, &sc->sc_ethercom.ec_rx_mowner); 1109 MCLAIM(m, &sc->sc_ethercom.ec_rx_mowner);
1110 if (len > (MHLEN - 2)) { 1110 if (len > (MHLEN - 2)) {
1111 MCLGET(m, M_DONTWAIT); 1111 MCLGET(m, M_DONTWAIT);
1112 if ((m->m_flags & M_EXT) == 0) { 1112 if ((m->m_flags & M_EXT) == 0) {
1113 m_freem(m); 1113 m_freem(m);
1114 goto dropit; 1114 goto dropit;
1115 } 1115 }
1116 } 1116 }
@@ -1206,37 +1206,40 @@ ae_txintr(struct ae_softc *sc) @@ -1206,37 +1206,40 @@ ae_txintr(struct ae_softc *sc)
1206 * Check for errors and collisions. 1206 * Check for errors and collisions.
1207 */ 1207 */
1208#ifdef AE_STATS 1208#ifdef AE_STATS
1209 if (txstat & ADSTAT_Tx_UF) 1209 if (txstat & ADSTAT_Tx_UF)
1210 sc->sc_stats.ts_tx_uf++; 1210 sc->sc_stats.ts_tx_uf++;
1211 if (txstat & ADSTAT_Tx_TO) 1211 if (txstat & ADSTAT_Tx_TO)
1212 sc->sc_stats.ts_tx_to++; 1212 sc->sc_stats.ts_tx_to++;
1213 if (txstat & ADSTAT_Tx_EC) 1213 if (txstat & ADSTAT_Tx_EC)
1214 sc->sc_stats.ts_tx_ec++; 1214 sc->sc_stats.ts_tx_ec++;
1215 if (txstat & ADSTAT_Tx_LC) 1215 if (txstat & ADSTAT_Tx_LC)
1216 sc->sc_stats.ts_tx_lc++; 1216 sc->sc_stats.ts_tx_lc++;
1217#endif 1217#endif
1218 1218
 1219 net_stat_ref_t nsr = IF_STAT_GETREF(ifp);
1219 if (txstat & (ADSTAT_Tx_UF | ADSTAT_Tx_TO)) 1220 if (txstat & (ADSTAT_Tx_UF | ADSTAT_Tx_TO))
1220 ifp->if_oerrors++; 1221 if_statinc_ref(nsr, if_oerrors);
1221 1222
1222 if (txstat & ADSTAT_Tx_EC) 1223 if (txstat & ADSTAT_Tx_EC)
1223 ifp->if_collisions += 16; 1224 if_statadd_ref(nsr, if_collisions, 16);
1224 else 1225 else if (ADSTAT_Tx_COLLISIONS(txstat))
1225 ifp->if_collisions += ADSTAT_Tx_COLLISIONS(txstat); 1226 if_statadd_ref(nsr, if_collisions,
 1227 ADSTAT_Tx_COLLISIONS(txstat));
1226 if (txstat & ADSTAT_Tx_LC) 1228 if (txstat & ADSTAT_Tx_LC)
1227 ifp->if_collisions++; 1229 if_statinc_ref(nsr, if_collisions);
1228 1230
1229 ifp->if_opackets++; 1231 if_statinc_ref(nsr, if_opackets);
 1232 IF_STAT_PUTREF(ifp);
1230 } 1233 }
1231 1234
1232 /* 1235 /*
1233 * If there are no more pending transmissions, cancel the watchdog 1236 * If there are no more pending transmissions, cancel the watchdog
1234 * timer. 1237 * timer.
1235 */ 1238 */
1236 if (txs == NULL) 1239 if (txs == NULL)
1237 ifp->if_timer = 0; 1240 ifp->if_timer = 0;
1238} 1241}
1239 1242
1240#ifdef AE_STATS 1243#ifdef AE_STATS
1241void 1244void
1242ae_print_stats(struct ae_softc *sc) 1245ae_print_stats(struct ae_softc *sc)

cvs diff -r1.15 -r1.16 src/sys/arch/mips/cavium/dev/if_cnmac.c (expand / switch to unified diff)

--- src/sys/arch/mips/cavium/dev/if_cnmac.c 2019/12/28 02:58:59 1.15
+++ src/sys/arch/mips/cavium/dev/if_cnmac.c 2020/01/29 05:30:14 1.16
@@ -1,18 +1,18 @@ @@ -1,18 +1,18 @@
1/* $NetBSD: if_cnmac.c,v 1.15 2019/12/28 02:58:59 gutteridge Exp $ */ 1/* $NetBSD: if_cnmac.c,v 1.16 2020/01/29 05:30:14 thorpej Exp $ */
2 2
3#include <sys/cdefs.h> 3#include <sys/cdefs.h>
4#if 0 4#if 0
5__KERNEL_RCSID(0, "$NetBSD: if_cnmac.c,v 1.15 2019/12/28 02:58:59 gutteridge Exp $"); 5__KERNEL_RCSID(0, "$NetBSD: if_cnmac.c,v 1.16 2020/01/29 05:30:14 thorpej Exp $");
6#endif 6#endif
7 7
8#include "opt_octeon.h" 8#include "opt_octeon.h"
9 9
10#ifdef OCTEON_ETH_DEBUG 10#ifdef OCTEON_ETH_DEBUG
11 11
12#ifndef DIAGNOSTIC 12#ifndef DIAGNOSTIC
13#define DIAGNOSTIC 13#define DIAGNOSTIC
14#endif 14#endif
15 15
16#ifndef DEBUG 16#ifndef DEBUG
17#define DEBUG 17#define DEBUG
18#endif 18#endif
@@ -1477,34 +1477,34 @@ octeon_eth_recv(struct octeon_eth_softc  @@ -1477,34 +1477,34 @@ octeon_eth_recv(struct octeon_eth_softc
1477 /* XXX XXX XXX */ 1477 /* XXX XXX XXX */
1478 1478
1479 OCTEON_ETH_KASSERT(sc != NULL); 1479 OCTEON_ETH_KASSERT(sc != NULL);
1480 OCTEON_ETH_KASSERT(work != NULL); 1480 OCTEON_ETH_KASSERT(work != NULL);
1481 1481
1482 OCTEON_EVCNT_INC(sc, rx); 1482 OCTEON_EVCNT_INC(sc, rx);
1483 1483
1484 word2 = work[2]; 1484 word2 = work[2];
1485 ifp = &sc->sc_ethercom.ec_if; 1485 ifp = &sc->sc_ethercom.ec_if;
1486 1486
1487 OCTEON_ETH_KASSERT(ifp != NULL); 1487 OCTEON_ETH_KASSERT(ifp != NULL);
1488 1488
1489 if (__predict_false(octeon_eth_recv_check(sc, word2) != 0)) { 1489 if (__predict_false(octeon_eth_recv_check(sc, word2) != 0)) {
1490 ifp->if_ierrors++; 1490 if_statinc(ifp, if_ierrors);
1491 result = 1; 1491 result = 1;
1492 octeon_eth_buf_free_work(sc, work, word2); 1492 octeon_eth_buf_free_work(sc, work, word2);
1493 goto drop; 1493 goto drop;
1494 } 1494 }
1495 1495
1496 if (__predict_false(octeon_eth_recv_mbuf(sc, work, &m) != 0)) { 1496 if (__predict_false(octeon_eth_recv_mbuf(sc, work, &m) != 0)) {
1497 ifp->if_ierrors++; 1497 if_statinc(ifp, if_ierrors);
1498 result = 1; 1498 result = 1;
1499 octeon_eth_buf_free_work(sc, work, word2); 1499 octeon_eth_buf_free_work(sc, work, word2);
1500 goto drop; 1500 goto drop;
1501 } 1501 }
1502 1502
1503 /* work[0] .. work[3] may not be valid any more */ 1503 /* work[0] .. work[3] may not be valid any more */
1504 1504
1505 OCTEON_ETH_KASSERT(m != NULL); 1505 OCTEON_ETH_KASSERT(m != NULL);
1506 1506
1507 octeon_ipd_offload(word2, m->m_data, &m->m_pkthdr.csum_flags); 1507 octeon_ipd_offload(word2, m->m_data, &m->m_pkthdr.csum_flags);
1508 1508
1509 /* XXX XXX XXX */ 1509 /* XXX XXX XXX */
1510 if (sc->sc_soft_req_cnt > sc->sc_soft_req_thresh) { 1510 if (sc->sc_soft_req_cnt > sc->sc_soft_req_thresh) {

cvs diff -r1.7 -r1.8 src/sys/arch/mips/cavium/dev/octeon_gmx.c (expand / switch to unified diff)

--- src/sys/arch/mips/cavium/dev/octeon_gmx.c 2020/01/25 19:20:24 1.7
+++ src/sys/arch/mips/cavium/dev/octeon_gmx.c 2020/01/29 05:30:14 1.8
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: octeon_gmx.c,v 1.7 2020/01/25 19:20:24 thorpej Exp $ */ 1/* $NetBSD: octeon_gmx.c,v 1.8 2020/01/29 05:30:14 thorpej Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2007 Internet Initiative Japan, Inc. 4 * Copyright (c) 2007 Internet Initiative Japan, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
@@ -22,27 +22,27 @@ @@ -22,27 +22,27 @@
22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * SUCH DAMAGE. 26 * SUCH DAMAGE.
27 */ 27 */
28 28
29/* 29/*
30 * support GMX0 interface only 30 * support GMX0 interface only
31 * take no thought for other GMX interface 31 * take no thought for other GMX interface
32 */ 32 */
33 33
34#include <sys/cdefs.h> 34#include <sys/cdefs.h>
35__KERNEL_RCSID(0, "$NetBSD: octeon_gmx.c,v 1.7 2020/01/25 19:20:24 thorpej Exp $"); 35__KERNEL_RCSID(0, "$NetBSD: octeon_gmx.c,v 1.8 2020/01/29 05:30:14 thorpej Exp $");
36 36
37#include "opt_octeon.h" 37#include "opt_octeon.h"
38 38
39#include <sys/param.h> 39#include <sys/param.h>
40#include <sys/systm.h> 40#include <sys/systm.h>
41#include <sys/types.h> 41#include <sys/types.h>
42#include <sys/cpu.h> 42#include <sys/cpu.h>
43#include <sys/device.h> 43#include <sys/device.h>
44#include <sys/lock.h> 44#include <sys/lock.h>
45#include <sys/cdefs.h> 45#include <sys/cdefs.h>
46#include <sys/malloc.h> 46#include <sys/malloc.h>
47#include <sys/syslog.h> 47#include <sys/syslog.h>
48 48
@@ -1061,42 +1061,44 @@ octeon_gmx_stats(struct octeon_gmx_port_ @@ -1061,42 +1061,44 @@ octeon_gmx_stats(struct octeon_gmx_port_
1061{ 1061{
1062 struct ifnet *ifp = &sc->sc_port_ec->ec_if; 1062 struct ifnet *ifp = &sc->sc_port_ec->ec_if;
1063 uint64_t tmp; 1063 uint64_t tmp;
1064 1064
1065 /* 1065 /*
1066 * GMX0_RX0_STATS_PKTS is not count. 1066 * GMX0_RX0_STATS_PKTS is not count.
1067 * input packet is counted when recepted packet in if_cnmac. 1067 * input packet is counted when recepted packet in if_cnmac.
1068 */ 1068 */
1069 /* 1069 /*
1070 * GMX0_RX0_STATS_PKTS_BAD count is included 1070 * GMX0_RX0_STATS_PKTS_BAD count is included
1071 * receive error of work queue entry. 1071 * receive error of work queue entry.
1072 * this is not add to input packet errors of interface. 1072 * this is not add to input packet errors of interface.
1073 */ 1073 */
1074 ifp->if_iqdrops += 1074 net_stat_ref_t nsr = IF_STAT_GETREF(ifp);
1075 (uint32_t)_GMX_PORT_RD8(sc, GMX0_RX0_STATS_PKTS_DRP); 1075 if_statadd_ref(nsr, if_iqdrops,
1076 ifp->if_opackets += 1076 (uint32_t)_GMX_PORT_RD8(sc, GMX0_RX0_STATS_PKTS_DRP));
1077 (uint32_t)_GMX_PORT_RD8(sc, GMX0_TX0_STAT3); 1077 if_statadd_ref(nsr, if_opackets,
 1078 (uint32_t)_GMX_PORT_RD8(sc, GMX0_TX0_STAT3));
1078 1079
1079 tmp = _GMX_PORT_RD8(sc, GMX0_TX0_STAT0); 1080 tmp = _GMX_PORT_RD8(sc, GMX0_TX0_STAT0);
1080 ifp->if_oerrors += 1081 if_statadd_ref(nsr, if_oerrors,
1081 (uint32_t)tmp + ((uint32_t)(tmp >> 32) * 16); 1082 (uint32_t)tmp + ((uint32_t)(tmp >> 32) * 16));
1082 ifp->if_collisions += (uint32_t)tmp; 1083 if_statadd_ref(nsr, if_collisions, (uint32_t)tmp);
1083 1084
1084 tmp = _GMX_PORT_RD8(sc, GMX0_TX0_STAT1); 1085 tmp = _GMX_PORT_RD8(sc, GMX0_TX0_STAT1);
1085 ifp->if_collisions += 1086 if_statadd_ref(nsr, if_collisions,
1086 (uint32_t)tmp + (uint32_t)(tmp >> 32); 1087 (uint32_t)tmp + (uint32_t)(tmp >> 32));
1087 1088
1088 tmp = _GMX_PORT_RD8(sc, GMX0_TX0_STAT9); 1089 tmp = _GMX_PORT_RD8(sc, GMX0_TX0_STAT9);
1089 ifp->if_oerrors += (uint32_t)(tmp >> 32); 1090 if_statadd_ref(nsr, if_oerrors, (uint32_t)(tmp >> 32));
 1091 IF_STAT_PUTREF(ifp);
1090} 1092}
1091 1093
1092/* ---- DMAC filter */ 1094/* ---- DMAC filter */
1093 1095
1094#ifdef notyet 1096#ifdef notyet
1095/* 1097/*
1096 * DMAC filter configuration 1098 * DMAC filter configuration
1097 * accept all 1099 * accept all
1098 * reject 0 addrs (virtually accept all?) 1100 * reject 0 addrs (virtually accept all?)
1099 * reject N addrs 1101 * reject N addrs
1100 * accept N addrs 1102 * accept N addrs
1101 * accept 0 addrs (virtually reject all?) 1103 * accept 0 addrs (virtually reject all?)
1102 * reject all 1104 * reject all

cvs diff -r1.2 -r1.3 src/sys/arch/mips/cavium/dev/octeon_pip.c (expand / switch to unified diff)

--- src/sys/arch/mips/cavium/dev/octeon_pip.c 2018/02/06 09:33:45 1.2
+++ src/sys/arch/mips/cavium/dev/octeon_pip.c 2020/01/29 05:30:14 1.3
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: octeon_pip.c,v 1.2 2018/02/06 09:33:45 mrg Exp $ */ 1/* $NetBSD: octeon_pip.c,v 1.3 2020/01/29 05:30:14 thorpej Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2007 Internet Initiative Japan, Inc. 4 * Copyright (c) 2007 Internet Initiative Japan, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
@@ -17,27 +17,27 @@ @@ -17,27 +17,27 @@
17 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 19 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
20 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * SUCH DAMAGE. 26 * SUCH DAMAGE.
27 */ 27 */
28 28
29#include <sys/cdefs.h> 29#include <sys/cdefs.h>
30__KERNEL_RCSID(0, "$NetBSD: octeon_pip.c,v 1.2 2018/02/06 09:33:45 mrg Exp $"); 30__KERNEL_RCSID(0, "$NetBSD: octeon_pip.c,v 1.3 2020/01/29 05:30:14 thorpej Exp $");
31 31
32#include "opt_octeon.h" 32#include "opt_octeon.h"
33 33
34#include <sys/param.h> 34#include <sys/param.h>
35#include <sys/systm.h> 35#include <sys/systm.h>
36#include <sys/malloc.h> 36#include <sys/malloc.h>
37#include <sys/syslog.h> 37#include <sys/syslog.h>
38#include <sys/time.h> 38#include <sys/time.h>
39#include <net/if.h> 39#include <net/if.h>
40#include <mips/locore.h> 40#include <mips/locore.h>
41#include <mips/cavium/octeonvar.h> 41#include <mips/cavium/octeonvar.h>
42#include <mips/cavium/dev/octeon_pipreg.h> 42#include <mips/cavium/dev/octeon_pipreg.h>
43#include <mips/cavium/dev/octeon_pipvar.h> 43#include <mips/cavium/dev/octeon_pipvar.h>
@@ -235,27 +235,27 @@ octeon_pip_stats(struct octeon_pip_softc @@ -235,27 +235,27 @@ octeon_pip_stats(struct octeon_pip_softc
235 panic("%s: invalid argument. sc=%p, ifp=%p\n", __func__, 235 panic("%s: invalid argument. sc=%p, ifp=%p\n", __func__,
236 sc, ifp); 236 sc, ifp);
237 237
238 if (gmx_port < 0 || gmx_port > 2) { 238 if (gmx_port < 0 || gmx_port > 2) {
239 printf("%s: invalid gmx_port %d\n", __func__, gmx_port); 239 printf("%s: invalid gmx_port %d\n", __func__, gmx_port);
240 return; 240 return;
241 } 241 }
242 242
243 pip_stat_ctl = _PIP_RD8(sc, PIP_STAT_CTL_OFFSET); 243 pip_stat_ctl = _PIP_RD8(sc, PIP_STAT_CTL_OFFSET);
244 _PIP_WR8(sc, PIP_STAT_CTL_OFFSET, pip_stat_ctl | PIP_STAT_CTL_RDCLR); 244 _PIP_WR8(sc, PIP_STAT_CTL_OFFSET, pip_stat_ctl | PIP_STAT_CTL_RDCLR);
245 reg = &octeon_pip_dump_stats_[gmx_port]; 245 reg = &octeon_pip_dump_stats_[gmx_port];
246 tmp = _PIP_RD8(sc, reg->offset); 246 tmp = _PIP_RD8(sc, reg->offset);
247 pkts = (tmp & 0xffffffff00000000ULL) >> 32; 247 pkts = (tmp & 0xffffffff00000000ULL) >> 32;
248 ifp->if_iqdrops += pkts; 248 if_statadd(ifp, if_iqdrops, pkts);
249 249
250 _PIP_WR8(sc, PIP_STAT_CTL_OFFSET, pip_stat_ctl); 250 _PIP_WR8(sc, PIP_STAT_CTL_OFFSET, pip_stat_ctl);
251} 251}
252 252
253 253
254#ifdef OCTEON_ETH_DEBUG 254#ifdef OCTEON_ETH_DEBUG
255int octeon_pip_intr_rml_verbose; 255int octeon_pip_intr_rml_verbose;
256struct evcnt octeon_pip_intr_evcnt; 256struct evcnt octeon_pip_intr_evcnt;
257 257
258static const struct octeon_evcnt_entry octeon_pip_intr_evcnt_entries[] = { 258static const struct octeon_evcnt_entry octeon_pip_intr_evcnt_entries[] = {
259#define _ENTRY(name, type, parent, descr) \ 259#define _ENTRY(name, type, parent, descr) \
260 OCTEON_EVCNT_ENTRY(struct octeon_pip_softc, name, type, parent, descr) 260 OCTEON_EVCNT_ENTRY(struct octeon_pip_softc, name, type, parent, descr)
261 _ENTRY(pipbeperr, MISC, NULL, "pip parity error backend"), 261 _ENTRY(pipbeperr, MISC, NULL, "pip parity error backend"),

cvs diff -r1.19 -r1.20 src/sys/arch/mips/ralink/ralink_eth.c (expand / switch to unified diff)

--- src/sys/arch/mips/ralink/ralink_eth.c 2019/06/03 06:04:20 1.19
+++ src/sys/arch/mips/ralink/ralink_eth.c 2020/01/29 05:30:14 1.20

cvs diff -r1.61 -r1.62 src/sys/arch/mips/sibyte/dev/sbmac.c (expand / switch to unified diff)

--- src/sys/arch/mips/sibyte/dev/sbmac.c 2019/09/13 07:55:06 1.61
+++ src/sys/arch/mips/sibyte/dev/sbmac.c 2020/01/29 05:30:14 1.62
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: sbmac.c,v 1.61 2019/09/13 07:55:06 msaitoh Exp $ */ 1/* $NetBSD: sbmac.c,v 1.62 2020/01/29 05:30:14 thorpej Exp $ */
2 2
3/* 3/*
4 * Copyright 2000, 2001, 2004 4 * Copyright 2000, 2001, 2004
5 * Broadcom Corporation. All rights reserved. 5 * Broadcom Corporation. All rights reserved.
6 * 6 *
7 * This software is furnished under license and may be used and copied only 7 * This software is furnished under license and may be used and copied only
8 * in accordance with the following terms and conditions. Subject to these 8 * in accordance with the following terms and conditions. Subject to these
9 * conditions, you may download, copy, install, use, modify and distribute 9 * conditions, you may download, copy, install, use, modify and distribute
10 * modified or unmodified copies of this software in source and/or binary 10 * modified or unmodified copies of this software in source and/or binary
11 * form. No title or ownership is transferred hereby. 11 * form. No title or ownership is transferred hereby.
12 * 12 *
13 * 1) Any source code used, modified or distributed must reproduce and 13 * 1) Any source code used, modified or distributed must reproduce and
14 * retain this copyright notice and list of conditions as they appear in 14 * retain this copyright notice and list of conditions as they appear in
@@ -23,27 +23,27 @@ @@ -23,27 +23,27 @@
23 * WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED WARRANTIES OF 23 * WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED WARRANTIES OF
24 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR 24 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
25 * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL BROADCOM BE LIABLE 25 * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL BROADCOM BE LIABLE
26 * FOR ANY DAMAGES WHATSOEVER, AND IN PARTICULAR, BROADCOM SHALL NOT BE 26 * FOR ANY DAMAGES WHATSOEVER, AND IN PARTICULAR, BROADCOM SHALL NOT BE
27 * LIABLE FOR DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 27 * LIABLE FOR DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
28 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 28 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
29 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 29 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
30 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 30 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
31 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 31 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
32 * OR OTHERWISE), EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 * OR OTHERWISE), EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 */ 33 */
34 34
35#include <sys/cdefs.h> 35#include <sys/cdefs.h>
36__KERNEL_RCSID(0, "$NetBSD: sbmac.c,v 1.61 2019/09/13 07:55:06 msaitoh Exp $"); 36__KERNEL_RCSID(0, "$NetBSD: sbmac.c,v 1.62 2020/01/29 05:30:14 thorpej Exp $");
37 37
38#include "opt_inet.h" 38#include "opt_inet.h"
39#include "opt_ns.h" 39#include "opt_ns.h"
40 40
41#include <sys/param.h> 41#include <sys/param.h>
42#include <sys/systm.h> 42#include <sys/systm.h>
43#include <sys/sockio.h> 43#include <sys/sockio.h>
44#include <sys/mbuf.h> 44#include <sys/mbuf.h>
45#include <sys/kmem.h> 45#include <sys/kmem.h>
46#include <sys/kernel.h> 46#include <sys/kernel.h>
47#include <sys/socket.h> 47#include <sys/socket.h>
48#include <sys/queue.h> 48#include <sys/queue.h>
49#include <sys/device.h> 49#include <sys/device.h>
@@ -1006,27 +1006,27 @@ sbdma_tx_process(struct sbmac_softc *sc, @@ -1006,27 +1006,27 @@ sbdma_tx_process(struct sbmac_softc *sc,
1006 if (curidx == hwidx) 1006 if (curidx == hwidx)
1007 break; 1007 break;
1008 1008
1009 /* 1009 /*
1010 * Otherwise, get the packet's mbuf ptr back 1010 * Otherwise, get the packet's mbuf ptr back
1011 */ 1011 */
1012 1012
1013 m = d->sbdma_ctxtable[curidx]; 1013 m = d->sbdma_ctxtable[curidx];
1014 d->sbdma_ctxtable[curidx] = NULL; 1014 d->sbdma_ctxtable[curidx] = NULL;
1015 1015
1016 /* 1016 /*
1017 * for transmits we just free buffers and count packets. 1017 * for transmits we just free buffers and count packets.
1018 */ 1018 */
1019 ifp->if_opackets++; 1019 if_statinc(ifp, if_opackets);
1020 m_freem(m); 1020 m_freem(m);
1021 1021
1022 /* 1022 /*
1023 * .. and advance to the next buffer. 1023 * .. and advance to the next buffer.
1024 */ 1024 */
1025 1025
1026 d->sbdma_rem_index = SBDMA_NEXTBUF(d, d->sbdma_rem_index); 1026 d->sbdma_rem_index = SBDMA_NEXTBUF(d, d->sbdma_rem_index);
1027 } 1027 }
1028 1028
1029 /* 1029 /*
1030 * Decide what to set the IFF_OACTIVE bit in the interface to. 1030 * Decide what to set the IFF_OACTIVE bit in the interface to.
1031 * It's supposed to reflect if the interface is actively 1031 * It's supposed to reflect if the interface is actively
1032 * transmitting, but that's really hard to do quickly. 1032 * transmitting, but that's really hard to do quickly.