Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/pci switch to use ETHER_F_ALLMULTI flag



details:   https://anonhg.NetBSD.org/src/rev/37adea71f59a
branches:  trunk
changeset: 1008700:37adea71f59a
user:      nisimura <nisimura%NetBSD.org@localhost>
date:      Wed Apr 01 00:07:04 2020 +0000

description:
switch to use ETHER_F_ALLMULTI flag

diffstat:

 sys/dev/pci/if_kse.c |  27 ++++++++++++---------------
 1 files changed, 12 insertions(+), 15 deletions(-)

diffs (71 lines):

diff -r 9e6fdf77605a -r 37adea71f59a sys/dev/pci/if_kse.c
--- a/sys/dev/pci/if_kse.c      Tue Mar 31 23:26:32 2020 +0000
+++ b/sys/dev/pci/if_kse.c      Wed Apr 01 00:07:04 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_kse.c,v 1.51 2020/03/24 04:00:26 nisimura Exp $     */
+/*     $NetBSD: if_kse.c,v 1.52 2020/04/01 00:07:04 nisimura Exp $     */
 
 /*-
  * Copyright (c) 2006 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_kse.c,v 1.51 2020/03/24 04:00:26 nisimura Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_kse.c,v 1.52 2020/04/01 00:07:04 nisimura Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -1096,18 +1096,19 @@
 
        sc->sc_rxc &= ~(RXC_MHTE | RXC_RM | RXC_RA);
 
-       if (ifp->if_flags & IFF_PROMISC) {
-               ifp->if_flags |= IFF_ALLMULTI;
-               goto update;
-       }
-       ifp->if_flags &= ~IFF_ALLMULTI;
-
        /* clear perfect match filter and prepare mcast hash table */
        for (i = 0; i < 16; i++)
                 CSR_WRITE_4(sc, MAAH0 + i*8, 0);
        crc = mchash[0] = mchash[1] = 0;
 
        ETHER_LOCK(ec);
+       if (ifp->if_flags & IFF_PROMISC) {
+               ec->ec_flags |= ETHER_F_ALLMULTI;
+               /* run promisc. mode */
+               sc->sc_rxc |= RXC_RA;
+               goto update;
+       }
+       ec->ec_flags &= ~ETHER_F_ALLMULTI;
        ETHER_FIRST_MULTI(step, ec, enm);
        i = 0;
        while (enm != NULL) {
@@ -1120,8 +1121,10 @@
                         * ranges is for IP multicast routing, for which the
                         * range is big enough to require all bits set.)
                         */
+                       ec->ec_flags |= ETHER_F_ALLMULTI;
                        ETHER_UNLOCK(ec);
-                       ifp->if_flags |= IFF_ALLMULTI;
+                       /* accept all multicast */
+                       sc->sc_rxc |= RXC_RM;
                        goto update;
                }
 #if KSE_MCASTDEBUG == 1
@@ -1150,14 +1153,8 @@
                sc->sc_rxc |= RXC_MHTE;
        CSR_WRITE_4(sc, MTR0, mchash[0]);
        CSR_WRITE_4(sc, MTR1, mchash[1]);
-       return;
-
  update:
        /* With RA or RM, MHTE/MTR0/MTR1 are never consulted. */
-       if (ifp->if_flags & IFF_PROMISC)
-               sc->sc_rxc |= RXC_RA;
-       else
-               sc->sc_rxc |= RXC_RM;
        return;
 }
 



Home | Main Index | Thread Index | Old Index