1 /* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */ 2 /* 3 * Copyright (C) 2012-2014, 2018-2020 Intel Corporation 4 * Copyright (C) 2016-2017 Intel Deutschland GmbH 5 */ 6 #ifndef __iwl_fw_api_tx_h__ 7 #define __iwl_fw_api_tx_h__ 8 #include <linux/ieee80211.h> 9 10 /** 11 * enum iwl_tx_flags - bitmasks for tx_flags in TX command 12 * @TX_CMD_FLG_PROT_REQUIRE: use RTS or CTS-to-self to protect the frame 13 * @TX_CMD_FLG_WRITE_TX_POWER: update current tx power value in the mgmt frame 14 * @TX_CMD_FLG_ACK: expect ACK from receiving station 15 * @TX_CMD_FLG_STA_RATE: use RS table with initial index from the TX command. 16 * Otherwise, use rate_n_flags from the TX command 17 * @TX_CMD_FLG_BAR: this frame is a BA request, immediate BAR is expected 18 * Must set TX_CMD_FLG_ACK with this flag. 19 * @TX_CMD_FLG_TXOP_PROT: TXOP protection requested 20 * @TX_CMD_FLG_VHT_NDPA: mark frame is NDPA for VHT beamformer sequence 21 * @TX_CMD_FLG_HT_NDPA: mark frame is NDPA for HT beamformer sequence 22 * @TX_CMD_FLG_CSI_FDBK2HOST: mark to send feedback to host (only if good CRC) 23 * @TX_CMD_FLG_BT_PRIO_POS: the position of the BT priority (bit 11 is ignored 24 * on old firmwares). 25 * @TX_CMD_FLG_BT_DIS: disable BT priority for this frame 26 * @TX_CMD_FLG_SEQ_CTL: set if FW should override the sequence control. 27 * Should be set for mgmt, non-QOS data, mcast, bcast and in scan command 28 * @TX_CMD_FLG_MORE_FRAG: this frame is non-last MPDU 29 * @TX_CMD_FLG_TSF: FW should calculate and insert TSF in the frame 30 * Should be set for beacons and probe responses 31 * @TX_CMD_FLG_CALIB: activate PA TX power calibrations 32 * @TX_CMD_FLG_KEEP_SEQ_CTL: if seq_ctl is set, don't increase inner seq count 33 * @TX_CMD_FLG_MH_PAD: driver inserted 2 byte padding after MAC header. 34 * Should be set for 26/30 length MAC headers 35 * @TX_CMD_FLG_RESP_TO_DRV: zero this if the response should go only to FW 36 * @TX_CMD_FLG_TKIP_MIC_DONE: FW already performed TKIP MIC calculation 37 * @TX_CMD_FLG_DUR: disable duration overwriting used in PS-Poll Assoc-id 38 * @TX_CMD_FLG_FW_DROP: FW should mark frame to be dropped 39 * @TX_CMD_FLG_EXEC_PAPD: execute PAPD 40 * @TX_CMD_FLG_PAPD_TYPE: 0 for reference power, 1 for nominal power 41 * @TX_CMD_FLG_HCCA_CHUNK: mark start of TSPEC chunk 42 */ 43 enum iwl_tx_flags { 44 TX_CMD_FLG_PROT_REQUIRE = BIT(0), 45 TX_CMD_FLG_WRITE_TX_POWER = BIT(1), 46 TX_CMD_FLG_ACK = BIT(3), 47 TX_CMD_FLG_STA_RATE = BIT(4), 48 TX_CMD_FLG_BAR = BIT(6), 49 TX_CMD_FLG_TXOP_PROT = BIT(7), 50 TX_CMD_FLG_VHT_NDPA = BIT(8), 51 TX_CMD_FLG_HT_NDPA = BIT(9), 52 TX_CMD_FLG_CSI_FDBK2HOST = BIT(10), 53 TX_CMD_FLG_BT_PRIO_POS = 11, 54 TX_CMD_FLG_BT_DIS = BIT(12), 55 TX_CMD_FLG_SEQ_CTL = BIT(13), 56 TX_CMD_FLG_MORE_FRAG = BIT(14), 57 TX_CMD_FLG_TSF = BIT(16), 58 TX_CMD_FLG_CALIB = BIT(17), 59 TX_CMD_FLG_KEEP_SEQ_CTL = BIT(18), 60 TX_CMD_FLG_MH_PAD = BIT(20), 61 TX_CMD_FLG_RESP_TO_DRV = BIT(21), 62 TX_CMD_FLG_TKIP_MIC_DONE = BIT(23), 63 TX_CMD_FLG_DUR = BIT(25), 64 TX_CMD_FLG_FW_DROP = BIT(26), 65 TX_CMD_FLG_EXEC_PAPD = BIT(27), 66 TX_CMD_FLG_PAPD_TYPE = BIT(28), 67 TX_CMD_FLG_HCCA_CHUNK = BIT(31) 68 }; /* TX_FLAGS_BITS_API_S_VER_1 */ 69 70 /** 71 * enum iwl_tx_cmd_flags - bitmasks for tx_flags in TX command for 22000 72 * @IWL_TX_FLAGS_CMD_RATE: use rate from the TX command 73 * @IWL_TX_FLAGS_ENCRYPT_DIS: frame should not be encrypted, even if it belongs 74 * to a secured STA 75 * @IWL_TX_FLAGS_HIGH_PRI: high priority frame (like EAPOL) - can affect rate 76 * selection, retry limits and BT kill 77 */ 78 enum iwl_tx_cmd_flags { 79 IWL_TX_FLAGS_CMD_RATE = BIT(0), 80 IWL_TX_FLAGS_ENCRYPT_DIS = BIT(1), 81 IWL_TX_FLAGS_HIGH_PRI = BIT(2), 82 }; /* TX_FLAGS_BITS_API_S_VER_3 */ 83 84 /** 85 * enum iwl_tx_pm_timeouts - pm timeout values in TX command 86 * @PM_FRAME_NONE: no need to suspend sleep mode 87 * @PM_FRAME_MGMT: fw suspend sleep mode for 100TU 88 * @PM_FRAME_ASSOC: fw suspend sleep mode for 10sec 89 */ 90 enum iwl_tx_pm_timeouts { 91 PM_FRAME_NONE = 0, 92 PM_FRAME_MGMT = 2, 93 PM_FRAME_ASSOC = 3, 94 }; 95 96 #define TX_CMD_SEC_MSK 0x07 97 #define TX_CMD_SEC_WEP_KEY_IDX_POS 6 98 #define TX_CMD_SEC_WEP_KEY_IDX_MSK 0xc0 99 100 /** 101 * enum iwl_tx_cmd_sec_ctrl - bitmasks for security control in TX command 102 * @TX_CMD_SEC_WEP: WEP encryption algorithm. 103 * @TX_CMD_SEC_CCM: CCM encryption algorithm. 104 * @TX_CMD_SEC_TKIP: TKIP encryption algorithm. 105 * @TX_CMD_SEC_EXT: extended cipher algorithm. 106 * @TX_CMD_SEC_GCMP: GCMP encryption algorithm. 107 * @TX_CMD_SEC_KEY128: set for 104 bits WEP key. 108 * @TX_CMD_SEC_KEY_FROM_TABLE: for a non-WEP key, set if the key should be taken 109 * from the table instead of from the TX command. 110 * If the key is taken from the key table its index should be given by the 111 * first byte of the TX command key field. 112 */ 113 enum iwl_tx_cmd_sec_ctrl { 114 TX_CMD_SEC_WEP = 0x01, 115 TX_CMD_SEC_CCM = 0x02, 116 TX_CMD_SEC_TKIP = 0x03, 117 TX_CMD_SEC_EXT = 0x04, 118 TX_CMD_SEC_GCMP = 0x05, 119 TX_CMD_SEC_KEY128 = 0x08, 120 TX_CMD_SEC_KEY_FROM_TABLE = 0x10, 121 }; 122 123 /* 124 * TX command Frame life time in us - to be written in pm_frame_timeout 125 */ 126 #define TX_CMD_LIFE_TIME_INFINITE 0xFFFFFFFF 127 #define TX_CMD_LIFE_TIME_DEFAULT 2000000 /* 2000 ms*/ 128 #define TX_CMD_LIFE_TIME_PROBE_RESP 40000 /* 40 ms */ 129 #define TX_CMD_LIFE_TIME_EXPIRED_FRAME 0 130 131 /* 132 * TID for non QoS frames - to be written in tid_tspec 133 */ 134 #define IWL_TID_NON_QOS 0 135 136 /* 137 * Limits on the retransmissions - to be written in {data,rts}_retry_limit 138 */ 139 #define IWL_DEFAULT_TX_RETRY 15 140 #define IWL_MGMT_DFAULT_RETRY_LIMIT 3 141 #define IWL_RTS_DFAULT_RETRY_LIMIT 60 142 #define IWL_BAR_DFAULT_RETRY_LIMIT 60 143 #define IWL_LOW_RETRY_LIMIT 7 144 145 /** 146 * enum iwl_tx_offload_assist_flags_pos - set %iwl_tx_cmd offload_assist values 147 * @TX_CMD_OFFLD_IP_HDR: offset to start of IP header (in words) 148 * from mac header end. For normal case it is 4 words for SNAP. 149 * note: tx_cmd, mac header and pad are not counted in the offset. 150 * This is used to help the offload in case there is tunneling such as 151 * IPv6 in IPv4, in such case the ip header offset should point to the 152 * inner ip header and IPv4 checksum of the external header should be 153 * calculated by driver. 154 * @TX_CMD_OFFLD_L4_EN: enable TCP/UDP checksum 155 * @TX_CMD_OFFLD_L3_EN: enable IP header checksum 156 * @TX_CMD_OFFLD_MH_SIZE: size of the mac header in words. Includes the IV 157 * field. Doesn't include the pad. 158 * @TX_CMD_OFFLD_PAD: mark 2-byte pad was inserted after the mac header for 159 * alignment 160 * @TX_CMD_OFFLD_AMSDU: mark TX command is A-MSDU 161 */ 162 enum iwl_tx_offload_assist_flags_pos { 163 TX_CMD_OFFLD_IP_HDR = 0, 164 TX_CMD_OFFLD_L4_EN = 6, 165 TX_CMD_OFFLD_L3_EN = 7, 166 TX_CMD_OFFLD_MH_SIZE = 8, 167 TX_CMD_OFFLD_PAD = 13, 168 TX_CMD_OFFLD_AMSDU = 14, 169 }; 170 171 #define IWL_TX_CMD_OFFLD_MH_MASK 0x1f 172 #define IWL_TX_CMD_OFFLD_IP_HDR_MASK 0x3f 173 174 /* TODO: complete documentation for try_cnt and btkill_cnt */ 175 /** 176 * struct iwl_tx_cmd - TX command struct to FW 177 * ( TX_CMD = 0x1c ) 178 * @len: in bytes of the payload, see below for details 179 * @offload_assist: TX offload configuration 180 * @tx_flags: combination of TX_CMD_FLG_* 181 * @scratch: scratch buffer used by the device 182 * @rate_n_flags: rate for *all* Tx attempts, if TX_CMD_FLG_STA_RATE_MSK is 183 * cleared. Combination of RATE_MCS_* 184 * @sta_id: index of destination station in FW station table 185 * @sec_ctl: security control, TX_CMD_SEC_* 186 * @initial_rate_index: index into the the rate table for initial TX attempt. 187 * Applied if TX_CMD_FLG_STA_RATE_MSK is set, normally 0 for data frames. 188 * @reserved2: reserved 189 * @key: security key 190 * @reserved3: reserved 191 * @life_time: frame life time (usecs??) 192 * @dram_lsb_ptr: Physical address of scratch area in the command (try_cnt + 193 * btkill_cnd + reserved), first 32 bits. "0" disables usage. 194 * @dram_msb_ptr: upper bits of the scratch physical address 195 * @rts_retry_limit: max attempts for RTS 196 * @data_retry_limit: max attempts to send the data packet 197 * @tid_tspec: TID/tspec 198 * @pm_frame_timeout: PM TX frame timeout 199 * @reserved4: reserved 200 * @payload: payload (same as @hdr) 201 * @hdr: 802.11 header (same as @payload) 202 * 203 * The byte count (both len and next_frame_len) includes MAC header 204 * (24/26/30/32 bytes) 205 * + 2 bytes pad if 26/30 header size 206 * + 8 byte IV for CCM or TKIP (not used for WEP) 207 * + Data payload 208 * + 8-byte MIC (not used for CCM/WEP) 209 * It does not include post-MAC padding, i.e., 210 * MIC (CCM) 8 bytes, ICV (WEP/TKIP/CKIP) 4 bytes, CRC 4 bytes. 211 * Range of len: 14-2342 bytes. 212 * 213 * After the struct fields the MAC header is placed, plus any padding, 214 * and then the actial payload. 215 */ 216 struct iwl_tx_cmd { 217 __le16 len; 218 __le16 offload_assist; 219 __le32 tx_flags; 220 struct { 221 u8 try_cnt; 222 u8 btkill_cnt; 223 __le16 reserved; 224 } scratch; /* DRAM_SCRATCH_API_U_VER_1 */ 225 __le32 rate_n_flags; 226 u8 sta_id; 227 u8 sec_ctl; 228 u8 initial_rate_index; 229 u8 reserved2; 230 u8 key[16]; 231 __le32 reserved3; 232 __le32 life_time; 233 __le32 dram_lsb_ptr; 234 u8 dram_msb_ptr; 235 u8 rts_retry_limit; 236 u8 data_retry_limit; 237 u8 tid_tspec; 238 __le16 pm_frame_timeout; 239 __le16 reserved4; 240 u8 payload[0]; 241 struct ieee80211_hdr hdr[]; 242 } __packed; /* TX_CMD_API_S_VER_6 */ 243 244 struct iwl_dram_sec_info { 245 __le32 pn_low; 246 __le16 pn_high; 247 __le16 aux_info; 248 } __packed; /* DRAM_SEC_INFO_API_S_VER_1 */ 249 250 /** 251 * struct iwl_tx_cmd_gen2 - TX command struct to FW for 22000 devices 252 * ( TX_CMD = 0x1c ) 253 * @len: in bytes of the payload, see below for details 254 * @offload_assist: TX offload configuration 255 * @flags: combination of &enum iwl_tx_cmd_flags 256 * @dram_info: FW internal DRAM storage 257 * @rate_n_flags: rate for *all* Tx attempts, if TX_CMD_FLG_STA_RATE_MSK is 258 * cleared. Combination of RATE_MCS_* 259 * @hdr: 802.11 header 260 */ 261 struct iwl_tx_cmd_gen2 { 262 __le16 len; 263 __le16 offload_assist; 264 __le32 flags; 265 struct iwl_dram_sec_info dram_info; 266 __le32 rate_n_flags; 267 struct ieee80211_hdr hdr[]; 268 } __packed; /* TX_CMD_API_S_VER_7 */ 269 270 /** 271 * struct iwl_tx_cmd_gen3 - TX command struct to FW for AX210+ devices 272 * ( TX_CMD = 0x1c ) 273 * @len: in bytes of the payload, see below for details 274 * @flags: combination of &enum iwl_tx_cmd_flags 275 * @offload_assist: TX offload configuration 276 * @dram_info: FW internal DRAM storage 277 * @rate_n_flags: rate for *all* Tx attempts, if TX_CMD_FLG_STA_RATE_MSK is 278 * cleared. Combination of RATE_MCS_* 279 * @ttl: time to live - packet lifetime limit. The FW should drop if 280 * passed. 281 * @hdr: 802.11 header 282 */ 283 struct iwl_tx_cmd_gen3 { 284 __le16 len; 285 __le16 flags; 286 __le32 offload_assist; 287 struct iwl_dram_sec_info dram_info; 288 __le32 rate_n_flags; 289 __le64 ttl; 290 struct ieee80211_hdr hdr[]; 291 } __packed; /* TX_CMD_API_S_VER_8 */ 292 293 /* 294 * TX response related data 295 */ 296 297 /* 298 * enum iwl_tx_status - status that is returned by the fw after attempts to Tx 299 * @TX_STATUS_SUCCESS: 300 * @TX_STATUS_DIRECT_DONE: 301 * @TX_STATUS_POSTPONE_DELAY: 302 * @TX_STATUS_POSTPONE_FEW_BYTES: 303 * @TX_STATUS_POSTPONE_BT_PRIO: 304 * @TX_STATUS_POSTPONE_QUIET_PERIOD: 305 * @TX_STATUS_POSTPONE_CALC_TTAK: 306 * @TX_STATUS_FAIL_INTERNAL_CROSSED_RETRY: 307 * @TX_STATUS_FAIL_SHORT_LIMIT: 308 * @TX_STATUS_FAIL_LONG_LIMIT: 309 * @TX_STATUS_FAIL_UNDERRUN: 310 * @TX_STATUS_FAIL_DRAIN_FLOW: 311 * @TX_STATUS_FAIL_RFKILL_FLUSH: 312 * @TX_STATUS_FAIL_LIFE_EXPIRE: 313 * @TX_STATUS_FAIL_DEST_PS: 314 * @TX_STATUS_FAIL_HOST_ABORTED: 315 * @TX_STATUS_FAIL_BT_RETRY: 316 * @TX_STATUS_FAIL_STA_INVALID: 317 * @TX_TATUS_FAIL_FRAG_DROPPED: 318 * @TX_STATUS_FAIL_TID_DISABLE: 319 * @TX_STATUS_FAIL_FIFO_FLUSHED: 320 * @TX_STATUS_FAIL_SMALL_CF_POLL: 321 * @TX_STATUS_FAIL_FW_DROP: 322 * @TX_STATUS_FAIL_STA_COLOR_MISMATCH: mismatch between color of Tx cmd and 323 * STA table 324 * @TX_FRAME_STATUS_INTERNAL_ABORT: 325 * @TX_MODE_MSK: 326 * @TX_MODE_NO_BURST: 327 * @TX_MODE_IN_BURST_SEQ: 328 * @TX_MODE_FIRST_IN_BURST: 329 * @TX_QUEUE_NUM_MSK: 330 * 331 * Valid only if frame_count =1 332 * TODO: complete documentation 333 */ 334 enum iwl_tx_status { 335 TX_STATUS_MSK = 0x000000ff, 336 TX_STATUS_SUCCESS = 0x01, 337 TX_STATUS_DIRECT_DONE = 0x02, 338 /* postpone TX */ 339 TX_STATUS_POSTPONE_DELAY = 0x40, 340 TX_STATUS_POSTPONE_FEW_BYTES = 0x41, 341 TX_STATUS_POSTPONE_BT_PRIO = 0x42, 342 TX_STATUS_POSTPONE_QUIET_PERIOD = 0x43, 343 TX_STATUS_POSTPONE_CALC_TTAK = 0x44, 344 /* abort TX */ 345 TX_STATUS_FAIL_INTERNAL_CROSSED_RETRY = 0x81, 346 TX_STATUS_FAIL_SHORT_LIMIT = 0x82, 347 TX_STATUS_FAIL_LONG_LIMIT = 0x83, 348 TX_STATUS_FAIL_UNDERRUN = 0x84, 349 TX_STATUS_FAIL_DRAIN_FLOW = 0x85, 350 TX_STATUS_FAIL_RFKILL_FLUSH = 0x86, 351 TX_STATUS_FAIL_LIFE_EXPIRE = 0x87, 352 TX_STATUS_FAIL_DEST_PS = 0x88, 353 TX_STATUS_FAIL_HOST_ABORTED = 0x89, 354 TX_STATUS_FAIL_BT_RETRY = 0x8a, 355 TX_STATUS_FAIL_STA_INVALID = 0x8b, 356 TX_STATUS_FAIL_FRAG_DROPPED = 0x8c, 357 TX_STATUS_FAIL_TID_DISABLE = 0x8d, 358 TX_STATUS_FAIL_FIFO_FLUSHED = 0x8e, 359 TX_STATUS_FAIL_SMALL_CF_POLL = 0x8f, 360 TX_STATUS_FAIL_FW_DROP = 0x90, 361 TX_STATUS_FAIL_STA_COLOR_MISMATCH = 0x91, 362 TX_STATUS_INTERNAL_ABORT = 0x92, 363 TX_MODE_MSK = 0x00000f00, 364 TX_MODE_NO_BURST = 0x00000000, 365 TX_MODE_IN_BURST_SEQ = 0x00000100, 366 TX_MODE_FIRST_IN_BURST = 0x00000200, 367 TX_QUEUE_NUM_MSK = 0x0001f000, 368 TX_NARROW_BW_MSK = 0x00060000, 369 TX_NARROW_BW_1DIV2 = 0x00020000, 370 TX_NARROW_BW_1DIV4 = 0x00040000, 371 TX_NARROW_BW_1DIV8 = 0x00060000, 372 }; 373 374 /* 375 * enum iwl_tx_agg_status - TX aggregation status 376 * @AGG_TX_STATE_STATUS_MSK: 377 * @AGG_TX_STATE_TRANSMITTED: 378 * @AGG_TX_STATE_UNDERRUN: 379 * @AGG_TX_STATE_BT_PRIO: 380 * @AGG_TX_STATE_FEW_BYTES: 381 * @AGG_TX_STATE_ABORT: 382 * @AGG_TX_STATE_TX_ON_AIR_DROP: TX_ON_AIR signal drop without underrun or 383 * BT detection 384 * @AGG_TX_STATE_LAST_SENT_TRY_CNT: 385 * @AGG_TX_STATE_LAST_SENT_BT_KILL: 386 * @AGG_TX_STATE_SCD_QUERY: 387 * @AGG_TX_STATE_TEST_BAD_CRC32: 388 * @AGG_TX_STATE_RESPONSE: 389 * @AGG_TX_STATE_DUMP_TX: 390 * @AGG_TX_STATE_DELAY_TX: 391 * @AGG_TX_STATE_TRY_CNT_MSK: Retry count for 1st frame in aggregation (retries 392 * occur if tx failed for this frame when it was a member of a previous 393 * aggregation block). If rate scaling is used, retry count indicates the 394 * rate table entry used for all frames in the new agg. 395 * @AGG_TX_STATE_SEQ_NUM_MSK: Command ID and sequence number of Tx command for 396 * this frame 397 * 398 * TODO: complete documentation 399 */ 400 enum iwl_tx_agg_status { 401 AGG_TX_STATE_STATUS_MSK = 0x00fff, 402 AGG_TX_STATE_TRANSMITTED = 0x000, 403 AGG_TX_STATE_UNDERRUN = 0x001, 404 AGG_TX_STATE_BT_PRIO = 0x002, 405 AGG_TX_STATE_FEW_BYTES = 0x004, 406 AGG_TX_STATE_ABORT = 0x008, 407 AGG_TX_STATE_TX_ON_AIR_DROP = 0x010, 408 AGG_TX_STATE_LAST_SENT_TRY_CNT = 0x020, 409 AGG_TX_STATE_LAST_SENT_BT_KILL = 0x040, 410 AGG_TX_STATE_SCD_QUERY = 0x080, 411 AGG_TX_STATE_TEST_BAD_CRC32 = 0x0100, 412 AGG_TX_STATE_RESPONSE = 0x1ff, 413 AGG_TX_STATE_DUMP_TX = 0x200, 414 AGG_TX_STATE_DELAY_TX = 0x400, 415 AGG_TX_STATE_TRY_CNT_POS = 12, 416 AGG_TX_STATE_TRY_CNT_MSK = 0xf << AGG_TX_STATE_TRY_CNT_POS, 417 }; 418 419 /* 420 * The mask below describes a status where we are absolutely sure that the MPDU 421 * wasn't sent. For BA/Underrun we cannot be that sure. All we know that we've 422 * written the bytes to the TXE, but we know nothing about what the DSP did. 423 */ 424 #define AGG_TX_STAT_FRAME_NOT_SENT (AGG_TX_STATE_FEW_BYTES | \ 425 AGG_TX_STATE_ABORT | \ 426 AGG_TX_STATE_SCD_QUERY) 427 428 /* 429 * REPLY_TX = 0x1c (response) 430 * 431 * This response may be in one of two slightly different formats, indicated 432 * by the frame_count field: 433 * 434 * 1) No aggregation (frame_count == 1). This reports Tx results for a single 435 * frame. Multiple attempts, at various bit rates, may have been made for 436 * this frame. 437 * 438 * 2) Aggregation (frame_count > 1). This reports Tx results for two or more 439 * frames that used block-acknowledge. All frames were transmitted at 440 * same rate. Rate scaling may have been used if first frame in this new 441 * agg block failed in previous agg block(s). 442 * 443 * Note that, for aggregation, ACK (block-ack) status is not delivered 444 * here; block-ack has not been received by the time the device records 445 * this status. 446 * This status relates to reasons the tx might have been blocked or aborted 447 * within the device, rather than whether it was received successfully by 448 * the destination station. 449 */ 450 451 /** 452 * struct agg_tx_status - per packet TX aggregation status 453 * @status: See &enum iwl_tx_agg_status 454 * @sequence: Sequence # for this frame's Tx cmd (not SSN!) 455 */ 456 struct agg_tx_status { 457 __le16 status; 458 __le16 sequence; 459 } __packed; 460 461 /* 462 * definitions for initial rate index field 463 * bits [3:0] initial rate index 464 * bits [6:4] rate table color, used for the initial rate 465 * bit-7 invalid rate indication 466 */ 467 #define TX_RES_INIT_RATE_INDEX_MSK 0x0f 468 #define TX_RES_RATE_TABLE_COLOR_POS 4 469 #define TX_RES_RATE_TABLE_COLOR_MSK 0x70 470 #define TX_RES_INV_RATE_INDEX_MSK 0x80 471 #define TX_RES_RATE_TABLE_COL_GET(_f) (((_f) & TX_RES_RATE_TABLE_COLOR_MSK) >>\ 472 TX_RES_RATE_TABLE_COLOR_POS) 473 474 #define IWL_MVM_TX_RES_GET_TID(_ra_tid) ((_ra_tid) & 0x0f) 475 #define IWL_MVM_TX_RES_GET_RA(_ra_tid) ((_ra_tid) >> 4) 476 477 /** 478 * struct iwl_mvm_tx_resp_v3 - notifies that fw is TXing a packet 479 * ( REPLY_TX = 0x1c ) 480 * @frame_count: 1 no aggregation, >1 aggregation 481 * @bt_kill_count: num of times blocked by bluetooth (unused for agg) 482 * @failure_rts: num of failures due to unsuccessful RTS 483 * @failure_frame: num failures due to no ACK (unused for agg) 484 * @initial_rate: for non-agg: rate of the successful Tx. For agg: rate of the 485 * Tx of all the batch. RATE_MCS_* 486 * @wireless_media_time: for non-agg: RTS + CTS + frame tx attempts time + ACK. 487 * for agg: RTS + CTS + aggregation tx time + block-ack time. 488 * in usec. 489 * @pa_status: tx power info 490 * @pa_integ_res_a: tx power info 491 * @pa_integ_res_b: tx power info 492 * @pa_integ_res_c: tx power info 493 * @measurement_req_id: tx power info 494 * @reduced_tpc: transmit power reduction used 495 * @reserved: reserved 496 * @tfd_info: TFD information set by the FH 497 * @seq_ctl: sequence control from the Tx cmd 498 * @byte_cnt: byte count from the Tx cmd 499 * @tlc_info: TLC rate info 500 * @ra_tid: bits [3:0] = ra, bits [7:4] = tid 501 * @frame_ctrl: frame control 502 * @status: for non-agg: frame status TX_STATUS_* 503 * for agg: status of 1st frame, AGG_TX_STATE_*; other frame status fields 504 * follow this one, up to frame_count. Length in @frame_count. 505 * 506 * After the array of statuses comes the SSN of the SCD. Look at 507 * %iwl_mvm_get_scd_ssn for more details. 508 */ 509 struct iwl_mvm_tx_resp_v3 { 510 u8 frame_count; 511 u8 bt_kill_count; 512 u8 failure_rts; 513 u8 failure_frame; 514 __le32 initial_rate; 515 __le16 wireless_media_time; 516 517 u8 pa_status; 518 u8 pa_integ_res_a[3]; 519 u8 pa_integ_res_b[3]; 520 u8 pa_integ_res_c[3]; 521 __le16 measurement_req_id; 522 u8 reduced_tpc; 523 u8 reserved; 524 525 __le32 tfd_info; 526 __le16 seq_ctl; 527 __le16 byte_cnt; 528 u8 tlc_info; 529 u8 ra_tid; 530 __le16 frame_ctrl; 531 struct agg_tx_status status[]; 532 } __packed; /* TX_RSP_API_S_VER_3 */ 533 534 /** 535 * struct iwl_mvm_tx_resp - notifies that fw is TXing a packet 536 * ( REPLY_TX = 0x1c ) 537 * @frame_count: 1 no aggregation, >1 aggregation 538 * @bt_kill_count: num of times blocked by bluetooth (unused for agg) 539 * @failure_rts: num of failures due to unsuccessful RTS 540 * @failure_frame: num failures due to no ACK (unused for agg) 541 * @initial_rate: for non-agg: rate of the successful Tx. For agg: rate of the 542 * Tx of all the batch. RATE_MCS_* 543 * @wireless_media_time: for non-agg: RTS + CTS + frame tx attempts time + ACK. 544 * for agg: RTS + CTS + aggregation tx time + block-ack time. 545 * in usec. 546 * @pa_status: tx power info 547 * @pa_integ_res_a: tx power info 548 * @pa_integ_res_b: tx power info 549 * @pa_integ_res_c: tx power info 550 * @measurement_req_id: tx power info 551 * @reduced_tpc: transmit power reduction used 552 * @reserved: reserved 553 * @tfd_info: TFD information set by the FH 554 * @seq_ctl: sequence control from the Tx cmd 555 * @byte_cnt: byte count from the Tx cmd 556 * @tlc_info: TLC rate info 557 * @ra_tid: bits [3:0] = ra, bits [7:4] = tid 558 * @frame_ctrl: frame control 559 * @tx_queue: TX queue for this response 560 * @reserved2: reserved for padding/alignment 561 * @status: for non-agg: frame status TX_STATUS_* 562 * For version 6 TX response isn't received for aggregation at all. 563 * 564 * After the array of statuses comes the SSN of the SCD. Look at 565 * %iwl_mvm_get_scd_ssn for more details. 566 */ 567 struct iwl_mvm_tx_resp { 568 u8 frame_count; 569 u8 bt_kill_count; 570 u8 failure_rts; 571 u8 failure_frame; 572 __le32 initial_rate; 573 __le16 wireless_media_time; 574 575 u8 pa_status; 576 u8 pa_integ_res_a[3]; 577 u8 pa_integ_res_b[3]; 578 u8 pa_integ_res_c[3]; 579 __le16 measurement_req_id; 580 u8 reduced_tpc; 581 u8 reserved; 582 583 __le32 tfd_info; 584 __le16 seq_ctl; 585 __le16 byte_cnt; 586 u8 tlc_info; 587 u8 ra_tid; 588 __le16 frame_ctrl; 589 __le16 tx_queue; 590 __le16 reserved2; 591 struct agg_tx_status status; 592 } __packed; /* TX_RSP_API_S_VER_6 */ 593 594 /** 595 * struct iwl_mvm_ba_notif - notifies about reception of BA 596 * ( BA_NOTIF = 0xc5 ) 597 * @sta_addr: MAC address 598 * @reserved: reserved 599 * @sta_id: Index of recipient (BA-sending) station in fw's station table 600 * @tid: tid of the session 601 * @seq_ctl: sequence control field 602 * @bitmap: the bitmap of the BA notification as seen in the air 603 * @scd_flow: the tx queue this BA relates to 604 * @scd_ssn: the index of the last contiguously sent packet 605 * @txed: number of Txed frames in this batch 606 * @txed_2_done: number of Acked frames in this batch 607 * @reduced_txp: power reduced according to TPC. This is the actual value and 608 * not a copy from the LQ command. Thus, if not the first rate was used 609 * for Tx-ing then this value will be set to 0 by FW. 610 * @reserved1: reserved 611 */ 612 struct iwl_mvm_ba_notif { 613 u8 sta_addr[ETH_ALEN]; 614 __le16 reserved; 615 616 u8 sta_id; 617 u8 tid; 618 __le16 seq_ctl; 619 __le64 bitmap; 620 __le16 scd_flow; 621 __le16 scd_ssn; 622 u8 txed; 623 u8 txed_2_done; 624 u8 reduced_txp; 625 u8 reserved1; 626 } __packed; 627 628 /** 629 * struct iwl_mvm_compressed_ba_tfd - progress of a TFD queue 630 * @q_num: TFD queue number 631 * @tfd_index: Index of first un-acked frame in the TFD queue 632 * @scd_queue: For debug only - the physical queue the TFD queue is bound to 633 * @tid: TID of the queue (0-7) 634 * @reserved: reserved for alignment 635 */ 636 struct iwl_mvm_compressed_ba_tfd { 637 __le16 q_num; 638 __le16 tfd_index; 639 u8 scd_queue; 640 u8 tid; 641 u8 reserved[2]; 642 } __packed; /* COMPRESSED_BA_TFD_API_S_VER_1 */ 643 644 /** 645 * struct iwl_mvm_compressed_ba_ratid - progress of a RA TID queue 646 * @q_num: RA TID queue number 647 * @tid: TID of the queue 648 * @ssn: BA window current SSN 649 */ 650 struct iwl_mvm_compressed_ba_ratid { 651 u8 q_num; 652 u8 tid; 653 __le16 ssn; 654 } __packed; /* COMPRESSED_BA_RATID_API_S_VER_1 */ 655 656 /* 657 * enum iwl_mvm_ba_resp_flags - TX aggregation status 658 * @IWL_MVM_BA_RESP_TX_AGG: generated due to BA 659 * @IWL_MVM_BA_RESP_TX_BAR: generated due to BA after BAR 660 * @IWL_MVM_BA_RESP_TX_AGG_FAIL: aggregation didn't receive BA 661 * @IWL_MVM_BA_RESP_TX_UNDERRUN: aggregation got underrun 662 * @IWL_MVM_BA_RESP_TX_BT_KILL: aggregation got BT-kill 663 * @IWL_MVM_BA_RESP_TX_DSP_TIMEOUT: aggregation didn't finish within the 664 * expected time 665 */ 666 enum iwl_mvm_ba_resp_flags { 667 IWL_MVM_BA_RESP_TX_AGG, 668 IWL_MVM_BA_RESP_TX_BAR, 669 IWL_MVM_BA_RESP_TX_AGG_FAIL, 670 IWL_MVM_BA_RESP_TX_UNDERRUN, 671 IWL_MVM_BA_RESP_TX_BT_KILL, 672 IWL_MVM_BA_RESP_TX_DSP_TIMEOUT 673 }; 674 675 /** 676 * struct iwl_mvm_compressed_ba_notif - notifies about reception of BA 677 * ( BA_NOTIF = 0xc5 ) 678 * @flags: status flag, see the &iwl_mvm_ba_resp_flags 679 * @sta_id: Index of recipient (BA-sending) station in fw's station table 680 * @reduced_txp: power reduced according to TPC. This is the actual value and 681 * not a copy from the LQ command. Thus, if not the first rate was used 682 * for Tx-ing then this value will be set to 0 by FW. 683 * @tlc_rate_info: TLC rate info, initial rate index, TLC table color 684 * @retry_cnt: retry count 685 * @query_byte_cnt: SCD query byte count 686 * @query_frame_cnt: SCD query frame count 687 * @txed: number of frames sent in the aggregation (all-TIDs) 688 * @done: number of frames that were Acked by the BA (all-TIDs) 689 * @reserved: reserved (for alignment) 690 * @wireless_time: Wireless-media time 691 * @tx_rate: the rate the aggregation was sent at 692 * @tfd_cnt: number of TFD-Q elements 693 * @ra_tid_cnt: number of RATID-Q elements 694 * @tfd: array of TFD queue status updates. See &iwl_mvm_compressed_ba_tfd 695 * for details. Length in @tfd_cnt. 696 * @ra_tid: array of RA-TID queue status updates. For debug purposes only. See 697 * &iwl_mvm_compressed_ba_ratid for more details. Length in @ra_tid_cnt. 698 */ 699 struct iwl_mvm_compressed_ba_notif { 700 __le32 flags; 701 u8 sta_id; 702 u8 reduced_txp; 703 u8 tlc_rate_info; 704 u8 retry_cnt; 705 __le32 query_byte_cnt; 706 __le16 query_frame_cnt; 707 __le16 txed; 708 __le16 done; 709 __le16 reserved; 710 __le32 wireless_time; 711 __le32 tx_rate; 712 __le16 tfd_cnt; 713 __le16 ra_tid_cnt; 714 struct iwl_mvm_compressed_ba_ratid ra_tid[0]; 715 struct iwl_mvm_compressed_ba_tfd tfd[]; 716 } __packed; /* COMPRESSED_BA_RES_API_S_VER_4 */ 717 718 /** 719 * struct iwl_mac_beacon_cmd_v6 - beacon template command 720 * @tx: the tx commands associated with the beacon frame 721 * @template_id: currently equal to the mac context id of the coresponding 722 * mac. 723 * @tim_idx: the offset of the tim IE in the beacon 724 * @tim_size: the length of the tim IE 725 * @frame: the template of the beacon frame 726 */ 727 struct iwl_mac_beacon_cmd_v6 { 728 struct iwl_tx_cmd tx; 729 __le32 template_id; 730 __le32 tim_idx; 731 __le32 tim_size; 732 struct ieee80211_hdr frame[]; 733 } __packed; /* BEACON_TEMPLATE_CMD_API_S_VER_6 */ 734 735 /** 736 * struct iwl_mac_beacon_cmd_v7 - beacon template command with offloaded CSA 737 * @tx: the tx commands associated with the beacon frame 738 * @template_id: currently equal to the mac context id of the coresponding 739 * mac. 740 * @tim_idx: the offset of the tim IE in the beacon 741 * @tim_size: the length of the tim IE 742 * @ecsa_offset: offset to the ECSA IE if present 743 * @csa_offset: offset to the CSA IE if present 744 * @frame: the template of the beacon frame 745 */ 746 struct iwl_mac_beacon_cmd_v7 { 747 struct iwl_tx_cmd tx; 748 __le32 template_id; 749 __le32 tim_idx; 750 __le32 tim_size; 751 __le32 ecsa_offset; 752 __le32 csa_offset; 753 struct ieee80211_hdr frame[]; 754 } __packed; /* BEACON_TEMPLATE_CMD_API_S_VER_7 */ 755 756 enum iwl_mac_beacon_flags { 757 IWL_MAC_BEACON_CCK = BIT(8), 758 IWL_MAC_BEACON_ANT_A = BIT(9), 759 IWL_MAC_BEACON_ANT_B = BIT(10), 760 IWL_MAC_BEACON_ANT_C = BIT(11), 761 IWL_MAC_BEACON_FILS = BIT(12), 762 }; 763 764 /** 765 * struct iwl_mac_beacon_cmd - beacon template command with offloaded CSA 766 * @byte_cnt: byte count of the beacon frame. 767 * @flags: least significant byte for rate code. The most significant byte 768 * is &enum iwl_mac_beacon_flags. 769 * @short_ssid: Short SSID 770 * @reserved: reserved 771 * @template_id: currently equal to the mac context id of the coresponding mac. 772 * @tim_idx: the offset of the tim IE in the beacon 773 * @tim_size: the length of the tim IE 774 * @ecsa_offset: offset to the ECSA IE if present 775 * @csa_offset: offset to the CSA IE if present 776 * @frame: the template of the beacon frame 777 */ 778 struct iwl_mac_beacon_cmd { 779 __le16 byte_cnt; 780 __le16 flags; 781 __le32 short_ssid; 782 __le32 reserved; 783 __le32 template_id; 784 __le32 tim_idx; 785 __le32 tim_size; 786 __le32 ecsa_offset; 787 __le32 csa_offset; 788 struct ieee80211_hdr frame[]; 789 } __packed; /* BEACON_TEMPLATE_CMD_API_S_VER_10 */ 790 791 struct iwl_beacon_notif { 792 struct iwl_mvm_tx_resp beacon_notify_hdr; 793 __le64 tsf; 794 __le32 ibss_mgr_status; 795 } __packed; 796 797 /** 798 * struct iwl_extended_beacon_notif_v5 - notifies about beacon transmission 799 * @beacon_notify_hdr: tx response command associated with the beacon 800 * @tsf: last beacon tsf 801 * @ibss_mgr_status: whether IBSS is manager 802 * @gp2: last beacon time in gp2 803 */ 804 struct iwl_extended_beacon_notif_v5 { 805 struct iwl_mvm_tx_resp beacon_notify_hdr; 806 __le64 tsf; 807 __le32 ibss_mgr_status; 808 __le32 gp2; 809 } __packed; /* BEACON_NTFY_API_S_VER_5 */ 810 811 /** 812 * struct iwl_extended_beacon_notif - notifies about beacon transmission 813 * @status: the status of the Tx response of the beacon 814 * @tsf: last beacon tsf 815 * @ibss_mgr_status: whether IBSS is manager 816 * @gp2: last beacon time in gp2 817 */ 818 struct iwl_extended_beacon_notif { 819 __le32 status; 820 __le64 tsf; 821 __le32 ibss_mgr_status; 822 __le32 gp2; 823 } __packed; /* BEACON_NTFY_API_S_VER_6_ */ 824 825 /** 826 * enum iwl_dump_control - dump (flush) control flags 827 * @DUMP_TX_FIFO_FLUSH: Dump MSDUs until the the FIFO is empty 828 * and the TFD queues are empty. 829 */ 830 enum iwl_dump_control { 831 DUMP_TX_FIFO_FLUSH = BIT(1), 832 }; 833 834 /** 835 * struct iwl_tx_path_flush_cmd -- queue/FIFO flush command 836 * @queues_ctl: bitmap of queues to flush 837 * @flush_ctl: control flags 838 * @reserved: reserved 839 */ 840 struct iwl_tx_path_flush_cmd_v1 { 841 __le32 queues_ctl; 842 __le16 flush_ctl; 843 __le16 reserved; 844 } __packed; /* TX_PATH_FLUSH_CMD_API_S_VER_1 */ 845 846 /** 847 * struct iwl_tx_path_flush_cmd -- queue/FIFO flush command 848 * @sta_id: station ID to flush 849 * @tid_mask: TID mask to flush 850 * @reserved: reserved 851 */ 852 struct iwl_tx_path_flush_cmd { 853 __le32 sta_id; 854 __le16 tid_mask; 855 __le16 reserved; 856 } __packed; /* TX_PATH_FLUSH_CMD_API_S_VER_2 */ 857 858 /* Available options for the SCD_QUEUE_CFG HCMD */ 859 enum iwl_scd_cfg_actions { 860 SCD_CFG_DISABLE_QUEUE = 0x0, 861 SCD_CFG_ENABLE_QUEUE = 0x1, 862 SCD_CFG_UPDATE_QUEUE_TID = 0x2, 863 }; 864 865 /** 866 * struct iwl_scd_txq_cfg_cmd - New txq hw scheduler config command 867 * @token: unused 868 * @sta_id: station id 869 * @tid: TID 870 * @scd_queue: scheduler queue to confiug 871 * @action: 1 queue enable, 0 queue disable, 2 change txq's tid owner 872 * Value is one of &enum iwl_scd_cfg_actions options 873 * @aggregate: 1 aggregated queue, 0 otherwise 874 * @tx_fifo: &enum iwl_mvm_tx_fifo 875 * @window: BA window size 876 * @ssn: SSN for the BA agreement 877 * @reserved: reserved 878 */ 879 struct iwl_scd_txq_cfg_cmd { 880 u8 token; 881 u8 sta_id; 882 u8 tid; 883 u8 scd_queue; 884 u8 action; 885 u8 aggregate; 886 u8 tx_fifo; 887 u8 window; 888 __le16 ssn; 889 __le16 reserved; 890 } __packed; /* SCD_QUEUE_CFG_CMD_API_S_VER_1 */ 891 892 /** 893 * struct iwl_scd_txq_cfg_rsp 894 * @token: taken from the command 895 * @sta_id: station id from the command 896 * @tid: tid from the command 897 * @scd_queue: scd_queue from the command 898 */ 899 struct iwl_scd_txq_cfg_rsp { 900 u8 token; 901 u8 sta_id; 902 u8 tid; 903 u8 scd_queue; 904 } __packed; /* SCD_QUEUE_CFG_RSP_API_S_VER_1 */ 905 906 #endif /* __iwl_fw_api_tx_h__ */ 907