Diff below converts the remaining drivers in our tree that still compare the low and high value of their Ethernet multicast ranges to set the IFF_ALLMULTI flag to use "ac->ac_multirangecnt" instead. This should not change the behavior of any driver.
The goal if this diff is to stop using the ``enm_addrhi'' field of the ether_multi structure to be able to modify our multicast address representation in a backward compatible way (without modifying more drivers than that!). As I (obviously) don't have access to all the hardware to fully test this diff, I appreciate test and/or oks on a per driver basis. I did compile this diff on amd64 and macppc. Index: dev/ic/aic6915.c =================================================================== RCS file: /home/ncvs/src/sys/dev/ic/aic6915.c,v retrieving revision 1.10 diff -u -p -r1.10 aic6915.c --- dev/ic/aic6915.c 7 Aug 2013 01:06:27 -0000 1.10 +++ dev/ic/aic6915.c 16 Oct 2013 13:27:25 -0000 @@ -1341,6 +1341,9 @@ sf_set_filter(struct sf_softc *sc) */ sf_set_filter_perfect(sc, 0, LLADDR(ifp->if_sadl)); + if (ac->ac_multirangecnt > 0) + goto allmulti; + /* * Now set the hash bits for each multicast address in our * list. @@ -1349,17 +1352,6 @@ sf_set_filter(struct sf_softc *sc) if (enm == NULL) goto done; while (enm != NULL) { - if (memcmp(enm->enm_addrlo, enm->enm_addrhi, ETHER_ADDR_LEN)) { - /* - * We must listen to a range of multicast addresses. - * For now, just accept all multicasts, rather than - * trying to set only those filter bits needed to match - * the range. (At this time, the only use of address - * ranges is for IP multicast routing, for which the - * range is big enough to require all bits set.) - */ - goto allmulti; - } sf_set_filter_hash(sc, enm->enm_addrlo); ETHER_NEXT_MULTI(step, enm); } Index: dev/ic/ath.c =================================================================== RCS file: /home/ncvs/src/sys/dev/ic/ath.c,v retrieving revision 1.96 diff -u -p -r1.96 ath.c --- dev/ic/ath.c 17 Oct 2012 00:59:57 -0000 1.96 +++ dev/ic/ath.c 16 Oct 2013 13:27:25 -0000 @@ -1148,18 +1148,20 @@ ath_mcastfilter_accum(caddr_t dl, u_int3 void ath_mcastfilter_compute(struct ath_softc *sc, u_int32_t (*mfilt)[2]) { + struct arpcom *ac = &sc->sc_ic.ic_ac; struct ifnet *ifp = &sc->sc_ic.ic_if; struct ether_multi *enm; struct ether_multistep estep; - ETHER_FIRST_MULTI(estep, &sc->sc_ic.ic_ac, enm); - while (enm != NULL) { + if (ac->ac_multirangecnt > 0) { /* XXX Punt on ranges. */ - if (!IEEE80211_ADDR_EQ(enm->enm_addrlo, enm->enm_addrhi)) { - (*mfilt)[0] = (*mfilt)[1] = ~((u_int32_t)0); - ifp->if_flags |= IFF_ALLMULTI; - return; - } + (*mfilt)[0] = (*mfilt)[1] = ~((u_int32_t)0); + ifp->if_flags |= IFF_ALLMULTI; + return; + } + + ETHER_FIRST_MULTI(estep, ac, enm); + while (enm != NULL) { ath_mcastfilter_accum(enm->enm_addrlo, mfilt); ETHER_NEXT_MULTI(estep, enm); } Index: dev/ic/athn.c =================================================================== RCS file: /home/ncvs/src/sys/dev/ic/athn.c,v retrieving revision 1.76 diff -u -p -r1.76 athn.c --- dev/ic/athn.c 7 Aug 2013 01:06:28 -0000 1.76 +++ dev/ic/athn.c 16 Oct 2013 13:27:25 -0000 @@ -2626,6 +2626,9 @@ athn_set_multi(struct athn_softc *sc) uint32_t val, lo, hi; uint8_t bit; + if (ac->ac_multirangecnt > 0) + ifp->if_flags |= IFF_ALLMULTI; + if ((ifp->if_flags & (IFF_ALLMULTI | IFF_PROMISC)) != 0) { lo = hi = 0xffffffff; goto done; @@ -2633,11 +2636,6 @@ athn_set_multi(struct athn_softc *sc) lo = hi = 0; ETHER_FIRST_MULTI(step, ac, enm); while (enm != NULL) { - if (memcmp(enm->enm_addrlo, enm->enm_addrhi, 6) != 0) { - ifp->if_flags |= IFF_ALLMULTI; - lo = hi = 0xffffffff; - goto done; - } addr = enm->enm_addrlo; /* Calculate the XOR value of all eight 6-bit words. */ val = addr[0] | addr[1] << 8 | addr[2] << 16; Index: dev/ic/atw.c =================================================================== RCS file: /home/ncvs/src/sys/dev/ic/atw.c,v retrieving revision 1.76 diff -u -p -r1.76 atw.c --- dev/ic/atw.c 5 Apr 2011 19:54:35 -0000 1.76 +++ dev/ic/atw.c 16 Oct 2013 13:27:25 -0000 @@ -2028,7 +2028,7 @@ void atw_filter_setup(struct atw_softc *sc) { struct ieee80211com *ic = &sc->sc_ic; - struct arpcom *ec = &ic->ic_ac; + struct arpcom *ac = &ic->ic_ac; struct ifnet *ifp = &sc->sc_ic.ic_if; int hash; u_int32_t hashes[2]; @@ -2056,15 +2056,14 @@ atw_filter_setup(struct atw_softc *sc) hashes[0] = hashes[1] = 0x0; + if (ac->ac_multirangecnt > 0) + goto allmulti; + /* * Program the 64-bit multicast hash filter. */ - ETHER_FIRST_MULTI(step, ec, enm); + ETHER_FIRST_MULTI(step, ac, enm); while (enm != NULL) { - if (memcmp(enm->enm_addrlo, enm->enm_addrhi, - ETHER_ADDR_LEN) != 0) - goto allmulti; - hash = atw_calchash(enm->enm_addrlo); hashes[hash >> 5] |= 1 << (hash & 0x1f); ETHER_NEXT_MULTI(step, enm); Index: dev/ic/dc.c =================================================================== RCS file: /home/ncvs/src/sys/dev/ic/dc.c,v retrieving revision 1.127 diff -u -p -r1.127 dc.c --- dev/ic/dc.c 21 Aug 2013 05:21:43 -0000 1.127 +++ dev/ic/dc.c 16 Oct 2013 13:27:25 -0000 @@ -918,7 +918,9 @@ dc_setfilt_21143(struct dc_softc *sc) else DC_CLRBIT(sc, DC_NETCFG, DC_NETCFG_RX_PROMISC); -allmulti: + if (ac->ac_multirangecnt > 0) + ifp->if_flags |= IFF_ALLMULTI; + if (ifp->if_flags & IFF_ALLMULTI) DC_SETBIT(sc, DC_NETCFG, DC_NETCFG_RX_ALLMULTI); else { @@ -926,12 +928,6 @@ allmulti: ETHER_FIRST_MULTI(step, ac, enm); while (enm != NULL) { - if (bcmp(enm->enm_addrlo, enm->enm_addrhi, - ETHER_ADDR_LEN)) { - ifp->if_flags |= IFF_ALLMULTI; - goto allmulti; - } - h = dc_crc_le(sc, enm->enm_addrlo); sp[h >> 4] |= htole32(1 << (h & 0xF)); ETHER_NEXT_MULTI(step, enm); @@ -996,7 +992,9 @@ dc_setfilt_admtek(struct dc_softc *sc) else DC_CLRBIT(sc, DC_NETCFG, DC_NETCFG_RX_PROMISC); -allmulti: + if (ac->ac_multirangecnt > 0) + ifp->if_flags |= IFF_ALLMULTI; + if (ifp->if_flags & IFF_ALLMULTI) DC_SETBIT(sc, DC_NETCFG, DC_NETCFG_RX_ALLMULTI); else @@ -1016,11 +1014,6 @@ allmulti: /* now program new ones */ ETHER_FIRST_MULTI(step, ac, enm); while (enm != NULL) { - if (bcmp(enm->enm_addrlo, enm->enm_addrhi, ETHER_ADDR_LEN)) { - ifp->if_flags |= IFF_ALLMULTI; - goto allmulti; - } - if (DC_IS_CENTAUR(sc)) h = dc_crc_le(sc, enm->enm_addrlo); else Index: dev/ic/dp8390.c =================================================================== RCS file: /home/ncvs/src/sys/dev/ic/dp8390.c,v retrieving revision 1.45 diff -u -p -r1.45 dp8390.c --- dev/ic/dp8390.c 7 Aug 2013 01:06:29 -0000 1.45 +++ dev/ic/dp8390.c 16 Oct 2013 13:27:25 -0000 @@ -923,7 +923,7 @@ dp8390_getmcaf(struct arpcom *ac, u_int8 * the word. */ - if (ifp->if_flags & IFF_PROMISC) { + if (ifp->if_flags & IFF_PROMISC || ac->ac_multirangecnt > 0) { ifp->if_flags |= IFF_ALLMULTI; for (i = 0; i < 8; i++) af[i] = 0xff; @@ -933,22 +933,6 @@ dp8390_getmcaf(struct arpcom *ac, u_int8 af[i] = 0; ETHER_FIRST_MULTI(step, ac, enm); while (enm != NULL) { - if (bcmp(enm->enm_addrlo, enm->enm_addrhi, - sizeof(enm->enm_addrlo)) != 0) { - /* - * We must listen to a range of multicast addresses. - * For now, just accept all multicasts, rather than - * trying to set only those filter bits needed to match - * the range. (At this time, the only use of address - * ranges is for IP multicast routing, for which the - * range is big enough to require all bits set.) - */ - ifp->if_flags |= IFF_ALLMULTI; - for (i = 0; i < 8; i++) - af[i] = 0xff; - return; - } - /* Just want the 6 most significant bits. */ crc = ether_crc32_be(enm->enm_addrlo, ETHER_ADDR_LEN) >> 26; Index: dev/ic/i82596.c =================================================================== RCS file: /home/ncvs/src/sys/dev/ic/i82596.c,v retrieving revision 1.34 diff -u -p -r1.34 i82596.c --- dev/ic/i82596.c 7 Aug 2013 01:06:29 -0000 1.34 +++ dev/ic/i82596.c 16 Oct 2013 13:27:25 -0000 @@ -1949,10 +1949,17 @@ void ie_mc_reset(sc) struct ie_softc *sc; { + struct arpcom *ac = &sc->sc_arpcom; struct ether_multi *enm; struct ether_multistep step; int size; + if (ac->ac_multicnt >= IE_MAXMCAST || ac->ac_multirangecnt > 0) { + ac->ac_if.if_flags |= IFF_ALLMULTI; + i82596_ioctl(&ac->.ac_if, SIOCSIFFLAGS, (void *)0); + return; + } + /* * Step through the list of addresses. */ @@ -1961,14 +1968,6 @@ ie_mc_reset(sc) ETHER_FIRST_MULTI(step, &sc->sc_arpcom, enm); while (enm) { size += ETHER_ADDR_LEN; - if (sc->mcast_count >= IE_MAXMCAST || - bcmp(enm->enm_addrlo, enm->enm_addrhi, - ETHER_ADDR_LEN) != 0) { - sc->sc_arpcom.ac_if.if_flags |= IFF_ALLMULTI; - i82596_ioctl(&sc->sc_arpcom.ac_if, - SIOCSIFFLAGS, (void *)0); - return; - } sc->mcast_count++; ETHER_NEXT_MULTI(step, enm); } Index: dev/ic/if_wi.c =================================================================== RCS file: /home/ncvs/src/sys/dev/ic/if_wi.c,v retrieving revision 1.153 diff -u -p -r1.153 if_wi.c --- dev/ic/if_wi.c 1 Oct 2013 19:33:49 -0000 1.153 +++ dev/ic/if_wi.c 16 Oct 2013 13:27:25 -0000 @@ -1394,6 +1394,7 @@ wi_alloc_nicmem_io(struct wi_softc *sc, STATIC void wi_setmulti(struct wi_softc *sc) { + struct arpcom *ac = &sc->sc_ic.ic_ac; struct ifnet *ifp; int i = 0; struct wi_ltv_mcast mcast; @@ -1407,7 +1408,9 @@ wi_setmulti(struct wi_softc *sc) mcast.wi_type = WI_RID_MCAST_LIST; mcast.wi_len = ((ETHER_ADDR_LEN / 2) * 16) + 1; -allmulti: + if (ac->ac_multirangecnt > 0) + ifp->if_flags |= IFF_ALLMULTI; + if (ifp->if_flags & IFF_ALLMULTI || ifp->if_flags & IFF_PROMISC) { wi_write_record(sc, (struct wi_ltv_gen *)&mcast); return; @@ -1420,10 +1423,6 @@ allmulti: break; } - if (bcmp(enm->enm_addrlo, enm->enm_addrhi, ETHER_ADDR_LEN)) { - ifp->if_flags |= IFF_ALLMULTI; - goto allmulti; - } bcopy(enm->enm_addrlo, &mcast.wi_mcast[i], ETHER_ADDR_LEN); i++; ETHER_NEXT_MULTI(step, enm); Index: dev/ic/lance.c =================================================================== RCS file: /home/ncvs/src/sys/dev/ic/lance.c,v retrieving revision 1.1 diff -u -p -r1.1 lance.c --- dev/ic/lance.c 24 Sep 2013 20:10:58 -0000 1.1 +++ dev/ic/lance.c 16 Oct 2013 13:27:25 -0000 @@ -603,24 +603,12 @@ lance_setladrf(struct arpcom *ac, uint16 * the word. */ - if (ifp->if_flags & IFF_PROMISC) + if (ifp->if_flags & IFF_PROMISC || ac->ac_multirangecnt > 0) goto allmulti; af[0] = af[1] = af[2] = af[3] = 0x0000; ETHER_FIRST_MULTI(step, ac, enm); while (enm != NULL) { - if (ETHER_CMP(enm->enm_addrlo, enm->enm_addrhi)) { - /* - * We must listen to a range of multicast addresses. - * For now, just accept all multicasts, rather than - * trying to set only those filter bits needed to match - * the range. (At this time, the only use of address - * ranges is for IP multicast routing, for which the - * range is big enough to require all bits set.) - */ - goto allmulti; - } - crc = ether_crc32_le(enm->enm_addrlo, ETHER_ADDR_LEN); /* Just want the 6 most significant bits. */ Index: dev/ic/lemac.c =================================================================== RCS file: /home/ncvs/src/sys/dev/ic/lemac.c,v retrieving revision 1.14 diff -u -p -r1.14 lemac.c --- dev/ic/lemac.c 7 Aug 2013 01:06:30 -0000 1.14 +++ dev/ic/lemac.c 16 Oct 2013 13:27:25 -0000 @@ -490,6 +490,7 @@ void lemac_multicast_filter(struct lemac_softc *sc) { #if 0 + struct arpcom *ac = &sc->sc_ec; struct ether_multistep step; struct ether_multi *enm; #endif @@ -499,13 +500,14 @@ lemac_multicast_filter(struct lemac_soft lemac_multicast_op(sc->sc_mctbl, etherbroadcastaddr, 1); #if 0 - ETHER_FIRST_MULTI(step, &sc->sc_ec, enm); + if (ac->ac_multirangecnt > 0) { + sc->sc_flags |= LEMAC_ALLMULTI; + sc->sc_if.if_flags |= IFF_ALLMULTI; + return; + } + + ETHER_FIRST_MULTI(step, ac, enm); while (enm != NULL) { - if (!LEMAC_ADDREQUAL(enm->enm_addrlo, enm->enm_addrhi)) { - sc->sc_flags |= LEMAC_ALLMULTI; - sc->sc_if.if_flags |= IFF_ALLMULTI; - return; - } lemac_multicast_op(sc->sc_mctbl, enm->enm_addrlo, TRUE); ETHER_NEXT_MULTI(step, enm); } Index: dev/ic/mtd8xx.c =================================================================== RCS file: /home/ncvs/src/sys/dev/ic/mtd8xx.c,v retrieving revision 1.20 diff -u -p -r1.20 mtd8xx.c --- dev/ic/mtd8xx.c 21 Aug 2013 05:21:43 -0000 1.20 +++ dev/ic/mtd8xx.c 16 Oct 2013 13:27:25 -0000 @@ -315,13 +315,16 @@ mtd_miibus_statchg(struct device *self) void mtd_setmulti(struct mtd_softc *sc) { + struct arpcom *ac = &sc->sc_arpcom; struct ifnet *ifp = &sc->sc_arpcom.ac_if; u_int32_t rxfilt, crc, hash[2] = { 0, 0 }; struct ether_multistep step; struct ether_multi *enm; int mcnt = 0; -allmulti: + if (ac->ac_multirangecnt > 0) + ifp->if_flags |= IFF_ALLMULTI; + rxfilt = CSR_READ_4(MTD_TCRRCR) & ~RCR_AM; if (ifp->if_flags & (IFF_ALLMULTI | IFF_PROMISC)) { rxfilt |= RCR_AM; @@ -336,12 +339,8 @@ allmulti: CSR_WRITE_4(MTD_MAR4, 0); /* Now program new ones. */ - ETHER_FIRST_MULTI(step, &sc->sc_arpcom, enm); + ETHER_FIRST_MULTI(step, ac, enm); while (enm != NULL) { - if (bcmp(enm->enm_addrlo, enm->enm_addrhi, ETHER_ADDR_LEN)) { - ifp->if_flags |= IFF_ALLMULTI; - goto allmulti; - } crc = ether_crc32_be(enm->enm_addrlo, ETHER_ADDR_LEN) >> 26; hash[crc >> 5] |= 1 << (crc & 0xf); ++mcnt; Index: dev/ic/rtw.c =================================================================== RCS file: /home/ncvs/src/sys/dev/ic/rtw.c,v retrieving revision 1.82 diff -u -p -r1.82 rtw.c --- dev/ic/rtw.c 5 Dec 2012 23:20:19 -0000 1.82 +++ dev/ic/rtw.c 16 Oct 2013 13:27:25 -0000 @@ -2278,7 +2278,7 @@ rtw_pktfilt_load(struct rtw_softc *sc) { struct rtw_regs *regs = &sc->sc_regs; struct ieee80211com *ic = &sc->sc_ic; - struct arpcom *ec = &ic->ic_ac; + struct arpcom *ac = &ic->ic_ac; struct ifnet *ifp = &sc->sc_ic.ic_if; int hash; u_int32_t hashes[2] = { 0, 0 }; @@ -2317,8 +2317,9 @@ rtw_pktfilt_load(struct rtw_softc *sc) if ((ifp->if_flags & IFF_BROADCAST) != 0) sc->sc_rcr |= RTW_RCR_AB; /* accept all broadcast */ - if (ifp->if_flags & IFF_PROMISC) { - sc->sc_rcr |= RTW_RCR_AB; /* accept all broadcast */ + if (ifp->if_flags & IFF_PROMISC || ac->ac_multirangecnt > 0) { + if (ifp->if_flags & IFF_PROMISC) + sc->sc_rcr |= RTW_RCR_AB; /* accept all broadcast */ allmulti: ifp->if_flags |= IFF_ALLMULTI; goto setit; @@ -2327,13 +2328,8 @@ allmulti: /* * Program the 64-bit multicast hash filter. */ - ETHER_FIRST_MULTI(step, ec, enm); + ETHER_FIRST_MULTI(step, ac, enm); while (enm != NULL) { - /* XXX */ - if (bcmp(enm->enm_addrlo, enm->enm_addrhi, - ETHER_ADDR_LEN) != 0) - goto allmulti; - hash = ether_crc32_be((enm->enm_addrlo), IEEE80211_ADDR_LEN) >> 26; hashes[hash >> 5] |= (1 << (hash & 0x1f)); Index: dev/ic/smc83c170.c =================================================================== RCS file: /home/ncvs/src/sys/dev/ic/smc83c170.c,v retrieving revision 1.15 diff -u -p -r1.15 smc83c170.c --- dev/ic/smc83c170.c 7 Aug 2013 01:06:31 -0000 1.15 +++ dev/ic/smc83c170.c 16 Oct 2013 13:27:25 -0000 @@ -1285,13 +1285,13 @@ epic_set_mchash(struct epic_softc *sc) goto allmulti; } + if (ac->ac_multirangecnt > 0) + goto allmulti; + mchash[0] = mchash[1] = mchash[2] = mchash[3] = 0; ETHER_FIRST_MULTI(step, ac, enm); while (enm != NULL) { - if (memcmp(enm->enm_addrlo, enm->enm_addrhi, ETHER_ADDR_LEN)) - goto allmulti; - hash = ether_crc32_be(enm->enm_addrlo, ETHER_ADDR_LEN); hash >>= 26; Index: dev/isa/if_ie.c =================================================================== RCS file: /home/ncvs/src/sys/dev/isa/if_ie.c,v retrieving revision 1.37 diff -u -p -r1.37 if_ie.c --- dev/isa/if_ie.c 7 Aug 2013 01:06:32 -0000 1.37 +++ dev/isa/if_ie.c 16 Oct 2013 13:27:25 -0000 @@ -2192,19 +2192,24 @@ static void mc_reset(sc) struct ie_softc *sc; { + struct arpcom *ac = &sc->sc_arpcom; struct ether_multi *enm; struct ether_multistep step; + if (ac->ac_multirangecnt > 0) { + ac->ac_if.if_flags |= IFF_ALLMULTI; + ieioctl(&ac->ac_if, SIOCSIFFLAGS, (void *)0); + goto setflag; + } /* * Step through the list of addresses. */ sc->mcast_count = 0; - ETHER_FIRST_MULTI(step, &sc->sc_arpcom, enm); + ETHER_FIRST_MULTI(step, ac, enm); while (enm) { - if (sc->mcast_count >= MAXMCAST || - bcmp(enm->enm_addrlo, enm->enm_addrhi, 6) != 0) { - sc->sc_arpcom.ac_if.if_flags |= IFF_ALLMULTI; - ieioctl(&sc->sc_arpcom.ac_if, SIOCSIFFLAGS, (void *)0); + if (sc->mcast_count >= MAXMCAST) { + ac->ac_if.if_flags |= IFF_ALLMULTI; + ieioctl(&ac->ac_if, SIOCSIFFLAGS, (void *)0); goto setflag; } Index: dev/pci/if_de.c =================================================================== RCS file: /home/ncvs/src/sys/dev/pci/if_de.c,v retrieving revision 1.111 diff -u -p -r1.111 if_de.c --- dev/pci/if_de.c 7 Aug 2013 01:06:34 -0000 1.111 +++ dev/pci/if_de.c 16 Oct 2013 13:27:25 -0000 @@ -2886,6 +2886,7 @@ tulip_free_txmap(tulip_softc_t *sc, bus_ void tulip_addr_filter(tulip_softc_t * const sc) { + struct arpcom *ac = &sc->tulip_ac; struct ether_multistep step; struct ether_multi *enm; @@ -2915,21 +2916,20 @@ tulip_addr_filter(tulip_softc_t * const * hash and one perfect hardware). */ bzero(sc->tulip_setupdata, sizeof(sc->tulip_setupdata)); - ETHER_FIRST_MULTI(step, &sc->tulip_ac, enm); - while (enm != NULL) { - if (bcmp(enm->enm_addrlo, enm->enm_addrhi, 6) == 0) { + if (ac->ac_multirangecnt > 0) { + sc->tulip_flags |= TULIP_ALLMULTI; + sc->tulip_flags &= ~(TULIP_WANTHASHONLY|TULIP_WANTHASHPERFECT); + } else { + ETHER_FIRST_MULTI(step, ac, enm); + while (enm != NULL) { hash = tulip_mchash(enm->enm_addrlo); #if BYTE_ORDER == BIG_ENDIAN sp[hash >> 4] |= swap32(1 << (hash & 0xF)); #else sp[hash >> 4] |= 1 << (hash & 0xF); #endif - } else { - sc->tulip_flags |= TULIP_ALLMULTI; - sc->tulip_flags &= ~(TULIP_WANTHASHONLY|TULIP_WANTHASHPERFECT); - break; - } ETHER_NEXT_MULTI(step, enm); + } } /* * No reason to use a hash if we are going to be @@ -2965,13 +2965,15 @@ tulip_addr_filter(tulip_softc_t * const if ((sc->tulip_flags & (TULIP_WANTHASHPERFECT|TULIP_WANTHASHONLY)) == 0) { u_int32_t *sp = sc->tulip_setupdata; int idx = 0; + if (ac->ac_multirangecnt > 0) + sc->tulip_flags |= TULIP_ALLMULTI; + if ((sc->tulip_flags & TULIP_ALLMULTI) == 0) { /* * Else can get perfect filtering for 16 addresses. */ - ETHER_FIRST_MULTI(step, &sc->tulip_ac, enm); + ETHER_FIRST_MULTI(step, ac, enm); for (; enm != NULL; idx++) { - if (bcmp(enm->enm_addrlo, enm->enm_addrhi, 6) == 0) { #if BYTE_ORDER == BIG_ENDIAN *sp++ = ((u_int16_t *) enm->enm_addrlo)[0] << 16; *sp++ = ((u_int16_t *) enm->enm_addrlo)[1] << 16; @@ -2981,10 +2983,6 @@ tulip_addr_filter(tulip_softc_t * const *sp++ = ((u_int16_t *) enm->enm_addrlo)[1]; *sp++ = ((u_int16_t *) enm->enm_addrlo)[2]; #endif - } else { - sc->tulip_flags |= TULIP_ALLMULTI; - break; - } ETHER_NEXT_MULTI(step, enm); } /* Index: dev/pci/if_ixgb.c =================================================================== RCS file: /home/ncvs/src/sys/dev/pci/if_ixgb.c,v retrieving revision 1.59 diff -u -p -r1.59 if_ixgb.c --- dev/pci/if_ixgb.c 5 Apr 2011 18:01:21 -0000 1.59 +++ dev/pci/if_ixgb.c 16 Oct 2013 13:27:25 -0000 @@ -753,12 +753,14 @@ ixgb_set_multi(struct ixgb_softc *sc) IOCTL_DEBUGOUT("ixgb_set_multi: begin"); + if (ac->ac_multirangecnt > 0) { + ifp->if_flags |= IFF_ALLMULTI; + mcnt = MAX_NUM_MULTICAST_ADDRESSES; + goto setit; + } + ETHER_FIRST_MULTI(step, ac, enm); while (enm != NULL) { - if (bcmp(enm->enm_addrlo, enm->enm_addrhi, ETHER_ADDR_LEN)) { - ifp->if_flags |= IFF_ALLMULTI; - mcnt = MAX_NUM_MULTICAST_ADDRESSES; - } if (mcnt == MAX_NUM_MULTICAST_ADDRESSES) break; bcopy(enm->enm_addrlo, &mta[mcnt*IXGB_ETH_LENGTH_OF_ADDRESS], @@ -767,6 +769,7 @@ ixgb_set_multi(struct ixgb_softc *sc) ETHER_NEXT_MULTI(step, enm); } +setit: if (mcnt >= MAX_NUM_MULTICAST_ADDRESSES) { reg_rctl = IXGB_READ_REG(&sc->hw, RCTL); reg_rctl |= IXGB_RCTL_MPE; Index: dev/pci/if_lge.c =================================================================== RCS file: /home/ncvs/src/sys/dev/pci/if_lge.c,v retrieving revision 1.60 diff -u -p -r1.60 if_lge.c --- dev/pci/if_lge.c 1 Oct 2013 20:06:01 -0000 1.60 +++ dev/pci/if_lge.c 16 Oct 2013 13:27:25 -0000 @@ -325,7 +325,9 @@ lge_setmulti(struct lge_softc *sc) /* Make sure multicast hash table is enabled. */ CSR_WRITE_4(sc, LGE_MODE1, LGE_MODE1_SETRST_CTL1|LGE_MODE1_RX_MCAST); -allmulti: + if (ac->ac_multirangecnt > 0) + ifp->if_flags |= IFF_ALLMULTI; + if (ifp->if_flags & IFF_ALLMULTI || ifp->if_flags & IFF_PROMISC) { CSR_WRITE_4(sc, LGE_MAR0, 0xFFFFFFFF); CSR_WRITE_4(sc, LGE_MAR1, 0xFFFFFFFF); @@ -339,10 +341,6 @@ allmulti: /* now program new ones */ ETHER_FIRST_MULTI(step, ac, enm); while (enm != NULL) { - if (bcmp(enm->enm_addrlo, enm->enm_addrhi, ETHER_ADDR_LEN)) { - ifp->if_flags |= IFF_ALLMULTI; - goto allmulti; - } h = (ether_crc32_be(enm->enm_addrlo, ETHER_ADDR_LEN) >> 26) & 0x0000003F; if (h < 32) Index: dev/pci/if_nge.c =================================================================== RCS file: /home/ncvs/src/sys/dev/pci/if_nge.c,v retrieving revision 1.76 diff -u -p -r1.76 if_nge.c --- dev/pci/if_nge.c 1 Oct 2013 20:06:01 -0000 1.76 +++ dev/pci/if_nge.c 16 Oct 2013 13:27:25 -0000 @@ -612,7 +612,9 @@ nge_setmulti(sc) u_int32_t h = 0, i, filtsave; int bit, index; -allmulti: + if (ac->ac_multirangecnt > 0) + ifp->if_flags |= IFF_ALLMULTI; + if (ifp->if_flags & IFF_ALLMULTI || ifp->if_flags & IFF_PROMISC) { NGE_CLRBIT(sc, NGE_RXFILT_CTL, NGE_RXFILTCTL_MCHASH|NGE_RXFILTCTL_UCHASH); @@ -646,10 +648,6 @@ allmulti: */ ETHER_FIRST_MULTI(step, ac, enm); while (enm != NULL) { - if (bcmp(enm->enm_addrlo, enm->enm_addrhi, ETHER_ADDR_LEN)) { - ifp->if_flags |= IFF_ALLMULTI; - goto allmulti; - } h = (ether_crc32_be(enm->enm_addrlo, ETHER_ADDR_LEN) >> 21) & 0x00000FFF; index = (h >> 4) & 0x7F; Index: dev/pci/if_pcn.c =================================================================== RCS file: /home/ncvs/src/sys/dev/pci/if_pcn.c,v retrieving revision 1.27 diff -u -p -r1.27 if_pcn.c --- dev/pci/if_pcn.c 7 Aug 2013 01:06:36 -0000 1.27 +++ dev/pci/if_pcn.c 16 Oct 2013 13:27:25 -0000 @@ -1843,7 +1843,8 @@ pcn_set_filter(struct pcn_softc *sc) * of the bits select the bit within the word. */ - if (ifp->if_flags & IFF_ALLMULTI || ifp->if_flags & IFF_PROMISC) + if (ifp->if_flags & IFF_ALLMULTI || ifp->if_flags & IFF_PROMISC || + ac->ac_multirangecnt > 0) goto allmulti; sc->sc_initblock.init_ladrf[0] = @@ -1853,18 +1854,6 @@ pcn_set_filter(struct pcn_softc *sc) ETHER_FIRST_MULTI(step, ac, enm); while (enm != NULL) { - if (memcmp(enm->enm_addrlo, enm->enm_addrhi, ETHER_ADDR_LEN)) { - /* - * We must listen to a range of multicast addresses. - * For now, just accept all multicasts, rather than - * trying to set only those filter bits needed to match - * the range. (At this time, the only use of address - * ranges is for IP multicast routing, for which the - * range is big enough to require all bits set.) - */ - goto allmulti; - } - crc = ether_crc32_le(enm->enm_addrlo, ETHER_ADDR_LEN); /* Just want the 6 most significant bits. */ Index: dev/pci/if_tl.c =================================================================== RCS file: /home/ncvs/src/sys/dev/pci/if_tl.c,v retrieving revision 1.55 diff -u -p -r1.55 if_tl.c --- dev/pci/if_tl.c 1 Oct 2013 20:06:01 -0000 1.55 +++ dev/pci/if_tl.c 16 Oct 2013 13:27:25 -0000 @@ -873,20 +873,6 @@ void tl_setmulti(sc) tl_dio_write32(sc, TL_HASH2, 0); ifp->if_flags &= ~IFF_ALLMULTI; -#if 0 - ETHER_FIRST_MULTI(step, ac, enm); - while (enm != NULL) { - if (memcmp(enm->enm_addrlo, enm->enm_addrhi, 6) == 0) { - h = tl_calchash(enm->enm_addrlo); - hashes[h/32] |= (1 << (h % 32)); - } else { - hashes[0] = hashes[1] = 0xffffffff; - ifp->if_flags |= IFF_ALLMULTI; - break; - } - ETHER_NEXT_MULTI(step, enm); - } -#else ETHER_FIRST_MULTI(step, ac, enm); h = 0; while (enm != NULL) { @@ -899,7 +885,6 @@ void tl_setmulti(sc) } else { hashes[0] = hashes[1] = 0x00000000; } -#endif tl_dio_write32(sc, TL_HASH1, hashes[0]); tl_dio_write32(sc, TL_HASH2, hashes[1]); Index: dev/pci/if_txp.c =================================================================== RCS file: /home/ncvs/src/sys/dev/pci/if_txp.c,v retrieving revision 1.107 diff -u -p -r1.107 if_txp.c --- dev/pci/if_txp.c 7 Aug 2013 01:06:38 -0000 1.107 +++ dev/pci/if_txp.c 16 Oct 2013 13:27:25 -0000 @@ -1858,7 +1858,9 @@ txp_set_filter(struct txp_softc *sc) goto setit; } -again: + if (ac->ac_multirangecnt > 0) + ifp->if_flags |= IFF_ALLMULTI; + filter = TXP_RXFILT_DIRECT; if (ifp->if_flags & IFF_BROADCAST) @@ -1871,21 +1873,6 @@ again: ETHER_FIRST_MULTI(step, ac, enm); while (enm != NULL) { - if (bcmp(enm->enm_addrlo, enm->enm_addrhi, ETHER_ADDR_LEN)) { - /* - * We must listen to a range of multicast - * addresses. For now, just accept all - * multicasts, rather than trying to set only - * those filter bits needed to match the range. - * (At this time, the only use of address - * ranges is for IP multicast routing, for - * which the range is big enough to require - * all bits set.) - */ - ifp->if_flags |= IFF_ALLMULTI; - goto again; - } - mcnt++; hashbit = (u_int16_t)(ether_crc32_be(enm->enm_addrlo, ETHER_ADDR_LEN) & (64 - 1)); Index: dev/pci/if_wb.c =================================================================== RCS file: /home/ncvs/src/sys/dev/pci/if_wb.c,v retrieving revision 1.54 diff -u -p -r1.54 if_wb.c --- dev/pci/if_wb.c 1 Oct 2013 20:06:02 -0000 1.54 +++ dev/pci/if_wb.c 16 Oct 2013 13:27:25 -0000 @@ -537,7 +537,9 @@ void wb_setmulti(sc) rxfilt = CSR_READ_4(sc, WB_NETCFG); -allmulti: + if (ac->ac_multirangecnt > 0) + ifp->if_flags |= IFF_ALLMULTI; + if (ifp->if_flags & IFF_ALLMULTI || ifp->if_flags & IFF_PROMISC) { rxfilt |= WB_NETCFG_RX_MULTI; CSR_WRITE_4(sc, WB_NETCFG, rxfilt); @@ -553,10 +555,6 @@ allmulti: /* now program new ones */ ETHER_FIRST_MULTI(step, ac, enm); while (enm != NULL) { - if (bcmp(enm->enm_addrlo, enm->enm_addrhi, ETHER_ADDR_LEN)) { - ifp->if_flags |= IFF_ALLMULTI; - goto allmulti; - } h = ~(ether_crc32_be(enm->enm_addrlo, ETHER_ADDR_LEN) >> 26); if (h < 32) hashes[0] |= (1 << h); Index: dev/pci/if_xge.c =================================================================== RCS file: /home/ncvs/src/sys/dev/pci/if_xge.c,v retrieving revision 1.55 diff -u -p -r1.55 if_xge.c --- dev/pci/if_xge.c 7 Aug 2013 01:06:39 -0000 1.55 +++ dev/pci/if_xge.c 16 Oct 2013 13:27:25 -0000 @@ -1016,12 +1016,11 @@ xge_setmulti(struct xge_softc *sc) int i, numaddr = 1; /* first slot used for card unicast address */ uint64_t val; + if (ac->ac_multirangecnt > 0) + goto allmulti; + ETHER_FIRST_MULTI(step, ac, enm); while (enm != NULL) { - if (memcmp(enm->enm_addrlo, enm->enm_addrhi, ETHER_ADDR_LEN)) { - /* Skip ranges */ - goto allmulti; - } if (numaddr == MAX_MCAST_ADDR) goto allmulti; for (val = 0, i = 0; i < ETHER_ADDR_LEN; i++) { Index: dev/pcmcia/if_xe.c =================================================================== RCS file: /home/ncvs/src/sys/dev/pcmcia/if_xe.c,v retrieving revision 1.42 diff -u -p -r1.42 if_xe.c --- dev/pcmcia/if_xe.c 7 Aug 2013 01:06:40 -0000 1.42 +++ dev/pcmcia/if_xe.c 16 Oct 2013 13:27:25 -0000 @@ -1273,8 +1273,11 @@ xe_set_address(sc) sc->sc_arpcom.ac_enaddr[(sc->sc_flags & XEF_MOHAWK) ? 5 - i : i]); } - - if (arp->ac_multicnt > 0) { + + if (arp->ac_multirangecnt > 0) { + ifp->if_flags |= IFF_ALLMULTI; + sc->sc_all_mcasts=1; + } else if (arp->ac_multicnt > 0) { if (arp->ac_multicnt > 9) { PAGE(sc, 0x42); bus_space_write_1(sc->sc_bst, sc->sc_bsh, @@ -1288,18 +1291,6 @@ xe_set_address(sc) pos = IA + 6; for (page = 0x50, num = arp->ac_multicnt; num > 0 && enm; num--) { - if (bcmp(enm->enm_addrlo, enm->enm_addrhi, - sizeof(enm->enm_addrlo)) != 0) { - /* - * The multicast address is really a range; - * it's easier just to accept all multicasts. - * XXX should we be setting IFF_ALLMULTI here? - */ - ifp->if_flags |= IFF_ALLMULTI; - sc->sc_all_mcasts=1; - break; - } - for (i = 0; i < 6; i++) { bus_space_write_1(bst, bsh, offset + pos, enm->enm_addrlo[ Index: dev/sbus/be.c =================================================================== RCS file: /home/ncvs/src/sys/dev/sbus/be.c,v retrieving revision 1.25 diff -u -p -r1.25 be.c --- dev/sbus/be.c 7 Aug 2013 01:06:40 -0000 1.25 +++ dev/sbus/be.c 16 Oct 2013 13:27:25 -0000 @@ -1116,6 +1116,9 @@ be_mcreset(struct be_softc *sc) return; } + if (ac->ac_multirangecnt > 0) + ifp->if_flags |= IFF_ALLMULTI; + if (ifp->if_flags & IFF_ALLMULTI) { hash[3] = hash[2] = hash[1] = hash[0] = 0xffff; goto chipit; @@ -1125,22 +1128,6 @@ be_mcreset(struct be_softc *sc) ETHER_FIRST_MULTI(step, ac, enm); while (enm != NULL) { - if (bcmp(enm->enm_addrlo, enm->enm_addrhi, ETHER_ADDR_LEN)) { - /* - * We must listen to a range of multicast - * addresses. For now, just accept all - * multicasts, rather than trying to set only - * those filter bits needed to match the range. - * (At this time, the only use of address - * ranges is for IP multicast routing, for - * which the range is big enough to require - * all bits set.) - */ - hash[3] = hash[2] = hash[1] = hash[0] = 0xffff; - ifp->if_flags |= IFF_ALLMULTI; - goto chipit; - } - crc = 0xffffffff; for (i = 0; i < ETHER_ADDR_LEN; i++) { Index: dev/sbus/qe.c =================================================================== RCS file: /home/ncvs/src/sys/dev/sbus/qe.c,v retrieving revision 1.24 diff -u -p -r1.24 qe.c --- dev/sbus/qe.c 7 Aug 2013 01:06:40 -0000 1.24 +++ dev/sbus/qe.c 16 Oct 2013 13:27:25 -0000 @@ -1098,6 +1098,9 @@ qe_mcreset(sc) return; } + if (ac->ac_multirangecnt > 0) + ifp->if_flags |= IFF_ALLMULTI; + if (ifp->if_flags & IFF_ALLMULTI) { bus_space_write_1(t, mr, QE_MRI_IAC, QE_MR_IAC_ADDRCHG | QE_MR_IAC_LOGADDR); @@ -1111,26 +1114,6 @@ qe_mcreset(sc) ETHER_FIRST_MULTI(step, ac, enm); while (enm != NULL) { - if (bcmp(enm->enm_addrlo, enm->enm_addrhi, - ETHER_ADDR_LEN) != 0) { - /* - * We must listen to a range of multicast - * addresses. For now, just accept all - * multicasts, rather than trying to set only - * those filter bits needed to match the range. - * (At this time, the only use of address - * ranges is for IP multicast routing, for - * which the range is big enough to require - * all bits set.) - */ - bus_space_write_1(t, mr, QE_MRI_IAC, - QE_MR_IAC_ADDRCHG | QE_MR_IAC_LOGADDR); - bus_space_set_multi_1(t, mr, QE_MRI_LADRF, 0xff, 8); - bus_space_write_1(t, mr, QE_MRI_IAC, 0); - ifp->if_flags |= IFF_ALLMULTI; - break; - } - crc = 0xffffffff; for (i = 0; i < ETHER_ADDR_LEN; i++) { Index: dev/usb/if_aue.c =================================================================== RCS file: /home/ncvs/src/sys/dev/usb/if_aue.c,v retrieving revision 1.88 diff -u -p -r1.88 if_aue.c --- dev/usb/if_aue.c 7 Aug 2013 01:06:41 -0000 1.88 +++ dev/usb/if_aue.c 16 Oct 2013 13:27:25 -0000 @@ -585,6 +585,7 @@ aue_crc(caddr_t addr) void aue_setmulti(struct aue_softc *sc) { + struct arpcom *ac = &sc->arpcom; struct ifnet *ifp; struct ether_multi *enm; struct ether_multistep step; @@ -594,8 +595,7 @@ aue_setmulti(struct aue_softc *sc) ifp = GET_IFP(sc); - if (ifp->if_flags & IFF_PROMISC) { -allmulti: + if (ifp->if_flags & IFF_PROMISC || ac->ac_multirangecnt > 0) { ifp->if_flags |= IFF_ALLMULTI; AUE_SETBIT(sc, AUE_CTL0, AUE_CTL0_ALLMULTI); return; @@ -608,12 +608,8 @@ allmulti: aue_csr_write_1(sc, AUE_MAR0 + i, 0); /* now program new ones */ - ETHER_FIRST_MULTI(step, &sc->arpcom, enm); + ETHER_FIRST_MULTI(step, ac, enm); while (enm != NULL) { - if (memcmp(enm->enm_addrlo, - enm->enm_addrhi, ETHER_ADDR_LEN) != 0) - goto allmulti; - h = aue_crc(enm->enm_addrlo); AUE_SETBIT(sc, AUE_MAR + (h >> 3), 1 << (h & 0x7)); ETHER_NEXT_MULTI(step, enm); Index: dev/usb/if_cue.c =================================================================== RCS file: /home/ncvs/src/sys/dev/usb/if_cue.c,v retrieving revision 1.62 diff -u -p -r1.62 if_cue.c --- dev/usb/if_cue.c 7 Aug 2013 01:06:41 -0000 1.62 +++ dev/usb/if_cue.c 16 Oct 2013 13:27:25 -0000 @@ -342,6 +342,7 @@ cue_getmac(struct cue_softc *sc, void *b void cue_setmulti(struct cue_softc *sc) { + struct arpcom *ac = &sc->arpcom; struct ifnet *ifp; struct ether_multi *enm; struct ether_multistep step; @@ -352,8 +353,7 @@ cue_setmulti(struct cue_softc *sc) DPRINTFN(2,("%s: cue_setmulti if_flags=0x%x\n", sc->cue_dev.dv_xname, ifp->if_flags)); - if (ifp->if_flags & IFF_PROMISC) { -allmulti: + if (ifp->if_flags & IFF_PROMISC || ac->ac_multirangecnt > 0) { ifp->if_flags |= IFF_ALLMULTI; for (i = 0; i < CUE_MCAST_TABLE_LEN; i++) sc->cue_mctab[i] = 0xFF; @@ -367,12 +367,8 @@ allmulti: sc->cue_mctab[i] = 0; /* now program new ones */ - ETHER_FIRST_MULTI(step, &sc->arpcom, enm); + ETHER_FIRST_MULTI(step, ac, enm); while (enm != NULL) { - if (memcmp(enm->enm_addrlo, - enm->enm_addrhi, ETHER_ADDR_LEN) != 0) - goto allmulti; - h = ether_crc32_le(enm->enm_addrlo, ETHER_ADDR_LEN) & ((1 << CUE_BITS) - 1); sc->cue_mctab[h >> 3] |= 1 << (h & 0x7); Index: dev/usb/if_kue.c =================================================================== RCS file: /home/ncvs/src/sys/dev/usb/if_kue.c,v retrieving revision 1.68 diff -u -p -r1.68 if_kue.c --- dev/usb/if_kue.c 7 Aug 2013 01:06:41 -0000 1.68 +++ dev/usb/if_kue.c 16 Oct 2013 13:27:25 -0000 @@ -333,6 +333,7 @@ kue_load_fw(struct kue_softc *sc) void kue_setmulti(struct kue_softc *sc) { + struct arpcom *ac = &sc->arpcom; struct ifnet *ifp = GET_IFP(sc); struct ether_multi *enm; struct ether_multistep step; @@ -340,7 +341,7 @@ kue_setmulti(struct kue_softc *sc) DPRINTFN(5,("%s: %s: enter\n", sc->kue_dev.dv_xname, __func__)); - if (ifp->if_flags & IFF_PROMISC) { + if (ifp->if_flags & IFF_PROMISC || ac->ac_multirangecnt > 0) { allmulti: ifp->if_flags |= IFF_ALLMULTI; sc->kue_rxfilt |= KUE_RXFILT_ALLMULTI; @@ -352,11 +353,9 @@ allmulti: sc->kue_rxfilt &= ~KUE_RXFILT_ALLMULTI; i = 0; - ETHER_FIRST_MULTI(step, &sc->arpcom, enm); + ETHER_FIRST_MULTI(step, ac, enm); while (enm != NULL) { - if (i == KUE_MCFILTCNT(sc) || - memcmp(enm->enm_addrlo, enm->enm_addrhi, - ETHER_ADDR_LEN) != 0) + if (i == KUE_MCFILTCNT(sc)) goto allmulti; memcpy(KUE_MCFILT(sc, i), enm->enm_addrlo, ETHER_ADDR_LEN); Index: dev/usb/if_otus.c =================================================================== RCS file: /home/ncvs/src/sys/dev/usb/if_otus.c,v retrieving revision 1.35 diff -u -p -r1.35 if_otus.c --- dev/usb/if_otus.c 7 Aug 2013 01:06:41 -0000 1.35 +++ dev/usb/if_otus.c 16 Oct 2013 13:27:25 -0000 @@ -1579,6 +1579,9 @@ otus_set_multi(struct otus_softc *sc) uint32_t lo, hi; uint8_t bit; + if (ac->ac_multirangecnt > 0) + ifp->if_flags |= IFF_ALLMULTI; + if ((ifp->if_flags & (IFF_ALLMULTI | IFF_PROMISC)) != 0) { lo = hi = 0xffffffff; goto done; @@ -1586,11 +1589,6 @@ otus_set_multi(struct otus_softc *sc) lo = hi = 0; ETHER_FIRST_MULTI(step, ac, enm); while (enm != NULL) { - if (bcmp(enm->enm_addrlo, enm->enm_addrhi, ETHER_ADDR_LEN)) { - ifp->if_flags |= IFF_ALLMULTI; - lo = hi = 0xffffffff; - goto done; - } bit = enm->enm_addrlo[5] >> 2; if (bit < 32) lo |= 1 << bit; Index: dev/usb/if_zyd.c =================================================================== RCS file: /home/ncvs/src/sys/dev/usb/if_zyd.c,v retrieving revision 1.91 diff -u -p -r1.91 if_zyd.c --- dev/usb/if_zyd.c 7 Aug 2013 01:06:43 -0000 1.91 +++ dev/usb/if_zyd.c 16 Oct 2013 13:27:25 -0000 @@ -1642,6 +1642,9 @@ zyd_set_multi(struct zyd_softc *sc) uint32_t lo, hi; uint8_t bit; + if (ac->ac_multirangecnt > 0) + ifp->if_flags |= IFF_ALLMULTI; + if ((ifp->if_flags & (IFF_ALLMULTI | IFF_PROMISC)) != 0) { lo = hi = 0xffffffff; goto done; @@ -1649,11 +1652,6 @@ zyd_set_multi(struct zyd_softc *sc) lo = hi = 0; ETHER_FIRST_MULTI(step, ac, enm); while (enm != NULL) { - if (bcmp(enm->enm_addrlo, enm->enm_addrhi, ETHER_ADDR_LEN)) { - ifp->if_flags |= IFF_ALLMULTI; - lo = hi = 0xffffffff; - goto done; - } bit = enm->enm_addrlo[5] >> 2; if (bit < 32) lo |= 1 << bit; Index: arch/macppc/dev/if_bm.c =================================================================== RCS file: /home/ncvs/src/sys/arch/macppc/dev/if_bm.c,v retrieving revision 1.27 diff -u -p -r1.27 if_bm.c --- arch/macppc/dev/if_bm.c 25 Aug 2009 20:39:36 -0000 1.27 +++ arch/macppc/dev/if_bm.c 16 Oct 2013 13:27:25 -0000 @@ -847,6 +847,7 @@ bmac_mediastatus(struct ifnet *ifp, stru void bmac_setladrf(struct bmac_softc *sc) { + struct arpcom *ac = &sc->arpcom; struct ifnet *ifp = &sc->arpcom.ac_if; struct ether_multi *enm; struct ether_multistep step; @@ -867,28 +868,17 @@ bmac_setladrf(struct bmac_softc *sc) return; } + if (ac->ac_multirangecnt > 0) + ifp->if_flags |= IFF_ALLMULTI; + if (ifp->if_flags & IFF_ALLMULTI) { hash[3] = hash[2] = hash[1] = hash[0] = 0xffff; goto chipit; } hash[3] = hash[2] = hash[1] = hash[0] = 0; - ETHER_FIRST_MULTI(step, &sc->arpcom, enm); + ETHER_FIRST_MULTI(step, ac, enm); while (enm != NULL) { - if (bcmp(enm->enm_addrlo, enm->enm_addrhi, ETHER_ADDR_LEN)) { - /* - * We must listen to a range of multicast addresses. - * For now, just accept all multicasts, rather than - * trying to set only those filter bits needed to match - * the range. (At this time, the only use of address - * ranges is for IP multicast routing, for which the - * range is big enough to require all bits set.) - */ - hash[3] = hash[2] = hash[1] = hash[0] = 0xffff; - ifp->if_flags |= IFF_ALLMULTI; - goto chipit; - } - crc = ether_crc32_le(enm->enm_addrlo, ETHER_ADDR_LEN); /* Just want the 6 most significant bits. */ Index: arch/macppc/dev/if_mc.c =================================================================== RCS file: /home/ncvs/src/sys/arch/macppc/dev/if_mc.c,v retrieving revision 1.15 diff -u -p -r1.15 if_mc.c --- arch/macppc/dev/if_mc.c 7 Aug 2013 22:22:42 -0000 1.15 +++ arch/macppc/dev/if_mc.c 16 Oct 2013 13:27:25 -0000 @@ -1121,21 +1121,12 @@ mace_calcladrf(struct mc_softc *sc, u_in * the word. */ + if (ac->ac_multirangecnt > 0) + goto allmulti; + *((u_int32_t *)af) = *((u_int32_t *)af + 1) = 0; ETHER_FIRST_MULTI(step, ac, enm); while (enm != NULL) { - if (bcmp(enm->enm_addrlo, enm->enm_addrhi, ETHER_ADDR_LEN)) { - /* - * We must listen to a range of multicast addresses. - * For now, just accept all multicasts, rather than - * trying to set only those filter bits needed to match - * the range. (At this time, the only use of address - * ranges is for IP multicast routing, for which the - * range is big enough to require all bits set.) - */ - goto allmulti; - } - crc = ether_crc32_le(enm->enm_addrlo, sizeof(enm->enm_addrlo)); /* Just want the 6 most significant bits. */ Index: arch/mvme68k/dev/if_ie.c =================================================================== RCS file: /home/ncvs/src/sys/arch/mvme68k/dev/if_ie.c,v retrieving revision 1.41 diff -u -p -r1.41 if_ie.c --- arch/mvme68k/dev/if_ie.c 5 Sep 2013 20:55:57 -0000 1.41 +++ arch/mvme68k/dev/if_ie.c 16 Oct 2013 13:27:25 -0000 @@ -1870,19 +1870,25 @@ void mc_reset(sc) struct ie_softc *sc; { + struct arpcom *ac = sc->sc_arpcom; struct ether_multi *enm; struct ether_multistep step; + if (ac->ac_multirangecnt > 0) { + ac->ac_if.if_flags |= IFF_ALLMULTI; + ieioctl(&ac->ac_if, SIOCSIFFLAGS, (void *)0); + goto setflag; + } + /* * Step through the list of addresses. */ sc->mcast_count = 0; - ETHER_FIRST_MULTI(step, &sc->sc_arpcom, enm); + ETHER_FIRST_MULTI(step, ac, enm); while (enm) { - if (sc->mcast_count >= MAXMCAST || - bcmp(enm->enm_addrlo, enm->enm_addrhi, 6) != 0) { - sc->sc_arpcom.ac_if.if_flags |= IFF_ALLMULTI; - ieioctl(&sc->sc_arpcom.ac_if, SIOCSIFFLAGS, (void *)0); + if (sc->mcast_count >= MAXMCAST) { + ac->ac_if.if_flags |= IFF_ALLMULTI; + ieioctl(&ac->ac_if, SIOCSIFFLAGS, (void *)0); goto setflag; } Index: arch/mvme88k/dev/if_ie.c =================================================================== RCS file: /home/ncvs/src/sys/arch/mvme88k/dev/if_ie.c,v retrieving revision 1.46 diff -u -p -r1.46 if_ie.c --- arch/mvme88k/dev/if_ie.c 5 Sep 2013 20:55:57 -0000 1.46 +++ arch/mvme88k/dev/if_ie.c 16 Oct 2013 13:27:26 -0000 @@ -1857,19 +1857,25 @@ void mc_reset(sc) struct ie_softc *sc; { + struct arpcom *ac = sc->sc_arpcom; struct ether_multi *enm; struct ether_multistep step; + if (ac->ac_multirangecnt > 0) { + ac->ac_if.if_flags |= IFF_ALLMULTI; + ieioctl(&ac->ac_if, SIOCSIFFLAGS, (void *)0); + goto setflag; + } + /* * Step through the list of addresses. */ sc->mcast_count = 0; - ETHER_FIRST_MULTI(step, &sc->sc_arpcom, enm); + ETHER_FIRST_MULTI(step, ac, enm); while (enm) { - if (sc->mcast_count >= MAXMCAST || - bcmp(enm->enm_addrlo, enm->enm_addrhi, 6) != 0) { - sc->sc_arpcom.ac_if.if_flags |= IFF_ALLMULTI; - ieioctl(&sc->sc_arpcom.ac_if, SIOCSIFFLAGS, (void *)0); + if (sc->mcast_count >= MAXMCAST) { + ac->ac_if.if_flags |= IFF_ALLMULTI; + ieioctl(&ac->ac_if, SIOCSIFFLAGS, (void *)0); goto setflag; } Index: arch/octeon/dev/cn30xxgmx.c =================================================================== RCS file: /home/ncvs/src/sys/arch/octeon/dev/cn30xxgmx.c,v retrieving revision 1.7 diff -u -p -r1.7 cn30xxgmx.c --- arch/octeon/dev/cn30xxgmx.c 19 Sep 2013 00:15:59 -0000 1.7 +++ arch/octeon/dev/cn30xxgmx.c 16 Oct 2013 13:27:26 -0000 @@ -1120,15 +1120,11 @@ cn30xxgmx_rgmii_set_filter(struct cn30xx while (enm != NULL) { int i; - dprintf("%d: lo(%02x:%02x:%02x:%02x:%02x:%02x) - " - "hi(%02x:%02x:%02x:%02x:%02x:%02x)\n", + dprintf("%d: %02x:%02x:%02x:%02x:%02x:%02x\n" multi + 1, enm->enm_addrlo[0], enm->enm_addrlo[1], enm->enm_addrlo[2], enm->enm_addrlo[3], - enm->enm_addrlo[4], enm->enm_addrlo[5], - enm->enm_addrhi[0], enm->enm_addrhi[1], - enm->enm_addrhi[2], enm->enm_addrhi[3], - enm->enm_addrhi[4], enm->enm_addrhi[5]); + enm->enm_addrlo[4], enm->enm_addrlo[5]); multi++; SET(cam_en, 1ULL << multi); /* XXX */ Index: arch/sparc/dev/be.c =================================================================== RCS file: /home/ncvs/src/sys/arch/sparc/dev/be.c,v retrieving revision 1.44 diff -u -p -r1.44 be.c --- arch/sparc/dev/be.c 5 Sep 2013 20:55:58 -0000 1.44 +++ arch/sparc/dev/be.c 16 Oct 2013 13:27:26 -0000 @@ -1158,6 +1158,9 @@ be_mcreset(sc) else br->rx_cfg &= ~BE_BR_RXCFG_PMISC; + if (ac->ac_multirangecnt > 0) + ifp->if_flags |= IFF_ALLMULTI; + if (ifp->if_flags & IFF_ALLMULTI) { br->htable3 = 0xffff; br->htable2 = 0xffff; @@ -1170,25 +1173,6 @@ be_mcreset(sc) ETHER_FIRST_MULTI(step, ac, enm); while (enm != NULL) { - if (bcmp(enm->enm_addrlo, enm->enm_addrhi, ETHER_ADDR_LEN)) { - /* - * We must listen to a range of multicast - * addresses. For now, just accept all - * multicasts, rather than trying to set only - * those filter bits needed to match the range. - * (At this time, the only use of address - * ranges is for IP multicast routing, for - * which the range is big enough to require - * all bits set.) - */ - br->htable3 = 0xffff; - br->htable2 = 0xffff; - br->htable1 = 0xffff; - br->htable0 = 0xffff; - ifp->if_flags |= IFF_ALLMULTI; - return; - } - crc = 0xffffffff; for (i = 0; i < ETHER_ADDR_LEN; i++) { Index: arch/sparc/dev/if_ie.c =================================================================== RCS file: /home/ncvs/src/sys/arch/sparc/dev/if_ie.c,v retrieving revision 1.43 diff -u -p -r1.43 if_ie.c --- arch/sparc/dev/if_ie.c 5 Sep 2013 20:55:58 -0000 1.43 +++ arch/sparc/dev/if_ie.c 16 Oct 2013 13:27:26 -0000 @@ -2017,19 +2017,25 @@ static void mc_reset(sc) struct ie_softc *sc; { + struct arpcom *ac = sc->sc_arpcom; struct ether_multi *enm; struct ether_multistep step; + if (ac->ac_multirangecnt > 0) { + ac->ac_if.if_flags |= IFF_ALLMULTI; + ieioctl(&ac->ac_if, SIOCSIFFLAGS, (void *)0); + goto setflag; + } + /* * Step through the list of addresses. */ sc->mcast_count = 0; - ETHER_FIRST_MULTI(step, &sc->sc_arpcom, enm); + ETHER_FIRST_MULTI(step, ac, enm); while (enm) { - if (sc->mcast_count >= MAXMCAST || - bcmp(enm->enm_addrlo, enm->enm_addrhi, 6) != 0) { - sc->sc_arpcom.ac_if.if_flags |= IFF_ALLMULTI; - ieioctl(&sc->sc_arpcom.ac_if, SIOCSIFFLAGS, (void *)0); + if (sc->mcast_count >= MAXMCAST) { + ac->ac_if.if_flags |= IFF_ALLMULTI; + ieioctl(&ac->ac_if, SIOCSIFFLAGS, (void *)0); goto setflag; } Index: arch/sparc/dev/qe.c =================================================================== RCS file: /home/ncvs/src/sys/arch/sparc/dev/qe.c,v retrieving revision 1.34 diff -u -p -r1.34 qe.c --- arch/sparc/dev/qe.c 5 Sep 2013 20:55:58 -0000 1.34 +++ arch/sparc/dev/qe.c 16 Oct 2013 13:27:26 -0000 @@ -805,7 +805,9 @@ qe_mcreset(sc) u_int8_t octet, *ladrp = (u_int8_t *)&hash[0]; int i, j; -allmulti: + if (ac->ac_multirangecnt > 0) + ifp->if_flags |= IFF_ALLMULTI; + if (ifp->if_flags & IFF_ALLMULTI) { mr->iac = QE_MR_IAC_ADDRCHG | QE_MR_IAC_LOGADDR; for (i = 100; i > 0; i--) { @@ -822,22 +824,6 @@ allmulti: ETHER_FIRST_MULTI(step, ac, enm); while (enm != NULL) { - if (bcmp(enm->enm_addrlo, enm->enm_addrhi, - ETHER_ADDR_LEN)) { - /* - * We must listen to a range of multicast - * addresses. For now, just accept all - * multicasts, rather than trying to set only - * those filter bits needed to match the range. - * (At this time, the only use of address - * ranges is for IP multicast routing, for - * which the range is big enough to require - * all bits set.) - */ - ifp->if_flags |= IFF_ALLMULTI; - goto allmulti; - } - crc = 0xffffffff; for (i = 0; i < ETHER_ADDR_LEN; i++) { Index: arch/vax/if/if_qe.c =================================================================== RCS file: /home/ncvs/src/sys/arch/vax/if/if_qe.c,v retrieving revision 1.25 diff -u -p -r1.25 if_qe.c --- arch/vax/if/if_qe.c 20 Sep 2010 06:33:47 -0000 1.25 +++ arch/vax/if/if_qe.c 16 Oct 2013 13:27:26 -0000 @@ -770,12 +770,14 @@ qe_setup(struct qe_softc *sc) */ j = 3; k = 0; ifp->if_flags &= ~IFF_ALLMULTI; + + if (ac->ac_multirangecnt > 0) { + ifp->if_flags |= IFF_ALLMULTI; + goto setit; + } + ETHER_FIRST_MULTI(step, &sc->sc_ac, enm); while (enm != NULL) { - if (memcmp(enm->enm_addrlo, enm->enm_addrhi, 6)) { - ifp->if_flags |= IFF_ALLMULTI; - break; - } for (i = 0; i < ETHER_ADDR_LEN; i++) qc->qc_setup[i * 8 + j + k] = enm->enm_addrlo[i]; j++; @@ -788,6 +790,8 @@ qe_setup(struct qe_softc *sc) } ETHER_NEXT_MULTI(step, enm); } + +setit: idx = sc->sc_nexttx; qc->qc_xmit[idx].qe_buf_len = -64; Index: arch/vax/if/sgec.c =================================================================== RCS file: /home/ncvs/src/sys/arch/vax/if/sgec.c,v retrieving revision 1.20 diff -u -p -r1.20 sgec.c --- arch/vax/if/sgec.c 26 Sep 2011 21:44:04 -0000 1.20 +++ arch/vax/if/sgec.c 16 Oct 2013 13:27:26 -0000 @@ -790,12 +790,14 @@ ze_setup(sc) */ j = 16; ifp->if_flags &= ~IFF_ALLMULTI; + + if (ac->ac_multirangecnt > 0) { + ifp->if_flags |= IFF_ALLMULTI; + goto setit; + } + ETHER_FIRST_MULTI(step, &sc->sc_ac, enm); while (enm != NULL) { - if (bcmp(enm->enm_addrlo, enm->enm_addrhi, 6)) { - ifp->if_flags |= IFF_ALLMULTI; - break; - } bcopy(enm->enm_addrlo, &zc->zc_setup[j], ETHER_ADDR_LEN); j += 8; ETHER_NEXT_MULTI(step, enm); @@ -805,6 +807,7 @@ ze_setup(sc) } } +setit: /* * Fiddle with the receive logic. */