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