The following diff rewrites parts of the code for promiscuous mode
and multicast handling. Please test promisc mode and multicast mode
of operation with any fxp(4) adapters.

Please provide a dmesg.


Index: fxp.c
===================================================================
RCS file: /cvs/src/sys/dev/ic/fxp.c,v
retrieving revision 1.96
diff -u -p -r1.96 fxp.c
--- fxp.c       6 Jun 2009 02:49:39 -0000       1.96
+++ fxp.c       29 Jul 2009 09:26:00 -0000
@@ -1284,7 +1284,8 @@ fxp_init(void *xsc)
        cbp->mc_all =           allm;
 #else
        cbp->cb_command = htole16(FXP_CB_COMMAND_CONFIG | FXP_CB_COMMAND_EL);
-       if (allm)
+
+       if (allm && !prm)
                cbp->mc_all |= 0x08;            /* accept all multicasts */
        else
                cbp->mc_all &= ~0x08;           /* reject all multicasts */
@@ -1718,44 +1719,39 @@ fxp_ioctl(struct ifnet *ifp, u_long comm
 void
 fxp_mc_setup(struct fxp_softc *sc, int doit)
 {
-       struct fxp_cb_mcs *mcsp = &sc->sc_ctrl->u.mcs;
        struct ifnet *ifp = &sc->sc_arpcom.ac_if;
+       struct arpcom *ac = &sc->sc_arpcom;
+       struct fxp_cb_mcs *mcsp = &sc->sc_ctrl->u.mcs;
        struct ether_multistep step;
        struct ether_multi *enm;
        int i, nmcasts;
 
-       /*
-        * Initialize multicast setup descriptor.
-        */
-       mcsp->cb_status = htole16(0);
-       mcsp->cb_command = htole16(FXP_CB_COMMAND_MCAS | FXP_CB_COMMAND_EL);
-       mcsp->link_addr = htole32(-1);
-
        nmcasts = 0;
-       if (!(ifp->if_flags & IFF_ALLMULTI)) {
+       ifp->if_flags &= ~IFF_ALLMULTI;
+
+       if (ifp->if_flags & IFF_PROMISC || ac->ac_multirangecnt > 0 ||
+           ac->ac_multicnt >= MAXMCADDR)
+               ifp->if_flags |= IFF_ALLMULTI;
+       else {
                ETHER_FIRST_MULTI(step, &sc->sc_arpcom, enm);
                while (enm != NULL) {
-                       if (nmcasts >= MAXMCADDR) {
-                               ifp->if_flags |= IFF_ALLMULTI;
-                               nmcasts = 0;
-                               break;
-                       }
-
-                       /* Punt on ranges. */
-                       if (bcmp(enm->enm_addrlo, enm->enm_addrhi,
-                           sizeof(enm->enm_addrlo)) != 0) {
-                               ifp->if_flags |= IFF_ALLMULTI;
-                               nmcasts = 0;
-                               break;
-                       }
                        bcopy(enm->enm_addrlo,
                            (void *)&mcsp->mc_addr[nmcasts][0], ETHER_ADDR_LEN);
                        nmcasts++;
+
                        ETHER_NEXT_MULTI(step, enm);
                }
        }
+
        if (doit == 0)
                return;
+
+       /* 
+        * Initialize multicast setup descriptor.
+        */
+       mcsp->cb_status = htole16(0);
+       mcsp->cb_command = htole16(FXP_CB_COMMAND_MCAS | FXP_CB_COMMAND_EL);
+       mcsp->link_addr = htole32(-1);
        mcsp->mc_cnt = htole16(nmcasts * ETHER_ADDR_LEN);
 
        /*

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

Reply via email to