Skip to contentSkip to conversation

ath9k patches

PATCH New Sujith Manoharan 1 participant 5 messages Aug 24, 2014 Qualcomm Atheros ATH9K wireless driver

lore
Share & tools
lore
#0 lore raw

cover ath9k patches

From: Sujith Manoharan <[email protected]>

More channel context fixes.

All pending patches: http://msujith.org/dir/patches/wl/Aug-24-2014/

Sujith

Sujith Manoharan (4):
ath9k: Add new chanctx events
ath9k: Print the event/state in ath_chanctx_event
ath9k: Fix interface limits
ath9k: Fix channel context creation

 drivers/net/wireless/ath/ath9k/ath9k.h   |  5 +++
 drivers/net/wireless/ath/ath9k/channel.c | 63 ++++++++++++++++++++++++++++++--
 drivers/net/wireless/ath/ath9k/init.c    |  6 ++-
 drivers/net/wireless/ath/ath9k/main.c    |  2 +
 4 files changed, 71 insertions(+), 5 deletions(-)
Signature · 1 line
2.0.4
#1 lore raw

PATCH 1/4 ath9k: Add new chanctx events

From: Sujith Manoharan <[email protected]>

This will be useful in handling addition/change of new channel contexts.

---
 drivers/net/wireless/ath/ath9k/ath9k.h   | 2 ++
 drivers/net/wireless/ath/ath9k/channel.c | 4 ++++
 2 files changed, 6 insertions(+)
drivers/net/wireless/ath/ath9k/ath9k.h +2 -0
index acbe2b7..7c8c6f1 100644
@@ -359,7 +359,9 @@ enum ath_chanctx_event {
 	ATH_CHANCTX_EVENT_BEACON_RECEIVED,
 	ATH_CHANCTX_EVENT_ASSOC,
 	ATH_CHANCTX_EVENT_SWITCH,
+	ATH_CHANCTX_EVENT_ASSIGN,
 	ATH_CHANCTX_EVENT_UNASSIGN,
+	ATH_CHANCTX_EVENT_CHANGE,
 	ATH_CHANCTX_EVENT_ENABLE_MULTICHANNEL,
 };
 
drivers/net/wireless/ath/ath9k/channel.c +4 -0
index 0e64b73..34ccfa0 100644
@@ -452,6 +452,10 @@ void ath_chanctx_event(struct ath_softc *sc, struct ieee80211_vif *vif,
 		sc->next_chan = ctx;
 		ieee80211_queue_work(sc->hw, &sc->chanctx_work);
 		break;
+	case ATH_CHANCTX_EVENT_ASSIGN:
+		break;
+	case ATH_CHANCTX_EVENT_CHANGE:
+		break;
 	}
 
 	spin_unlock_bh(&sc->chan_lock);
Signature · 1 line
2.0.4
#2 lore raw

PATCH 2/4 ath9k: Print the event/state in ath_chanctx_event

In reply to Sujith Manoharan

From: Sujith Manoharan <[email protected]>

---
 drivers/net/wireless/ath/ath9k/ath9k.h   |  3 +++
 drivers/net/wireless/ath/ath9k/channel.c | 37 ++++++++++++++++++++++++++++++--
 2 files changed, 38 insertions(+), 2 deletions(-)
drivers/net/wireless/ath/ath9k/ath9k.h +3 -0
index 7c8c6f1..c690601 100644
@@ -410,6 +410,9 @@ struct ath_offchannel {
 	int roc_duration;
 	int duration;
 };
+
+#define case_rtn_string(val) case val: return #val
+
 #define ath_for_each_chanctx(_sc, _ctx)                             \
 	for (ctx = &sc->chanctx[0];                                 \
 	     ctx <= &sc->chanctx[ARRAY_SIZE(sc->chanctx) - 1];      \
drivers/net/wireless/ath/ath9k/channel.c +35 -2
index 34ccfa0..9be92d8 100644
@@ -149,8 +149,6 @@ void ath_chanctx_set_channel(struct ath_softc *sc, struct ath_chanctx *ctx,
 
 static const char *offchannel_state_string(enum ath_offchannel_state state)
 {
-#define case_rtn_string(val) case val: return #val
-
 	switch (state) {
 		case_rtn_string(ATH_OFFCHANNEL_IDLE);
 		case_rtn_string(ATH_OFFCHANNEL_PROBE_SEND);
@@ -164,6 +162,37 @@ static const char *offchannel_state_string(enum ath_offchannel_state state)
 	}
 }
 
+static const char *chanctx_event_string(enum ath_chanctx_event ev)
+{
+	switch (ev) {
+		case_rtn_string(ATH_CHANCTX_EVENT_BEACON_PREPARE);
+		case_rtn_string(ATH_CHANCTX_EVENT_BEACON_SENT);
+		case_rtn_string(ATH_CHANCTX_EVENT_TSF_TIMER);
+		case_rtn_string(ATH_CHANCTX_EVENT_BEACON_RECEIVED);
+		case_rtn_string(ATH_CHANCTX_EVENT_ASSOC);
+		case_rtn_string(ATH_CHANCTX_EVENT_SWITCH);
+		case_rtn_string(ATH_CHANCTX_EVENT_ASSIGN);
+		case_rtn_string(ATH_CHANCTX_EVENT_UNASSIGN);
+		case_rtn_string(ATH_CHANCTX_EVENT_CHANGE);
+		case_rtn_string(ATH_CHANCTX_EVENT_ENABLE_MULTICHANNEL);
+	default:
+		return "unknown";
+	}
+}
+
+static const char *chanctx_state_string(enum ath_chanctx_state state)
+{
+	switch (state) {
+		case_rtn_string(ATH_CHANCTX_STATE_IDLE);
+		case_rtn_string(ATH_CHANCTX_STATE_WAIT_FOR_BEACON);
+		case_rtn_string(ATH_CHANCTX_STATE_WAIT_FOR_TIMER);
+		case_rtn_string(ATH_CHANCTX_STATE_SWITCH);
+		case_rtn_string(ATH_CHANCTX_STATE_FORCE_ACTIVE);
+	default:
+		return "unknown";
+	}
+}
+
 void ath_chanctx_check_active(struct ath_softc *sc, struct ath_chanctx *ctx)
 {
 	struct ath_common *common = ath9k_hw_common(sc->sc_ah);
@@ -275,6 +304,10 @@ void ath_chanctx_event(struct ath_softc *sc, struct ieee80211_vif *vif,
 	u32 beacon_int;
 	bool noa_changed = false;
 
+	ath_dbg(common, CHAN_CTX, "event: %s, state: %s\n",
+		chanctx_event_string(ev),
+		chanctx_state_string(sc->sched.state));
+
 	if (vif)
 		avp = (struct ath_vif *) vif->drv_priv;
 
Signature · 1 line
2.0.4
#3 lore raw

PATCH 3/4 ath9k: Fix interface limits

In reply to Sujith Manoharan

From: Sujith Manoharan <[email protected]>

There is no reason why managed/p2p interfaces have to be limited to one. IBSS is the only type that needs a restriction.

---
 drivers/net/wireless/ath/ath9k/init.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/net/wireless/ath/ath9k/init.c +4 -2
index 5887499..ca10a8b 100644
@@ -679,9 +679,11 @@ static const struct ieee80211_iface_limit wds_limits[] = {
 #ifdef CONFIG_ATH9K_CHANNEL_CONTEXT
 
 static const struct ieee80211_iface_limit if_limits_multi[] = {
-	{ .max = 1,	.types = BIT(NL80211_IFTYPE_STATION) },
-	{ .max = 1,	.types = BIT(NL80211_IFTYPE_P2P_CLIENT) |
+	{ .max = 2,	.types = BIT(NL80211_IFTYPE_STATION) |
+				 BIT(NL80211_IFTYPE_AP) |
+				 BIT(NL80211_IFTYPE_P2P_CLIENT) |
 				 BIT(NL80211_IFTYPE_P2P_GO) },
+	{ .max = 1,	.types = BIT(NL80211_IFTYPE_ADHOC) },
 };
 
 static const struct ieee80211_iface_combination if_comb_multi[] = {
Signature · 1 line
2.0.4
#4 lore raw

PATCH 4/4 ath9k: Fix channel context creation

In reply to Sujith Manoharan

From: Sujith Manoharan <[email protected]>

If a new context is being added in addition to the current one, then send the ASSIGN event to abort a running scan since the addition of a context is usually followed by VIF assignment and further operations.

---
 drivers/net/wireless/ath/ath9k/channel.c | 22 +++++++++++++++++++++-
 drivers/net/wireless/ath/ath9k/main.c    |  2 ++
 2 files changed, 23 insertions(+), 1 deletion(-)
drivers/net/wireless/ath/ath9k/channel.c +21 -1
index 9be92d8..b369c48 100644
@@ -127,6 +127,7 @@ void ath_chanctx_init(struct ath_softc *sc)
 void ath_chanctx_set_channel(struct ath_softc *sc, struct ath_chanctx *ctx,
 			     struct cfg80211_chan_def *chandef)
 {
+	struct ath_common *common = ath9k_hw_common(sc->sc_ah);
 	bool cur_chan;
 
 	spin_lock_bh(&sc->chan_lock);
@@ -135,8 +136,11 @@ void ath_chanctx_set_channel(struct ath_softc *sc, struct ath_chanctx *ctx,
 	cur_chan = sc->cur_chan == ctx;
 	spin_unlock_bh(&sc->chan_lock);
 
-	if (!cur_chan)
+	if (!cur_chan) {
+		ath_dbg(common, CHAN_CTX,
+			"Current context differs from the new context\n");
 		return;
+	}
 
 	ath_set_channel(sc);
 }
@@ -486,6 +490,22 @@ void ath_chanctx_event(struct ath_softc *sc, struct ieee80211_vif *vif,
 		ieee80211_queue_work(sc->hw, &sc->chanctx_work);
 		break;
 	case ATH_CHANCTX_EVENT_ASSIGN:
+		/*
+		 * When adding a new channel context, check if a scan
+		 * is in progress and abort it since the addition of
+		 * a new channel context is usually followed by VIF
+		 * assignment, in which case we have to start multi-channel
+		 * operation.
+		 */
+		if (test_bit(ATH_OP_SCANNING, &common->op_flags)) {
+			ath_dbg(common, CHAN_CTX,
+				"Aborting HW scan to add new context\n");
+
+			spin_unlock_bh(&sc->chan_lock);
+			del_timer_sync(&sc->offchannel.timer);
+			ath_scan_complete(sc, true);
+			spin_lock_bh(&sc->chan_lock);
+		}
 		break;
 	case ATH_CHANCTX_EVENT_CHANGE:
 		break;
drivers/net/wireless/ath/ath9k/main.c +2 -0
index da63487..2fcafa6 100644
@@ -2236,6 +2236,8 @@ static int ath9k_add_chanctx(struct ieee80211_hw *hw,
 			conf->def.chan->center_freq);
 
 		ath_chanctx_set_channel(sc, ctx, &conf->def);
+		ath_chanctx_event(sc, NULL, ATH_CHANCTX_EVENT_ASSIGN);
+
 		mutex_unlock(&sc->mutex);
 		return 0;
 	}
Signature · 1 line
2.0.4