1 // SPDX-License-Identifier: ISC
3 * Copyright (c) 2014-2017 Qualcomm Atheros, Inc.
4 * Copyright (c) 2018, The Linux Foundation. All rights reserved.
12 static void ath10k_rx_stats_update_amsdu_subfrm(struct ath10k
*ar
,
13 struct ath10k_sta_tid_stats
*stats
,
17 stats
->rx_pkt_amsdu
[ATH10K_AMSDU_SUBFRM_NUM_1
]++;
18 else if (msdu_count
== 2)
19 stats
->rx_pkt_amsdu
[ATH10K_AMSDU_SUBFRM_NUM_2
]++;
20 else if (msdu_count
== 3)
21 stats
->rx_pkt_amsdu
[ATH10K_AMSDU_SUBFRM_NUM_3
]++;
22 else if (msdu_count
== 4)
23 stats
->rx_pkt_amsdu
[ATH10K_AMSDU_SUBFRM_NUM_4
]++;
24 else if (msdu_count
> 4)
25 stats
->rx_pkt_amsdu
[ATH10K_AMSDU_SUBFRM_NUM_MORE
]++;
28 static void ath10k_rx_stats_update_ampdu_subfrm(struct ath10k
*ar
,
29 struct ath10k_sta_tid_stats
*stats
,
33 stats
->rx_pkt_ampdu
[ATH10K_AMPDU_SUBFRM_NUM_10
]++;
34 else if (mpdu_count
<= 20)
35 stats
->rx_pkt_ampdu
[ATH10K_AMPDU_SUBFRM_NUM_20
]++;
36 else if (mpdu_count
<= 30)
37 stats
->rx_pkt_ampdu
[ATH10K_AMPDU_SUBFRM_NUM_30
]++;
38 else if (mpdu_count
<= 40)
39 stats
->rx_pkt_ampdu
[ATH10K_AMPDU_SUBFRM_NUM_40
]++;
40 else if (mpdu_count
<= 50)
41 stats
->rx_pkt_ampdu
[ATH10K_AMPDU_SUBFRM_NUM_50
]++;
42 else if (mpdu_count
<= 60)
43 stats
->rx_pkt_ampdu
[ATH10K_AMPDU_SUBFRM_NUM_60
]++;
44 else if (mpdu_count
> 60)
45 stats
->rx_pkt_ampdu
[ATH10K_AMPDU_SUBFRM_NUM_MORE
]++;
48 void ath10k_sta_update_rx_tid_stats_ampdu(struct ath10k
*ar
, u16 peer_id
, u8 tid
,
49 struct htt_rx_indication_mpdu_range
*ranges
,
52 struct ath10k_sta
*arsta
;
53 struct ath10k_peer
*peer
;
56 if (tid
> IEEE80211_NUM_TIDS
|| !(ar
->sta_tid_stats_mask
& BIT(tid
)))
60 spin_lock_bh(&ar
->data_lock
);
62 peer
= ath10k_peer_find_by_id(ar
, peer_id
);
63 if (!peer
|| !peer
->sta
)
66 arsta
= (struct ath10k_sta
*)peer
->sta
->drv_priv
;
68 for (i
= 0; i
< num_ranges
; i
++)
69 ath10k_rx_stats_update_ampdu_subfrm(ar
,
70 &arsta
->tid_stats
[tid
],
71 ranges
[i
].mpdu_count
);
74 spin_unlock_bh(&ar
->data_lock
);
78 void ath10k_sta_update_rx_tid_stats(struct ath10k
*ar
, u8
*first_hdr
,
79 unsigned long num_msdus
,
80 enum ath10k_pkt_rx_err err
,
81 unsigned long unchain_cnt
,
82 unsigned long drop_cnt
,
83 unsigned long drop_cnt_filter
,
84 unsigned long queued_msdus
)
86 struct ieee80211_sta
*sta
;
87 struct ath10k_sta
*arsta
;
88 struct ieee80211_hdr
*hdr
;
89 struct ath10k_sta_tid_stats
*stats
;
90 u8 tid
= IEEE80211_NUM_TIDS
;
91 bool non_data_frm
= false;
93 hdr
= (struct ieee80211_hdr
*)first_hdr
;
94 if (!ieee80211_is_data(hdr
->frame_control
))
97 if (ieee80211_is_data_qos(hdr
->frame_control
))
98 tid
= *ieee80211_get_qos_ctl(hdr
) & IEEE80211_QOS_CTL_TID_MASK
;
100 if (!(ar
->sta_tid_stats_mask
& BIT(tid
)) || non_data_frm
)
105 sta
= ieee80211_find_sta_by_ifaddr(ar
->hw
, hdr
->addr2
, NULL
);
109 arsta
= (struct ath10k_sta
*)sta
->drv_priv
;
111 spin_lock_bh(&ar
->data_lock
);
112 stats
= &arsta
->tid_stats
[tid
];
113 stats
->rx_pkt_from_fw
+= num_msdus
;
114 stats
->rx_pkt_unchained
+= unchain_cnt
;
115 stats
->rx_pkt_drop_chained
+= drop_cnt
;
116 stats
->rx_pkt_drop_filter
+= drop_cnt_filter
;
117 if (err
!= ATH10K_PKT_RX_ERR_MAX
)
118 stats
->rx_pkt_err
[err
] += queued_msdus
;
119 stats
->rx_pkt_queued_for_mac
+= queued_msdus
;
120 ath10k_rx_stats_update_amsdu_subfrm(ar
, &arsta
->tid_stats
[tid
],
122 spin_unlock_bh(&ar
->data_lock
);
128 static void ath10k_sta_update_extd_stats_rx_duration(struct ath10k
*ar
,
129 struct ath10k_fw_stats
*stats
)
131 struct ath10k_fw_extd_stats_peer
*peer
;
132 struct ieee80211_sta
*sta
;
133 struct ath10k_sta
*arsta
;
136 list_for_each_entry(peer
, &stats
->peers_extd
, list
) {
137 sta
= ieee80211_find_sta_by_ifaddr(ar
->hw
, peer
->peer_macaddr
,
141 arsta
= (struct ath10k_sta
*)sta
->drv_priv
;
142 arsta
->rx_duration
+= (u64
)peer
->rx_duration
;
147 static void ath10k_sta_update_stats_rx_duration(struct ath10k
*ar
,
148 struct ath10k_fw_stats
*stats
)
150 struct ath10k_fw_stats_peer
*peer
;
151 struct ieee80211_sta
*sta
;
152 struct ath10k_sta
*arsta
;
155 list_for_each_entry(peer
, &stats
->peers
, list
) {
156 sta
= ieee80211_find_sta_by_ifaddr(ar
->hw
, peer
->peer_macaddr
,
160 arsta
= (struct ath10k_sta
*)sta
->drv_priv
;
161 arsta
->rx_duration
+= (u64
)peer
->rx_duration
;
166 void ath10k_sta_update_rx_duration(struct ath10k
*ar
,
167 struct ath10k_fw_stats
*stats
)
170 ath10k_sta_update_extd_stats_rx_duration(ar
, stats
);
172 ath10k_sta_update_stats_rx_duration(ar
, stats
);
175 static ssize_t
ath10k_dbg_sta_read_aggr_mode(struct file
*file
,
176 char __user
*user_buf
,
177 size_t count
, loff_t
*ppos
)
179 struct ieee80211_sta
*sta
= file
->private_data
;
180 struct ath10k_sta
*arsta
= (struct ath10k_sta
*)sta
->drv_priv
;
181 struct ath10k
*ar
= arsta
->arvif
->ar
;
185 mutex_lock(&ar
->conf_mutex
);
186 len
= scnprintf(buf
, sizeof(buf
) - len
, "aggregation mode: %s\n",
187 (arsta
->aggr_mode
== ATH10K_DBG_AGGR_MODE_AUTO
) ?
189 mutex_unlock(&ar
->conf_mutex
);
191 return simple_read_from_buffer(user_buf
, count
, ppos
, buf
, len
);
194 static ssize_t
ath10k_dbg_sta_write_aggr_mode(struct file
*file
,
195 const char __user
*user_buf
,
196 size_t count
, loff_t
*ppos
)
198 struct ieee80211_sta
*sta
= file
->private_data
;
199 struct ath10k_sta
*arsta
= (struct ath10k_sta
*)sta
->drv_priv
;
200 struct ath10k
*ar
= arsta
->arvif
->ar
;
204 if (kstrtouint_from_user(user_buf
, count
, 0, &aggr_mode
))
207 if (aggr_mode
>= ATH10K_DBG_AGGR_MODE_MAX
)
210 mutex_lock(&ar
->conf_mutex
);
211 if ((ar
->state
!= ATH10K_STATE_ON
) ||
212 (aggr_mode
== arsta
->aggr_mode
)) {
217 ret
= ath10k_wmi_addba_clear_resp(ar
, arsta
->arvif
->vdev_id
, sta
->addr
);
219 ath10k_warn(ar
, "failed to clear addba session ret: %d\n", ret
);
223 arsta
->aggr_mode
= aggr_mode
;
225 mutex_unlock(&ar
->conf_mutex
);
229 static const struct file_operations fops_aggr_mode
= {
230 .read
= ath10k_dbg_sta_read_aggr_mode
,
231 .write
= ath10k_dbg_sta_write_aggr_mode
,
233 .owner
= THIS_MODULE
,
234 .llseek
= default_llseek
,
237 static ssize_t
ath10k_dbg_sta_write_addba(struct file
*file
,
238 const char __user
*user_buf
,
239 size_t count
, loff_t
*ppos
)
241 struct ieee80211_sta
*sta
= file
->private_data
;
242 struct ath10k_sta
*arsta
= (struct ath10k_sta
*)sta
->drv_priv
;
243 struct ath10k
*ar
= arsta
->arvif
->ar
;
248 ret
= simple_write_to_buffer(buf
, sizeof(buf
) - 1, ppos
,
253 ret
= sscanf(buf
, "%u %u", &tid
, &buf_size
);
257 /* Valid TID values are 0 through 15 */
258 if (tid
> HTT_DATA_TX_EXT_TID_MGMT
- 2)
261 mutex_lock(&ar
->conf_mutex
);
262 if ((ar
->state
!= ATH10K_STATE_ON
) ||
263 (arsta
->aggr_mode
!= ATH10K_DBG_AGGR_MODE_MANUAL
)) {
268 ret
= ath10k_wmi_addba_send(ar
, arsta
->arvif
->vdev_id
, sta
->addr
,
271 ath10k_warn(ar
, "failed to send addba request: vdev_id %u peer %pM tid %u buf_size %u\n",
272 arsta
->arvif
->vdev_id
, sta
->addr
, tid
, buf_size
);
277 mutex_unlock(&ar
->conf_mutex
);
281 static const struct file_operations fops_addba
= {
282 .write
= ath10k_dbg_sta_write_addba
,
284 .owner
= THIS_MODULE
,
285 .llseek
= default_llseek
,
288 static ssize_t
ath10k_dbg_sta_write_addba_resp(struct file
*file
,
289 const char __user
*user_buf
,
290 size_t count
, loff_t
*ppos
)
292 struct ieee80211_sta
*sta
= file
->private_data
;
293 struct ath10k_sta
*arsta
= (struct ath10k_sta
*)sta
->drv_priv
;
294 struct ath10k
*ar
= arsta
->arvif
->ar
;
299 ret
= simple_write_to_buffer(buf
, sizeof(buf
) - 1, ppos
,
304 ret
= sscanf(buf
, "%u %u", &tid
, &status
);
308 /* Valid TID values are 0 through 15 */
309 if (tid
> HTT_DATA_TX_EXT_TID_MGMT
- 2)
312 mutex_lock(&ar
->conf_mutex
);
313 if ((ar
->state
!= ATH10K_STATE_ON
) ||
314 (arsta
->aggr_mode
!= ATH10K_DBG_AGGR_MODE_MANUAL
)) {
319 ret
= ath10k_wmi_addba_set_resp(ar
, arsta
->arvif
->vdev_id
, sta
->addr
,
322 ath10k_warn(ar
, "failed to send addba response: vdev_id %u peer %pM tid %u status%u\n",
323 arsta
->arvif
->vdev_id
, sta
->addr
, tid
, status
);
327 mutex_unlock(&ar
->conf_mutex
);
331 static const struct file_operations fops_addba_resp
= {
332 .write
= ath10k_dbg_sta_write_addba_resp
,
334 .owner
= THIS_MODULE
,
335 .llseek
= default_llseek
,
338 static ssize_t
ath10k_dbg_sta_write_delba(struct file
*file
,
339 const char __user
*user_buf
,
340 size_t count
, loff_t
*ppos
)
342 struct ieee80211_sta
*sta
= file
->private_data
;
343 struct ath10k_sta
*arsta
= (struct ath10k_sta
*)sta
->drv_priv
;
344 struct ath10k
*ar
= arsta
->arvif
->ar
;
345 u32 tid
, initiator
, reason
;
349 ret
= simple_write_to_buffer(buf
, sizeof(buf
) - 1, ppos
,
354 ret
= sscanf(buf
, "%u %u %u", &tid
, &initiator
, &reason
);
358 /* Valid TID values are 0 through 15 */
359 if (tid
> HTT_DATA_TX_EXT_TID_MGMT
- 2)
362 mutex_lock(&ar
->conf_mutex
);
363 if ((ar
->state
!= ATH10K_STATE_ON
) ||
364 (arsta
->aggr_mode
!= ATH10K_DBG_AGGR_MODE_MANUAL
)) {
369 ret
= ath10k_wmi_delba_send(ar
, arsta
->arvif
->vdev_id
, sta
->addr
,
370 tid
, initiator
, reason
);
372 ath10k_warn(ar
, "failed to send delba: vdev_id %u peer %pM tid %u initiator %u reason %u\n",
373 arsta
->arvif
->vdev_id
, sta
->addr
, tid
, initiator
,
378 mutex_unlock(&ar
->conf_mutex
);
382 static const struct file_operations fops_delba
= {
383 .write
= ath10k_dbg_sta_write_delba
,
385 .owner
= THIS_MODULE
,
386 .llseek
= default_llseek
,
389 static ssize_t
ath10k_dbg_sta_read_peer_debug_trigger(struct file
*file
,
390 char __user
*user_buf
,
394 struct ieee80211_sta
*sta
= file
->private_data
;
395 struct ath10k_sta
*arsta
= (struct ath10k_sta
*)sta
->drv_priv
;
396 struct ath10k
*ar
= arsta
->arvif
->ar
;
400 mutex_lock(&ar
->conf_mutex
);
401 len
= scnprintf(buf
, sizeof(buf
) - len
,
402 "Write 1 to once trigger the debug logs\n");
403 mutex_unlock(&ar
->conf_mutex
);
405 return simple_read_from_buffer(user_buf
, count
, ppos
, buf
, len
);
409 ath10k_dbg_sta_write_peer_debug_trigger(struct file
*file
,
410 const char __user
*user_buf
,
411 size_t count
, loff_t
*ppos
)
413 struct ieee80211_sta
*sta
= file
->private_data
;
414 struct ath10k_sta
*arsta
= (struct ath10k_sta
*)sta
->drv_priv
;
415 struct ath10k
*ar
= arsta
->arvif
->ar
;
416 u8 peer_debug_trigger
;
419 if (kstrtou8_from_user(user_buf
, count
, 0, &peer_debug_trigger
))
422 if (peer_debug_trigger
!= 1)
425 mutex_lock(&ar
->conf_mutex
);
427 if (ar
->state
!= ATH10K_STATE_ON
) {
432 ret
= ath10k_wmi_peer_set_param(ar
, arsta
->arvif
->vdev_id
, sta
->addr
,
433 ar
->wmi
.peer_param
->debug
, peer_debug_trigger
);
435 ath10k_warn(ar
, "failed to set param to trigger peer tid logs for station ret: %d\n",
440 mutex_unlock(&ar
->conf_mutex
);
444 static const struct file_operations fops_peer_debug_trigger
= {
446 .read
= ath10k_dbg_sta_read_peer_debug_trigger
,
447 .write
= ath10k_dbg_sta_write_peer_debug_trigger
,
448 .owner
= THIS_MODULE
,
449 .llseek
= default_llseek
,
452 static ssize_t
ath10k_dbg_sta_read_peer_ps_state(struct file
*file
,
453 char __user
*user_buf
,
454 size_t count
, loff_t
*ppos
)
456 struct ieee80211_sta
*sta
= file
->private_data
;
457 struct ath10k_sta
*arsta
= (struct ath10k_sta
*)sta
->drv_priv
;
458 struct ath10k
*ar
= arsta
->arvif
->ar
;
462 spin_lock_bh(&ar
->data_lock
);
464 len
= scnprintf(buf
, sizeof(buf
) - len
, "%d\n",
465 arsta
->peer_ps_state
);
467 spin_unlock_bh(&ar
->data_lock
);
469 return simple_read_from_buffer(user_buf
, count
, ppos
, buf
, len
);
472 static const struct file_operations fops_peer_ps_state
= {
474 .read
= ath10k_dbg_sta_read_peer_ps_state
,
475 .owner
= THIS_MODULE
,
476 .llseek
= default_llseek
,
479 static char *get_err_str(enum ath10k_pkt_rx_err i
)
482 case ATH10K_PKT_RX_ERR_FCS
:
484 case ATH10K_PKT_RX_ERR_TKIP
:
486 case ATH10K_PKT_RX_ERR_CRYPT
:
488 case ATH10K_PKT_RX_ERR_PEER_IDX_INVAL
:
489 return "peer_idx_inval";
490 case ATH10K_PKT_RX_ERR_MAX
:
497 static char *get_num_ampdu_subfrm_str(enum ath10k_ampdu_subfrm_num i
)
500 case ATH10K_AMPDU_SUBFRM_NUM_10
:
502 case ATH10K_AMPDU_SUBFRM_NUM_20
:
504 case ATH10K_AMPDU_SUBFRM_NUM_30
:
506 case ATH10K_AMPDU_SUBFRM_NUM_40
:
508 case ATH10K_AMPDU_SUBFRM_NUM_50
:
510 case ATH10K_AMPDU_SUBFRM_NUM_60
:
512 case ATH10K_AMPDU_SUBFRM_NUM_MORE
:
514 case ATH10K_AMPDU_SUBFRM_NUM_MAX
:
521 static char *get_num_amsdu_subfrm_str(enum ath10k_amsdu_subfrm_num i
)
524 case ATH10K_AMSDU_SUBFRM_NUM_1
:
526 case ATH10K_AMSDU_SUBFRM_NUM_2
:
528 case ATH10K_AMSDU_SUBFRM_NUM_3
:
530 case ATH10K_AMSDU_SUBFRM_NUM_4
:
532 case ATH10K_AMSDU_SUBFRM_NUM_MORE
:
534 case ATH10K_AMSDU_SUBFRM_NUM_MAX
:
541 #define PRINT_TID_STATS(_field, _tabs) \
544 for (j = 0; j <= IEEE80211_NUM_TIDS; j++) { \
545 if (ar->sta_tid_stats_mask & BIT(j)) { \
546 len += scnprintf(buf + len, buf_len - len, \
548 j, stats[j]._field); \
551 len += scnprintf(buf + len, \
552 buf_len - len, "\n"); \
553 len += scnprintf(buf + len, \
559 len += scnprintf(buf + len, buf_len - len, "\n"); \
562 static ssize_t
ath10k_dbg_sta_read_tid_stats(struct file
*file
,
563 char __user
*user_buf
,
564 size_t count
, loff_t
*ppos
)
566 struct ieee80211_sta
*sta
= file
->private_data
;
567 struct ath10k_sta
*arsta
= (struct ath10k_sta
*)sta
->drv_priv
;
568 struct ath10k
*ar
= arsta
->arvif
->ar
;
569 struct ath10k_sta_tid_stats
*stats
= arsta
->tid_stats
;
570 size_t len
= 0, buf_len
= 1048 * IEEE80211_NUM_TIDS
;
575 buf
= kzalloc(buf_len
, GFP_KERNEL
);
579 mutex_lock(&ar
->conf_mutex
);
581 spin_lock_bh(&ar
->data_lock
);
583 len
+= scnprintf(buf
+ len
, buf_len
- len
,
584 "\n\t\tDriver Rx pkt stats per tid, ([tid] count)\n");
585 len
+= scnprintf(buf
+ len
, buf_len
- len
,
586 "\t\t------------------------------------------\n");
587 len
+= scnprintf(buf
+ len
, buf_len
- len
, "MSDUs from FW\t\t\t");
588 PRINT_TID_STATS(rx_pkt_from_fw
, "\t\t\t\t");
590 len
+= scnprintf(buf
+ len
, buf_len
- len
, "MSDUs unchained\t\t\t");
591 PRINT_TID_STATS(rx_pkt_unchained
, "\t\t\t\t");
593 len
+= scnprintf(buf
+ len
, buf_len
- len
,
594 "MSDUs locally dropped:chained\t");
595 PRINT_TID_STATS(rx_pkt_drop_chained
, "\t\t\t\t");
597 len
+= scnprintf(buf
+ len
, buf_len
- len
,
598 "MSDUs locally dropped:filtered\t");
599 PRINT_TID_STATS(rx_pkt_drop_filter
, "\t\t\t\t");
601 len
+= scnprintf(buf
+ len
, buf_len
- len
,
602 "MSDUs queued for mac80211\t");
603 PRINT_TID_STATS(rx_pkt_queued_for_mac
, "\t\t\t\t");
605 for (i
= 0; i
< ATH10K_PKT_RX_ERR_MAX
; i
++) {
606 len
+= scnprintf(buf
+ len
, buf_len
- len
,
607 "MSDUs with error:%s\t", get_err_str(i
));
608 PRINT_TID_STATS(rx_pkt_err
[i
], "\t\t\t\t");
611 len
+= scnprintf(buf
+ len
, buf_len
- len
, "\n");
612 for (i
= 0; i
< ATH10K_AMPDU_SUBFRM_NUM_MAX
; i
++) {
613 len
+= scnprintf(buf
+ len
, buf_len
- len
,
614 "A-MPDU num subframes %s\t",
615 get_num_ampdu_subfrm_str(i
));
616 PRINT_TID_STATS(rx_pkt_ampdu
[i
], "\t\t\t\t");
619 len
+= scnprintf(buf
+ len
, buf_len
- len
, "\n");
620 for (i
= 0; i
< ATH10K_AMSDU_SUBFRM_NUM_MAX
; i
++) {
621 len
+= scnprintf(buf
+ len
, buf_len
- len
,
622 "A-MSDU num subframes %s\t\t",
623 get_num_amsdu_subfrm_str(i
));
624 PRINT_TID_STATS(rx_pkt_amsdu
[i
], "\t\t\t\t");
627 spin_unlock_bh(&ar
->data_lock
);
629 ret
= simple_read_from_buffer(user_buf
, count
, ppos
, buf
, len
);
633 mutex_unlock(&ar
->conf_mutex
);
638 static const struct file_operations fops_tid_stats_dump
= {
640 .read
= ath10k_dbg_sta_read_tid_stats
,
641 .owner
= THIS_MODULE
,
642 .llseek
= default_llseek
,
645 static ssize_t
ath10k_dbg_sta_dump_tx_stats(struct file
*file
,
646 char __user
*user_buf
,
647 size_t count
, loff_t
*ppos
)
649 struct ieee80211_sta
*sta
= file
->private_data
;
650 struct ath10k_sta
*arsta
= (struct ath10k_sta
*)sta
->drv_priv
;
651 struct ath10k
*ar
= arsta
->arvif
->ar
;
652 struct ath10k_htt_data_stats
*stats
;
653 const char *str_name
[ATH10K_STATS_TYPE_MAX
] = {"succ", "fail",
655 const char *str
[ATH10K_COUNTER_TYPE_MAX
] = {"bytes", "packets"};
656 int len
= 0, i
, j
, k
, retval
= 0;
657 const int size
= 16 * 4096;
660 buf
= kzalloc(size
, GFP_KERNEL
);
664 mutex_lock(&ar
->conf_mutex
);
666 if (!arsta
->tx_stats
) {
667 ath10k_warn(ar
, "failed to get tx stats");
668 mutex_unlock(&ar
->conf_mutex
);
673 spin_lock_bh(&ar
->data_lock
);
674 for (k
= 0; k
< ATH10K_STATS_TYPE_MAX
; k
++) {
675 for (j
= 0; j
< ATH10K_COUNTER_TYPE_MAX
; j
++) {
676 stats
= &arsta
->tx_stats
->stats
[k
];
677 len
+= scnprintf(buf
+ len
, size
- len
, "%s_%s\n",
680 len
+= scnprintf(buf
+ len
, size
- len
,
683 for (i
= 0; i
< ATH10K_VHT_MCS_NUM
; i
++)
684 len
+= scnprintf(buf
+ len
, size
- len
,
687 len
+= scnprintf(buf
+ len
, size
- len
, "\n");
688 len
+= scnprintf(buf
+ len
, size
- len
, " HT MCS %s\n",
690 for (i
= 0; i
< ATH10K_HT_MCS_NUM
; i
++)
691 len
+= scnprintf(buf
+ len
, size
- len
,
692 " %llu ", stats
->ht
[j
][i
]);
693 len
+= scnprintf(buf
+ len
, size
- len
, "\n");
694 len
+= scnprintf(buf
+ len
, size
- len
,
695 " BW %s (20,5,10,40,80,160 MHz)\n", str
[j
]);
696 len
+= scnprintf(buf
+ len
, size
- len
,
697 " %llu %llu %llu %llu %llu %llu\n",
698 stats
->bw
[j
][0], stats
->bw
[j
][1],
699 stats
->bw
[j
][2], stats
->bw
[j
][3],
700 stats
->bw
[j
][4], stats
->bw
[j
][5]);
701 len
+= scnprintf(buf
+ len
, size
- len
,
702 " NSS %s (1x1,2x2,3x3,4x4)\n", str
[j
]);
703 len
+= scnprintf(buf
+ len
, size
- len
,
704 " %llu %llu %llu %llu\n",
705 stats
->nss
[j
][0], stats
->nss
[j
][1],
706 stats
->nss
[j
][2], stats
->nss
[j
][3]);
707 len
+= scnprintf(buf
+ len
, size
- len
,
708 " GI %s (LGI,SGI)\n",
710 len
+= scnprintf(buf
+ len
, size
- len
, " %llu %llu\n",
711 stats
->gi
[j
][0], stats
->gi
[j
][1]);
712 len
+= scnprintf(buf
+ len
, size
- len
,
713 " legacy rate %s (1,2 ... Mbps)\n ",
715 for (i
= 0; i
< ATH10K_LEGACY_NUM
; i
++)
716 len
+= scnprintf(buf
+ len
, size
- len
, "%llu ",
717 stats
->legacy
[j
][i
]);
718 len
+= scnprintf(buf
+ len
, size
- len
, "\n");
719 len
+= scnprintf(buf
+ len
, size
- len
,
720 " Rate table %s (1,2 ... Mbps)\n ",
722 for (i
= 0; i
< ATH10K_RATE_TABLE_NUM
; i
++) {
723 len
+= scnprintf(buf
+ len
, size
- len
, "%llu ",
724 stats
->rate_table
[j
][i
]);
727 scnprintf(buf
+ len
, size
- len
, "\n ");
732 len
+= scnprintf(buf
+ len
, size
- len
,
733 "\nTX duration\n %llu usecs\n",
734 arsta
->tx_stats
->tx_duration
);
735 len
+= scnprintf(buf
+ len
, size
- len
,
736 "BA fails\n %llu\n", arsta
->tx_stats
->ba_fails
);
737 len
+= scnprintf(buf
+ len
, size
- len
,
738 "ack fails\n %llu\n", arsta
->tx_stats
->ack_fails
);
739 spin_unlock_bh(&ar
->data_lock
);
743 retval
= simple_read_from_buffer(user_buf
, count
, ppos
, buf
, len
);
746 mutex_unlock(&ar
->conf_mutex
);
750 static const struct file_operations fops_tx_stats
= {
751 .read
= ath10k_dbg_sta_dump_tx_stats
,
753 .owner
= THIS_MODULE
,
754 .llseek
= default_llseek
,
757 void ath10k_sta_add_debugfs(struct ieee80211_hw
*hw
, struct ieee80211_vif
*vif
,
758 struct ieee80211_sta
*sta
, struct dentry
*dir
)
760 struct ath10k
*ar
= hw
->priv
;
762 debugfs_create_file("aggr_mode", 0644, dir
, sta
, &fops_aggr_mode
);
763 debugfs_create_file("addba", 0200, dir
, sta
, &fops_addba
);
764 debugfs_create_file("addba_resp", 0200, dir
, sta
, &fops_addba_resp
);
765 debugfs_create_file("delba", 0200, dir
, sta
, &fops_delba
);
766 debugfs_create_file("peer_debug_trigger", 0600, dir
, sta
,
767 &fops_peer_debug_trigger
);
768 debugfs_create_file("dump_tid_stats", 0400, dir
, sta
,
769 &fops_tid_stats_dump
);
771 if (ath10k_peer_stats_enabled(ar
) &&
772 ath10k_debug_is_extd_tx_stats_enabled(ar
))
773 debugfs_create_file("tx_stats", 0400, dir
, sta
,
775 debugfs_create_file("peer_ps_state", 0400, dir
, sta
,
776 &fops_peer_ps_state
);