ath9k: add debug messages to aggr/chanctx funcs
PATCH 1/12 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
@@ -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
@@ -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
@@ -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
PATCH 2/12 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
@@ -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
PATCH 3/12 ath9k: queue null frames in case of MCC
In reply to Janusz DziedzicWhile 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
@@ -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
PATCH 4/12 ath9k: P2P_CLIENT, send frames after 1ms AP/GO will aprear
In reply to Janusz DziedzicAP/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
@@ -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
PATCH 5/12 ath9k: use u32 when calculate tsf
In reply to Janusz Dziedzic--- drivers/net/wireless/ath/ath9k/channel.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/ath/ath9k/channel.c +1 -1
@@ -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 ;
Signature · 1 line
1.9.1
PATCH 5/12 ath9k: use u32 when calculate tsf
Quoted 1 line · Janusz Dziedzic
Signed-off-by Janusz Dziedzic <[email protected]>
Why? And no empty commit logs, please.
Signature · 1 line
Kalle Valo
PATCH 6/12 ath9k: setup correct skb priority for nullfunc
In reply to Janusz DziedzicAfter 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
@@ -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
PATCH 7/12 ath9k: MCC enable Opportunistic Power Save
In reply to Janusz DziedzicWhen adding NOA attr enable Opportunistiv 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
@@ -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
PATCH 8/12 ath9k: P2P_CLIENT, get/set NOA correctly
In reply to Janusz DziedzicIn 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
@@ -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
PATCH 9/12 ath9k: request NOA update when chanctx active
In reply to Janusz DziedzicRequest NOA update when chanctx active, also in case of STA.
---
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(-)
drivers/net/wireless/ath/ath9k/channel.c +1 -1
@@ -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
@@ -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
kbuild test robot
build bot[ath9k-devel] [PATCH 09/12] ath9k: request NOA update when chanctx active
reproduce:
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
PATCH 10/12 ath9k: MCC, add NOA also in case of an AP
In reply to Janusz DziedzicIn 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
@@ -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
PATCH 11/12 ath9k: MCC add sta_ap_ratio module param
In reply to Janusz DziedzicIn 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
@@ -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
@@ -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
@@ -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
PATCH 12/12 ath9k: MCC, print time elapsed between events
In reply to Janusz DziedzicThis 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
@@ -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
@@ -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