2d24051a04c711b8e724aa63e79646166ce9a74d
[GitHub/exynos8895/android_kernel_samsung_universal8895.git] / drivers / net / wireless / bcmdhd4361 / include / nan.h
1 /*
2 * Fundamental types and constants relating to WFA NAN
3 * (Neighbor Awareness Networking)
4 *
5 * Copyright (C) 1999-2019, Broadcom.
6 *
7 * Unless you and Broadcom execute a separate written software license
8 * agreement governing use of this software, this software is licensed to you
9 * under the terms of the GNU General Public License version 2 (the "GPL"),
10 * available at http://www.broadcom.com/licenses/GPLv2.php, with the
11 * following added to such license:
12 *
13 * As a special exception, the copyright holders of this software give you
14 * permission to link this software with independent modules, and to copy and
15 * distribute the resulting executable under terms of your choice, provided that
16 * you also meet, for each linked independent module, the terms and conditions of
17 * the license of that module. An independent module is a module which is not
18 * derived from this software. The special exception does not apply to any
19 * modifications of the software.
20 *
21 * Notwithstanding the above, under no circumstances may you combine this
22 * software in any way with any other Broadcom software provided under a license
23 * other than the GPL, without Broadcom's express prior written consent.
24 *
25 *
26 * <<Broadcom-WL-IPTag/Open:>>
27 *
28 * $Id: nan.h 758133 2018-04-17 19:07:15Z $
29 */
30 #ifndef _NAN_H_
31 #define _NAN_H_
32
33 #include <typedefs.h>
34 #include <802.11.h>
35
36 /* This marks the start of a packed structure section. */
37 #include <packed_section_start.h>
38
39 /* WiFi NAN OUI values */
40 #define NAN_OUI "\x50\x6F\x9A" /* WFA OUI. WiFi-Alliance OUI */
41 /* For oui_type field identifying the type and version of the NAN IE. */
42 #define NAN_OUI_TYPE 0x13 /* Type/Version */
43 #define NAN_AF_OUI_TYPE 0x18 /* Type/Version */
44 /* IEEE 802.11 vendor specific information element. (Same as P2P_IE_ID.) */
45 #define NAN_IE_ID 0xdd
46
47 /* Same as P2P_PUB_AF_CATEGORY and DOT11_ACTION_CAT_PUBLIC */
48 #define NAN_PUB_AF_CATEGORY DOT11_ACTION_CAT_PUBLIC
49 /* Protected dual public action frame category */
50 #define NAN_PROT_DUAL_PUB_AF_CATEGORY DOT11_ACTION_CAT_PDPA
51 /* IEEE 802.11 Public Action Frame Vendor Specific. (Same as P2P_PUB_AF_ACTION.) */
52 #define NAN_PUB_AF_ACTION DOT11_PUB_ACTION_VENDOR_SPEC
53 /* Number of octents in hash of service name. (Same as P2P_WFDS_HASH_LEN.) */
54 #define NAN_SVC_HASH_LEN 6
55 /* Size of fixed length part of nan_pub_act_frame_t before attributes. */
56 #define NAN_PUB_ACT_FRAME_FIXED_LEN 6
57 /* Number of octents in master rank value. */
58 #define NAN_MASTER_RANK_LEN 8
59 /* NAN public action frame header size */
60 #define NAN_PUB_ACT_FRAME_HDR_SIZE (OFFSETOF(nan_pub_act_frame_t, data))
61 /* NAN network ID */
62 #define NAN_NETWORK_ID "\x51\x6F\x9A\x01\x00\x00"
63 /* Service Control Type length */
64 #define NAN_SVC_CONTROL_TYPE_LEN 2
65 /* Binding Bitmap length */
66 #define NAN_BINDING_BITMAP_LEN 2
67 /* Service Response Filter (SRF) control field masks */
68 #define NAN_SRF_BLOOM_MASK 0x01
69 #define NAN_SRF_INCLUDE_MASK 0x02
70 #define NAN_SRF_INDEX_MASK 0x0C
71 /* SRF Bloom Filter index shift */
72 #define NAN_SRF_BLOOM_SHIFT 2
73 #define NAN_SRF_INCLUDE_SHIFT 1
74 /* Mask for CRC32 output, used in hash function for NAN bloom filter */
75 #define NAN_BLOOM_CRC32_MASK 0xFFFF
76
77 /* Attribute TLV header size */
78 #define NAN_ATTR_ID_OFF 0
79 #define NAN_ATTR_LEN_OFF 1
80 #define NAN_ATTR_DATA_OFF 3
81
82 #define NAN_ATTR_ID_LEN 1u /* ID field length */
83 #define NAN_ATTR_LEN_LEN 2u /* Length field length */
84 #define NAN_ATTR_HDR_LEN (NAN_ATTR_ID_LEN + NAN_ATTR_LEN_LEN)
85 #define NAN_ENTRY_CTRL_LEN 1 /* Entry control field length from FAM attribute */
86 #define NAN_MAP_ID_LEN 1 /* MAP ID length to signify band */
87 #define NAN_OPERATING_CLASS_LEN 1 /* operating class field length from NAN FAM */
88 #define NAN_CHANNEL_NUM_LEN 1 /* channel number field length 1 byte */
89
90 /* generic nan attribute total length */
91 #define NAN_ATTR_TOT_LEN(_nan_attr) (ltoh16_ua(((const uint8 *)(_nan_attr)) + \
92 NAN_ATTR_ID_LEN) + NAN_ATTR_HDR_LEN)
93
94 /* NAN slot duration / period */
95 #define NAN_MIN_TU 16
96 #define NAN_TU_PER_DW 512
97 #define NAN_MAX_DW 16
98 #define NAN_MAX_TU (NAN_MAX_DW * NAN_TU_PER_DW)
99
100 #define NAN_SLOT_DUR_0TU 0
101 #define NAN_SLOT_DUR_16TU 16
102 #define NAN_SLOT_DUR_32TU 32
103 #define NAN_SLOT_DUR_64TU 64
104 #define NAN_SLOT_DUR_128TU 128
105 #define NAN_SLOT_DUR_256TU 256
106 #define NAN_SLOT_DUR_512TU 512
107 #define NAN_SLOT_DUR_1024TU 1024
108 #define NAN_SLOT_DUR_2048TU 2048
109 #define NAN_SLOT_DUR_4096TU 4096
110 #define NAN_SLOT_DUR_8192TU 8192
111
112 #define NAN_SOC_CHAN_2G 6 /* NAN 2.4G discovery channel */
113 #define NAN_SOC_CHAN_5G_CH149 149 /* NAN 5G discovery channel if upper band allowed */
114 #define NAN_SOC_CHAN_5G_CH44 44 /* NAN 5G discovery channel if only lower band allowed */
115
116 /* size of ndc id */
117 #define NAN_DATA_NDC_ID_SIZE 6
118
119 #define NAN_AVAIL_ENTRY_LEN_RES0 7 /* Avail entry len in FAM attribute for resolution 16TU */
120 #define NAN_AVAIL_ENTRY_LEN_RES1 5 /* Avail entry len in FAM attribute for resolution 32TU */
121 #define NAN_AVAIL_ENTRY_LEN_RES2 4 /* Avail entry len in FAM attribute for resolution 64TU */
122
123 /* map id field */
124 #define NAN_MAPID_SPECIFIC_MAP_MASK 0x01 /* apply to specific map */
125 #define NAN_MAPID_MAPID_MASK 0x1E
126 #define NAN_MAPID_MAPID_SHIFT 1
127 #define NAN_MAPID_SPECIFIC_MAP(_mapid) ((_mapid) & NAN_MAPID_SPECIFIC_MAP_MASK)
128 #define NAN_MAPID_ALL_MAPS(_mapid) (!NAN_MAPID_SPECIFIC_MAP(_mapid))
129 #define NAN_MAPID_MAPID(_mapid) (((_mapid) & NAN_MAPID_MAPID_MASK) \
130 >> NAN_MAPID_MAPID_SHIFT)
131 #define NAN_MAPID_SET_SPECIFIC_MAPID(map_id) ((((map_id) << NAN_MAPID_MAPID_SHIFT) \
132 & NAN_MAPID_MAPID_MASK) | NAN_MAPID_SPECIFIC_MAP_MASK)
133
134 /* Vendor-specific public action frame for NAN */
135 typedef BWL_PRE_PACKED_STRUCT struct nan_pub_act_frame_s {
136 /* NAN_PUB_AF_CATEGORY 0x04 */
137 uint8 category_id;
138 /* NAN_PUB_AF_ACTION 0x09 */
139 uint8 action_field;
140 /* NAN_OUI 0x50-6F-9A */
141 uint8 oui[DOT11_OUI_LEN];
142 /* NAN_OUI_TYPE 0x13 */
143 uint8 oui_type;
144 /* One or more NAN Attributes follow */
145 uint8 data[];
146 } BWL_POST_PACKED_STRUCT nan_pub_act_frame_t;
147
148 /* NAN attributes as defined in the nan spec */
149 enum {
150 NAN_ATTR_MASTER_IND = 0,
151 NAN_ATTR_CLUSTER = 1,
152 NAN_ATTR_SVC_ID_LIST = 2,
153 NAN_ATTR_SVC_DESCRIPTOR = 3,
154 NAN_ATTR_CONN_CAP = 4,
155 NAN_ATTR_INFRA = 5,
156 NAN_ATTR_P2P = 6,
157 NAN_ATTR_IBSS = 7,
158 NAN_ATTR_MESH = 8,
159 NAN_ATTR_FURTHER_NAN_SD = 9,
160 NAN_ATTR_FURTHER_AVAIL = 10,
161 NAN_ATTR_COUNTRY_CODE = 11,
162 NAN_ATTR_RANGING = 12,
163 NAN_ATTR_CLUSTER_DISC = 13,
164 /* nan 2.0 */
165 NAN_ATTR_SVC_DESC_EXTENSION = 14,
166 NAN_ATTR_NAN_DEV_CAP = 15,
167 NAN_ATTR_NAN_NDP = 16,
168 NAN_ATTR_NAN_NMSG = 17,
169 NAN_ATTR_NAN_AVAIL = 18,
170 NAN_ATTR_NAN_NDC = 19,
171 NAN_ATTR_NAN_NDL = 20,
172 NAN_ATTR_NAN_NDL_QOS = 21,
173 NAN_ATTR_MCAST_SCHED = 22,
174 NAN_ATTR_UNALIGN_SCHED = 23,
175 NAN_ATTR_PAGING_UCAST = 24,
176 NAN_ATTR_PAGING_MCAST = 25,
177 NAN_ATTR_RANGING_INFO = 26,
178 NAN_ATTR_RANGING_SETUP = 27,
179 NAN_ATTR_FTM_RANGE_REPORT = 28,
180 NAN_ATTR_ELEMENT_CONTAINER = 29,
181 NAN_ATTR_WLAN_INFRA_EXT = 30,
182 NAN_ATTR_EXT_P2P_OPER = 31,
183 NAN_ATTR_EXT_IBSS = 32,
184 NAN_ATTR_EXT_MESH = 33,
185 NAN_ATTR_CIPHER_SUITE_INFO = 34,
186 NAN_ATTR_SEC_CTX_ID_INFO = 35,
187 NAN_ATTR_SHARED_KEY_DESC = 36,
188 NAN_ATTR_MCAST_SCHED_CHANGE = 37,
189 NAN_ATTR_MCAST_SCHED_OWNER_CHANGE = 38,
190 NAN_ATTR_PUBLIC_AVAILABILITY = 39,
191 NAN_ATTR_SUB_SVC_ID_LIST = 40,
192 NAN_ATTR_NDPE = 41,
193 /* change NAN_ATTR_MAX_ID to max ids + 1, excluding NAN_ATTR_VENDOR_SPECIFIC.
194 * This is used in nan_parse.c
195 */
196 NAN_ATTR_MAX_ID = NAN_ATTR_NDPE + 1,
197
198 NAN_ATTR_VENDOR_SPECIFIC = 221
199 };
200
201 enum wifi_nan_avail_resolution {
202 NAN_AVAIL_RES_16_TU = 0,
203 NAN_AVAIL_RES_32_TU = 1,
204 NAN_AVAIL_RES_64_TU = 2,
205 NAN_AVAIL_RES_INVALID = 255
206 };
207
208 typedef BWL_PRE_PACKED_STRUCT struct wifi_nan_ie_s {
209 uint8 id; /* IE ID: NAN_IE_ID 0xDD */
210 uint8 len; /* IE length */
211 uint8 oui[DOT11_OUI_LEN]; /* NAN_OUI 50:6F:9A */
212 uint8 oui_type; /* NAN_OUI_TYPE 0x13 */
213 uint8 attr[]; /* var len attributes */
214 } BWL_POST_PACKED_STRUCT wifi_nan_ie_t;
215
216 #define NAN_IE_HDR_SIZE (OFFSETOF(wifi_nan_ie_t, attr))
217
218 /* master indication record */
219 typedef BWL_PRE_PACKED_STRUCT struct wifi_nan_master_ind_attr_s {
220 uint8 id;
221 uint16 len;
222 uint8 master_preference;
223 uint8 random_factor;
224 } BWL_POST_PACKED_STRUCT wifi_nan_master_ind_attr_t;
225
226 /* cluster attr record */
227 typedef BWL_PRE_PACKED_STRUCT struct wifi_nan_cluster_attr_s {
228 uint8 id;
229 uint16 len;
230 uint8 amr[NAN_MASTER_RANK_LEN];
231 uint8 hop_count;
232 /* Anchor Master Beacon Transmission Time */
233 uint32 ambtt;
234 } BWL_POST_PACKED_STRUCT wifi_nan_cluster_attr_t;
235
236 /* container for service ID records */
237 typedef BWL_PRE_PACKED_STRUCT struct wifi_nan_svc_id_attr_s {
238 uint8 id;
239 uint16 len;
240 uint8 svcid[0]; /* 6*len of srvc IDs */
241 } BWL_POST_PACKED_STRUCT wifi_nan_svc_id_attr_t;
242
243 /* service_control bitmap for wifi_nan_svc_descriptor_attr_t below */
244 #define NAN_SC_PUBLISH 0x0
245 #define NAN_SC_SUBSCRIBE 0x1
246 #define NAN_SC_FOLLOWUP 0x2
247 /* Set to 1 if a Matching Filter field is included in descriptors. */
248 #define NAN_SC_MATCHING_FILTER_PRESENT 0x4
249 /* Set to 1 if a Service Response Filter field is included in descriptors. */
250 #define NAN_SC_SR_FILTER_PRESENT 0x8
251 /* Set to 1 if a Service Info field is included in descriptors. */
252 #define NAN_SC_SVC_INFO_PRESENT 0x10
253 /* range is close proximity only */
254 #define NAN_SC_RANGE_LIMITED 0x20
255 /* Set to 1 if binding bitamp is present in descriptors */
256 #define NAN_SC_BINDING_BITMAP_PRESENT 0x40
257
258 /* Service descriptor */
259 typedef BWL_PRE_PACKED_STRUCT struct wifi_nan_svc_descriptor_attr_s {
260 /* Attribute ID - 0x03. */
261 uint8 id;
262 /* Length of the following fields in the attribute */
263 uint16 len;
264 /* Hash of the Service Name */
265 uint8 svc_hash[NAN_SVC_HASH_LEN];
266 /* Publish or subscribe instance id */
267 uint8 instance_id;
268 /* Requestor Instance ID */
269 uint8 requestor_id;
270 /* Service Control Bitmask. Also determines what data follows. */
271 uint8 svc_control;
272 /* Optional fields follow */
273 } BWL_POST_PACKED_STRUCT wifi_nan_svc_descriptor_attr_t;
274
275 /* IBSS attribute */
276 typedef BWL_PRE_PACKED_STRUCT struct wifi_nan_ibss_attr_s {
277 /* Attribute ID - 0x07. */
278 uint8 id;
279 /* Length of the following fields in the attribute */
280 uint16 len;
281 /* BSSID of the ibss */
282 struct ether_addr bssid;
283 /*
284 map control:, bits:
285 [0-3]: Id for associated further avail map attribute
286 [4-5]: avail interval duration: 0:16ms; 1:32ms; 2:64ms; 3:reserved
287 [6] : repeat : 0 - applies to next DW, 1: 16 intervals max? wtf?
288 [7] : reserved
289 */
290 uint8 map_ctrl;
291 /* avail. intervals bitmap, var len */
292 uint8 avail_bmp[1];
293 } BWL_POST_PACKED_STRUCT wifi_nan_ibss_attr_t;
294
295 /* Further Availability MAP attr */
296 typedef BWL_PRE_PACKED_STRUCT struct wifi_nan_favail_attr_s {
297 /* Attribute ID - 0x0A. */
298 uint8 id;
299 /* Length of the following fields in the attribute */
300 uint16 len;
301 /* MAP id: val [0..15], values[16-255] reserved */
302 uint8 map_id;
303 /* availibility entry, var len */
304 uint8 avil_entry[1];
305 } BWL_POST_PACKED_STRUCT wifi_nan_favail_attr_t;
306
307 /* Further Availability MAP attr */
308 typedef BWL_PRE_PACKED_STRUCT struct wifi_nan_avail_entry_s {
309 /*
310 entry control
311 [0-1]: avail interval duration: 0:16ms; 1:32ms; 2:64ms;
312 [2:7] reserved
313 */
314 uint8 entry_ctrl;
315 /* operating class: freq band etc IEEE 802.11 */
316 uint8 opclass;
317 /* channel number */
318 uint8 chan;
319 /* avail bmp, var len */
320 uint8 avail_bmp[1];
321 } BWL_POST_PACKED_STRUCT wifi_nan_avail_entry_t;
322
323 /* Map control Field */
324 #define NAN_MAPCTRL_IDMASK 0x7
325 #define NAN_MAPCTRL_DURSHIFT 4
326 #define NAN_MAPCTRL_DURMASK 0x30
327 #define NAN_MAPCTRL_REPEAT 0x40
328 #define NAN_MAPCTRL_REPEATSHIFT 6
329
330 #define NAN_VENDOR_TYPE_RTT 0
331 #define NAN_VENDOR_TYPE_P2P 1
332
333 /* Vendor Specific Attribute - old definition */
334 /* TODO remove */
335 typedef BWL_PRE_PACKED_STRUCT struct wifi_nan_vendor_attr_s {
336 uint8 id; /* 0xDD */
337 uint16 len; /* IE length */
338 uint8 oui[DOT11_OUI_LEN]; /* 00-90-4C */
339 uint8 type; /* attribute type */
340 uint8 attr[1]; /* var len attributes */
341 } BWL_POST_PACKED_STRUCT wifi_nan_vendor_attr_t;
342
343 #define NAN_VENDOR_HDR_SIZE (OFFSETOF(wifi_nan_vendor_attr_t, attr))
344
345 /* vendor specific attribute */
346 typedef BWL_PRE_PACKED_STRUCT struct wifi_nan_vndr_attr_s {
347 uint8 id; /* 0xDD */
348 uint16 len; /* length of following fields */
349 uint8 oui[DOT11_OUI_LEN]; /* vendor specific OUI */
350 uint8 body[];
351 } BWL_POST_PACKED_STRUCT wifi_nan_vndr_attr_t;
352
353 /* p2p operation attribute */
354 typedef BWL_PRE_PACKED_STRUCT struct wifi_nan_p2p_op_attr_s {
355 /* Attribute ID - 0x06. */
356 uint8 id;
357 /* Length of the following fields in the attribute */
358 uint16 len;
359 /* P2P device role */
360 uint8 dev_role;
361 /* BSSID of the ibss */
362 struct ether_addr p2p_dev_addr;
363 /*
364 map control:, bits:
365 [0-3]: Id for associated further avail map attribute
366 [4-5]: avail interval duration: 0:16ms; 1:32ms; 2:64ms; 3:reserved
367 [6] : repeat : 0 - applies to next DW, 1: 16 intervals max? wtf?
368 [7] : reserved
369 */
370 uint8 map_ctrl;
371 /* avail. intervals bitmap */
372 uint8 avail_bmp[1];
373 } BWL_POST_PACKED_STRUCT wifi_nan_p2p_op_attr_t;
374
375 /* ranging attribute */
376 #define NAN_RANGING_MAP_CTRL_ID_SHIFT 0
377 #define NAN_RANGING_MAP_CTRL_ID_MASK 0x0F
378 #define NAN_RANGING_MAP_CTRL_DUR_SHIFT 4
379 #define NAN_RANGING_MAP_CTRL_DUR_MASK 0x30
380 #define NAN_RANGING_MAP_CTRL_REPEAT_SHIFT 6
381 #define NAN_RANGING_MAP_CTRL_REPEAT_MASK 0x40
382 #define NAN_RANGING_MAP_CTRL_REPEAT_DW(_ctrl) (((_ctrl) & \
383 NAN_RANGING_MAP_CTRL_DUR_MASK) ? 16 : 1)
384 #define NAN_RANGING_MAP_CTRL(_id, _dur, _repeat) (\
385 (((_id) << NAN_RANGING_MAP_CTRL_ID_SHIFT) & \
386 NAN_RANGING_MAP_CTRL_ID_MASK) | \
387 (((_dur) << NAN_RANGING_MAP_CTRL_DUR_SHIFT) & \
388 NAN_RANGING_MAP_CTRL_DUR_MASK) | \
389 (((_repeat) << NAN_RANGING_MAP_CTRL_REPEAT_SHIFT) & \
390 NAN_RANGING_MAP_CTRL_REPEAT_MASK))
391
392 enum {
393 NAN_RANGING_PROTO_FTM = 0
394 };
395
396 typedef BWL_PRE_PACKED_STRUCT struct wifi_nan_ranging_attr_s {
397 uint8 id; /* 0x0C */
398 uint16 len; /* length that follows */
399 struct ether_addr dev_addr; /* device mac address */
400
401 /*
402 map control:, bits:
403 [0-3]: Id for associated further avail map attribute
404 [4-5]: avail interval duration: 0:16ms; 1:32ms; 2:64ms; 3:reserved
405 [6] : repeat : 0 - applies to next DW, 1: 16 intervals max? wtf?
406 [7] : reserved
407 */
408 uint8 map_ctrl;
409
410 uint8 protocol; /* FTM = 0 */
411 uint32 avail_bmp; /* avail interval bitmap */
412 } BWL_POST_PACKED_STRUCT wifi_nan_ranging_attr_t;
413
414 typedef BWL_PRE_PACKED_STRUCT struct wifi_nan_ranging_info_attr_s {
415 uint8 id; /* 0x1A */
416 uint16 len; /* length that follows */
417 /*
418 location info availability bit map
419 0: LCI Local Coordinates
420 1: Geospatial LCI WGS84
421 2: Civi Location
422 3: Last Movement Indication
423 [4-7]: reserved
424 */
425 uint8 lc_info_avail;
426 /*
427 Last movement indication
428 present if bit 3 is set in lc_info_avail
429 cluster TSF[29:14] at the last detected platform movement
430 */
431 uint16 last_movement;
432
433 } BWL_POST_PACKED_STRUCT wifi_nan_ranging_info_attr_t;
434
435 typedef BWL_PRE_PACKED_STRUCT struct wifi_nan_ranging_setup_attr_hdr_s {
436 uint8 id; /* 0x1B */
437 uint16 len; /* length that follows */
438 uint8 dialog_token; /* Identify req and resp */
439 uint8 type_status; /* bits 0-3 type, 4-7 status */
440 /* reason code
441 i. when frm type = response & status = reject
442 ii. frm type = termination
443 */
444 uint8 reason;
445 } BWL_POST_PACKED_STRUCT wifi_nan_ranging_setup_attr_hdr_t;
446
447 typedef BWL_PRE_PACKED_STRUCT struct wifi_nan_ranging_setup_attr_s {
448
449 wifi_nan_ranging_setup_attr_hdr_t setup_attr_hdr;
450 /* Below fields not required when frm type = termination */
451 uint8 ranging_ctrl; /* Bit 0: ranging report required or not */
452 uint8 ftm_params[3];
453 uint8 data[]; /* schedule entry list */
454 } BWL_POST_PACKED_STRUCT wifi_nan_ranging_setup_attr_t;
455
456 #define NAN_RANGE_SETUP_ATTR_OFFSET_TBM_INFO (OFFSETOF(wifi_nan_ranging_setup_attr_t, data))
457
458 typedef BWL_PRE_PACKED_STRUCT struct wifi_nan_ranging_report_attr_s {
459 uint8 id; /* 0x1C */
460 uint16 len; /* length that follows */
461 /* FTM report format in spec.
462 See definition in 9.4.2.22.18 in 802.11mc D5.0
463 */
464 uint8 entry_count;
465 uint8 data[2]; /* includes pad */
466 /*
467 dot11_ftm_range_entry_t entries[entry_count];
468 uint8 error_count;
469 dot11_ftm_error_entry_t errors[error_count];
470 */
471 } BWL_POST_PACKED_STRUCT wifi_nan_ranging_report_attr_t;
472
473 /* Ranging control flags */
474 #define NAN_RNG_REPORT_REQUIRED 0x01
475 #define NAN_RNG_FTM_PARAMS_PRESENT 0x02
476 #define NAN_RNG_SCHED_ENTRY_PRESENT 0X04
477
478 /* Location info flags */
479 #define NAN_RNG_LOCATION_FLAGS_LOCAL_CORD 0x1
480 #define NAN_RNG_LOCATION_FLAGS_GEO_SPATIAL 0x2
481 #define NAN_RNG_LOCATION_FLAGS_CIVIC 0x4
482 #define NAN_RNG_LOCATION_FLAGS_LAST_MVMT 0x8
483
484 /* Last movement mask and shift value */
485 #define NAN_RNG_LOCATION_MASK_LAST_MVT_TSF 0x3FFFC000
486 #define NAN_RNG_LOCATION_SHIFT_LAST_MVT_TSF 14
487
488 /* FTM params shift values */
489 #define NAN_FTM_MAX_BURST_DUR_SHIFT 0
490 #define NAN_FTM_MIN_FTM_DELTA_SHIFT 4
491 #define NAN_FTM_NUM_FTM_SHIFT 10
492 #define NAN_FTM_FORMAT_BW_SHIFT 15
493
494 /* FTM params mask */
495 #define NAN_FTM_MAX_BURST_DUR_MASK 0x00000F
496 #define NAN_FTM_MIN_FTM_DELTA_MASK 0x00003F
497 #define NAN_FTM_NUM_FTM_MASK 0x00001F
498 #define NAN_FTM_FORMAT_BW_MASK 0x00003F
499
500 #define FTM_PARAMS_BURSTTMO_FACTOR 250
501
502 /* set to value to uint32 */
503 #define NAN_FTM_SET_BURST_DUR(ftm, dur) (ftm |= (((dur + 2) & NAN_FTM_MAX_BURST_DUR_MASK) <<\
504 NAN_FTM_MAX_BURST_DUR_SHIFT))
505 #define NAN_FTM_SET_FTM_DELTA(ftm, delta) (ftm |= (((delta/100) & NAN_FTM_MIN_FTM_DELTA_MASK) <<\
506 NAN_FTM_MIN_FTM_DELTA_SHIFT))
507 #define NAN_FTM_SET_NUM_FTM(ftm, delta) (ftm |= ((delta & NAN_FTM_NUM_FTM_MASK) <<\
508 NAN_FTM_NUM_FTM_SHIFT))
509 #define NAN_FTM_SET_FORMAT_BW(ftm, delta) (ftm |= ((delta & NAN_FTM_FORMAT_BW_MASK) <<\
510 NAN_FTM_FORMAT_BW_SHIFT))
511 /* set uint32 to attribute */
512 #define NAN_FTM_PARAMS_UINT32_TO_ATTR(ftm_u32, ftm_attr) {ftm_attr[0] = ftm_u32 & 0xFF; \
513 ftm_attr[1] = (ftm_u32 >> 8) & 0xFF; ftm_attr[2] = (ftm_u32 >> 16) & 0xFF;}
514
515 /* get atrribute to uint32 */
516 #define NAN_FTM_PARAMS_ATTR_TO_UINT32(ftm_p, ftm_u32) (ftm_u32 = ftm_p[0] | ftm_p[1] << 8 | \
517 ftm_p[2] << 16)
518 /* get param values from uint32 */
519 #define NAN_FTM_GET_BURST_DUR(ftm) (((ftm >> NAN_FTM_MAX_BURST_DUR_SHIFT) &\
520 NAN_FTM_MAX_BURST_DUR_MASK))
521 #define NAN_FTM_GET_BURST_DUR_USEC(_val) ((1 << ((_val)-2)) * FTM_PARAMS_BURSTTMO_FACTOR)
522 #define NAN_FTM_GET_FTM_DELTA(ftm) (((ftm >> NAN_FTM_MIN_FTM_DELTA_SHIFT) &\
523 NAN_FTM_MIN_FTM_DELTA_MASK)*100)
524 #define NAN_FTM_GET_NUM_FTM(ftm) ((ftm >> NAN_FTM_NUM_FTM_SHIFT) &\
525 NAN_FTM_NUM_FTM_MASK)
526 #define NAN_FTM_GET_FORMAT_BW(ftm) ((ftm >> NAN_FTM_FORMAT_BW_SHIFT) &\
527 NAN_FTM_FORMAT_BW_MASK)
528
529 #define NAN_CONN_CAPABILITY_WFD 0x0001
530 #define NAN_CONN_CAPABILITY_WFDS 0x0002
531 #define NAN_CONN_CAPABILITY_TDLS 0x0004
532 #define NAN_CONN_CAPABILITY_INFRA 0x0008
533 #define NAN_CONN_CAPABILITY_IBSS 0x0010
534 #define NAN_CONN_CAPABILITY_MESH 0x0020
535
536 #define NAN_DEFAULT_MAP_ID 0 /* nan default map id */
537 #define NAN_DEFAULT_MAP_CTRL 0 /* nan default map control */
538
539 typedef BWL_PRE_PACKED_STRUCT struct wifi_nan_conn_cap_attr_s {
540 /* Attribute ID - 0x04. */
541 uint8 id;
542 /* Length of the following fields in the attribute */
543 uint16 len;
544 uint16 conn_cap_bmp; /* Connection capability bitmap */
545 } BWL_POST_PACKED_STRUCT wifi_nan_conn_cap_attr_t;
546
547 /* NAN Element container Attribute */
548 typedef BWL_PRE_PACKED_STRUCT struct wifi_nan_container_attr_s {
549 uint8 id; /* id - 0x20 */
550 uint16 len; /* Total length of following IEs */
551 uint8 map_id; /* map id */
552 uint8 data[1]; /* Data pointing to one or more IEs */
553 } BWL_POST_PACKED_STRUCT wifi_nan_container_attr_t;
554
555 /* NAN 2.0 NAN avail attribute */
556
557 /* Availability Attribute */
558 typedef BWL_PRE_PACKED_STRUCT struct wifi_nan_avail_attr_s {
559 uint8 id; /* id - 0x12 */
560 uint16 len; /* total length */
561 uint8 seqid; /* sequence id */
562 uint16 ctrl; /* attribute control */
563 uint8 entry[1]; /* availability entry list */
564 } BWL_POST_PACKED_STRUCT wifi_nan_avail_attr_t;
565
566 /* for processing/building time bitmap info in nan_avail_entry */
567 typedef BWL_PRE_PACKED_STRUCT struct wifi_nan_time_bitmap_s {
568 uint16 ctrl; /* Time bitmap control */
569 uint8 len; /* Time bitmap length */
570 uint8 bitmap[]; /* Time bitmap */
571 } BWL_POST_PACKED_STRUCT wifi_nan_time_bitmap_t;
572
573 /* Availability Entry format */
574 typedef BWL_PRE_PACKED_STRUCT struct wifi_nan_avail_entry_attr_s {
575 uint16 len; /* Length */
576 uint16 entry_cntrl; /* Entry Control */
577 uint8 var[]; /* Time bitmap and channel entry list */
578 } BWL_POST_PACKED_STRUCT wifi_nan_avail_entry_attr_t;
579
580 /* FAC Channel Entry (section 10.7.19.1.5) */
581 typedef BWL_PRE_PACKED_STRUCT struct wifi_nan_chan_entry_s {
582 uint8 oper_class; /* Operating Class */
583 uint16 chan_bitmap; /* Channel Bitmap */
584 uint8 primary_chan_bmp; /* Primary Channel Bitmap */
585 uint8 aux_chan[0]; /* Auxiliary Channel bitmap */
586 } BWL_POST_PACKED_STRUCT wifi_nan_chan_entry_t;
587
588 /* Channel entry */
589 typedef BWL_PRE_PACKED_STRUCT struct wifi_nan_channel_entry_s {
590 uint8 opclass; /* Operating class */
591 uint16 chan_bitmap; /* Channel bitmap */
592 uint8 prim_bitmap; /* Primary channel bitmap */
593 uint16 aux_bitmap; /* Time bitmap length */
594 } BWL_POST_PACKED_STRUCT wifi_nan_channel_entry_t;
595
596 /* Type of Availability: committed */
597 #define NAN_ENTRY_CNTRL_TYPE_COMM_AVAIL_MASK 0x1
598 /* Type of Availability: potential */
599 #define NAN_ENTRY_CNTRL_TYPE_POTEN_AVAIL_MASK 0x2
600 /* Type of Availability: conditional */
601 #define NAN_ENTRY_CNTRL_TYPE_COND_AVAIL_MASK 0x4
602
603 #define NAN_AVAIL_CTRL_MAP_ID_MASK 0x000F
604 #define NAN_AVAIL_CTRL_MAP_ID(_ctrl) ((_ctrl) & NAN_AVAIL_CTRL_MAP_ID_MASK)
605 #define NAN_AVAIL_CTRL_COMM_CHANGED_MASK 0x0010
606 #define NAN_AVAIL_CTRL_COMM_CHANGED(_ctrl) ((_ctrl) & NAN_AVAIL_CTRL_COMM_CHANGED_MASK)
607 #define NAN_AVAIL_CTRL_POTEN_CHANGED_MASK 0x0020
608 #define NAN_AVAIL_CTRL_POTEN_CHANGED(_ctrl) ((_ctrl) & NAN_AVAIL_CTRL_POTEN_CHANGED_MASK)
609 #define NAN_AVAIL_CTRL_PUBLIC_CHANGED_MASK 0x0040
610 #define NAN_AVAIL_CTRL_PUBLIC_CHANGED(_ctrl) ((_ctrl) & NAN_AVAIL_CTRL_PUBLIC_CHANGED_MASK)
611 #define NAN_AVAIL_CTRL_NDC_CHANGED_MASK 0x0080
612 #define NAN_AVAIL_CTRL_NDC_CHANGED(_ctrl) ((_ctrl) & NAN_AVAIL_CTRL_NDC_CHANGED_MASK)
613 #define NAN_AVAIL_CTRL_MCAST_CHANGED_MASK 0x0100
614 #define NAN_AVAIL_CTRL_MCAST_CHANGED(_ctrl) ((_ctrl) & NAN_AVAIL_CTRL_MCAST_CHANGED_MASK)
615 #define NAN_AVAIL_CTRL_MCAST_CHG_CHANGED_MASK 0x0200
616 #define NAN_AVAIL_CTRL_MCAST_CHG_CHANGED(_ctrl) ((_ctrl) & NAN_AVAIL_CTRL_MCAST_CHG_CHANGED_MASK)
617 #define NAN_AVAIL_CTRL_CHANGED_FLAGS_MASK 0x03f0
618
619 #define NAN_AVAIL_ENTRY_CTRL_AVAIL_TYPE_MASK 0x07
620 #define NAN_AVAIL_ENTRY_CTRL_AVAIL_TYPE(_flags) ((_flags) & NAN_AVAIL_ENTRY_CTRL_AVAIL_TYPE_MASK)
621 #define NAN_AVAIL_ENTRY_CTRL_USAGE_MASK 0x18
622 #define NAN_AVAIL_ENTRY_CTRL_USAGE_SHIFT 3
623 #define NAN_AVAIL_ENTRY_CTRL_USAGE(_flags) (((_flags) & NAN_AVAIL_ENTRY_CTRL_USAGE_MASK) \
624 >> NAN_AVAIL_ENTRY_CTRL_USAGE_SHIFT)
625 #define NAN_AVAIL_ENTRY_CTRL_UTIL_MASK 0xE0
626 #define NAN_AVAIL_ENTRY_CTRL_UTIL_SHIFT 5
627 #define NAN_AVAIL_ENTRY_CTRL_UTIL(_flags) (((_flags) & NAN_AVAIL_ENTRY_CTRL_UTIL_MASK) \
628 >> NAN_AVAIL_ENTRY_CTRL_UTIL_SHIFT)
629 #define NAN_AVAIL_ENTRY_CTRL_RX_NSS_MASK 0xF00
630 #define NAN_AVAIL_ENTRY_CTRL_RX_NSS_SHIFT 8
631 #define NAN_AVAIL_ENTRY_CTRL_RX_NSS(_flags) (((_flags) & NAN_AVAIL_ENTRY_CTRL_RX_NSS_MASK) \
632 >> NAN_AVAIL_ENTRY_CTRL_RX_NSS_SHIFT)
633 #define NAN_AVAIL_ENTRY_CTRL_BITMAP_PRESENT_MASK 0x1000
634 #define NAN_AVAIL_ENTRY_CTRL_BITMAP_PRESENT_SHIFT 12
635 #define NAN_AVAIL_ENTRY_CTRL_BITMAP_PRESENT(_flags) (((_flags) & \
636 NAN_AVAIL_ENTRY_CTRL_BITMAP_PRESENT_MASK) >> NAN_AVAIL_ENTRY_CTRL_BITMAP_PRESENT_SHIFT)
637
638 #define NAN_TIME_BMAP_CTRL_BITDUR_MASK 0x07
639 #define NAN_TIME_BMAP_CTRL_BITDUR(_flags) ((_flags) & NAN_TIME_BMAP_CTRL_BITDUR_MASK)
640 #define NAN_TIME_BMAP_CTRL_PERIOD_MASK 0x38
641 #define NAN_TIME_BMAP_CTRL_PERIOD_SHIFT 3
642 #define NAN_TIME_BMAP_CTRL_PERIOD(_flags) (((_flags) & NAN_TIME_BMAP_CTRL_PERIOD_MASK) \
643 >> NAN_TIME_BMAP_CTRL_PERIOD_SHIFT)
644 #define NAN_TIME_BMAP_CTRL_OFFSET_MASK 0x7FC0
645 #define NAN_TIME_BMAP_CTRL_OFFSET_SHIFT 6
646 #define NAN_TIME_BMAP_CTRL_OFFSET(_flags) (((_flags) & NAN_TIME_BMAP_CTRL_OFFSET_MASK) \
647 >> NAN_TIME_BMAP_CTRL_OFFSET_SHIFT)
648 #define NAN_TIME_BMAP_LEN(avail_entry) \
649 (*(uint8 *)(((wifi_nan_avail_entry_attr_t *)avail_entry)->var + 2))
650
651 #define NAN_AVAIL_CHAN_LIST_HDR_LEN 1
652 #define NAN_AVAIL_CHAN_LIST_TYPE_BAND 0x00
653 #define NAN_AVAIL_CHAN_LIST_TYPE_CHANNEL 0x01
654 #define NAN_AVAIL_CHAN_LIST_NON_CONTIG_BW 0x02
655 #define NAN_AVAIL_CHAN_LIST_NUM_ENTRIES_MASK 0xF0
656 #define NAN_AVAIL_CHAN_LIST_NUM_ENTRIES_SHIFT 4
657 #define NAN_AVAIL_CHAN_LIST_NUM_ENTRIES(_ctrl) (((_ctrl) & NAN_AVAIL_CHAN_LIST_NUM_ENTRIES_MASK) \
658 >> NAN_AVAIL_CHAN_LIST_NUM_ENTRIES_SHIFT)
659
660 typedef BWL_PRE_PACKED_STRUCT struct wifi_nan_channel_entry_list_s {
661 uint8 chan_info;
662 uint8 var[0];
663 } BWL_POST_PACKED_STRUCT wifi_nan_channel_entry_list_t;
664
665 /* define for chan_info */
666 #define NAN_CHAN_OP_CLASS_MASK 0x01
667 #define NAN_CHAN_NON_CONT_BW_MASK 0x02
668 #define NAN_CHAN_RSVD_MASK 0x03
669 #define NAN_CHAN_NUM_ENTRIES_MASK 0xF0
670
671 typedef BWL_PRE_PACKED_STRUCT struct wifi_nan_band_entry_s {
672 uint8 band[0];
673 } BWL_POST_PACKED_STRUCT wifi_nan_band_entry_t;
674
675 /* Type of Availability: committed */
676 #define NAN_ENTRY_CNTRL_TYPE_COMM_AVAIL 0x1
677 /* Type of Availability: potential */
678 #define NAN_ENTRY_CNTRL_TYPE_POTEN_AVAIL 0x2
679 /* Type of Availability: conditional */
680 #define NAN_ENTRY_CNTRL_TYPE_COND_AVAIL 0x4
681 /* Committed + Potential */
682 #define NAN_ENTRY_CNTRL_TYPE_COMM_POTEN \
683 (NAN_ENTRY_CNTRL_TYPE_COMM_AVAIL | NAN_ENTRY_CNTRL_TYPE_POTEN_AVAIL)
684 /* Conditional + Potential */
685 #define NAN_ENTRY_CNTRL_TYPE_COND_POTEN \
686 (NAN_ENTRY_CNTRL_TYPE_COND_AVAIL | NAN_ENTRY_CNTRL_TYPE_POTEN_AVAIL)
687
688 /* Type of Availability */
689 #define NAN_ENTRY_CNTRL_TYPE_OF_AVAIL_MASK 0x07
690 #define NAN_ENTRY_CNTRL_TYPE_OF_AVAIL_SHIFT 0
691 /* Usage Preference */
692 #define NAN_ENTRY_CNTRL_USAGE_PREF_MASK 0x18
693 #define NAN_ENTRY_CNTRL_USAGE_PREF_SHIFT 3
694 /* Utilization */
695 #define NAN_ENTRY_CNTRL_UTIL_MASK 0x1E0
696 #define NAN_ENTRY_CNTRL_UTIL_SHIFT 5
697
698 /* Time Bitmap Control field (section 5.7.18.2.3) */
699
700 /* Reserved */
701 #define NAN_TIME_BMP_CNTRL_RSVD_MASK 0x01
702 #define NAN_TIME_BMP_CNTRL_RSVD_SHIFT 0
703 /* Bitmap Len */
704 #define NAN_TIME_BMP_CNTRL_BMP_LEN_MASK 0x7E
705 #define NAN_TIME_BMP_CNTRL_BMP_LEN_SHIFT 1
706 /* Bit Duration */
707 #define NAN_TIME_BMP_CNTRL_BIT_DUR_MASK 0x380
708 #define NAN_TIME_BMP_CNTRL_BIT_DUR_SHIFT 7
709 /* Bitmap Len */
710 #define NAN_TIME_BMP_CNTRL_PERIOD_MASK 0x1C00
711 #define NAN_TIME_BMP_CNTRL_PERIOD_SHIFT 10
712 /* Start Offset */
713 #define NAN_TIME_BMP_CNTRL_START_OFFSET_MASK 0x3FE000
714 #define NAN_TIME_BMP_CNTRL_START_OFFSET_SHIFT 13
715 /* Reserved */
716 #define NAN_TIME_BMP_CNTRL_RESERVED_MASK 0xC00000
717 #define NAN_TIME_BMP_CNTRL_RESERVED_SHIFT 22
718
719 /* Time Bitmap Control field: Period */
720 typedef enum
721 {
722 NAN_TIME_BMP_CTRL_PERIOD_128TU = 1,
723 NAN_TIME_BMP_CTRL_PERIOD_256TU = 2,
724 NAN_TIME_BMP_CTRL_PERIOD_512TU = 3,
725 NAN_TIME_BMP_CTRL_PERIOD_1024TU = 4,
726 NAN_TIME_BMP_CTRL_PERIOD_2048U = 5,
727 NAN_TIME_BMP_CTRL_PERIOD_4096U = 6,
728 NAN_TIME_BMP_CTRL_PERIOD_8192U = 7
729 } nan_time_bmp_ctrl_repeat_interval_t;
730
731 enum
732 {
733 NAN_TIME_BMP_BIT_DUR_16TU_IDX = 0,
734 NAN_TIME_BMP_BIT_DUR_32TU_IDX = 1,
735 NAN_TIME_BMP_BIT_DUR_64TU_IDX = 2,
736 NAN_TIME_BMP_BIT_DUR_128TU_IDX = 3
737 };
738
739 enum
740 {
741 NAN_TIME_BMP_BIT_DUR_IDX_0 = 16,
742 NAN_TIME_BMP_BIT_DUR_IDX_1 = 32,
743 NAN_TIME_BMP_BIT_DUR_IDX_2 = 64,
744 NAN_TIME_BMP_BIT_DUR_IDX_3 = 128
745 };
746
747 enum
748 {
749 NAN_TIME_BMP_CTRL_PERIOD_IDX_1 = 128,
750 NAN_TIME_BMP_CTRL_PERIOD_IDX_2 = 256,
751 NAN_TIME_BMP_CTRL_PERIOD_IDX_3 = 512,
752 NAN_TIME_BMP_CTRL_PERIOD_IDX_4 = 1024,
753 NAN_TIME_BMP_CTRL_PERIOD_IDX_5 = 2048,
754 NAN_TIME_BMP_CTRL_PERIOD_IDX_6 = 4096,
755 NAN_TIME_BMP_CTRL_PERIOD_IDX_7 = 8192
756 };
757
758 /* Channel Entries List field */
759
760 /* Type */
761 #define NAN_CHAN_ENTRY_TYPE_MASK 0x01
762 #define NAN_CHAN_ENTRY_TYPE_SHIFT 0
763 /* Channel Entry Length Indication */
764 #define NAN_CHAN_ENTRY_LEN_IND_MASK 0x02
765 #define NAN_CHAN_ENTRY_LEN_IND_SHIFT 1
766 /* Reserved */
767 #define NAN_CHAN_ENTRY_RESERVED_MASK 0x0C
768 #define NAN_CHAN_ENTRY_RESERVED_SHIFT 2
769 /* Number of FAC Band or Channel Entries */
770 #define NAN_CHAN_ENTRY_NO_OF_CHAN_ENTRY_MASK 0xF0
771 #define NAN_CHAN_ENTRY_NO_OF_CHAN_ENTRY_SHIFT 4
772
773 #define NAN_CHAN_ENTRY_TYPE_BANDS 0
774 #define NAN_CHAN_ENTRY_TYPE_OPCLASS_CHANS 1
775
776 #define NAN_CHAN_ENTRY_BW_LT_80MHZ 0
777 #define NAN_CHAN_ENTRY_BW_EQ_160MHZ 1
778
779 /*
780 * NDL Attribute WFA Tech. Spec ver 1.0.r12 (section 10.7.19.2)
781 */
782 #define NDL_ATTR_IM_MAP_ID_LEN 1
783 #define NDL_ATTR_IM_TIME_BMP_CTRL_LEN 2
784 #define NDL_ATTR_IM_TIME_BMP_LEN_LEN 1
785
786 /*
787 * NDL Control field - Table xx
788 */
789 #define NDL_ATTR_CTRL_PEER_ID_PRESENT_MASK 0x01
790 #define NDL_ATTR_CTRL_PEER_ID_PRESENT_SHIFT 0
791 #define NDL_ATTR_CTRL_IM_SCHED_PRESENT_MASK 0x02
792 #define NDL_ATTR_CTRL_IM_SCHED_PRESENT_SHIFT 1
793 #define NDL_ATTR_CTRL_NDC_ATTR_PRESENT_MASK 0x04
794 #define NDL_ATTR_CTRL_NDC_ATTR_PRESENT_SHIFT 2
795 #define NDL_ATTR_CTRL_QOS_ATTR_PRESENT_MASK 0x08
796 #define NDL_ATTR_CTRL_QOS_ATTR_PRESENT_SHIFT 3
797 #define NDL_ATTR_CTRL_MAX_IDLE_PER_PRESENT_MASK 0x10 /* max idle period */
798 #define NDL_ATTR_CTRL_MAX_IDLE_PER_PRESENT_SHIFT 4
799 #define NDL_ATTR_CTRL_NDL_TYPE_MASK 0x20 /* NDL type */
800 #define NDL_ATTR_CTRL_NDL_TYPE_SHIFT 5
801 #define NDL_ATTR_CTRL_NDL_SETUP_REASON_MASK 0xC0 /* NDL Setup Reason */
802 #define NDL_ATTR_CTRL_NDL_SETUP_REASON_SHIFT 6
803
804 /* NDL setup Reason */
805 #define NDL_ATTR_CTRL_NDL_TYPE_S_NDL 0x0 /* S-NDL */
806 #define NDL_ATTR_CTRL_NDL_TYPE_P_NDL 0x1 /* P-NDL */
807
808 /* NDL setup Reason */
809 #define NDL_ATTR_CTRL_NDL_SETUP_REASON_NDP_RANG 0x0 /* NDP or Ranging */
810 #define NDL_ATTR_CTRL_NDL_SETUP_REASON_FSD_GAS 0x1 /* FSD using GAS */
811
812 #define NAN_NDL_TYPE_MASK 0x0F
813 #define NDL_ATTR_TYPE_STATUS_REQUEST 0x00
814 #define NDL_ATTR_TYPE_STATUS_RESPONSE 0x01
815 #define NDL_ATTR_TYPE_STATUS_CONFIRM 0x02
816 #define NDL_ATTR_TYPE_STATUS_CONTINUED 0x00
817 #define NDL_ATTR_TYPE_STATUS_ACCEPTED 0x10
818 #define NDL_ATTR_TYPE_STATUS_REJECTED 0x20
819
820 #define NAN_NDL_TYPE_CHECK(_ndl, x) (((_ndl)->type_status & NAN_NDL_TYPE_MASK) == (x))
821 #define NAN_NDL_REQUEST(_ndl) (((_ndl)->type_status & NAN_NDL_TYPE_MASK) == \
822 NDL_ATTR_TYPE_STATUS_REQUEST)
823 #define NAN_NDL_RESPONSE(_ndl) (((_ndl)->type_status & NAN_NDL_TYPE_MASK) == \
824 NDL_ATTR_TYPE_STATUS_RESPONSE)
825 #define NAN_NDL_CONFIRM(_ndl) (((_ndl)->type_status & NAN_NDL_TYPE_MASK) == \
826 NDL_ATTR_TYPE_STATUS_CONFIRM)
827
828 #define NAN_NDL_STATUS_SHIFT 4
829 #define NAN_NDL_STATUS_MASK 0xF0
830 #define NAN_NDL_CONT(_ndl) (((_ndl)->type_status & NAN_NDL_STATUS_MASK) == \
831 NDL_ATTR_TYPE_STATUS_CONTINUED)
832 #define NAN_NDL_ACCEPT(_ndl) (((_ndl)->type_status & NAN_NDL_STATUS_MASK) == \
833 NDL_ATTR_TYPE_STATUS_ACCEPTED)
834 #define NAN_NDL_REJECT(_ndl) (((_ndl)->type_status & NAN_NDL_STATUS_MASK) == \
835 NDL_ATTR_TYPE_STATUS_REJECTED)
836
837 #define NDL_ATTR_CTRL_NONE 0
838 #define NDL_ATTR_CTRL_PEER_ID_PRESENT (1 << NDL_ATTR_CTRL_PEER_ID_PRESENT_SHIFT)
839 #define NDL_ATTR_CTRL_IMSCHED_PRESENT (1 << NDL_ATTR_CTRL_IM_SCHED_PRESENT_SHIFT)
840 #define NDL_ATTR_CTRL_NDC_PRESENT (1 << NDL_ATTR_CTRL_NDC_ATTR_PRESENT_SHIFT)
841 #define NDL_ATTR_CTRL_NDL_QOS_PRESENT (1 << NDL_ATTR_CTRL_QOS_ATTR_PRESENT_SHIFT)
842 #define NDL_ATTR_CTRL_MAX_IDLE_PER_PRESENT (1 << NDL_ATTR_CTRL_MAX_IDLE_PER_PRESENT_SHIFT)
843
844 #define NA_NDL_IS_IMMUT_PRESENT(ndl) (((ndl)->ndl_ctrl) & NDL_ATTR_CTRL_IMSCHED_PRESENT)
845 #define NA_NDL_IS_PEER_ID_PRESENT(ndl) (((ndl)->ndl_ctrl) & NDL_ATTR_CTRL_PEER_ID_PRESENT)
846 #define NA_NDL_IS_MAX_IDLE_PER_PRESENT(ndl) (((ndl)->ndl_ctrl) & NDL_ATTR_CTRL_MAX_IDLE_PER_PRESENT)
847
848 #define NDL_ATTR_PEERID_LEN 1
849 #define NDL_ATTR_MAX_IDLE_PERIOD_LEN 2
850
851 typedef BWL_PRE_PACKED_STRUCT struct wifi_nan_ndl_attr_s {
852 uint8 id; /* NAN_ATTR_NAN_NDL = 0x17 */
853 uint16 len; /* Length of the fields in the attribute */
854 uint8 dialog_token; /* Identify req and resp */
855 uint8 type_status; /* Bits[3-0] type subfield, Bits[7-4] status subfield */
856 uint8 reason; /* Identifies reject reason */
857 uint8 ndl_ctrl; /* NDL control field */
858 uint8 var[]; /* Optional fields follow */
859 } BWL_POST_PACKED_STRUCT wifi_nan_ndl_attr_t;
860
861 /*
862 * NDL QoS Attribute WFA Tech. Spec ver r26
863 */
864 typedef BWL_PRE_PACKED_STRUCT struct wifi_nan_ndl_qos_attr_s {
865 uint8 id; /* NAN_ATTR_NAN_NDL_QOS = 24 */
866 uint16 len; /* Length of the attribute field following */
867 uint8 min_slots; /* Min. number of FAW slots needed per DW interval */
868 uint16 max_latency; /* Max interval between non-cont FAW */
869 } BWL_POST_PACKED_STRUCT wifi_nan_ndl_qos_attr_t;
870
871 /* no preference to min time slots */
872 #define NAN_NDL_QOS_MIN_SLOT_NO_PREF 0
873 /* no preference to no. of slots between two non-contiguous slots */
874 #define NAN_NDL_QOS_MAX_LAT_NO_PREF 0xFFFF
875
876 /* Device Capability Attribute */
877
878 typedef BWL_PRE_PACKED_STRUCT struct wifi_nan_dev_cap_s {
879 uint8 id; /* 0x0F */
880 uint16 len; /* Length */
881 uint8 map_id; /* map id */
882 uint16 commit_dw_info; /* Committed DW Info */
883 uint8 bands_supported; /* Supported Bands */
884 uint8 op_mode; /* Operation Mode */
885 uint8 num_antennas; /* Bit 0-3 tx, 4-7 rx */
886 uint16 chan_switch_time; /* Max channel switch time in us */
887 uint8 capabilities; /* DFS Master, Extended key id etc */
888 } BWL_POST_PACKED_STRUCT wifi_nan_dev_cap_t;
889
890 /* map id related */
891
892 /* all maps */
893 #define NAN_DEV_CAP_ALL_MAPS_FLAG_MASK 0x1 /* nan default map control */
894 #define NAN_DEV_CAP_ALL_MAPS_FLAG_SHIFT 0
895 /* map id */
896 #define NAN_DEV_CAP_MAPID_MASK 0x1E
897 #define NAN_DEV_CAP_MAPID_SHIFT 1
898
899 /* Awake DW Info field format */
900
901 /* 2.4GHz DW */
902 #define NAN_DEV_CAP_AWAKE_DW_2G_MASK 0x07
903 /* 5GHz DW */
904 #define NAN_DEV_CAP_AWAKE_DW_5G_MASK 0x38
905 /* Reserved */
906 #define NAN_DEV_CAP_AWAKE_DW_RSVD_MASK 0xC0
907
908 /* bit shift for dev cap */
909 #define NAN_DEV_CAP_AWAKE_DW_2G_SHIFT 0
910 #define NAN_DEV_CAP_AWAKE_DW_5G_SHIFT 3
911
912 /* Device Capability Attribute Format */
913
914 /* Committed DW Info field format */
915 /* 2.4GHz DW */
916 #define NAN_DEV_CAP_COMMIT_DW_2G_MASK 0x07
917 #define NAN_DEV_CAP_COMMIT_DW_2G_OVERWRITE_MASK 0x3C0
918 /* 5GHz DW */
919 #define NAN_DEV_CAP_COMMIT_DW_5G_MASK 0x38
920 #define NAN_DEV_CAP_COMMIT_DW_5G_OVERWRITE_MASK 0x3C00
921 /* Reserved */
922 #define NAN_DEV_CAP_COMMIT_DW_RSVD_MASK 0xC000
923 /* Committed DW bit shift for dev cap */
924 #define NAN_DEV_CAP_COMMIT_DW_2G_SHIFT 0
925 #define NAN_DEV_CAP_COMMIT_DW_5G_SHIFT 3
926 #define NAN_DEV_CAP_COMMIT_DW_2G_OVERWRITE_SHIFT 6
927 #define NAN_DEV_CAP_COMMIT_DW_5G_OVERWRITE_SHIFT 10
928 /* Operation Mode */
929 #define NAN_DEV_CAP_OP_PHY_MODE_HT_ONLY 0x00
930 #define NAN_DEV_CAP_OP_PHY_MODE_VHT 0x01
931 #define NAN_DEV_CAP_OP_PHY_MODE_VHT_8080 0x02
932 #define NAN_DEV_CAP_OP_PHY_MODE_VHT_160 0x04
933 #define NAN_DEV_CAP_OP_PAGING_NDL 0x08
934
935 #define NAN_DEV_CAP_OP_MODE_VHT_MASK 0x01
936 #define NAN_DEV_CAP_OP_MODE_VHT_SHIFT 0
937 #define NAN_DEV_CAP_OP_MODE_VHT8080_MASK 0x02
938 #define NAN_DEV_CAP_OP_MODE_VHT8080_SHIFT 1
939 #define NAN_DEV_CAP_OP_MODE_VHT160_MASK 0x04
940 #define NAN_DEV_CAP_OP_MODE_VHT160_SHIFT 2
941 #define NAN_DEV_CAP_OP_MODE_PAGING_NDL_MASK 0x08
942 #define NAN_DEV_CAP_OP_MODE_PAGING_NDL_SHIFT 3
943
944 #define NAN_DEV_CAP_RX_ANT_SHIFT 4
945 #define NAN_DEV_CAP_TX_ANT_MASK 0x0F
946 #define NAN_DEV_CAP_RX_ANT_MASK 0xF0
947 #define NAN_DEV_CAP_TX_ANT(_ant) ((_ant) & NAN_DEV_CAP_TX_ANT_MASK)
948 #define NAN_DEV_CAP_RX_ANT(_ant) (((_ant) & NAN_DEV_CAP_RX_ANT_MASK) \
949 >> NAN_DEV_CAP_RX_ANT_SHIFT)
950
951 /* Device capabilities */
952
953 /* DFS master capability */
954 #define NAN_DEV_CAP_DFS_MASTER_MASK 0x01
955 #define NAN_DEV_CAP_DFS_MASTER_SHIFT 0
956 /* extended iv cap */
957 #define NAN_DEV_CAP_EXT_KEYID_MASK 0x02
958 #define NAN_DEV_CAP_EXT_KEYID_SHIFT 1
959 /* NDPE attribute support */
960 #define NAN_DEV_CAP_NDPE_ATTR_SUPPORT_MASK 0x08
961 #define NAN_DEV_CAP_NDPE_ATTR_SUPPORT(_cap) ((_cap) & NAN_DEV_CAP_NDPE_ATTR_SUPPORT_MASK)
962
963 /* Band IDs */
964 enum {
965 NAN_BAND_ID_TVWS = 0,
966 NAN_BAND_ID_SIG = 1, /* Sub 1 GHz */
967 NAN_BAND_ID_2G = 2, /* 2.4 GHz */
968 NAN_BAND_ID_3G = 3, /* 3.6 GHz */
969 NAN_BAND_ID_5G = 4, /* 4.9 & 5 GHz */
970 NAN_BAND_ID_60G = 5
971 };
972 typedef uint8 nan_band_id_t;
973
974 /* NAN supported band in device capability */
975 #define NAN_DEV_CAP_SUPPORTED_BANDS_2G (1 << NAN_BAND_ID_2G)
976 #define NAN_DEV_CAP_SUPPORTED_BANDS_5G (1 << NAN_BAND_ID_5G)
977
978 /*
979 * Unaligned schedule attribute section 10.7.19.6 spec. ver r15
980 */
981 #define NAN_ULW_ATTR_CTRL_SCHED_ID_MASK 0x000F
982 #define NAN_ULW_ATTR_CTRL_SCHED_ID_SHIFT 0
983 #define NAN_ULW_ATTR_CTRL_SEQ_ID_MASK 0xFF00
984 #define NAN_ULW_ATTR_CTRL_SEQ_ID_SHIFT 8
985
986 #define NAN_ULW_OVWR_ALL_MASK 0x01
987 #define NAN_ULW_OVWR_ALL_SHIFT 0
988 #define NAN_ULW_OVWR_MAP_ID_MASK 0x1E
989 #define NAN_ULW_OVWR_MAP_ID_SHIFT 1
990
991 #define NAN_ULW_CTRL_TYPE_MASK 0x03
992 #define NAN_ULW_CTRL_TYPE_SHIFT 0
993 #define NAN_ULW_CTRL_TYPE(ctrl) (ctrl & NAN_ULW_CTRL_TYPE_MASK)
994 #define NAN_ULW_CTRL_CHAN_AVAIL_MASK 0x04
995 #define NAN_ULW_CTRL_CHAN_AVAIL_SHIFT 2
996 #define NAN_ULW_CTRL_CHAN_AVAIL(ctrl) ((ctrl & NAN_ULW_CTRL_CHAN_AVAIL_MASK) \
997 >> NAN_ULW_CTRL_CHAN_AVAIL_SHIFT)
998 #define NAN_ULW_CTRL_RX_NSS_MASK 0x78
999 #define NAN_ULW_CTRL_RX_NSS_SHIFT 3
1000
1001 #define NAN_ULW_CTRL_TYPE_BAND 0
1002 #define NAN_ULW_CTRL_TYPE_CHAN_NOAUX 1
1003 #define NAN_ULW_CTRL_TYPE_CHAN_AUX 2
1004
1005 #define NAN_ULW_CNT_DOWN_NO_EXPIRE 0xFF /* ULWs doen't end until next sched update */
1006 #define NAN_ULW_CNT_DOWN_CANCEL 0x0 /* cancel remaining ulws */
1007
1008 typedef BWL_PRE_PACKED_STRUCT struct wifi_nan_ulw_attr_s {
1009 uint8 id;
1010 uint16 len;
1011 uint16 ctrl;
1012 uint32 start; /* low 32 bits of tsf */
1013 uint32 dur;
1014 uint32 period;
1015 uint8 count_down;
1016 uint8 overwrite;
1017 /*
1018 * ulw[0] == optional field ULW control when present.
1019 * band ID or channel follows
1020 */
1021 uint8 ulw_entry[];
1022 } BWL_POST_PACKED_STRUCT wifi_nan_ulw_attr_t;
1023
1024 /* NAN2 Management Frame (section 5.6) */
1025
1026 /* Public action frame for NAN2 */
1027 typedef BWL_PRE_PACKED_STRUCT struct nan2_pub_act_frame_s {
1028 /* NAN_PUB_AF_CATEGORY 0x04 */
1029 uint8 category_id;
1030 /* NAN_PUB_AF_ACTION 0x09 */
1031 uint8 action_field;
1032 /* NAN_OUI 0x50-6F-9A */
1033 uint8 oui[DOT11_OUI_LEN];
1034 /* NAN_OUI_TYPE TBD */
1035 uint8 oui_type;
1036 /* NAN_OUI_SUB_TYPE TBD */
1037 uint8 oui_sub_type;
1038 /* One or more NAN Attributes follow */
1039 uint8 data[];
1040 } BWL_POST_PACKED_STRUCT nan2_pub_act_frame_t;
1041
1042 #define NAN2_PUB_ACT_FRM_SIZE (OFFSETOF(nan2_pub_act_frame_t, data))
1043
1044 /* NAN Action Frame Subtypes */
1045 /* Subtype-0 is Reserved */
1046 #define NAN_MGMT_FRM_SUBTYPE_RESERVED 0
1047 #define NAN_MGMT_FRM_SUBTYPE_INVALID 0
1048 /* NAN Ranging Request */
1049 #define NAN_MGMT_FRM_SUBTYPE_RANGING_REQ 1
1050 /* NAN Ranging Response */
1051 #define NAN_MGMT_FRM_SUBTYPE_RANGING_RESP 2
1052 /* NAN Ranging Termination */
1053 #define NAN_MGMT_FRM_SUBTYPE_RANGING_TERM 3
1054 /* NAN Ranging Report */
1055 #define NAN_MGMT_FRM_SUBTYPE_RANGING_RPT 4
1056 /* NDP Request */
1057 #define NAN_MGMT_FRM_SUBTYPE_NDP_REQ 5
1058 /* NDP Response */
1059 #define NAN_MGMT_FRM_SUBTYPE_NDP_RESP 6
1060 /* NDP Confirm */
1061 #define NAN_MGMT_FRM_SUBTYPE_NDP_CONFIRM 7
1062 /* NDP Key Installment */
1063 #define NAN_MGMT_FRM_SUBTYPE_NDP_KEY_INST 8
1064 /* NDP Termination */
1065 #define NAN_MGMT_FRM_SUBTYPE_NDP_END 9
1066 /* Schedule Request */
1067 #define NAN_MGMT_FRM_SUBTYPE_SCHED_REQ 10
1068 /* Schedule Response */
1069 #define NAN_MGMT_FRM_SUBTYPE_SCHED_RESP 11
1070 /* Schedule Confirm */
1071 #define NAN_MGMT_FRM_SUBTYPE_SCHED_CONF 12
1072 /* Schedule Update */
1073 #define NAN_MGMT_FRM_SUBTYPE_SCHED_UPD 13
1074
1075 /* Reason code defines */
1076 #define NAN_REASON_RESERVED 0x0
1077 #define NAN_REASON_UNSPECIFIED 0x1
1078 #define NAN_REASON_RESOURCE_LIMIT 0x2
1079 #define NAN_REASON_INVALID_PARAMS 0x3
1080 #define NAN_REASON_FTM_PARAM_INCAP 0x4
1081 #define NAN_REASON_NO_MOVEMENT 0x5
1082 #define NAN_REASON_INVALID_AVAIL 0x6
1083 #define NAN_REASON_IMMUT_UNACCEPT 0x7
1084 #define NAN_REASON_SEC_POLICY 0x8
1085 #define NAN_REASON_QOS_UNACCEPT 0x9
1086 #define NAN_REASON_NDP_REJECT 0xa
1087 #define NAN_REASON_NDL_UNACCEPTABLE 0xb
1088
1089 /* nan 2.0 qos (not attribute) */
1090 typedef BWL_PRE_PACKED_STRUCT struct wifi_nan_ndp_qos_s {
1091 uint8 tid; /* traffic identifier */
1092 uint16 pkt_size; /* service data pkt size */
1093 uint8 data_rate; /* mean data rate */
1094 uint8 svc_interval; /* max service interval */
1095 } BWL_POST_PACKED_STRUCT wifi_nan_ndp_qos_t;
1096
1097 /* NDP control bitmap defines */
1098 #define NAN_NDP_CTRL_CONFIRM_REQUIRED 0x01
1099 #define NAN_NDP_CTRL_SECURTIY_PRESENT 0x04
1100 #define NAN_NDP_CTRL_PUB_ID_PRESENT 0x08
1101 #define NAN_NDP_CTRL_RESP_NDI_PRESENT 0x10
1102 #define NAN_NDP_CTRL_SPEC_INFO_PRESENT 0x20
1103 #define NAN_NDP_CTRL_RESERVED 0xA0
1104
1105 /* Used for both NDP Attribute and NDPE Attribute, since the structures are identical */
1106 typedef BWL_PRE_PACKED_STRUCT struct wifi_nan_ndp_attr_s {
1107 uint8 id; /* NDP: 0x10, NDPE: 0x29 */
1108 uint16 len; /* length */
1109 uint8 dialog_token; /* dialog token */
1110 uint8 type_status; /* bits 0-3 type, 4-7 status */
1111 uint8 reason; /* reason code */
1112 struct ether_addr init_ndi; /* ndp initiator's data interface address */
1113 uint8 ndp_id; /* ndp identifier (created by initiator */
1114 uint8 control; /* ndp control field */
1115 uint8 var[]; /* Optional fields follow */
1116 } BWL_POST_PACKED_STRUCT wifi_nan_ndp_attr_t;
1117 /* NDP attribute type and status macros */
1118 #define NAN_NDP_TYPE_MASK 0x0F
1119 #define NAN_NDP_TYPE_REQUEST 0x0
1120 #define NAN_NDP_TYPE_RESPONSE 0x1
1121 #define NAN_NDP_TYPE_CONFIRM 0x2
1122 #define NAN_NDP_TYPE_SECURITY 0x3
1123 #define NAN_NDP_TYPE_TERMINATE 0x4
1124 #define NAN_NDP_REQUEST(_ndp) (((_ndp)->type_status & NAN_NDP_TYPE_MASK) == NAN_NDP_TYPE_REQUEST)
1125 #define NAN_NDP_RESPONSE(_ndp) (((_ndp)->type_status & NAN_NDP_TYPE_MASK) == NAN_NDP_TYPE_RESPONSE)
1126 #define NAN_NDP_CONFIRM(_ndp) (((_ndp)->type_status & NAN_NDP_TYPE_MASK) == NAN_NDP_TYPE_CONFIRM)
1127 #define NAN_NDP_SECURITY_INST(_ndp) (((_ndp)->type_status & NAN_NDP_TYPE_MASK) == \
1128 NAN_NDP_TYPE_SECURITY)
1129 #define NAN_NDP_TERMINATE(_ndp) (((_ndp)->type_status & NAN_NDP_TYPE_MASK) == \
1130 NAN_NDP_TYPE_TERMINATE)
1131 #define NAN_NDP_STATUS_SHIFT 4
1132 #define NAN_NDP_STATUS_MASK 0xF0
1133 #define NAN_NDP_STATUS_CONT (0 << NAN_NDP_STATUS_SHIFT)
1134 #define NAN_NDP_STATUS_ACCEPT (1 << NAN_NDP_STATUS_SHIFT)
1135 #define NAN_NDP_STATUS_REJECT (2 << NAN_NDP_STATUS_SHIFT)
1136 #define NAN_NDP_CONT(_ndp) (((_ndp)->type_status & NAN_NDP_STATUS_MASK) == NAN_NDP_STATUS_CONT)
1137 #define NAN_NDP_ACCEPT(_ndp) (((_ndp)->type_status & NAN_NDP_STATUS_MASK) == \
1138 NAN_NDP_STATUS_ACCEPT)
1139 #define NAN_NDP_REJECT(_ndp) (((_ndp)->type_status & NAN_NDP_STATUS_MASK) == \
1140 NAN_NDP_STATUS_REJECT)
1141 /* NDP Setup Status */
1142 #define NAN_NDP_SETUP_STATUS_OK 1
1143 #define NAN_NDP_SETUP_STATUS_FAIL 0
1144 #define NAN_NDP_SETUP_STATUS_REJECT 2
1145
1146 /* Rng setup attribute type and status macros */
1147 #define NAN_RNG_TYPE_MASK 0x0F
1148 #define NAN_RNG_TYPE_REQUEST 0x0
1149 #define NAN_RNG_TYPE_RESPONSE 0x1
1150 #define NAN_RNG_TYPE_TERMINATE 0x2
1151
1152 #define NAN_RNG_STATUS_SHIFT 4
1153 #define NAN_RNG_STATUS_MASK 0xF0
1154 #define NAN_RNG_STATUS_ACCEPT (0 << NAN_RNG_STATUS_SHIFT)
1155 #define NAN_RNG_STATUS_REJECT (1 << NAN_RNG_STATUS_SHIFT)
1156
1157 #define NAN_RNG_ACCEPT(_rsua) (((_rsua)->type_status & NAN_RNG_STATUS_MASK) == \
1158 NAN_RNG_STATUS_ACCEPT)
1159 #define NAN_RNG_REJECT(_rsua) (((_rsua)->type_status & NAN_RNG_STATUS_MASK) == \
1160 NAN_RNG_STATUS_REJECT)
1161
1162 /* schedule entry */
1163 typedef BWL_PRE_PACKED_STRUCT struct wifi_nan_sched_entry_s {
1164 uint8 map_id; /* map id */
1165 uint16 tbmp_ctrl; /* time bitmap control */
1166 uint8 tbmp_len; /* time bitmap len */
1167 uint8 tbmp[]; /* time bitmap - Optional */
1168 } BWL_POST_PACKED_STRUCT wifi_nan_sched_entry_t;
1169
1170 #define NAN_SCHED_ENTRY_MAPID_MASK 0x0F
1171 #define NAN_SCHED_ENTRY_MIN_SIZE OFFSETOF(wifi_nan_sched_entry_t, tbmp)
1172 #define NAN_SCHED_ENTRY_SIZE(_entry) (NAN_SCHED_ENTRY_MIN_SIZE + (_entry)->tbmp_len)
1173
1174 /* for dev cap, element container etc. */
1175 #define NAN_DEV_ELE_MAPID_CTRL_MASK 0x1
1176 #define NAN_DEV_ELE_MAPID_CTRL_SHIFT 0
1177 #define NAN_DEV_ELE_MAPID_MASK 0x1E
1178 #define NAN_DEV_ELE_MAPID_SHIFT 1
1179
1180 #define NAN_DEV_ELE_MAPID_CTRL_SET(_mapid_field, value) \
1181 do {(_mapid_field) &= ~NAN_DEV_ELE_MAPID_CTRL_MASK; \
1182 (_mapid_field) |= ((value << NAN_DEV_ELE_MAPID_CTRL_SHIFT) & \
1183 NAN_DEV_ELE_MAPID_CTRL_MASK); \
1184 } while (0);
1185
1186 #define NAN_DEV_ELE_MAPID_CTRL_GET(_mapid_field) \
1187 (((_mapid_field) & NAN_DEV_ELE_MAPID_CTRL_MASK) >> \
1188 NAN_DEV_ELE_MAPID_CTRL_SHIFT)
1189
1190 #define NAN_DEV_ELE_MAPID_SET(_mapid_field, value) \
1191 do {(_mapid_field) &= ~NAN_DEV_ELE_MAPID_MASK; \
1192 (_mapid_field) |= ((value << NAN_DEV_ELE_MAPID_SHIFT) & \
1193 NAN_DEV_ELE_MAPID_MASK); \
1194 } while (0);
1195
1196 #define NAN_DEV_ELE_MAPID_GET(_mapid_field) \
1197 (((_mapid_field) & NAN_DEV_ELE_MAPID_MASK) >> \
1198 NAN_DEV_ELE_MAPID_SHIFT)
1199
1200 /* schedule entry map id handling */
1201 #define NAN_SCHED_ENTRY_MAPID_MASK 0x0F
1202 #define NAN_SCHED_ENTRY_MAPID_SHIFT 0
1203
1204 #define NAN_SCHED_ENTRY_MAPID_SET(_mapid_field, value) \
1205 do {(_mapid_field) &= ~NAN_SCHED_ENTRY_MAPID_MASK; \
1206 (_mapid_field) |= ((value << NAN_SCHED_ENTRY_MAPID_SHIFT) & \
1207 NAN_SCHED_ENTRY_MAPID_MASK); \
1208 } while (0);
1209
1210 #define NAN_SCHED_ENTRY_MAPID_GET(_mapid_field) \
1211 (((_mapid_field) & NAN_SCHED_ENTRY_MAPID_MASK) >> \
1212 NAN_SCHED_ENTRY_MAPID_SHIFT)
1213
1214 /* NDC attribute */
1215 typedef BWL_PRE_PACKED_STRUCT struct wifi_nan_ndc_attr_s {
1216 uint8 id;
1217 uint16 len;
1218 uint8 ndc_id[NAN_DATA_NDC_ID_SIZE];
1219 uint8 attr_cntrl;
1220 uint8 var[];
1221 } BWL_POST_PACKED_STRUCT wifi_nan_ndc_attr_t;
1222
1223 /* Attribute control subfield of NDC attr */
1224 /* Proposed NDC */
1225 #define NAN_NDC_ATTR_PROPOSED_NDC_MASK 0x1
1226 #define NAN_NDC_ATTR_PROPOSED_NDC_SHIFT 0
1227
1228 /* get & set */
1229 #define NAN_NDC_GET_PROPOSED_FLAG(_attr) \
1230 (((_attr)->attr_cntrl & NAN_NDC_ATTR_PROPOSED_NDC_MASK) >> \
1231 NAN_NDC_ATTR_PROPOSED_NDC_SHIFT)
1232 #define NAN_NDC_SET_PROPOSED_FLAG(_attr, value) \
1233 do {((_attr)->attr_cntrl &= ~NAN_NDC_ATTR_PROPOSED_NDC_MASK); \
1234 ((_attr)->attr_cntrl |= \
1235 (((value) << NAN_NDC_ATTR_PROPOSED_NDC_SHIFT) & NAN_NDC_ATTR_PROPOSED_NDC_MASK)); \
1236 } while (0)
1237
1238 /* Service descriptor extension attribute */
1239 typedef BWL_PRE_PACKED_STRUCT struct wifi_nan_svc_desc_ext_attr_s {
1240 /* Attribute ID - 0x11 */
1241 uint8 id;
1242 /* Length of the following fields in the attribute */
1243 uint16 len;
1244 /* Instance id of associated service descriptor attribute */
1245 uint8 instance_id;
1246 /* SDE control field */
1247 uint16 control;
1248 /* range limit, svc upd indicator etc. */
1249 uint8 var[];
1250 } BWL_POST_PACKED_STRUCT wifi_nan_svc_desc_ext_attr_t;
1251
1252 #define NAN_SDE_ATTR_MIN_LEN OFFSETOF(wifi_nan_svc_desc_ext_attr_t, var)
1253 #define NAN_SDE_ATTR_RANGE_LEN 4
1254 #define NAN_SDE_ATTR_SUI_LEN 1
1255 #define NAN_SDE_ATTR_INFO_LEN_PARAM_LEN 2
1256 #define NAN_SDE_ATTR_RANGE_INGRESS_LEN 2
1257 #define NAN_SDE_ATTR_RANGE_EGRESS_LEN 2
1258 #define NAN_SDE_ATTR_CTRL_LEN 2
1259 /* max length of variable length field (matching filter, service response filter,
1260 * or service info) in service descriptor attribute
1261 */
1262 #define NAN_DISC_SDA_FIELD_MAX_LEN 255
1263
1264 /* SDEA control field bit definitions and access macros */
1265 #define NAN_SDE_CF_FSD_REQUIRED (1 << 0)
1266 #define NAN_SDE_CF_FSD_GAS (1 << 1)
1267 #define NAN_SDE_CF_DP_REQUIRED (1 << 2)
1268 #define NAN_SDE_CF_DP_TYPE (1 << 3)
1269 #define NAN_SDE_CF_MULTICAST_TYPE (1 << 4)
1270 #define NAN_SDE_CF_QOS_REQUIRED (1 << 5)
1271 #define NAN_SDE_CF_SECURITY_REQUIRED (1 << 6)
1272 #define NAN_SDE_CF_RANGING_REQUIRED (1 << 7)
1273 #define NAN_SDE_CF_RANGE_PRESENT (1 << 8)
1274 #define NAN_SDE_CF_SVC_UPD_IND_PRESENT (1 << 9)
1275 /* Using Reserved Bits as per Spec */
1276 #define NAN_SDE_CF_LIFE_CNT_PUB_RX (1 << 15)
1277 #define NAN_SDE_FSD_REQUIRED(_sde) ((_sde)->control & NAN_SDE_CF_FSD_REQUIRED)
1278 #define NAN_SDE_FSD_GAS(_sde) ((_sde)->control & NAN_SDE_CF_FSD_GAS)
1279 #define NAN_SDE_DP_REQUIRED(_sde) ((_sde)->control & NAN_SDE_CF_DP_REQUIRED)
1280 #define NAN_SDE_DP_MULTICAST(_sde) ((_sde)->control & NAN_SDE_CF_DP_TYPE)
1281 #define NAN_SDE_MULTICAST_M_TO_M(_sde) ((_sde)->control & NAN_SDE_CF_MULTICAST_TYPE)
1282 #define NAN_SDE_QOS_REQUIRED(_sde) ((_sde)->control & NAN_SDE_CF_QOS_REQUIRED)
1283 #define NAN_SDE_SECURITY_REQUIRED(_sde) ((_sde)->control & NAN_SDE_CF_SECURITY_REQUIRED)
1284 #define NAN_SDE_RANGING_REQUIRED(_sde) ((_sde)->control & NAN_SDE_CF_RANGING_REQUIRED)
1285 #define NAN_SDE_RANGE_PRESENT(_sde) ((_sde)->control & NAN_SDE_CF_RANGE_PRESENT)
1286 #define NAN_SDE_SVC_UPD_IND_PRESENT(_sde) ((_sde)->control & NAN_SDE_CF_SVC_UPD_IND_PRESENT)
1287 #define NAN_SDE_LIFE_COUNT_FOR_PUB_RX(_sde) (_sde & NAN_SDE_CF_LIFE_CNT_PUB_RX)
1288
1289 /* nan2 security */
1290
1291 /*
1292 * Cipher suite information Attribute.
1293 * WFA Tech. Spec ver 1.0.r21 (section 10.7.24.2)
1294 */
1295 #define NAN_SEC_CIPHER_SUITE_CAP_REPLAY_4 0
1296 #define NAN_SEC_CIPHER_SUITE_CAP_REPLAY_16 (1 << 0)
1297
1298 /* enum security algo.
1299 */
1300 enum nan_sec_csid {
1301 NAN_SEC_ALGO_NONE = 0,
1302 NAN_SEC_ALGO_NCS_SK_CCM_128 = 1, /* CCMP 128 */
1303 NAN_SEC_ALGO_NCS_SK_GCM_256 = 2, /* GCMP 256 */
1304 NAN_SEC_ALGO_LAST = 3
1305 };
1306 typedef int8 nan_sec_csid_e;
1307
1308 /* nan2 cipher suite attribute field */
1309 typedef BWL_PRE_PACKED_STRUCT struct wifi_nan_sec_cipher_suite_field_s {
1310 uint8 cipher_suite_id;
1311 uint8 inst_id; /* Instance Id */
1312 } BWL_POST_PACKED_STRUCT wifi_nan_sec_cipher_suite_field_t;
1313
1314 /* nan2 cipher suite information attribute field */
1315 typedef BWL_PRE_PACKED_STRUCT struct wifi_nan_sec_cipher_suite_info_attr_s {
1316 uint8 attr_id; /* 0x22 - NAN_ATTR_CIPHER_SUITE_INFO */
1317 uint16 len;
1318 uint8 capabilities;
1319 uint8 var[]; /* cipher suite list */
1320 } BWL_POST_PACKED_STRUCT wifi_nan_sec_cipher_suite_info_attr_t;
1321
1322 /*
1323 * Security context identifier attribute
1324 * WFA Tech. Spec ver 1.0.r21 (section 10.7.24.4)
1325 */
1326
1327 #define NAN_SEC_CTX_ID_TYPE_PMKID (1 << 0)
1328
1329 /* nan2 security context identifier attribute field */
1330 typedef BWL_PRE_PACKED_STRUCT struct wifi_nan_sec_ctx_id_field_s {
1331 uint16 sec_ctx_id_type_len; /* length of security ctx identifier */
1332 uint8 sec_ctx_id_type;
1333 uint8 inst_id; /* Instance Id */
1334 uint8 var[]; /* security ctx identifier */
1335 } BWL_POST_PACKED_STRUCT wifi_nan_sec_ctx_id_field_t;
1336
1337 /* nan2 security context identifier info attribute field */
1338 typedef BWL_PRE_PACKED_STRUCT struct wifi_nan_sec_ctx_id_info_attr_s {
1339 uint8 attr_id; /* 0x23 - NAN_ATTR_SEC_CTX_ID_INFO */
1340 uint16 len;
1341 uint8 var[]; /* security context identifier list */
1342 } BWL_POST_PACKED_STRUCT wifi_nan_sec_ctx_id_info_attr_t;
1343
1344 /*
1345 * Nan shared key descriptor attribute
1346 * WFA Tech. Spec ver 23
1347 */
1348
1349 #define NAN_SEC_NCSSK_DESC_REPLAY_CNT_LEN 8
1350 #define NAN_SEC_NCSSK_DESC_KEY_NONCE_LEN 32
1351
1352 /* nan shared key descriptor attr field */
1353 typedef BWL_PRE_PACKED_STRUCT struct wifi_nan_sec_ncssk_key_desc_attr_s {
1354 uint8 attr_id; /* 0x24 - NAN_ATTR_SHARED_KEY_DESC */
1355 uint16 len;
1356 uint8 inst_id; /* Publish service instance ID */
1357 uint8 desc_type;
1358 uint16 key_info;
1359 uint16 key_len;
1360 uint8 key_replay_cntr[NAN_SEC_NCSSK_DESC_REPLAY_CNT_LEN];
1361 uint8 key_nonce[NAN_SEC_NCSSK_DESC_KEY_NONCE_LEN];
1362 uint8 reserved[32]; /* EAPOL IV + Key RSC + Rsvd fields in EAPOL Key */
1363 uint8 mic[]; /* mic + key data len + key data */
1364 } BWL_POST_PACKED_STRUCT wifi_nan_sec_ncssk_key_desc_attr_t;
1365
1366 /* Key Info fields */
1367 #define NAN_SEC_NCSSK_DESC_MASK 0x7
1368 #define NAN_SEC_NCSSK_DESC_SHIFT 0
1369 #define NAN_SEC_NCSSK_DESC_KEY_TYPE_MASK 0x8
1370 #define NAN_SEC_NCSSK_DESC_KEY_TYPE_SHIFT 3
1371 #define NAN_SEC_NCSSK_DESC_KEY_INSTALL_MASK 0x40
1372 #define NAN_SEC_NCSSK_DESC_KEY_INSTALL_SHIFT 6
1373 #define NAN_SEC_NCSSK_DESC_KEY_ACK_MASK 0x80
1374 #define NAN_SEC_NCSSK_DESC_KEY_ACK_SHIFT 7
1375 #define NAN_SEC_NCSSK_DESC_KEY_MIC_MASK 0x100
1376 #define NAN_SEC_NCSSK_DESC_KEY_MIC_SHIFT 8
1377 #define NAN_SEC_NCSSK_DESC_KEY_SEC_MASK 0x200
1378 #define NAN_SEC_NCSSK_DESC_KEY_SEC_SHIFT 9
1379 #define NAN_SEC_NCSSK_DESC_KEY_ERR_MASK 0x400
1380 #define NAN_SEC_NCSSK_DESC_KEY_ERR_SHIFT 10
1381 #define NAN_SEC_NCSSK_DESC_KEY_REQ_MASK 0x800
1382 #define NAN_SEC_NCSSK_DESC_KEY_REQ_SHIFT 11
1383 #define NAN_SEC_NCSSK_DESC_KEY_ENC_KEY_MASK 0x1000
1384 #define NAN_SEC_NCSSK_DESC_KEY_ENC_KEY_SHIFT 12
1385 #define NAN_SEC_NCSSK_DESC_KEY_SMK_MSG_MASK 0x2000
1386 #define NAN_SEC_NCSSK_DESC_KEY_SMK_MSG_SHIFT 13
1387
1388 /* Key Info get & set macros */
1389 #define NAN_SEC_NCSSK_KEY_DESC_VER_GET(_key_info) \
1390 (((_key_info) & NAN_SEC_NCSSK_DESC_MASK) >> NAN_SEC_NCSSK_DESC_SHIFT)
1391 #define NAN_SEC_NCSSK_KEY_DESC_VER_SET(_val, _key_info) \
1392 do {(_key_info) &= ~NAN_SEC_NCSSK_DESC_MASK; \
1393 (_key_info) |= (((_val) << NAN_SEC_NCSSK_DESC_SHIFT) & \
1394 NAN_SEC_NCSSK_DESC_MASK);} while (0)
1395 #define NAN_SEC_NCSSK_DESC_KEY_TYPE_GET(_key_info) \
1396 (((_key_info) & NAN_SEC_NCSSK_DESC_KEY_TYPE_MASK) >> NAN_SEC_NCSSK_DESC_KEY_TYPE_SHIFT)
1397 #define NAN_SEC_NCSSK_DESC_KEY_TYPE_SET(_val, _key_info) \
1398 do {(_key_info) &= ~NAN_SEC_NCSSK_DESC_KEY_TYPE_MASK; \
1399 (_key_info) |= (((_val) << NAN_SEC_NCSSK_DESC_KEY_TYPE_SHIFT) & \
1400 NAN_SEC_NCSSK_DESC_KEY_TYPE_MASK);} while (0)
1401 #define NAN_SEC_NCSSK_DESC_KEY_INSTALL_GET(_key_info) \
1402 (((_key_info) & NAN_SEC_NCSSK_DESC_KEY_INSTALL_MASK) >> \
1403 NAN_SEC_NCSSK_DESC_KEY_INSTALL_SHIFT)
1404 #define NAN_SEC_NCSSK_DESC_KEY_INSTALL_SET(_val, _key_info) \
1405 do {(_key_info) &= ~NAN_SEC_NCSSK_DESC_KEY_INSTALL_MASK; \
1406 (_key_info) |= (((_val) << NAN_SEC_NCSSK_DESC_KEY_INSTALL_SHIFT) & \
1407 NAN_SEC_NCSSK_DESC_KEY_INSTALL_MASK);} while (0)
1408 #define NAN_SEC_NCSSK_DESC_KEY_ACK_GET(_key_info) \
1409 (((_key_info) & NAN_SEC_NCSSK_DESC_KEY_ACK_MASK) >> NAN_SEC_NCSSK_DESC_KEY_ACK_SHIFT)
1410 #define NAN_SEC_NCSSK_DESC_KEY_ACK_SET(_val, _key_info) \
1411 do {(_key_info) &= ~NAN_SEC_NCSSK_DESC_KEY_ACK_MASK; \
1412 (_key_info) |= (((_val) << NAN_SEC_NCSSK_DESC_KEY_ACK_SHIFT) & \
1413 NAN_SEC_NCSSK_DESC_KEY_ACK_MASK);} while (0)
1414 #define NAN_SEC_NCSSK_DESC_KEY_MIC_GET(_key_info) \
1415 (((_key_info) & NAN_SEC_NCSSK_DESC_KEY_MIC_MASK) >> NAN_SEC_NCSSK_DESC_KEY_MIC_SHIFT)
1416 #define NAN_SEC_NCSSK_DESC_KEY_MIC_SET(_val, _key_info) \
1417 do {(_key_info) &= ~NAN_SEC_NCSSK_DESC_KEY_MIC_MASK; \
1418 (_key_info) |= (((_val) << NAN_SEC_NCSSK_DESC_KEY_MIC_SHIFT) & \
1419 NAN_SEC_NCSSK_DESC_KEY_MIC_MASK);} while (0)
1420 #define NAN_SEC_NCSSK_DESC_KEY_SEC_GET(_key_info) \
1421 (((_key_info) & NAN_SEC_NCSSK_DESC_KEY_SEC_MASK) >> NAN_SEC_NCSSK_DESC_KEY_SEC_SHIFT)
1422 #define NAN_SEC_NCSSK_DESC_KEY_SEC_SET(_val, _key_info) \
1423 do {(_key_info) &= ~NAN_SEC_NCSSK_DESC_KEY_SEC_MASK; \
1424 (_key_info) |= (((_val) << NAN_SEC_NCSSK_DESC_KEY_SEC_SHIFT) & \
1425 NAN_SEC_NCSSK_DESC_KEY_SEC_MASK);} while (0)
1426 #define NAN_SEC_NCSSK_DESC_KEY_ERR_GET(_key_info) \
1427 (((_key_info) & NAN_SEC_NCSSK_DESC_KEY_ERR_MASK) >> NAN_SEC_NCSSK_DESC_KEY_ERR_SHIFT)
1428 #define NAN_SEC_NCSSK_DESC_KEY_ERR_SET(_val, _key_info) \
1429 do {(_key_info) &= ~NAN_SEC_NCSSK_DESC_KEY_ERR_MASK; \
1430 (_key_info) |= (((_val) << NAN_SEC_NCSSK_DESC_KEY_ERR_SHIFT) & \
1431 NAN_SEC_NCSSK_DESC_KEY_ERR_MASK);} while (0)
1432 #define NAN_SEC_NCSSK_DESC_KEY_REQ_GET(_key_info) \
1433 (((_key_info) & NAN_SEC_NCSSK_DESC_KEY_REQ_MASK) >> NAN_SEC_NCSSK_DESC_KEY_REQ_SHIFT)
1434 #define NAN_SEC_NCSSK_DESC_KEY_REQ_SET(_val, _key_info) \
1435 do {(_key_info) &= ~NAN_SEC_NCSSK_DESC_KEY_REQ_MASK; \
1436 (_key_info) |= (((_val) << NAN_SEC_NCSSK_DESC_KEY_REQ_SHIFT) & \
1437 NAN_SEC_NCSSK_DESC_KEY_REQ_MASK);} while (0)
1438 #define NAN_SEC_NCSSK_DESC_KEY_ENC_KEY_GET(_key_info) \
1439 (((_key_info) & NAN_SEC_NCSSK_DESC_KEY_ENC_KEY_MASK) >> \
1440 NAN_SEC_NCSSK_DESC_KEY_ENC_KEY_SHIFT)
1441 #define NAN_SEC_NCSSK_DESC_KEY_ENC_KEY_SET(_val, _key_info) \
1442 do {(_key_info) &= ~NAN_SEC_NCSSK_DESC_KEY_ENC_KEY_MASK; \
1443 (_key_info) |= (((_val) << NAN_SEC_NCSSK_DESC_KEY_ENC_KEY_SHIFT) & \
1444 NAN_SEC_NCSSK_DESC_KEY_ENC_KEY_MASK);} while (0)
1445 #define NAN_SEC_NCSSK_DESC_KEY_SMK_MSG_GET(_key_info) \
1446 (((_key_info) & NAN_SEC_NCSSK_DESC_KEY_SMK_MSG_MASK) >> \
1447 NAN_SEC_NCSSK_DESC_KEY_SMK_MSG_SHIFT)
1448 #define NAN_SEC_NCSSK_DESC_KEY_SMK_MSG_SET(_val, _key_info) \
1449 do {(_key_info) &= ~NAN_SEC_NCSSK_DESC_KEY_SMK_MSG_MASK; \
1450 (_key_info) |= (((_val) << NAN_SEC_NCSSK_DESC_KEY_SMK_MSG_SHIFT) & \
1451 NAN_SEC_NCSSK_DESC_KEY_SMK_MSG_MASK);} while (0)
1452
1453 #define NAN_SEC_NCSSK_IEEE80211_KDESC_TYPE 2 /* IEEE 802.11 Key Descriptor Type */
1454 #define NAN_SEC_NCSSK_KEY_DESC_VER 0 /* NCSSK-128/256 */
1455 #define NAN_SEC_NCSSK_KEY_TYPE_PAIRWISE 1 /* Pairwise */
1456 #define NAN_SEC_NCSSK_LIFETIME_KDE 7 /* Lifetime KDE type */
1457
1458 /* TODO include MTK related attributes */
1459
1460 /* NAN Multicast service group(NMSG) definitions */
1461 /* Length of NMSG_ID -- (NDI * 2^16 + pub_id * 2^8 + Random_factor) */
1462 #define NAN_NMSG_ID_LEN 8
1463
1464 #define NAN_NMSG_TYPE_MASK 0x0F
1465 #define NMSG_ATTR_TYPE_STATUS_REQUEST 0x00
1466 #define NMSG_ATTR_TYPE_STATUS_RESPONSE 0x01
1467 #define NMSG_ATTR_TYPE_STATUS_CONFIRM 0x02
1468 #define NMSG_ATTR_TYPE_STATUS_SEC_INSTALL 0x03
1469 #define NMSG_ATTR_TYPE_STATUS_TERMINATE 0x04
1470 #define NMSG_ATTR_TYPE_STATUS_IMPLICIT_ENROL 0x05
1471
1472 #define NMSG_ATTR_TYPE_STATUS_CONTINUED 0x00
1473 #define NMSG_ATTR_TYPE_STATUS_ACCEPTED 0x10
1474 #define NMSG_ATTR_TYPE_STATUS_REJECTED 0x20
1475
1476 #define NMSG_CTRL_PUB_ID_PRESENT 0x0001
1477 #define NMSG_CTRL_NMSG_ID_PRESENT 0x0002
1478 #define NMSG_CTRL_SECURITY_PRESENT 0x0004
1479 #define NMSG_CTRL_MANY_TO_MANY_PRESENT 0x0008
1480 #define NMSG_CTRL_SVC_INFO_PRESENT 0x0010
1481
1482 /* NMSG attribute */
1483 typedef BWL_PRE_PACKED_STRUCT struct wifi_nan_nmsg_attr_s {
1484 uint8 id; /* Attribute ID - 0x11 */
1485 uint16 len; /* Length including pubid, NMSGID and svc info */
1486 uint8 dialog_token;
1487 uint8 type_status; /* Type and Status field byte */
1488 uint8 reason_code;
1489 uint8 mc_id; /* Multicast id similar to NDPID */
1490 uint8 nmsg_ctrl; /* NMSG control field */
1491 /* Optional publish id, NMSGID and svc info are included in var[] */
1492 uint8 var[0];
1493 } BWL_POST_PACKED_STRUCT wifi_nan_nmsg_attr_t;
1494
1495 #define NMSG_ATTR_MCAST_SCHED_MAP_ID_MASK 0x1E
1496 #define NMSG_ATTR_MCAST_SCHED_MAP_ID_SHIFT 1
1497 #define NMSG_ATTR_MCAST_SCHED_TIME_MAP_MASK 0x20
1498 #define NMSG_ATTR_MCAST_SCHED_TIME_MAP_SHIFT 5
1499
1500 /* NAN Multicast Schedule atribute structure */
1501 typedef BWL_PRE_PACKED_STRUCT struct wifi_nan_mcast_sched_attr_s {
1502 uint8 id; /* 0x16 */
1503 uint16 len;
1504 uint8 nmsg_id[NAN_NMSG_ID_LEN];
1505 uint8 attr_cntrl;
1506 uint8 sched_own[ETHER_ADDR_LEN];
1507 uint8 var[]; /* multicast sched entry list (schedule_entry_list) */
1508 } BWL_POST_PACKED_STRUCT wifi_nan_mcast_sched_attr_t;
1509
1510 /* FAC Channel Entry (section 10.7.19.1.5) */
1511 typedef BWL_PRE_PACKED_STRUCT struct wifi_nan_fac_chan_entry_s {
1512 uint8 oper_class; /* Operating Class */
1513 uint16 chan_bitmap; /* Channel Bitmap */
1514 uint8 primary_chan_bmp; /* Primary Channel Bitmap */
1515 uint16 aux_chan; /* Auxiliary Channel bitmap */
1516 } BWL_POST_PACKED_STRUCT wifi_nan_fac_chan_entry_t;
1517
1518 /* TODO move this from nan.h */
1519 #define NAN_ALL_NAN_MGMT_FRAMES (NAN_FRM_SCHED_AF | \
1520 NAN_FRM_NDP_AF | NAN_FRM_NDL_AF | \
1521 NAN_FRM_DISC_BCN | NAN_FRM_SYNC_BCN | \
1522 NAN_FRM_SVC_DISC | NAN_FRM_RNG_REQ_AF | \
1523 NAN_FRM_RNG_RESP_AF | NAN_FRM_RNG_REPORT_AF | \
1524 NAN_FRM_RNG_TERM_AF)
1525
1526 /* This marks the end of a packed structure section. */
1527 #include <packed_section_end.h>
1528
1529 #endif /* _NAN_H_ */