summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorJonathan Matthew <jmatthew@cvs.openbsd.org>2022-03-11 12:14:18 +0000
committerJonathan Matthew <jmatthew@cvs.openbsd.org>2022-03-11 12:14:18 +0000
commit07b7274091b2605c9cd7444719f815c4f33736a8 (patch)
treea2fb255bd7b8d7fe44094868b346fe3a82ff218b /sys/dev
parent0fe89780c429c8892d009e29df6882ae62fb5661 (diff)
Fix receive filter handling. Update the unicast mac address in the filter
when bringing the interface up, so it's possible to change it with ifconfig. Rearrange multicast handling so IFF_ALLMULTI is set correctly and multicast ranges don't trigger promisc mode. Perhaps most importantly, set RPF_MCAST_FILTER_EN to 0 when we don't want all multicast traffic - we use mac address filters to receive specific multicast groups, and the multicast filter is programmed to accept all multicast traffic. based on a diff from Brad ok dlg@
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/pci/if_aq_pci.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/sys/dev/pci/if_aq_pci.c b/sys/dev/pci/if_aq_pci.c
index 18e6d308ebd..246f25a89f2 100644
--- a/sys/dev/pci/if_aq_pci.c
+++ b/sys/dev/pci/if_aq_pci.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_aq_pci.c,v 1.6 2022/03/10 11:35:13 jmatthew Exp $ */
+/* $OpenBSD: if_aq_pci.c,v 1.7 2022/03/11 12:14:17 jmatthew Exp $ */
/* $NetBSD: if_aq.c,v 1.27 2021/06/16 00:21:18 riastradh Exp $ */
/*
@@ -2508,7 +2508,8 @@ aq_up(struct aq_softc *sc)
goto downqueues;
}
- /* filters? */
+ aq_set_mac_addr(sc, AQ_HW_MAC_OWN, sc->sc_arpcom.ac_enaddr);
+
/* enable checksum offload */
SET(ifp->if_flags, IFF_RUNNING);
@@ -2766,24 +2767,21 @@ aq_iff(struct aq_softc *sc)
struct ether_multistep step;
int idx;
- if (ifp->if_flags & IFF_PROMISC || ac->ac_multirangecnt > 0) {
+ if (ifp->if_flags & IFF_PROMISC) {
ifp->if_flags |= IFF_ALLMULTI;
AQ_WRITE_REG_BIT(sc, RPF_L2BC_REG, RPF_L2BC_PROMISC, 1);
- } else if (ac->ac_multicnt >= AQ_HW_MAC_NUM ||
- ISSET(ifp->if_flags, IFF_ALLMULTI)) {
+ } else if (ac->ac_multirangecnt > 0 ||
+ ac->ac_multicnt >= AQ_HW_MAC_NUM) {
+ ifp->if_flags |= IFF_ALLMULTI;
AQ_WRITE_REG_BIT(sc, RPF_L2BC_REG, RPF_L2BC_PROMISC, 0);
AQ_WRITE_REG_BIT(sc, RPF_MCAST_FILTER_MASK_REG,
RPF_MCAST_FILTER_MASK_ALLMULTI, 1);
AQ_WRITE_REG_BIT(sc, RPF_MCAST_FILTER_REG(0),
RPF_MCAST_FILTER_EN, 1);
- } else if (ac->ac_multicnt == 0) {
- AQ_WRITE_REG_BIT(sc, RPF_L2BC_REG, RPF_L2BC_PROMISC, 0);
- AQ_WRITE_REG_BIT(sc, RPF_MCAST_FILTER_REG(0),
- RPF_MCAST_FILTER_EN, 0);
} else {
+ ifp->if_flags &= ~IFF_ALLMULTI;
idx = AQ_HW_MAC_OWN + 1;
- /* turn on allmulti while we're rewriting? */
AQ_WRITE_REG_BIT(sc, RPF_L2BC_REG, RPF_L2BC_PROMISC, 0);
ETHER_FIRST_MULTI(step, ac, enm);
@@ -2798,7 +2796,7 @@ aq_iff(struct aq_softc *sc)
AQ_WRITE_REG_BIT(sc, RPF_MCAST_FILTER_MASK_REG,
RPF_MCAST_FILTER_MASK_ALLMULTI, 0);
AQ_WRITE_REG_BIT(sc, RPF_MCAST_FILTER_REG(0),
- RPF_MCAST_FILTER_EN, 1);
+ RPF_MCAST_FILTER_EN, 0);
}
}