xref: /openwifi/doc/app_notes/driver_stat.md (revision 17cfeb0bf7dd911e01a15d6f16132920824e9594)
1Comprehensive statistics are offered at the driver level via the [Linux sysfs](https://en.wikipedia.org/wiki/Sysfs#:~:text=sysfs%20is%20a%20pseudo%20file,user%20space%20through%20virtual%20files.).
2
3[[Quick start](#Quick-start)]
4[[Sysfs explanation](#Sysfs-explanation)]
5[[Statistics variable file meaning](#Statistics-variable-file-meaning)]
6
7All operations should be done on board in openwifi directory, not in host PC.
8
9## Quick start
10
11Enable the driver level statistics (after openwifi up and running)
12```
13./stat_enable.sh
14```
15Show the statistics
16```
17./tx_stat_show.sh
18./tx_prio_queue_show.sh
19./rx_stat_show.sh
20./rx_gain_show.sh
21```
22Clear the stattistics
23```
24./tx_stat_show.sh clear
25./tx_prio_queue_show.sh clear
26./rx_stat_show.sh clear
27```
28To only show the statistics for the link with a specific peer node
29```
30./set_rx_target_sender_mac_addr.sh c83caf93
31(If the peer node MAC address is 00:80:c8:3c:af:93)
32```
33To show the statistics of all (not filtered by the peer node MAC address)
34```
35./set_rx_target_sender_mac_addr.sh 0
36```
37To show the peer node MAC address for statistics
38```
39./set_rx_target_sender_mac_addr.sh
40```
41To see the statistics of ACK packet, run this before above scripts
42```
43./set_rx_monitor_all.sh
44```
45Disable the statistics of ACK packet, run this before above scripts
46```
47./set_rx_monitor_all.sh 0
48```
49Disable the driver level statistics (after openwifi up and running)
50```
51./stat_enable.sh 0
52```
53
54## Sysfs explanation
55
56For user, as you can check in those scripts above, the sysfs is a set of files that can be operated in the command line for communicating with kernel module. You can find these files on zcu102 board at
57```
58/sys/devices/platform/fpga-axi@0/fpga-axi@0:sdr
59```
60On othe boards at
61```
62/sys/devices/soc0/fpga-axi@0/fpga-axi@0:sdr
63```
64
65## Statistics variable file meaning
66
67These statistics names are the same as the file names (in those scripts) and variable names in the sdr.c. Do search these names in sdr.c to understand exact meaning of these statistics.
68
69- tx_stat_show.sh
70
71  name|meaning
72  ------------|----------------------
73  tx_data_pkt_need_ack_num_total     | number of tx data packet reported in openwifi_tx_interrupt() (both fail and succeed)
74  tx_data_pkt_need_ack_num_total_fail| number of tx data packet reported in openwifi_tx_interrupt() (fail -- no ACK received)
75  tx_data_pkt_need_ack_num_retx      | number of tx data packet reported in openwifi_tx_interrupt() at different number of retransmission (both fail and succeed)
76  tx_data_pkt_need_ack_num_retx_fail | number of tx data packet reported in openwifi_tx_interrupt() at different number of retransmission (fail -- no ACK received)
77  tx_data_pkt_mcs_realtime           | MCS (10*Mbps) of tx data packet reported in openwifi_tx_interrupt() (both fail and succeed)
78  tx_data_pkt_fail_mcs_realtime      | MCS (10*Mbps) of tx data packet reported in openwifi_tx_interrupt() (fail -- no ACK received)
79  tx_mgmt_pkt_need_ack_num_total     | number of tx management packet reported in openwifi_tx_interrupt() (both fail and succeed)
80  tx_mgmt_pkt_need_ack_num_total_fail| number of tx management packet reported in openwifi_tx_interrupt() (fail -- no ACK received)
81  tx_mgmt_pkt_need_ack_num_retx      | number of tx management packet reported in openwifi_tx_interrupt() at different number of retransmission (both fail and succeed)
82  tx_mgmt_pkt_need_ack_num_retx_fail | number of tx management packet reported in openwifi_tx_interrupt() at different number of retransmission (fail -- no ACK received)
83  tx_mgmt_pkt_mcs_realtime           | MCS (10*Mbps) of tx management packet reported in openwifi_tx_interrupt() (both fail and succeed)
84  tx_mgmt_pkt_fail_mcs_realtime      | MCS (10*Mbps) of tx management packet reported in openwifi_tx_interrupt() (fail -- no ACK received)
85
86- tx_prio_queue_show.sh
87
88  tx_prio_queue_show.sh will show 4 rows. Each row is corresponding one Linux-prio and one FPGA queue. Each row has 12 elements. Elements' name will not be displayed in the command line.
89
90  Element name|meaning
91  ------------|----------------------
92  tx_prio_num            | number of tx packet from Linux prio N to openwifi_tx()
93  tx_prio_interrupt_num  | number of tx packet from Linux prio N recorded in openwifi_tx_interrupt()
94  tx_prio_stop0_fake_num | number of Linux prio N stopped attempt in the 1st place of openwfii_tx(), fake alarm
95  tx_prio_stop0_real_num | number of Linux prio N stopped attempt in the 1st place of openwfii_tx(), real stop
96  tx_prio_stop1_num      | number of Linux prio N stopped in the 2nd place of openwfii_tx()
97  tx_prio_wakeup_num     | number of Linux prio N waked up in openwifi_tx_interrupt()
98  tx_queue_num           | number of tx packet for FPGA queue N to openwifi_tx()
99  tx_queue_interrupt_num | number of tx packet for FPGA queue N recorded in openwifi_tx_interrupt()
100  tx_queue_stop0_fake_num| number of FPGA queue N stopped attempt in the 1st place of openwfii_tx(), fake alarm
101  tx_queue_stop0_real_num| number of FPGA queue N stopped attempt in the 1st place of openwfii_tx(), real stop
102  tx_queue_stop1_num     | number of FPGA queue N stopped in the 2nd place of openwfii_tx()
103  tx_queue_wakeup_num    | number of FPGA queue N waked up in openwifi_tx_interrupt()
104
105- rx_stat_show.sh
106
107  name|meaning
108  ------------|----------------------
109  rx_data_pkt_num_total               | number of rx data packet with both FCS ok and failed
110  rx_data_pkt_num_fail                | number of rx data packet with FCS failed
111  rx_mgmt_pkt_num_total               | number of rx management packet with both FCS ok and failed
112  rx_mgmt_pkt_num_fail                | number of rx management packet with FCS failed
113  rx_ack_pkt_num_total                | number of rx ACK packet with both FCS ok and failed
114  rx_ack_pkt_num_fail                 | number of rx ACK packet with FCS failed
115  rx_data_pkt_mcs_realtime            | MCS (10*Mbps) of rx data packet with both FCS ok and failed
116  rx_data_pkt_fail_mcs_realtime       | MCS (10*Mbps) of rx data packet with FCS failed
117  rx_mgmt_pkt_mcs_realtime            | MCS (10*Mbps) of rx management packet with both FCS ok and failed
118  rx_mgmt_pkt_fail_mcs_realtime       | MCS (10*Mbps) of rx management packet with FCS failed
119  rx_ack_pkt_mcs_realtime             | MCS (10*Mbps) of rx ACK packet with both FCS ok and failed
120  rx_data_ok_agc_gain_value_realtime  | agc gain value of rx data packet with FCS ok
121  rx_data_fail_agc_gain_value_realtime| agc gain value of rx data packet with FCS failed
122  rx_mgmt_ok_agc_gain_value_realtime  | agc gain value of rx management packet with FCS ok
123  rx_mgmt_fail_agc_gain_value_realtime| agc gain value of rx management packet with FCS failed
124  rx_ack_ok_agc_gain_value_realtime   | agc gain value of rx ACK packet with FCS ok
125
126- rx_gain_show.sh
127
128  name|meaning
129  ------------|----------------------
130  rx_data_ok_agc_gain_value_realtime  | agc gain value of rx data packet with FCS ok
131  rx_data_fail_agc_gain_value_realtime| agc gain value of rx data packet with FCS failed
132  rx_mgmt_ok_agc_gain_value_realtime  | agc gain value of rx management packet with FCS ok
133  rx_mgmt_fail_agc_gain_value_realtime| agc gain value of rx management packet with FCS failed
134  rx_ack_ok_agc_gain_value_realtime   | agc gain value of rx ACK packet with FCS ok
135
136  Note: gain value here is always 14 dB higher than set_rx_gain_auto.sh/set_rx_gain_manual.sh at 5220MHz. 5dB higher at 2.4GHz.
137