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