Lines Matching +full:txrx +full:-

1 // SPDX-License-Identifier: ISC
3 * Copyright (c) 2014-2017 Qualcomm Atheros, Inc.
8 #include "wmi-ops.h"
9 #include "txrx.h"
17 stats->rx_pkt_amsdu[ATH10K_AMSDU_SUBFRM_NUM_1]++; in ath10k_rx_stats_update_amsdu_subfrm()
19 stats->rx_pkt_amsdu[ATH10K_AMSDU_SUBFRM_NUM_2]++; in ath10k_rx_stats_update_amsdu_subfrm()
21 stats->rx_pkt_amsdu[ATH10K_AMSDU_SUBFRM_NUM_3]++; in ath10k_rx_stats_update_amsdu_subfrm()
23 stats->rx_pkt_amsdu[ATH10K_AMSDU_SUBFRM_NUM_4]++; in ath10k_rx_stats_update_amsdu_subfrm()
25 stats->rx_pkt_amsdu[ATH10K_AMSDU_SUBFRM_NUM_MORE]++; in ath10k_rx_stats_update_amsdu_subfrm()
33 stats->rx_pkt_ampdu[ATH10K_AMPDU_SUBFRM_NUM_10]++; in ath10k_rx_stats_update_ampdu_subfrm()
35 stats->rx_pkt_ampdu[ATH10K_AMPDU_SUBFRM_NUM_20]++; in ath10k_rx_stats_update_ampdu_subfrm()
37 stats->rx_pkt_ampdu[ATH10K_AMPDU_SUBFRM_NUM_30]++; in ath10k_rx_stats_update_ampdu_subfrm()
39 stats->rx_pkt_ampdu[ATH10K_AMPDU_SUBFRM_NUM_40]++; in ath10k_rx_stats_update_ampdu_subfrm()
41 stats->rx_pkt_ampdu[ATH10K_AMPDU_SUBFRM_NUM_50]++; in ath10k_rx_stats_update_ampdu_subfrm()
43 stats->rx_pkt_ampdu[ATH10K_AMPDU_SUBFRM_NUM_60]++; in ath10k_rx_stats_update_ampdu_subfrm()
45 stats->rx_pkt_ampdu[ATH10K_AMPDU_SUBFRM_NUM_MORE]++; in ath10k_rx_stats_update_ampdu_subfrm()
56 if (tid > IEEE80211_NUM_TIDS || !(ar->sta_tid_stats_mask & BIT(tid))) in ath10k_sta_update_rx_tid_stats_ampdu()
60 spin_lock_bh(&ar->data_lock); in ath10k_sta_update_rx_tid_stats_ampdu()
63 if (!peer || !peer->sta) in ath10k_sta_update_rx_tid_stats_ampdu()
66 arsta = (struct ath10k_sta *)peer->sta->drv_priv; in ath10k_sta_update_rx_tid_stats_ampdu()
70 &arsta->tid_stats[tid], in ath10k_sta_update_rx_tid_stats_ampdu()
74 spin_unlock_bh(&ar->data_lock); in ath10k_sta_update_rx_tid_stats_ampdu()
94 if (!ieee80211_is_data(hdr->frame_control)) in ath10k_sta_update_rx_tid_stats()
97 if (ieee80211_is_data_qos(hdr->frame_control)) in ath10k_sta_update_rx_tid_stats()
100 if (!(ar->sta_tid_stats_mask & BIT(tid)) || non_data_frm) in ath10k_sta_update_rx_tid_stats()
105 sta = ieee80211_find_sta_by_ifaddr(ar->hw, hdr->addr2, NULL); in ath10k_sta_update_rx_tid_stats()
109 arsta = (struct ath10k_sta *)sta->drv_priv; in ath10k_sta_update_rx_tid_stats()
111 spin_lock_bh(&ar->data_lock); in ath10k_sta_update_rx_tid_stats()
112 stats = &arsta->tid_stats[tid]; in ath10k_sta_update_rx_tid_stats()
113 stats->rx_pkt_from_fw += num_msdus; in ath10k_sta_update_rx_tid_stats()
114 stats->rx_pkt_unchained += unchain_cnt; in ath10k_sta_update_rx_tid_stats()
115 stats->rx_pkt_drop_chained += drop_cnt; in ath10k_sta_update_rx_tid_stats()
116 stats->rx_pkt_drop_filter += drop_cnt_filter; in ath10k_sta_update_rx_tid_stats()
118 stats->rx_pkt_err[err] += queued_msdus; in ath10k_sta_update_rx_tid_stats()
119 stats->rx_pkt_queued_for_mac += queued_msdus; in ath10k_sta_update_rx_tid_stats()
120 ath10k_rx_stats_update_amsdu_subfrm(ar, &arsta->tid_stats[tid], in ath10k_sta_update_rx_tid_stats()
122 spin_unlock_bh(&ar->data_lock); in ath10k_sta_update_rx_tid_stats()
136 list_for_each_entry(peer, &stats->peers_extd, list) { in ath10k_sta_update_extd_stats_rx_duration()
137 sta = ieee80211_find_sta_by_ifaddr(ar->hw, peer->peer_macaddr, in ath10k_sta_update_extd_stats_rx_duration()
141 arsta = (struct ath10k_sta *)sta->drv_priv; in ath10k_sta_update_extd_stats_rx_duration()
142 arsta->rx_duration += (u64)peer->rx_duration; in ath10k_sta_update_extd_stats_rx_duration()
155 list_for_each_entry(peer, &stats->peers, list) { in ath10k_sta_update_stats_rx_duration()
156 sta = ieee80211_find_sta_by_ifaddr(ar->hw, peer->peer_macaddr, in ath10k_sta_update_stats_rx_duration()
160 arsta = (struct ath10k_sta *)sta->drv_priv; in ath10k_sta_update_stats_rx_duration()
161 arsta->rx_duration += (u64)peer->rx_duration; in ath10k_sta_update_stats_rx_duration()
169 if (stats->extended) in ath10k_sta_update_rx_duration()
179 struct ieee80211_sta *sta = file->private_data; in ath10k_dbg_sta_read_aggr_mode()
180 struct ath10k_sta *arsta = (struct ath10k_sta *)sta->drv_priv; in ath10k_dbg_sta_read_aggr_mode()
181 struct ath10k *ar = arsta->arvif->ar; in ath10k_dbg_sta_read_aggr_mode()
185 mutex_lock(&ar->conf_mutex); in ath10k_dbg_sta_read_aggr_mode()
186 len = scnprintf(buf, sizeof(buf) - len, "aggregation mode: %s\n", in ath10k_dbg_sta_read_aggr_mode()
187 (arsta->aggr_mode == ATH10K_DBG_AGGR_MODE_AUTO) ? in ath10k_dbg_sta_read_aggr_mode()
189 mutex_unlock(&ar->conf_mutex); in ath10k_dbg_sta_read_aggr_mode()
198 struct ieee80211_sta *sta = file->private_data; in ath10k_dbg_sta_write_aggr_mode()
199 struct ath10k_sta *arsta = (struct ath10k_sta *)sta->drv_priv; in ath10k_dbg_sta_write_aggr_mode()
200 struct ath10k *ar = arsta->arvif->ar; in ath10k_dbg_sta_write_aggr_mode()
205 return -EINVAL; in ath10k_dbg_sta_write_aggr_mode()
208 return -EINVAL; in ath10k_dbg_sta_write_aggr_mode()
210 mutex_lock(&ar->conf_mutex); in ath10k_dbg_sta_write_aggr_mode()
211 if ((ar->state != ATH10K_STATE_ON) || in ath10k_dbg_sta_write_aggr_mode()
212 (aggr_mode == arsta->aggr_mode)) { in ath10k_dbg_sta_write_aggr_mode()
217 ret = ath10k_wmi_addba_clear_resp(ar, arsta->arvif->vdev_id, sta->addr); in ath10k_dbg_sta_write_aggr_mode()
223 arsta->aggr_mode = aggr_mode; in ath10k_dbg_sta_write_aggr_mode()
225 mutex_unlock(&ar->conf_mutex); in ath10k_dbg_sta_write_aggr_mode()
241 struct ieee80211_sta *sta = file->private_data; in ath10k_dbg_sta_write_addba()
242 struct ath10k_sta *arsta = (struct ath10k_sta *)sta->drv_priv; in ath10k_dbg_sta_write_addba()
243 struct ath10k *ar = arsta->arvif->ar; in ath10k_dbg_sta_write_addba()
248 ret = simple_write_to_buffer(buf, sizeof(buf) - 1, ppos, in ath10k_dbg_sta_write_addba()
255 return -EINVAL; in ath10k_dbg_sta_write_addba()
258 if (tid > HTT_DATA_TX_EXT_TID_MGMT - 2) in ath10k_dbg_sta_write_addba()
259 return -EINVAL; in ath10k_dbg_sta_write_addba()
261 mutex_lock(&ar->conf_mutex); in ath10k_dbg_sta_write_addba()
262 if ((ar->state != ATH10K_STATE_ON) || in ath10k_dbg_sta_write_addba()
263 (arsta->aggr_mode != ATH10K_DBG_AGGR_MODE_MANUAL)) { in ath10k_dbg_sta_write_addba()
268 ret = ath10k_wmi_addba_send(ar, arsta->arvif->vdev_id, sta->addr, in ath10k_dbg_sta_write_addba()
272 arsta->arvif->vdev_id, sta->addr, tid, buf_size); in ath10k_dbg_sta_write_addba()
277 mutex_unlock(&ar->conf_mutex); in ath10k_dbg_sta_write_addba()
292 struct ieee80211_sta *sta = file->private_data; in ath10k_dbg_sta_write_addba_resp()
293 struct ath10k_sta *arsta = (struct ath10k_sta *)sta->drv_priv; in ath10k_dbg_sta_write_addba_resp()
294 struct ath10k *ar = arsta->arvif->ar; in ath10k_dbg_sta_write_addba_resp()
299 ret = simple_write_to_buffer(buf, sizeof(buf) - 1, ppos, in ath10k_dbg_sta_write_addba_resp()
306 return -EINVAL; in ath10k_dbg_sta_write_addba_resp()
309 if (tid > HTT_DATA_TX_EXT_TID_MGMT - 2) in ath10k_dbg_sta_write_addba_resp()
310 return -EINVAL; in ath10k_dbg_sta_write_addba_resp()
312 mutex_lock(&ar->conf_mutex); in ath10k_dbg_sta_write_addba_resp()
313 if ((ar->state != ATH10K_STATE_ON) || in ath10k_dbg_sta_write_addba_resp()
314 (arsta->aggr_mode != ATH10K_DBG_AGGR_MODE_MANUAL)) { in ath10k_dbg_sta_write_addba_resp()
319 ret = ath10k_wmi_addba_set_resp(ar, arsta->arvif->vdev_id, sta->addr, in ath10k_dbg_sta_write_addba_resp()
323 arsta->arvif->vdev_id, sta->addr, tid, status); in ath10k_dbg_sta_write_addba_resp()
327 mutex_unlock(&ar->conf_mutex); in ath10k_dbg_sta_write_addba_resp()
342 struct ieee80211_sta *sta = file->private_data; in ath10k_dbg_sta_write_delba()
343 struct ath10k_sta *arsta = (struct ath10k_sta *)sta->drv_priv; in ath10k_dbg_sta_write_delba()
344 struct ath10k *ar = arsta->arvif->ar; in ath10k_dbg_sta_write_delba()
349 ret = simple_write_to_buffer(buf, sizeof(buf) - 1, ppos, in ath10k_dbg_sta_write_delba()
356 return -EINVAL; in ath10k_dbg_sta_write_delba()
359 if (tid > HTT_DATA_TX_EXT_TID_MGMT - 2) in ath10k_dbg_sta_write_delba()
360 return -EINVAL; in ath10k_dbg_sta_write_delba()
362 mutex_lock(&ar->conf_mutex); in ath10k_dbg_sta_write_delba()
363 if ((ar->state != ATH10K_STATE_ON) || in ath10k_dbg_sta_write_delba()
364 (arsta->aggr_mode != ATH10K_DBG_AGGR_MODE_MANUAL)) { in ath10k_dbg_sta_write_delba()
369 ret = ath10k_wmi_delba_send(ar, arsta->arvif->vdev_id, sta->addr, in ath10k_dbg_sta_write_delba()
373 arsta->arvif->vdev_id, sta->addr, tid, initiator, in ath10k_dbg_sta_write_delba()
378 mutex_unlock(&ar->conf_mutex); in ath10k_dbg_sta_write_delba()
394 struct ieee80211_sta *sta = file->private_data; in ath10k_dbg_sta_read_peer_debug_trigger()
395 struct ath10k_sta *arsta = (struct ath10k_sta *)sta->drv_priv; in ath10k_dbg_sta_read_peer_debug_trigger()
396 struct ath10k *ar = arsta->arvif->ar; in ath10k_dbg_sta_read_peer_debug_trigger()
400 mutex_lock(&ar->conf_mutex); in ath10k_dbg_sta_read_peer_debug_trigger()
401 len = scnprintf(buf, sizeof(buf) - len, in ath10k_dbg_sta_read_peer_debug_trigger()
403 mutex_unlock(&ar->conf_mutex); in ath10k_dbg_sta_read_peer_debug_trigger()
413 struct ieee80211_sta *sta = file->private_data; in ath10k_dbg_sta_write_peer_debug_trigger()
414 struct ath10k_sta *arsta = (struct ath10k_sta *)sta->drv_priv; in ath10k_dbg_sta_write_peer_debug_trigger()
415 struct ath10k *ar = arsta->arvif->ar; in ath10k_dbg_sta_write_peer_debug_trigger()
420 return -EINVAL; in ath10k_dbg_sta_write_peer_debug_trigger()
423 return -EINVAL; in ath10k_dbg_sta_write_peer_debug_trigger()
425 mutex_lock(&ar->conf_mutex); in ath10k_dbg_sta_write_peer_debug_trigger()
427 if (ar->state != ATH10K_STATE_ON) { in ath10k_dbg_sta_write_peer_debug_trigger()
428 ret = -ENETDOWN; in ath10k_dbg_sta_write_peer_debug_trigger()
432 ret = ath10k_wmi_peer_set_param(ar, arsta->arvif->vdev_id, sta->addr, in ath10k_dbg_sta_write_peer_debug_trigger()
433 ar->wmi.peer_param->debug, peer_debug_trigger); in ath10k_dbg_sta_write_peer_debug_trigger()
440 mutex_unlock(&ar->conf_mutex); in ath10k_dbg_sta_write_peer_debug_trigger()
456 struct ieee80211_sta *sta = file->private_data; in ath10k_dbg_sta_read_peer_ps_state()
457 struct ath10k_sta *arsta = (struct ath10k_sta *)sta->drv_priv; in ath10k_dbg_sta_read_peer_ps_state()
458 struct ath10k *ar = arsta->arvif->ar; in ath10k_dbg_sta_read_peer_ps_state()
462 spin_lock_bh(&ar->data_lock); in ath10k_dbg_sta_read_peer_ps_state()
464 len = scnprintf(buf, sizeof(buf) - len, "%d\n", in ath10k_dbg_sta_read_peer_ps_state()
465 arsta->peer_ps_state); in ath10k_dbg_sta_read_peer_ps_state()
467 spin_unlock_bh(&ar->data_lock); in ath10k_dbg_sta_read_peer_ps_state()
503 return "11-20"; in get_num_ampdu_subfrm_str()
505 return "21-30"; in get_num_ampdu_subfrm_str()
507 return "31-40"; in get_num_ampdu_subfrm_str()
509 return "41-50"; in get_num_ampdu_subfrm_str()
511 return "51-60"; in get_num_ampdu_subfrm_str()
545 if (ar->sta_tid_stats_mask & BIT(j)) { \
546 len += scnprintf(buf + len, buf_len - len, \
547 "[%02d] %-10lu ", \
552 buf_len - len, "\n"); \
554 buf_len - len, \
559 len += scnprintf(buf + len, buf_len - len, "\n"); \
566 struct ieee80211_sta *sta = file->private_data; in ath10k_dbg_sta_read_tid_stats()
567 struct ath10k_sta *arsta = (struct ath10k_sta *)sta->drv_priv; in ath10k_dbg_sta_read_tid_stats()
568 struct ath10k *ar = arsta->arvif->ar; in ath10k_dbg_sta_read_tid_stats()
569 struct ath10k_sta_tid_stats *stats = arsta->tid_stats; in ath10k_dbg_sta_read_tid_stats()
577 return -ENOMEM; in ath10k_dbg_sta_read_tid_stats()
579 mutex_lock(&ar->conf_mutex); in ath10k_dbg_sta_read_tid_stats()
581 spin_lock_bh(&ar->data_lock); in ath10k_dbg_sta_read_tid_stats()
583 len += scnprintf(buf + len, buf_len - len, in ath10k_dbg_sta_read_tid_stats()
585 len += scnprintf(buf + len, buf_len - len, in ath10k_dbg_sta_read_tid_stats()
586 "\t\t------------------------------------------\n"); in ath10k_dbg_sta_read_tid_stats()
587 len += scnprintf(buf + len, buf_len - len, "MSDUs from FW\t\t\t"); in ath10k_dbg_sta_read_tid_stats()
590 len += scnprintf(buf + len, buf_len - len, "MSDUs unchained\t\t\t"); in ath10k_dbg_sta_read_tid_stats()
593 len += scnprintf(buf + len, buf_len - len, in ath10k_dbg_sta_read_tid_stats()
597 len += scnprintf(buf + len, buf_len - len, in ath10k_dbg_sta_read_tid_stats()
601 len += scnprintf(buf + len, buf_len - len, in ath10k_dbg_sta_read_tid_stats()
606 len += scnprintf(buf + len, buf_len - len, in ath10k_dbg_sta_read_tid_stats()
611 len += scnprintf(buf + len, buf_len - len, "\n"); in ath10k_dbg_sta_read_tid_stats()
613 len += scnprintf(buf + len, buf_len - len, in ath10k_dbg_sta_read_tid_stats()
614 "A-MPDU num subframes %s\t", in ath10k_dbg_sta_read_tid_stats()
619 len += scnprintf(buf + len, buf_len - len, "\n"); in ath10k_dbg_sta_read_tid_stats()
621 len += scnprintf(buf + len, buf_len - len, in ath10k_dbg_sta_read_tid_stats()
622 "A-MSDU num subframes %s\t\t", in ath10k_dbg_sta_read_tid_stats()
627 spin_unlock_bh(&ar->data_lock); in ath10k_dbg_sta_read_tid_stats()
633 mutex_unlock(&ar->conf_mutex); in ath10k_dbg_sta_read_tid_stats()
649 struct ieee80211_sta *sta = file->private_data; in ath10k_dbg_sta_dump_tx_stats()
650 struct ath10k_sta *arsta = (struct ath10k_sta *)sta->drv_priv; in ath10k_dbg_sta_dump_tx_stats()
651 struct ath10k *ar = arsta->arvif->ar; in ath10k_dbg_sta_dump_tx_stats()
662 return -ENOMEM; in ath10k_dbg_sta_dump_tx_stats()
664 mutex_lock(&ar->conf_mutex); in ath10k_dbg_sta_dump_tx_stats()
666 if (!arsta->tx_stats) { in ath10k_dbg_sta_dump_tx_stats()
668 mutex_unlock(&ar->conf_mutex); in ath10k_dbg_sta_dump_tx_stats()
673 spin_lock_bh(&ar->data_lock); in ath10k_dbg_sta_dump_tx_stats()
676 stats = &arsta->tx_stats->stats[k]; in ath10k_dbg_sta_dump_tx_stats()
677 len += scnprintf(buf + len, size - len, "%s_%s\n", in ath10k_dbg_sta_dump_tx_stats()
680 len += scnprintf(buf + len, size - len, in ath10k_dbg_sta_dump_tx_stats()
684 len += scnprintf(buf + len, size - len, in ath10k_dbg_sta_dump_tx_stats()
686 stats->vht[j][i]); in ath10k_dbg_sta_dump_tx_stats()
687 len += scnprintf(buf + len, size - len, "\n"); in ath10k_dbg_sta_dump_tx_stats()
688 len += scnprintf(buf + len, size - len, " HT MCS %s\n", in ath10k_dbg_sta_dump_tx_stats()
691 len += scnprintf(buf + len, size - len, in ath10k_dbg_sta_dump_tx_stats()
692 " %llu ", stats->ht[j][i]); in ath10k_dbg_sta_dump_tx_stats()
693 len += scnprintf(buf + len, size - len, "\n"); in ath10k_dbg_sta_dump_tx_stats()
694 len += scnprintf(buf + len, size - len, in ath10k_dbg_sta_dump_tx_stats()
696 len += scnprintf(buf + len, size - len, in ath10k_dbg_sta_dump_tx_stats()
698 stats->bw[j][0], stats->bw[j][1], in ath10k_dbg_sta_dump_tx_stats()
699 stats->bw[j][2], stats->bw[j][3], in ath10k_dbg_sta_dump_tx_stats()
700 stats->bw[j][4], stats->bw[j][5]); in ath10k_dbg_sta_dump_tx_stats()
701 len += scnprintf(buf + len, size - len, in ath10k_dbg_sta_dump_tx_stats()
703 len += scnprintf(buf + len, size - len, in ath10k_dbg_sta_dump_tx_stats()
705 stats->nss[j][0], stats->nss[j][1], in ath10k_dbg_sta_dump_tx_stats()
706 stats->nss[j][2], stats->nss[j][3]); in ath10k_dbg_sta_dump_tx_stats()
707 len += scnprintf(buf + len, size - len, in ath10k_dbg_sta_dump_tx_stats()
710 len += scnprintf(buf + len, size - len, " %llu %llu\n", in ath10k_dbg_sta_dump_tx_stats()
711 stats->gi[j][0], stats->gi[j][1]); in ath10k_dbg_sta_dump_tx_stats()
712 len += scnprintf(buf + len, size - len, in ath10k_dbg_sta_dump_tx_stats()
716 len += scnprintf(buf + len, size - len, "%llu ", in ath10k_dbg_sta_dump_tx_stats()
717 stats->legacy[j][i]); in ath10k_dbg_sta_dump_tx_stats()
718 len += scnprintf(buf + len, size - len, "\n"); in ath10k_dbg_sta_dump_tx_stats()
719 len += scnprintf(buf + len, size - len, in ath10k_dbg_sta_dump_tx_stats()
723 len += scnprintf(buf + len, size - len, "%llu ", in ath10k_dbg_sta_dump_tx_stats()
724 stats->rate_table[j][i]); in ath10k_dbg_sta_dump_tx_stats()
727 scnprintf(buf + len, size - len, "\n "); in ath10k_dbg_sta_dump_tx_stats()
732 len += scnprintf(buf + len, size - len, in ath10k_dbg_sta_dump_tx_stats()
734 arsta->tx_stats->tx_duration); in ath10k_dbg_sta_dump_tx_stats()
735 len += scnprintf(buf + len, size - len, in ath10k_dbg_sta_dump_tx_stats()
736 "BA fails\n %llu\n", arsta->tx_stats->ba_fails); in ath10k_dbg_sta_dump_tx_stats()
737 len += scnprintf(buf + len, size - len, in ath10k_dbg_sta_dump_tx_stats()
738 "ack fails\n %llu\n", arsta->tx_stats->ack_fails); in ath10k_dbg_sta_dump_tx_stats()
739 spin_unlock_bh(&ar->data_lock); in ath10k_dbg_sta_dump_tx_stats()
746 mutex_unlock(&ar->conf_mutex); in ath10k_dbg_sta_dump_tx_stats()
760 struct ath10k *ar = hw->priv; in ath10k_sta_add_debugfs()