diff mbox

[2/3] ath9k: make rxfilter per HW

Message ID 1434973385-15865-3-git-send-email-janusz.dziedzic@tieto.com (mailing list archive)
State Changes Requested
Delegated to: Kalle Valo
Headers show

Commit Message

Janusz.Dziedzic@tieto.com June 22, 2015, 11:43 a.m. UTC
mac80211 configure rxfilter per HW,
so we don't need this per channel.

This fix problem when chanctx used and ath9k
allocate new internal ath_chanctx (eg. when
offchannel) and we loose rxfilter configuration.

Eg. when p2p_find (with use_chanctx=1), during
remain on channel, driver create new ath_chanctx
with incorrect rxfilter. Then we didn't receive
probe requests and fail p2p_find.

Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
---
 drivers/net/wireless/ath/ath9k/ath9k.h |  3 ++-
 drivers/net/wireless/ath/ath9k/main.c  |  2 +-
 drivers/net/wireless/ath/ath9k/recv.c  | 12 ++++++------
 3 files changed, 9 insertions(+), 8 deletions(-)

Comments

Johannes Berg June 22, 2015, 11:58 a.m. UTC | #1
On Mon, 2015-06-22 at 13:43 +0200, Janusz Dziedzic wrote:
> mac80211 configure rxfilter per HW,
> so we don't need this per channel.

As I said before, I think there's value in mac80211 doing it per chanctx
or even per vif, and it should be more efficient to do so.

It's tempting to do it per vif and leave the chanctx work up to the
driver, but perhaps with CSA and all that it gets complicated enough
that doing it per chanctx in mac80211 would make sense?

johannes

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
Johannes Berg June 22, 2015, 11:59 a.m. UTC | #2
On Mon, 2015-06-22 at 13:58 +0200, Johannes Berg wrote:
> On Mon, 2015-06-22 at 13:43 +0200, Janusz Dziedzic wrote:
> > mac80211 configure rxfilter per HW,
> > so we don't need this per channel.
> 
> As I said before, I think there's value in mac80211 doing it per chanctx
> or even per vif, and it should be more efficient to do so.
> 
> It's tempting to do it per vif and leave the chanctx work up to the
> driver, but perhaps with CSA and all that it gets complicated enough
> that doing it per chanctx in mac80211 would make sense?

On the other hand, I think our device requires it per vif, so we'd
probably have to do both.

+Andrei, who was looking into this.

johannes

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
Felix Fietkau June 22, 2015, 5:58 p.m. UTC | #3
On 2015-06-22 13:59, Johannes Berg wrote:
> On Mon, 2015-06-22 at 13:58 +0200, Johannes Berg wrote:
>> On Mon, 2015-06-22 at 13:43 +0200, Janusz Dziedzic wrote:
>> > mac80211 configure rxfilter per HW,
>> > so we don't need this per channel.
>> 
>> As I said before, I think there's value in mac80211 doing it per chanctx
>> or even per vif, and it should be more efficient to do so.
>> 
>> It's tempting to do it per vif and leave the chanctx work up to the
>> driver, but perhaps with CSA and all that it gets complicated enough
>> that doing it per chanctx in mac80211 would make sense?
> 
> On the other hand, I think our device requires it per vif, so we'd
> probably have to do both.
> 
> +Andrei, who was looking into this.
There's value in it, but I think it makes more sense to fix this bug
now, and rework the code again later when mac80211 has support for
per-vif or per-chanctx rxfilter.

- Felix
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
Andrei Otcheretianski June 23, 2015, 6:40 a.m. UTC | #4
PiAtLS0tLU9yaWdpbmFsIE1lc3NhZ2UtLS0tLQ0KPiBGcm9tOiBKb2hhbm5lcyBCZXJnIFttYWls
dG86am9oYW5uZXNAc2lwc29sdXRpb25zLm5ldF0NCj4gU2VudDogTW9uZGF5LCBKdW5lIDIyLCAy
MDE1IDE1OjAwDQo+IFRvOiBKYW51c3ogRHppZWR6aWMNCj4gQ2M6IGxpbnV4LXdpcmVsZXNzQHZn
ZXIua2VybmVsLm9yZzsgYXRoOWstZGV2ZWxAdmVuZW1hLmg0Y2tyLm5ldDsNCj4gbmJkQG9wZW53
cnQub3JnOyBzdWppdGhAbXN1aml0aC5vcmc7IE90Y2hlcmV0aWFuc2tpLCBBbmRyZWkNCj4gU3Vi
amVjdDogUmU6IFtQQVRDSCAyLzNdIGF0aDlrOiBtYWtlIHJ4ZmlsdGVyIHBlciBIVw0KPiANCj4g
T24gTW9uLCAyMDE1LTA2LTIyIGF0IDEzOjU4ICswMjAwLCBKb2hhbm5lcyBCZXJn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ZXMgaXQgcGVyIHZpZiwgc28gd2Un
ZCBwcm9iYWJseQ0KPiBoYXZlIHRvIGRvIGJvdGguDQo+IA0KPiArQW5kcmVpLCB3aG8gd2FzIGxv
b2tpbmcgaW50byB0aGlzLg0KPiANCj4gam9oYW5uZXMNCg0K
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
diff mbox

Patch

diff --git a/drivers/net/wireless/ath/ath9k/ath9k.h b/drivers/net/wireless/ath/ath9k/ath9k.h
index a7a81b3..030fd0f 100644
--- a/drivers/net/wireless/ath/ath9k/ath9k.h
+++ b/drivers/net/wireless/ath/ath9k/ath9k.h
@@ -356,7 +356,6 @@  struct ath_chanctx {
 
 	short nvifs;
 	short nvifs_assigned;
-	unsigned int rxfilter;
 };
 
 enum ath_chanctx_event {
@@ -1001,8 +1000,10 @@  struct ath_softc {
 	struct cfg80211_chan_def cur_chandef;
 	struct ath_chanctx chanctx[ATH9K_NUM_CHANCTX];
 	struct ath_chanctx *cur_chan;
+	unsigned int rxfilter;
 	spinlock_t chan_lock;
 
+
 #ifdef CONFIG_MAC80211_LEDS
 	bool led_registered;
 	char led_name[32];
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c
index d285e3a..945f002 100644
--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
@@ -1463,7 +1463,7 @@  static void ath9k_configure_filter(struct ieee80211_hw *hw,
 	*total_flags &= SUPPORTED_FILTERS;
 
 	spin_lock_bh(&sc->chan_lock);
-	sc->cur_chan->rxfilter = *total_flags;
+	sc->rxfilter = *total_flags;
 	spin_unlock_bh(&sc->chan_lock);
 
 	ath9k_ps_wakeup(sc);
diff --git a/drivers/net/wireless/ath/ath9k/recv.c b/drivers/net/wireless/ath/ath9k/recv.c
index 6c75fb1..5f72c65 100644
--- a/drivers/net/wireless/ath/ath9k/recv.c
+++ b/drivers/net/wireless/ath/ath9k/recv.c
@@ -389,31 +389,31 @@  u32 ath_calcrxfilter(struct ath_softc *sc)
 
 	spin_lock_bh(&sc->chan_lock);
 
-	if (sc->cur_chan->rxfilter & FIF_PROBE_REQ)
+	if (sc->rxfilter & FIF_PROBE_REQ)
 		rfilt |= ATH9K_RX_FILTER_PROBEREQ;
 
 	if (sc->sc_ah->is_monitoring)
 		rfilt |= ATH9K_RX_FILTER_PROM;
 
-	if ((sc->cur_chan->rxfilter & FIF_CONTROL) ||
+	if ((sc->rxfilter & FIF_CONTROL) ||
 	    sc->sc_ah->dynack.enabled)
 		rfilt |= ATH9K_RX_FILTER_CONTROL;
 
 	if ((sc->sc_ah->opmode == NL80211_IFTYPE_STATION) &&
 	    (sc->cur_chan->nvifs <= 1) &&
-	    !(sc->cur_chan->rxfilter & FIF_BCN_PRBRESP_PROMISC))
+	    !(sc->rxfilter & FIF_BCN_PRBRESP_PROMISC))
 		rfilt |= ATH9K_RX_FILTER_MYBEACON;
 	else
 		rfilt |= ATH9K_RX_FILTER_BEACON;
 
 	if ((sc->sc_ah->opmode == NL80211_IFTYPE_AP) ||
-	    (sc->cur_chan->rxfilter & FIF_PSPOLL))
+	    (sc->rxfilter & FIF_PSPOLL))
 		rfilt |= ATH9K_RX_FILTER_PSPOLL;
 
 	if (sc->cur_chandef.width != NL80211_CHAN_WIDTH_20_NOHT)
 		rfilt |= ATH9K_RX_FILTER_COMP_BAR;
 
-	if (sc->cur_chan->nvifs > 1 || (sc->cur_chan->rxfilter & FIF_OTHER_BSS)) {
+	if (sc->cur_chan->nvifs > 1 || (sc->rxfilter & FIF_OTHER_BSS)) {
 		/* This is needed for older chips */
 		if (sc->sc_ah->hw_version.macVersion <= AR_SREV_VERSION_9160)
 			rfilt |= ATH9K_RX_FILTER_PROM;
@@ -878,7 +878,7 @@  static int ath9k_rx_skb_preprocess(struct ath_softc *sc,
 	 */
 	spin_lock_bh(&sc->chan_lock);
 	if (!ath9k_cmn_rx_accept(common, hdr, rx_status, rx_stats, decrypt_error,
-				 sc->cur_chan->rxfilter)) {
+				 sc->rxfilter)) {
 		spin_unlock_bh(&sc->chan_lock);
 		return -EINVAL;
 	}