All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 01/12] ath9k: add debug messages to aggr/chanctx funcs
@ 2015-11-12 13:15 ` Janusz Dziedzic
  0 siblings, 0 replies; 28+ messages in thread
From: Janusz Dziedzic @ 2015-11-12 13:15 UTC (permalink / raw)
  To: linux-wireless; +Cc: ath9k-devel, Janusz Dziedzic

Add/extend debug messages when chanctx used.

Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
---
 drivers/net/wireless/ath/ath9k/channel.c | 11 ++++++++---
 drivers/net/wireless/ath/ath9k/hw.c      |  8 ++++----
 drivers/net/wireless/ath/ath9k/xmit.c    | 15 +++++++++++++++
 3 files changed, 27 insertions(+), 7 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/channel.c b/drivers/net/wireless/ath/ath9k/channel.c
index 90f5773..35802c9 100644
--- a/drivers/net/wireless/ath/ath9k/channel.c
+++ b/drivers/net/wireless/ath/ath9k/channel.c
@@ -403,7 +403,7 @@ static void ath_chanctx_offchannel_noa(struct ath_softc *sc,
 	avp->offchannel_duration = sc->sched.offchannel_duration;
 
 	ath_dbg(common, CHAN_CTX,
-		"offchannel noa_duration: %d, noa_start: %d, noa_index: %d\n",
+		"offchannel noa_duration: %d, noa_start: %u, noa_index: %d\n",
 		avp->offchannel_duration,
 		avp->offchannel_start,
 		avp->noa_index);
@@ -443,7 +443,7 @@ static void ath_chanctx_set_periodic_noa(struct ath_softc *sc,
 		avp->periodic_noa = true;
 
 	ath_dbg(common, CHAN_CTX,
-		"noa_duration: %d, noa_start: %d, noa_index: %d, periodic: %d\n",
+		"noa_duration: %d, noa_start: %u, noa_index: %d, periodic: %d\n",
 		avp->noa_duration,
 		avp->noa_start,
 		avp->noa_index,
@@ -464,7 +464,7 @@ static void ath_chanctx_set_oneshot_noa(struct ath_softc *sc,
 	avp->noa_duration = duration + sc->sched.channel_switch_time;
 
 	ath_dbg(common, CHAN_CTX,
-		"oneshot noa_duration: %d, noa_start: %d, noa_index: %d, periodic: %d\n",
+		"oneshot noa_duration: %d, noa_start: %u, noa_index: %d, periodic: %d\n",
 		avp->noa_duration,
 		avp->noa_start,
 		avp->noa_index,
@@ -1401,6 +1401,7 @@ void ath9k_chanctx_wake_queues(struct ath_softc *sc, struct ath_chanctx *ctx)
 
 static void ath9k_update_p2p_ps_timer(struct ath_softc *sc, struct ath_vif *avp)
 {
+	struct ath_common *common = ath9k_hw_common(sc->sc_ah);
 	struct ath_hw *ah = sc->sc_ah;
 	s32 tsf, target_tsf;
 
@@ -1418,6 +1419,10 @@ static void ath9k_update_p2p_ps_timer(struct ath_softc *sc, struct ath_vif *avp)
 	if (target_tsf - tsf < ATH_P2P_PS_STOP_TIME)
 		target_tsf = tsf + ATH_P2P_PS_STOP_TIME;
 
+	ath_dbg(common, CHAN_CTX, "%s absent %d tsf 0x%08X next_tsf 0x%08X (%dms)\n",
+		__func__, avp->noa.absent, tsf, target_tsf,
+		(target_tsf - tsf) / 1000);
+
 	ath9k_hw_gen_timer_start(ah, sc->p2p_ps_timer, (u32) target_tsf, 1000000);
 }
 
diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c
index bdfff46..4af19e4 100644
--- a/drivers/net/wireless/ath/ath9k/hw.c
+++ b/drivers/net/wireless/ath/ath9k/hw.c
@@ -2299,10 +2299,10 @@ void ath9k_hw_set_sta_beacon_timers(struct ath_hw *ah,
 	else
 		nextTbtt = bs->bs_nexttbtt;
 
-	ath_dbg(common, BEACON, "next DTIM %d\n", bs->bs_nextdtim);
-	ath_dbg(common, BEACON, "next beacon %d\n", nextTbtt);
-	ath_dbg(common, BEACON, "beacon period %d\n", beaconintval);
-	ath_dbg(common, BEACON, "DTIM period %d\n", dtimperiod);
+	ath_dbg(common, BEACON, "next DTIM %u\n", bs->bs_nextdtim);
+	ath_dbg(common, BEACON, "next beacon %u\n", nextTbtt);
+	ath_dbg(common, BEACON, "beacon period %u\n", beaconintval);
+	ath_dbg(common, BEACON, "DTIM period %u\n", dtimperiod);
 
 	ENABLE_REGWRITE_BUFFER(ah);
 
diff --git a/drivers/net/wireless/ath/ath9k/xmit.c b/drivers/net/wireless/ath/ath9k/xmit.c
index 3e3dac3..26698a6 100644
--- a/drivers/net/wireless/ath/ath9k/xmit.c
+++ b/drivers/net/wireless/ath/ath9k/xmit.c
@@ -1473,11 +1473,14 @@ static bool ath_tx_sched_aggr(struct ath_softc *sc, struct ath_txq *txq,
 int ath_tx_aggr_start(struct ath_softc *sc, struct ieee80211_sta *sta,
 		      u16 tid, u16 *ssn)
 {
+	struct ath_common *common = ath9k_hw_common(sc->sc_ah);
 	struct ath_atx_tid *txtid;
 	struct ath_txq *txq;
 	struct ath_node *an;
 	u8 density;
 
+	ath_dbg(common, XMIT, "%s called\n", __func__);
+
 	an = (struct ath_node *)sta->drv_priv;
 	txtid = ATH_AN_2_TID(an, tid);
 	txq = txtid->txq;
@@ -1512,10 +1515,13 @@ int ath_tx_aggr_start(struct ath_softc *sc, struct ieee80211_sta *sta,
 
 void ath_tx_aggr_stop(struct ath_softc *sc, struct ieee80211_sta *sta, u16 tid)
 {
+	struct ath_common *common = ath9k_hw_common(sc->sc_ah);
 	struct ath_node *an = (struct ath_node *)sta->drv_priv;
 	struct ath_atx_tid *txtid = ATH_AN_2_TID(an, tid);
 	struct ath_txq *txq = txtid->txq;
 
+	ath_dbg(common, XMIT, "%s called\n", __func__);
+
 	ath_txq_lock(sc, txq);
 	txtid->active = false;
 	ath_tx_flush_tid(sc, txtid);
@@ -1526,11 +1532,14 @@ void ath_tx_aggr_stop(struct ath_softc *sc, struct ieee80211_sta *sta, u16 tid)
 void ath_tx_aggr_sleep(struct ieee80211_sta *sta, struct ath_softc *sc,
 		       struct ath_node *an)
 {
+	struct ath_common *common = ath9k_hw_common(sc->sc_ah);
 	struct ath_atx_tid *tid;
 	struct ath_txq *txq;
 	bool buffered;
 	int tidno;
 
+	ath_dbg(common, XMIT, "%s called\n", __func__);
+
 	for (tidno = 0, tid = &an->tid[tidno];
 	     tidno < IEEE80211_NUM_TIDS; tidno++, tid++) {
 
@@ -1555,10 +1564,13 @@ void ath_tx_aggr_sleep(struct ieee80211_sta *sta, struct ath_softc *sc,
 
 void ath_tx_aggr_wakeup(struct ath_softc *sc, struct ath_node *an)
 {
+	struct ath_common *common = ath9k_hw_common(sc->sc_ah);
 	struct ath_atx_tid *tid;
 	struct ath_txq *txq;
 	int tidno;
 
+	ath_dbg(common, XMIT, "%s called\n", __func__);
+
 	for (tidno = 0, tid = &an->tid[tidno];
 	     tidno < IEEE80211_NUM_TIDS; tidno++, tid++) {
 
@@ -1579,10 +1591,13 @@ void ath_tx_aggr_wakeup(struct ath_softc *sc, struct ath_node *an)
 void ath_tx_aggr_resume(struct ath_softc *sc, struct ieee80211_sta *sta,
 			u16 tidno)
 {
+	struct ath_common *common = ath9k_hw_common(sc->sc_ah);
 	struct ath_atx_tid *tid;
 	struct ath_node *an;
 	struct ath_txq *txq;
 
+	ath_dbg(common, XMIT, "%s called\n", __func__);
+
 	an = (struct ath_node *)sta->drv_priv;
 	tid = ATH_AN_2_TID(an, tidno);
 	txq = tid->txq;
-- 
1.9.1


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

* [ath9k-devel] [PATCH 01/12] ath9k: add debug messages to aggr/chanctx funcs
@ 2015-11-12 13:15 ` Janusz Dziedzic
  0 siblings, 0 replies; 28+ messages in thread
From: Janusz Dziedzic @ 2015-11-12 13:15 UTC (permalink / raw)
  To: ath9k-devel

Add/extend debug messages when chanctx used.

Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
---
 drivers/net/wireless/ath/ath9k/channel.c | 11 ++++++++---
 drivers/net/wireless/ath/ath9k/hw.c      |  8 ++++----
 drivers/net/wireless/ath/ath9k/xmit.c    | 15 +++++++++++++++
 3 files changed, 27 insertions(+), 7 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/channel.c b/drivers/net/wireless/ath/ath9k/channel.c
index 90f5773..35802c9 100644
--- a/drivers/net/wireless/ath/ath9k/channel.c
+++ b/drivers/net/wireless/ath/ath9k/channel.c
@@ -403,7 +403,7 @@ static void ath_chanctx_offchannel_noa(struct ath_softc *sc,
 	avp->offchannel_duration = sc->sched.offchannel_duration;
 
 	ath_dbg(common, CHAN_CTX,
-		"offchannel noa_duration: %d, noa_start: %d, noa_index: %d\n",
+		"offchannel noa_duration: %d, noa_start: %u, noa_index: %d\n",
 		avp->offchannel_duration,
 		avp->offchannel_start,
 		avp->noa_index);
@@ -443,7 +443,7 @@ static void ath_chanctx_set_periodic_noa(struct ath_softc *sc,
 		avp->periodic_noa = true;
 
 	ath_dbg(common, CHAN_CTX,
-		"noa_duration: %d, noa_start: %d, noa_index: %d, periodic: %d\n",
+		"noa_duration: %d, noa_start: %u, noa_index: %d, periodic: %d\n",
 		avp->noa_duration,
 		avp->noa_start,
 		avp->noa_index,
@@ -464,7 +464,7 @@ static void ath_chanctx_set_oneshot_noa(struct ath_softc *sc,
 	avp->noa_duration = duration + sc->sched.channel_switch_time;
 
 	ath_dbg(common, CHAN_CTX,
-		"oneshot noa_duration: %d, noa_start: %d, noa_index: %d, periodic: %d\n",
+		"oneshot noa_duration: %d, noa_start: %u, noa_index: %d, periodic: %d\n",
 		avp->noa_duration,
 		avp->noa_start,
 		avp->noa_index,
@@ -1401,6 +1401,7 @@ void ath9k_chanctx_wake_queues(struct ath_softc *sc, struct ath_chanctx *ctx)
 
 static void ath9k_update_p2p_ps_timer(struct ath_softc *sc, struct ath_vif *avp)
 {
+	struct ath_common *common = ath9k_hw_common(sc->sc_ah);
 	struct ath_hw *ah = sc->sc_ah;
 	s32 tsf, target_tsf;
 
@@ -1418,6 +1419,10 @@ static void ath9k_update_p2p_ps_timer(struct ath_softc *sc, struct ath_vif *avp)
 	if (target_tsf - tsf < ATH_P2P_PS_STOP_TIME)
 		target_tsf = tsf + ATH_P2P_PS_STOP_TIME;
 
+	ath_dbg(common, CHAN_CTX, "%s absent %d tsf 0x%08X next_tsf 0x%08X (%dms)\n",
+		__func__, avp->noa.absent, tsf, target_tsf,
+		(target_tsf - tsf) / 1000);
+
 	ath9k_hw_gen_timer_start(ah, sc->p2p_ps_timer, (u32) target_tsf, 1000000);
 }
 
diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c
index bdfff46..4af19e4 100644
--- a/drivers/net/wireless/ath/ath9k/hw.c
+++ b/drivers/net/wireless/ath/ath9k/hw.c
@@ -2299,10 +2299,10 @@ void ath9k_hw_set_sta_beacon_timers(struct ath_hw *ah,
 	else
 		nextTbtt = bs->bs_nexttbtt;
 
-	ath_dbg(common, BEACON, "next DTIM %d\n", bs->bs_nextdtim);
-	ath_dbg(common, BEACON, "next beacon %d\n", nextTbtt);
-	ath_dbg(common, BEACON, "beacon period %d\n", beaconintval);
-	ath_dbg(common, BEACON, "DTIM period %d\n", dtimperiod);
+	ath_dbg(common, BEACON, "next DTIM %u\n", bs->bs_nextdtim);
+	ath_dbg(common, BEACON, "next beacon %u\n", nextTbtt);
+	ath_dbg(common, BEACON, "beacon period %u\n", beaconintval);
+	ath_dbg(common, BEACON, "DTIM period %u\n", dtimperiod);
 
 	ENABLE_REGWRITE_BUFFER(ah);
 
diff --git a/drivers/net/wireless/ath/ath9k/xmit.c b/drivers/net/wireless/ath/ath9k/xmit.c
index 3e3dac3..26698a6 100644
--- a/drivers/net/wireless/ath/ath9k/xmit.c
+++ b/drivers/net/wireless/ath/ath9k/xmit.c
@@ -1473,11 +1473,14 @@ static bool ath_tx_sched_aggr(struct ath_softc *sc, struct ath_txq *txq,
 int ath_tx_aggr_start(struct ath_softc *sc, struct ieee80211_sta *sta,
 		      u16 tid, u16 *ssn)
 {
+	struct ath_common *common = ath9k_hw_common(sc->sc_ah);
 	struct ath_atx_tid *txtid;
 	struct ath_txq *txq;
 	struct ath_node *an;
 	u8 density;
 
+	ath_dbg(common, XMIT, "%s called\n", __func__);
+
 	an = (struct ath_node *)sta->drv_priv;
 	txtid = ATH_AN_2_TID(an, tid);
 	txq = txtid->txq;
@@ -1512,10 +1515,13 @@ int ath_tx_aggr_start(struct ath_softc *sc, struct ieee80211_sta *sta,
 
 void ath_tx_aggr_stop(struct ath_softc *sc, struct ieee80211_sta *sta, u16 tid)
 {
+	struct ath_common *common = ath9k_hw_common(sc->sc_ah);
 	struct ath_node *an = (struct ath_node *)sta->drv_priv;
 	struct ath_atx_tid *txtid = ATH_AN_2_TID(an, tid);
 	struct ath_txq *txq = txtid->txq;
 
+	ath_dbg(common, XMIT, "%s called\n", __func__);
+
 	ath_txq_lock(sc, txq);
 	txtid->active = false;
 	ath_tx_flush_tid(sc, txtid);
@@ -1526,11 +1532,14 @@ void ath_tx_aggr_stop(struct ath_softc *sc, struct ieee80211_sta *sta, u16 tid)
 void ath_tx_aggr_sleep(struct ieee80211_sta *sta, struct ath_softc *sc,
 		       struct ath_node *an)
 {
+	struct ath_common *common = ath9k_hw_common(sc->sc_ah);
 	struct ath_atx_tid *tid;
 	struct ath_txq *txq;
 	bool buffered;
 	int tidno;
 
+	ath_dbg(common, XMIT, "%s called\n", __func__);
+
 	for (tidno = 0, tid = &an->tid[tidno];
 	     tidno < IEEE80211_NUM_TIDS; tidno++, tid++) {
 
@@ -1555,10 +1564,13 @@ void ath_tx_aggr_sleep(struct ieee80211_sta *sta, struct ath_softc *sc,
 
 void ath_tx_aggr_wakeup(struct ath_softc *sc, struct ath_node *an)
 {
+	struct ath_common *common = ath9k_hw_common(sc->sc_ah);
 	struct ath_atx_tid *tid;
 	struct ath_txq *txq;
 	int tidno;
 
+	ath_dbg(common, XMIT, "%s called\n", __func__);
+
 	for (tidno = 0, tid = &an->tid[tidno];
 	     tidno < IEEE80211_NUM_TIDS; tidno++, tid++) {
 
@@ -1579,10 +1591,13 @@ void ath_tx_aggr_wakeup(struct ath_softc *sc, struct ath_node *an)
 void ath_tx_aggr_resume(struct ath_softc *sc, struct ieee80211_sta *sta,
 			u16 tidno)
 {
+	struct ath_common *common = ath9k_hw_common(sc->sc_ah);
 	struct ath_atx_tid *tid;
 	struct ath_node *an;
 	struct ath_txq *txq;
 
+	ath_dbg(common, XMIT, "%s called\n", __func__);
+
 	an = (struct ath_node *)sta->drv_priv;
 	tid = ATH_AN_2_TID(an, tidno);
 	txq = tid->txq;
-- 
1.9.1

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

* [PATCH 02/12] ath9k: print real timer value
  2015-11-12 13:15 ` [ath9k-devel] " Janusz Dziedzic
@ 2015-11-12 13:15   ` Janusz Dziedzic
  -1 siblings, 0 replies; 28+ messages in thread
From: Janusz Dziedzic @ 2015-11-12 13:15 UTC (permalink / raw)
  To: linux-wireless; +Cc: ath9k-devel, Janusz Dziedzic

In case of low HZ before this patch we saw wrong
values in debug message. Print real timeout value.

Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
---
 drivers/net/wireless/ath/ath9k/channel.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/channel.c b/drivers/net/wireless/ath/ath9k/channel.c
index 35802c9..dddaaea 100644
--- a/drivers/net/wireless/ath/ath9k/channel.c
+++ b/drivers/net/wireless/ath/ath9k/channel.c
@@ -356,14 +356,16 @@ static void ath_chanctx_setup_timer(struct ath_softc *sc, u32 tsf_time)
 {
 	struct ath_common *common = ath9k_hw_common(sc->sc_ah);
 	struct ath_hw *ah = sc->sc_ah;
+	unsigned long timeout;
 
 	ath9k_hw_gen_timer_start(ah, sc->p2p_ps_timer, tsf_time, 1000000);
 	tsf_time -= ath9k_hw_gettsf32(ah);
-	tsf_time = msecs_to_jiffies(tsf_time / 1000) + 1;
-	mod_timer(&sc->sched.timer, jiffies + tsf_time);
+	timeout = msecs_to_jiffies(tsf_time / 1000) + 1;
+	mod_timer(&sc->sched.timer, jiffies + timeout);
 
 	ath_dbg(common, CHAN_CTX,
-		"Setup chanctx timer with timeout: %d ms\n", jiffies_to_msecs(tsf_time));
+		"Setup chanctx timer with timeout: %d (%d) ms\n",
+		tsf_time / 1000, jiffies_to_msecs(timeout));
 }
 
 static void ath_chanctx_handle_bmiss(struct ath_softc *sc,
-- 
1.9.1


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

* [ath9k-devel] [PATCH 02/12] ath9k: print real timer value
@ 2015-11-12 13:15   ` Janusz Dziedzic
  0 siblings, 0 replies; 28+ messages in thread
From: Janusz Dziedzic @ 2015-11-12 13:15 UTC (permalink / raw)
  To: ath9k-devel

In case of low HZ before this patch we saw wrong
values in debug message. Print real timeout value.

Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
---
 drivers/net/wireless/ath/ath9k/channel.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/channel.c b/drivers/net/wireless/ath/ath9k/channel.c
index 35802c9..dddaaea 100644
--- a/drivers/net/wireless/ath/ath9k/channel.c
+++ b/drivers/net/wireless/ath/ath9k/channel.c
@@ -356,14 +356,16 @@ static void ath_chanctx_setup_timer(struct ath_softc *sc, u32 tsf_time)
 {
 	struct ath_common *common = ath9k_hw_common(sc->sc_ah);
 	struct ath_hw *ah = sc->sc_ah;
+	unsigned long timeout;
 
 	ath9k_hw_gen_timer_start(ah, sc->p2p_ps_timer, tsf_time, 1000000);
 	tsf_time -= ath9k_hw_gettsf32(ah);
-	tsf_time = msecs_to_jiffies(tsf_time / 1000) + 1;
-	mod_timer(&sc->sched.timer, jiffies + tsf_time);
+	timeout = msecs_to_jiffies(tsf_time / 1000) + 1;
+	mod_timer(&sc->sched.timer, jiffies + timeout);
 
 	ath_dbg(common, CHAN_CTX,
-		"Setup chanctx timer with timeout: %d ms\n", jiffies_to_msecs(tsf_time));
+		"Setup chanctx timer with timeout: %d (%d) ms\n",
+		tsf_time / 1000, jiffies_to_msecs(timeout));
 }
 
 static void ath_chanctx_handle_bmiss(struct ath_softc *sc,
-- 
1.9.1

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

* [PATCH 03/12] ath9k: queue null frames in case of MCC
  2015-11-12 13:15 ` [ath9k-devel] " Janusz Dziedzic
@ 2015-11-12 13:15   ` Janusz Dziedzic
  -1 siblings, 0 replies; 28+ messages in thread
From: Janusz Dziedzic @ 2015-11-12 13:15 UTC (permalink / raw)
  To: linux-wireless; +Cc: ath9k-devel, Janusz Dziedzic

While mac80211 using null frames when connection polling,
we should queue this frames while NOA could be there, and
AP, P2P_GO could be not present.

Without this patch, with no traffic we often saw disconnections
while we try to send nullfunc when AP/GO wasn't present.

Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
---
 drivers/net/wireless/ath/ath9k/xmit.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/net/wireless/ath/ath9k/xmit.c b/drivers/net/wireless/ath/ath9k/xmit.c
index 26698a6..82fc76f 100644
--- a/drivers/net/wireless/ath/ath9k/xmit.c
+++ b/drivers/net/wireless/ath/ath9k/xmit.c
@@ -2331,6 +2331,12 @@ int ath_tx_start(struct ieee80211_hw *hw, struct sk_buff *skb,
 
 	queue = ieee80211_is_data_present(hdr->frame_control);
 
+	/* If chanctx, queue all null frames while NOA could be there */
+	if (ath9k_is_chanctx_enabled() &&
+	    ieee80211_is_nullfunc(hdr->frame_control) &&
+	    !txctl->force_channel)
+		queue = true;
+
 	/* Force queueing of all frames that belong to a virtual interface on
 	 * a different channel context, to ensure that they are sent on the
 	 * correct channel.
-- 
1.9.1


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

* [ath9k-devel] [PATCH 03/12] ath9k: queue null frames in case of MCC
@ 2015-11-12 13:15   ` Janusz Dziedzic
  0 siblings, 0 replies; 28+ messages in thread
From: Janusz Dziedzic @ 2015-11-12 13:15 UTC (permalink / raw)
  To: ath9k-devel

While mac80211 using null frames when connection polling,
we should queue this frames while NOA could be there, and
AP, P2P_GO could be not present.

Without this patch, with no traffic we often saw disconnections
while we try to send nullfunc when AP/GO wasn't present.

Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
---
 drivers/net/wireless/ath/ath9k/xmit.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/net/wireless/ath/ath9k/xmit.c b/drivers/net/wireless/ath/ath9k/xmit.c
index 26698a6..82fc76f 100644
--- a/drivers/net/wireless/ath/ath9k/xmit.c
+++ b/drivers/net/wireless/ath/ath9k/xmit.c
@@ -2331,6 +2331,12 @@ int ath_tx_start(struct ieee80211_hw *hw, struct sk_buff *skb,
 
 	queue = ieee80211_is_data_present(hdr->frame_control);
 
+	/* If chanctx, queue all null frames while NOA could be there */
+	if (ath9k_is_chanctx_enabled() &&
+	    ieee80211_is_nullfunc(hdr->frame_control) &&
+	    !txctl->force_channel)
+		queue = true;
+
 	/* Force queueing of all frames that belong to a virtual interface on
 	 * a different channel context, to ensure that they are sent on the
 	 * correct channel.
-- 
1.9.1

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

* [PATCH 04/12] ath9k: P2P_CLIENT, send frames after 1ms AP/GO will aprear
  2015-11-12 13:15 ` [ath9k-devel] " Janusz Dziedzic
@ 2015-11-12 13:15   ` Janusz Dziedzic
  -1 siblings, 0 replies; 28+ messages in thread
From: Janusz Dziedzic @ 2015-11-12 13:15 UTC (permalink / raw)
  To: linux-wireless; +Cc: ath9k-devel, Janusz Dziedzic

AP/GO will aprear after NOA, wait 1ms to be sure AP
could receive/answer this frames.

Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
---
 drivers/net/wireless/ath/ath9k/channel.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/net/wireless/ath/ath9k/channel.c b/drivers/net/wireless/ath/ath9k/channel.c
index dddaaea..5640e88 100644
--- a/drivers/net/wireless/ath/ath9k/channel.c
+++ b/drivers/net/wireless/ath/ath9k/channel.c
@@ -1417,6 +1417,8 @@ static void ath9k_update_p2p_ps_timer(struct ath_softc *sc, struct ath_vif *avp)
 	target_tsf = avp->noa.next_tsf;
 	if (!avp->noa.absent)
 		target_tsf -= ATH_P2P_PS_STOP_TIME;
+	else
+		target_tsf += ATH_P2P_PS_STOP_TIME;
 
 	if (target_tsf - tsf < ATH_P2P_PS_STOP_TIME)
 		target_tsf = tsf + ATH_P2P_PS_STOP_TIME;
@@ -1543,6 +1545,8 @@ void ath9k_p2p_ps_timer(void *priv)
 	tsf = ath9k_hw_gettsf32(sc->sc_ah);
 	if (!avp->noa.absent)
 		tsf += ATH_P2P_PS_STOP_TIME;
+	else
+		tsf -= ATH_P2P_PS_STOP_TIME;
 
 	if (!avp->noa.has_next_tsf ||
 	    avp->noa.next_tsf - tsf > BIT(31))
-- 
1.9.1


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

* [ath9k-devel] [PATCH 04/12] ath9k: P2P_CLIENT, send frames after 1ms AP/GO will aprear
@ 2015-11-12 13:15   ` Janusz Dziedzic
  0 siblings, 0 replies; 28+ messages in thread
From: Janusz Dziedzic @ 2015-11-12 13:15 UTC (permalink / raw)
  To: ath9k-devel

AP/GO will aprear after NOA, wait 1ms to be sure AP
could receive/answer this frames.

Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
---
 drivers/net/wireless/ath/ath9k/channel.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/net/wireless/ath/ath9k/channel.c b/drivers/net/wireless/ath/ath9k/channel.c
index dddaaea..5640e88 100644
--- a/drivers/net/wireless/ath/ath9k/channel.c
+++ b/drivers/net/wireless/ath/ath9k/channel.c
@@ -1417,6 +1417,8 @@ static void ath9k_update_p2p_ps_timer(struct ath_softc *sc, struct ath_vif *avp)
 	target_tsf = avp->noa.next_tsf;
 	if (!avp->noa.absent)
 		target_tsf -= ATH_P2P_PS_STOP_TIME;
+	else
+		target_tsf += ATH_P2P_PS_STOP_TIME;
 
 	if (target_tsf - tsf < ATH_P2P_PS_STOP_TIME)
 		target_tsf = tsf + ATH_P2P_PS_STOP_TIME;
@@ -1543,6 +1545,8 @@ void ath9k_p2p_ps_timer(void *priv)
 	tsf = ath9k_hw_gettsf32(sc->sc_ah);
 	if (!avp->noa.absent)
 		tsf += ATH_P2P_PS_STOP_TIME;
+	else
+		tsf -= ATH_P2P_PS_STOP_TIME;
 
 	if (!avp->noa.has_next_tsf ||
 	    avp->noa.next_tsf - tsf > BIT(31))
-- 
1.9.1

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

* [PATCH 05/12] ath9k: use u32 when calculate tsf
  2015-11-12 13:15 ` [ath9k-devel] " Janusz Dziedzic
@ 2015-11-12 13:15   ` Janusz Dziedzic
  -1 siblings, 0 replies; 28+ messages in thread
From: Janusz Dziedzic @ 2015-11-12 13:15 UTC (permalink / raw)
  To: linux-wireless; +Cc: ath9k-devel, Janusz Dziedzic

Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
---
 drivers/net/wireless/ath/ath9k/channel.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath9k/channel.c b/drivers/net/wireless/ath/ath9k/channel.c
index 5640e88..d86566b 100644
--- a/drivers/net/wireless/ath/ath9k/channel.c
+++ b/drivers/net/wireless/ath/ath9k/channel.c
@@ -1405,7 +1405,7 @@ static void ath9k_update_p2p_ps_timer(struct ath_softc *sc, struct ath_vif *avp)
 {
 	struct ath_common *common = ath9k_hw_common(sc->sc_ah);
 	struct ath_hw *ah = sc->sc_ah;
-	s32 tsf, target_tsf;
+	u32 tsf, target_tsf;
 
 	if (!avp || !avp->noa.has_next_tsf)
 		return;
-- 
1.9.1


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

* [ath9k-devel] [PATCH 05/12] ath9k: use u32 when calculate tsf
@ 2015-11-12 13:15   ` Janusz Dziedzic
  0 siblings, 0 replies; 28+ messages in thread
From: Janusz Dziedzic @ 2015-11-12 13:15 UTC (permalink / raw)
  To: ath9k-devel

Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
---
 drivers/net/wireless/ath/ath9k/channel.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath9k/channel.c b/drivers/net/wireless/ath/ath9k/channel.c
index 5640e88..d86566b 100644
--- a/drivers/net/wireless/ath/ath9k/channel.c
+++ b/drivers/net/wireless/ath/ath9k/channel.c
@@ -1405,7 +1405,7 @@ static void ath9k_update_p2p_ps_timer(struct ath_softc *sc, struct ath_vif *avp)
 {
 	struct ath_common *common = ath9k_hw_common(sc->sc_ah);
 	struct ath_hw *ah = sc->sc_ah;
-	s32 tsf, target_tsf;
+	u32 tsf, target_tsf;
 
 	if (!avp || !avp->noa.has_next_tsf)
 		return;
-- 
1.9.1

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

* [PATCH 06/12] ath9k: setup correct skb priority for nullfunc
  2015-11-12 13:15 ` [ath9k-devel] " Janusz Dziedzic
@ 2015-11-12 13:15   ` Janusz Dziedzic
  -1 siblings, 0 replies; 28+ messages in thread
From: Janusz Dziedzic @ 2015-11-12 13:15 UTC (permalink / raw)
  To: linux-wireless; +Cc: ath9k-devel, Janusz Dziedzic

After queue nullfunc for MCC case, we hit WARN_ON
in xmit.c:2398 while skb priority wasn't set.

Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
---
 drivers/net/wireless/ath/ath9k/channel.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/wireless/ath/ath9k/channel.c b/drivers/net/wireless/ath/ath9k/channel.c
index d86566b..4f60ddb 100644
--- a/drivers/net/wireless/ath/ath9k/channel.c
+++ b/drivers/net/wireless/ath/ath9k/channel.c
@@ -1101,6 +1101,7 @@ ath_chanctx_send_vif_ps_frame(struct ath_softc *sc, struct ath_vif *avp,
 			nullfunc->frame_control |=
 				cpu_to_le16(IEEE80211_FCTL_PM);
 
+		skb->priority = 7;
 		skb_set_queue_mapping(skb, IEEE80211_AC_VO);
 		if (!ieee80211_tx_prepare_skb(sc->hw, vif, skb, band, &sta)) {
 			dev_kfree_skb_any(skb);
-- 
1.9.1


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

* [ath9k-devel] [PATCH 06/12] ath9k: setup correct skb priority for nullfunc
@ 2015-11-12 13:15   ` Janusz Dziedzic
  0 siblings, 0 replies; 28+ messages in thread
From: Janusz Dziedzic @ 2015-11-12 13:15 UTC (permalink / raw)
  To: ath9k-devel

After queue nullfunc for MCC case, we hit WARN_ON
in xmit.c:2398 while skb priority wasn't set.

Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
---
 drivers/net/wireless/ath/ath9k/channel.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/wireless/ath/ath9k/channel.c b/drivers/net/wireless/ath/ath9k/channel.c
index d86566b..4f60ddb 100644
--- a/drivers/net/wireless/ath/ath9k/channel.c
+++ b/drivers/net/wireless/ath/ath9k/channel.c
@@ -1101,6 +1101,7 @@ ath_chanctx_send_vif_ps_frame(struct ath_softc *sc, struct ath_vif *avp,
 			nullfunc->frame_control |=
 				cpu_to_le16(IEEE80211_FCTL_PM);
 
+		skb->priority = 7;
 		skb_set_queue_mapping(skb, IEEE80211_AC_VO);
 		if (!ieee80211_tx_prepare_skb(sc->hw, vif, skb, band, &sta)) {
 			dev_kfree_skb_any(skb);
-- 
1.9.1

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

* [PATCH 07/12] ath9k: MCC enable Opportunistic Power Save
  2015-11-12 13:15 ` [ath9k-devel] " Janusz Dziedzic
@ 2015-11-12 13:15   ` Janusz Dziedzic
  -1 siblings, 0 replies; 28+ messages in thread
From: Janusz Dziedzic @ 2015-11-12 13:15 UTC (permalink / raw)
  To: linux-wireless; +Cc: ath9k-devel, Janusz Dziedzic

When adding NOA attr enable Opportunistiv Power Save.
Before we calculate ctwindow but didn't enable oppps.

Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
---
 drivers/net/wireless/ath/ath9k/channel.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/wireless/ath/ath9k/channel.c b/drivers/net/wireless/ath/ath9k/channel.c
index 4f60ddb..2615392 100644
--- a/drivers/net/wireless/ath/ath9k/channel.c
+++ b/drivers/net/wireless/ath/ath9k/channel.c
@@ -1505,6 +1505,8 @@ void ath9k_beacon_add_noa(struct ath_softc *sc, struct ath_vif *avp,
 
 	noa->index = avp->noa_index;
 	noa->oppps_ctwindow = ath9k_get_ctwin(sc, avp);
+	if (noa->oppps_ctwindow)
+		noa->oppps_ctwindow |= BIT(7);
 
 	if (avp->noa_duration) {
 		if (avp->periodic_noa) {
-- 
1.9.1


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

* [ath9k-devel] [PATCH 07/12] ath9k: MCC enable Opportunistic Power Save
@ 2015-11-12 13:15   ` Janusz Dziedzic
  0 siblings, 0 replies; 28+ messages in thread
From: Janusz Dziedzic @ 2015-11-12 13:15 UTC (permalink / raw)
  To: ath9k-devel

When adding NOA attr enable Opportunistiv Power Save.
Before we calculate ctwindow but didn't enable oppps.

Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
---
 drivers/net/wireless/ath/ath9k/channel.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/wireless/ath/ath9k/channel.c b/drivers/net/wireless/ath/ath9k/channel.c
index 4f60ddb..2615392 100644
--- a/drivers/net/wireless/ath/ath9k/channel.c
+++ b/drivers/net/wireless/ath/ath9k/channel.c
@@ -1505,6 +1505,8 @@ void ath9k_beacon_add_noa(struct ath_softc *sc, struct ath_vif *avp,
 
 	noa->index = avp->noa_index;
 	noa->oppps_ctwindow = ath9k_get_ctwin(sc, avp);
+	if (noa->oppps_ctwindow)
+		noa->oppps_ctwindow |= BIT(7);
 
 	if (avp->noa_duration) {
 		if (avp->periodic_noa) {
-- 
1.9.1

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

* [PATCH 08/12] ath9k: P2P_CLIENT, get/set NOA correctly
  2015-11-12 13:15 ` [ath9k-devel] " Janusz Dziedzic
@ 2015-11-12 13:15   ` Janusz Dziedzic
  -1 siblings, 0 replies; 28+ messages in thread
From: Janusz Dziedzic @ 2015-11-12 13:15 UTC (permalink / raw)
  To: linux-wireless; +Cc: ath9k-devel, Janusz Dziedzic

In case we get BSS_CHANGED_P2P_PS early, from
mac80211, we didn't set NOA timer correctly,
while p2p_ps_vif was NULL.

Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
---
 drivers/net/wireless/ath/ath9k/channel.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/channel.c b/drivers/net/wireless/ath/ath9k/channel.c
index 2615392..db49bc5 100644
--- a/drivers/net/wireless/ath/ath9k/channel.c
+++ b/drivers/net/wireless/ath/ath9k/channel.c
@@ -1443,6 +1443,10 @@ static void ath9k_update_p2p_ps(struct ath_softc *sc, struct ieee80211_vif *vif)
 		return;
 
 	sc->p2p_ps_vif = avp;
+
+	if (sc->ps_flags & PS_BEACON_SYNC)
+		return;
+
 	tsf = ath9k_hw_gettsf32(sc->sc_ah);
 	ieee80211_parse_p2p_noa(&vif->bss_conf.p2p_noa_attr, &avp->noa, tsf);
 	ath9k_update_p2p_ps_timer(sc, avp);
@@ -1585,8 +1589,7 @@ void ath9k_p2p_bss_info_changed(struct ath_softc *sc,
 
 	spin_lock_bh(&sc->sc_pcu_lock);
 	spin_lock_irqsave(&sc->sc_pm_lock, flags);
-	if (!(sc->ps_flags & PS_BEACON_SYNC))
-		ath9k_update_p2p_ps(sc, vif);
+	ath9k_update_p2p_ps(sc, vif);
 	spin_unlock_irqrestore(&sc->sc_pm_lock, flags);
 	spin_unlock_bh(&sc->sc_pcu_lock);
 }
-- 
1.9.1


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

* [ath9k-devel] [PATCH 08/12] ath9k: P2P_CLIENT, get/set NOA correctly
@ 2015-11-12 13:15   ` Janusz Dziedzic
  0 siblings, 0 replies; 28+ messages in thread
From: Janusz Dziedzic @ 2015-11-12 13:15 UTC (permalink / raw)
  To: ath9k-devel

In case we get BSS_CHANGED_P2P_PS early, from
mac80211, we didn't set NOA timer correctly,
while p2p_ps_vif was NULL.

Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
---
 drivers/net/wireless/ath/ath9k/channel.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/channel.c b/drivers/net/wireless/ath/ath9k/channel.c
index 2615392..db49bc5 100644
--- a/drivers/net/wireless/ath/ath9k/channel.c
+++ b/drivers/net/wireless/ath/ath9k/channel.c
@@ -1443,6 +1443,10 @@ static void ath9k_update_p2p_ps(struct ath_softc *sc, struct ieee80211_vif *vif)
 		return;
 
 	sc->p2p_ps_vif = avp;
+
+	if (sc->ps_flags & PS_BEACON_SYNC)
+		return;
+
 	tsf = ath9k_hw_gettsf32(sc->sc_ah);
 	ieee80211_parse_p2p_noa(&vif->bss_conf.p2p_noa_attr, &avp->noa, tsf);
 	ath9k_update_p2p_ps_timer(sc, avp);
@@ -1585,8 +1589,7 @@ void ath9k_p2p_bss_info_changed(struct ath_softc *sc,
 
 	spin_lock_bh(&sc->sc_pcu_lock);
 	spin_lock_irqsave(&sc->sc_pm_lock, flags);
-	if (!(sc->ps_flags & PS_BEACON_SYNC))
-		ath9k_update_p2p_ps(sc, vif);
+	ath9k_update_p2p_ps(sc, vif);
 	spin_unlock_irqrestore(&sc->sc_pm_lock, flags);
 	spin_unlock_bh(&sc->sc_pcu_lock);
 }
-- 
1.9.1

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

* [PATCH 09/12] ath9k: request NOA update when chanctx active
  2015-11-12 13:15 ` [ath9k-devel] " Janusz Dziedzic
@ 2015-11-12 13:15   ` Janusz Dziedzic
  -1 siblings, 0 replies; 28+ messages in thread
From: Janusz Dziedzic @ 2015-11-12 13:15 UTC (permalink / raw)
  To: linux-wireless; +Cc: ath9k-devel, Janusz Dziedzic

Request NOA update when chanctx active, also in case
of STA.

Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
---
This depends on:
[PATCH] mac80211: add new IEEE80211_VIF_GET_NOA_UPDATE flag

 drivers/net/wireless/ath/ath9k/channel.c | 2 +-
 drivers/net/wireless/ath/ath9k/main.c    | 5 ++++-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/channel.c b/drivers/net/wireless/ath/ath9k/channel.c
index db49bc5..4320928 100644
--- a/drivers/net/wireless/ath/ath9k/channel.c
+++ b/drivers/net/wireless/ath/ath9k/channel.c
@@ -1439,7 +1439,7 @@ static void ath9k_update_p2p_ps(struct ath_softc *sc, struct ieee80211_vif *vif)
 	if (!sc->p2p_ps_timer)
 		return;
 
-	if (vif->type != NL80211_IFTYPE_STATION || !vif->p2p)
+	if (vif->type != NL80211_IFTYPE_STATION)
 		return;
 
 	sc->p2p_ps_vif = avp;
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c
index d184e68..ab46a4d 100644
--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
@@ -974,7 +974,7 @@ static void ath9k_update_bssid_mask(struct ath_softc *sc,
 		if (ctx->nvifs_assigned != 1)
 			continue;
 
-		if (!avp->vif->p2p || !iter_data->has_hw_macaddr)
+		if (!iter_data->has_hw_macaddr)
 			continue;
 
 		ether_addr_copy(common->curbssid, avp->bssid);
@@ -1251,6 +1251,9 @@ static int ath9k_add_interface(struct ieee80211_hw *hw,
 	ath_dbg(common, CONFIG, "Attach a VIF of type: %d\n", vif->type);
 	sc->cur_chan->nvifs++;
 
+	if (vif->type == NL80211_IFTYPE_STATION && ath9k_is_chanctx_enabled())
+		vif->driver_flags |= IEEE80211_VIF_GET_NOA_UPDATE;
+
 	if (ath9k_uses_beacons(vif->type))
 		ath9k_beacon_assign_slot(sc, vif);
 
-- 
1.9.1


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

* [ath9k-devel] [PATCH 09/12] ath9k: request NOA update when chanctx active
@ 2015-11-12 13:15   ` Janusz Dziedzic
  0 siblings, 0 replies; 28+ messages in thread
From: Janusz Dziedzic @ 2015-11-12 13:15 UTC (permalink / raw)
  To: ath9k-devel

Request NOA update when chanctx active, also in case
of STA.

Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
---
This depends on:
[PATCH] mac80211: add new IEEE80211_VIF_GET_NOA_UPDATE flag

 drivers/net/wireless/ath/ath9k/channel.c | 2 +-
 drivers/net/wireless/ath/ath9k/main.c    | 5 ++++-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/channel.c b/drivers/net/wireless/ath/ath9k/channel.c
index db49bc5..4320928 100644
--- a/drivers/net/wireless/ath/ath9k/channel.c
+++ b/drivers/net/wireless/ath/ath9k/channel.c
@@ -1439,7 +1439,7 @@ static void ath9k_update_p2p_ps(struct ath_softc *sc, struct ieee80211_vif *vif)
 	if (!sc->p2p_ps_timer)
 		return;
 
-	if (vif->type != NL80211_IFTYPE_STATION || !vif->p2p)
+	if (vif->type != NL80211_IFTYPE_STATION)
 		return;
 
 	sc->p2p_ps_vif = avp;
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c
index d184e68..ab46a4d 100644
--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
@@ -974,7 +974,7 @@ static void ath9k_update_bssid_mask(struct ath_softc *sc,
 		if (ctx->nvifs_assigned != 1)
 			continue;
 
-		if (!avp->vif->p2p || !iter_data->has_hw_macaddr)
+		if (!iter_data->has_hw_macaddr)
 			continue;
 
 		ether_addr_copy(common->curbssid, avp->bssid);
@@ -1251,6 +1251,9 @@ static int ath9k_add_interface(struct ieee80211_hw *hw,
 	ath_dbg(common, CONFIG, "Attach a VIF of type: %d\n", vif->type);
 	sc->cur_chan->nvifs++;
 
+	if (vif->type == NL80211_IFTYPE_STATION && ath9k_is_chanctx_enabled())
+		vif->driver_flags |= IEEE80211_VIF_GET_NOA_UPDATE;
+
 	if (ath9k_uses_beacons(vif->type))
 		ath9k_beacon_assign_slot(sc, vif);
 
-- 
1.9.1

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

* [PATCH 10/12] ath9k: MCC, add NOA also in case of an AP
  2015-11-12 13:15 ` [ath9k-devel] " Janusz Dziedzic
@ 2015-11-12 13:15   ` Janusz Dziedzic
  -1 siblings, 0 replies; 28+ messages in thread
From: Janusz Dziedzic @ 2015-11-12 13:15 UTC (permalink / raw)
  To: linux-wireless; +Cc: ath9k-devel, Janusz Dziedzic

In case of MCC and AP interface, add also NOA attr
that will inform stations about absence of an AP.
There is a chance that some stations will handle
this NOA attr correctly and will know exactly when
AP is present/absent.

Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
---
 drivers/net/wireless/ath/ath9k/beacon.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath9k/beacon.c b/drivers/net/wireless/ath/ath9k/beacon.c
index f50a6bc..5cf0cd7 100644
--- a/drivers/net/wireless/ath/ath9k/beacon.c
+++ b/drivers/net/wireless/ath/ath9k/beacon.c
@@ -148,7 +148,8 @@ static struct ath_buf *ath9k_beacon_generate(struct ieee80211_hw *hw,
 
 	ath_assign_seq(common, skb);
 
-	if (vif->p2p)
+	/* Always assign NOA attr when MCC enabled */
+	if (ath9k_is_chanctx_enabled())
 		ath9k_beacon_add_noa(sc, avp, skb);
 
 	bf->bf_buf_addr = dma_map_single(sc->dev, skb->data,
-- 
1.9.1


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

* [ath9k-devel] [PATCH 10/12] ath9k: MCC, add NOA also in case of an AP
@ 2015-11-12 13:15   ` Janusz Dziedzic
  0 siblings, 0 replies; 28+ messages in thread
From: Janusz Dziedzic @ 2015-11-12 13:15 UTC (permalink / raw)
  To: ath9k-devel

In case of MCC and AP interface, add also NOA attr
that will inform stations about absence of an AP.
There is a chance that some stations will handle
this NOA attr correctly and will know exactly when
AP is present/absent.

Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
---
 drivers/net/wireless/ath/ath9k/beacon.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath9k/beacon.c b/drivers/net/wireless/ath/ath9k/beacon.c
index f50a6bc..5cf0cd7 100644
--- a/drivers/net/wireless/ath/ath9k/beacon.c
+++ b/drivers/net/wireless/ath/ath9k/beacon.c
@@ -148,7 +148,8 @@ static struct ath_buf *ath9k_beacon_generate(struct ieee80211_hw *hw,
 
 	ath_assign_seq(common, skb);
 
-	if (vif->p2p)
+	/* Always assign NOA attr when MCC enabled */
+	if (ath9k_is_chanctx_enabled())
 		ath9k_beacon_add_noa(sc, avp, skb);
 
 	bf->bf_buf_addr = dma_map_single(sc->dev, skb->data,
-- 
1.9.1

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

* [PATCH 11/12] ath9k: MCC add sta_ap_ratio module param
  2015-11-12 13:15 ` [ath9k-devel] " Janusz Dziedzic
@ 2015-11-12 13:15   ` Janusz Dziedzic
  -1 siblings, 0 replies; 28+ messages in thread
From: Janusz Dziedzic @ 2015-11-12 13:15 UTC (permalink / raw)
  To: linux-wireless; +Cc: ath9k-devel, Janusz Dziedzic

In case of MCC we can setup STA/AP(GO) ratio.
Eg. setting sta_ap_ratio=80
STA will get 80% of time, while AP(GO) 20%.
Setup correct ctwindow.

Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
---
 drivers/net/wireless/ath/ath9k/ath9k.h   |  2 +
 drivers/net/wireless/ath/ath9k/channel.c | 69 +++++++++++++++++++++-----------
 drivers/net/wireless/ath/ath9k/hw.h      |  1 +
 drivers/net/wireless/ath/ath9k/init.c    |  3 ++
 4 files changed, 51 insertions(+), 24 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/ath9k.h b/drivers/net/wireless/ath/ath9k/ath9k.h
index b42f4a9..4616229 100644
--- a/drivers/net/wireless/ath/ath9k/ath9k.h
+++ b/drivers/net/wireless/ath/ath9k/ath9k.h
@@ -37,6 +37,7 @@ extern int ath9k_modparam_nohwcrypt;
 extern int ath9k_led_blink;
 extern bool is_ath9k_unloaded;
 extern int ath9k_use_chanctx;
+extern int ath9k_sta_ap_ratio;
 
 /*************************/
 /* Descriptor Management */
@@ -335,6 +336,7 @@ struct ath_chanctx {
 	struct timespec tsf_ts;
 	u64 tsf_val;
 	u32 last_beacon;
+	u32 ctwindow;
 
 	int flush_timeout;
 	u16 txpower;
diff --git a/drivers/net/wireless/ath/ath9k/channel.c b/drivers/net/wireless/ath/ath9k/channel.c
index 4320928..b0d74f0 100644
--- a/drivers/net/wireless/ath/ath9k/channel.c
+++ b/drivers/net/wireless/ath/ath9k/channel.c
@@ -313,11 +313,21 @@ ath_chanctx_get_next(struct ath_softc *sc, struct ath_chanctx *ctx)
 	return &sc->chanctx[!idx];
 }
 
+static u32 get_ratio(u32 beacon_int)
+{
+	if (ath9k_sta_ap_ratio < 20 ||
+	    ath9k_sta_ap_ratio > 80)
+		return beacon_int / 2;
+
+	return (beacon_int * ath9k_sta_ap_ratio) / 100;
+}
+
 static void ath_chanctx_adjust_tbtt_delta(struct ath_softc *sc)
 {
+	struct ath_common *common = ath9k_hw_common(sc->sc_ah);
 	struct ath_chanctx *prev, *cur;
 	struct timespec ts;
-	u32 cur_tsf, prev_tsf, beacon_int;
+	u32 cur_tsf, prev_tsf, beacon_int, diff;
 	s32 offset;
 
 	beacon_int = TU_TO_USEC(sc->cur_chan->beacon.beacon_interval);
@@ -344,7 +354,14 @@ static void ath_chanctx_adjust_tbtt_delta(struct ath_softc *sc)
 	if (offset < 0 || offset > 3 * beacon_int)
 		return;
 
-	offset = beacon_int / 2 - (offset % beacon_int);
+	diff = 2 * prev->ctwindow;
+	diff += sc->sched.channel_switch_time;
+	if (diff > beacon_int / 2)
+		diff = beacon_int / 2;
+
+	ath_dbg(common, CHAN_CTX, "Setup beacon interval offset %u ms\n",
+		diff / 1000);
+	offset = diff - (offset % beacon_int);
 	prev->tsf_val += offset;
 }
 
@@ -435,7 +452,7 @@ static void ath_chanctx_set_periodic_noa(struct ath_softc *sc,
 			sc->sched.channel_switch_time;
 	else
 		avp->noa_duration =
-			TU_TO_USEC(cur_conf->beacon_interval) / 2 +
+			TU_TO_USEC(get_ratio(cur_conf->beacon_interval)) +
 			sc->sched.channel_switch_time;
 
 	if (test_bit(ATH_OP_SCANNING, &common->op_flags) ||
@@ -481,7 +498,8 @@ void ath_chanctx_event(struct ath_softc *sc, struct ieee80211_vif *vif,
 	struct ath_beacon_config *cur_conf;
 	struct ath_vif *avp = NULL;
 	struct ath_chanctx *ctx;
-	u32 tsf_time;
+	u32 tsf_time, defer_time;
+	u32 beacon_resp_time = ah->config.sw_beacon_response_time;
 	u32 beacon_int;
 
 	if (vif)
@@ -565,10 +583,26 @@ void ath_chanctx_event(struct ath_softc *sc, struct ieee80211_vif *vif,
 		cur_conf = &sc->cur_chan->beacon;
 		beacon_int = TU_TO_USEC(cur_conf->beacon_interval);
 
-		/* defer channel switch by a quarter beacon interval */
-		tsf_time = sc->sched.next_tbtt + beacon_int / 4;
+		/* defer channel switch */
+		defer_time = beacon_int - get_ratio(beacon_int);
+		defer_time -= sc->sched.channel_switch_time;
+		defer_time /= 2;
+
+		if (defer_time < TU_TO_USEC(2 + beacon_resp_time)) {
+			defer_time *= 2;
+			if (defer_time > TU_TO_USEC(3 + beacon_resp_time))
+				defer_time -= TU_TO_USEC(3 + beacon_resp_time);
+			else
+				defer_time = 1000;
+		}
+
+		ath_dbg(common, CHAN_CTX, "Setup defer_time %u (%u ms)\n",
+			defer_time, defer_time / 1000);
+
+		tsf_time = sc->sched.next_tbtt + defer_time;
 		sc->sched.switch_start_time = tsf_time;
 		sc->cur_chan->last_beacon = sc->sched.next_tbtt;
+		sc->cur_chan->ctwindow = defer_time;
 
 		/*
 		 * If an offchannel switch is scheduled to happen after
@@ -707,7 +741,7 @@ void ath_chanctx_event(struct ath_softc *sc, struct ieee80211_vif *vif,
 		sc->sched.state = ATH_CHANCTX_STATE_WAIT_FOR_TIMER;
 		sc->sched.wait_switch = false;
 
-		tsf_time = TU_TO_USEC(cur_conf->beacon_interval) / 2;
+		tsf_time = TU_TO_USEC(get_ratio(cur_conf->beacon_interval));
 
 		if (sc->sched.extend_absence) {
 			sc->sched.beacon_miss = 0;
@@ -1454,26 +1488,13 @@ static void ath9k_update_p2p_ps(struct ath_softc *sc, struct ieee80211_vif *vif)
 
 static u8 ath9k_get_ctwin(struct ath_softc *sc, struct ath_vif *avp)
 {
-	struct ath_beacon_config *cur_conf = &sc->cur_chan->beacon;
-	u8 switch_time, ctwin;
-
 	/*
 	 * Channel switch in multi-channel mode is deferred
-	 * by a quarter beacon interval when handling
-	 * ATH_CHANCTX_EVENT_BEACON_PREPARE, so the P2P-GO
-	 * interface is guaranteed to be discoverable
-	 * for that duration after a TBTT.
+	 * when handling ATH_CHANCTX_EVENT_BEACON_PREPARE,
+	 * so the P2P-GO interface is guaranteed to be
+	 * discoverable for that duration after a TBTT.
 	 */
-	switch_time = cur_conf->beacon_interval / 4;
-
-	ctwin = avp->vif->bss_conf.p2p_noa_attr.oppps_ctwindow;
-	if (ctwin && (ctwin < switch_time))
-		return ctwin;
-
-	if (switch_time < P2P_DEFAULT_CTWIN)
-		return 0;
-
-	return P2P_DEFAULT_CTWIN;
+	return USEC_TO_TU(sc->cur_chan->ctwindow);
 }
 
 void ath9k_beacon_add_noa(struct ath_softc *sc, struct ath_vif *avp,
diff --git a/drivers/net/wireless/ath/ath9k/hw.h b/drivers/net/wireless/ath/ath9k/hw.h
index 4f0a3f6..7528f00 100644
--- a/drivers/net/wireless/ath/ath9k/hw.h
+++ b/drivers/net/wireless/ath/ath9k/hw.h
@@ -193,6 +193,7 @@
 #define INIT_BCON_CNTRL_REG         0x00000000
 
 #define TU_TO_USEC(_tu)             ((_tu) << 10)
+#define USEC_TO_TU(_us)             ((_us) >> 10)
 
 #define ATH9K_HW_RX_HP_QDEPTH	16
 #define ATH9K_HW_RX_LP_QDEPTH	128
diff --git a/drivers/net/wireless/ath/ath9k/init.c b/drivers/net/wireless/ath/ath9k/init.c
index 2e2b92b..6729a5f 100644
--- a/drivers/net/wireless/ath/ath9k/init.c
+++ b/drivers/net/wireless/ath/ath9k/init.c
@@ -67,6 +67,9 @@ int ath9k_use_chanctx;
 module_param_named(use_chanctx, ath9k_use_chanctx, int, 0444);
 MODULE_PARM_DESC(use_chanctx, "Enable channel context for concurrency");
 
+int ath9k_sta_ap_ratio;
+module_param_named(sta_ap_ratio, ath9k_sta_ap_ratio, int, 0444);
+MODULE_PARM_DESC(sta_ap_ratio, "sta/ap ratio 20-80");
 #endif /* CONFIG_ATH9K_CHANNEL_CONTEXT */
 
 bool is_ath9k_unloaded;
-- 
1.9.1


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

* [ath9k-devel] [PATCH 11/12] ath9k: MCC add sta_ap_ratio module param
@ 2015-11-12 13:15   ` Janusz Dziedzic
  0 siblings, 0 replies; 28+ messages in thread
From: Janusz Dziedzic @ 2015-11-12 13:15 UTC (permalink / raw)
  To: ath9k-devel

In case of MCC we can setup STA/AP(GO) ratio.
Eg. setting sta_ap_ratio=80
STA will get 80% of time, while AP(GO) 20%.
Setup correct ctwindow.

Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
---
 drivers/net/wireless/ath/ath9k/ath9k.h   |  2 +
 drivers/net/wireless/ath/ath9k/channel.c | 69 +++++++++++++++++++++-----------
 drivers/net/wireless/ath/ath9k/hw.h      |  1 +
 drivers/net/wireless/ath/ath9k/init.c    |  3 ++
 4 files changed, 51 insertions(+), 24 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/ath9k.h b/drivers/net/wireless/ath/ath9k/ath9k.h
index b42f4a9..4616229 100644
--- a/drivers/net/wireless/ath/ath9k/ath9k.h
+++ b/drivers/net/wireless/ath/ath9k/ath9k.h
@@ -37,6 +37,7 @@ extern int ath9k_modparam_nohwcrypt;
 extern int ath9k_led_blink;
 extern bool is_ath9k_unloaded;
 extern int ath9k_use_chanctx;
+extern int ath9k_sta_ap_ratio;
 
 /*************************/
 /* Descriptor Management */
@@ -335,6 +336,7 @@ struct ath_chanctx {
 	struct timespec tsf_ts;
 	u64 tsf_val;
 	u32 last_beacon;
+	u32 ctwindow;
 
 	int flush_timeout;
 	u16 txpower;
diff --git a/drivers/net/wireless/ath/ath9k/channel.c b/drivers/net/wireless/ath/ath9k/channel.c
index 4320928..b0d74f0 100644
--- a/drivers/net/wireless/ath/ath9k/channel.c
+++ b/drivers/net/wireless/ath/ath9k/channel.c
@@ -313,11 +313,21 @@ ath_chanctx_get_next(struct ath_softc *sc, struct ath_chanctx *ctx)
 	return &sc->chanctx[!idx];
 }
 
+static u32 get_ratio(u32 beacon_int)
+{
+	if (ath9k_sta_ap_ratio < 20 ||
+	    ath9k_sta_ap_ratio > 80)
+		return beacon_int / 2;
+
+	return (beacon_int * ath9k_sta_ap_ratio) / 100;
+}
+
 static void ath_chanctx_adjust_tbtt_delta(struct ath_softc *sc)
 {
+	struct ath_common *common = ath9k_hw_common(sc->sc_ah);
 	struct ath_chanctx *prev, *cur;
 	struct timespec ts;
-	u32 cur_tsf, prev_tsf, beacon_int;
+	u32 cur_tsf, prev_tsf, beacon_int, diff;
 	s32 offset;
 
 	beacon_int = TU_TO_USEC(sc->cur_chan->beacon.beacon_interval);
@@ -344,7 +354,14 @@ static void ath_chanctx_adjust_tbtt_delta(struct ath_softc *sc)
 	if (offset < 0 || offset > 3 * beacon_int)
 		return;
 
-	offset = beacon_int / 2 - (offset % beacon_int);
+	diff = 2 * prev->ctwindow;
+	diff += sc->sched.channel_switch_time;
+	if (diff > beacon_int / 2)
+		diff = beacon_int / 2;
+
+	ath_dbg(common, CHAN_CTX, "Setup beacon interval offset %u ms\n",
+		diff / 1000);
+	offset = diff - (offset % beacon_int);
 	prev->tsf_val += offset;
 }
 
@@ -435,7 +452,7 @@ static void ath_chanctx_set_periodic_noa(struct ath_softc *sc,
 			sc->sched.channel_switch_time;
 	else
 		avp->noa_duration =
-			TU_TO_USEC(cur_conf->beacon_interval) / 2 +
+			TU_TO_USEC(get_ratio(cur_conf->beacon_interval)) +
 			sc->sched.channel_switch_time;
 
 	if (test_bit(ATH_OP_SCANNING, &common->op_flags) ||
@@ -481,7 +498,8 @@ void ath_chanctx_event(struct ath_softc *sc, struct ieee80211_vif *vif,
 	struct ath_beacon_config *cur_conf;
 	struct ath_vif *avp = NULL;
 	struct ath_chanctx *ctx;
-	u32 tsf_time;
+	u32 tsf_time, defer_time;
+	u32 beacon_resp_time = ah->config.sw_beacon_response_time;
 	u32 beacon_int;
 
 	if (vif)
@@ -565,10 +583,26 @@ void ath_chanctx_event(struct ath_softc *sc, struct ieee80211_vif *vif,
 		cur_conf = &sc->cur_chan->beacon;
 		beacon_int = TU_TO_USEC(cur_conf->beacon_interval);
 
-		/* defer channel switch by a quarter beacon interval */
-		tsf_time = sc->sched.next_tbtt + beacon_int / 4;
+		/* defer channel switch */
+		defer_time = beacon_int - get_ratio(beacon_int);
+		defer_time -= sc->sched.channel_switch_time;
+		defer_time /= 2;
+
+		if (defer_time < TU_TO_USEC(2 + beacon_resp_time)) {
+			defer_time *= 2;
+			if (defer_time > TU_TO_USEC(3 + beacon_resp_time))
+				defer_time -= TU_TO_USEC(3 + beacon_resp_time);
+			else
+				defer_time = 1000;
+		}
+
+		ath_dbg(common, CHAN_CTX, "Setup defer_time %u (%u ms)\n",
+			defer_time, defer_time / 1000);
+
+		tsf_time = sc->sched.next_tbtt + defer_time;
 		sc->sched.switch_start_time = tsf_time;
 		sc->cur_chan->last_beacon = sc->sched.next_tbtt;
+		sc->cur_chan->ctwindow = defer_time;
 
 		/*
 		 * If an offchannel switch is scheduled to happen after
@@ -707,7 +741,7 @@ void ath_chanctx_event(struct ath_softc *sc, struct ieee80211_vif *vif,
 		sc->sched.state = ATH_CHANCTX_STATE_WAIT_FOR_TIMER;
 		sc->sched.wait_switch = false;
 
-		tsf_time = TU_TO_USEC(cur_conf->beacon_interval) / 2;
+		tsf_time = TU_TO_USEC(get_ratio(cur_conf->beacon_interval));
 
 		if (sc->sched.extend_absence) {
 			sc->sched.beacon_miss = 0;
@@ -1454,26 +1488,13 @@ static void ath9k_update_p2p_ps(struct ath_softc *sc, struct ieee80211_vif *vif)
 
 static u8 ath9k_get_ctwin(struct ath_softc *sc, struct ath_vif *avp)
 {
-	struct ath_beacon_config *cur_conf = &sc->cur_chan->beacon;
-	u8 switch_time, ctwin;
-
 	/*
 	 * Channel switch in multi-channel mode is deferred
-	 * by a quarter beacon interval when handling
-	 * ATH_CHANCTX_EVENT_BEACON_PREPARE, so the P2P-GO
-	 * interface is guaranteed to be discoverable
-	 * for that duration after a TBTT.
+	 * when handling ATH_CHANCTX_EVENT_BEACON_PREPARE,
+	 * so the P2P-GO interface is guaranteed to be
+	 * discoverable for that duration after a TBTT.
 	 */
-	switch_time = cur_conf->beacon_interval / 4;
-
-	ctwin = avp->vif->bss_conf.p2p_noa_attr.oppps_ctwindow;
-	if (ctwin && (ctwin < switch_time))
-		return ctwin;
-
-	if (switch_time < P2P_DEFAULT_CTWIN)
-		return 0;
-
-	return P2P_DEFAULT_CTWIN;
+	return USEC_TO_TU(sc->cur_chan->ctwindow);
 }
 
 void ath9k_beacon_add_noa(struct ath_softc *sc, struct ath_vif *avp,
diff --git a/drivers/net/wireless/ath/ath9k/hw.h b/drivers/net/wireless/ath/ath9k/hw.h
index 4f0a3f6..7528f00 100644
--- a/drivers/net/wireless/ath/ath9k/hw.h
+++ b/drivers/net/wireless/ath/ath9k/hw.h
@@ -193,6 +193,7 @@
 #define INIT_BCON_CNTRL_REG         0x00000000
 
 #define TU_TO_USEC(_tu)             ((_tu) << 10)
+#define USEC_TO_TU(_us)             ((_us) >> 10)
 
 #define ATH9K_HW_RX_HP_QDEPTH	16
 #define ATH9K_HW_RX_LP_QDEPTH	128
diff --git a/drivers/net/wireless/ath/ath9k/init.c b/drivers/net/wireless/ath/ath9k/init.c
index 2e2b92b..6729a5f 100644
--- a/drivers/net/wireless/ath/ath9k/init.c
+++ b/drivers/net/wireless/ath/ath9k/init.c
@@ -67,6 +67,9 @@ int ath9k_use_chanctx;
 module_param_named(use_chanctx, ath9k_use_chanctx, int, 0444);
 MODULE_PARM_DESC(use_chanctx, "Enable channel context for concurrency");
 
+int ath9k_sta_ap_ratio;
+module_param_named(sta_ap_ratio, ath9k_sta_ap_ratio, int, 0444);
+MODULE_PARM_DESC(sta_ap_ratio, "sta/ap ratio 20-80");
 #endif /* CONFIG_ATH9K_CHANNEL_CONTEXT */
 
 bool is_ath9k_unloaded;
-- 
1.9.1

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

* [PATCH 12/12] ath9k: MCC, print time elapsed between events
  2015-11-12 13:15 ` [ath9k-devel] " Janusz Dziedzic
@ 2015-11-12 13:15   ` Janusz Dziedzic
  -1 siblings, 0 replies; 28+ messages in thread
From: Janusz Dziedzic @ 2015-11-12 13:15 UTC (permalink / raw)
  To: linux-wireless; +Cc: ath9k-devel, Janusz Dziedzic

This is useful for MCC debugging and bug fixing.

Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
---
 drivers/net/wireless/ath/ath9k/ath9k.h   |  1 +
 drivers/net/wireless/ath/ath9k/channel.c | 19 +++++++++++++++++--
 2 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/ath9k.h b/drivers/net/wireless/ath/ath9k/ath9k.h
index 4616229..952a467 100644
--- a/drivers/net/wireless/ath/ath9k/ath9k.h
+++ b/drivers/net/wireless/ath/ath9k/ath9k.h
@@ -983,6 +983,7 @@ struct ath_softc {
 	struct ath_offchannel offchannel;
 	struct ath_chanctx *next_chan;
 	struct completion go_beacon;
+	struct timespec last_event_time;
 #endif
 
 	unsigned long driver_data;
diff --git a/drivers/net/wireless/ath/ath9k/channel.c b/drivers/net/wireless/ath/ath9k/channel.c
index b0d74f0..d6b1076 100644
--- a/drivers/net/wireless/ath/ath9k/channel.c
+++ b/drivers/net/wireless/ath/ath9k/channel.c
@@ -226,6 +226,20 @@ static const char *chanctx_state_string(enum ath_chanctx_state state)
 	}
 }
 
+static const u32 chanctx_event_delta(struct ath_softc *sc)
+{
+	u64 ms;
+	struct timespec ts, *old;
+
+	getrawmonotonic(&ts);
+	old = &sc->last_event_time;
+	ms = ts.tv_sec * 1000 + ts.tv_nsec / 1000000;
+	ms -= old->tv_sec * 1000 + old->tv_nsec / 1000000;
+	sc->last_event_time = ts;
+
+	return (u32)ms;
+}
+
 void ath_chanctx_check_active(struct ath_softc *sc, struct ath_chanctx *ctx)
 {
 	struct ath_common *common = ath9k_hw_common(sc->sc_ah);
@@ -507,10 +521,11 @@ void ath_chanctx_event(struct ath_softc *sc, struct ieee80211_vif *vif,
 
 	spin_lock_bh(&sc->chan_lock);
 
-	ath_dbg(common, CHAN_CTX, "cur_chan: %d MHz, event: %s, state: %s\n",
+	ath_dbg(common, CHAN_CTX, "cur_chan: %d MHz, event: %s, state: %s, delta: %u ms\n",
 		sc->cur_chan->chandef.center_freq1,
 		chanctx_event_string(ev),
-		chanctx_state_string(sc->sched.state));
+		chanctx_state_string(sc->sched.state),
+		chanctx_event_delta(sc));
 
 	switch (ev) {
 	case ATH_CHANCTX_EVENT_BEACON_PREPARE:
-- 
1.9.1


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

* [ath9k-devel] [PATCH 12/12] ath9k: MCC, print time elapsed between events
@ 2015-11-12 13:15   ` Janusz Dziedzic
  0 siblings, 0 replies; 28+ messages in thread
From: Janusz Dziedzic @ 2015-11-12 13:15 UTC (permalink / raw)
  To: ath9k-devel

This is useful for MCC debugging and bug fixing.

Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
---
 drivers/net/wireless/ath/ath9k/ath9k.h   |  1 +
 drivers/net/wireless/ath/ath9k/channel.c | 19 +++++++++++++++++--
 2 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/ath9k.h b/drivers/net/wireless/ath/ath9k/ath9k.h
index 4616229..952a467 100644
--- a/drivers/net/wireless/ath/ath9k/ath9k.h
+++ b/drivers/net/wireless/ath/ath9k/ath9k.h
@@ -983,6 +983,7 @@ struct ath_softc {
 	struct ath_offchannel offchannel;
 	struct ath_chanctx *next_chan;
 	struct completion go_beacon;
+	struct timespec last_event_time;
 #endif
 
 	unsigned long driver_data;
diff --git a/drivers/net/wireless/ath/ath9k/channel.c b/drivers/net/wireless/ath/ath9k/channel.c
index b0d74f0..d6b1076 100644
--- a/drivers/net/wireless/ath/ath9k/channel.c
+++ b/drivers/net/wireless/ath/ath9k/channel.c
@@ -226,6 +226,20 @@ static const char *chanctx_state_string(enum ath_chanctx_state state)
 	}
 }
 
+static const u32 chanctx_event_delta(struct ath_softc *sc)
+{
+	u64 ms;
+	struct timespec ts, *old;
+
+	getrawmonotonic(&ts);
+	old = &sc->last_event_time;
+	ms = ts.tv_sec * 1000 + ts.tv_nsec / 1000000;
+	ms -= old->tv_sec * 1000 + old->tv_nsec / 1000000;
+	sc->last_event_time = ts;
+
+	return (u32)ms;
+}
+
 void ath_chanctx_check_active(struct ath_softc *sc, struct ath_chanctx *ctx)
 {
 	struct ath_common *common = ath9k_hw_common(sc->sc_ah);
@@ -507,10 +521,11 @@ void ath_chanctx_event(struct ath_softc *sc, struct ieee80211_vif *vif,
 
 	spin_lock_bh(&sc->chan_lock);
 
-	ath_dbg(common, CHAN_CTX, "cur_chan: %d MHz, event: %s, state: %s\n",
+	ath_dbg(common, CHAN_CTX, "cur_chan: %d MHz, event: %s, state: %s, delta: %u ms\n",
 		sc->cur_chan->chandef.center_freq1,
 		chanctx_event_string(ev),
-		chanctx_state_string(sc->sched.state));
+		chanctx_state_string(sc->sched.state),
+		chanctx_event_delta(sc));
 
 	switch (ev) {
 	case ATH_CHANCTX_EVENT_BEACON_PREPARE:
-- 
1.9.1

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

* Re: [PATCH 09/12] ath9k: request NOA update when chanctx active
  2015-11-12 13:15   ` [ath9k-devel] " Janusz Dziedzic
@ 2015-11-12 14:09     ` kbuild test robot
  -1 siblings, 0 replies; 28+ messages in thread
From: kbuild test robot @ 2015-11-12 13:59 UTC (permalink / raw)
  To: Janusz Dziedzic; +Cc: kbuild-all, linux-wireless, ath9k-devel, Janusz Dziedzic

[-- Attachment #1: Type: text/plain, Size: 1552 bytes --]

Hi Janusz,

[auto build test ERROR on wireless-drivers-next/master]
[also build test ERROR on v4.3 next-20151112]

url:    https://github.com/0day-ci/linux/commits/Janusz-Dziedzic/ath9k-add-debug-messages-to-aggr-chanctx-funcs/20151112-212004
base:   https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/wireless-drivers-next.git master
config: i386-allmodconfig (attached as .config)
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

All errors (new ones prefixed by >>):

   drivers/net/wireless/ath/ath9k/main.c: In function 'ath9k_add_interface':
>> drivers/net/wireless/ath/ath9k/main.c:1255:24: error: 'IEEE80211_VIF_GET_NOA_UPDATE' undeclared (first use in this function)
      vif->driver_flags |= IEEE80211_VIF_GET_NOA_UPDATE;
                           ^
   drivers/net/wireless/ath/ath9k/main.c:1255:24: note: each undeclared identifier is reported only once for each function it appears in

vim +/IEEE80211_VIF_GET_NOA_UPDATE +1255 drivers/net/wireless/ath/ath9k/main.c

  1249		}
  1250	
  1251		ath_dbg(common, CONFIG, "Attach a VIF of type: %d\n", vif->type);
  1252		sc->cur_chan->nvifs++;
  1253	
  1254		if (vif->type == NL80211_IFTYPE_STATION && ath9k_is_chanctx_enabled())
> 1255			vif->driver_flags |= IEEE80211_VIF_GET_NOA_UPDATE;
  1256	
  1257		if (ath9k_uses_beacons(vif->type))
  1258			ath9k_beacon_assign_slot(sc, vif);

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/octet-stream, Size: 51725 bytes --]

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

* [ath9k-devel] [PATCH 09/12] ath9k: request NOA update when chanctx active
@ 2015-11-12 14:09     ` kbuild test robot
  0 siblings, 0 replies; 28+ messages in thread
From: kbuild test robot @ 2015-11-12 14:09 UTC (permalink / raw)
  To: ath9k-devel

Hi Janusz,

[auto build test ERROR on wireless-drivers-next/master]
[also build test ERROR on v4.3 next-20151112]

url:    https://github.com/0day-ci/linux/commits/Janusz-Dziedzic/ath9k-add-debug-messages-to-aggr-chanctx-funcs/20151112-212004
base:   https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/wireless-drivers-next.git master
config: i386-allmodconfig (attached as .config)
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

All errors (new ones prefixed by >>):

   drivers/net/wireless/ath/ath9k/main.c: In function 'ath9k_add_interface':
>> drivers/net/wireless/ath/ath9k/main.c:1255:24: error: 'IEEE80211_VIF_GET_NOA_UPDATE' undeclared (first use in this function)
      vif->driver_flags |= IEEE80211_VIF_GET_NOA_UPDATE;
                           ^
   drivers/net/wireless/ath/ath9k/main.c:1255:24: note: each undeclared identifier is reported only once for each function it appears in

vim +/IEEE80211_VIF_GET_NOA_UPDATE +1255 drivers/net/wireless/ath/ath9k/main.c

  1249		}
  1250	
  1251		ath_dbg(common, CONFIG, "Attach a VIF of type: %d\n", vif->type);
  1252		sc->cur_chan->nvifs++;
  1253	
  1254		if (vif->type == NL80211_IFTYPE_STATION && ath9k_is_chanctx_enabled())
> 1255			vif->driver_flags |= IEEE80211_VIF_GET_NOA_UPDATE;
  1256	
  1257		if (ath9k_uses_beacons(vif->type))
  1258			ath9k_beacon_assign_slot(sc, vif);

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/octet-stream
Size: 51725 bytes
Desc: not available
Url : http://lists.ath9k.org/pipermail/ath9k-devel/attachments/20151112/075f427b/attachment-0001.obj 

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

* Re: [PATCH 05/12] ath9k: use u32 when calculate tsf
  2015-11-12 13:15   ` [ath9k-devel] " Janusz Dziedzic
@ 2015-11-12 19:51     ` Kalle Valo
  -1 siblings, 0 replies; 28+ messages in thread
From: Kalle Valo @ 2015-11-12 19:51 UTC (permalink / raw)
  To: Janusz Dziedzic; +Cc: linux-wireless, ath9k-devel

Janusz Dziedzic <janusz.dziedzic@tieto.com> writes:

> Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>

Why? And no empty commit logs, please.

-- 
Kalle Valo

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

* [ath9k-devel] [PATCH 05/12] ath9k: use u32 when calculate tsf
@ 2015-11-12 19:51     ` Kalle Valo
  0 siblings, 0 replies; 28+ messages in thread
From: Kalle Valo @ 2015-11-12 19:51 UTC (permalink / raw)
  To: ath9k-devel

Janusz Dziedzic <janusz.dziedzic@tieto.com> writes:

> Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>

Why? And no empty commit logs, please.

-- 
Kalle Valo

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

end of thread, other threads:[~2015-11-12 19:51 UTC | newest]

Thread overview: 28+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-12 13:15 [PATCH 01/12] ath9k: add debug messages to aggr/chanctx funcs Janusz Dziedzic
2015-11-12 13:15 ` [ath9k-devel] " Janusz Dziedzic
2015-11-12 13:15 ` [PATCH 02/12] ath9k: print real timer value Janusz Dziedzic
2015-11-12 13:15   ` [ath9k-devel] " Janusz Dziedzic
2015-11-12 13:15 ` [PATCH 03/12] ath9k: queue null frames in case of MCC Janusz Dziedzic
2015-11-12 13:15   ` [ath9k-devel] " Janusz Dziedzic
2015-11-12 13:15 ` [PATCH 04/12] ath9k: P2P_CLIENT, send frames after 1ms AP/GO will aprear Janusz Dziedzic
2015-11-12 13:15   ` [ath9k-devel] " Janusz Dziedzic
2015-11-12 13:15 ` [PATCH 05/12] ath9k: use u32 when calculate tsf Janusz Dziedzic
2015-11-12 13:15   ` [ath9k-devel] " Janusz Dziedzic
2015-11-12 19:51   ` Kalle Valo
2015-11-12 19:51     ` [ath9k-devel] " Kalle Valo
2015-11-12 13:15 ` [PATCH 06/12] ath9k: setup correct skb priority for nullfunc Janusz Dziedzic
2015-11-12 13:15   ` [ath9k-devel] " Janusz Dziedzic
2015-11-12 13:15 ` [PATCH 07/12] ath9k: MCC enable Opportunistic Power Save Janusz Dziedzic
2015-11-12 13:15   ` [ath9k-devel] " Janusz Dziedzic
2015-11-12 13:15 ` [PATCH 08/12] ath9k: P2P_CLIENT, get/set NOA correctly Janusz Dziedzic
2015-11-12 13:15   ` [ath9k-devel] " Janusz Dziedzic
2015-11-12 13:15 ` [PATCH 09/12] ath9k: request NOA update when chanctx active Janusz Dziedzic
2015-11-12 13:15   ` [ath9k-devel] " Janusz Dziedzic
2015-11-12 13:59   ` kbuild test robot
2015-11-12 14:09     ` [ath9k-devel] " kbuild test robot
2015-11-12 13:15 ` [PATCH 10/12] ath9k: MCC, add NOA also in case of an AP Janusz Dziedzic
2015-11-12 13:15   ` [ath9k-devel] " Janusz Dziedzic
2015-11-12 13:15 ` [PATCH 11/12] ath9k: MCC add sta_ap_ratio module param Janusz Dziedzic
2015-11-12 13:15   ` [ath9k-devel] " Janusz Dziedzic
2015-11-12 13:15 ` [PATCH 12/12] ath9k: MCC, print time elapsed between events Janusz Dziedzic
2015-11-12 13:15   ` [ath9k-devel] " Janusz Dziedzic

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.