xref: /wlan-driver/qca-wifi-host-cmn/umac/dcs/dispatcher/inc/wlan_dcs_public_structs.h (revision 5113495b16420b49004c444715d2daae2066e7dc)
1*5113495bSYour Name /*
2*5113495bSYour Name  * Copyright (c) 2020-2021, The Linux Foundation. All rights reserved.
3*5113495bSYour Name  * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
4*5113495bSYour Name  *
5*5113495bSYour Name  * Permission to use, copy, modify, and/or distribute this software for any
6*5113495bSYour Name  * purpose with or without fee is hereby granted, provided that the above
7*5113495bSYour Name  * copyright notice and this permission notice appear in all copies.
8*5113495bSYour Name  *
9*5113495bSYour Name  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10*5113495bSYour Name  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11*5113495bSYour Name  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12*5113495bSYour Name  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13*5113495bSYour Name  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14*5113495bSYour Name  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15*5113495bSYour Name  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16*5113495bSYour Name  */
17*5113495bSYour Name 
18*5113495bSYour Name /**
19*5113495bSYour Name  * DOC: contains dcs structure definitions
20*5113495bSYour Name  */
21*5113495bSYour Name 
22*5113495bSYour Name #ifndef _WLAN_DCS_PUBLIC_STRUCTS_H_
23*5113495bSYour Name #define _WLAN_DCS_PUBLIC_STRUCTS_H_
24*5113495bSYour Name 
25*5113495bSYour Name /**
26*5113495bSYour Name  * enum wlan_host_dcs_type - types of DCS interference events
27*5113495bSYour Name  * @WLAN_HOST_DCS_NONE: invalid type
28*5113495bSYour Name  * @WLAN_HOST_DCS_CWIM: continuous wave interference
29*5113495bSYour Name  * @WLAN_HOST_DCS_WLANIM: wlan interference stats
30*5113495bSYour Name  * @WLAN_HOST_DCS_AWGNIM: additive white Gaussian noise (awgn) interference
31*5113495bSYour Name  * @WLAN_HOST_DCS_AFC: AFC data update 6 GHz SP channels
32*5113495bSYour Name  */
33*5113495bSYour Name enum wlan_host_dcs_type {
34*5113495bSYour Name 	WLAN_HOST_DCS_NONE   = 0,      /* 0x0 */
35*5113495bSYour Name 	WLAN_HOST_DCS_CWIM   = BIT(0), /* 0x1 */
36*5113495bSYour Name 	WLAN_HOST_DCS_WLANIM = BIT(1), /* 0x2 */
37*5113495bSYour Name 	WLAN_HOST_DCS_AWGNIM = BIT(2), /* 0x4 */
38*5113495bSYour Name 	WLAN_HOST_DCS_AFC    = BIT(3), /* 0x8 */
39*5113495bSYour Name };
40*5113495bSYour Name 
41*5113495bSYour Name /**
42*5113495bSYour Name  * struct wlan_host_dcs_interference_param - dcs interference parameters
43*5113495bSYour Name  * @interference_type: type of DCS interference
44*5113495bSYour Name  * @pdev_id: pdev id
45*5113495bSYour Name  */
46*5113495bSYour Name struct wlan_host_dcs_interference_param {
47*5113495bSYour Name 	uint32_t interference_type;
48*5113495bSYour Name 	uint32_t pdev_id;
49*5113495bSYour Name };
50*5113495bSYour Name 
51*5113495bSYour Name /**
52*5113495bSYour Name  * struct wlan_host_dcs_mib_stats - WLAN IM stats from target to host
53*5113495bSYour Name  * @listen_time:
54*5113495bSYour Name  * @reg_tx_frame_cnt:
55*5113495bSYour Name  * @reg_rx_frame_cnt:
56*5113495bSYour Name  * @reg_rxclr_cnt:
57*5113495bSYour Name  * @reg_cycle_cnt: delta cycle count
58*5113495bSYour Name  * @reg_rxclr_ext_cnt:
59*5113495bSYour Name  * @reg_ofdm_phyerr_cnt:
60*5113495bSYour Name  * @reg_cck_phyerr_cnt: CCK err count since last reset, read from register
61*5113495bSYour Name  */
62*5113495bSYour Name struct wlan_host_dcs_mib_stats {
63*5113495bSYour Name 	int32_t listen_time;
64*5113495bSYour Name 	uint32_t reg_tx_frame_cnt;
65*5113495bSYour Name 	uint32_t reg_rx_frame_cnt;
66*5113495bSYour Name 	uint32_t reg_rxclr_cnt;
67*5113495bSYour Name 	uint32_t reg_cycle_cnt;
68*5113495bSYour Name 	uint32_t reg_rxclr_ext_cnt;
69*5113495bSYour Name 	uint32_t reg_ofdm_phyerr_cnt;
70*5113495bSYour Name 	uint32_t reg_cck_phyerr_cnt;
71*5113495bSYour Name };
72*5113495bSYour Name 
73*5113495bSYour Name /**
74*5113495bSYour Name  * struct wlan_host_dcs_im_tgt_stats - DCS IM target stats
75*5113495bSYour Name  * @reg_tsf32: current running TSF from the TSF-1
76*5113495bSYour Name  * @last_ack_rssi: known last frame rssi, in case of multiple stations, if
77*5113495bSYour Name  *      and at different ranges, this would not guarantee that
78*5113495bSYour Name  *      this is the least rssi.
79*5113495bSYour Name  * @tx_waste_time: sum of all the failed durations in the last
80*5113495bSYour Name  *      one second interval.
81*5113495bSYour Name  * @rx_time: count how many times the hal_rxerr_phy is marked, in this
82*5113495bSYour Name  *      time period
83*5113495bSYour Name  * @phyerr_cnt:
84*5113495bSYour Name  * @mib_stats: collected mib stats as explained in mib structure
85*5113495bSYour Name  * @chan_nf: Channel noise floor (units are in dBm)
86*5113495bSYour Name  * @my_bss_rx_cycle_count: BSS rx cycle count
87*5113495bSYour Name  * @reg_rxclr_ext40_cnt: extension channel 40Mhz rxclear count
88*5113495bSYour Name  * @reg_rxclr_ext80_cnt: extension channel 80Mhz rxclear count
89*5113495bSYour Name  */
90*5113495bSYour Name struct wlan_host_dcs_im_tgt_stats {
91*5113495bSYour Name 	uint32_t reg_tsf32;
92*5113495bSYour Name 	uint32_t last_ack_rssi;
93*5113495bSYour Name 	uint32_t tx_waste_time;
94*5113495bSYour Name 	uint32_t rx_time;
95*5113495bSYour Name 	uint32_t phyerr_cnt;
96*5113495bSYour Name 	struct wlan_host_dcs_mib_stats mib_stats;
97*5113495bSYour Name 	uint32_t chan_nf;
98*5113495bSYour Name 	uint32_t my_bss_rx_cycle_count;
99*5113495bSYour Name 	uint32_t reg_rxclr_ext40_cnt;
100*5113495bSYour Name 	uint32_t reg_rxclr_ext80_cnt;
101*5113495bSYour Name };
102*5113495bSYour Name 
103*5113495bSYour Name /**
104*5113495bSYour Name  * struct wlan_host_dcs_ch_util_stats - DCS IM chan utilization stats
105*5113495bSYour Name  * @rx_cu: rx channel utilization
106*5113495bSYour Name  * @tx_cu: tx channel utilization
107*5113495bSYour Name  * @obss_rx_cu: obss rx channel utilization
108*5113495bSYour Name  * @total_cu: total channel utilization
109*5113495bSYour Name  * @chan_nf: Channel noise floor (units are in dBm)
110*5113495bSYour Name  */
111*5113495bSYour Name struct wlan_host_dcs_ch_util_stats {
112*5113495bSYour Name 	uint32_t rx_cu;
113*5113495bSYour Name 	uint32_t tx_cu;
114*5113495bSYour Name 	uint32_t obss_rx_cu;
115*5113495bSYour Name 	uint32_t total_cu;
116*5113495bSYour Name 	uint32_t chan_nf;
117*5113495bSYour Name };
118*5113495bSYour Name 
119*5113495bSYour Name /**
120*5113495bSYour Name  * struct wlan_host_dcs_im_user_stats - DCS IM stats requested by userspace
121*5113495bSYour Name  * @max_rssi: max rssi of the bss traffic
122*5113495bSYour Name  * @min_rssi: min rssi of the bss traffic
123*5113495bSYour Name  * @cycle_count: cycle count
124*5113495bSYour Name  * @rxclr_count: rx clear count
125*5113495bSYour Name  * @rx_frame_count: rx frame count
126*5113495bSYour Name  * @my_bss_rx_cycle_count: BSS rx cycle count
127*5113495bSYour Name  */
128*5113495bSYour Name struct wlan_host_dcs_im_user_stats {
129*5113495bSYour Name 	uint32_t max_rssi;
130*5113495bSYour Name 	uint32_t min_rssi;
131*5113495bSYour Name 	uint32_t cycle_count;
132*5113495bSYour Name 	uint32_t rxclr_count;
133*5113495bSYour Name 	uint32_t rx_frame_count;
134*5113495bSYour Name 	uint32_t my_bss_rx_cycle_count;
135*5113495bSYour Name };
136*5113495bSYour Name 
137*5113495bSYour Name /**
138*5113495bSYour Name  * struct wlan_host_dcs_awgn_info - DCS AWGN info
139*5113495bSYour Name  * @channel_width: Channel width, enum phy_ch_width
140*5113495bSYour Name  * @center_freq: Center frequency of primary channel
141*5113495bSYour Name  * @center_freq0: Center frequency of segment 1
142*5113495bSYour Name  * @center_freq1: Center frequency of segment 2
143*5113495bSYour Name  * @chan_bw_intf_bitmap: Per-20MHz interference bitmap, each bit
144*5113495bSYour Name  *  indicates 20MHz in which interference is seen, e.g.
145*5113495bSYour Name  *  bit0 - primary 20MHz, bit1 - secondary 20MHz,
146*5113495bSYour Name  *  bit2 - secondary 40MHz Lower, bit3 - secondary 40MHz Upper
147*5113495bSYour Name  */
148*5113495bSYour Name struct wlan_host_dcs_awgn_info {
149*5113495bSYour Name 	enum phy_ch_width channel_width;
150*5113495bSYour Name 	qdf_freq_t center_freq;
151*5113495bSYour Name 	qdf_freq_t center_freq0;
152*5113495bSYour Name 	qdf_freq_t center_freq1;
153*5113495bSYour Name 	uint32_t chan_bw_intf_bitmap;
154*5113495bSYour Name };
155*5113495bSYour Name 
156*5113495bSYour Name /**
157*5113495bSYour Name  * struct wlan_host_dcs_event - define dcs event
158*5113495bSYour Name  * @wlan_stat: wlan interference target statistics
159*5113495bSYour Name  * @dcs_param: dcs event param
160*5113495bSYour Name  * @awgn_info: awgn info
161*5113495bSYour Name  */
162*5113495bSYour Name struct wlan_host_dcs_event {
163*5113495bSYour Name 	struct wlan_host_dcs_im_tgt_stats wlan_stat;
164*5113495bSYour Name 	struct wlan_host_dcs_interference_param dcs_param;
165*5113495bSYour Name 	struct wlan_host_dcs_awgn_info awgn_info;
166*5113495bSYour Name };
167*5113495bSYour Name #endif
168