18e99ea8dSJohannes Berg /* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */ 28e99ea8dSJohannes Berg /* 38e99ea8dSJohannes Berg * Copyright (C) 2012-2014, 2018 Intel Corporation 48e99ea8dSJohannes Berg * Copyright (C) 2013-2015 Intel Mobile Communications GmbH 58e99ea8dSJohannes Berg * Copyright (C) 2016-2017 Intel Deutschland GmbH 68e99ea8dSJohannes Berg */ 7d172a5efSJohannes Berg #ifndef __iwl_fw_api_tdls_h__ 8d172a5efSJohannes Berg #define __iwl_fw_api_tdls_h__ 9d172a5efSJohannes Berg 10d172a5efSJohannes Berg #include "fw/api/tx.h" 11d172a5efSJohannes Berg #include "fw/api/phy-ctxt.h" 12d172a5efSJohannes Berg 13d172a5efSJohannes Berg #define IWL_MVM_TDLS_STA_COUNT 4 14d172a5efSJohannes Berg 15d172a5efSJohannes Berg /* Type of TDLS request */ 16d172a5efSJohannes Berg enum iwl_tdls_channel_switch_type { 17d172a5efSJohannes Berg TDLS_SEND_CHAN_SW_REQ = 0, 18d172a5efSJohannes Berg TDLS_SEND_CHAN_SW_RESP_AND_MOVE_CH, 19d172a5efSJohannes Berg TDLS_MOVE_CH, 20d172a5efSJohannes Berg }; /* TDLS_STA_CHANNEL_SWITCH_CMD_TYPE_API_E_VER_1 */ 21d172a5efSJohannes Berg 22d172a5efSJohannes Berg /** 23d172a5efSJohannes Berg * struct iwl_tdls_channel_switch_timing - Switch timing in TDLS channel-switch 24d172a5efSJohannes Berg * @frame_timestamp: GP2 timestamp of channel-switch request/response packet 25d172a5efSJohannes Berg * received from peer 26d172a5efSJohannes Berg * @max_offchan_duration: What amount of microseconds out of a DTIM is given 27d172a5efSJohannes Berg * to the TDLS off-channel communication. For instance if the DTIM is 28d172a5efSJohannes Berg * 200TU and the TDLS peer is to be given 25% of the time, the value 29d172a5efSJohannes Berg * given will be 50TU, or 50 * 1024 if translated into microseconds. 30d172a5efSJohannes Berg * @switch_time: switch time the peer sent in its channel switch timing IE 31d172a5efSJohannes Berg * @switch_timeout: switch timeout the peer sent in its channel switch timing IE 32d172a5efSJohannes Berg */ 33d172a5efSJohannes Berg struct iwl_tdls_channel_switch_timing { 34d172a5efSJohannes Berg __le32 frame_timestamp; /* GP2 time of peer packet Rx */ 35d172a5efSJohannes Berg __le32 max_offchan_duration; /* given in micro-seconds */ 36d172a5efSJohannes Berg __le32 switch_time; /* given in micro-seconds */ 37d172a5efSJohannes Berg __le32 switch_timeout; /* given in micro-seconds */ 38d172a5efSJohannes Berg } __packed; /* TDLS_STA_CHANNEL_SWITCH_TIMING_DATA_API_S_VER_1 */ 39d172a5efSJohannes Berg 40d172a5efSJohannes Berg #define IWL_TDLS_CH_SW_FRAME_MAX_SIZE 200 41d172a5efSJohannes Berg 42d172a5efSJohannes Berg /** 43d172a5efSJohannes Berg * struct iwl_tdls_channel_switch_frame - TDLS channel switch frame template 44d172a5efSJohannes Berg * 45d172a5efSJohannes Berg * A template representing a TDLS channel-switch request or response frame 46d172a5efSJohannes Berg * 47d172a5efSJohannes Berg * @switch_time_offset: offset to the channel switch timing IE in the template 48d172a5efSJohannes Berg * @tx_cmd: Tx parameters for the frame 49d172a5efSJohannes Berg * @data: frame data 50d172a5efSJohannes Berg */ 51d172a5efSJohannes Berg struct iwl_tdls_channel_switch_frame { 52d172a5efSJohannes Berg __le32 switch_time_offset; 53d172a5efSJohannes Berg struct iwl_tx_cmd tx_cmd; 54d172a5efSJohannes Berg u8 data[IWL_TDLS_CH_SW_FRAME_MAX_SIZE]; 55d172a5efSJohannes Berg } __packed; /* TDLS_STA_CHANNEL_SWITCH_FRAME_API_S_VER_1 */ 56d172a5efSJohannes Berg 57d172a5efSJohannes Berg /** 5857e861d9SDavid Spinadel * struct iwl_tdls_channel_switch_cmd_tail - tail of iwl_tdls_channel_switch_cmd 5957e861d9SDavid Spinadel * 6057e861d9SDavid Spinadel * @timing: timing related data for command 6157e861d9SDavid Spinadel * @frame: channel-switch request/response template, depending to switch_type 6257e861d9SDavid Spinadel */ 6357e861d9SDavid Spinadel struct iwl_tdls_channel_switch_cmd_tail { 6457e861d9SDavid Spinadel struct iwl_tdls_channel_switch_timing timing; 6557e861d9SDavid Spinadel struct iwl_tdls_channel_switch_frame frame; 6657e861d9SDavid Spinadel } __packed; 6757e861d9SDavid Spinadel 6857e861d9SDavid Spinadel /** 69d172a5efSJohannes Berg * struct iwl_tdls_channel_switch_cmd - TDLS channel switch command 70d172a5efSJohannes Berg * 71d172a5efSJohannes Berg * The command is sent to initiate a channel switch and also in response to 72d172a5efSJohannes Berg * incoming TDLS channel-switch request/response packets from remote peers. 73d172a5efSJohannes Berg * 74d172a5efSJohannes Berg * @switch_type: see &enum iwl_tdls_channel_switch_type 75d172a5efSJohannes Berg * @peer_sta_id: station id of TDLS peer 76d172a5efSJohannes Berg * @ci: channel we switch to 7757e861d9SDavid Spinadel * @tail: command tail 78d172a5efSJohannes Berg */ 79d172a5efSJohannes Berg struct iwl_tdls_channel_switch_cmd { 80d172a5efSJohannes Berg u8 switch_type; 81d172a5efSJohannes Berg __le32 peer_sta_id; 82d172a5efSJohannes Berg struct iwl_fw_channel_info ci; 8357e861d9SDavid Spinadel struct iwl_tdls_channel_switch_cmd_tail tail; 84d172a5efSJohannes Berg } __packed; /* TDLS_STA_CHANNEL_SWITCH_CMD_API_S_VER_1 */ 85d172a5efSJohannes Berg 86d172a5efSJohannes Berg /** 87d172a5efSJohannes Berg * struct iwl_tdls_channel_switch_notif - TDLS channel switch start notification 88d172a5efSJohannes Berg * 89d172a5efSJohannes Berg * @status: non-zero on success 90d172a5efSJohannes Berg * @offchannel_duration: duration given in microseconds 91d172a5efSJohannes Berg * @sta_id: peer currently performing the channel-switch with 92d172a5efSJohannes Berg */ 93d172a5efSJohannes Berg struct iwl_tdls_channel_switch_notif { 94d172a5efSJohannes Berg __le32 status; 95d172a5efSJohannes Berg __le32 offchannel_duration; 96d172a5efSJohannes Berg __le32 sta_id; 97d172a5efSJohannes Berg } __packed; /* TDLS_STA_CHANNEL_SWITCH_NTFY_API_S_VER_1 */ 98d172a5efSJohannes Berg 99d172a5efSJohannes Berg /** 100d172a5efSJohannes Berg * struct iwl_tdls_sta_info - TDLS station info 101d172a5efSJohannes Berg * 102d172a5efSJohannes Berg * @sta_id: station id of the TDLS peer 103d172a5efSJohannes Berg * @tx_to_peer_tid: TID reserved vs. the peer for FW based Tx 104d172a5efSJohannes Berg * @tx_to_peer_ssn: initial SSN the FW should use for Tx on its TID vs the peer 105d172a5efSJohannes Berg * @is_initiator: 1 if the peer is the TDLS link initiator, 0 otherwise 106d172a5efSJohannes Berg */ 107d172a5efSJohannes Berg struct iwl_tdls_sta_info { 108d172a5efSJohannes Berg u8 sta_id; 109d172a5efSJohannes Berg u8 tx_to_peer_tid; 110d172a5efSJohannes Berg __le16 tx_to_peer_ssn; 111d172a5efSJohannes Berg __le32 is_initiator; 112d172a5efSJohannes Berg } __packed; /* TDLS_STA_INFO_VER_1 */ 113d172a5efSJohannes Berg 114d172a5efSJohannes Berg /** 115d172a5efSJohannes Berg * struct iwl_tdls_config_cmd - TDLS basic config command 116d172a5efSJohannes Berg * 117d172a5efSJohannes Berg * @id_and_color: MAC id and color being configured 118d172a5efSJohannes Berg * @tdls_peer_count: amount of currently connected TDLS peers 119d172a5efSJohannes Berg * @tx_to_ap_tid: TID reverved vs. the AP for FW based Tx 120d172a5efSJohannes Berg * @tx_to_ap_ssn: initial SSN the FW should use for Tx on its TID vs. the AP 121d172a5efSJohannes Berg * @sta_info: per-station info. Only the first tdls_peer_count entries are set 122d172a5efSJohannes Berg * @pti_req_data_offset: offset of network-level data for the PTI template 123d172a5efSJohannes Berg * @pti_req_tx_cmd: Tx parameters for PTI request template 124d172a5efSJohannes Berg * @pti_req_template: PTI request template data 125d172a5efSJohannes Berg */ 126d172a5efSJohannes Berg struct iwl_tdls_config_cmd { 127d172a5efSJohannes Berg __le32 id_and_color; /* mac id and color */ 128d172a5efSJohannes Berg u8 tdls_peer_count; 129d172a5efSJohannes Berg u8 tx_to_ap_tid; 130d172a5efSJohannes Berg __le16 tx_to_ap_ssn; 131d172a5efSJohannes Berg struct iwl_tdls_sta_info sta_info[IWL_MVM_TDLS_STA_COUNT]; 132d172a5efSJohannes Berg 133d172a5efSJohannes Berg __le32 pti_req_data_offset; 134d172a5efSJohannes Berg struct iwl_tx_cmd pti_req_tx_cmd; 135*34e63cd5SGustavo A. R. Silva u8 pti_req_template[]; 136d172a5efSJohannes Berg } __packed; /* TDLS_CONFIG_CMD_API_S_VER_1 */ 137d172a5efSJohannes Berg 138d172a5efSJohannes Berg /** 139d172a5efSJohannes Berg * struct iwl_tdls_config_sta_info_res - TDLS per-station config information 140d172a5efSJohannes Berg * 141d172a5efSJohannes Berg * @sta_id: station id of the TDLS peer 142d172a5efSJohannes Berg * @tx_to_peer_last_seq: last sequence number used by FW during FW-based Tx to 143d172a5efSJohannes Berg * the peer 144d172a5efSJohannes Berg */ 145d172a5efSJohannes Berg struct iwl_tdls_config_sta_info_res { 146d172a5efSJohannes Berg __le16 sta_id; 147d172a5efSJohannes Berg __le16 tx_to_peer_last_seq; 148d172a5efSJohannes Berg } __packed; /* TDLS_STA_INFO_RSP_VER_1 */ 149d172a5efSJohannes Berg 150d172a5efSJohannes Berg /** 151d172a5efSJohannes Berg * struct iwl_tdls_config_res - TDLS config information from FW 152d172a5efSJohannes Berg * 153d172a5efSJohannes Berg * @tx_to_ap_last_seq: last sequence number used by FW during FW-based Tx to AP 154d172a5efSJohannes Berg * @sta_info: per-station TDLS config information 155d172a5efSJohannes Berg */ 156d172a5efSJohannes Berg struct iwl_tdls_config_res { 157d172a5efSJohannes Berg __le32 tx_to_ap_last_seq; 158d172a5efSJohannes Berg struct iwl_tdls_config_sta_info_res sta_info[IWL_MVM_TDLS_STA_COUNT]; 159d172a5efSJohannes Berg } __packed; /* TDLS_CONFIG_RSP_API_S_VER_1 */ 160d172a5efSJohannes Berg 161d172a5efSJohannes Berg #endif /* __iwl_fw_api_tdls_h__ */ 162