blob: 9a8a37f7fd196555b77209e2754360f2a945f649 [file] [log] [blame]
Johannes Bergee6dbb22015-09-02 14:53:39 +02001/******************************************************************************
2 *
3 * This file is provided under a dual BSD/GPLv2 license. When using or
4 * redistributing this file, you may do so under either license.
5 *
6 * GPL LICENSE SUMMARY
7 *
8 * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
9 * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
10 * Copyright(c) 2015 Intel Deutschland GmbH
11 *
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of version 2 of the GNU General Public License as
14 * published by the Free Software Foundation.
15 *
16 * This program is distributed in the hope that it will be useful, but
17 * WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 * General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110,
24 * USA
25 *
26 * The full GNU General Public License is included in this distribution
27 * in the file called COPYING.
28 *
29 * Contact Information:
30 * Intel Linux Wireless <ilw@linux.intel.com>
31 * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
32 *
33 * BSD LICENSE
34 *
35 * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
36 * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
37 * Copyright(c) 2015 Intel Deutschland GmbH
38 * All rights reserved.
39 *
40 * Redistribution and use in source and binary forms, with or without
41 * modification, are permitted provided that the following conditions
42 * are met:
43 *
44 * * Redistributions of source code must retain the above copyright
45 * notice, this list of conditions and the following disclaimer.
46 * * Redistributions in binary form must reproduce the above copyright
47 * notice, this list of conditions and the following disclaimer in
48 * the documentation and/or other materials provided with the
49 * distribution.
50 * * Neither the name Intel Corporation nor the names of its
51 * contributors may be used to endorse or promote products derived
52 * from this software without specific prior written permission.
53 *
54 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
55 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
56 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
57 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
58 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
59 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
60 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
61 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
62 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
63 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
64 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
65 *
66 *****************************************************************************/
67
68#ifndef __fw_api_rx_h__
69#define __fw_api_rx_h__
70
Johannes Berg13555e82015-09-02 16:16:49 +020071/* API for pre-9000 hardware */
72
Johannes Bergee6dbb22015-09-02 14:53:39 +020073#define IWL_RX_INFO_PHY_CNT 8
74#define IWL_RX_INFO_ENERGY_ANT_ABC_IDX 1
75#define IWL_RX_INFO_ENERGY_ANT_A_MSK 0x000000ff
76#define IWL_RX_INFO_ENERGY_ANT_B_MSK 0x0000ff00
77#define IWL_RX_INFO_ENERGY_ANT_C_MSK 0x00ff0000
78#define IWL_RX_INFO_ENERGY_ANT_A_POS 0
79#define IWL_RX_INFO_ENERGY_ANT_B_POS 8
80#define IWL_RX_INFO_ENERGY_ANT_C_POS 16
81
82/**
83 * struct iwl_rx_phy_info - phy info
84 * (REPLY_RX_PHY_CMD = 0xc0)
85 * @non_cfg_phy_cnt: non configurable DSP phy data byte count
86 * @cfg_phy_cnt: configurable DSP phy data byte count
87 * @stat_id: configurable DSP phy data set ID
88 * @reserved1:
89 * @system_timestamp: GP2 at on air rise
90 * @timestamp: TSF at on air rise
91 * @beacon_time_stamp: beacon at on-air rise
92 * @phy_flags: general phy flags: band, modulation, ...
93 * @channel: channel number
94 * @non_cfg_phy_buf: for various implementations of non_cfg_phy
95 * @rate_n_flags: RATE_MCS_*
96 * @byte_count: frame's byte-count
97 * @frame_time: frame's time on the air, based on byte count and frame rate
98 * calculation
99 * @mac_active_msk: what MACs were active when the frame was received
100 *
101 * Before each Rx, the device sends this data. It contains PHY information
102 * about the reception of the packet.
103 */
104struct iwl_rx_phy_info {
105 u8 non_cfg_phy_cnt;
106 u8 cfg_phy_cnt;
107 u8 stat_id;
108 u8 reserved1;
109 __le32 system_timestamp;
110 __le64 timestamp;
111 __le32 beacon_time_stamp;
112 __le16 phy_flags;
113 __le16 channel;
114 __le32 non_cfg_phy[IWL_RX_INFO_PHY_CNT];
115 __le32 rate_n_flags;
116 __le32 byte_count;
117 __le16 mac_active_msk;
118 __le16 frame_time;
119} __packed;
120
121/*
122 * TCP offload Rx assist info
123 *
124 * bits 0:3 - reserved
125 * bits 4:7 - MIC CRC length
126 * bits 8:12 - MAC header length
127 * bit 13 - Padding indication
128 * bit 14 - A-AMSDU indication
129 * bit 15 - Offload enabled
130 */
131enum iwl_csum_rx_assist_info {
132 CSUM_RXA_RESERVED_MASK = 0x000f,
133 CSUM_RXA_MICSIZE_MASK = 0x00f0,
134 CSUM_RXA_HEADERLEN_MASK = 0x1f00,
135 CSUM_RXA_PADD = BIT(13),
136 CSUM_RXA_AMSDU = BIT(14),
137 CSUM_RXA_ENA = BIT(15)
138};
139
140/**
141 * struct iwl_rx_mpdu_res_start - phy info
142 * @assist: see CSUM_RX_ASSIST_ above
143 */
144struct iwl_rx_mpdu_res_start {
145 __le16 byte_count;
146 __le16 assist;
147} __packed; /* _RX_MPDU_RES_START_API_S_VER_2 */
148
149/**
150 * enum iwl_rx_phy_flags - to parse %iwl_rx_phy_info phy_flags
151 * @RX_RES_PHY_FLAGS_BAND_24: true if the packet was received on 2.4 band
152 * @RX_RES_PHY_FLAGS_MOD_CCK:
153 * @RX_RES_PHY_FLAGS_SHORT_PREAMBLE: true if packet's preamble was short
154 * @RX_RES_PHY_FLAGS_NARROW_BAND:
155 * @RX_RES_PHY_FLAGS_ANTENNA: antenna on which the packet was received
156 * @RX_RES_PHY_FLAGS_AGG: set if the packet was part of an A-MPDU
157 * @RX_RES_PHY_FLAGS_OFDM_HT: The frame was an HT frame
158 * @RX_RES_PHY_FLAGS_OFDM_GF: The frame used GF preamble
159 * @RX_RES_PHY_FLAGS_OFDM_VHT: The frame was a VHT frame
160 */
161enum iwl_rx_phy_flags {
162 RX_RES_PHY_FLAGS_BAND_24 = BIT(0),
163 RX_RES_PHY_FLAGS_MOD_CCK = BIT(1),
164 RX_RES_PHY_FLAGS_SHORT_PREAMBLE = BIT(2),
165 RX_RES_PHY_FLAGS_NARROW_BAND = BIT(3),
166 RX_RES_PHY_FLAGS_ANTENNA = (0x7 << 4),
167 RX_RES_PHY_FLAGS_ANTENNA_POS = 4,
168 RX_RES_PHY_FLAGS_AGG = BIT(7),
169 RX_RES_PHY_FLAGS_OFDM_HT = BIT(8),
170 RX_RES_PHY_FLAGS_OFDM_GF = BIT(9),
171 RX_RES_PHY_FLAGS_OFDM_VHT = BIT(10),
172};
173
174/**
175 * enum iwl_mvm_rx_status - written by fw for each Rx packet
176 * @RX_MPDU_RES_STATUS_CRC_OK: CRC is fine
177 * @RX_MPDU_RES_STATUS_OVERRUN_OK: there was no RXE overflow
178 * @RX_MPDU_RES_STATUS_SRC_STA_FOUND:
179 * @RX_MPDU_RES_STATUS_KEY_VALID:
180 * @RX_MPDU_RES_STATUS_KEY_PARAM_OK:
181 * @RX_MPDU_RES_STATUS_ICV_OK: ICV is fine, if not, the packet is destroyed
182 * @RX_MPDU_RES_STATUS_MIC_OK: used for CCM alg only. TKIP MIC is checked
183 * in the driver.
184 * @RX_MPDU_RES_STATUS_TTAK_OK: TTAK is fine
185 * @RX_MPDU_RES_STATUS_MNG_FRAME_REPLAY_ERR: valid for alg = CCM_CMAC or
186 * alg = CCM only. Checks replay attack for 11w frames. Relevant only if
187 * %RX_MPDU_RES_STATUS_ROBUST_MNG_FRAME is set.
188 * @RX_MPDU_RES_STATUS_SEC_NO_ENC: this frame is not encrypted
189 * @RX_MPDU_RES_STATUS_SEC_WEP_ENC: this frame is encrypted using WEP
190 * @RX_MPDU_RES_STATUS_SEC_CCM_ENC: this frame is encrypted using CCM
191 * @RX_MPDU_RES_STATUS_SEC_TKIP_ENC: this frame is encrypted using TKIP
192 * @RX_MPDU_RES_STATUS_SEC_CCM_CMAC_ENC: this frame is encrypted using CCM_CMAC
193 * @RX_MPDU_RES_STATUS_SEC_ENC_ERR: this frame couldn't be decrypted
194 * @RX_MPDU_RES_STATUS_SEC_ENC_MSK: bitmask of the encryption algorithm
195 * @RX_MPDU_RES_STATUS_DEC_DONE: this frame has been successfully decrypted
196 * @RX_MPDU_RES_STATUS_PROTECT_FRAME_BIT_CMP:
197 * @RX_MPDU_RES_STATUS_EXT_IV_BIT_CMP:
198 * @RX_MPDU_RES_STATUS_KEY_ID_CMP_BIT:
199 * @RX_MPDU_RES_STATUS_ROBUST_MNG_FRAME: this frame is an 11w management frame
200 * @RX_MPDU_RES_STATUS_CSUM_DONE: checksum was done by the hw
201 * @RX_MPDU_RES_STATUS_CSUM_OK: checksum found no errors
202 * @RX_MPDU_RES_STATUS_HASH_INDEX_MSK:
203 * @RX_MPDU_RES_STATUS_STA_ID_MSK:
204 * @RX_MPDU_RES_STATUS_RRF_KILL:
205 * @RX_MPDU_RES_STATUS_FILTERING_MSK:
206 * @RX_MPDU_RES_STATUS2_FILTERING_MSK:
207 */
208enum iwl_mvm_rx_status {
209 RX_MPDU_RES_STATUS_CRC_OK = BIT(0),
210 RX_MPDU_RES_STATUS_OVERRUN_OK = BIT(1),
211 RX_MPDU_RES_STATUS_SRC_STA_FOUND = BIT(2),
212 RX_MPDU_RES_STATUS_KEY_VALID = BIT(3),
213 RX_MPDU_RES_STATUS_KEY_PARAM_OK = BIT(4),
214 RX_MPDU_RES_STATUS_ICV_OK = BIT(5),
215 RX_MPDU_RES_STATUS_MIC_OK = BIT(6),
216 RX_MPDU_RES_STATUS_TTAK_OK = BIT(7),
217 RX_MPDU_RES_STATUS_MNG_FRAME_REPLAY_ERR = BIT(7),
218 RX_MPDU_RES_STATUS_SEC_NO_ENC = (0 << 8),
219 RX_MPDU_RES_STATUS_SEC_WEP_ENC = (1 << 8),
220 RX_MPDU_RES_STATUS_SEC_CCM_ENC = (2 << 8),
221 RX_MPDU_RES_STATUS_SEC_TKIP_ENC = (3 << 8),
222 RX_MPDU_RES_STATUS_SEC_EXT_ENC = (4 << 8),
223 RX_MPDU_RES_STATUS_SEC_CCM_CMAC_ENC = (6 << 8),
224 RX_MPDU_RES_STATUS_SEC_ENC_ERR = (7 << 8),
225 RX_MPDU_RES_STATUS_SEC_ENC_MSK = (7 << 8),
226 RX_MPDU_RES_STATUS_DEC_DONE = BIT(11),
227 RX_MPDU_RES_STATUS_PROTECT_FRAME_BIT_CMP = BIT(12),
228 RX_MPDU_RES_STATUS_EXT_IV_BIT_CMP = BIT(13),
229 RX_MPDU_RES_STATUS_KEY_ID_CMP_BIT = BIT(14),
230 RX_MPDU_RES_STATUS_ROBUST_MNG_FRAME = BIT(15),
231 RX_MPDU_RES_STATUS_CSUM_DONE = BIT(16),
232 RX_MPDU_RES_STATUS_CSUM_OK = BIT(17),
233 RX_MPDU_RES_STATUS_HASH_INDEX_MSK = (0x3F0000),
Johannes Berga399f982015-09-24 18:29:00 +0200234 RX_MDPU_RES_STATUS_STA_ID_SHIFT = 24,
235 RX_MPDU_RES_STATUS_STA_ID_MSK = 0x1f << RX_MDPU_RES_STATUS_STA_ID_SHIFT,
Johannes Bergee6dbb22015-09-02 14:53:39 +0200236 RX_MPDU_RES_STATUS_RRF_KILL = BIT(29),
237 RX_MPDU_RES_STATUS_FILTERING_MSK = (0xc00000),
238 RX_MPDU_RES_STATUS2_FILTERING_MSK = (0xc0000000),
239};
240
Johannes Berg13555e82015-09-02 16:16:49 +0200241/* 9000 series API */
242enum iwl_rx_mpdu_mac_flags1 {
243 IWL_RX_MDPU_MFLG1_ADDRTYPE_MASK = 0x03,
244 IWL_RX_MPDU_MFLG1_MIC_CRC_LEN_MASK = 0xf0,
245 /* shift should be 4, but the length is measured in 2-byte
246 * words, so shifting only by 3 gives a byte result
247 */
248 IWL_RX_MPDU_MFLG1_MIC_CRC_LEN_SHIFT = 3,
249};
250
251enum iwl_rx_mpdu_mac_flags2 {
252 /* in 2-byte words */
253 IWL_RX_MPDU_MFLG2_HDR_LEN_MASK = 0x1f,
254 IWL_RX_MPDU_MFLG2_PAD = 0x20,
255 IWL_RX_MPDU_MFLG2_AMSDU = 0x40,
256};
257
258enum iwl_rx_mpdu_amsdu_info {
259 IWL_RX_MPDU_AMSDU_SUBFRAME_IDX_MASK = 0x3f,
260 IWL_RX_MPDU_AMSDU_LAST_SUBFRAME = 0x40,
261 /* 0x80 bit reserved for now */
262};
263
264enum iwl_rx_l3l4_flags {
265 IWL_RX_L3L4_IP_HDR_CSUM_OK = BIT(0),
266 IWL_RX_L3L4_TCP_UDP_CSUM_OK = BIT(1),
267 IWL_RX_L3L4_TCP_FIN_SYN_RST_PSH = BIT(2),
268 IWL_RX_L3L4_TCP_ACK = BIT(3),
269 IWL_RX_L3L4_L3_PROTO_MASK = 0xf << 4,
270 IWL_RX_L3L4_L4_PROTO_MASK = 0xf << 8,
271 IWL_RX_L3L4_RSS_HASH_MASK = 0xf << 12,
272};
273
274enum iwl_rx_mpdu_status {
275 IWL_RX_MPDU_STATUS_CRC_OK = BIT(0),
276 IWL_RX_MPDU_STATUS_OVERRUN_OK = BIT(1),
277 IWL_RX_MPDU_STATUS_SRC_STA_FOUND = BIT(2),
278 IWL_RX_MPDU_STATUS_KEY_VALID = BIT(3),
279 IWL_RX_MPDU_STATUS_KEY_ERROR = BIT(4),
280 IWL_RX_MPDU_STATUS_ICV_OK = BIT(5),
281 IWL_RX_MPDU_STATUS_MIC_OK = BIT(6),
282 IWL_RX_MPDU_STATUS_SEC_MASK = 0x7 << 8,
283 IWL_RX_MPDU_STATUS_SEC_NONE = 0x0 << 8,
284 IWL_RX_MPDU_STATUS_SEC_WEP = 0x1 << 8,
285 IWL_RX_MPDU_STATUS_SEC_CCM = 0x2 << 8,
286 IWL_RX_MPDU_STATUS_SEC_TKIP = 0x3 << 8,
287 IWL_RX_MPDU_STATUS_DECRYPTED = BIT(11),
288 IWL_RX_MPDU_STATUS_WEP_MATCH = BIT(12),
289 IWL_RX_MPDU_STATUS_EXT_IV_MATCH = BIT(13),
290 IWL_RX_MPDU_STATUS_KEY_ID_MATCH = BIT(14),
291 IWL_RX_MPDU_STATUS_KEY_COLOR = BIT(15),
292};
293
294enum iwl_rx_mpdu_hash_filter {
295 IWL_RX_MPDU_HF_A1_HASH_MASK = 0x3f,
296 IWL_RX_MPDU_HF_FILTER_STATUS_MASK = 0xc0,
297};
298
299enum iwl_rx_mpdu_sta_id_flags {
300 IWL_RX_MPDU_SIF_STA_ID_MASK = 0x1f,
301 IWL_RX_MPDU_SIF_RRF_ABORT = 0x20,
302 IWL_RX_MPDU_SIF_FILTER_STATUS_MASK = 0xc0,
303};
304
305enum iwl_rx_mpdu_reorder_data {
306 IWL_RX_MPDU_REORDER_NSSN_MASK = 0x00000fff,
307 IWL_RX_MPDU_REORDER_SN_MASK = 0x00fff000,
308 IWL_RX_MPDU_REORDER_SN_SHIFT = 12,
309 IWL_RX_MPDU_REORDER_BAID_MASK = 0x7f000000,
310 IWL_RX_MPDU_REORDER_BAID_SHIFT = 24,
311 IWL_RX_MPDU_REORDER_BA_OLD_SN = 0x80000000,
312};
313
314struct iwl_rx_mpdu_desc {
315 /* DW2 */
316 __le16 mpdu_len;
317 u8 mac_flags1;
318 u8 mac_flags2;
319 /* DW3 */
320 u8 amsdu_info;
321 __le16 reserved_for_software;
322 u8 mac_phy_idx;
323 /* DW4 */
324 __le16 raw_csum; /* alledgedly unreliable */
325 __le16 l3l4_flags;
326 /* DW5 */
327 __le16 status;
328 u8 hash_filter;
329 u8 sta_id_flags;
330 /* DW6 */
331 __le32 reorder_data;
332 /* DW7 */
333 __le32 rss_hash;
334 /* DW8 */
335 __le32 filter_match;
336 /* DW9 */
337 __le32 gp2_on_air_rise;
338 /* DW10 */
339 __le32 rate_n_flags;
340 /* DW11 */
341 u8 energy_a, energy_b, energy_c, channel;
342 /* DW12 & DW13 */
343 __le64 tsf_on_air_rise;
344} __packed;
345
346struct iwl_frame_release {
347 u8 baid;
348 u8 reserved;
349 __le16 nssn;
350};
351
Johannes Bergee6dbb22015-09-02 14:53:39 +0200352#endif /* __fw_api_rx_h__ */