969 lines · c
1/* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */2/*3 * Copyright (C) 2012-2014, 2018-2024 Intel Corporation4 * Copyright (C) 2016-2017 Intel Deutschland GmbH5 */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 command12 * @TX_CMD_FLG_PROT_REQUIRE: use RTS or CTS-to-self to protect the frame13 * @TX_CMD_FLG_WRITE_TX_POWER: update current tx power value in the mgmt frame14 * @TX_CMD_FLG_ACK: expect ACK from receiving station15 * @TX_CMD_FLG_STA_RATE: use RS table with initial index from the TX command.16 * Otherwise, use rate_n_flags from the TX command17 * @TX_CMD_FLG_BAR: this frame is a BA request, immediate BAR is expected18 * Must set TX_CMD_FLG_ACK with this flag.19 * @TX_CMD_FLG_TXOP_PROT: TXOP protection requested20 * @TX_CMD_FLG_VHT_NDPA: mark frame is NDPA for VHT beamformer sequence21 * @TX_CMD_FLG_HT_NDPA: mark frame is NDPA for HT beamformer sequence22 * @TX_CMD_FLG_CSI_FDBK2HOST: mark to send feedback to host (only if good CRC)23 * @TX_CMD_FLG_BT_PRIO_MASK: BT priority value24 * @TX_CMD_FLG_BT_PRIO_POS: the position of the BT priority (bit 11 is ignored25 * on old firmwares).26 * @TX_CMD_FLG_BT_DIS: disable BT priority for this frame27 * @TX_CMD_FLG_SEQ_CTL: set if FW should override the sequence control.28 * Should be set for mgmt, non-QOS data, mcast, bcast and in scan command29 * @TX_CMD_FLG_MORE_FRAG: this frame is non-last MPDU30 * @TX_CMD_FLG_TSF: FW should calculate and insert TSF in the frame31 * Should be set for beacons and probe responses32 * @TX_CMD_FLG_CALIB: activate PA TX power calibrations33 * @TX_CMD_FLG_KEEP_SEQ_CTL: if seq_ctl is set, don't increase inner seq count34 * @TX_CMD_FLG_MH_PAD: driver inserted 2 byte padding after MAC header.35 * Should be set for 26/30 length MAC headers36 * @TX_CMD_FLG_RESP_TO_DRV: zero this if the response should go only to FW37 * @TX_CMD_FLG_TKIP_MIC_DONE: FW already performed TKIP MIC calculation38 * @TX_CMD_FLG_DUR: disable duration overwriting used in PS-Poll Assoc-id39 * @TX_CMD_FLG_FW_DROP: FW should mark frame to be dropped40 * @TX_CMD_FLG_EXEC_PAPD: execute PAPD41 * @TX_CMD_FLG_PAPD_TYPE: 0 for reference power, 1 for nominal power42 * @TX_CMD_FLG_HCCA_CHUNK: mark start of TSPEC chunk43 */44enum iwl_tx_flags {45 TX_CMD_FLG_PROT_REQUIRE = BIT(0),46 TX_CMD_FLG_WRITE_TX_POWER = BIT(1),47 TX_CMD_FLG_ACK = BIT(3),48 TX_CMD_FLG_STA_RATE = BIT(4),49 TX_CMD_FLG_BAR = BIT(6),50 TX_CMD_FLG_TXOP_PROT = BIT(7),51 TX_CMD_FLG_VHT_NDPA = BIT(8),52 TX_CMD_FLG_HT_NDPA = BIT(9),53 TX_CMD_FLG_CSI_FDBK2HOST = BIT(10),54 TX_CMD_FLG_BT_PRIO_POS = 11,55 TX_CMD_FLG_BT_PRIO_MASK = BIT(11) | BIT(12),56 TX_CMD_FLG_BT_DIS = BIT(12),57 TX_CMD_FLG_SEQ_CTL = BIT(13),58 TX_CMD_FLG_MORE_FRAG = BIT(14),59 TX_CMD_FLG_TSF = BIT(16),60 TX_CMD_FLG_CALIB = BIT(17),61 TX_CMD_FLG_KEEP_SEQ_CTL = BIT(18),62 TX_CMD_FLG_MH_PAD = BIT(20),63 TX_CMD_FLG_RESP_TO_DRV = BIT(21),64 TX_CMD_FLG_TKIP_MIC_DONE = BIT(23),65 TX_CMD_FLG_DUR = BIT(25),66 TX_CMD_FLG_FW_DROP = BIT(26),67 TX_CMD_FLG_EXEC_PAPD = BIT(27),68 TX_CMD_FLG_PAPD_TYPE = BIT(28),69 TX_CMD_FLG_HCCA_CHUNK = BIT(31)70}; /* TX_FLAGS_BITS_API_S_VER_1 */71 72/**73 * enum iwl_tx_cmd_flags - bitmasks for tx_flags in TX command for 2200074 * @IWL_TX_FLAGS_CMD_RATE: use rate from the TX command75 * @IWL_TX_FLAGS_ENCRYPT_DIS: frame should not be encrypted, even if it belongs76 * to a secured STA77 * @IWL_TX_FLAGS_HIGH_PRI: high priority frame (like EAPOL) - can affect rate78 * selection, retry limits and BT kill79 * @IWL_TX_FLAGS_RTS: firmware used an RTS80 * @IWL_TX_FLAGS_CTS: firmware used CTS-to-self81 */82enum iwl_tx_cmd_flags {83 IWL_TX_FLAGS_CMD_RATE = BIT(0),84 IWL_TX_FLAGS_ENCRYPT_DIS = BIT(1),85 IWL_TX_FLAGS_HIGH_PRI = BIT(2),86 /* Use these flags only from87 * TX_FLAGS_BITS_API_S_VER_4 and above */88 IWL_TX_FLAGS_RTS = BIT(3),89 IWL_TX_FLAGS_CTS = BIT(4),90}; /* TX_FLAGS_BITS_API_S_VER_3 */91 92/**93 * enum iwl_tx_pm_timeouts - pm timeout values in TX command94 * @PM_FRAME_NONE: no need to suspend sleep mode95 * @PM_FRAME_MGMT: fw suspend sleep mode for 100TU96 * @PM_FRAME_ASSOC: fw suspend sleep mode for 10sec97 */98enum iwl_tx_pm_timeouts {99 PM_FRAME_NONE = 0,100 PM_FRAME_MGMT = 2,101 PM_FRAME_ASSOC = 3,102};103 104#define TX_CMD_SEC_MSK 0x07105#define TX_CMD_SEC_WEP_KEY_IDX_POS 6106#define TX_CMD_SEC_WEP_KEY_IDX_MSK 0xc0107 108/**109 * enum iwl_tx_cmd_sec_ctrl - bitmasks for security control in TX command110 * @TX_CMD_SEC_WEP: WEP encryption algorithm.111 * @TX_CMD_SEC_CCM: CCM encryption algorithm.112 * @TX_CMD_SEC_TKIP: TKIP encryption algorithm.113 * @TX_CMD_SEC_EXT: extended cipher algorithm.114 * @TX_CMD_SEC_GCMP: GCMP encryption algorithm.115 * @TX_CMD_SEC_KEY128: set for 104 bits WEP key.116 * @TX_CMD_SEC_KEY_FROM_TABLE: for a non-WEP key, set if the key should be taken117 * from the table instead of from the TX command.118 * If the key is taken from the key table its index should be given by the119 * first byte of the TX command key field.120 */121enum iwl_tx_cmd_sec_ctrl {122 TX_CMD_SEC_WEP = 0x01,123 TX_CMD_SEC_CCM = 0x02,124 TX_CMD_SEC_TKIP = 0x03,125 TX_CMD_SEC_EXT = 0x04,126 TX_CMD_SEC_GCMP = 0x05,127 TX_CMD_SEC_KEY128 = 0x08,128 TX_CMD_SEC_KEY_FROM_TABLE = 0x10,129};130 131/*132 * TX command Frame life time in us - to be written in pm_frame_timeout133 */134#define TX_CMD_LIFE_TIME_INFINITE 0xFFFFFFFF135#define TX_CMD_LIFE_TIME_DEFAULT 2000000 /* 2000 ms*/136#define TX_CMD_LIFE_TIME_PROBE_RESP 40000 /* 40 ms */137#define TX_CMD_LIFE_TIME_EXPIRED_FRAME 0138 139/*140 * TID for non QoS frames - to be written in tid_tspec141 */142#define IWL_TID_NON_QOS 0143 144/*145 * Limits on the retransmissions - to be written in {data,rts}_retry_limit146 */147#define IWL_DEFAULT_TX_RETRY 15148#define IWL_MGMT_DFAULT_RETRY_LIMIT 3149#define IWL_RTS_DFAULT_RETRY_LIMIT 60150#define IWL_BAR_DFAULT_RETRY_LIMIT 60151#define IWL_LOW_RETRY_LIMIT 7152 153/**154 * enum iwl_tx_offload_assist_flags_pos - set %iwl_tx_cmd offload_assist values155 * @TX_CMD_OFFLD_IP_HDR: offset to start of IP header (in words)156 * from mac header end. For normal case it is 4 words for SNAP.157 * note: tx_cmd, mac header and pad are not counted in the offset.158 * This is used to help the offload in case there is tunneling such as159 * IPv6 in IPv4, in such case the ip header offset should point to the160 * inner ip header and IPv4 checksum of the external header should be161 * calculated by driver.162 * @TX_CMD_OFFLD_L4_EN: enable TCP/UDP checksum163 * @TX_CMD_OFFLD_L3_EN: enable IP header checksum164 * @TX_CMD_OFFLD_MH_SIZE: size of the mac header in words. Includes the IV165 * field. Doesn't include the pad.166 * @TX_CMD_OFFLD_PAD: mark 2-byte pad was inserted after the mac header for167 * alignment168 * @TX_CMD_OFFLD_AMSDU: mark TX command is A-MSDU169 */170enum iwl_tx_offload_assist_flags_pos {171 TX_CMD_OFFLD_IP_HDR = 0,172 TX_CMD_OFFLD_L4_EN = 6,173 TX_CMD_OFFLD_L3_EN = 7,174 TX_CMD_OFFLD_MH_SIZE = 8,175 TX_CMD_OFFLD_PAD = 13,176 TX_CMD_OFFLD_AMSDU = 14,177};178 179#define IWL_TX_CMD_OFFLD_MH_MASK 0x1f180#define IWL_TX_CMD_OFFLD_IP_HDR_MASK 0x3f181 182/* TODO: complete documentation for try_cnt and btkill_cnt */183/**184 * struct iwl_tx_cmd - TX command struct to FW185 * ( TX_CMD = 0x1c )186 * @len: in bytes of the payload, see below for details187 * @offload_assist: TX offload configuration188 * @tx_flags: combination of TX_CMD_FLG_*, see &enum iwl_tx_flags189 * @scratch: scratch buffer used by the device190 * @rate_n_flags: rate for *all* Tx attempts, if TX_CMD_FLG_STA_RATE_MSK is191 * cleared. Combination of RATE_MCS_*192 * @sta_id: index of destination station in FW station table193 * @sec_ctl: security control, TX_CMD_SEC_*194 * @initial_rate_index: index into the the rate table for initial TX attempt.195 * Applied if TX_CMD_FLG_STA_RATE_MSK is set, normally 0 for data frames.196 * @reserved2: reserved197 * @key: security key198 * @reserved3: reserved199 * @life_time: frame life time (usecs??)200 * @dram_lsb_ptr: Physical address of scratch area in the command (try_cnt +201 * btkill_cnd + reserved), first 32 bits. "0" disables usage.202 * @dram_msb_ptr: upper bits of the scratch physical address203 * @rts_retry_limit: max attempts for RTS204 * @data_retry_limit: max attempts to send the data packet205 * @tid_tspec: TID/tspec206 * @pm_frame_timeout: PM TX frame timeout207 * @reserved4: reserved208 * @payload: payload (same as @hdr)209 * @hdr: 802.11 header (same as @payload)210 *211 * The byte count (both len and next_frame_len) includes MAC header212 * (24/26/30/32 bytes)213 * + 2 bytes pad if 26/30 header size214 * + 8 byte IV for CCM or TKIP (not used for WEP)215 * + Data payload216 * + 8-byte MIC (not used for CCM/WEP)217 * It does not include post-MAC padding, i.e.,218 * MIC (CCM) 8 bytes, ICV (WEP/TKIP/CKIP) 4 bytes, CRC 4 bytes.219 * Range of len: 14-2342 bytes.220 *221 * After the struct fields the MAC header is placed, plus any padding,222 * and then the actial payload.223 */224struct iwl_tx_cmd {225 __le16 len;226 __le16 offload_assist;227 __le32 tx_flags;228 struct {229 u8 try_cnt;230 u8 btkill_cnt;231 __le16 reserved;232 } scratch; /* DRAM_SCRATCH_API_U_VER_1 */233 __le32 rate_n_flags;234 u8 sta_id;235 u8 sec_ctl;236 u8 initial_rate_index;237 u8 reserved2;238 u8 key[16];239 __le32 reserved3;240 __le32 life_time;241 __le32 dram_lsb_ptr;242 u8 dram_msb_ptr;243 u8 rts_retry_limit;244 u8 data_retry_limit;245 u8 tid_tspec;246 __le16 pm_frame_timeout;247 __le16 reserved4;248 union {249 DECLARE_FLEX_ARRAY(u8, payload);250 DECLARE_FLEX_ARRAY(struct ieee80211_hdr, hdr);251 };252} __packed; /* TX_CMD_API_S_VER_6 */253 254struct iwl_dram_sec_info {255 __le32 pn_low;256 __le16 pn_high;257 __le16 aux_info;258} __packed; /* DRAM_SEC_INFO_API_S_VER_1 */259 260/**261 * struct iwl_tx_cmd_gen2 - TX command struct to FW for 22000 devices262 * ( TX_CMD = 0x1c )263 * @len: in bytes of the payload, see below for details264 * @offload_assist: TX offload configuration265 * @flags: combination of &enum iwl_tx_cmd_flags266 * @dram_info: FW internal DRAM storage267 * @rate_n_flags: rate for *all* Tx attempts, if TX_CMD_FLG_STA_RATE_MSK is268 * cleared. Combination of RATE_MCS_*269 * @hdr: 802.11 header270 */271struct iwl_tx_cmd_gen2 {272 __le16 len;273 __le16 offload_assist;274 __le32 flags;275 struct iwl_dram_sec_info dram_info;276 __le32 rate_n_flags;277 struct ieee80211_hdr hdr[];278} __packed; /* TX_CMD_API_S_VER_7,279 TX_CMD_API_S_VER_9 */280 281/**282 * struct iwl_tx_cmd_gen3 - TX command struct to FW for AX210+ devices283 * ( TX_CMD = 0x1c )284 * @len: in bytes of the payload, see below for details285 * @flags: combination of &enum iwl_tx_cmd_flags286 * @offload_assist: TX offload configuration287 * @dram_info: FW internal DRAM storage288 * @rate_n_flags: rate for *all* Tx attempts, if TX_CMD_FLG_STA_RATE_MSK is289 * cleared. Combination of RATE_MCS_*290 * @reserved: reserved291 * @hdr: 802.11 header292 */293struct iwl_tx_cmd_gen3 {294 __le16 len;295 __le16 flags;296 __le32 offload_assist;297 struct iwl_dram_sec_info dram_info;298 __le32 rate_n_flags;299 u8 reserved[8];300 struct ieee80211_hdr hdr[];301} __packed; /* TX_CMD_API_S_VER_8,302 TX_CMD_API_S_VER_10 */303 304/*305 * TX response related data306 */307 308/*309 * enum iwl_tx_status - status that is returned by the fw after attempts to Tx310 * @TX_STATUS_SUCCESS:311 * @TX_STATUS_DIRECT_DONE:312 * @TX_STATUS_POSTPONE_DELAY:313 * @TX_STATUS_POSTPONE_FEW_BYTES:314 * @TX_STATUS_POSTPONE_BT_PRIO:315 * @TX_STATUS_POSTPONE_QUIET_PERIOD:316 * @TX_STATUS_POSTPONE_CALC_TTAK:317 * @TX_STATUS_FAIL_INTERNAL_CROSSED_RETRY:318 * @TX_STATUS_FAIL_SHORT_LIMIT:319 * @TX_STATUS_FAIL_LONG_LIMIT:320 * @TX_STATUS_FAIL_UNDERRUN:321 * @TX_STATUS_FAIL_DRAIN_FLOW:322 * @TX_STATUS_FAIL_RFKILL_FLUSH:323 * @TX_STATUS_FAIL_LIFE_EXPIRE:324 * @TX_STATUS_FAIL_DEST_PS:325 * @TX_STATUS_FAIL_HOST_ABORTED:326 * @TX_STATUS_FAIL_BT_RETRY:327 * @TX_STATUS_FAIL_STA_INVALID:328 * @TX_TATUS_FAIL_FRAG_DROPPED:329 * @TX_STATUS_FAIL_TID_DISABLE:330 * @TX_STATUS_FAIL_FIFO_FLUSHED:331 * @TX_STATUS_FAIL_SMALL_CF_POLL:332 * @TX_STATUS_FAIL_FW_DROP:333 * @TX_STATUS_FAIL_STA_COLOR_MISMATCH: mismatch between color of Tx cmd and334 * STA table335 * @TX_FRAME_STATUS_INTERNAL_ABORT:336 * @TX_MODE_MSK:337 * @TX_MODE_NO_BURST:338 * @TX_MODE_IN_BURST_SEQ:339 * @TX_MODE_FIRST_IN_BURST:340 * @TX_QUEUE_NUM_MSK:341 *342 * Valid only if frame_count =1343 * TODO: complete documentation344 */345enum iwl_tx_status {346 TX_STATUS_MSK = 0x000000ff,347 TX_STATUS_SUCCESS = 0x01,348 TX_STATUS_DIRECT_DONE = 0x02,349 /* postpone TX */350 TX_STATUS_POSTPONE_DELAY = 0x40,351 TX_STATUS_POSTPONE_FEW_BYTES = 0x41,352 TX_STATUS_POSTPONE_BT_PRIO = 0x42,353 TX_STATUS_POSTPONE_QUIET_PERIOD = 0x43,354 TX_STATUS_POSTPONE_CALC_TTAK = 0x44,355 /* abort TX */356 TX_STATUS_FAIL_INTERNAL_CROSSED_RETRY = 0x81,357 TX_STATUS_FAIL_SHORT_LIMIT = 0x82,358 TX_STATUS_FAIL_LONG_LIMIT = 0x83,359 TX_STATUS_FAIL_UNDERRUN = 0x84,360 TX_STATUS_FAIL_DRAIN_FLOW = 0x85,361 TX_STATUS_FAIL_RFKILL_FLUSH = 0x86,362 TX_STATUS_FAIL_LIFE_EXPIRE = 0x87,363 TX_STATUS_FAIL_DEST_PS = 0x88,364 TX_STATUS_FAIL_HOST_ABORTED = 0x89,365 TX_STATUS_FAIL_BT_RETRY = 0x8a,366 TX_STATUS_FAIL_STA_INVALID = 0x8b,367 TX_STATUS_FAIL_FRAG_DROPPED = 0x8c,368 TX_STATUS_FAIL_TID_DISABLE = 0x8d,369 TX_STATUS_FAIL_FIFO_FLUSHED = 0x8e,370 TX_STATUS_FAIL_SMALL_CF_POLL = 0x8f,371 TX_STATUS_FAIL_FW_DROP = 0x90,372 TX_STATUS_FAIL_STA_COLOR_MISMATCH = 0x91,373 TX_STATUS_INTERNAL_ABORT = 0x92,374 TX_MODE_MSK = 0x00000f00,375 TX_MODE_NO_BURST = 0x00000000,376 TX_MODE_IN_BURST_SEQ = 0x00000100,377 TX_MODE_FIRST_IN_BURST = 0x00000200,378 TX_QUEUE_NUM_MSK = 0x0001f000,379 TX_NARROW_BW_MSK = 0x00060000,380 TX_NARROW_BW_1DIV2 = 0x00020000,381 TX_NARROW_BW_1DIV4 = 0x00040000,382 TX_NARROW_BW_1DIV8 = 0x00060000,383};384 385/*386 * enum iwl_tx_agg_status - TX aggregation status387 * @AGG_TX_STATE_STATUS_MSK:388 * @AGG_TX_STATE_TRANSMITTED:389 * @AGG_TX_STATE_UNDERRUN:390 * @AGG_TX_STATE_BT_PRIO:391 * @AGG_TX_STATE_FEW_BYTES:392 * @AGG_TX_STATE_ABORT:393 * @AGG_TX_STATE_TX_ON_AIR_DROP: TX_ON_AIR signal drop without underrun or394 * BT detection395 * @AGG_TX_STATE_LAST_SENT_TRY_CNT:396 * @AGG_TX_STATE_LAST_SENT_BT_KILL:397 * @AGG_TX_STATE_SCD_QUERY:398 * @AGG_TX_STATE_TEST_BAD_CRC32:399 * @AGG_TX_STATE_RESPONSE:400 * @AGG_TX_STATE_DUMP_TX:401 * @AGG_TX_STATE_DELAY_TX:402 * @AGG_TX_STATE_TRY_CNT_MSK: Retry count for 1st frame in aggregation (retries403 * occur if tx failed for this frame when it was a member of a previous404 * aggregation block). If rate scaling is used, retry count indicates the405 * rate table entry used for all frames in the new agg.406 * @AGG_TX_STATE_SEQ_NUM_MSK: Command ID and sequence number of Tx command for407 * this frame408 *409 * TODO: complete documentation410 */411enum iwl_tx_agg_status {412 AGG_TX_STATE_STATUS_MSK = 0x00fff,413 AGG_TX_STATE_TRANSMITTED = 0x000,414 AGG_TX_STATE_UNDERRUN = 0x001,415 AGG_TX_STATE_BT_PRIO = 0x002,416 AGG_TX_STATE_FEW_BYTES = 0x004,417 AGG_TX_STATE_ABORT = 0x008,418 AGG_TX_STATE_TX_ON_AIR_DROP = 0x010,419 AGG_TX_STATE_LAST_SENT_TRY_CNT = 0x020,420 AGG_TX_STATE_LAST_SENT_BT_KILL = 0x040,421 AGG_TX_STATE_SCD_QUERY = 0x080,422 AGG_TX_STATE_TEST_BAD_CRC32 = 0x0100,423 AGG_TX_STATE_RESPONSE = 0x1ff,424 AGG_TX_STATE_DUMP_TX = 0x200,425 AGG_TX_STATE_DELAY_TX = 0x400,426 AGG_TX_STATE_TRY_CNT_POS = 12,427 AGG_TX_STATE_TRY_CNT_MSK = 0xf << AGG_TX_STATE_TRY_CNT_POS,428};429 430/*431 * The mask below describes a status where we are absolutely sure that the MPDU432 * wasn't sent. For BA/Underrun we cannot be that sure. All we know that we've433 * written the bytes to the TXE, but we know nothing about what the DSP did.434 */435#define AGG_TX_STAT_FRAME_NOT_SENT (AGG_TX_STATE_FEW_BYTES | \436 AGG_TX_STATE_ABORT | \437 AGG_TX_STATE_SCD_QUERY)438 439/*440 * REPLY_TX = 0x1c (response)441 *442 * This response may be in one of two slightly different formats, indicated443 * by the frame_count field:444 *445 * 1) No aggregation (frame_count == 1). This reports Tx results for a single446 * frame. Multiple attempts, at various bit rates, may have been made for447 * this frame.448 *449 * 2) Aggregation (frame_count > 1). This reports Tx results for two or more450 * frames that used block-acknowledge. All frames were transmitted at451 * same rate. Rate scaling may have been used if first frame in this new452 * agg block failed in previous agg block(s).453 *454 * Note that, for aggregation, ACK (block-ack) status is not delivered455 * here; block-ack has not been received by the time the device records456 * this status.457 * This status relates to reasons the tx might have been blocked or aborted458 * within the device, rather than whether it was received successfully by459 * the destination station.460 */461 462/**463 * struct agg_tx_status - per packet TX aggregation status464 * @status: See &enum iwl_tx_agg_status465 * @sequence: Sequence # for this frame's Tx cmd (not SSN!)466 */467struct agg_tx_status {468 __le16 status;469 __le16 sequence;470} __packed;471 472/*473 * definitions for initial rate index field474 * bits [3:0] initial rate index475 * bits [6:4] rate table color, used for the initial rate476 * bit-7 invalid rate indication477 */478#define TX_RES_INIT_RATE_INDEX_MSK 0x0f479#define TX_RES_RATE_TABLE_COLOR_POS 4480#define TX_RES_RATE_TABLE_COLOR_MSK 0x70481#define TX_RES_INV_RATE_INDEX_MSK 0x80482#define TX_RES_RATE_TABLE_COL_GET(_f) (((_f) & TX_RES_RATE_TABLE_COLOR_MSK) >>\483 TX_RES_RATE_TABLE_COLOR_POS)484 485#define IWL_MVM_TX_RES_GET_TID(_ra_tid) ((_ra_tid) & 0x0f)486#define IWL_MVM_TX_RES_GET_RA(_ra_tid) ((_ra_tid) >> 4)487 488/**489 * struct iwl_tx_resp_v3 - notifies that fw is TXing a packet490 * ( REPLY_TX = 0x1c )491 * @frame_count: 1 no aggregation, >1 aggregation492 * @bt_kill_count: num of times blocked by bluetooth (unused for agg)493 * @failure_rts: num of failures due to unsuccessful RTS494 * @failure_frame: num failures due to no ACK (unused for agg)495 * @initial_rate: for non-agg: rate of the successful Tx. For agg: rate of the496 * Tx of all the batch. RATE_MCS_*497 * @wireless_media_time: for non-agg: RTS + CTS + frame tx attempts time + ACK.498 * for agg: RTS + CTS + aggregation tx time + block-ack time.499 * in usec.500 * @pa_status: tx power info501 * @pa_integ_res_a: tx power info502 * @pa_integ_res_b: tx power info503 * @pa_integ_res_c: tx power info504 * @measurement_req_id: tx power info505 * @reduced_tpc: transmit power reduction used506 * @reserved: reserved507 * @tfd_info: TFD information set by the FH508 * @seq_ctl: sequence control from the Tx cmd509 * @byte_cnt: byte count from the Tx cmd510 * @tlc_info: TLC rate info511 * @ra_tid: bits [3:0] = ra, bits [7:4] = tid512 * @frame_ctrl: frame control513 * @status: for non-agg: frame status TX_STATUS_*514 * for agg: status of 1st frame, AGG_TX_STATE_*; other frame status fields515 * follow this one, up to frame_count. Length in @frame_count.516 *517 * After the array of statuses comes the SSN of the SCD. Look at518 * %iwl_mvm_get_scd_ssn for more details.519 */520struct iwl_tx_resp_v3 {521 u8 frame_count;522 u8 bt_kill_count;523 u8 failure_rts;524 u8 failure_frame;525 __le32 initial_rate;526 __le16 wireless_media_time;527 528 u8 pa_status;529 u8 pa_integ_res_a[3];530 u8 pa_integ_res_b[3];531 u8 pa_integ_res_c[3];532 __le16 measurement_req_id;533 u8 reduced_tpc;534 u8 reserved;535 536 __le32 tfd_info;537 __le16 seq_ctl;538 __le16 byte_cnt;539 u8 tlc_info;540 u8 ra_tid;541 __le16 frame_ctrl;542 struct agg_tx_status status[];543} __packed; /* TX_RSP_API_S_VER_3 */544 545/**546 * struct iwl_tx_resp - notifies that fw is TXing a packet547 * ( REPLY_TX = 0x1c )548 * @frame_count: 1 no aggregation, >1 aggregation549 * @bt_kill_count: num of times blocked by bluetooth (unused for agg)550 * @failure_rts: num of failures due to unsuccessful RTS551 * @failure_frame: num failures due to no ACK (unused for agg)552 * @initial_rate: for non-agg: rate of the successful Tx. For agg: rate of the553 * Tx of all the batch. RATE_MCS_*554 * @wireless_media_time: for non-agg: RTS + CTS + frame tx attempts time + ACK.555 * for agg: RTS + CTS + aggregation tx time + block-ack time.556 * in usec.557 * @pa_status: tx power info558 * @pa_integ_res_a: tx power info559 * @pa_integ_res_b: tx power info560 * @pa_integ_res_c: tx power info561 * @measurement_req_id: tx power info562 * @reduced_tpc: transmit power reduction used563 * @reserved: reserved564 * @tfd_info: TFD information set by the FH565 * @seq_ctl: sequence control from the Tx cmd566 * @byte_cnt: byte count from the Tx cmd567 * @tlc_info: TLC rate info568 * @ra_tid: bits [3:0] = ra, bits [7:4] = tid569 * @frame_ctrl: frame control570 * @tx_queue: TX queue for this response571 * @reserved2: reserved for padding/alignment572 * @status: for non-agg: frame status TX_STATUS_*573 * For version 6 TX response isn't received for aggregation at all.574 *575 * After the array of statuses comes the SSN of the SCD. Look at576 * %iwl_mvm_get_scd_ssn for more details.577 */578struct iwl_tx_resp {579 u8 frame_count;580 u8 bt_kill_count;581 u8 failure_rts;582 u8 failure_frame;583 __le32 initial_rate;584 __le16 wireless_media_time;585 586 u8 pa_status;587 u8 pa_integ_res_a[3];588 u8 pa_integ_res_b[3];589 u8 pa_integ_res_c[3];590 __le16 measurement_req_id;591 u8 reduced_tpc;592 u8 reserved;593 594 __le32 tfd_info;595 __le16 seq_ctl;596 __le16 byte_cnt;597 u8 tlc_info;598 u8 ra_tid;599 __le16 frame_ctrl;600 __le16 tx_queue;601 __le16 reserved2;602 struct agg_tx_status status;603} __packed; /* TX_RSP_API_S_VER_6,604 TX_RSP_API_S_VER_7 */605 606/**607 * struct iwl_mvm_ba_notif - notifies about reception of BA608 * ( BA_NOTIF = 0xc5 )609 * @sta_addr: MAC address610 * @reserved: reserved611 * @sta_id: Index of recipient (BA-sending) station in fw's station table612 * @tid: tid of the session613 * @seq_ctl: sequence control field614 * @bitmap: the bitmap of the BA notification as seen in the air615 * @scd_flow: the tx queue this BA relates to616 * @scd_ssn: the index of the last contiguously sent packet617 * @txed: number of Txed frames in this batch618 * @txed_2_done: number of Acked frames in this batch619 * @reduced_txp: power reduced according to TPC. This is the actual value and620 * not a copy from the LQ command. Thus, if not the first rate was used621 * for Tx-ing then this value will be set to 0 by FW.622 * @reserved1: reserved623 */624struct iwl_mvm_ba_notif {625 u8 sta_addr[ETH_ALEN];626 __le16 reserved;627 628 u8 sta_id;629 u8 tid;630 __le16 seq_ctl;631 __le64 bitmap;632 __le16 scd_flow;633 __le16 scd_ssn;634 u8 txed;635 u8 txed_2_done;636 u8 reduced_txp;637 u8 reserved1;638} __packed;639 640/**641 * struct iwl_mvm_compressed_ba_tfd - progress of a TFD queue642 * @q_num: TFD queue number643 * @tfd_index: Index of first un-acked frame in the TFD queue644 * @scd_queue: For debug only - the physical queue the TFD queue is bound to645 * @tid: TID of the queue (0-7)646 * @reserved: reserved for alignment647 */648struct iwl_mvm_compressed_ba_tfd {649 __le16 q_num;650 __le16 tfd_index;651 u8 scd_queue;652 u8 tid;653 u8 reserved[2];654} __packed; /* COMPRESSED_BA_TFD_API_S_VER_1 */655 656/**657 * struct iwl_mvm_compressed_ba_ratid - progress of a RA TID queue658 * @q_num: RA TID queue number659 * @tid: TID of the queue660 * @ssn: BA window current SSN661 */662struct iwl_mvm_compressed_ba_ratid {663 u8 q_num;664 u8 tid;665 __le16 ssn;666} __packed; /* COMPRESSED_BA_RATID_API_S_VER_1 */667 668/*669 * enum iwl_mvm_ba_resp_flags - TX aggregation status670 * @IWL_MVM_BA_RESP_TX_AGG: generated due to BA671 * @IWL_MVM_BA_RESP_TX_BAR: generated due to BA after BAR672 * @IWL_MVM_BA_RESP_TX_AGG_FAIL: aggregation didn't receive BA673 * @IWL_MVM_BA_RESP_TX_UNDERRUN: aggregation got underrun674 * @IWL_MVM_BA_RESP_TX_BT_KILL: aggregation got BT-kill675 * @IWL_MVM_BA_RESP_TX_DSP_TIMEOUT: aggregation didn't finish within the676 * expected time677 */678enum iwl_mvm_ba_resp_flags {679 IWL_MVM_BA_RESP_TX_AGG,680 IWL_MVM_BA_RESP_TX_BAR,681 IWL_MVM_BA_RESP_TX_AGG_FAIL,682 IWL_MVM_BA_RESP_TX_UNDERRUN,683 IWL_MVM_BA_RESP_TX_BT_KILL,684 IWL_MVM_BA_RESP_TX_DSP_TIMEOUT685};686 687/**688 * struct iwl_mvm_compressed_ba_notif - notifies about reception of BA689 * ( BA_NOTIF = 0xc5 )690 * @flags: status flag, see the &iwl_mvm_ba_resp_flags691 * @sta_id: Index of recipient (BA-sending) station in fw's station table692 * @reduced_txp: power reduced according to TPC. This is the actual value and693 * not a copy from the LQ command. Thus, if not the first rate was used694 * for Tx-ing then this value will be set to 0 by FW.695 * @tlc_rate_info: TLC rate info, initial rate index, TLC table color696 * @retry_cnt: retry count697 * @query_byte_cnt: SCD query byte count698 * @query_frame_cnt: SCD query frame count699 * @txed: number of frames sent in the aggregation (all-TIDs)700 * @done: number of frames that were Acked by the BA (all-TIDs)701 * @rts_retry_cnt: RTS retry count702 * @reserved: reserved (for alignment)703 * @wireless_time: Wireless-media time704 * @tx_rate: the rate the aggregation was sent at705 * @tfd_cnt: number of TFD-Q elements706 * @ra_tid_cnt: number of RATID-Q elements707 * @tfd: array of TFD queue status updates. See &iwl_mvm_compressed_ba_tfd708 * for details. Length in @tfd_cnt.709 * @ra_tid: array of RA-TID queue status updates. For debug purposes only. See710 * &iwl_mvm_compressed_ba_ratid for more details. Length in @ra_tid_cnt.711 */712struct iwl_mvm_compressed_ba_notif {713 __le32 flags;714 u8 sta_id;715 u8 reduced_txp;716 u8 tlc_rate_info;717 u8 retry_cnt;718 __le32 query_byte_cnt;719 __le16 query_frame_cnt;720 __le16 txed;721 __le16 done;722 u8 rts_retry_cnt;723 u8 reserved;724 __le32 wireless_time;725 __le32 tx_rate;726 __le16 tfd_cnt;727 __le16 ra_tid_cnt;728 union {729 DECLARE_FLEX_ARRAY(struct iwl_mvm_compressed_ba_ratid, ra_tid);730 DECLARE_FLEX_ARRAY(struct iwl_mvm_compressed_ba_tfd, tfd);731 };732} __packed; /* COMPRESSED_BA_RES_API_S_VER_4,733 COMPRESSED_BA_RES_API_S_VER_5 */734 735/**736 * struct iwl_mac_beacon_cmd_v6 - beacon template command737 * @tx: the tx commands associated with the beacon frame738 * @template_id: currently equal to the mac context id of the coresponding739 * mac.740 * @tim_idx: the offset of the tim IE in the beacon741 * @tim_size: the length of the tim IE742 * @frame: the template of the beacon frame743 */744struct iwl_mac_beacon_cmd_v6 {745 struct iwl_tx_cmd tx;746 __le32 template_id;747 __le32 tim_idx;748 __le32 tim_size;749 struct ieee80211_hdr frame[];750} __packed; /* BEACON_TEMPLATE_CMD_API_S_VER_6 */751 752/**753 * struct iwl_mac_beacon_cmd_v7 - beacon template command with offloaded CSA754 * @tx: the tx commands associated with the beacon frame755 * @template_id: currently equal to the mac context id of the coresponding756 * mac.757 * @tim_idx: the offset of the tim IE in the beacon758 * @tim_size: the length of the tim IE759 * @ecsa_offset: offset to the ECSA IE if present760 * @csa_offset: offset to the CSA IE if present761 * @frame: the template of the beacon frame762 */763struct iwl_mac_beacon_cmd_v7 {764 struct iwl_tx_cmd tx;765 __le32 template_id;766 __le32 tim_idx;767 __le32 tim_size;768 __le32 ecsa_offset;769 __le32 csa_offset;770 struct ieee80211_hdr frame[];771} __packed; /* BEACON_TEMPLATE_CMD_API_S_VER_7 */772 773/* Bit flags for BEACON_TEMPLATE_CMD_API until version 10 */774enum iwl_mac_beacon_flags_v1 {775 IWL_MAC_BEACON_CCK_V1 = BIT(8),776 IWL_MAC_BEACON_ANT_A_V1 = BIT(9),777 IWL_MAC_BEACON_ANT_B_V1 = BIT(10),778 IWL_MAC_BEACON_FILS_V1 = BIT(12),779};780 781/* Bit flags for BEACON_TEMPLATE_CMD_API version 11 and above */782enum iwl_mac_beacon_flags {783 IWL_MAC_BEACON_CCK = BIT(5),784 IWL_MAC_BEACON_ANT_A = BIT(6),785 IWL_MAC_BEACON_ANT_B = BIT(7),786 IWL_MAC_BEACON_FILS = BIT(8),787};788 789/**790 * struct iwl_mac_beacon_cmd - beacon template command with offloaded CSA791 * @byte_cnt: byte count of the beacon frame.792 * @flags: least significant byte for rate code. The most significant byte793 * is &enum iwl_mac_beacon_flags.794 * @short_ssid: Short SSID795 * @reserved: reserved796 * @link_id: the firmware id of the link that will use this beacon797 * @tim_idx: the offset of the tim IE in the beacon798 * @tim_size: the length of the tim IE (version < 14)799 * @btwt_offset: offset to the broadcast TWT IE if present (version >= 14)800 * @ecsa_offset: offset to the ECSA IE if present801 * @csa_offset: offset to the CSA IE if present802 * @frame: the template of the beacon frame803 */804struct iwl_mac_beacon_cmd {805 __le16 byte_cnt;806 __le16 flags;807 __le32 short_ssid;808 __le32 reserved;809 __le32 link_id;810 __le32 tim_idx;811 union {812 __le32 tim_size;813 __le32 btwt_offset;814 };815 __le32 ecsa_offset;816 __le32 csa_offset;817 struct ieee80211_hdr frame[];818} __packed; /* BEACON_TEMPLATE_CMD_API_S_VER_10,819 * BEACON_TEMPLATE_CMD_API_S_VER_11,820 * BEACON_TEMPLATE_CMD_API_S_VER_12,821 * BEACON_TEMPLATE_CMD_API_S_VER_13,822 * BEACON_TEMPLATE_CMD_API_S_VER_14823 */824 825struct iwl_beacon_notif {826 struct iwl_tx_resp beacon_notify_hdr;827 __le64 tsf;828 __le32 ibss_mgr_status;829} __packed;830 831/**832 * struct iwl_extended_beacon_notif_v5 - notifies about beacon transmission833 * @beacon_notify_hdr: tx response command associated with the beacon834 * @tsf: last beacon tsf835 * @ibss_mgr_status: whether IBSS is manager836 * @gp2: last beacon time in gp2837 */838struct iwl_extended_beacon_notif_v5 {839 struct iwl_tx_resp beacon_notify_hdr;840 __le64 tsf;841 __le32 ibss_mgr_status;842 __le32 gp2;843} __packed; /* BEACON_NTFY_API_S_VER_5 */844 845/**846 * struct iwl_extended_beacon_notif - notifies about beacon transmission847 * @status: the status of the Tx response of the beacon848 * @tsf: last beacon tsf849 * @ibss_mgr_status: whether IBSS is manager850 * @gp2: last beacon time in gp2851 */852struct iwl_extended_beacon_notif {853 __le32 status;854 __le64 tsf;855 __le32 ibss_mgr_status;856 __le32 gp2;857} __packed; /* BEACON_NTFY_API_S_VER_6_ */858 859/**860 * enum iwl_dump_control - dump (flush) control flags861 * @DUMP_TX_FIFO_FLUSH: Dump MSDUs until the the FIFO is empty862 * and the TFD queues are empty.863 */864enum iwl_dump_control {865 DUMP_TX_FIFO_FLUSH = BIT(1),866};867 868/**869 * struct iwl_tx_path_flush_cmd_v1 -- queue/FIFO flush command870 * @queues_ctl: bitmap of queues to flush871 * @flush_ctl: control flags872 * @reserved: reserved873 */874struct iwl_tx_path_flush_cmd_v1 {875 __le32 queues_ctl;876 __le16 flush_ctl;877 __le16 reserved;878} __packed; /* TX_PATH_FLUSH_CMD_API_S_VER_1 */879 880/**881 * struct iwl_tx_path_flush_cmd -- queue/FIFO flush command882 * @sta_id: station ID to flush883 * @tid_mask: TID mask to flush884 * @reserved: reserved885 */886struct iwl_tx_path_flush_cmd {887 __le32 sta_id;888 __le16 tid_mask;889 __le16 reserved;890} __packed; /* TX_PATH_FLUSH_CMD_API_S_VER_2 */891 892#define IWL_TX_FLUSH_QUEUE_RSP 16893 894/**895 * struct iwl_flush_queue_info - virtual flush queue info896 * @tid: the tid to flush897 * @queue_num: virtual queue id898 * @read_before_flush: read pointer before flush899 * @read_after_flush: read pointer after flush900 */901struct iwl_flush_queue_info {902 __le16 tid;903 __le16 queue_num;904 __le16 read_before_flush;905 __le16 read_after_flush;906} __packed; /* TFDQ_FLUSH_INFO_API_S_VER_1 */907 908/**909 * struct iwl_tx_path_flush_cmd_rsp -- queue/FIFO flush command response910 * @sta_id: the station for which the queue was flushed911 * @num_flushed_queues: number of queues in queues array912 * @queues: all flushed queues913 */914struct iwl_tx_path_flush_cmd_rsp {915 __le16 sta_id;916 __le16 num_flushed_queues;917 struct iwl_flush_queue_info queues[IWL_TX_FLUSH_QUEUE_RSP];918} __packed; /* TX_PATH_FLUSH_CMD_RSP_API_S_VER_1 */919 920/* Available options for the SCD_QUEUE_CFG HCMD */921enum iwl_scd_cfg_actions {922 SCD_CFG_DISABLE_QUEUE = 0x0,923 SCD_CFG_ENABLE_QUEUE = 0x1,924 SCD_CFG_UPDATE_QUEUE_TID = 0x2,925};926 927/**928 * struct iwl_scd_txq_cfg_cmd - New txq hw scheduler config command929 * @token: unused930 * @sta_id: station id931 * @tid: TID932 * @scd_queue: scheduler queue to confiug933 * @action: 1 queue enable, 0 queue disable, 2 change txq's tid owner934 * Value is one of &enum iwl_scd_cfg_actions options935 * @aggregate: 1 aggregated queue, 0 otherwise936 * @tx_fifo: &enum iwl_mvm_tx_fifo937 * @window: BA window size938 * @ssn: SSN for the BA agreement939 * @reserved: reserved940 */941struct iwl_scd_txq_cfg_cmd {942 u8 token;943 u8 sta_id;944 u8 tid;945 u8 scd_queue;946 u8 action;947 u8 aggregate;948 u8 tx_fifo;949 u8 window;950 __le16 ssn;951 __le16 reserved;952} __packed; /* SCD_QUEUE_CFG_CMD_API_S_VER_1 */953 954/**955 * struct iwl_scd_txq_cfg_rsp956 * @token: taken from the command957 * @sta_id: station id from the command958 * @tid: tid from the command959 * @scd_queue: scd_queue from the command960 */961struct iwl_scd_txq_cfg_rsp {962 u8 token;963 u8 sta_id;964 u8 tid;965 u8 scd_queue;966} __packed; /* SCD_QUEUE_CFG_RSP_API_S_VER_1 */967 968#endif /* __iwl_fw_api_tx_h__ */969