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