xref: /illumos-gate/usr/src/uts/common/io/qede/579xx/drivers/ecore/hsi_repository/tcp_common.h (revision 14b24e2b79293068c8e016a69ef1d872fb5e2fd5)
1 /*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, v.1,  (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://opensource.org/licenses/CDDL-1.0.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21 
22 /*
23 * Copyright 2014-2017 Cavium, Inc.
24 * The contents of this file are subject to the terms of the Common Development
25 * and Distribution License, v.1,  (the "License").
26 
27 * You may not use this file except in compliance with the License.
28 
29 * You can obtain a copy of the License at available
30 * at http://opensource.org/licenses/CDDL-1.0
31 
32 * See the License for the specific language governing permissions and
33 * limitations under the License.
34 */
35 
36 #ifndef __TCP_COMMON__
37 #define __TCP_COMMON__
38 /********************/
39 /* TCP FW CONSTANTS */
40 /********************/
41 
42 #define TCP_INVALID_TIMEOUT_VAL -1
43 
44 
45 /*
46  * OOO opaque data received from LL2
47  */
48 struct ooo_opaque
49 {
50 	__le32 cid /* connection ID  */;
51 	u8 drop_isle /* isle number of the first isle to drop */;
52 	u8 drop_size /* number of isles to drop */;
53 	u8 ooo_opcode /* (use enum tcp_seg_placement_event) */;
54 	u8 ooo_isle /* OOO isle number to add the packet to */;
55 };
56 
57 
58 /*
59  * tcp connect mode enum
60  */
61 enum tcp_connect_mode
62 {
63 	TCP_CONNECT_ACTIVE,
64 	TCP_CONNECT_PASSIVE,
65 	MAX_TCP_CONNECT_MODE
66 };
67 
68 
69 /*
70  * tcp function init parameters
71  */
72 struct tcp_init_params
73 {
74 	__le32 two_msl_timer /* 2MSL (used for TIME_WAIT state) timeout value */;
75 	__le16 tx_sws_timer /* Transmission silly window syndrom timeout value */;
76 	u8 max_fin_rt /* Minimum Fin RT */;
77 	u8 reserved[9];
78 };
79 
80 
81 /*
82  * tcp IPv4/IPv6 enum
83  */
84 enum tcp_ip_version
85 {
86 	TCP_IPV4,
87 	TCP_IPV6,
88 	MAX_TCP_IP_VERSION
89 };
90 
91 
92 /*
93  * tcp offload parameters
94  */
95 struct tcp_offload_params
96 {
97 	__le16 local_mac_addr_lo;
98 	__le16 local_mac_addr_mid;
99 	__le16 local_mac_addr_hi;
100 	__le16 remote_mac_addr_lo;
101 	__le16 remote_mac_addr_mid;
102 	__le16 remote_mac_addr_hi;
103 	__le16 vlan_id;
104 	u8 flags;
105 #define TCP_OFFLOAD_PARAMS_TS_EN_MASK         0x1 /* timestamp enable */
106 #define TCP_OFFLOAD_PARAMS_TS_EN_SHIFT        0
107 #define TCP_OFFLOAD_PARAMS_DA_EN_MASK         0x1 /* delayed ack enabled */
108 #define TCP_OFFLOAD_PARAMS_DA_EN_SHIFT        1
109 #define TCP_OFFLOAD_PARAMS_KA_EN_MASK         0x1 /* keep alive enabled */
110 #define TCP_OFFLOAD_PARAMS_KA_EN_SHIFT        2
111 #define TCP_OFFLOAD_PARAMS_NAGLE_EN_MASK      0x1 /* nagle algorithm enabled */
112 #define TCP_OFFLOAD_PARAMS_NAGLE_EN_SHIFT     3
113 #define TCP_OFFLOAD_PARAMS_DA_CNT_EN_MASK     0x1 /* delayed ack counter enabled */
114 #define TCP_OFFLOAD_PARAMS_DA_CNT_EN_SHIFT    4
115 #define TCP_OFFLOAD_PARAMS_FIN_SENT_MASK      0x1 /* fin already sent to far end */
116 #define TCP_OFFLOAD_PARAMS_FIN_SENT_SHIFT     5
117 #define TCP_OFFLOAD_PARAMS_FIN_RECEIVED_MASK  0x1 /* fin received */
118 #define TCP_OFFLOAD_PARAMS_FIN_RECEIVED_SHIFT 6
119 #define TCP_OFFLOAD_PARAMS_RESERVED0_MASK     0x1
120 #define TCP_OFFLOAD_PARAMS_RESERVED0_SHIFT    7
121 	u8 ip_version;
122 	__le32 remote_ip[4];
123 	__le32 local_ip[4];
124 	__le32 flow_label;
125 	u8 ttl;
126 	u8 tos_or_tc;
127 	__le16 remote_port;
128 	__le16 local_port;
129 	__le16 mss /* the mss derived from remote mss and local mtu, ipVersion options and tags */;
130 	u8 rcv_wnd_scale;
131 	u8 connect_mode /* TCP connect mode: use enum tcp_connect_mode */;
132 	__le16 srtt /* in ms */;
133 	__le32 cwnd /* absolute congestion window */;
134 	__le32 ss_thresh;
135 	__le16 reserved1;
136 	u8 ka_max_probe_cnt;
137 	u8 dup_ack_theshold;
138 	__le32 rcv_next;
139 	__le32 snd_una;
140 	__le32 snd_next;
141 	__le32 snd_max;
142 	__le32 snd_wnd /* absolute send window (not scaled) */;
143 	__le32 rcv_wnd /* absolute receive window (not scaled) */;
144 	__le32 snd_wl1 /* the segment sequence number used for the last window update */;
145 	__le32 ts_recent /* The timestamp value to send in the next ACK */;
146 	__le32 ts_recent_age /* The length of time, in ms, since the most recent timestamp was received */;
147 	__le32 total_rt /* The total time, in ms, that has been spent retransmitting the current TCP segment */;
148 	__le32 ka_timeout_delta /* The time remaining, in clock ticks, until the next keepalive timeout. A value of -1 indicates that the keepalive timer was not running when the connection was offloaded. */;
149 	__le32 rt_timeout_delta /* The time remaining, in clock ticks, until the next retransmit timeout. A value of -1 indicates that the  retransmit timer was not running when the connection was offloaded. */;
150 	u8 dup_ack_cnt /* The number of ACKs that have been accepted for the same sequence number */;
151 	u8 snd_wnd_probe_cnt /* The current send window probe round */;
152 	u8 ka_probe_cnt /* the number of keepalive probes that have been sent that have not received a response */;
153 	u8 rt_cnt /* The number of retransmits that have been sent */;
154 	__le16 rtt_var /* in ms */;
155 	__le16 fw_internal /* fw internal use - initialize value = 0 */;
156 	__le32 ka_timeout /* This member specifies, in ms, the timeout interval for inactivity before sending a keepalive probe */;
157 	__le32 ka_interval /* This member specifies, in ms, the timeout after which to retransmit a keepalive frame if no response is received to a keepalive probe  */;
158 	__le32 max_rt_time /* This member specifies, in ms, the maximum time that the offload target should spend retransmitting a segment */;
159 	__le32 initial_rcv_wnd /* Initial receive window */;
160 	u8 snd_wnd_scale;
161 	u8 ack_frequency /* delayed ack counter threshold */;
162 	__le16 da_timeout_value /* delayed ack timeout value in ms */;
163 	__le32 reserved3[2];
164 };
165 
166 
167 /*
168  * tcp offload parameters
169  */
170 struct tcp_offload_params_opt2
171 {
172 	__le16 local_mac_addr_lo;
173 	__le16 local_mac_addr_mid;
174 	__le16 local_mac_addr_hi;
175 	__le16 remote_mac_addr_lo;
176 	__le16 remote_mac_addr_mid;
177 	__le16 remote_mac_addr_hi;
178 	__le16 vlan_id;
179 	u8 flags;
180 #define TCP_OFFLOAD_PARAMS_OPT2_TS_EN_MASK      0x1 /* timestamp enable */
181 #define TCP_OFFLOAD_PARAMS_OPT2_TS_EN_SHIFT     0
182 #define TCP_OFFLOAD_PARAMS_OPT2_DA_EN_MASK      0x1 /* delayed ack enabled */
183 #define TCP_OFFLOAD_PARAMS_OPT2_DA_EN_SHIFT     1
184 #define TCP_OFFLOAD_PARAMS_OPT2_KA_EN_MASK      0x1 /* keep alive enabled */
185 #define TCP_OFFLOAD_PARAMS_OPT2_KA_EN_SHIFT     2
186 #define TCP_OFFLOAD_PARAMS_OPT2_RESERVED0_MASK  0x1F
187 #define TCP_OFFLOAD_PARAMS_OPT2_RESERVED0_SHIFT 3
188 	u8 ip_version;
189 	__le32 remote_ip[4];
190 	__le32 local_ip[4];
191 	__le32 flow_label;
192 	u8 ttl;
193 	u8 tos_or_tc;
194 	__le16 remote_port;
195 	__le16 local_port;
196 	__le16 mss /* the mss derived from remote mss and local mtu, ipVersion options and tags */;
197 	u8 rcv_wnd_scale;
198 	u8 connect_mode /* TCP connect mode: use enum tcp_connect_mode */;
199 	__le16 syn_ip_payload_length /* length of Tcp header in SYN packet - relevent for passive mode */;
200 	__le32 syn_phy_addr_lo /* physical address (low) of SYN buffer - relevent for passive mode */;
201 	__le32 syn_phy_addr_hi /* physical address (high) of SYN buffer - relevent for passive mode */;
202 	__le32 reserved1[22];
203 };
204 
205 
206 /*
207  * tcp IPv4/IPv6 enum
208  */
209 enum tcp_seg_placement_event
210 {
211 	TCP_EVENT_ADD_PEN,
212 	TCP_EVENT_ADD_NEW_ISLE,
213 	TCP_EVENT_ADD_ISLE_RIGHT,
214 	TCP_EVENT_ADD_ISLE_LEFT,
215 	TCP_EVENT_JOIN,
216 	TCP_EVENT_DELETE_ISLES,
217 	TCP_EVENT_NOP,
218 	MAX_TCP_SEG_PLACEMENT_EVENT
219 };
220 
221 
222 /*
223  * tcp init parameters
224  */
225 struct tcp_update_params
226 {
227 	__le16 flags;
228 #define TCP_UPDATE_PARAMS_REMOTE_MAC_ADDR_CHANGED_MASK   0x1
229 #define TCP_UPDATE_PARAMS_REMOTE_MAC_ADDR_CHANGED_SHIFT  0
230 #define TCP_UPDATE_PARAMS_MSS_CHANGED_MASK               0x1
231 #define TCP_UPDATE_PARAMS_MSS_CHANGED_SHIFT              1
232 #define TCP_UPDATE_PARAMS_TTL_CHANGED_MASK               0x1
233 #define TCP_UPDATE_PARAMS_TTL_CHANGED_SHIFT              2
234 #define TCP_UPDATE_PARAMS_TOS_OR_TC_CHANGED_MASK         0x1
235 #define TCP_UPDATE_PARAMS_TOS_OR_TC_CHANGED_SHIFT        3
236 #define TCP_UPDATE_PARAMS_KA_TIMEOUT_CHANGED_MASK        0x1
237 #define TCP_UPDATE_PARAMS_KA_TIMEOUT_CHANGED_SHIFT       4
238 #define TCP_UPDATE_PARAMS_KA_INTERVAL_CHANGED_MASK       0x1
239 #define TCP_UPDATE_PARAMS_KA_INTERVAL_CHANGED_SHIFT      5
240 #define TCP_UPDATE_PARAMS_MAX_RT_TIME_CHANGED_MASK       0x1
241 #define TCP_UPDATE_PARAMS_MAX_RT_TIME_CHANGED_SHIFT      6
242 #define TCP_UPDATE_PARAMS_FLOW_LABEL_CHANGED_MASK        0x1
243 #define TCP_UPDATE_PARAMS_FLOW_LABEL_CHANGED_SHIFT       7
244 #define TCP_UPDATE_PARAMS_INITIAL_RCV_WND_CHANGED_MASK   0x1
245 #define TCP_UPDATE_PARAMS_INITIAL_RCV_WND_CHANGED_SHIFT  8
246 #define TCP_UPDATE_PARAMS_KA_MAX_PROBE_CNT_CHANGED_MASK  0x1
247 #define TCP_UPDATE_PARAMS_KA_MAX_PROBE_CNT_CHANGED_SHIFT 9
248 #define TCP_UPDATE_PARAMS_KA_EN_CHANGED_MASK             0x1
249 #define TCP_UPDATE_PARAMS_KA_EN_CHANGED_SHIFT            10
250 #define TCP_UPDATE_PARAMS_NAGLE_EN_CHANGED_MASK          0x1
251 #define TCP_UPDATE_PARAMS_NAGLE_EN_CHANGED_SHIFT         11
252 #define TCP_UPDATE_PARAMS_KA_EN_MASK                     0x1
253 #define TCP_UPDATE_PARAMS_KA_EN_SHIFT                    12
254 #define TCP_UPDATE_PARAMS_NAGLE_EN_MASK                  0x1
255 #define TCP_UPDATE_PARAMS_NAGLE_EN_SHIFT                 13
256 #define TCP_UPDATE_PARAMS_KA_RESTART_MASK                0x1
257 #define TCP_UPDATE_PARAMS_KA_RESTART_SHIFT               14
258 #define TCP_UPDATE_PARAMS_RETRANSMIT_RESTART_MASK        0x1
259 #define TCP_UPDATE_PARAMS_RETRANSMIT_RESTART_SHIFT       15
260 	__le16 remote_mac_addr_lo;
261 	__le16 remote_mac_addr_mid;
262 	__le16 remote_mac_addr_hi;
263 	__le16 mss;
264 	u8 ttl;
265 	u8 tos_or_tc;
266 	__le32 ka_timeout;
267 	__le32 ka_interval;
268 	__le32 max_rt_time;
269 	__le32 flow_label;
270 	__le32 initial_rcv_wnd;
271 	u8 ka_max_probe_cnt;
272 	u8 reserved1[7];
273 };
274 
275 
276 /*
277  * toe upload parameters
278  */
279 struct tcp_upload_params
280 {
281 	__le32 rcv_next;
282 	__le32 snd_una;
283 	__le32 snd_next;
284 	__le32 snd_max;
285 	__le32 snd_wnd /* absolute send window (not scaled) */;
286 	__le32 rcv_wnd /* absolute receive window (not scaled) */;
287 	__le32 snd_wl1 /* the segment sequence number used for the last window update */;
288 	__le32 cwnd /* absolute congestion window */;
289 	__le32 ss_thresh;
290 	__le16 srtt /* in ms */;
291 	__le16 rtt_var /* in ms */;
292 	__le32 ts_time /* The current value of the adjusted timestamp */;
293 	__le32 ts_recent /* The timestamp value to send in the next ACK */;
294 	__le32 ts_recent_age /* The length of time, in ms, since the most recent timestamp was received */;
295 	__le32 total_rt /* The total time, in ms, that has been spent retransmitting the current TCP segment */;
296 	__le32 ka_timeout_delta /* The time remaining, in clock ticks, until the next keepalive timeout. A value of -1 indicates that the keepalive timer was not running when the connection was offloaded. */;
297 	__le32 rt_timeout_delta /* The time remaining, in clock ticks, until the next retransmit timeout. A value of -1 indicates that the  retransmit timer was not running when the connection was offloaded. */;
298 	u8 dup_ack_cnt /* The number of ACKs that have been accepted for the same sequence number */;
299 	u8 snd_wnd_probe_cnt /* The current send window probe round */;
300 	u8 ka_probe_cnt /* the number of keepalive probes that have been sent that have not received a response */;
301 	u8 rt_cnt /* The number of retransmits that have been sent */;
302 	__le32 reserved;
303 };
304 
305 #endif /* __TCP_COMMON__ */
306