Skip to content

Commit 840c36f

Browse files
Carl HuangKalle Valo
authored andcommitted
ath11k: dp: stop rx pktlog before suspend
Stop dp rx pktlog when entering suspend and reap the mon_status buffer to keep it empty. During resume restart the reap timer. Tested-on: QCA6390 hw2.0 PCI WLAN.HST.1.0.1-01740-QCAHSTSWPLZ_V2_TO_X86-1 Signed-off-by: Carl Huang <[email protected]> Signed-off-by: Kalle Valo <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 8733d83 commit 840c36f

File tree

4 files changed

+56
-0
lines changed

4 files changed

+56
-0
lines changed

drivers/net/wireless/ath/ath11k/dp.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ struct dp_rx_tid {
4040

4141
#define DP_REO_DESC_FREE_THRESHOLD 64
4242
#define DP_REO_DESC_FREE_TIMEOUT_MS 1000
43+
#define DP_MON_PURGE_TIMEOUT_MS 100
4344
#define DP_MON_SERVICE_BUDGET 128
4445

4546
struct dp_reo_cache_flush_elem {

drivers/net/wireless/ath/ath11k/dp_rx.c

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,28 @@ static void ath11k_dp_service_mon_ring(struct timer_list *t)
274274
msecs_to_jiffies(ATH11K_MON_TIMER_INTERVAL));
275275
}
276276

277+
static int ath11k_dp_purge_mon_ring(struct ath11k_base *ab)
278+
{
279+
int i, reaped = 0;
280+
unsigned long timeout = jiffies + msecs_to_jiffies(DP_MON_PURGE_TIMEOUT_MS);
281+
282+
do {
283+
for (i = 0; i < ab->hw_params.num_rxmda_per_pdev; i++)
284+
reaped += ath11k_dp_rx_process_mon_rings(ab, i,
285+
NULL,
286+
DP_MON_SERVICE_BUDGET);
287+
288+
/* nothing more to reap */
289+
if (reaped < DP_MON_SERVICE_BUDGET)
290+
return 0;
291+
292+
} while (time_before(jiffies, timeout));
293+
294+
ath11k_warn(ab, "dp mon ring purge timeout");
295+
296+
return -ETIMEDOUT;
297+
}
298+
277299
/* Returns number of Rx buffers replenished */
278300
int ath11k_dp_rxbufs_replenish(struct ath11k_base *ab, int mac_id,
279301
struct dp_rxdma_ring *rx_ring,
@@ -5026,3 +5048,29 @@ int ath11k_dp_rx_pdev_mon_detach(struct ath11k *ar)
50265048
ath11k_dp_mon_link_free(ar);
50275049
return 0;
50285050
}
5051+
5052+
int ath11k_dp_rx_pktlog_start(struct ath11k_base *ab)
5053+
{
5054+
/* start reap timer */
5055+
mod_timer(&ab->mon_reap_timer,
5056+
jiffies + msecs_to_jiffies(ATH11K_MON_TIMER_INTERVAL));
5057+
5058+
return 0;
5059+
}
5060+
5061+
int ath11k_dp_rx_pktlog_stop(struct ath11k_base *ab, bool stop_timer)
5062+
{
5063+
int ret;
5064+
5065+
if (stop_timer)
5066+
del_timer_sync(&ab->mon_reap_timer);
5067+
5068+
/* reap all the monitor related rings */
5069+
ret = ath11k_dp_purge_mon_ring(ab);
5070+
if (ret) {
5071+
ath11k_warn(ab, "failed to purge dp mon ring: %d\n", ret);
5072+
return ret;
5073+
}
5074+
5075+
return 0;
5076+
}

drivers/net/wireless/ath/ath11k/dp_rx.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,4 +91,7 @@ int ath11k_dp_rx_pdev_mon_detach(struct ath11k *ar);
9191
int ath11k_dp_rx_pdev_mon_attach(struct ath11k *ar);
9292
int ath11k_peer_rx_frag_setup(struct ath11k *ar, const u8 *peer_mac, int vdev_id);
9393

94+
int ath11k_dp_rx_pktlog_start(struct ath11k_base *ab);
95+
int ath11k_dp_rx_pktlog_stop(struct ath11k_base *ab, bool stop_timer);
96+
9497
#endif /* ATH11K_DP_RX_H */

drivers/net/wireless/ath/ath11k/mac.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4146,6 +4146,10 @@ static int ath11k_mac_config_mon_status_default(struct ath11k *ar, bool enable)
41464146
&tlv_filter);
41474147
}
41484148

4149+
if (enable && !ar->ab->hw_params.rxdma1_enable)
4150+
mod_timer(&ar->ab->mon_reap_timer, jiffies +
4151+
msecs_to_jiffies(ATH11K_MON_TIMER_INTERVAL));
4152+
41494153
return ret;
41504154
}
41514155

0 commit comments

Comments
 (0)