summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Wright <jason@cvs.openbsd.org>1999-02-24 06:57:46 +0000
committerJason Wright <jason@cvs.openbsd.org>1999-02-24 06:57:46 +0000
commit836d34c789b656faa61c85d3920258113def7090 (patch)
treed6332c868dca28524aaee5adfe0c1fc7687728c6
parent067232e530d0ec6cd768e0eef4659769bf001163 (diff)
better promisc & allmulti handling
-rw-r--r--sys/arch/sparc/dev/qe.c107
-rw-r--r--sys/arch/sparc/dev/qevar.h3
2 files changed, 55 insertions, 55 deletions
diff --git a/sys/arch/sparc/dev/qe.c b/sys/arch/sparc/dev/qe.c
index f35e8e0b6dd..0fcd475b159 100644
--- a/sys/arch/sparc/dev/qe.c
+++ b/sys/arch/sparc/dev/qe.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: qe.c,v 1.6 1999/02/08 13:39:30 jason Exp $ */
+/* $OpenBSD: qe.c,v 1.7 1999/02/24 06:57:45 jason Exp $ */
/*
* Copyright (c) 1998 Jason L. Wright.
@@ -614,7 +614,6 @@ qeioctl(ifp, cmd, data)
break;
case SIOCSIFFLAGS:
- sc->sc_promisc = ifp->if_flags & (IFF_PROMISC | IFF_ALLMULTI);
if ((ifp->if_flags & IFF_UP) == 0 &&
(ifp->if_flags & IFF_RUNNING) != 0) {
/*
@@ -754,8 +753,7 @@ qeinit(sc)
i = mr->mpc; /* cleared on read */
- mr->maccc = QE_MR_MACCC_ENXMT | QE_MR_MACCC_ENRCV |
- ((ifp->if_flags & IFF_PROMISC) ? QE_MR_MACCC_PROM : 0);
+ qe_mcreset(sc);
ifp->if_flags |= IFF_RUNNING;
ifp->if_flags &= ~IFF_OACTIVE;
@@ -905,70 +903,73 @@ qe_mcreset(sc)
struct ether_multistep step;
u_int32_t crc;
u_int16_t hash[4];
- u_int8_t octet, maccc = 0, *ladrp = (u_int8_t *)&hash[0];
+ u_int8_t octet, *ladrp = (u_int8_t *)&hash[0];
int i, j;
+ if (ifp->if_flags & IFF_PROMISC) {
+ mr->maccc = QE_MR_MACCC_PROM | QE_MR_MACCC_ENXMT |
+ QE_MR_MACCC_ENRCV;
+ return;
+ }
+
if (ifp->if_flags & IFF_ALLMULTI) {
mr->iac = QE_MR_IAC_ADDRCHG | QE_MR_IAC_LOGADDR;
for (i = 0; i < 8; i++)
mr->ladrf = 0xff;
mr->iac = 0;
+ mr->maccc = QE_MR_MACCC_ENXMT | QE_MR_MACCC_ENRCV;
+ return;
}
- else if (ifp->if_flags & IFF_PROMISC) {
- maccc |= QE_MR_MACCC_PROM;
- }
- else {
-
- hash[3] = hash[2] = hash[1] = hash[0] = 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.)
- */
- mr->iac = QE_MR_IAC_ADDRCHG | QE_MR_IAC_LOGADDR;
- for (i = 0; i < 8; i++)
- mr->ladrf = 0xff;
- mr->iac = 0;
- ifp->if_flags |= IFF_ALLMULTI;
- break;
- }
- crc = 0xffffffff;
+ hash[3] = hash[2] = hash[1] = hash[0] = 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.)
+ */
+ mr->iac = QE_MR_IAC_ADDRCHG | QE_MR_IAC_LOGADDR;
+ for (i = 0; i < 8; i++)
+ mr->ladrf = 0xff;
+ mr->iac = 0;
+ ifp->if_flags |= IFF_ALLMULTI;
+ break;
+ }
- for (i = 0; i < ETHER_ADDR_LEN; i++) {
- octet = enm->enm_addrlo[i];
+ crc = 0xffffffff;
- for (j = 0; j < 8; j++) {
- if ((crc & 1) ^ (octet & 1)) {
- crc >>= 1;
- crc ^= MC_POLY_LE;
- }
- else
- crc >>= 1;
- octet >>= 1;
+ for (i = 0; i < ETHER_ADDR_LEN; i++) {
+ octet = enm->enm_addrlo[i];
+
+ for (j = 0; j < 8; j++) {
+ if ((crc & 1) ^ (octet & 1)) {
+ crc >>= 1;
+ crc ^= MC_POLY_LE;
}
+ else
+ crc >>= 1;
+ octet >>= 1;
}
-
- crc >>= 26;
- hash[crc >> 4] |= 1 << (crc & 0xf);
- ETHER_NEXT_MULTI(step, enm);
}
- mr->iac = QE_MR_IAC_ADDRCHG | QE_MR_IAC_LOGADDR;
- for (i = 0; i < 8; i++)
- mr->ladrf = ladrp[i];
- mr->iac = 0;
+ crc >>= 26;
+ hash[crc >> 4] |= 1 << (crc & 0xf);
+ ETHER_NEXT_MULTI(step, enm);
}
- mr->maccc = maccc | QE_MR_MACCC_ENXMT | QE_MR_MACCC_ENRCV;
+ mr->iac = QE_MR_IAC_ADDRCHG | QE_MR_IAC_LOGADDR;
+ for (i = 0; i < 8; i++)
+ mr->ladrf = ladrp[i];
+ mr->iac = 0;
+
+ mr->maccc = QE_MR_MACCC_ENXMT | QE_MR_MACCC_ENRCV;
}
diff --git a/sys/arch/sparc/dev/qevar.h b/sys/arch/sparc/dev/qevar.h
index a23dc9d695b..e5dd63681d3 100644
--- a/sys/arch/sparc/dev/qevar.h
+++ b/sys/arch/sparc/dev/qevar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: qevar.h,v 1.2 1998/11/02 05:50:59 jason Exp $ */
+/* $OpenBSD: qevar.h,v 1.3 1999/02/24 06:57:45 jason Exp $ */
/*
* Copyright (c) 1998 Jason L. Wright.
@@ -41,7 +41,6 @@ struct qesoftc {
int sc_channel;
u_int sc_rev;
- int sc_promisc;
int sc_burst;
struct qe_bufs *sc_bufs, *sc_bufs_dva;