diff options
author | Martin Pieuchot <mpi@cvs.openbsd.org> | 2013-11-05 10:20:06 +0000 |
---|---|---|
committer | Martin Pieuchot <mpi@cvs.openbsd.org> | 2013-11-05 10:20:06 +0000 |
commit | 6d52c4dcd1c626834713dcf719c066097aa9f734 (patch) | |
tree | 1dc3c33c379891e075c305e970e0b1d9ddca9acd | |
parent | 39c5fc7992b2198b383c3128140d2aa7a570cb4f (diff) |
Instead of comparing the lower and higher addresses of all the multicast
entries to decide if the IFF_ALLMULTI flag should be set, check if there
is at least one real range between them.
This should not introduce any behavior change but will help changing our
representation of multicast entries.
-rw-r--r-- | sys/dev/usb/if_aue.c | 12 | ||||
-rw-r--r-- | sys/dev/usb/if_cue.c | 12 | ||||
-rw-r--r-- | sys/dev/usb/if_kue.c | 11 | ||||
-rw-r--r-- | sys/dev/usb/if_otus.c | 10 | ||||
-rw-r--r-- | sys/dev/usb/if_zyd.c | 10 |
5 files changed, 21 insertions, 34 deletions
diff --git a/sys/dev/usb/if_aue.c b/sys/dev/usb/if_aue.c index 95aed7dab74..b2704672956 100644 --- a/sys/dev/usb/if_aue.c +++ b/sys/dev/usb/if_aue.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_aue.c,v 1.88 2013/08/07 01:06:41 bluhm Exp $ */ +/* $OpenBSD: if_aue.c,v 1.89 2013/11/05 10:20:04 mpi Exp $ */ /* $NetBSD: if_aue.c,v 1.82 2003/03/05 17:37:36 shiba Exp $ */ /* * Copyright (c) 1997, 1998, 1999, 2000 @@ -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); diff --git a/sys/dev/usb/if_cue.c b/sys/dev/usb/if_cue.c index 49dd15126aa..27ea1cc4a7f 100644 --- a/sys/dev/usb/if_cue.c +++ b/sys/dev/usb/if_cue.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_cue.c,v 1.62 2013/08/07 01:06:41 bluhm Exp $ */ +/* $OpenBSD: if_cue.c,v 1.63 2013/11/05 10:20:04 mpi Exp $ */ /* $NetBSD: if_cue.c,v 1.40 2002/07/11 21:14:26 augustss Exp $ */ /* * Copyright (c) 1997, 1998, 1999, 2000 @@ -342,6 +342,7 @@ cue_getmac(struct cue_softc *sc, void *buf) 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); diff --git a/sys/dev/usb/if_kue.c b/sys/dev/usb/if_kue.c index eab30475e6e..757da46f288 100644 --- a/sys/dev/usb/if_kue.c +++ b/sys/dev/usb/if_kue.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_kue.c,v 1.68 2013/08/07 01:06:41 bluhm Exp $ */ +/* $OpenBSD: if_kue.c,v 1.69 2013/11/05 10:20:04 mpi Exp $ */ /* $NetBSD: if_kue.c,v 1.50 2002/07/16 22:00:31 augustss Exp $ */ /* * Copyright (c) 1997, 1998, 1999, 2000 @@ -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); diff --git a/sys/dev/usb/if_otus.c b/sys/dev/usb/if_otus.c index 26dea3add5f..3950d0af1cb 100644 --- a/sys/dev/usb/if_otus.c +++ b/sys/dev/usb/if_otus.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_otus.c,v 1.35 2013/08/07 01:06:41 bluhm Exp $ */ +/* $OpenBSD: if_otus.c,v 1.36 2013/11/05 10:20:04 mpi Exp $ */ /*- * Copyright (c) 2009 Damien Bergamini <damien.bergamini@free.fr> @@ -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; diff --git a/sys/dev/usb/if_zyd.c b/sys/dev/usb/if_zyd.c index e5ac2d0603e..2c523867ef3 100644 --- a/sys/dev/usb/if_zyd.c +++ b/sys/dev/usb/if_zyd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_zyd.c,v 1.91 2013/08/07 01:06:43 bluhm Exp $ */ +/* $OpenBSD: if_zyd.c,v 1.92 2013/11/05 10:20:05 mpi Exp $ */ /*- * Copyright (c) 2006 by Damien Bergamini <damien.bergamini@free.fr> @@ -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; |