summaryrefslogtreecommitdiffstats
path: root/sys/dev/ath
diff options
context:
space:
mode:
authorsam <sam@FreeBSD.org>2003-10-17 21:58:39 +0000
committersam <sam@FreeBSD.org>2003-10-17 21:58:39 +0000
commitc0c1db86a0e892dec2499bf67d2fc21128dad252 (patch)
tree8efecde29fb72980315ff57f76ca10c55e86486f /sys/dev/ath
parent23522eb8551b09f2a83a0b6ff48f556efc4a790b (diff)
downloadFreeBSD-src-c0c1db86a0e892dec2499bf67d2fc21128dad252.zip
FreeBSD-src-c0c1db86a0e892dec2499bf67d2fc21128dad252.tar.gz
o consolidate rx filter calculations in one place
o enable beacon reception when operating in adhoc mode so the 802.11 layer can use them to create nodes for peers
Diffstat (limited to 'sys/dev/ath')
-rw-r--r--sys/dev/ath/if_ath.c58
1 files changed, 39 insertions, 19 deletions
diff --git a/sys/dev/ath/if_ath.c b/sys/dev/ath/if_ath.c
index 7192d4a..4f37be2 100644
--- a/sys/dev/ath/if_ath.c
+++ b/sys/dev/ath/if_ath.c
@@ -919,20 +919,30 @@ ath_initkeytable(struct ath_softc *sc)
}
}
-static void
-ath_mode_init(struct ath_softc *sc)
+/*
+ * Calculate the receive filter according to the
+ * operating mode and state:
+ *
+ * o always accept unicast, broadcast, and multicast traffic
+ * o maintain current state of phy error reception
+ * o probe request frames are accepted only when operating in
+ * hostap, adhoc, or monitor modes
+ * o enable promiscuous mode according to the interface state
+ * o accept beacons:
+ * - when operating in adhoc mode so the 802.11 layer creates
+ * node table entries for peers,
+ * - when operating in station mode for collecting rssi data when
+ * the station is otherwise quiet, or
+ * - when scanning
+ */
+static u_int32_t
+ath_calcrxfilter(struct ath_softc *sc)
{
struct ieee80211com *ic = &sc->sc_ic;
struct ath_hal *ah = sc->sc_ah;
struct ifnet *ifp = &ic->ic_if;
- u_int32_t rfilt, mfilt[2], val;
- u_int8_t pos;
- struct ifmultiaddr *ifma;
-
- /* configure operational mode */
- ath_hal_setopmode(ah, ic->ic_opmode);
+ u_int32_t rfilt;
- /* receive filter */
rfilt = (ath_hal_getrxfilter(ah) & HAL_RX_FILTER_PHYERR)
| HAL_RX_FILTER_UCAST | HAL_RX_FILTER_BCAST | HAL_RX_FILTER_MCAST;
if (ic->ic_opmode != IEEE80211_M_STA)
@@ -941,10 +951,29 @@ ath_mode_init(struct ath_softc *sc)
(ifp->if_flags & IFF_PROMISC))
rfilt |= HAL_RX_FILTER_PROM;
if (ic->ic_opmode == IEEE80211_M_STA ||
+ ic->ic_opmode == IEEE80211_M_IBSS ||
ic->ic_state == IEEE80211_S_SCAN)
rfilt |= HAL_RX_FILTER_BEACON;
+ return rfilt;
+}
+
+static void
+ath_mode_init(struct ath_softc *sc)
+{
+ struct ieee80211com *ic = &sc->sc_ic;
+ struct ath_hal *ah = sc->sc_ah;
+ struct ifnet *ifp = &ic->ic_if;
+ u_int32_t rfilt, mfilt[2], val;
+ u_int8_t pos;
+ struct ifmultiaddr *ifma;
+
+ /* configure rx filter */
+ rfilt = ath_calcrxfilter(sc);
ath_hal_setrxfilter(ah, rfilt);
+ /* configure operational mode */
+ ath_hal_setopmode(ah, ic->ic_opmode);
+
/* calculate and install multicast filter */
if ((ifp->if_flags & IFF_ALLMULTI) == 0) {
mfilt[0] = mfilt[1] = 0;
@@ -2370,16 +2399,7 @@ ath_newstate(struct ieee80211com *ic, enum ieee80211_state nstate, int arg)
error = ath_chan_set(sc, ni->ni_chan);
if (error != 0)
goto bad;
- rfilt = (ath_hal_getrxfilter(ah) & HAL_RX_FILTER_PHYERR)
- | HAL_RX_FILTER_UCAST | HAL_RX_FILTER_BCAST | HAL_RX_FILTER_MCAST;
- if (ic->ic_opmode != IEEE80211_M_STA)
- rfilt |= HAL_RX_FILTER_PROBEREQ;
- if (ic->ic_opmode != IEEE80211_M_HOSTAP &&
- (ifp->if_flags & IFF_PROMISC))
- rfilt |= HAL_RX_FILTER_PROM;
- if (ic->ic_opmode == IEEE80211_M_STA ||
- ic->ic_state == IEEE80211_S_SCAN)
- rfilt |= HAL_RX_FILTER_BEACON;
+ rfilt = ath_calcrxfilter(sc);
if (nstate == IEEE80211_S_SCAN) {
callout_reset(&sc->sc_scan_ch, (hz * ath_dwelltime) / 1000,
ath_next_scan, sc);
OpenPOWER on IntegriCloud