1 /* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
2 /*
3  * Copyright (C) 2012-2014, 2018-2019, 2021 Intel Corporation
4  * Copyright (C) 2013-2015 Intel Mobile Communications GmbH
5  * Copyright (C) 2016-2017 Intel Deutschland GmbH
6  */
7 #ifndef __iwl_fw_api_mac_cfg_h__
8 #define __iwl_fw_api_mac_cfg_h__
9 
10 /**
11  * enum iwl_mac_conf_subcmd_ids - mac configuration command IDs
12  */
13 enum iwl_mac_conf_subcmd_ids {
14 	/**
15 	 * @LOW_LATENCY_CMD: &struct iwl_mac_low_latency_cmd
16 	 */
17 	LOW_LATENCY_CMD = 0x3,
18 	/**
19 	 * @CHANNEL_SWITCH_TIME_EVENT_CMD: &struct iwl_chan_switch_te_cmd
20 	 */
21 	CHANNEL_SWITCH_TIME_EVENT_CMD = 0x4,
22 	/**
23 	 * @MISSED_VAP_NOTIF: &struct iwl_missed_vap_notif
24 	 */
25 	MISSED_VAP_NOTIF = 0xFA,
26 	/**
27 	 * @SESSION_PROTECTION_CMD: &struct iwl_mvm_session_prot_cmd
28 	 */
29 	SESSION_PROTECTION_CMD = 0x5,
30 	/**
31 	 * @CANCEL_CHANNEL_SWITCH_CMD: &struct iwl_cancel_channel_switch_cmd
32 	 */
33 	CANCEL_CHANNEL_SWITCH_CMD = 0x6,
34 
35 	/**
36 	 * @SESSION_PROTECTION_NOTIF: &struct iwl_mvm_session_prot_notif
37 	 */
38 	SESSION_PROTECTION_NOTIF = 0xFB,
39 
40 	/**
41 	 * @PROBE_RESPONSE_DATA_NOTIF: &struct iwl_probe_resp_data_notif
42 	 */
43 	PROBE_RESPONSE_DATA_NOTIF = 0xFC,
44 
45 	/**
46 	 * @CHANNEL_SWITCH_START_NOTIF: &struct iwl_channel_switch_start_notif
47 	 */
48 	CHANNEL_SWITCH_START_NOTIF = 0xFF,
49 
50 	/**
51 	 *@CHANNEL_SWITCH_ERROR_NOTIF: &struct iwl_channel_switch_error_notif
52 	 */
53 	CHANNEL_SWITCH_ERROR_NOTIF = 0xF9,
54 };
55 
56 #define IWL_P2P_NOA_DESC_COUNT	(2)
57 
58 /**
59  * struct iwl_p2p_noa_attr - NOA attr contained in probe resp FW notification
60  *
61  * @id: attribute id
62  * @len_low: length low half
63  * @len_high: length high half
64  * @idx: instance of NoA timing
65  * @ctwin: GO's ct window and pwer save capability
66  * @desc: NoA descriptor
67  * @reserved: reserved for alignment purposes
68  */
69 struct iwl_p2p_noa_attr {
70 	u8 id;
71 	u8 len_low;
72 	u8 len_high;
73 	u8 idx;
74 	u8 ctwin;
75 	struct ieee80211_p2p_noa_desc desc[IWL_P2P_NOA_DESC_COUNT];
76 	u8 reserved;
77 } __packed;
78 
79 #define IWL_PROBE_RESP_DATA_NO_CSA (0xff)
80 
81 /**
82  * struct iwl_probe_resp_data_notif - notification with NOA and CSA counter
83  *
84  * @mac_id: the mac which should send the probe response
85  * @noa_active: notifies if the noa attribute should be handled
86  * @noa_attr: P2P NOA attribute
87  * @csa_counter: current csa counter
88  * @reserved: reserved for alignment purposes
89  */
90 struct iwl_probe_resp_data_notif {
91 	__le32 mac_id;
92 	__le32 noa_active;
93 	struct iwl_p2p_noa_attr noa_attr;
94 	u8 csa_counter;
95 	u8 reserved[3];
96 } __packed; /* PROBE_RESPONSE_DATA_NTFY_API_S_VER_1 */
97 
98 /**
99  * struct iwl_missed_vap_notif - notification of missing vap detection
100  *
101  * @mac_id: the mac for which the ucode sends the notification for
102  * @num_beacon_intervals_elapsed: beacons elpased with no vap profile inside
103  * @profile_periodicity: beacons period to have our profile inside
104  * @reserved: reserved for alignment purposes
105  */
106 struct iwl_missed_vap_notif {
107 	__le32 mac_id;
108 	u8 num_beacon_intervals_elapsed;
109 	u8 profile_periodicity;
110 	u8 reserved[2];
111 } __packed; /* MISSED_VAP_NTFY_API_S_VER_1 */
112 
113 /**
114  * struct iwl_channel_switch_start_notif - Channel switch start notification
115  *
116  * @id_and_color: ID and color of the MAC
117  */
118 struct iwl_channel_switch_start_notif {
119 	__le32 id_and_color;
120 } __packed; /* CHANNEL_SWITCH_START_NTFY_API_S_VER_1 */
121 
122 #define CS_ERR_COUNT_ERROR BIT(0)
123 #define CS_ERR_LONG_DELAY_AFTER_CS BIT(1)
124 #define CS_ERR_LONG_TX_BLOCK BIT(2)
125 #define CS_ERR_TX_BLOCK_TIMER_EXPIRED BIT(3)
126 
127 /**
128  * struct iwl_channel_switch_error_notif - Channel switch error notification
129  *
130  * @mac_id: the mac for which the ucode sends the notification for
131  * @csa_err_mask: mask of channel switch error that can occur
132  */
133 struct iwl_channel_switch_error_notif {
134 	__le32 mac_id;
135 	__le32 csa_err_mask;
136 } __packed; /* CHANNEL_SWITCH_ERROR_NTFY_API_S_VER_1 */
137 
138 /**
139  * struct iwl_cancel_channel_switch_cmd - Cancel Channel Switch command
140  *
141  * @mac_id: the mac that should cancel the channel switch
142  */
143 struct iwl_cancel_channel_switch_cmd {
144 	__le32 mac_id;
145 } __packed; /* MAC_CANCEL_CHANNEL_SWITCH_S_VER_1 */
146 
147 /**
148  * struct iwl_chan_switch_te_cmd - Channel Switch Time Event command
149  *
150  * @mac_id: MAC ID for channel switch
151  * @action: action to perform, one of FW_CTXT_ACTION_*
152  * @tsf: beacon tsf
153  * @cs_count: channel switch count from CSA/eCSA IE
154  * @cs_delayed_bcn_count: if set to N (!= 0) GO/AP can delay N beacon intervals
155  *	at the new channel after the channel switch, otherwise (N == 0) expect
156  *	beacon right after the channel switch.
157  * @cs_mode: 1 - quiet, 0 - otherwise
158  * @reserved: reserved for alignment purposes
159  */
160 struct iwl_chan_switch_te_cmd {
161 	__le32 mac_id;
162 	__le32 action;
163 	__le32 tsf;
164 	u8 cs_count;
165 	u8 cs_delayed_bcn_count;
166 	u8 cs_mode;
167 	u8 reserved;
168 } __packed; /* MAC_CHANNEL_SWITCH_TIME_EVENT_S_VER_2 */
169 
170 /**
171  * struct iwl_mac_low_latency_cmd - set/clear mac to 'low-latency mode'
172  *
173  * @mac_id: MAC ID to whom to apply the low-latency configurations
174  * @low_latency_rx: 1/0 to set/clear Rx low latency direction
175  * @low_latency_tx: 1/0 to set/clear Tx low latency direction
176  * @reserved: reserved for alignment purposes
177  */
178 struct iwl_mac_low_latency_cmd {
179 	__le32 mac_id;
180 	u8 low_latency_rx;
181 	u8 low_latency_tx;
182 	__le16 reserved;
183 } __packed; /* MAC_LOW_LATENCY_API_S_VER_1 */
184 
185 #endif /* __iwl_fw_api_mac_cfg_h__ */
186