Skip to contentSkip to conversation

ath9k: add debug messages to aggr/chanctx funcs

PATCH New Janusz Dziedzic 2 participants 18 messages Nov 27, 2015 – Jan 28, 2016 Qualcomm Atheros ATH9K wireless driver

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/13 ath9k: add debug messages to aggr/chanctx funcs

Add/extend debug messages when chanctx used.

---
 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(-)
drivers/net/wireless/ath/ath9k/channel.c +8 -3
index 90f5773..35802c9 100644
@@ -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);
 }
 
drivers/net/wireless/ath/ath9k/hw.c +4 -4
index bdfff46..4af19e4 100644
@@ -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);
 
drivers/net/wireless/ath/ath9k/xmit.c +15 -0
index 3e3dac3..26698a6 100644
@@ -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;
Signature · 1 line
1.9.1
#1 lore raw

PATCH v2 2/13 ath9k: print real timer value

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

---
 drivers/net/wireless/ath/ath9k/channel.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/net/wireless/ath/ath9k/channel.c +5 -3
index 35802c9..dddaaea 100644
@@ -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,
Signature · 1 line
1.9.1
#2 lore raw

PATCH v2 3/13 ath9k: queue null frames in case of MCC

In reply to 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.

---
 drivers/net/wireless/ath/ath9k/xmit.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/net/wireless/ath/ath9k/xmit.c +6 -0
index 26698a6..82fc76f 100644
@@ -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.
Signature · 1 line
1.9.1
#3 lore raw

PATCH v2 4/13 ath9k: P2P_CLIENT, send frames after 1ms AP/GO will aprear

In reply to Janusz Dziedzic

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

---
 drivers/net/wireless/ath/ath9k/channel.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/net/wireless/ath/ath9k/channel.c +4 -0
index dddaaea..5640e88 100644
@@ -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))
Signature · 1 line
1.9.1
#4 lore raw

PATCH v2 5/13 ath9k: use u32 when calculate tsf

In reply to Janusz Dziedzic

Use u32 while ath9k_hw_gettsf32() and
ath9k_hw_gen_timer_start() require u32.

---
 drivers/net/wireless/ath/ath9k/channel.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/wireless/ath/ath9k/channel.c +2 -2
index 5640e88..28bbbef 100644
@@ -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;
@@ -1427,7 +1427,7 @@ static void ath9k_update_p2p_ps_timer(struct ath_softc *sc, struct ath_vif *avp)
 		__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);
+	ath9k_hw_gen_timer_start(ah, sc->p2p_ps_timer, target_tsf, 1000000);
 }
 
 static void ath9k_update_p2p_ps(struct ath_softc *sc, struct ieee80211_vif *vif)
Signature · 1 line
1.9.1
#5 lore raw

PATCH v2 6/13 ath9k: setup correct skb priority for nullfunc

In reply to Janusz Dziedzic

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

---
 drivers/net/wireless/ath/ath9k/channel.c | 1 +
 1 file changed, 1 insertion(+)
drivers/net/wireless/ath/ath9k/channel.c +1 -0
index 28bbbef..2afb8da 100644
@@ -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);
Signature · 1 line
1.9.1
#6 lore raw

PATCH v2 7/13 ath9k: MCC enable Opportunistic Power Save

In reply to Janusz Dziedzic

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

---
 drivers/net/wireless/ath/ath9k/channel.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/net/wireless/ath/ath9k/channel.c +2 -0
index 2afb8da..31b4d0e 100644
@@ -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) {
Signature · 1 line
1.9.1
#7 lore raw

PATCH v2 8/13 ath9k: P2P_CLIENT, get/set NOA correctly

In reply to 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.

---
 drivers/net/wireless/ath/ath9k/channel.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/net/wireless/ath/ath9k/channel.c +5 -2
index 31b4d0e..5a1ede6 100644
@@ -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);
 }
Signature · 1 line
1.9.1
#8 lore raw

PATCH v2 9/13 ath9k: request NOA update when chanctx active

In reply to Janusz Dziedzic

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

---
This depends on:
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(-)
drivers/net/wireless/ath/ath9k/channel.c +1 -1
index 5a1ede6..c94d7d9 100644
@@ -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;
drivers/net/wireless/ath/ath9k/main.c +4 -1
index d184e68..ab46a4d 100644
@@ -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);
 
Signature · 1 line
1.9.1
#9 lore raw

PATCH v2 9/13 ath9k: request NOA update when chanctx active

Quoted 7 lines · Janusz Dziedzic

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

---
This depends on:
mac80211: add new IEEE80211_VIF_GET_NOA_UPDATE flag

It would make my life a lot easier if you could submit patches like this (which depend on something else) in a separate patchset instead of hiding them inside a 13 patch set. I'll postpone this patch for now and apply it once I have the mac80211 commit.

Signature · 1 line
Kalle Valo
#10 lore raw

PATCH v2 9/13 ath9k: request NOA update when chanctx active

In reply to Janusz Dziedzic
Quoted 7 lines · Janusz Dziedzic

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

---
This depends on:
mac80211: add new IEEE80211_VIF_GET_NOA_UPDATE flag

The dependency is now in ath.git and I have applied this, thanks.

Signature · 1 line
Kalle Valo
#11 lore raw

PATCH v2 10/13 ath9k: MCC, add NOA also in case of an AP

In reply to 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.

---
 drivers/net/wireless/ath/ath9k/beacon.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/wireless/ath/ath9k/beacon.c +2 -1
index f50a6bc..5cf0cd7 100644
@@ -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,
Signature · 1 line
1.9.1
#12 lore raw

PATCH v2 11/13 ath9k: MCC add sta_ap_ratio module param

In reply to 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.

---
 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(-)
drivers/net/wireless/ath/ath9k/ath9k.h +2 -0
index b42f4a9..4616229 100644
@@ -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;
drivers/net/wireless/ath/ath9k/channel.c +45 -24

120 lines not on this page · raw message

drivers/net/wireless/ath/ath9k/hw.h +1 -0
index 4f0a3f6..7528f00 100644
@@ -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
drivers/net/wireless/ath/ath9k/init.c +3 -0
index 2e2b92b..6729a5f 100644
@@ -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;
Signature · 1 line
1.9.1
#13 lore raw

PATCH v2 11/13 ath9k: MCC add sta_ap_ratio module param

Quoted 6 lines · 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.

Why? What's the use case?

And isn't there a better way to do this? Like using nl80211 (via wpasupplicant?) or debugfs?

Signature · 1 line
Kalle Valo
#14 lore raw

PATCH v2 11/13 ath9k: MCC add sta_ap_ratio module param

Quoted 11 lines · Kalle Valo
Quoted 6 lines · 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.

Why? What's the use case?

By default beacon_int/2 is used in current implementation. This patch was developed as a proof of concept in case we would like to use MCC and need change this 50/50.
Eg, for some reason we need higher BW/ more air time for STA or AP - depends on case.
For my case STA connection to Gateway was more important that clients connected to an AP - so just used
70/30.

Quoted 3 lines

And isn't there a better way to do this? Like using nl80211 (via wpasupplicant?) or debugfs?

I wasn't sure here, but maybe some prio param on the VIF could be used here? Eg.
VIF1 - prio 50
VIF2 - prio 100

VIF1_time = 50 / (50 + 100) = 33%
VIF2_time = 100 / (50 + 100) = 66%

with some default prio eg. 100.
But for sure this is more work, and I am not sure someone else will need this?

BR
Janusz

Quoted 2 lines

--
Kalle Valo

#15 lore raw

PATCH v2 12/13 ath9k: MCC, print time elapsed between events

In reply to Janusz Dziedzic

This is useful for MCC debugging and bug fixing.

---
 drivers/net/wireless/ath/ath9k/ath9k.h   |  1 +
 drivers/net/wireless/ath/ath9k/channel.c | 19 +++++++++++++++++--
 2 files changed, 18 insertions(+), 2 deletions(-)
drivers/net/wireless/ath/ath9k/ath9k.h +1 -0
index 4616229..952a467 100644
@@ -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;
drivers/net/wireless/ath/ath9k/channel.c +17 -2
index 8ab856c..65ad7be 100644
@@ -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:
Signature · 1 line
1.9.1
#16 lore raw

PATCH v2 13/13 ath9k: remove ath9k_mod_tsf64_tu

In reply to Janusz Dziedzic

Remove ath9k_mod_tsf64_tu() function while we could use div_u64_rem() function.

---
 drivers/net/wireless/ath/ath9k/common-beacon.c | 22 ++++------------------
 1 file changed, 4 insertions(+), 18 deletions(-)
drivers/net/wireless/ath/ath9k/common-beacon.c +4 -18
index 6ad4447..01d6d32 100644
@@ -18,30 +18,16 @@
 
 #define FUDGE 2
 
-/* Calculate the modulo of a 64 bit TSF snapshot with a TU divisor */
-static u32 ath9k_mod_tsf64_tu(u64 tsf, u32 div_tu)
-{
-	u32 tsf_mod, tsf_hi, tsf_lo, mod_hi, mod_lo;
-
-	tsf_mod = tsf & (BIT(10) - 1);
-	tsf_hi = tsf >> 32;
-	tsf_lo = ((u32) tsf) >> 10;
-
-	mod_hi = tsf_hi % div_tu;
-	mod_lo = ((mod_hi << 22) + tsf_lo) % div_tu;
-
-	return (mod_lo << 10) | tsf_mod;
-}
-
 static u32 ath9k_get_next_tbtt(struct ath_hw *ah, u64 tsf,
 			       unsigned int interval)
 {
-	unsigned int offset;
+	unsigned int offset, divisor;
 
 	tsf += TU_TO_USEC(FUDGE + ah->config.sw_beacon_response_time);
-	offset = ath9k_mod_tsf64_tu(tsf, interval);
+	divisor = TU_TO_USEC(interval);
+	div_u64_rem(tsf, divisor, &offset);
 
-	return (u32) tsf + TU_TO_USEC(interval) - offset;
+	return (u32) tsf + divisor - offset;
 }
 
 /*
Signature · 1 line
1.9.1
#17 lore raw

PATCH v2 1/13 ath9k: add debug messages to aggr/chanctx funcs

In reply to Janusz Dziedzic
Quoted 3 lines · Janusz Dziedzic

Add/extend debug messages when chanctx used.

Manually applied these patches to ath.git:

05a85a6c42b5 ath9k: remove ath9k_mod_tsf64_tu
02edab5b5f82 ath9k: MCC, print time elapsed between events a64d876ef7dc ath9k: MCC, add NOA also in case of an AP b10b7fb31a21 ath9k: P2P_CLIENT, get/set NOA correctly 3edbf0ba0494 ath9k: MCC enable Opportunistic Power Save c1b7bea038f0 ath9k: setup correct skb priority for nullfunc 631c45f41957 ath9k: use u32 when calculate tsf
b77b59ae8acd ath9k: P2P_CLIENT, send frames after 1ms AP/GO will aprear 60337ed86306 ath9k: queue null frames in case of MCC 2f985539b98b ath9k: print real timer value
58bb9ca84c20 ath9k: add debug messages to aggr/chanctx funcs

These patches are still pending:

[v2,09/13] ath9k: request NOA update when chanctx active [v2,11/13] ath9k: MCC add sta_ap_ratio module param

Signature · 1 line
Kalle Valo