Source-Changes-HG archive

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

[src/netbsd-3]: src/sys/dev/pci Pull up following revision(s) (requested by c...



details:   https://anonhg.NetBSD.org/src/rev/3ccfe04f812b
branches:  netbsd-3
changeset: 577142:3ccfe04f812b
user:      tron <tron%NetBSD.org@localhost>
date:      Sun Sep 11 22:06:32 2005 +0000

description:
Pull up following revision(s) (requested by christos in ticket #756):
        sys/dev/pci/if_vge.c: revision 1.6
PR/31130: FUKAUMI Naoki: Fix vge(4) SIOC{ADD,DEL}MULTI handling

diffstat:

 sys/dev/pci/if_vge.c |  48 +++++++++++++++++++++++++++++++++++-------------
 1 files changed, 35 insertions(+), 13 deletions(-)

diffs (112 lines):

diff -r 584d094d8a37 -r 3ccfe04f812b sys/dev/pci/if_vge.c
--- a/sys/dev/pci/if_vge.c      Fri Sep 09 15:28:55 2005 +0000
+++ b/sys/dev/pci/if_vge.c      Sun Sep 11 22:06:32 2005 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_vge.c,v 1.4 2005/03/05 14:51:21 jdolecek Exp $ */
+/* $NetBSD: if_vge.c,v 1.4.2.1 2005/09/11 22:06:32 tron Exp $ */
 
 /*-
  * Copyright (c) 2004
@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_vge.c,v 1.4 2005/03/05 14:51:21 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_vge.c,v 1.4.2.1 2005/09/11 22:06:32 tron Exp $");
 
 /*
  * VIA Networking Technologies VT612x PCI gigabit ethernet NIC driver.
@@ -549,15 +549,17 @@
        vge_cam_clear(sc);
        CSR_WRITE_4(sc, VGE_MAR0, 0);
        CSR_WRITE_4(sc, VGE_MAR1, 0);
+       ifp->if_flags &= ~IFF_ALLMULTI;
 
        /*
         * If the user wants allmulti or promisc mode, enable reception
         * of all multicast frames.
         */
-       if (ifp->if_flags & IFF_ALLMULTI || ifp->if_flags & IFF_PROMISC) {
+       if (ifp->if_flags & IFF_PROMISC) {
     allmulti:
                CSR_WRITE_4(sc, VGE_MAR0, 0xFFFFFFFF);
                CSR_WRITE_4(sc, VGE_MAR1, 0xFFFFFFFF);
+               ifp->if_flags |= IFF_ALLMULTI;
                return;
        }
 
@@ -571,8 +573,7 @@
                                ETHER_ADDR_LEN) != 0)
                        goto allmulti;
 
-               error = vge_cam_set(sc,
-                   LLADDR((struct sockaddr_dl *)enm->enm_addrlo));
+               error = vge_cam_set(sc, enm->enm_addrlo);
                if (error)
                        break;
 
@@ -585,12 +586,18 @@
 
                ETHER_FIRST_MULTI(step, &sc->sc_ethercom, enm);
                while(enm != NULL) {
-                       h = ether_crc32_be(LLADDR((struct sockaddr_dl *)
-                           enm->enm_addrlo), ETHER_ADDR_LEN) >> 26;
-                       if (h < 32)
-                               hashes[0] |= (1 << h);
-                       else
-                               hashes[1] |= (1 << (h - 32));
+                       /*
+                        * If multicast range, fall back to ALLMULTI.
+                        */
+                       if (memcmp(enm->enm_addrlo, enm->enm_addrhi,
+                                       ETHER_ADDR_LEN) != 0)
+                               goto allmulti;
+
+                       h = ether_crc32_be(enm->enm_addrlo,
+                           ETHER_ADDR_LEN) >> 26;
+                       hashes[h >> 5] |= 1 << (h & 0x1f);
+
+                       ETHER_NEXT_MULTI(step, enm);
                }
 
                CSR_WRITE_4(sc, VGE_MAR0, hashes[0]);
@@ -2058,7 +2065,9 @@
        struct vge_softc        *sc = ifp->if_softc;
        struct ifreq            *ifr = (struct ifreq *) data;
        struct mii_data         *mii;
-       int                     error = 0;
+       int                     s, error = 0;
+
+       s = splnet();
 
        switch (command) {
        case SIOCSIFMTU:
@@ -2090,7 +2099,19 @@
                break;
        case SIOCADDMULTI:
        case SIOCDELMULTI:
-               vge_setmulti(sc);
+               error = (command == SIOCADDMULTI) ?
+                   ether_addmulti(ifr, &sc->sc_ethercom) :
+                   ether_delmulti(ifr, &sc->sc_ethercom);
+
+               if (error == ENETRESET) {
+                       /*
+                        * Multicast list has changed; set the hardware filter
+                        * accordingly.
+                        */
+                       if (ifp->if_flags & IFF_RUNNING)
+                               vge_setmulti(sc);
+                       error = 0;
+               }
                break;
        case SIOCGIFMEDIA:
        case SIOCSIFMEDIA:
@@ -2102,6 +2123,7 @@
                break;
        }
 
+       splx(s);
        return (error);
 }
 



Home | Main Index | Thread Index | Old Index