From: "Luis R. Rodriguez" <mcgrof@gmail.com>
To: John Linville <linville@tuxdriver.com>
Cc: linux-wireless@vger.kernel.org, Jiri Slaby <jirislaby@gmail.com>,
Nick Kossifidis <mickflemm@gmail.com>
Subject: [PATCH 4/6] ath5k: Add proper support for multicast
Date: Fri, 5 Oct 2007 21:19:49 -0400 [thread overview]
Message-ID: <20071006011949.GD25022@pogo> (raw)
In-Reply-To: <20071006011923.GC25022@pogo>
Add proper support for multicast and keep any HW imposed error filters.
There seems to be several ways to enable multicast. We choose right now
MadWifi's old implementation. We can later try ath5k_hw_set_mcast_filterindex()
as well.
ath5k_hw_get_rx_filter() may enable AR5K_RX_FILTER_RADARERR or
AR5K_RX_FILTER_PHYERR. We respect those calls in our configure_filter()
Changes to base.c
Changes-licensed-under: 3-clause-BSD
Signed-off-by: Luis R. Rodriguez <mcgrof@gmail.com>
---
drivers/net/wireless/ath5k/base.c | 64 ++++++++++++++++++++++++++++++------
1 files changed, 53 insertions(+), 11 deletions(-)
diff --git a/drivers/net/wireless/ath5k/base.c b/drivers/net/wireless/ath5k/base.c
index b11a14b..325965a 100644
--- a/drivers/net/wireless/ath5k/base.c
+++ b/drivers/net/wireless/ath5k/base.c
@@ -1397,8 +1397,15 @@ unlock:
FIF_BCN_PRBRESP_PROMISC
/*
* o always accept unicast, broadcast, and multicast traffic
- * o maintain current state of phy error reception (the hal
- * may enable phy error frames for noise immunity work)
+ * o multicast traffic for all BSSIDs will be enabled if mac80211
+ * says it should be
+ * o multicast traffic for all BSSIDs will be enabled if mac80211
+ * says it should be
+ * o maintain current state of radar error, phy ofdm or phy cck error reception.
+ * If the hardware detects any of these type of errors then
+ * ath5k_hw_get_rx_filter() will pass to us the respective
+ * hardware filters to be able to receive these type of frames.
+ * We do this to be safe, for noise immunity work.
* o probe request frames are accepted only when operating in
* hostap, adhoc, or monitor modes
* o enable promiscuous mode according to the interface state
@@ -1416,15 +1423,23 @@ static void ath_configure_filter(struct ieee80211_hw *hw,
{
struct ath_softc *sc = hw->priv;
struct ath_hw *ah = sc->ah;
- u32 rfilt;
+ u32 mfilt[2], val, rfilt;
+ u8 pos;
+ int i;
+
+ mfilt[0] = mfilt[1] = 0;
/* Only deal with supported flags */
changed_flags &= SUPPORTED_FIF_FLAGS;
*new_flags &= SUPPORTED_FIF_FLAGS;
- /* XXX: Start by enabling broadcasts and Unicast, move this later
- * to mac802111 and add a flag for these */
- rfilt = AR5K_RX_FILTER_UCAST | AR5K_RX_FILTER_BCAST;
+ /* If HW detects any phy or radar errors, leave those filters on.
+ * Also, always enable Unicast, Broadcasts and Multicast
+ * XXX: move unicast, bssid broadcasts and multicast to mac80211 */
+ rfilt = (ath5k_hw_get_rx_filter(ah) &
+ (AR5K_RX_FILTER_RADARERR | AR5K_RX_FILTER_PHYERR)) |
+ ( AR5K_RX_FILTER_UCAST | AR5K_RX_FILTER_BCAST |
+ AR5K_RX_FILTER_MCAST);
if (changed_flags & (FIF_PROMISC_IN_BSS | FIF_OTHER_BSS)) {
if (*new_flags & FIF_PROMISC_IN_BSS) {
@@ -1435,18 +1450,43 @@ static void ath_configure_filter(struct ieee80211_hw *hw,
__clear_bit(ATH_STAT_PROMISC, sc->status);
}
- if (*new_flags & FIF_ALLMULTI)
- rfilt |= AR5K_RX_FILTER_MCAST;
+ /* Note, AR5K_RX_FILTER_MCAST is already enabled */
+ if (*new_flags & FIF_ALLMULTI) {
+ mfilt[0] = mfilt[1] = ~0;
+ } else {
+ for (i = 0; i < mc_count; i++) {
+ if (!mclist)
+ break;
+ /* calculate XOR of eight 6-bit values */
+ val = LE_READ_4(mclist->dmi_addr + 0);
+ pos = (val >> 18) ^ (val >> 12) ^ (val >> 6) ^ val;
+ val = LE_READ_4(mclist->dmi_addr + 3);
+ pos ^= (val >> 18) ^ (val >> 12) ^ (val >> 6) ^ val;
+ pos &= 0x3f;
+ mfilt[pos / 32] |= (1 << (pos % 32));
+ /* XXX: we might be able to just do this instead,
+ * but not sure, needs testing, if we do use this we'd
+ * neet to inform below to not reset the mcast */
+ //ath5k_hw_set_mcast_filterindex(ah,
+ // mclist->dmi_addr[5]);
+ mclist = mclist->next;
+ }
+ }
+
+
/* This is the best we can do */
if (*new_flags & (FIF_FCSFAIL | FIF_PLCPFAIL))
rfilt |= AR5K_RX_FILTER_PHYERR;
+
/* FIF_BCN_PRBRESP_PROMISC really means to enable beacons
* and probes for any BSSID, this needs testing */
if (*new_flags & FIF_BCN_PRBRESP_PROMISC)
rfilt |= AR5K_RX_FILTER_BEACON | AR5K_RX_FILTER_PROBEREQ;
- /* FIF_CONTROL doc says that FIF_PROMISC_IN_BSS is not set we should
- * only pass on control frames for this station. This needs testing.
- * I believe right now this enables *all* control frames */
+
+ /* FIF_CONTROL doc says that if FIF_PROMISC_IN_BSS is not
+ * set we should only pass on control frames for this
+ * station. This needs testing. I believe right now this
+ * enables *all* control frames */
if (*new_flags & FIF_CONTROL)
rfilt |= AR5K_RX_FILTER_CONTROL;
@@ -1467,6 +1507,8 @@ static void ath_configure_filter(struct ieee80211_hw *hw,
rfilt |= AR5K_RX_FILTER_BEACON;
}
+ /* Set multicast bits */
+ ath5k_hw_set_mcast_filter(ah, mfilt[0], mfilt[1]);
/* Set the cached hw filter flags, this will alter actually
* be set in HW */
sc->filter_flags = rfilt;
--
1.5.2.5
next prev parent reply other threads:[~2007-10-06 1:28 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-10-06 1:04 [PATCH 0/6] ath5k: initvals, radar, promiscuous bug and multicast Luis R. Rodriguez
2007-10-06 1:16 ` [PATCH 1/6] ath5k: Ported new initval changes from OpenBSD to ath5k Luis R. Rodriguez
2007-10-06 1:18 ` [PATCH 2/6] ath5k: Enable radar detection Luis R. Rodriguez
2007-10-06 1:19 ` [PATCH 3/6] ath5k: Fix a bug which pushed us to enable the promiscuous filter Luis R. Rodriguez
2007-10-06 1:19 ` Luis R. Rodriguez [this message]
2007-10-06 1:20 ` [PATCH 5/6] ath5k: Add documenation for atheros bssid_mask Luis R. Rodriguez
2007-10-06 1:20 ` [PATCH 6/6] ath5k: Do not let the driver through for not yet supported radios Luis R. Rodriguez
2007-10-07 10:13 ` Nick Kossifidis
2007-10-08 20:48 ` Luis R. Rodriguez
2007-10-09 2:37 ` Nick Kossifidis
2007-10-09 7:02 ` Holger Schurig
2007-10-09 8:17 ` Nick Kossifidis
2007-10-09 20:05 ` [PATCH 5/6] ath5k: Add documenation for atheros bssid_mask Johannes Berg
2007-10-09 20:01 ` [PATCH 4/6] ath5k: Add proper support for multicast Johannes Berg
2007-10-10 18:11 ` Luis R. Rodriguez
2007-10-07 9:56 ` [PATCH 2/6] ath5k: Enable radar detection Nick Kossifidis
2007-10-07 10:28 ` Nick Kossifidis
2007-10-08 20:34 ` Luis R. Rodriguez
2007-10-08 21:18 ` Michael Taylor
2007-10-09 7:05 ` Holger Schurig
2007-10-09 9:34 ` Johannes Berg
2007-10-09 15:59 ` Luis R. Rodriguez
2007-10-07 9:49 ` [PATCH 1/6] ath5k: Ported new initval changes from OpenBSD to ath5k Nick Kossifidis
2007-10-08 20:38 ` Luis R. Rodriguez
2007-10-09 2:31 ` Nick Kossifidis
2007-10-09 7:17 ` Jiri Slaby
2007-10-09 8:15 ` Nick Kossifidis
2007-10-06 1:23 ` [PATCH 0/6] ath5k: initvals, radar, promiscuous bug and multicast Luis R. Rodriguez
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20071006011949.GD25022@pogo \
--to=mcgrof@gmail.com \
--cc=jirislaby@gmail.com \
--cc=linux-wireless@vger.kernel.org \
--cc=linville@tuxdriver.com \
--cc=mickflemm@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).