linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/4] ath9k patches
@ 2014-08-24 15:46 Sujith Manoharan
  2014-08-24 15:46 ` [PATCH 1/4] ath9k: Add new chanctx events Sujith Manoharan
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Sujith Manoharan @ 2014-08-24 15:46 UTC (permalink / raw)
  To: John Linville; +Cc: linux-wireless, ath9k-devel

From: Sujith Manoharan <c_manoha@qca.qualcomm.com>

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(-)

-- 
2.0.4


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/4] ath9k: Add new chanctx events
  2014-08-24 15:46 [PATCH 0/4] ath9k patches Sujith Manoharan
@ 2014-08-24 15:46 ` Sujith Manoharan
  2014-08-24 15:46 ` [PATCH 2/4] ath9k: Print the event/state in ath_chanctx_event Sujith Manoharan
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Sujith Manoharan @ 2014-08-24 15:46 UTC (permalink / raw)
  To: John Linville; +Cc: linux-wireless, ath9k-devel

From: Sujith Manoharan <c_manoha@qca.qualcomm.com>

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

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
---
 drivers/net/wireless/ath/ath9k/ath9k.h   | 2 ++
 drivers/net/wireless/ath/ath9k/channel.c | 4 ++++
 2 files changed, 6 insertions(+)

diff --git a/drivers/net/wireless/ath/ath9k/ath9k.h b/drivers/net/wireless/ath/ath9k/ath9k.h
index acbe2b7..7c8c6f1 100644
--- a/drivers/net/wireless/ath/ath9k/ath9k.h
+++ b/drivers/net/wireless/ath/ath9k/ath9k.h
@@ -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,
 };
 
diff --git a/drivers/net/wireless/ath/ath9k/channel.c b/drivers/net/wireless/ath/ath9k/channel.c
index 0e64b73..34ccfa0 100644
--- a/drivers/net/wireless/ath/ath9k/channel.c
+++ b/drivers/net/wireless/ath/ath9k/channel.c
@@ -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);
-- 
2.0.4


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/4] ath9k: Print the event/state in ath_chanctx_event
  2014-08-24 15:46 [PATCH 0/4] ath9k patches Sujith Manoharan
  2014-08-24 15:46 ` [PATCH 1/4] ath9k: Add new chanctx events Sujith Manoharan
@ 2014-08-24 15:46 ` Sujith Manoharan
  2014-08-24 15:46 ` [PATCH 3/4] ath9k: Fix interface limits Sujith Manoharan
  2014-08-24 15:46 ` [PATCH 4/4] ath9k: Fix channel context creation Sujith Manoharan
  3 siblings, 0 replies; 5+ messages in thread
From: Sujith Manoharan @ 2014-08-24 15:46 UTC (permalink / raw)
  To: John Linville; +Cc: linux-wireless, ath9k-devel

From: Sujith Manoharan <c_manoha@qca.qualcomm.com>

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
---
 drivers/net/wireless/ath/ath9k/ath9k.h   |  3 +++
 drivers/net/wireless/ath/ath9k/channel.c | 37 ++++++++++++++++++++++++++++++--
 2 files changed, 38 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/ath9k.h b/drivers/net/wireless/ath/ath9k/ath9k.h
index 7c8c6f1..c690601 100644
--- a/drivers/net/wireless/ath/ath9k/ath9k.h
+++ b/drivers/net/wireless/ath/ath9k/ath9k.h
@@ -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];      \
diff --git a/drivers/net/wireless/ath/ath9k/channel.c b/drivers/net/wireless/ath/ath9k/channel.c
index 34ccfa0..9be92d8 100644
--- a/drivers/net/wireless/ath/ath9k/channel.c
+++ b/drivers/net/wireless/ath/ath9k/channel.c
@@ -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;
 
-- 
2.0.4


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 3/4] ath9k: Fix interface limits
  2014-08-24 15:46 [PATCH 0/4] ath9k patches Sujith Manoharan
  2014-08-24 15:46 ` [PATCH 1/4] ath9k: Add new chanctx events Sujith Manoharan
  2014-08-24 15:46 ` [PATCH 2/4] ath9k: Print the event/state in ath_chanctx_event Sujith Manoharan
@ 2014-08-24 15:46 ` Sujith Manoharan
  2014-08-24 15:46 ` [PATCH 4/4] ath9k: Fix channel context creation Sujith Manoharan
  3 siblings, 0 replies; 5+ messages in thread
From: Sujith Manoharan @ 2014-08-24 15:46 UTC (permalink / raw)
  To: John Linville; +Cc: linux-wireless, ath9k-devel

From: Sujith Manoharan <c_manoha@qca.qualcomm.com>

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

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
---
 drivers/net/wireless/ath/ath9k/init.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/init.c b/drivers/net/wireless/ath/ath9k/init.c
index 5887499..ca10a8b 100644
--- a/drivers/net/wireless/ath/ath9k/init.c
+++ b/drivers/net/wireless/ath/ath9k/init.c
@@ -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[] = {
-- 
2.0.4


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 4/4] ath9k: Fix channel context creation
  2014-08-24 15:46 [PATCH 0/4] ath9k patches Sujith Manoharan
                   ` (2 preceding siblings ...)
  2014-08-24 15:46 ` [PATCH 3/4] ath9k: Fix interface limits Sujith Manoharan
@ 2014-08-24 15:46 ` Sujith Manoharan
  3 siblings, 0 replies; 5+ messages in thread
From: Sujith Manoharan @ 2014-08-24 15:46 UTC (permalink / raw)
  To: John Linville; +Cc: linux-wireless, ath9k-devel

From: Sujith Manoharan <c_manoha@qca.qualcomm.com>

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.

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
---
 drivers/net/wireless/ath/ath9k/channel.c | 22 +++++++++++++++++++++-
 drivers/net/wireless/ath/ath9k/main.c    |  2 ++
 2 files changed, 23 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath9k/channel.c b/drivers/net/wireless/ath/ath9k/channel.c
index 9be92d8..b369c48 100644
--- a/drivers/net/wireless/ath/ath9k/channel.c
+++ b/drivers/net/wireless/ath/ath9k/channel.c
@@ -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;
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c
index da63487..2fcafa6 100644
--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
@@ -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;
 	}
-- 
2.0.4


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-08-24 15:46 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-24 15:46 [PATCH 0/4] ath9k patches Sujith Manoharan
2014-08-24 15:46 ` [PATCH 1/4] ath9k: Add new chanctx events Sujith Manoharan
2014-08-24 15:46 ` [PATCH 2/4] ath9k: Print the event/state in ath_chanctx_event Sujith Manoharan
2014-08-24 15:46 ` [PATCH 3/4] ath9k: Fix interface limits Sujith Manoharan
2014-08-24 15:46 ` [PATCH 4/4] ath9k: Fix channel context creation Sujith Manoharan

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).