blob: 4a4845193539ad52f650e9d91549f685535edcab [file] [log] [blame]
Yuval Mintz7a9b6b82016-06-03 14:35:33 +03001/* QLogic qed NIC Driver
Mintz, Yuvale8f1cb52017-01-01 13:57:00 +02002 * Copyright (c) 2015-2017 QLogic Corporation
Yuval Mintz7a9b6b82016-06-03 14:35:33 +03003 *
Mintz, Yuvale8f1cb52017-01-01 13:57:00 +02004 * This software is available to you under a choice of one of two
5 * licenses. You may choose to be licensed under the terms of the GNU
6 * General Public License (GPL) Version 2, available from the file
7 * COPYING in the main directory of this source tree, or the
8 * OpenIB.org BSD license below:
9 *
10 * Redistribution and use in source and binary forms, with or
11 * without modification, are permitted provided that the following
12 * conditions are met:
13 *
14 * - Redistributions of source code must retain the above
15 * copyright notice, this list of conditions and the following
16 * disclaimer.
17 *
18 * - Redistributions in binary form must reproduce the above
19 * copyright notice, this list of conditions and the following
20 * disclaimer in the documentation and /or other materials
21 * provided with the distribution.
22 *
23 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
27 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
28 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
29 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
30 * SOFTWARE.
Yuval Mintz7a9b6b82016-06-03 14:35:33 +030031 */
32
33#ifndef __TCP_COMMON__
34#define __TCP_COMMON__
35
Tomer Tayara2e76992017-12-27 19:30:05 +020036/********************/
37/* TCP FW CONSTANTS */
38/********************/
Yuval Mintz7a9b6b82016-06-03 14:35:33 +030039
Tomer Tayara2e76992017-12-27 19:30:05 +020040#define TCP_INVALID_TIMEOUT_VAL -1
41
42/* OOO opaque data received from LL2 */
Yuval Mintz05fafbf2016-08-19 09:33:31 +030043struct ooo_opaque {
44 __le32 cid;
45 u8 drop_isle;
46 u8 drop_size;
47 u8 ooo_opcode;
48 u8 ooo_isle;
49};
50
Tomer Tayara2e76992017-12-27 19:30:05 +020051/* tcp connect mode enum */
Yuval Mintz7a9b6b82016-06-03 14:35:33 +030052enum tcp_connect_mode {
53 TCP_CONNECT_ACTIVE,
54 TCP_CONNECT_PASSIVE,
55 MAX_TCP_CONNECT_MODE
56};
57
Tomer Tayara2e76992017-12-27 19:30:05 +020058/* tcp function init parameters */
Yuval Mintz7a9b6b82016-06-03 14:35:33 +030059struct tcp_init_params {
Yuval Mintz05fafbf2016-08-19 09:33:31 +030060 __le32 two_msl_timer;
Yuval Mintz7a9b6b82016-06-03 14:35:33 +030061 __le16 tx_sws_timer;
Tomer Tayara2e76992017-12-27 19:30:05 +020062 u8 max_fin_rt;
Yuval Mintz05fafbf2016-08-19 09:33:31 +030063 u8 reserved[9];
Yuval Mintz7a9b6b82016-06-03 14:35:33 +030064};
65
Tomer Tayara2e76992017-12-27 19:30:05 +020066/* tcp IPv4/IPv6 enum */
Yuval Mintz7a9b6b82016-06-03 14:35:33 +030067enum tcp_ip_version {
68 TCP_IPV4,
69 TCP_IPV6,
70 MAX_TCP_IP_VERSION
71};
72
Tomer Tayara2e76992017-12-27 19:30:05 +020073/* tcp offload parameters */
Yuval Mintz7a9b6b82016-06-03 14:35:33 +030074struct tcp_offload_params {
75 __le16 local_mac_addr_lo;
76 __le16 local_mac_addr_mid;
77 __le16 local_mac_addr_hi;
78 __le16 remote_mac_addr_lo;
79 __le16 remote_mac_addr_mid;
80 __le16 remote_mac_addr_hi;
81 __le16 vlan_id;
Tomer Tayarda090912017-12-27 19:30:07 +020082 __le16 flags;
Tomer Tayara2e76992017-12-27 19:30:05 +020083#define TCP_OFFLOAD_PARAMS_TS_EN_MASK 0x1
84#define TCP_OFFLOAD_PARAMS_TS_EN_SHIFT 0
85#define TCP_OFFLOAD_PARAMS_DA_EN_MASK 0x1
86#define TCP_OFFLOAD_PARAMS_DA_EN_SHIFT 1
87#define TCP_OFFLOAD_PARAMS_KA_EN_MASK 0x1
88#define TCP_OFFLOAD_PARAMS_KA_EN_SHIFT 2
Tomer Tayarda090912017-12-27 19:30:07 +020089#define TCP_OFFLOAD_PARAMS_ECN_SENDER_EN_MASK 0x1
90#define TCP_OFFLOAD_PARAMS_ECN_SENDER_EN_SHIFT 3
91#define TCP_OFFLOAD_PARAMS_ECN_RECEIVER_EN_MASK 0x1
92#define TCP_OFFLOAD_PARAMS_ECN_RECEIVER_EN_SHIFT 4
Tomer Tayara2e76992017-12-27 19:30:05 +020093#define TCP_OFFLOAD_PARAMS_NAGLE_EN_MASK 0x1
Tomer Tayarda090912017-12-27 19:30:07 +020094#define TCP_OFFLOAD_PARAMS_NAGLE_EN_SHIFT 5
Tomer Tayara2e76992017-12-27 19:30:05 +020095#define TCP_OFFLOAD_PARAMS_DA_CNT_EN_MASK 0x1
Tomer Tayarda090912017-12-27 19:30:07 +020096#define TCP_OFFLOAD_PARAMS_DA_CNT_EN_SHIFT 6
Tomer Tayara2e76992017-12-27 19:30:05 +020097#define TCP_OFFLOAD_PARAMS_FIN_SENT_MASK 0x1
Tomer Tayarda090912017-12-27 19:30:07 +020098#define TCP_OFFLOAD_PARAMS_FIN_SENT_SHIFT 7
Tomer Tayara2e76992017-12-27 19:30:05 +020099#define TCP_OFFLOAD_PARAMS_FIN_RECEIVED_MASK 0x1
Tomer Tayarda090912017-12-27 19:30:07 +0200100#define TCP_OFFLOAD_PARAMS_FIN_RECEIVED_SHIFT 8
101#define TCP_OFFLOAD_PARAMS_RESERVED_MASK 0x7F
102#define TCP_OFFLOAD_PARAMS_RESERVED_SHIFT 9
Yuval Mintz7a9b6b82016-06-03 14:35:33 +0300103 u8 ip_version;
Tomer Tayarda090912017-12-27 19:30:07 +0200104 u8 reserved0[3];
Yuval Mintz7a9b6b82016-06-03 14:35:33 +0300105 __le32 remote_ip[4];
106 __le32 local_ip[4];
107 __le32 flow_label;
108 u8 ttl;
109 u8 tos_or_tc;
110 __le16 remote_port;
111 __le16 local_port;
112 __le16 mss;
113 u8 rcv_wnd_scale;
114 u8 connect_mode;
115 __le16 srtt;
Yuval Mintz7a9b6b82016-06-03 14:35:33 +0300116 __le32 ss_thresh;
Tomer Tayarda090912017-12-27 19:30:07 +0200117 __le32 rcv_wnd;
118 __le32 cwnd;
Yuval Mintz7a9b6b82016-06-03 14:35:33 +0300119 u8 ka_max_probe_cnt;
120 u8 dup_ack_theshold;
Tomer Tayarda090912017-12-27 19:30:07 +0200121 __le16 reserved1;
122 __le32 ka_timeout;
123 __le32 ka_interval;
124 __le32 max_rt_time;
125 __le32 initial_rcv_wnd;
Yuval Mintz7a9b6b82016-06-03 14:35:33 +0300126 __le32 rcv_next;
127 __le32 snd_una;
128 __le32 snd_next;
129 __le32 snd_max;
130 __le32 snd_wnd;
Yuval Mintz7a9b6b82016-06-03 14:35:33 +0300131 __le32 snd_wl1;
Yuval Mintz7a9b6b82016-06-03 14:35:33 +0300132 __le32 ts_recent;
133 __le32 ts_recent_age;
134 __le32 total_rt;
135 __le32 ka_timeout_delta;
136 __le32 rt_timeout_delta;
137 u8 dup_ack_cnt;
138 u8 snd_wnd_probe_cnt;
139 u8 ka_probe_cnt;
140 u8 rt_cnt;
141 __le16 rtt_var;
Mintz, Yuval7b6859f2017-05-18 19:41:04 +0300142 __le16 fw_internal;
Yuval Mintz7a9b6b82016-06-03 14:35:33 +0300143 u8 snd_wnd_scale;
144 u8 ack_frequency;
145 __le16 da_timeout_value;
Tomer Tayarda090912017-12-27 19:30:07 +0200146 __le32 reserved3;
Yuval Mintz7a9b6b82016-06-03 14:35:33 +0300147};
148
Tomer Tayara2e76992017-12-27 19:30:05 +0200149/* tcp offload parameters */
Yuval Mintz7a9b6b82016-06-03 14:35:33 +0300150struct tcp_offload_params_opt2 {
151 __le16 local_mac_addr_lo;
152 __le16 local_mac_addr_mid;
153 __le16 local_mac_addr_hi;
154 __le16 remote_mac_addr_lo;
155 __le16 remote_mac_addr_mid;
156 __le16 remote_mac_addr_hi;
157 __le16 vlan_id;
Tomer Tayarda090912017-12-27 19:30:07 +0200158 __le16 flags;
Tomer Tayara2e76992017-12-27 19:30:05 +0200159#define TCP_OFFLOAD_PARAMS_OPT2_TS_EN_MASK 0x1
160#define TCP_OFFLOAD_PARAMS_OPT2_TS_EN_SHIFT 0
161#define TCP_OFFLOAD_PARAMS_OPT2_DA_EN_MASK 0x1
162#define TCP_OFFLOAD_PARAMS_OPT2_DA_EN_SHIFT 1
163#define TCP_OFFLOAD_PARAMS_OPT2_KA_EN_MASK 0x1
164#define TCP_OFFLOAD_PARAMS_OPT2_KA_EN_SHIFT 2
Tomer Tayarda090912017-12-27 19:30:07 +0200165#define TCP_OFFLOAD_PARAMS_OPT2_ECN_EN_MASK 0x1
166#define TCP_OFFLOAD_PARAMS_OPT2_ECN_EN_SHIFT 3
167#define TCP_OFFLOAD_PARAMS_OPT2_RESERVED0_MASK 0xFFF
168#define TCP_OFFLOAD_PARAMS_OPT2_RESERVED0_SHIFT 4
Yuval Mintz7a9b6b82016-06-03 14:35:33 +0300169 u8 ip_version;
Tomer Tayarda090912017-12-27 19:30:07 +0200170 u8 reserved1[3];
Yuval Mintz7a9b6b82016-06-03 14:35:33 +0300171 __le32 remote_ip[4];
172 __le32 local_ip[4];
173 __le32 flow_label;
174 u8 ttl;
175 u8 tos_or_tc;
176 __le16 remote_port;
177 __le16 local_port;
178 __le16 mss;
179 u8 rcv_wnd_scale;
180 u8 connect_mode;
181 __le16 syn_ip_payload_length;
182 __le32 syn_phy_addr_lo;
183 __le32 syn_phy_addr_hi;
Tomer Tayarda090912017-12-27 19:30:07 +0200184 __le32 cwnd;
185 u8 ka_max_probe_cnt;
186 u8 reserved2[3];
187 __le32 ka_timeout;
188 __le32 ka_interval;
189 __le32 max_rt_time;
190 __le32 reserved3[16];
Yuval Mintz7a9b6b82016-06-03 14:35:33 +0300191};
192
Tomer Tayara2e76992017-12-27 19:30:05 +0200193/* tcp IPv4/IPv6 enum */
Yuval Mintz7a9b6b82016-06-03 14:35:33 +0300194enum tcp_seg_placement_event {
195 TCP_EVENT_ADD_PEN,
196 TCP_EVENT_ADD_NEW_ISLE,
197 TCP_EVENT_ADD_ISLE_RIGHT,
198 TCP_EVENT_ADD_ISLE_LEFT,
199 TCP_EVENT_JOIN,
Mintz, Yuvalbe086e72017-03-11 18:39:18 +0200200 TCP_EVENT_DELETE_ISLES,
Yuval Mintz7a9b6b82016-06-03 14:35:33 +0300201 TCP_EVENT_NOP,
202 MAX_TCP_SEG_PLACEMENT_EVENT
203};
204
Tomer Tayara2e76992017-12-27 19:30:05 +0200205/* tcp init parameters */
Yuval Mintz7a9b6b82016-06-03 14:35:33 +0300206struct tcp_update_params {
207 __le16 flags;
Tomer Tayara2e76992017-12-27 19:30:05 +0200208#define TCP_UPDATE_PARAMS_REMOTE_MAC_ADDR_CHANGED_MASK 0x1
209#define TCP_UPDATE_PARAMS_REMOTE_MAC_ADDR_CHANGED_SHIFT 0
210#define TCP_UPDATE_PARAMS_MSS_CHANGED_MASK 0x1
211#define TCP_UPDATE_PARAMS_MSS_CHANGED_SHIFT 1
212#define TCP_UPDATE_PARAMS_TTL_CHANGED_MASK 0x1
213#define TCP_UPDATE_PARAMS_TTL_CHANGED_SHIFT 2
214#define TCP_UPDATE_PARAMS_TOS_OR_TC_CHANGED_MASK 0x1
215#define TCP_UPDATE_PARAMS_TOS_OR_TC_CHANGED_SHIFT 3
216#define TCP_UPDATE_PARAMS_KA_TIMEOUT_CHANGED_MASK 0x1
217#define TCP_UPDATE_PARAMS_KA_TIMEOUT_CHANGED_SHIFT 4
218#define TCP_UPDATE_PARAMS_KA_INTERVAL_CHANGED_MASK 0x1
219#define TCP_UPDATE_PARAMS_KA_INTERVAL_CHANGED_SHIFT 5
220#define TCP_UPDATE_PARAMS_MAX_RT_TIME_CHANGED_MASK 0x1
221#define TCP_UPDATE_PARAMS_MAX_RT_TIME_CHANGED_SHIFT 6
222#define TCP_UPDATE_PARAMS_FLOW_LABEL_CHANGED_MASK 0x1
223#define TCP_UPDATE_PARAMS_FLOW_LABEL_CHANGED_SHIFT 7
224#define TCP_UPDATE_PARAMS_INITIAL_RCV_WND_CHANGED_MASK 0x1
225#define TCP_UPDATE_PARAMS_INITIAL_RCV_WND_CHANGED_SHIFT 8
226#define TCP_UPDATE_PARAMS_KA_MAX_PROBE_CNT_CHANGED_MASK 0x1
227#define TCP_UPDATE_PARAMS_KA_MAX_PROBE_CNT_CHANGED_SHIFT 9
228#define TCP_UPDATE_PARAMS_KA_EN_CHANGED_MASK 0x1
229#define TCP_UPDATE_PARAMS_KA_EN_CHANGED_SHIFT 10
230#define TCP_UPDATE_PARAMS_NAGLE_EN_CHANGED_MASK 0x1
231#define TCP_UPDATE_PARAMS_NAGLE_EN_CHANGED_SHIFT 11
232#define TCP_UPDATE_PARAMS_KA_EN_MASK 0x1
233#define TCP_UPDATE_PARAMS_KA_EN_SHIFT 12
234#define TCP_UPDATE_PARAMS_NAGLE_EN_MASK 0x1
235#define TCP_UPDATE_PARAMS_NAGLE_EN_SHIFT 13
236#define TCP_UPDATE_PARAMS_KA_RESTART_MASK 0x1
237#define TCP_UPDATE_PARAMS_KA_RESTART_SHIFT 14
238#define TCP_UPDATE_PARAMS_RETRANSMIT_RESTART_MASK 0x1
239#define TCP_UPDATE_PARAMS_RETRANSMIT_RESTART_SHIFT 15
Yuval Mintz7a9b6b82016-06-03 14:35:33 +0300240 __le16 remote_mac_addr_lo;
241 __le16 remote_mac_addr_mid;
242 __le16 remote_mac_addr_hi;
243 __le16 mss;
244 u8 ttl;
245 u8 tos_or_tc;
246 __le32 ka_timeout;
247 __le32 ka_interval;
248 __le32 max_rt_time;
249 __le32 flow_label;
250 __le32 initial_rcv_wnd;
251 u8 ka_max_probe_cnt;
252 u8 reserved1[7];
253};
254
Tomer Tayara2e76992017-12-27 19:30:05 +0200255/* toe upload parameters */
Yuval Mintz7a9b6b82016-06-03 14:35:33 +0300256struct tcp_upload_params {
257 __le32 rcv_next;
258 __le32 snd_una;
259 __le32 snd_next;
260 __le32 snd_max;
261 __le32 snd_wnd;
262 __le32 rcv_wnd;
263 __le32 snd_wl1;
264 __le32 cwnd;
265 __le32 ss_thresh;
266 __le16 srtt;
267 __le16 rtt_var;
268 __le32 ts_time;
269 __le32 ts_recent;
270 __le32 ts_recent_age;
271 __le32 total_rt;
272 __le32 ka_timeout_delta;
273 __le32 rt_timeout_delta;
274 u8 dup_ack_cnt;
275 u8 snd_wnd_probe_cnt;
276 u8 ka_probe_cnt;
277 u8 rt_cnt;
278 __le32 reserved;
279};
280
281#endif /* __TCP_COMMON__ */