Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/arm/sociox small knit about multicast hash table ha...



details:   https://anonhg.NetBSD.org/src/rev/6ae3b1bc6cb3
branches:  trunk
changeset: 1008496:6ae3b1bc6cb3
user:      nisimura <nisimura%NetBSD.org@localhost>
date:      Tue Mar 24 10:31:52 2020 +0000

description:
small knit about multicast hash table handling. use sc_100mii as bool

diffstat:

 sys/arch/arm/sociox/if_scx.c |  19 ++++++++++---------
 1 files changed, 10 insertions(+), 9 deletions(-)

diffs (70 lines):

diff -r 0e2dcde9874d -r 6ae3b1bc6cb3 sys/arch/arm/sociox/if_scx.c
--- a/sys/arch/arm/sociox/if_scx.c      Tue Mar 24 09:27:46 2020 +0000
+++ b/sys/arch/arm/sociox/if_scx.c      Tue Mar 24 10:31:52 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_scx.c,v 1.7 2020/03/24 02:31:59 nisimura Exp $      */
+/*     $NetBSD: if_scx.c,v 1.8 2020/03/24 10:31:52 nisimura Exp $      */
 
 /*-
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -55,7 +55,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_scx.c,v 1.7 2020/03/24 02:31:59 nisimura Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_scx.c,v 1.8 2020/03/24 10:31:52 nisimura Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -162,13 +162,14 @@
 #define GMACFCR                0x0018          /* 802.3x flowcontrol */
 #define  FCR_RFE       (1U<<2)         /* accept PAUSE to throttle Tx */
 #define  FCR_TFE       (1U<<1)         /* generate PAUSE to moderate Rx lvl */
+#define GMACVTAG       0x001c          /* VLAN tag control */
 #define GMACIMPL       0x0020          /* implementation number XXXX.YYYY */
-#define GMACVTAG       0x001c          /* VLAN tag control */
 #define GMACMAH0       0x0040          /* MAC address 0 47:32 */
 #define GMACMAL0       0x0044          /* MAC address 0 31:0 */
 #define GMACMAH(i)     ((i)*8+0x40)    /* supplimental MAC addr 1 - 15 */
 #define GMACMAL(i)     ((i)*8+0x44)
-#define GMACMHT0       0x0500          /* multicast hash table 0 - 8*/
+#define GMACMHT0       0x0500          /* multicast hash table 0 - 7 */
+#define GMACMHT(i)     ((i)*4+0500)
 
 #define GMACBMR                0x1000          /* DMA bus mode control
                                         * 24    4PBL
@@ -300,7 +301,7 @@
        uint32_t sc_mdclk;              /* GAR 5:2 clock selection */
        uint32_t sc_t0coso;             /* T0_CSUM | T0_SGOL to run */
        int sc_ucodeloaded;             /* ucode for H2M/M2H/PKT */
-       int sc_100mii;                  /* 1<<15 RMII/MII, 0 for RGMII */
+       int sc_100mii;                  /* 1 for RMII/MII, 0 for RGMII */
        int sc_phandle;                 /* fdt phandle */
 
        bus_dmamap_t sc_cddmamap;       /* control data DMA map */
@@ -459,7 +460,7 @@
        sc->sc_eesz = size[1];
        sc->sc_dmat = faa->faa_dmat;
        sc->sc_phandle = phandle;
-       sc->sc_100mii = (strcmp(phy_mode, "rgmii") != 0) ? MCR_USEMII : 0;
+       sc->sc_100mii = (strcmp(phy_mode, "rgmii") != 0);
 
        scx_attach_i(sc);
        return;
@@ -945,13 +946,13 @@
 
        if (crc)
                csr |= AFR_MHTE;
-       for (i = 0; i < 8; i++)
-               CSR_WRITE(sc, GMACMHT0 + i * 4, mchash[i]);
+       for (i = 0; i < __arraycount(mchash); i++)
+               CSR_WRITE(sc, GMACMHT(i), mchash[i]);
        CSR_WRITE(sc, GMACAFR, csr);
        return;
 
  update:
-       /* With PM or AM, MHTE/MHTL/MHTH are never consulted. really? */
+       /* With PM or AM, MHTE/MHT0-7 are never consulted. really? */
        if (ifp->if_flags & IFF_PROMISC)
                csr |= AFR_PM;  /* run promisc. mode */
        else



Home | Main Index | Thread Index | Old Index