diff options
-rw-r--r-- | sys/dev/ic/aic6915.c | 16 | ||||
-rw-r--r-- | sys/dev/ic/ath.c | 18 | ||||
-rw-r--r-- | sys/dev/ic/athn.c | 10 | ||||
-rw-r--r-- | sys/dev/ic/atw.c | 13 | ||||
-rw-r--r-- | sys/dev/ic/dp8390.c | 20 | ||||
-rw-r--r-- | sys/dev/ic/i82596.c | 17 | ||||
-rw-r--r-- | sys/dev/ic/if_wi.c | 11 | ||||
-rw-r--r-- | sys/dev/ic/lance.c | 16 | ||||
-rw-r--r-- | sys/dev/ic/lemac.c | 16 | ||||
-rw-r--r-- | sys/dev/ic/mtd8xx.c | 13 | ||||
-rw-r--r-- | sys/dev/ic/rtw.c | 16 | ||||
-rw-r--r-- | sys/dev/ic/smc83c170.c | 8 | ||||
-rw-r--r-- | sys/dev/isa/if_ie.c | 17 | ||||
-rw-r--r-- | sys/dev/pci/if_de.c | 28 | ||||
-rw-r--r-- | sys/dev/pci/if_ixgb.c | 13 | ||||
-rw-r--r-- | sys/dev/pci/if_lge.c | 10 | ||||
-rw-r--r-- | sys/dev/pci/if_nge.c | 10 | ||||
-rw-r--r-- | sys/dev/pci/if_pcn.c | 17 | ||||
-rw-r--r-- | sys/dev/pci/if_tl.c | 17 | ||||
-rw-r--r-- | sys/dev/pci/if_txp.c | 21 | ||||
-rw-r--r-- | sys/dev/pci/if_wb.c | 10 | ||||
-rw-r--r-- | sys/dev/pci/if_xge.c | 9 | ||||
-rw-r--r-- | sys/dev/pcmcia/if_xe.c | 21 | ||||
-rw-r--r-- | sys/dev/sbus/be.c | 21 | ||||
-rw-r--r-- | sys/dev/sbus/qe.c | 25 |
25 files changed, 136 insertions, 257 deletions
diff --git a/sys/dev/ic/aic6915.c b/sys/dev/ic/aic6915.c index 8a6d6e5c510..02a5fcf3b97 100644 --- a/sys/dev/ic/aic6915.c +++ b/sys/dev/ic/aic6915.c @@ -1,4 +1,4 @@ -/* $OpenBSD: aic6915.c,v 1.10 2013/08/07 01:06:27 bluhm Exp $ */ +/* $OpenBSD: aic6915.c,v 1.11 2013/11/26 09:50:32 mpi Exp $ */ /* $NetBSD: aic6915.c,v 1.15 2005/12/24 20:27:29 perry Exp $ */ /*- @@ -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); } diff --git a/sys/dev/ic/ath.c b/sys/dev/ic/ath.c index d8d90a3e2f3..83cd2339197 100644 --- a/sys/dev/ic/ath.c +++ b/sys/dev/ic/ath.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ath.c,v 1.97 2013/11/21 16:16:08 mpi Exp $ */ +/* $OpenBSD: ath.c,v 1.98 2013/11/26 09:50:32 mpi Exp $ */ /* $NetBSD: ath.c,v 1.37 2004/08/18 21:59:39 dyoung Exp $ */ /*- @@ -1147,18 +1147,20 @@ ath_mcastfilter_accum(caddr_t dl, u_int32_t (*mfilt)[2]) 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); } diff --git a/sys/dev/ic/athn.c b/sys/dev/ic/athn.c index ffa6cb65a09..5d5ab61c569 100644 --- a/sys/dev/ic/athn.c +++ b/sys/dev/ic/athn.c @@ -1,4 +1,4 @@ -/* $OpenBSD: athn.c,v 1.78 2013/11/15 01:45:44 krw Exp $ */ +/* $OpenBSD: athn.c,v 1.79 2013/11/26 09:50:32 mpi Exp $ */ /*- * Copyright (c) 2009 Damien Bergamini <damien.bergamini@free.fr> @@ -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; diff --git a/sys/dev/ic/atw.c b/sys/dev/ic/atw.c index 042bf6cf2e7..27e98c64f94 100644 --- a/sys/dev/ic/atw.c +++ b/sys/dev/ic/atw.c @@ -1,4 +1,4 @@ -/* $OpenBSD: atw.c,v 1.77 2013/11/14 12:30:39 dlg Exp $ */ +/* $OpenBSD: atw.c,v 1.78 2013/11/26 09:50:32 mpi Exp $ */ /* $NetBSD: atw.c,v 1.69 2004/07/23 07:07:55 dyoung Exp $ */ /*- @@ -2030,7 +2030,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]; @@ -2058,15 +2058,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); diff --git a/sys/dev/ic/dp8390.c b/sys/dev/ic/dp8390.c index 4868f9fcb62..b4ec9323467 100644 --- a/sys/dev/ic/dp8390.c +++ b/sys/dev/ic/dp8390.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dp8390.c,v 1.45 2013/08/07 01:06:29 bluhm Exp $ */ +/* $OpenBSD: dp8390.c,v 1.46 2013/11/26 09:50:33 mpi Exp $ */ /* $NetBSD: dp8390.c,v 1.13 1998/07/05 06:49:11 jonathan Exp $ */ /* @@ -923,7 +923,7 @@ dp8390_getmcaf(struct arpcom *ac, u_int8_t *af) * 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_t *af) 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; diff --git a/sys/dev/ic/i82596.c b/sys/dev/ic/i82596.c index 6c07c66800f..c20e9f2ab65 100644 --- a/sys/dev/ic/i82596.c +++ b/sys/dev/ic/i82596.c @@ -1,4 +1,4 @@ -/* $OpenBSD: i82596.c,v 1.34 2013/08/07 01:06:29 bluhm Exp $ */ +/* $OpenBSD: i82596.c,v 1.35 2013/11/26 09:50:33 mpi Exp $ */ /* $NetBSD: i82586.c,v 1.18 1998/08/15 04:42:42 mycroft Exp $ */ /*- @@ -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); } diff --git a/sys/dev/ic/if_wi.c b/sys/dev/ic/if_wi.c index ed2f248eef5..0c44fd50a47 100644 --- a/sys/dev/ic/if_wi.c +++ b/sys/dev/ic/if_wi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_wi.c,v 1.153 2013/10/01 19:33:49 kettenis Exp $ */ +/* $OpenBSD: if_wi.c,v 1.154 2013/11/26 09:50:33 mpi Exp $ */ /* * Copyright (c) 1997, 1998, 1999 @@ -1394,6 +1394,7 @@ wi_alloc_nicmem_io(struct wi_softc *sc, int len, int *id) 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); diff --git a/sys/dev/ic/lance.c b/sys/dev/ic/lance.c index 731cf8a5980..4d29cf1bd48 100644 --- a/sys/dev/ic/lance.c +++ b/sys/dev/ic/lance.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lance.c,v 1.1 2013/09/24 20:10:58 miod Exp $ */ +/* $OpenBSD: lance.c,v 1.2 2013/11/26 09:50:33 mpi Exp $ */ /* $NetBSD: lance.c,v 1.46 2012/02/02 19:43:03 tls Exp $ */ /*- @@ -603,24 +603,12 @@ lance_setladrf(struct arpcom *ac, uint16_t *af) * 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. */ diff --git a/sys/dev/ic/lemac.c b/sys/dev/ic/lemac.c index 76d5470547d..30908ff4604 100644 --- a/sys/dev/ic/lemac.c +++ b/sys/dev/ic/lemac.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lemac.c,v 1.14 2013/08/07 01:06:30 bluhm Exp $ */ +/* $OpenBSD: lemac.c,v 1.15 2013/11/26 09:50:33 mpi Exp $ */ /* $NetBSD: lemac.c,v 1.20 2001/06/13 10:46:02 wiz Exp $ */ /*- @@ -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_softc *sc) 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); } diff --git a/sys/dev/ic/mtd8xx.c b/sys/dev/ic/mtd8xx.c index add477fefc5..f05cd067053 100644 --- a/sys/dev/ic/mtd8xx.c +++ b/sys/dev/ic/mtd8xx.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mtd8xx.c,v 1.20 2013/08/21 05:21:43 dlg Exp $ */ +/* $OpenBSD: mtd8xx.c,v 1.21 2013/11/26 09:50:33 mpi Exp $ */ /* * Copyright (c) 2003 Oleg Safiullin <form@pdp11.org.ru> @@ -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; diff --git a/sys/dev/ic/rtw.c b/sys/dev/ic/rtw.c index f79999753b8..02622421ac3 100644 --- a/sys/dev/ic/rtw.c +++ b/sys/dev/ic/rtw.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rtw.c,v 1.82 2012/12/05 23:20:19 deraadt Exp $ */ +/* $OpenBSD: rtw.c,v 1.83 2013/11/26 09:50:33 mpi Exp $ */ /* $NetBSD: rtw.c,v 1.29 2004/12/27 19:49:16 dyoung Exp $ */ /*- @@ -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)); diff --git a/sys/dev/ic/smc83c170.c b/sys/dev/ic/smc83c170.c index 08eea91b7d8..befdee44846 100644 --- a/sys/dev/ic/smc83c170.c +++ b/sys/dev/ic/smc83c170.c @@ -1,4 +1,4 @@ -/* $OpenBSD: smc83c170.c,v 1.15 2013/08/07 01:06:31 bluhm Exp $ */ +/* $OpenBSD: smc83c170.c,v 1.16 2013/11/26 09:50:33 mpi Exp $ */ /* $NetBSD: smc83c170.c,v 1.59 2005/02/27 00:27:02 perry Exp $ */ /*- @@ -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; diff --git a/sys/dev/isa/if_ie.c b/sys/dev/isa/if_ie.c index 5eca03b635c..e33529b6f3b 100644 --- a/sys/dev/isa/if_ie.c +++ b/sys/dev/isa/if_ie.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ie.c,v 1.37 2013/08/07 01:06:32 bluhm Exp $ */ +/* $OpenBSD: if_ie.c,v 1.38 2013/11/26 09:50:33 mpi Exp $ */ /* $NetBSD: if_ie.c,v 1.51 1996/05/12 23:52:48 mycroft Exp $ */ /*- @@ -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; } diff --git a/sys/dev/pci/if_de.c b/sys/dev/pci/if_de.c index 7178281a15e..ecaa384bb2f 100644 --- a/sys/dev/pci/if_de.c +++ b/sys/dev/pci/if_de.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_de.c,v 1.111 2013/08/07 01:06:34 bluhm Exp $ */ +/* $OpenBSD: if_de.c,v 1.112 2013/11/26 09:50:33 mpi Exp $ */ /* $NetBSD: if_de.c,v 1.58 1998/01/12 09:39:58 thorpej Exp $ */ /*- @@ -2886,6 +2886,7 @@ tulip_free_txmap(tulip_softc_t *sc, bus_dmamap_t map) 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 sc) * 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 sc) 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 sc) *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); } /* diff --git a/sys/dev/pci/if_ixgb.c b/sys/dev/pci/if_ixgb.c index 827e9da78f3..9886d39bd40 100644 --- a/sys/dev/pci/if_ixgb.c +++ b/sys/dev/pci/if_ixgb.c @@ -31,7 +31,7 @@ POSSIBILITY OF SUCH DAMAGE. ***************************************************************************/ -/* $OpenBSD: if_ixgb.c,v 1.59 2011/04/05 18:01:21 henning Exp $ */ +/* $OpenBSD: if_ixgb.c,v 1.60 2013/11/26 09:50:33 mpi Exp $ */ #include <dev/pci/if_ixgb.h> @@ -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; diff --git a/sys/dev/pci/if_lge.c b/sys/dev/pci/if_lge.c index 19503c2edef..62c93269c68 100644 --- a/sys/dev/pci/if_lge.c +++ b/sys/dev/pci/if_lge.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_lge.c,v 1.60 2013/10/01 20:06:01 sf Exp $ */ +/* $OpenBSD: if_lge.c,v 1.61 2013/11/26 09:50:33 mpi Exp $ */ /* * Copyright (c) 2001 Wind River Systems * Copyright (c) 1997, 1998, 1999, 2000, 2001 @@ -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) diff --git a/sys/dev/pci/if_nge.c b/sys/dev/pci/if_nge.c index c56ebee42c5..d61109555e4 100644 --- a/sys/dev/pci/if_nge.c +++ b/sys/dev/pci/if_nge.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_nge.c,v 1.77 2013/11/18 19:43:00 brad Exp $ */ +/* $OpenBSD: if_nge.c,v 1.78 2013/11/26 09:50:33 mpi Exp $ */ /* * Copyright (c) 2001 Wind River Systems * Copyright (c) 1997, 1998, 1999, 2000, 2001 @@ -586,7 +586,9 @@ nge_setmulti(struct nge_softc *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); @@ -620,10 +622,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; diff --git a/sys/dev/pci/if_pcn.c b/sys/dev/pci/if_pcn.c index 69eca80d7cd..abaa8bdb68b 100644 --- a/sys/dev/pci/if_pcn.c +++ b/sys/dev/pci/if_pcn.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_pcn.c,v 1.27 2013/08/07 01:06:36 bluhm Exp $ */ +/* $OpenBSD: if_pcn.c,v 1.28 2013/11/26 09:50:33 mpi Exp $ */ /* $NetBSD: if_pcn.c,v 1.26 2005/05/07 09:15:44 is Exp $ */ /* @@ -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. */ diff --git a/sys/dev/pci/if_tl.c b/sys/dev/pci/if_tl.c index 1345446be8b..367112c0d88 100644 --- a/sys/dev/pci/if_tl.c +++ b/sys/dev/pci/if_tl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_tl.c,v 1.56 2013/11/18 19:43:00 brad Exp $ */ +/* $OpenBSD: if_tl.c,v 1.57 2013/11/26 09:50:33 mpi Exp $ */ /* * Copyright (c) 1997, 1998 @@ -815,20 +815,6 @@ tl_setmulti(struct tl_softc *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) { @@ -840,7 +826,6 @@ tl_setmulti(struct tl_softc *sc) ifp->if_flags |= IFF_ALLMULTI; } else hashes[0] = hashes[1] = 0x00000000; -#endif tl_dio_write32(sc, TL_HASH1, hashes[0]); tl_dio_write32(sc, TL_HASH2, hashes[1]); diff --git a/sys/dev/pci/if_txp.c b/sys/dev/pci/if_txp.c index 015619de47f..c9126fa65e9 100644 --- a/sys/dev/pci/if_txp.c +++ b/sys/dev/pci/if_txp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_txp.c,v 1.107 2013/08/07 01:06:38 bluhm Exp $ */ +/* $OpenBSD: if_txp.c,v 1.108 2013/11/26 09:50:33 mpi Exp $ */ /* * Copyright (c) 2001 @@ -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)); diff --git a/sys/dev/pci/if_wb.c b/sys/dev/pci/if_wb.c index 74ffbb3198f..70afc260646 100644 --- a/sys/dev/pci/if_wb.c +++ b/sys/dev/pci/if_wb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_wb.c,v 1.54 2013/10/01 20:06:02 sf Exp $ */ +/* $OpenBSD: if_wb.c,v 1.55 2013/11/26 09:50:33 mpi Exp $ */ /* * Copyright (c) 1997, 1998 @@ -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); diff --git a/sys/dev/pci/if_xge.c b/sys/dev/pci/if_xge.c index 55ba58cb87e..bd286e36740 100644 --- a/sys/dev/pci/if_xge.c +++ b/sys/dev/pci/if_xge.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_xge.c,v 1.55 2013/08/07 01:06:39 bluhm Exp $ */ +/* $OpenBSD: if_xge.c,v 1.56 2013/11/26 09:50:33 mpi Exp $ */ /* $NetBSD: if_xge.c,v 1.1 2005/09/09 10:30:27 ragge Exp $ */ /* @@ -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++) { diff --git a/sys/dev/pcmcia/if_xe.c b/sys/dev/pcmcia/if_xe.c index 6d62ac85f6a..2417b08fe16 100644 --- a/sys/dev/pcmcia/if_xe.c +++ b/sys/dev/pcmcia/if_xe.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_xe.c,v 1.42 2013/08/07 01:06:40 bluhm Exp $ */ +/* $OpenBSD: if_xe.c,v 1.43 2013/11/26 09:50:33 mpi Exp $ */ /* * Copyright (c) 1999 Niklas Hallqvist, Brandon Creighton, Job de Haas @@ -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[ diff --git a/sys/dev/sbus/be.c b/sys/dev/sbus/be.c index 9621b7513ae..c2fc2fa53a3 100644 --- a/sys/dev/sbus/be.c +++ b/sys/dev/sbus/be.c @@ -1,4 +1,4 @@ -/* $OpenBSD: be.c,v 1.25 2013/08/07 01:06:40 bluhm Exp $ */ +/* $OpenBSD: be.c,v 1.26 2013/11/26 09:50:33 mpi Exp $ */ /* $NetBSD: be.c,v 1.26 2001/03/20 15:39:20 pk Exp $ */ /*- @@ -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++) { diff --git a/sys/dev/sbus/qe.c b/sys/dev/sbus/qe.c index c988407038c..ec17c7f05f4 100644 --- a/sys/dev/sbus/qe.c +++ b/sys/dev/sbus/qe.c @@ -1,4 +1,4 @@ -/* $OpenBSD: qe.c,v 1.24 2013/08/07 01:06:40 bluhm Exp $ */ +/* $OpenBSD: qe.c,v 1.25 2013/11/26 09:50:33 mpi Exp $ */ /* $NetBSD: qe.c,v 1.16 2001/03/30 17:30:18 christos Exp $ */ /*- @@ -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++) { |