Skip to content

Commit

Permalink
ath11k: dp: stop rx pktlog before suspend
Browse files Browse the repository at this point in the history
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 <cjhuang@codeaurora.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/1607708150-21066-7-git-send-email-kvalo@codeaurora.org
  • Loading branch information
Carl Huang authored and Kalle Valo committed Dec 12, 2020
1 parent 8733d83 commit 840c36f
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 0 deletions.
1 change: 1 addition & 0 deletions drivers/net/wireless/ath/ath11k/dp.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ struct dp_rx_tid {

#define DP_REO_DESC_FREE_THRESHOLD 64
#define DP_REO_DESC_FREE_TIMEOUT_MS 1000
#define DP_MON_PURGE_TIMEOUT_MS 100
#define DP_MON_SERVICE_BUDGET 128

struct dp_reo_cache_flush_elem {
Expand Down
48 changes: 48 additions & 0 deletions drivers/net/wireless/ath/ath11k/dp_rx.c
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,28 @@ static void ath11k_dp_service_mon_ring(struct timer_list *t)
msecs_to_jiffies(ATH11K_MON_TIMER_INTERVAL));
}

static int ath11k_dp_purge_mon_ring(struct ath11k_base *ab)
{
int i, reaped = 0;
unsigned long timeout = jiffies + msecs_to_jiffies(DP_MON_PURGE_TIMEOUT_MS);

do {
for (i = 0; i < ab->hw_params.num_rxmda_per_pdev; i++)
reaped += ath11k_dp_rx_process_mon_rings(ab, i,
NULL,
DP_MON_SERVICE_BUDGET);

/* nothing more to reap */
if (reaped < DP_MON_SERVICE_BUDGET)
return 0;

} while (time_before(jiffies, timeout));

ath11k_warn(ab, "dp mon ring purge timeout");

return -ETIMEDOUT;
}

/* Returns number of Rx buffers replenished */
int ath11k_dp_rxbufs_replenish(struct ath11k_base *ab, int mac_id,
struct dp_rxdma_ring *rx_ring,
Expand Down Expand Up @@ -5026,3 +5048,29 @@ int ath11k_dp_rx_pdev_mon_detach(struct ath11k *ar)
ath11k_dp_mon_link_free(ar);
return 0;
}

int ath11k_dp_rx_pktlog_start(struct ath11k_base *ab)
{
/* start reap timer */
mod_timer(&ab->mon_reap_timer,
jiffies + msecs_to_jiffies(ATH11K_MON_TIMER_INTERVAL));

return 0;
}

int ath11k_dp_rx_pktlog_stop(struct ath11k_base *ab, bool stop_timer)
{
int ret;

if (stop_timer)
del_timer_sync(&ab->mon_reap_timer);

/* reap all the monitor related rings */
ret = ath11k_dp_purge_mon_ring(ab);
if (ret) {
ath11k_warn(ab, "failed to purge dp mon ring: %d\n", ret);
return ret;
}

return 0;
}
3 changes: 3 additions & 0 deletions drivers/net/wireless/ath/ath11k/dp_rx.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,4 +91,7 @@ int ath11k_dp_rx_pdev_mon_detach(struct ath11k *ar);
int ath11k_dp_rx_pdev_mon_attach(struct ath11k *ar);
int ath11k_peer_rx_frag_setup(struct ath11k *ar, const u8 *peer_mac, int vdev_id);

int ath11k_dp_rx_pktlog_start(struct ath11k_base *ab);
int ath11k_dp_rx_pktlog_stop(struct ath11k_base *ab, bool stop_timer);

#endif /* ATH11K_DP_RX_H */
4 changes: 4 additions & 0 deletions drivers/net/wireless/ath/ath11k/mac.c
Original file line number Diff line number Diff line change
Expand Up @@ -4146,6 +4146,10 @@ static int ath11k_mac_config_mon_status_default(struct ath11k *ar, bool enable)
&tlv_filter);
}

if (enable && !ar->ab->hw_params.rxdma1_enable)
mod_timer(&ar->ab->mon_reap_timer, jiffies +
msecs_to_jiffies(ATH11K_MON_TIMER_INTERVAL));

return ret;
}

Expand Down

0 comments on commit 840c36f

Please sign in to comment.