Loading...
1/* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
2/*
3 * Copyright (C) 2012-2014, 2018 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_tdls_h__
8#define __iwl_fw_api_tdls_h__
9
10#include "fw/api/tx.h"
11#include "fw/api/phy-ctxt.h"
12
13#define IWL_MVM_TDLS_STA_COUNT 4
14
15/* Type of TDLS request */
16enum iwl_tdls_channel_switch_type {
17 TDLS_SEND_CHAN_SW_REQ = 0,
18 TDLS_SEND_CHAN_SW_RESP_AND_MOVE_CH,
19 TDLS_MOVE_CH,
20}; /* TDLS_STA_CHANNEL_SWITCH_CMD_TYPE_API_E_VER_1 */
21
22/**
23 * struct iwl_tdls_channel_switch_timing - Switch timing in TDLS channel-switch
24 * @frame_timestamp: GP2 timestamp of channel-switch request/response packet
25 * received from peer
26 * @max_offchan_duration: What amount of microseconds out of a DTIM is given
27 * to the TDLS off-channel communication. For instance if the DTIM is
28 * 200TU and the TDLS peer is to be given 25% of the time, the value
29 * given will be 50TU, or 50 * 1024 if translated into microseconds.
30 * @switch_time: switch time the peer sent in its channel switch timing IE
31 * @switch_timeout: switch timeout the peer sent in its channel switch timing IE
32 */
33struct iwl_tdls_channel_switch_timing {
34 __le32 frame_timestamp; /* GP2 time of peer packet Rx */
35 __le32 max_offchan_duration; /* given in micro-seconds */
36 __le32 switch_time; /* given in micro-seconds */
37 __le32 switch_timeout; /* given in micro-seconds */
38} __packed; /* TDLS_STA_CHANNEL_SWITCH_TIMING_DATA_API_S_VER_1 */
39
40#define IWL_TDLS_CH_SW_FRAME_MAX_SIZE 200
41
42/**
43 * struct iwl_tdls_channel_switch_frame - TDLS channel switch frame template
44 *
45 * A template representing a TDLS channel-switch request or response frame
46 *
47 * @switch_time_offset: offset to the channel switch timing IE in the template
48 * @tx_cmd: Tx parameters for the frame
49 * @data: frame data
50 */
51struct iwl_tdls_channel_switch_frame {
52 __le32 switch_time_offset;
53 struct iwl_tx_cmd tx_cmd;
54 u8 data[IWL_TDLS_CH_SW_FRAME_MAX_SIZE];
55} __packed; /* TDLS_STA_CHANNEL_SWITCH_FRAME_API_S_VER_1 */
56
57/**
58 * struct iwl_tdls_channel_switch_cmd_tail - tail of iwl_tdls_channel_switch_cmd
59 *
60 * @timing: timing related data for command
61 * @frame: channel-switch request/response template, depending to switch_type
62 */
63struct iwl_tdls_channel_switch_cmd_tail {
64 struct iwl_tdls_channel_switch_timing timing;
65 struct iwl_tdls_channel_switch_frame frame;
66} __packed;
67
68/**
69 * struct iwl_tdls_channel_switch_cmd - TDLS channel switch command
70 *
71 * The command is sent to initiate a channel switch and also in response to
72 * incoming TDLS channel-switch request/response packets from remote peers.
73 *
74 * @switch_type: see &enum iwl_tdls_channel_switch_type
75 * @peer_sta_id: station id of TDLS peer
76 * @ci: channel we switch to
77 * @tail: command tail
78 */
79struct iwl_tdls_channel_switch_cmd {
80 u8 switch_type;
81 __le32 peer_sta_id;
82 struct iwl_fw_channel_info ci;
83 struct iwl_tdls_channel_switch_cmd_tail tail;
84} __packed; /* TDLS_STA_CHANNEL_SWITCH_CMD_API_S_VER_1 */
85
86/**
87 * struct iwl_tdls_channel_switch_notif - TDLS channel switch start notification
88 *
89 * @status: non-zero on success
90 * @offchannel_duration: duration given in microseconds
91 * @sta_id: peer currently performing the channel-switch with
92 */
93struct iwl_tdls_channel_switch_notif {
94 __le32 status;
95 __le32 offchannel_duration;
96 __le32 sta_id;
97} __packed; /* TDLS_STA_CHANNEL_SWITCH_NTFY_API_S_VER_1 */
98
99/**
100 * struct iwl_tdls_sta_info - TDLS station info
101 *
102 * @sta_id: station id of the TDLS peer
103 * @tx_to_peer_tid: TID reserved vs. the peer for FW based Tx
104 * @tx_to_peer_ssn: initial SSN the FW should use for Tx on its TID vs the peer
105 * @is_initiator: 1 if the peer is the TDLS link initiator, 0 otherwise
106 */
107struct iwl_tdls_sta_info {
108 u8 sta_id;
109 u8 tx_to_peer_tid;
110 __le16 tx_to_peer_ssn;
111 __le32 is_initiator;
112} __packed; /* TDLS_STA_INFO_VER_1 */
113
114/**
115 * struct iwl_tdls_config_cmd - TDLS basic config command
116 *
117 * @id_and_color: MAC id and color being configured
118 * @tdls_peer_count: amount of currently connected TDLS peers
119 * @tx_to_ap_tid: TID reverved vs. the AP for FW based Tx
120 * @tx_to_ap_ssn: initial SSN the FW should use for Tx on its TID vs. the AP
121 * @sta_info: per-station info. Only the first tdls_peer_count entries are set
122 * @pti_req_data_offset: offset of network-level data for the PTI template
123 * @pti_req_tx_cmd: Tx parameters for PTI request template
124 * @pti_req_template: PTI request template data
125 */
126struct iwl_tdls_config_cmd {
127 __le32 id_and_color; /* mac id and color */
128 u8 tdls_peer_count;
129 u8 tx_to_ap_tid;
130 __le16 tx_to_ap_ssn;
131 struct iwl_tdls_sta_info sta_info[IWL_MVM_TDLS_STA_COUNT];
132
133 __le32 pti_req_data_offset;
134 struct iwl_tx_cmd pti_req_tx_cmd;
135 u8 pti_req_template[];
136} __packed; /* TDLS_CONFIG_CMD_API_S_VER_1 */
137
138/**
139 * struct iwl_tdls_config_sta_info_res - TDLS per-station config information
140 *
141 * @sta_id: station id of the TDLS peer
142 * @tx_to_peer_last_seq: last sequence number used by FW during FW-based Tx to
143 * the peer
144 */
145struct iwl_tdls_config_sta_info_res {
146 __le16 sta_id;
147 __le16 tx_to_peer_last_seq;
148} __packed; /* TDLS_STA_INFO_RSP_VER_1 */
149
150/**
151 * struct iwl_tdls_config_res - TDLS config information from FW
152 *
153 * @tx_to_ap_last_seq: last sequence number used by FW during FW-based Tx to AP
154 * @sta_info: per-station TDLS config information
155 */
156struct iwl_tdls_config_res {
157 __le32 tx_to_ap_last_seq;
158 struct iwl_tdls_config_sta_info_res sta_info[IWL_MVM_TDLS_STA_COUNT];
159} __packed; /* TDLS_CONFIG_RSP_API_S_VER_1 */
160
161#endif /* __iwl_fw_api_tdls_h__ */
1/******************************************************************************
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) 2016 - 2017 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 * The full GNU General Public License is included in this distribution
22 * in the file called COPYING.
23 *
24 * Contact Information:
25 * Intel Linux Wireless <linuxwifi@intel.com>
26 * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
27 *
28 * BSD LICENSE
29 *
30 * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
31 * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
32 * Copyright(c) 2016 - 2017 Intel Deutschland GmbH
33 * All rights reserved.
34 *
35 * Redistribution and use in source and binary forms, with or without
36 * modification, are permitted provided that the following conditions
37 * are met:
38 *
39 * * Redistributions of source code must retain the above copyright
40 * notice, this list of conditions and the following disclaimer.
41 * * Redistributions in binary form must reproduce the above copyright
42 * notice, this list of conditions and the following disclaimer in
43 * the documentation and/or other materials provided with the
44 * distribution.
45 * * Neither the name Intel Corporation nor the names of its
46 * contributors may be used to endorse or promote products derived
47 * from this software without specific prior written permission.
48 *
49 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
50 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
51 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
52 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
53 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
54 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
55 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
56 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
57 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
58 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
59 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
60 *
61 *****************************************************************************/
62
63#ifndef __iwl_fw_api_tdls_h__
64#define __iwl_fw_api_tdls_h__
65
66#include "fw/api/tx.h"
67#include "fw/api/phy-ctxt.h"
68
69#define IWL_MVM_TDLS_STA_COUNT 4
70
71/* Type of TDLS request */
72enum iwl_tdls_channel_switch_type {
73 TDLS_SEND_CHAN_SW_REQ = 0,
74 TDLS_SEND_CHAN_SW_RESP_AND_MOVE_CH,
75 TDLS_MOVE_CH,
76}; /* TDLS_STA_CHANNEL_SWITCH_CMD_TYPE_API_E_VER_1 */
77
78/**
79 * struct iwl_tdls_channel_switch_timing - Switch timing in TDLS channel-switch
80 * @frame_timestamp: GP2 timestamp of channel-switch request/response packet
81 * received from peer
82 * @max_offchan_duration: What amount of microseconds out of a DTIM is given
83 * to the TDLS off-channel communication. For instance if the DTIM is
84 * 200TU and the TDLS peer is to be given 25% of the time, the value
85 * given will be 50TU, or 50 * 1024 if translated into microseconds.
86 * @switch_time: switch time the peer sent in its channel switch timing IE
87 * @switch_timeout: switch timeout the peer sent in its channel switch timing IE
88 */
89struct iwl_tdls_channel_switch_timing {
90 __le32 frame_timestamp; /* GP2 time of peer packet Rx */
91 __le32 max_offchan_duration; /* given in micro-seconds */
92 __le32 switch_time; /* given in micro-seconds */
93 __le32 switch_timeout; /* given in micro-seconds */
94} __packed; /* TDLS_STA_CHANNEL_SWITCH_TIMING_DATA_API_S_VER_1 */
95
96#define IWL_TDLS_CH_SW_FRAME_MAX_SIZE 200
97
98/**
99 * struct iwl_tdls_channel_switch_frame - TDLS channel switch frame template
100 *
101 * A template representing a TDLS channel-switch request or response frame
102 *
103 * @switch_time_offset: offset to the channel switch timing IE in the template
104 * @tx_cmd: Tx parameters for the frame
105 * @data: frame data
106 */
107struct iwl_tdls_channel_switch_frame {
108 __le32 switch_time_offset;
109 struct iwl_tx_cmd tx_cmd;
110 u8 data[IWL_TDLS_CH_SW_FRAME_MAX_SIZE];
111} __packed; /* TDLS_STA_CHANNEL_SWITCH_FRAME_API_S_VER_1 */
112
113/**
114 * struct iwl_tdls_channel_switch_cmd - TDLS channel switch command
115 *
116 * The command is sent to initiate a channel switch and also in response to
117 * incoming TDLS channel-switch request/response packets from remote peers.
118 *
119 * @switch_type: see &enum iwl_tdls_channel_switch_type
120 * @peer_sta_id: station id of TDLS peer
121 * @ci: channel we switch to
122 * @timing: timing related data for command
123 * @frame: channel-switch request/response template, depending to switch_type
124 */
125struct iwl_tdls_channel_switch_cmd {
126 u8 switch_type;
127 __le32 peer_sta_id;
128 struct iwl_fw_channel_info ci;
129 struct iwl_tdls_channel_switch_timing timing;
130 struct iwl_tdls_channel_switch_frame frame;
131} __packed; /* TDLS_STA_CHANNEL_SWITCH_CMD_API_S_VER_1 */
132
133/**
134 * struct iwl_tdls_channel_switch_notif - TDLS channel switch start notification
135 *
136 * @status: non-zero on success
137 * @offchannel_duration: duration given in microseconds
138 * @sta_id: peer currently performing the channel-switch with
139 */
140struct iwl_tdls_channel_switch_notif {
141 __le32 status;
142 __le32 offchannel_duration;
143 __le32 sta_id;
144} __packed; /* TDLS_STA_CHANNEL_SWITCH_NTFY_API_S_VER_1 */
145
146/**
147 * struct iwl_tdls_sta_info - TDLS station info
148 *
149 * @sta_id: station id of the TDLS peer
150 * @tx_to_peer_tid: TID reserved vs. the peer for FW based Tx
151 * @tx_to_peer_ssn: initial SSN the FW should use for Tx on its TID vs the peer
152 * @is_initiator: 1 if the peer is the TDLS link initiator, 0 otherwise
153 */
154struct iwl_tdls_sta_info {
155 u8 sta_id;
156 u8 tx_to_peer_tid;
157 __le16 tx_to_peer_ssn;
158 __le32 is_initiator;
159} __packed; /* TDLS_STA_INFO_VER_1 */
160
161/**
162 * struct iwl_tdls_config_cmd - TDLS basic config command
163 *
164 * @id_and_color: MAC id and color being configured
165 * @tdls_peer_count: amount of currently connected TDLS peers
166 * @tx_to_ap_tid: TID reverved vs. the AP for FW based Tx
167 * @tx_to_ap_ssn: initial SSN the FW should use for Tx on its TID vs. the AP
168 * @sta_info: per-station info. Only the first tdls_peer_count entries are set
169 * @pti_req_data_offset: offset of network-level data for the PTI template
170 * @pti_req_tx_cmd: Tx parameters for PTI request template
171 * @pti_req_template: PTI request template data
172 */
173struct iwl_tdls_config_cmd {
174 __le32 id_and_color; /* mac id and color */
175 u8 tdls_peer_count;
176 u8 tx_to_ap_tid;
177 __le16 tx_to_ap_ssn;
178 struct iwl_tdls_sta_info sta_info[IWL_MVM_TDLS_STA_COUNT];
179
180 __le32 pti_req_data_offset;
181 struct iwl_tx_cmd pti_req_tx_cmd;
182 u8 pti_req_template[0];
183} __packed; /* TDLS_CONFIG_CMD_API_S_VER_1 */
184
185/**
186 * struct iwl_tdls_config_sta_info_res - TDLS per-station config information
187 *
188 * @sta_id: station id of the TDLS peer
189 * @tx_to_peer_last_seq: last sequence number used by FW during FW-based Tx to
190 * the peer
191 */
192struct iwl_tdls_config_sta_info_res {
193 __le16 sta_id;
194 __le16 tx_to_peer_last_seq;
195} __packed; /* TDLS_STA_INFO_RSP_VER_1 */
196
197/**
198 * struct iwl_tdls_config_res - TDLS config information from FW
199 *
200 * @tx_to_ap_last_seq: last sequence number used by FW during FW-based Tx to AP
201 * @sta_info: per-station TDLS config information
202 */
203struct iwl_tdls_config_res {
204 __le32 tx_to_ap_last_seq;
205 struct iwl_tdls_config_sta_info_res sta_info[IWL_MVM_TDLS_STA_COUNT];
206} __packed; /* TDLS_CONFIG_RSP_API_S_VER_1 */
207
208#endif /* __iwl_fw_api_tdls_h__ */