--- a/drivers/net/wireless/ath/ath11k/dp_rx.c +++ b/drivers/net/wireless/ath/ath11k/dp_rx.c @@ -3289,12 +3289,17 @@ int ath11k_dp_rx_process_mon_status(stru enum hal_rx_mon_status hal_status; struct sk_buff *skb; struct sk_buff_head skb_list; - struct hal_rx_mon_ppdu_info ppdu_info; + struct hal_rx_mon_ppdu_info *ppdu_info; struct ath11k_peer *peer; struct ath11k_sta *arsta; int num_buffs_reaped = 0; u32 rx_buf_sz; u16 log_type = 0; + struct ath11k_mon_data *pmon = (struct ath11k_mon_data *)&ar->dp.mon_data; + struct ath11k_pdev_mon_stats *rx_mon_stats; + + ppdu_info = &pmon->mon_ppdu_info; + rx_mon_stats = &pmon->rx_mon_stats; __skb_queue_head_init(&skb_list); @@ -3304,8 +3309,8 @@ int ath11k_dp_rx_process_mon_status(stru goto exit; while ((skb = __skb_dequeue(&skb_list))) { - memset(&ppdu_info, 0, sizeof(ppdu_info)); - ppdu_info.peer_id = HAL_INVALID_PEERID; + memset(ppdu_info, 0, sizeof(*ppdu_info)); + ppdu_info->peer_id = HAL_INVALID_PEERID; if (ath11k_debug_is_pktlog_lite_mode_enabled(ar)) { log_type = ATH11K_PKTLOG_TYPE_LITE_RX; @@ -3321,9 +3326,18 @@ int ath11k_dp_rx_process_mon_status(stru log_type, rx_buf_sz); } - hal_status = ath11k_hal_rx_parse_mon_status(ab, &ppdu_info, skb); + hal_status = ath11k_hal_rx_parse_mon_status(ab, ppdu_info, skb); - if (ppdu_info.peer_id == HAL_INVALID_PEERID || + if ((ar->monitor_started) && + (hal_status == HAL_TLV_STATUS_PPDU_DONE) && + (pmon->mon_ppdu_status == DP_PPDU_STATUS_START)) { + rx_mon_stats->status_ppdu_done++; + pmon->mon_ppdu_status = DP_PPDU_STATUS_DONE; + ath11k_dp_rx_mon_dest_process(ar, budget, napi); + pmon->mon_ppdu_status = DP_PPDU_STATUS_START; + } + + if (ppdu_info->peer_id == HAL_INVALID_PEERID || hal_status != HAL_RX_MON_STATUS_PPDU_DONE) { dev_kfree_skb_any(skb); continue; @@ -3331,26 +3345,26 @@ int ath11k_dp_rx_process_mon_status(stru rcu_read_lock(); spin_lock_bh(&ab->base_lock); - peer = ath11k_peer_find_by_id(ab, ppdu_info.peer_id); + peer = ath11k_peer_find_by_id(ab, ppdu_info->peer_id); if (!peer || !peer->sta) { ath11k_dbg(ab, ATH11K_DBG_DATA, "failed to find the peer with peer_id %d\n", - ppdu_info.peer_id); + ppdu_info->peer_id); spin_unlock_bh(&ab->base_lock); rcu_read_unlock(); dev_kfree_skb_any(skb); continue; } - if ((ppdu_info.fc_valid) && - (ppdu_info.ast_index != HAL_AST_IDX_INVALID)) { - if (ppdu_info.reception_type == HAL_RX_RECEPTION_TYPE_SU) { + if ((ppdu_info->fc_valid) && + (ppdu_info->ast_index != HAL_AST_IDX_INVALID)) { + if (ppdu_info->reception_type == HAL_RX_RECEPTION_TYPE_SU) { arsta = (struct ath11k_sta *)peer->sta->drv_priv; - ath11k_dp_rx_update_peer_su_stats(arsta, &ppdu_info); + ath11k_dp_rx_update_peer_su_stats(arsta, ppdu_info); } else { - ath11k_dp_rx_mon_process_ulofdma(&ppdu_info); - ath11k_dp_rx_update_peer_mu_stats(ar, &ppdu_info); + ath11k_dp_rx_mon_process_ulofdma(ppdu_info); + ath11k_dp_rx_update_peer_mu_stats(ar, ppdu_info); } } @@ -5228,8 +5242,8 @@ mon_deliver_fail: return -EINVAL; } -static void ath11k_dp_rx_mon_dest_process(struct ath11k *ar, u32 quota, - struct napi_struct *napi) +void ath11k_dp_rx_mon_dest_process(struct ath11k *ar, u32 quota, + struct napi_struct *napi) { struct ath11k_pdev_dp *dp = &ar->dp; struct ath11k_mon_data *pmon = (struct ath11k_mon_data *)&dp->mon_data; @@ -5298,66 +5312,12 @@ static void ath11k_dp_rx_mon_dest_proces } } -static void ath11k_dp_rx_mon_status_process_tlv(struct ath11k *ar, - u32 quota, - struct napi_struct *napi) -{ - struct ath11k_pdev_dp *dp = &ar->dp; - struct ath11k_mon_data *pmon = (struct ath11k_mon_data *)&dp->mon_data; - struct hal_rx_mon_ppdu_info *ppdu_info; - struct sk_buff *status_skb; - u32 tlv_status = HAL_TLV_STATUS_BUF_DONE; - struct ath11k_pdev_mon_stats *rx_mon_stats; - - ppdu_info = &pmon->mon_ppdu_info; - rx_mon_stats = &pmon->rx_mon_stats; - - if (pmon->mon_ppdu_status != DP_PPDU_STATUS_START) - return; - - while (!skb_queue_empty(&pmon->rx_status_q)) { - status_skb = skb_dequeue(&pmon->rx_status_q); - - memset(ppdu_info, 0, sizeof(struct hal_rx_mon_ppdu_info)); - - tlv_status = ath11k_hal_rx_parse_mon_status(ar->ab, ppdu_info, - status_skb); - if (tlv_status == HAL_TLV_STATUS_PPDU_DONE) { - rx_mon_stats->status_ppdu_done++; - pmon->mon_ppdu_status = DP_PPDU_STATUS_DONE; - ath11k_dp_rx_mon_dest_process(ar, quota, napi); - pmon->mon_ppdu_status = DP_PPDU_STATUS_START; - } - dev_kfree_skb_any(status_skb); - } -} - -static int ath11k_dp_mon_process_rx(struct ath11k_base *ab, int mac_id, - struct napi_struct *napi, int budget) -{ - struct ath11k *ar = ab->pdevs[mac_id].ar; - struct ath11k_pdev_dp *dp = &ar->dp; - struct ath11k_mon_data *pmon = (struct ath11k_mon_data *)&dp->mon_data; - int num_buffs_reaped = 0; - - num_buffs_reaped = ath11k_dp_rx_reap_mon_status_ring(ar->ab, dp->mac_id, &budget, - &pmon->rx_status_q); - if (num_buffs_reaped) - ath11k_dp_rx_mon_status_process_tlv(ar, budget, napi); - - return num_buffs_reaped; -} - int ath11k_dp_rx_process_mon_rings(struct ath11k_base *ab, int mac_id, struct napi_struct *napi, int budget) { - struct ath11k *ar = ab->pdevs[mac_id].ar; int ret = 0; - if (ar->monitor_started) - ret = ath11k_dp_mon_process_rx(ab, mac_id, napi, budget); - else - ret = ath11k_dp_rx_process_mon_status(ab, mac_id, napi, budget); + ret = ath11k_dp_rx_process_mon_status(ab, mac_id, napi, budget); return ret; } --- a/drivers/net/wireless/ath/ath11k/dp_rx.h +++ b/drivers/net/wireless/ath/ath11k/dp_rx.h @@ -108,6 +108,8 @@ int ath11k_dp_rx_mon_status_bufs_repleni int req_entries, enum hal_rx_buf_return_buf_manager mgr, gfp_t gfp); +void ath11k_dp_rx_mon_dest_process(struct ath11k *ar, u32 quota, + struct napi_struct *napi); 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); --- a/drivers/net/wireless/ath/ath11k/hal_rx.h +++ b/drivers/net/wireless/ath/ath11k/hal_rx.h @@ -85,10 +85,6 @@ enum hal_rx_legacy_rate { HAL_RX_LEGACY_RATE_INVALID, }; -#define HAL_TLV_STATUS_PPDU_NOT_DONE 0 -#define HAL_TLV_STATUS_PPDU_DONE 1 -#define HAL_TLV_STATUS_BUF_DONE 2 -#define HAL_TLV_STATUS_PPDU_NON_STD_DONE 3 #define HAL_RX_FCS_LEN 4 #define HAL_AST_IDX_INVALID 0xFFFF @@ -102,6 +98,10 @@ enum hal_rx_mon_status { HAL_RX_MON_STATUS_BUF_DONE, }; +#define HAL_TLV_STATUS_PPDU_NOT_DONE HAL_RX_MON_STATUS_PPDU_NOT_DONE +#define HAL_TLV_STATUS_PPDU_DONE HAL_RX_MON_STATUS_PPDU_DONE +#define HAL_TLV_STATUS_BUF_DONE HAL_RX_MON_STATUS_BUF_DONE + struct hal_rx_user_status { u32 mcs:4, nss:3, --- a/drivers/net/wireless/ath/ath11k/debug.c +++ b/drivers/net/wireless/ath/ath11k/debug.c @@ -917,6 +917,12 @@ static ssize_t ath11k_write_extd_rx_stat goto exit; } + if (ar->monitor_started) { + ar->debug.extd_rx_stats = enable; + ret = count; + goto exit; + } + if (enable) { rx_filter = HTT_RX_FILTER_TLV_FLAGS_MPDU_START; rx_filter |= HTT_RX_FILTER_TLV_FLAGS_PPDU_START;