xref: /linux/drivers/net/wireless/marvell/libertas/types.h (revision 9a87ffc99ec8eb8d35eed7c4f816d75f5cc9662e)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * This header file contains definition for global types
4  */
5 #ifndef _LBS_TYPES_H_
6 #define _LBS_TYPES_H_
7 
8 #include <linux/if_ether.h>
9 #include <linux/ieee80211.h>
10 #include <asm/byteorder.h>
11 
12 struct ieee_ie_header {
13 	u8 id;
14 	u8 len;
15 } __packed;
16 
17 struct ieee_ie_cf_param_set {
18 	struct ieee_ie_header header;
19 
20 	u8 cfpcnt;
21 	u8 cfpperiod;
22 	__le16 cfpmaxduration;
23 	__le16 cfpdurationremaining;
24 } __packed;
25 
26 
27 struct ieee_ie_ibss_param_set {
28 	struct ieee_ie_header header;
29 
30 	__le16 atimwindow;
31 } __packed;
32 
33 union ieee_ss_param_set {
34 	struct ieee_ie_cf_param_set cf;
35 	struct ieee_ie_ibss_param_set ibss;
36 } __packed;
37 
38 struct ieee_ie_fh_param_set {
39 	struct ieee_ie_header header;
40 
41 	__le16 dwelltime;
42 	u8 hopset;
43 	u8 hoppattern;
44 	u8 hopindex;
45 } __packed;
46 
47 struct ieee_ie_ds_param_set {
48 	struct ieee_ie_header header;
49 
50 	u8 channel;
51 } __packed;
52 
53 union ieee_phy_param_set {
54 	struct ieee_ie_fh_param_set fh;
55 	struct ieee_ie_ds_param_set ds;
56 } __packed;
57 
58 /* TLV  type ID definition */
59 #define PROPRIETARY_TLV_BASE_ID		0x0100
60 
61 /* Terminating TLV type */
62 #define MRVL_TERMINATE_TLV_ID		0xffff
63 
64 #define TLV_TYPE_SSID				0x0000
65 #define TLV_TYPE_RATES				0x0001
66 #define TLV_TYPE_PHY_FH				0x0002
67 #define TLV_TYPE_PHY_DS				0x0003
68 #define TLV_TYPE_CF				    0x0004
69 #define TLV_TYPE_IBSS				0x0006
70 
71 #define TLV_TYPE_DOMAIN				0x0007
72 
73 #define TLV_TYPE_POWER_CAPABILITY	0x0021
74 
75 #define TLV_TYPE_KEY_MATERIAL       (PROPRIETARY_TLV_BASE_ID + 0)
76 #define TLV_TYPE_CHANLIST           (PROPRIETARY_TLV_BASE_ID + 1)
77 #define TLV_TYPE_NUMPROBES          (PROPRIETARY_TLV_BASE_ID + 2)
78 #define TLV_TYPE_RSSI_LOW           (PROPRIETARY_TLV_BASE_ID + 4)
79 #define TLV_TYPE_SNR_LOW            (PROPRIETARY_TLV_BASE_ID + 5)
80 #define TLV_TYPE_FAILCOUNT          (PROPRIETARY_TLV_BASE_ID + 6)
81 #define TLV_TYPE_BCNMISS            (PROPRIETARY_TLV_BASE_ID + 7)
82 #define TLV_TYPE_LED_GPIO           (PROPRIETARY_TLV_BASE_ID + 8)
83 #define TLV_TYPE_LEDBEHAVIOR        (PROPRIETARY_TLV_BASE_ID + 9)
84 #define TLV_TYPE_PASSTHROUGH        (PROPRIETARY_TLV_BASE_ID + 10)
85 #define TLV_TYPE_REASSOCAP          (PROPRIETARY_TLV_BASE_ID + 11)
86 #define TLV_TYPE_POWER_TBL_2_4GHZ   (PROPRIETARY_TLV_BASE_ID + 12)
87 #define TLV_TYPE_POWER_TBL_5GHZ     (PROPRIETARY_TLV_BASE_ID + 13)
88 #define TLV_TYPE_BCASTPROBE	    (PROPRIETARY_TLV_BASE_ID + 14)
89 #define TLV_TYPE_NUMSSID_PROBE	    (PROPRIETARY_TLV_BASE_ID + 15)
90 #define TLV_TYPE_WMMQSTATUS   	    (PROPRIETARY_TLV_BASE_ID + 16)
91 #define TLV_TYPE_CRYPTO_DATA	    (PROPRIETARY_TLV_BASE_ID + 17)
92 #define TLV_TYPE_WILDCARDSSID	    (PROPRIETARY_TLV_BASE_ID + 18)
93 #define TLV_TYPE_TSFTIMESTAMP	    (PROPRIETARY_TLV_BASE_ID + 19)
94 #define TLV_TYPE_RSSI_HIGH          (PROPRIETARY_TLV_BASE_ID + 22)
95 #define TLV_TYPE_SNR_HIGH           (PROPRIETARY_TLV_BASE_ID + 23)
96 #define TLV_TYPE_WPS_ENROLLEE       (PROPRIETARY_TLV_BASE_ID + 27)
97 #define TLV_TYPE_AUTH_TYPE          (PROPRIETARY_TLV_BASE_ID + 31)
98 #define TLV_TYPE_MESH_ID            (PROPRIETARY_TLV_BASE_ID + 37)
99 #define TLV_TYPE_OLD_MESH_ID        (PROPRIETARY_TLV_BASE_ID + 291)
100 
101 /* TLV related data structures */
102 struct mrvl_ie_header {
103 	__le16 type;
104 	__le16 len;
105 } __packed;
106 
107 struct mrvl_ie_data {
108 	struct mrvl_ie_header header;
109 	u8 data[];
110 } __packed;
111 
112 struct mrvl_ie_rates_param_set {
113 	struct mrvl_ie_header header;
114 	u8 rates[];
115 } __packed;
116 
117 struct mrvl_ie_ssid_param_set {
118 	struct mrvl_ie_header header;
119 	u8 ssid[];
120 } __packed;
121 
122 struct mrvl_ie_wildcard_ssid_param_set {
123 	struct mrvl_ie_header header;
124 	u8 maxssidlength;
125 	u8 ssid[];
126 } __packed;
127 
128 struct chanscanmode {
129 #ifdef __BIG_ENDIAN_BITFIELD
130 	u8 reserved_2_7:6;
131 	u8 disablechanfilt:1;
132 	u8 passivescan:1;
133 #else
134 	u8 passivescan:1;
135 	u8 disablechanfilt:1;
136 	u8 reserved_2_7:6;
137 #endif
138 } __packed;
139 
140 struct chanscanparamset {
141 	u8 radiotype;
142 	u8 channumber;
143 	struct chanscanmode chanscanmode;
144 	__le16 minscantime;
145 	__le16 maxscantime;
146 } __packed;
147 
148 struct mrvl_ie_chanlist_param_set {
149 	struct mrvl_ie_header header;
150 	struct chanscanparamset chanscanparam[];
151 } __packed;
152 
153 struct mrvl_ie_cf_param_set {
154 	struct mrvl_ie_header header;
155 	u8 cfpcnt;
156 	u8 cfpperiod;
157 	__le16 cfpmaxduration;
158 	__le16 cfpdurationremaining;
159 } __packed;
160 
161 struct mrvl_ie_ds_param_set {
162 	struct mrvl_ie_header header;
163 	u8 channel;
164 } __packed;
165 
166 struct mrvl_ie_rsn_param_set {
167 	struct mrvl_ie_header header;
168 	u8 rsnie[];
169 } __packed;
170 
171 struct mrvl_ie_tsf_timestamp {
172 	struct mrvl_ie_header header;
173 	__le64 tsftable[];
174 } __packed;
175 
176 /* v9 and later firmware only */
177 struct mrvl_ie_auth_type {
178 	struct mrvl_ie_header header;
179 	__le16 auth;
180 } __packed;
181 
182 /*  Local Power capability */
183 struct mrvl_ie_power_capability {
184 	struct mrvl_ie_header header;
185 	s8 minpower;
186 	s8 maxpower;
187 } __packed;
188 
189 /* used in CMD_802_11_SUBSCRIBE_EVENT for SNR, RSSI and Failure */
190 struct mrvl_ie_thresholds {
191 	struct mrvl_ie_header header;
192 	u8 value;
193 	u8 freq;
194 } __packed;
195 
196 struct mrvl_ie_beacons_missed {
197 	struct mrvl_ie_header header;
198 	u8 beaconmissed;
199 	u8 reserved;
200 } __packed;
201 
202 struct mrvl_ie_num_probes {
203 	struct mrvl_ie_header header;
204 	__le16 numprobes;
205 } __packed;
206 
207 struct mrvl_ie_bcast_probe {
208 	struct mrvl_ie_header header;
209 	__le16 bcastprobe;
210 } __packed;
211 
212 struct mrvl_ie_num_ssid_probe {
213 	struct mrvl_ie_header header;
214 	__le16 numssidprobe;
215 } __packed;
216 
217 struct led_pin {
218 	u8 led;
219 	u8 pin;
220 } __packed;
221 
222 struct mrvl_ie_ledgpio {
223 	struct mrvl_ie_header header;
224 	struct led_pin ledpin[];
225 } __packed;
226 
227 struct led_bhv {
228 	uint8_t	firmwarestate;
229 	uint8_t	led;
230 	uint8_t	ledstate;
231 	uint8_t	ledarg;
232 } __packed;
233 
234 
235 struct mrvl_ie_ledbhv {
236 	struct mrvl_ie_header header;
237 	struct led_bhv ledbhv[];
238 } __packed;
239 
240 /*
241  * Meant to be packed as the value member of a struct ieee80211_info_element.
242  * Note that the len member of the ieee80211_info_element varies depending on
243  * the mesh_id_len
244  */
245 struct mrvl_meshie_val {
246 	uint8_t oui[3];
247 	uint8_t type;
248 	uint8_t subtype;
249 	uint8_t version;
250 	uint8_t active_protocol_id;
251 	uint8_t active_metric_id;
252 	uint8_t mesh_capability;
253 	uint8_t mesh_id_len;
254 	uint8_t mesh_id[IEEE80211_MAX_SSID_LEN];
255 } __packed;
256 
257 struct mrvl_meshie {
258 	u8 id, len;
259 	struct mrvl_meshie_val val;
260 } __packed;
261 
262 struct mrvl_mesh_defaults {
263 	__le32 bootflag;
264 	uint8_t boottime;
265 	uint8_t reserved;
266 	__le16 channel;
267 	struct mrvl_meshie meshie;
268 } __packed;
269 
270 #endif
271