xref: /wlan-dirver/qca-wifi-host-cmn/umac/cfr/dispatcher/inc/wlan_cfr_public_structs.h (revision 901120c066e139c7f8a2c8e4820561fdd83c67ef)
1 /*
2  * Copyright (c) 2020-2021, The Linux Foundation. All rights reserved.
3  * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
4  *
5  * Permission to use, copy, modify, and/or distribute this software for any
6  * purpose with or without fee is hereby granted, provided that the above
7  * copyright notice and this permission notice appear in all copies.
8  *
9  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16  */
17 
18 /**
19  * DOC: declare the data structure to hold CFR specific configurations
20  */
21 #ifndef _WLAN_CFR_PUBLIC_STRUCTS_H_
22 #define _WLAN_CFR_PUBLIC_STRUCTS_H_
23 
24 #define MAC_ADDR_LEN 6
25 
26 #define MAX_CAPTURE_COUNT_VAL 0xFFFF
27 
28 /**
29  * cfr_cwm_width : Capture bandwidth
30  * 0 : 20MHz, 1 : 40MHz, 2 : 80MHz, 3 : 160MHz, 4 : 80+80MHz
31  * 5 : 320MHz
32  */
33 enum cfr_cwm_width {
34 	CFR_CWM_WIDTH20,
35 	CFR_CWM_WIDTH40,
36 	CFR_CWM_WIDTH80,
37 	CFR_CWM_WIDTH160,
38 	CFR_CWM_WIDTH80_80,
39 	CFR_CWM_WIDTH320,
40 
41 	CFR_CWM_WIDTH_MAX,
42 	CFR_CWM_WIDTHINVALID = 0xff
43 };
44 
45 /**
46  * cfr_capture_method : Tx based CFR capture method
47  * @CFR_CAPTURE_METHOD_QOS_NULL : Send QOS Null frame and capture CFR on ACK
48  * @CFR_CAPTURE_METHOD_QOS_NULL_WITH_PHASE: Send QoS Null frame with phase
49  * @CFR_CAPTURE_METHOD_PROBE_RESPONSE : Capture is enabled on probe response
50  * If node is not found, trigger unassociated capture.
51  */
52 enum cfr_capture_method {
53 	CFR_CAPTURE_METHOD_QOS_NULL = 0,
54 	CFR_CAPTURE_METHOD_QOS_NULL_WITH_PHASE = 1,
55 	CFR_CAPTURE_METHOD_PROBE_RESPONSE = 2,
56 	CFR_CAPTURE_METHOD_LAST_VALID,
57 	CFR_CAPTURE_METHOD_AUTO = 0xff,
58 	CFR_CAPTURE_METHOD_MAX,
59 };
60 
61 /**
62  * cfr_wlanconfig_param : CFR params used to store user provided inputs
63  * @bandwidth : CFR capture bandwidth
64  * @periodicity : CFR capture periodicity in milli seconds
65  * @capture_method : CFR capture method
66  * @mac : peer mac address
67  * @ta : Tx address
68  * @ra : Rx Address
69  * @ta_mask: Tx address mask
70  * @ra_mask; Rx address mask
71  * *** Controls for different capture modes in RCC ***
72  * @en_directed_ftm: Enable capture for directed RTT FTM Packet
73  * @en_directed_ndpa_ndp: Enable NDPA filter followed by directed NDP capture
74  * @en_ta_ra_filter: Enable MAC TA/RA/type filtering channel capture
75  * @en_all_ftm_ack: Enable all FTM and ACK capture
76  * @en_ndpa_ndp_all: Enable NDPA filter followed by NDP capture,
77  *                   capture includes both directed and non-directed packets.
78  * @en_all_pkt: Enable capture mode to filter in all packets
79  * @dis_directed_ftm: Drop directed RTT FTM packets
80  * @dis_directed_ndpa_ndp: Drop directed NDPA and NDP packets
81  * @dis_ta_ra_filter: Disable MAC TA/RA/type filtering channel capture
82  * @dis_all_ftm_ack: Drop all FTM and ACK capture
83  * @dis_ndpa_ndp_all: Drop all NDPA and NDP packets
84  * @dis_all_pkt: Do not filter in any packet
85  * @en_ta_ra_filter_in_as_fp: Filter in frames as FP/MO in m_ta_ra_filter mode
86  *		0: as MO
87  *		1: as FP
88  *
89  * **** Fixed parameters ****
90  * @cap_dur: Capture duration
91  * @cap_intvl: Capture interval
92  * FW may limit the interval and duration during which HW may attempt
93  * to capture by programming the user provided values.
94  * These values(cap_dur, cap_intvl) range from 1 us to roughly 16.8 in 1 us
95  * units. Max value is 0xFFFFFF, i.e., 16.777215 s
96  * @bw: Bandwidth: 20, 40, 80, 160, 240, 320MHz
97  * @nss: 8 bits are allotted for NSS mask. Specifies which numbers of
98  * spatial streams (MIMO factor) are permitted
99  * @grp_id:  Group id could of any value between 0 and 15
100  * @expected_mgmt_subtype/ expected_ctrl_subtype / expected_data_subtype:
101  * corresponds to mgmt/ ctrl/ data, all are bitmasks, in which each bit
102  * represents the corresponding type/ subtype value as per IEEE80211.
103  *
104  * @en_cfg and reset_cfg: This bitmap of 16 bits, indicates 16 groups.
105  * Valid entry should be in between 0 to 0xFFFF.
106  * Turning on a bit in en_cfg will enable MAC TA_RA filter
107  * for corresponding group; whereas turning on a bit in reset_cfg
108  * will reset all 9 params in the corresponding group to default values.
109  *
110  * @ul_mu_user_mask_lower, ul_mu_user_mask_upper :
111  * Since Cypress supports max bandwidth of 80Mhz, maximum number
112  * of users in a UL MU-MIMO transmission would be 37.
113  * mask_lower_32: Bits from 31 to 0 indicate user indices for 32 users.
114  * mask_upper_32: Bits from 0 to 4 indicate user indices from 33 to 37.
115  *
116  * @ freeze_tlv_delay_cnt_en, freeze_tlv_delay_cnt_thr :
117  * freeze_tlv_delay_cnt_thr will decide the threshold for MAC to drop the
118  * freeze TLV. freeze_tlv_delay_cnt_thr will only be applicable if
119  * freeze_tlv_delay_cnt_en is enabled.
120  *
121  * @cap_count: After capture_count+1 number of captures, MAC stops RCC and
122  * waits for capture_interval duration before enabling again
123  *
124  * @cap_intval_mode_sel: 0 indicates capture_duration mode, 1 indicates the
125  * capture_count mode.
126  */
127 struct cfr_wlanconfig_param {
128 	enum cfr_cwm_width bandwidth;
129 	uint32_t periodicity;
130 	enum cfr_capture_method capture_method;
131 	uint8_t mac[MAC_ADDR_LEN];
132 #ifdef WLAN_ENH_CFR_ENABLE
133 	uint8_t ta[MAC_ADDR_LEN];
134 	uint8_t ra[MAC_ADDR_LEN];
135 	uint8_t ta_mask[MAC_ADDR_LEN];
136 	uint8_t ra_mask[MAC_ADDR_LEN];
137 	uint16_t en_directed_ftm             :1,
138 		 en_directed_ndpa_ndp        :1,
139 		 en_ta_ra_filter             :1,
140 		 en_all_ftm_ack              :1,
141 		 en_ndpa_ndp_all             :1,
142 		 en_all_pkt                  :1,
143 		 dis_directed_ftm            :1,
144 		 dis_directed_ndpa_ndp       :1,
145 		 dis_ta_ra_filter            :1,
146 		 dis_all_ftm_ack             :1,
147 		 dis_ndpa_ndp_all            :1,
148 		 dis_all_pkt                 :1,
149 		 en_ta_ra_filter_in_as_fp    :1,
150 		 rsvd0                       :3;
151 
152 	uint32_t cap_dur                     :24,
153 		 rsvd1                       :8;
154 	uint32_t cap_intvl                   :24,
155 		 rsvd2                       :8;
156 	uint32_t bw                          :6,
157 		 nss                         :8,
158 		 grp_id                      :4,
159 		 rsvd3                       :14;
160 
161 	uint32_t expected_mgmt_subtype       :16,
162 		 expected_ctrl_subtype       :16;
163 
164 	uint32_t expected_data_subtype       :16,
165 		 rsvd5                       :16;
166 
167 	uint32_t en_cfg                      :16,
168 		 reset_cfg                   :16;
169 
170 	uint32_t ul_mu_user_mask_lower;
171 	uint32_t ul_mu_user_mask_upper;
172 
173 	uint32_t freeze_tlv_delay_cnt_en :1,
174 		 freeze_tlv_delay_cnt_thr :8,
175 		 rsvd6 :23;
176 
177 	uint32_t cap_count                   :16,
178 		 cap_intval_mode_sel         :1,
179 		 rsvd7                       :15;
180 #endif
181 };
182 
183 #endif /* _WLAN_CFR_PUBLIC_STRUCTS_H_ */
184 
185