Debian Codegraph @

drivers/net/wireless/intel/iwlwifi/mei/sap.h

raw
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3 * Copyright (C) 2021 - 2022, 2025 Intel Corporation
4 */
5
6 #ifndef __sap_h__
7 #define __sap_h__
8
9 #include "mei/iwl-mei.h"
10
11 /**
12 * DOC: Introduction
13 *
14 * SAP is the protocol used by the Intel Wireless driver (iwlwifi)
15 * and the wireless driver implemented in the CSME firmware.
16 * It allows to do several things:
17 * 1) Decide who is the owner of the device: CSME or the host
18 * 2) When the host is the owner of the device, CSME can still
19 * send and receive packets through iwlwifi.
20 *
21 * The protocol uses the ME interface (mei driver) to send
22 * messages to the CSME firmware. Those messages have a header
23 * &struct iwl_sap_me_msg_hdr and this header is followed
24 * by a payload.
25 *
26 * Since this messaging system cannot support high amounts of
27 * traffic, iwlwifi and the CSME firmware's WLAN driver have an
28 * additional communication pipe to exchange information. The body
29 * of the message is copied to a shared area and the message that
30 * goes over the ME interface just signals the other side
31 * that a new message is waiting in the shared area. The ME
32 * interface is used only for signaling and not to transfer
33 * the payload.
34 *
35 * This shared area of memory is DMA'able mapped to be
36 * writable by both the CSME firmware and iwlwifi. It is
37 * mapped to address space of the device that controls the ME
38 * interface's DMA engine. Any data that iwlwifi needs to
39 * send to the CSME firmware needs to be copied to there.
40 */
41
42 /**
43 * DOC: Initial Handshake
44 *
45 * Once we get a link to the CMSE's WLAN driver we start the handshake
46 * to establish the shared memory that will allow the communication between
47 * the CSME's WLAN driver and the host.
48 *
49 * 1) Host sends %SAP_ME_MSG_START message with the physical address
50 * of the shared area.
51 * 2) CSME replies with %SAP_ME_MSG_START_OK which includes the versions
52 * protocol versions supported by CSME.
53 */
54
55 /**
56 * DOC: Host and driver state messages
57 *
58 * In order to let CSME know about the host state and the host driver state,
59 * the host sends messages that let CSME know about the host's state.
60 * When the host driver is loaded, the host sends %SAP_MSG_NOTIF_WIFIDR_UP.
61 * When the host driver is unloaded, the host sends %SAP_MSG_NOTIF_WIFIDR_DOWN.
62 * When the iwlmei is unloaded, %SAP_MSG_NOTIF_HOST_GOES_DOWN is sent to let
63 * CSME know not to access the shared memory anymore since it'll be freed.
64 *
65 * CSME will reply to SAP_MSG_NOTIF_WIFIDR_UP by
66 * %SAP_MSG_NOTIF_AMT_STATE to let the host driver whether CSME can use the
67 * WiFi device or not followed by %SAP_MSG_NOTIF_CSME_CONN_STATUS to inform
68 * the host driver on the connection state of CSME.
69 *
70 * When host is associated to an AP, it must send %SAP_MSG_NOTIF_HOST_LINK_UP
71 * and when it disconnect from the AP, it must send
72 * %SAP_MSG_NOTIF_HOST_LINK_DOWN.
73 */
74
75 /**
76 * DOC: Ownership
77 *
78 * The device can be controlled either by the CSME firmware or
79 * by the host driver: iwlwifi. There is a negotiation between
80 * those two entities to determine who controls (or owns) the
81 * device. Since the CSME can control the device even when the
82 * OS is not working or even missing, the CSME can request the
83 * device if it comes to the conclusion that the OS's host driver
84 * is not operational. This is why the host driver needs to
85 * signal CSME that it is up and running. If the driver is
86 * unloaded, it'll signal CSME that it is going down so that
87 * CSME can take ownership.
88 */
89
90 /**
91 * DOC: Ownership transfer
92 *
93 * When the host driver needs the device, it'll send the
94 * %SAP_MSG_NOTIF_HOST_ASKS_FOR_NIC_OWNERSHIP that will be replied by
95 * %SAP_MSG_NOTIF_CSME_REPLY_TO_HOST_OWNERSHIP_REQ which will let the
96 * host know whether the ownership is granted or no. If the ownership is
97 * granted, the hosts sends %SAP_MSG_NOTIF_HOST_OWNERSHIP_CONFIRMED.
98 *
99 * When CSME requests ownership, it'll send the
100 * %SAP_MSG_NOTIF_CSME_TAKING_OWNERSHIP and give some time to host to stop
101 * accessing the device. The host needs to send
102 * %SAP_MSG_NOTIF_CSME_OWNERSHIP_CONFIRMED to confirm that it won't access
103 * the device anymore. If the host failed to send this message fast enough,
104 * CSME will take ownership on the device anyway.
105 * When CSME is willing to release the ownership, it'll send
106 * %SAP_MSG_NOTIF_CSME_CAN_RELEASE_OWNERSHIP.
107 */
108
109 /**
110 * DOC: Data messages
111 *
112 * Data messages must be sent and receives on a separate queue in the shared
113 * memory. Almost all the data messages use the %SAP_MSG_DATA_PACKET for both
114 * packets sent by CSME to the host to be sent to the AP or for packets
115 * received from the AP and sent by the host to CSME.
116 * CSME sends filters to the host to let the host what inbound packets it must
117 * send to CSME. Those filters are received by the host as a
118 * %SAP_MSG_NOTIF_CSME_FILTERS command.
119 * The only outbound packets that must be sent to CSME are the DHCP packets.
120 * Those packets must use the %SAP_MSG_CB_DATA_PACKET message.
121 */
122
123 /**
124 * enum iwl_sap_me_msg_id - the ID of the ME message
125 * @SAP_ME_MSG_START: See &struct iwl_sap_me_msg_start.
126 * @SAP_ME_MSG_START_OK: See &struct iwl_sap_me_msg_start_ok.
127 * @SAP_ME_MSG_CHECK_SHARED_AREA: This message has no payload.
128 */
129 enum iwl_sap_me_msg_id {
130 SAP_ME_MSG_START = 1,
131 SAP_ME_MSG_START_OK,
132 SAP_ME_MSG_CHECK_SHARED_AREA,
133 };
134
135 /**
136 * struct iwl_sap_me_msg_hdr - the header of the ME message
137 * @type: the type of the message, see &enum iwl_sap_me_msg_id.
138 * @seq_num: a sequence number used for debug only.
139 * @len: the length of the message.
140 */
141 struct iwl_sap_me_msg_hdr {
142 __le32 type;
143 __le32 seq_num;
144 __le32 len;
145 } __packed;
146
147 /**
148 * struct iwl_sap_me_msg_start - used for the %SAP_ME_MSG_START message
149 * @hdr: See &struct iwl_sap_me_msg_hdr.
150 * @shared_mem: physical address of SAP shared memory area.
151 * @init_data_seq_num: seq_num of the first data packet HOST -> CSME.
152 * @init_notif_seq_num: seq_num of the first notification HOST -> CSME.
153 * @supported_versions: The host sends to the CSME a zero-terminated array
154 * of versions its supports.
155 *
156 * This message is sent by the host to CSME and will responded by the
157 * %SAP_ME_MSG_START_OK message.
158 */
159 struct iwl_sap_me_msg_start {
160 struct iwl_sap_me_msg_hdr hdr;
161 __le64 shared_mem;
162 __le16 init_data_seq_num;
163 __le16 init_notif_seq_num;
164 u8 supported_versions[64];
165 } __packed;
166
167 /**
168 * struct iwl_sap_me_msg_start_ok - used for the %SAP_ME_MSG_START_OK
169 * @hdr: See &struct iwl_sap_me_msg_hdr
170 * @init_data_seq_num: Not used.
171 * @init_notif_seq_num: Not used
172 * @supported_version: The version that will be used.
173 * @reserved: For alignment.
174 *
175 * This message is sent by CSME to the host in response to the
176 * %SAP_ME_MSG_START message.
177 */
178 struct iwl_sap_me_msg_start_ok {
179 struct iwl_sap_me_msg_hdr hdr;
180 __le16 init_data_seq_num;
181 __le16 init_notif_seq_num;
182 u8 supported_version;
183 u8 reserved[3];
184 } __packed;
185
186 /**
187 * enum iwl_sap_msg - SAP messages
188 * @SAP_MSG_NOTIF_BOTH_WAYS_MIN: Not used.
189 * @SAP_MSG_NOTIF_PING: No payload. Solicitate a response message (check-alive).
190 * @SAP_MSG_NOTIF_PONG: No payload. The response message.
191 * @SAP_MSG_NOTIF_BOTH_WAYS_MAX: Not used.
192 *
193 * @SAP_MSG_NOTIF_FROM_CSME_MIN: Not used.
194 * @SAP_MSG_NOTIF_CSME_FILTERS: TODO
195 * @SAP_MSG_NOTIF_AMT_STATE: Payload is a DW. Any non-zero value means
196 * that CSME is enabled.
197 * @SAP_MSG_NOTIF_CSME_REPLY_TO_HOST_OWNERSHIP_REQ: Payload is a DW. 0 means
198 * the host will not get ownership. Any other value means the host is
199 * the owner.
200 * @SAP_MSG_NOTIF_CSME_TAKING_OWNERSHIP: No payload.
201 * @SAP_MSG_NOTIF_TRIGGER_IP_REFRESH: No payload.
202 * @SAP_MSG_NOTIF_CSME_CAN_RELEASE_OWNERSHIP: No payload.
203 * @SAP_MSG_NOTIF_NIC_OWNER: Payload is a DW. See &enum iwl_sap_nic_owner.
204 * @SAP_MSG_NOTIF_CSME_CONN_STATUS: See &struct iwl_sap_notif_conn_status.
205 * @SAP_MSG_NOTIF_NVM: See &struct iwl_sap_nvm.
206 * @SAP_MSG_NOTIF_PLDR_ACK: See &struct iwl_sap_pldr_ack_data.
207 * @SAP_MSG_NOTIF_FROM_CSME_MAX: Not used.
208 *
209 * @SAP_MSG_NOTIF_FROM_HOST_MIN: Not used.
210 * @SAP_MSG_NOTIF_BAND_SELECTION: TODO
211 * @SAP_MSG_NOTIF_RADIO_STATE: Payload is a DW.
212 * See &enum iwl_sap_radio_state_bitmap.
213 * @SAP_MSG_NOTIF_NIC_INFO: See &struct iwl_sap_notif_host_nic_info.
214 * @SAP_MSG_NOTIF_HOST_ASKS_FOR_NIC_OWNERSHIP: No payload.
215 * @SAP_MSG_NOTIF_HOST_SUSPENDS: Payload is a DW. Bitmap described in
216 * &enum iwl_sap_notif_host_suspends_bitmap.
217 * @SAP_MSG_NOTIF_HOST_RESUMES: Payload is a DW. 0 or 1. 1 says that
218 * the CSME should re-initialize the init control block.
219 * @SAP_MSG_NOTIF_HOST_GOES_DOWN: No payload.
220 * @SAP_MSG_NOTIF_CSME_OWNERSHIP_CONFIRMED: No payload.
221 * @SAP_MSG_NOTIF_COUNTRY_CODE: See &struct iwl_sap_notif_country_code.
222 * @SAP_MSG_NOTIF_HOST_LINK_UP: See &struct iwl_sap_notif_host_link_up.
223 * @SAP_MSG_NOTIF_HOST_LINK_DOWN: See &struct iwl_sap_notif_host_link_down.
224 * @SAP_MSG_NOTIF_WHO_OWNS_NIC: No payload.
225 * @SAP_MSG_NOTIF_WIFIDR_DOWN: No payload.
226 * @SAP_MSG_NOTIF_WIFIDR_UP: No payload.
227 * @SAP_MSG_NOTIF_HOST_OWNERSHIP_CONFIRMED: No payload.
228 * @SAP_MSG_NOTIF_SAR_LIMITS: See &struct iwl_sap_notif_sar_limits.
229 * @SAP_MSG_NOTIF_GET_NVM: No payload. Triggers %SAP_MSG_NOTIF_NVM.
230 * @SAP_MSG_NOTIF_PLDR: See &struct iwl_sap_pldr_data.
231 * @SAP_MSG_NOTIF_PLDR_END: See &struct iwl_sap_pldr_end_data.
232 * @SAP_MSG_NOTIF_FROM_HOST_MAX: Not used.
233 *
234 * @SAP_MSG_DATA_MIN: Not used.
235 * @SAP_MSG_DATA_PACKET: Packets that passed the filters defined by
236 * %SAP_MSG_NOTIF_CSME_FILTERS. The payload is &struct iwl_sap_hdr with
237 * the payload of the packet immediately afterwards.
238 * @SAP_MSG_CB_DATA_PACKET: Indicates to CSME that we transmitted a specific
239 * packet. Used only for DHCP transmitted packets. See
240 * &struct iwl_sap_cb_data.
241 * @SAP_MSG_DATA_MAX: Not used.
242 */
243 enum iwl_sap_msg {
244 SAP_MSG_NOTIF_BOTH_WAYS_MIN = 0,
245 SAP_MSG_NOTIF_PING = 1,
246 SAP_MSG_NOTIF_PONG = 2,
247 SAP_MSG_NOTIF_BOTH_WAYS_MAX,
248
249 SAP_MSG_NOTIF_FROM_CSME_MIN = 500,
250 SAP_MSG_NOTIF_CSME_FILTERS = SAP_MSG_NOTIF_FROM_CSME_MIN,
251 /* 501 is deprecated */
252 SAP_MSG_NOTIF_AMT_STATE = 502,
253 SAP_MSG_NOTIF_CSME_REPLY_TO_HOST_OWNERSHIP_REQ = 503,
254 SAP_MSG_NOTIF_CSME_TAKING_OWNERSHIP = 504,
255 SAP_MSG_NOTIF_TRIGGER_IP_REFRESH = 505,
256 SAP_MSG_NOTIF_CSME_CAN_RELEASE_OWNERSHIP = 506,
257 /* 507 is deprecated */
258 /* 508 is deprecated */
259 /* 509 is deprecated */
260 /* 510 is deprecated */
261 SAP_MSG_NOTIF_NIC_OWNER = 511,
262 SAP_MSG_NOTIF_CSME_CONN_STATUS = 512,
263 SAP_MSG_NOTIF_NVM = 513,
264 /* 514 - 517 not supported */
265 SAP_MSG_NOTIF_PLDR_ACK = 518,
266 SAP_MSG_NOTIF_FROM_CSME_MAX,
267
268 SAP_MSG_NOTIF_FROM_HOST_MIN = 1000,
269 SAP_MSG_NOTIF_BAND_SELECTION = SAP_MSG_NOTIF_FROM_HOST_MIN,
270 SAP_MSG_NOTIF_RADIO_STATE = 1001,
271 SAP_MSG_NOTIF_NIC_INFO = 1002,
272 SAP_MSG_NOTIF_HOST_ASKS_FOR_NIC_OWNERSHIP = 1003,
273 SAP_MSG_NOTIF_HOST_SUSPENDS = 1004,
274 SAP_MSG_NOTIF_HOST_RESUMES = 1005,
275 SAP_MSG_NOTIF_HOST_GOES_DOWN = 1006,
276 SAP_MSG_NOTIF_CSME_OWNERSHIP_CONFIRMED = 1007,
277 SAP_MSG_NOTIF_COUNTRY_CODE = 1008,
278 SAP_MSG_NOTIF_HOST_LINK_UP = 1009,
279 SAP_MSG_NOTIF_HOST_LINK_DOWN = 1010,
280 SAP_MSG_NOTIF_WHO_OWNS_NIC = 1011,
281 SAP_MSG_NOTIF_WIFIDR_DOWN = 1012,
282 SAP_MSG_NOTIF_WIFIDR_UP = 1013,
283 /* 1014 is deprecated */
284 SAP_MSG_NOTIF_HOST_OWNERSHIP_CONFIRMED = 1015,
285 SAP_MSG_NOTIF_SAR_LIMITS = 1016,
286 SAP_MSG_NOTIF_GET_NVM = 1017,
287 /* 1018 - 1023 not supported */
288 SAP_MSG_NOTIF_PLDR = 1024,
289 SAP_MSG_NOTIF_PLDR_END = 1025,
290 SAP_MSG_NOTIF_FROM_HOST_MAX,
291
292 SAP_MSG_DATA_MIN = 2000,
293 SAP_MSG_DATA_PACKET = SAP_MSG_DATA_MIN,
294 SAP_MSG_CB_DATA_PACKET = 2001,
295 SAP_MSG_DATA_MAX,
296 };
297
298 /**
299 * struct iwl_sap_hdr - prefixes any SAP message
300 * @type: See &enum iwl_sap_msg.
301 * @len: The length of the message (header not included).
302 * @seq_num: For debug.
303 */
304 struct iwl_sap_hdr {
305 __le16 type;
306 __le16 len;
307 __le32 seq_num;
308 };
309
310 /**
311 * struct iwl_sap_msg_dw - suits any DW long SAP message
312 * @hdr: The SAP header
313 * @val: The value of the DW.
314 */
315 struct iwl_sap_msg_dw {
316 struct iwl_sap_hdr hdr;
317 __le32 val;
318 };
319
320 /**
321 * enum iwl_sap_nic_owner - used by %SAP_MSG_NOTIF_NIC_OWNER
322 * @SAP_NIC_OWNER_UNKNOWN: Not used.
323 * @SAP_NIC_OWNER_HOST: The host owns the NIC.
324 * @SAP_NIC_OWNER_ME: CSME owns the NIC.
325 */
326 enum iwl_sap_nic_owner {
327 SAP_NIC_OWNER_UNKNOWN,
328 SAP_NIC_OWNER_HOST,
329 SAP_NIC_OWNER_ME,
330 };
331
332 enum iwl_sap_wifi_auth_type {
333 SAP_WIFI_AUTH_TYPE_OPEN = IWL_MEI_AKM_AUTH_OPEN,
334 SAP_WIFI_AUTH_TYPE_RSNA = IWL_MEI_AKM_AUTH_RSNA,
335 SAP_WIFI_AUTH_TYPE_RSNA_PSK = IWL_MEI_AKM_AUTH_RSNA_PSK,
336 SAP_WIFI_AUTH_TYPE_SAE = IWL_MEI_AKM_AUTH_SAE,
337 SAP_WIFI_AUTH_TYPE_MAX,
338 };
339
340 /**
341 * enum iwl_sap_wifi_cipher_alg - MEI WiFi cipher algorithm IDs
342 * @SAP_WIFI_CIPHER_ALG_NONE: No encryption
343 * @SAP_WIFI_CIPHER_ALG_TKIP: TKIPO
344 * @SAP_WIFI_CIPHER_ALG_CCMP: CCMP
345 * @SAP_WIFI_CIPHER_ALG_GCMP: GCMP-128
346 * @SAP_WIFI_CIPHER_ALG_GCMP_256: GCMP-256
347 */
348 enum iwl_sap_wifi_cipher_alg {
349 SAP_WIFI_CIPHER_ALG_NONE = IWL_MEI_CIPHER_NONE,
350 SAP_WIFI_CIPHER_ALG_TKIP = IWL_MEI_CIPHER_TKIP,
351 SAP_WIFI_CIPHER_ALG_CCMP = IWL_MEI_CIPHER_CCMP,
352 SAP_WIFI_CIPHER_ALG_GCMP = IWL_MEI_CIPHER_GCMP,
353 SAP_WIFI_CIPHER_ALG_GCMP_256 = IWL_MEI_CIPHER_GCMP_256,
354 };
355
356 /**
357 * struct iwl_sap_notif_connection_info - nested in other structures
358 * @ssid_len: The length of the SSID.
359 * @ssid: The SSID.
360 * @auth_mode: The authentication mode. See &enum iwl_sap_wifi_auth_type.
361 * @pairwise_cipher: The cipher used for unicast packets.
362 * See &enum iwl_sap_wifi_cipher_alg.
363 * @channel: The channel on which we are associated.
364 * @band: The band on which we are associated.
365 * @reserved: For alignment.
366 * @bssid: The BSSID.
367 * @reserved1: For alignment.
368 */
369 struct iwl_sap_notif_connection_info {
370 __le32 ssid_len;
371 u8 ssid[32];
372 __le32 auth_mode;
373 __le32 pairwise_cipher;
374 u8 channel;
375 u8 band;
376 __le16 reserved;
377 u8 bssid[6];
378 __le16 reserved1;
379 } __packed;
380
381 /**
382 * enum iwl_sap_scan_request - for the scan_request field
383 * @SCAN_REQUEST_FILTERING: Filtering is requested.
384 * @SCAN_REQUEST_FAST: Fast scan is requested.
385 */
386 enum iwl_sap_scan_request {
387 SCAN_REQUEST_FILTERING = 1 << 0,
388 SCAN_REQUEST_FAST = 1 << 1,
389 };
390
391 /**
392 * struct iwl_sap_notif_conn_status - payload of %SAP_MSG_NOTIF_CSME_CONN_STATUS
393 * @hdr: The SAP header
394 * @link_prot_state: Non-zero if link protection is active.
395 * @scan_request: See &enum iwl_sap_scan_request.
396 * @conn_info: Information about the connection.
397 */
398 struct iwl_sap_notif_conn_status {
399 struct iwl_sap_hdr hdr;
400 __le32 link_prot_state;
401 __le32 scan_request;
402 struct iwl_sap_notif_connection_info conn_info;
403 } __packed;
404
405 /**
406 * enum iwl_sap_radio_state_bitmap - used for %SAP_MSG_NOTIF_RADIO_STATE
407 * @SAP_SW_RFKILL_DEASSERTED: If set, SW RfKill is de-asserted
408 * @SAP_HW_RFKILL_DEASSERTED: If set, HW RfKill is de-asserted
409 *
410 * If both bits are set, then the radio is on.
411 */
412 enum iwl_sap_radio_state_bitmap {
413 SAP_SW_RFKILL_DEASSERTED = 1 << 0,
414 SAP_HW_RFKILL_DEASSERTED = 1 << 1,
415 };
416
417 /**
418 * enum iwl_sap_notif_host_suspends_bitmap - used for %SAP_MSG_NOTIF_HOST_SUSPENDS
419 * @SAP_OFFER_NIC: TBD
420 * @SAP_FILTER_CONFIGURED: TBD
421 * @SAP_NLO_CONFIGURED: TBD
422 * @SAP_HOST_OWNS_NIC: TBD
423 * @SAP_LINK_PROTECTED: TBD
424 */
425 enum iwl_sap_notif_host_suspends_bitmap {
426 SAP_OFFER_NIC = 1 << 0,
427 SAP_FILTER_CONFIGURED = 1 << 1,
428 SAP_NLO_CONFIGURED = 1 << 2,
429 SAP_HOST_OWNS_NIC = 1 << 3,
430 SAP_LINK_PROTECTED = 1 << 4,
431 };
432
433 /**
434 * struct iwl_sap_notif_country_code - payload of %SAP_MSG_NOTIF_COUNTRY_CODE
435 * @hdr: The SAP header
436 * @mcc: The country code.
437 * @source_id: TBD
438 * @reserved: For alignment.
439 * @diff_time: TBD
440 */
441 struct iwl_sap_notif_country_code {
442 struct iwl_sap_hdr hdr;
443 __le16 mcc;
444 u8 source_id;
445 u8 reserved;
446 __le32 diff_time;
447 } __packed;
448
449 /**
450 * struct iwl_sap_notif_host_link_up - payload of %SAP_MSG_NOTIF_HOST_LINK_UP
451 * @hdr: The SAP header
452 * @conn_info: Information about the connection.
453 * @colloc_channel: The collocated channel
454 * @colloc_band: The band of the collocated channel.
455 * @reserved: For alignment.
456 * @colloc_bssid: The collocated BSSID.
457 * @reserved1: For alignment.
458 */
459 struct iwl_sap_notif_host_link_up {
460 struct iwl_sap_hdr hdr;
461 struct iwl_sap_notif_connection_info conn_info;
462 u8 colloc_channel;
463 u8 colloc_band;
464 __le16 reserved;
465 u8 colloc_bssid[6];
466 __le16 reserved1;
467 } __packed;
468
469 /**
470 * enum iwl_sap_notif_link_down_type - used in &struct iwl_sap_notif_host_link_down
471 * @HOST_LINK_DOWN_TYPE_NONE: TBD
472 * @HOST_LINK_DOWN_TYPE_TEMPORARY: TBD
473 * @HOST_LINK_DOWN_TYPE_LONG: TBD
474 */
475 enum iwl_sap_notif_link_down_type {
476 HOST_LINK_DOWN_TYPE_NONE,
477 HOST_LINK_DOWN_TYPE_TEMPORARY,
478 HOST_LINK_DOWN_TYPE_LONG,
479 };
480
481 /**
482 * struct iwl_sap_notif_host_link_down - payload for %SAP_MSG_NOTIF_HOST_LINK_DOWN
483 * @hdr: The SAP header
484 * @type: See &enum iwl_sap_notif_link_down_type.
485 * @reserved: For alignment.
486 * @reason_valid: If 0, ignore the next field.
487 * @reason: The reason of the disconnection.
488 */
489 struct iwl_sap_notif_host_link_down {
490 struct iwl_sap_hdr hdr;
491 u8 type;
492 u8 reserved[2];
493 u8 reason_valid;
494 __le32 reason;
495 } __packed;
496
497 /**
498 * struct iwl_sap_notif_host_nic_info - payload for %SAP_MSG_NOTIF_NIC_INFO
499 * @hdr: The SAP header
500 * @mac_address: The MAC address as configured to the interface.
501 * @nvm_address: The MAC address as configured in the NVM.
502 */
503 struct iwl_sap_notif_host_nic_info {
504 struct iwl_sap_hdr hdr;
505 u8 mac_address[6];
506 u8 nvm_address[6];
507 } __packed;
508
509 /**
510 * struct iwl_sap_notif_dw - payload is a dw
511 * @hdr: The SAP header.
512 * @dw: The payload.
513 */
514 struct iwl_sap_notif_dw {
515 struct iwl_sap_hdr hdr;
516 __le32 dw;
517 } __packed;
518
519 /**
520 * struct iwl_sap_notif_sar_limits - payload for %SAP_MSG_NOTIF_SAR_LIMITS
521 * @hdr: The SAP header
522 * @sar_chain_info_table: Tx power limits.
523 */
524 struct iwl_sap_notif_sar_limits {
525 struct iwl_sap_hdr hdr;
526 __le16 sar_chain_info_table[2][5];
527 } __packed;
528
529 /**
530 * enum iwl_sap_nvm_caps - capabilities for NVM SAP
531 * @SAP_NVM_CAPS_LARI_SUPPORT: Lari is supported
532 * @SAP_NVM_CAPS_11AX_SUPPORT: 11AX is supported
533 */
534 enum iwl_sap_nvm_caps {
535 SAP_NVM_CAPS_LARI_SUPPORT = BIT(0),
536 SAP_NVM_CAPS_11AX_SUPPORT = BIT(1),
537 };
538
539 /**
540 * struct iwl_sap_nvm - payload for %SAP_MSG_NOTIF_NVM
541 * @hdr: The SAP header.
542 * @hw_addr: The MAC address
543 * @n_hw_addrs: The number of MAC addresses
544 * @reserved: For alignment.
545 * @radio_cfg: The radio configuration.
546 * @caps: See &enum iwl_sap_nvm_caps.
547 * @nvm_version: The version of the NVM.
548 * @channels: The data for each channel.
549 */
550 struct iwl_sap_nvm {
551 struct iwl_sap_hdr hdr;
552 u8 hw_addr[6];
553 u8 n_hw_addrs;
554 u8 reserved;
555 __le32 radio_cfg;
556 __le32 caps;
557 __le32 nvm_version;
558 __le32 channels[110];
559 } __packed;
560
561 /**
562 * enum iwl_sap_eth_filter_flags - used in &struct iwl_sap_eth_filter
563 * @SAP_ETH_FILTER_STOP: Do not process further filters.
564 * @SAP_ETH_FILTER_COPY: Copy the packet to the CSME.
565 * @SAP_ETH_FILTER_ENABLED: If false, the filter should be ignored.
566 */
567 enum iwl_sap_eth_filter_flags {
568 SAP_ETH_FILTER_STOP = BIT(0),
569 SAP_ETH_FILTER_COPY = BIT(1),
570 SAP_ETH_FILTER_ENABLED = BIT(2),
571 };
572
573 /**
574 * struct iwl_sap_eth_filter - a L2 filter
575 * @mac_address: Address to filter.
576 * @flags: See &enum iwl_sap_eth_filter_flags.
577 */
578 struct iwl_sap_eth_filter {
579 u8 mac_address[6];
580 u8 flags;
581 } __packed;
582
583 /**
584 * enum iwl_sap_flex_filter_flags - used in &struct iwl_sap_flex_filter
585 * @SAP_FLEX_FILTER_COPY: Pass UDP / TCP packets to CSME.
586 * @SAP_FLEX_FILTER_ENABLED: If false, the filter should be ignored.
587 * @SAP_FLEX_FILTER_IPV4: Filter requires match on the IP address as well.
588 * @SAP_FLEX_FILTER_IPV6: Filter requires match on the IP address as well.
589 * @SAP_FLEX_FILTER_TCP: Filter should be applied on TCP packets.
590 * @SAP_FLEX_FILTER_UDP: Filter should be applied on UDP packets.
591 */
592 enum iwl_sap_flex_filter_flags {
593 SAP_FLEX_FILTER_COPY = BIT(0),
594 SAP_FLEX_FILTER_ENABLED = BIT(1),
595 SAP_FLEX_FILTER_IPV6 = BIT(2),
596 SAP_FLEX_FILTER_IPV4 = BIT(3),
597 SAP_FLEX_FILTER_TCP = BIT(4),
598 SAP_FLEX_FILTER_UDP = BIT(5),
599 };
600
601 /**
602 * struct iwl_sap_flex_filter - filter configuration
603 * @src_port: Source port in network format.
604 * @dst_port: Destination port in network format.
605 * @flags: Flags and protocol, see &enum iwl_sap_flex_filter_flags.
606 * @reserved: For alignment.
607 */
608 struct iwl_sap_flex_filter {
609 __be16 src_port;
610 __be16 dst_port;
611 u8 flags;
612 u8 reserved;
613 } __packed;
614
615 /**
616 * enum iwl_sap_ipv4_filter_flags - used in &struct iwl_sap_ipv4_filter
617 * @SAP_IPV4_FILTER_ICMP_PASS: Pass ICMP packets to CSME.
618 * @SAP_IPV4_FILTER_ICMP_COPY: Pass ICMP packets to host.
619 * @SAP_IPV4_FILTER_ARP_REQ_PASS: Pass ARP requests to CSME.
620 * @SAP_IPV4_FILTER_ARP_REQ_COPY: Pass ARP requests to host.
621 * @SAP_IPV4_FILTER_ARP_RESP_PASS: Pass ARP responses to CSME.
622 * @SAP_IPV4_FILTER_ARP_RESP_COPY: Pass ARP responses to host.
623 */
624 enum iwl_sap_ipv4_filter_flags {
625 SAP_IPV4_FILTER_ICMP_PASS = BIT(0),
626 SAP_IPV4_FILTER_ICMP_COPY = BIT(1),
627 SAP_IPV4_FILTER_ARP_REQ_PASS = BIT(2),
628 SAP_IPV4_FILTER_ARP_REQ_COPY = BIT(3),
629 SAP_IPV4_FILTER_ARP_RESP_PASS = BIT(4),
630 SAP_IPV4_FILTER_ARP_RESP_COPY = BIT(5),
631 };
632
633 /**
634 * struct iwl_sap_ipv4_filter - IPv4 filter configuration
635 * @ipv4_addr: The IP address to filer.
636 * @flags: See &enum iwl_sap_ipv4_filter_flags.
637 */
638 struct iwl_sap_ipv4_filter {
639 __be32 ipv4_addr;
640 __le32 flags;
641 } __packed;
642
643 /**
644 * enum iwl_sap_ipv6_filter_flags - IPv6 filter flags
645 * @SAP_IPV6_ADDR_FILTER_COPY: Pass packets to the host.
646 * @SAP_IPV6_ADDR_FILTER_ENABLED: If false, the filter should be ignored.
647 */
648 enum iwl_sap_ipv6_filter_flags {
649 SAP_IPV6_ADDR_FILTER_COPY = BIT(0),
650 SAP_IPV6_ADDR_FILTER_ENABLED = BIT(1),
651 };
652
653 /**
654 * struct iwl_sap_ipv6_filter - IPv6 filter configuration
655 * @addr_lo24: Lowest 24 bits of the IPv6 address.
656 * @flags: See &enum iwl_sap_ipv6_filter_flags.
657 */
658 struct iwl_sap_ipv6_filter {
659 u8 addr_lo24[3];
660 u8 flags;
661 } __packed;
662
663 /**
664 * enum iwl_sap_icmpv6_filter_flags - ICMPv6 filter flags
665 * @SAP_ICMPV6_FILTER_ENABLED: If false, the filter should be ignored.
666 * @SAP_ICMPV6_FILTER_COPY: Pass packets to the host.
667 */
668 enum iwl_sap_icmpv6_filter_flags {
669 SAP_ICMPV6_FILTER_ENABLED = BIT(0),
670 SAP_ICMPV6_FILTER_COPY = BIT(1),
671 };
672
673 /**
674 * enum iwl_sap_vlan_filter_flags - VLAN filter flags
675 * @SAP_VLAN_FILTER_VLAN_ID_MSK: VLAN ID
676 * @SAP_VLAN_FILTER_ENABLED: If false, the filter should be ignored.
677 */
678 enum iwl_sap_vlan_filter_flags {
679 SAP_VLAN_FILTER_VLAN_ID_MSK = 0x0FFF,
680 SAP_VLAN_FILTER_ENABLED = BIT(15),
681 };
682
683 /**
684 * struct iwl_sap_oob_filters - Out of band filters (for RX only)
685 * @flex_filters: Array of &struct iwl_sap_flex_filter.
686 * @icmpv6_flags: See &enum iwl_sap_icmpv6_filter_flags.
687 * @ipv6_filters: Array of &struct iwl_sap_ipv6_filter.
688 * @eth_filters: Array of &struct iwl_sap_eth_filter.
689 * @reserved: For alignment.
690 * @ipv4_filter: &struct iwl_sap_ipv4_filter.
691 * @vlan: See &enum iwl_sap_vlan_filter_flags.
692 */
693 struct iwl_sap_oob_filters {
694 struct iwl_sap_flex_filter flex_filters[14];
695 __le32 icmpv6_flags;
696 struct iwl_sap_ipv6_filter ipv6_filters[4];
697 struct iwl_sap_eth_filter eth_filters[5];
698 u8 reserved;
699 struct iwl_sap_ipv4_filter ipv4_filter;
700 __le16 vlan[4];
701 } __packed;
702
703 /**
704 * struct iwl_sap_csme_filters - payload of %SAP_MSG_NOTIF_CSME_FILTERS
705 * @hdr: The SAP header.
706 * @mode: Not used.
707 * @mac_address: Not used.
708 * @reserved: For alignment.
709 * @cbfilters: Not used.
710 * @filters: Out of band filters.
711 */
712 struct iwl_sap_csme_filters {
713 struct iwl_sap_hdr hdr;
714 __le32 mode;
715 u8 mac_address[6];
716 __le16 reserved;
717 u8 cbfilters[1728];
718 struct iwl_sap_oob_filters filters;
719 } __packed;
720
721 #define CB_TX_DHCP_FILT_IDX 30
722 /**
723 * struct iwl_sap_cb_data - header to be added for transmitted packets.
724 * @hdr: The SAP header.
725 * @reserved: Not used.
726 * @to_me_filt_status: The filter that matches. Bit %CB_TX_DHCP_FILT_IDX should
727 * be set for DHCP (the only packet that uses this header).
728 * @reserved2: Not used.
729 * @data_len: The length of the payload.
730 * @payload: The payload of the transmitted packet.
731 */
732 struct iwl_sap_cb_data {
733 struct iwl_sap_hdr hdr;
734 __le32 reserved[7];
735 __le32 to_me_filt_status;
736 __le32 reserved2;
737 __le32 data_len;
738 u8 payload[];
739 };
740
741 /**
742 * struct iwl_sap_pldr_data - payload of %SAP_MSG_NOTIF_PLDR
743 * @hdr: The SAP header.
744 * @version: SAP message version
745 */
746 struct iwl_sap_pldr_data {
747 struct iwl_sap_hdr hdr;
748 __le32 version;
749 } __packed;
750
751 /**
752 * enum iwl_sap_pldr_status - product reset status
753 * @SAP_PLDR_STATUS_SUCCESS: PLDR started/ended successfully
754 * @SAP_PLDR_STATUS_FAILURE: PLDR failed to start/end
755 */
756 enum iwl_sap_pldr_status {
757 SAP_PLDR_STATUS_SUCCESS = 0,
758 SAP_PLDR_STATUS_FAILURE = 1,
759 };
760
761 /*
762 * struct iwl_sap_pldr_end_data - payload of %SAP_MSG_NOTIF_PLDR_END
763 * @hdr: The SAP header.
764 * @version: SAP message version
765 * @status: PLDR end status
766 */
767 struct iwl_sap_pldr_end_data {
768 struct iwl_sap_hdr hdr;
769 __le32 version;
770 __le32 status;
771 } __packed;
772
773 /*
774 * struct iwl_sap_pldr_ack_data - payload of %SAP_MSG_NOTIF_PLDR_ACK
775 * @version: SAP message version
776 * @status: CSME accept/refuse to the PLDR request
777 */
778 struct iwl_sap_pldr_ack_data {
779 struct iwl_sap_hdr hdr;
780 __le32 version;
781 __le32 status;
782 } __packed;
783
784 #endif /* __sap_h__ */