xref: /wlan-dirver/qca-wifi-host-cmn/umac/cfr/dispatcher/inc/wlan_cfr_public_structs.h (revision 97f44cd39e4ff816eaa1710279d28cf6b9e65ad9)
1 /*
2  * Copyright (c) 2020, 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  */
31 enum cfr_cwm_width {
32 	CFR_CWM_WIDTH20,
33 	CFR_CWM_WIDTH40,
34 	CFR_CWM_WIDTH80,
35 	CFR_CWM_WIDTH160,
36 	CFR_CWM_WIDTH80_80,
37 
38 	CFR_CWM_WIDTH_MAX,
39 	CFR_CWM_WIDTHINVALID = 0xff
40 };
41 
42 /**
43  * cfr_capture_method : Tx based CFR capture method
44  * @CFR_CAPTURE_METHOD_QOS_NULL : Send QOS Null frame and capture CFR on ACK
45  * @CFR_CAPTURE_METHOD_QOS_NULL_WITH_PHASE: Send QoS Null frame with phase
46  * @CFR_CAPTURE_METHOD_PROBE_RESPONSE : Capture is enabled on probe response
47  * If node is not found, trigger unassociated capture.
48  */
49 enum cfr_capture_method {
50 	CFR_CAPTURE_METHOD_QOS_NULL = 0,
51 	CFR_CAPTURE_METHOD_QOS_NULL_WITH_PHASE = 1,
52 	CFR_CAPTURE_METHOD_PROBE_RESPONSE = 2,
53 	CFR_CAPTURE_METHOD_LAST_VALID,
54 	CFR_CAPTURE_METHOD_AUTO = 0xff,
55 	CFR_CAPTURE_METHOD_MAX,
56 };
57 
58 /**
59  * cfr_wlanconfig_param : CFR params used to store user provided inputs
60  * @bandwidth : CFR capture bandwidth
61  * @periodicity : CFR capture periodicity in milli seconds
62  * @capture_method : CFR capture method
63  * @mac : peer mac address
64  * @ta : Tx address
65  * @ra : Rx Address
66  * @ta_mask: Tx address mask
67  * @ra_mask; Rx address mask
68  * *** Controls for different capture modes in RCC ***
69  * @en_directed_ftm: Enable capture for directed RTT FTM Packet
70  * @en_directed_ndpa_ndp: Enable NDPA filter followed by directed NDP capture
71  * @en_ta_ra_filter: Enable MAC TA/RA/type filtering channel capture
72  * @en_all_ftm_ack: Enable all FTM and ACK capture
73  * @en_ndpa_ndp_all: Enable NDPA filter followed by NDP capture,
74  *                   capture includes both directed and non-directed packets.
75  * @en_all_pkt: Enable capture mode to filter in all packets
76  * @dis_directed_ftm: Drop directed RTT FTM packets
77  * @dis_directed_ndpa_ndp: Drop directed NDPA and NDP packets
78  * @dis_ta_ra_filter: Disable MAC TA/RA/type filtering channel capture
79  * @dis_all_ftm_ack: Drop all FTM and ACK capture
80  * @dis_ndpa_ndp_all: Drop all NDPA and NDP packets
81  * @dis_all_pkt: Do not filter in any packet
82  * @en_ta_ra_filter_in_as_fp: Filter in frames as FP/MO in m_ta_ra_filter mode
83  *		0: as MO
84  *		1: as FP
85  *
86  * **** Fixed parameters ****
87  * @cap_dur: Capture duration
88  * @cap_intvl: Capture interval
89  * FW may limit the interval and duration during which HW may attempt
90  * to capture by programming the user provided values.
91  * These values(cap_dur, cap_intvl) range from 1 us to roughly 16.8 in 1 us
92  * units. Max value is 0xFFFFFF, i.e., 16.777215 s
93  * @bw: Bandwidth: 20, 40, 80, 160, 320MHz
94  * @nss: 8 bits are allotted for NSS mask. Specifies which numbers of
95  * spatial streams (MIMO factor) are permitted
96  * @grp_id:  Group id could of any value between 0 and 15
97  * @expected_mgmt_subtype/ expected_ctrl_subtype / expected_data_subtype:
98  * corresponds to mgmt/ ctrl/ data, all are bitmasks, in which each bit
99  * represents the corresponding type/ subtype value as per IEEE80211.
100  *
101  * @en_cfg and reset_cfg: This bitmap of 16 bits, indicates 16 groups.
102  * Valid entry should be in between 0 to 0xFFFF.
103  * Turning on a bit in en_cfg will enable MAC TA_RA filter
104  * for corresponding group; whereas turning on a bit in reset_cfg
105  * will reset all 9 params in the corresponding group to default values.
106  *
107  * @ul_mu_user_mask_lower, ul_mu_user_mask_upper :
108  * Since Cypress supports max bandwidth of 80Mhz, maximum number
109  * of users in a UL MU-MIMO transmission would be 37.
110  * mask_lower_32: Bits from 31 to 0 indicate user indices for 32 users.
111  * mask_upper_32: Bits from 0 to 4 indicate user indices from 33 to 37.
112  *
113  * @ freeze_tlv_delay_cnt_en, freeze_tlv_delay_cnt_thr :
114  * freeze_tlv_delay_cnt_thr will decide the threshold for MAC to drop the
115  * freeze TLV. freeze_tlv_delay_cnt_thr will only be applicable if
116  * freeze_tlv_delay_cnt_en is enabled.
117  *
118  * @cap_count: After capture_count+1 number of captures, MAC stops RCC and
119  * waits for capture_interval duration before enabling again
120  *
121  * @cap_intval_mode_sel: 0 indicates capture_duration mode, 1 indicates the
122  * capture_count mode.
123  */
124 struct cfr_wlanconfig_param {
125 	enum cfr_cwm_width bandwidth;
126 	uint32_t periodicity;
127 	enum cfr_capture_method capture_method;
128 	uint8_t mac[MAC_ADDR_LEN];
129 #ifdef WLAN_ENH_CFR_ENABLE
130 	uint8_t ta[MAC_ADDR_LEN];
131 	uint8_t ra[MAC_ADDR_LEN];
132 	uint8_t ta_mask[MAC_ADDR_LEN];
133 	uint8_t ra_mask[MAC_ADDR_LEN];
134 	uint16_t en_directed_ftm             :1,
135 		 en_directed_ndpa_ndp        :1,
136 		 en_ta_ra_filter             :1,
137 		 en_all_ftm_ack              :1,
138 		 en_ndpa_ndp_all             :1,
139 		 en_all_pkt                  :1,
140 		 dis_directed_ftm            :1,
141 		 dis_directed_ndpa_ndp       :1,
142 		 dis_ta_ra_filter            :1,
143 		 dis_all_ftm_ack             :1,
144 		 dis_ndpa_ndp_all            :1,
145 		 dis_all_pkt                 :1,
146 		 en_ta_ra_filter_in_as_fp    :1,
147 		 rsvd0                       :3;
148 
149 	uint32_t cap_dur                     :24,
150 		 rsvd1                       :8;
151 	uint32_t cap_intvl                   :24,
152 		 rsvd2                       :8;
153 	uint32_t bw                          :5,
154 		 nss                         :8,
155 		 grp_id                      :4,
156 		 rsvd3                       :15;
157 
158 	uint32_t expected_mgmt_subtype       :16,
159 		 expected_ctrl_subtype       :16;
160 
161 	uint32_t expected_data_subtype       :16,
162 		 rsvd5                       :16;
163 
164 	uint32_t en_cfg                      :16,
165 		 reset_cfg                   :16;
166 
167 	uint32_t ul_mu_user_mask_lower;
168 	uint32_t ul_mu_user_mask_upper;
169 
170 	uint32_t freeze_tlv_delay_cnt_en :1,
171 		 freeze_tlv_delay_cnt_thr :8,
172 		 rsvd6 :23;
173 
174 	uint32_t cap_count                   :16,
175 		 cap_intval_mode_sel         :1,
176 		 rsvd7                       :15;
177 #endif
178 };
179 
180 #endif /* _WLAN_CFR_PUBLIC_STRUCTS_H_ */
181 
182