2 * Copyright (c) 2017-2018 Cavium, Inc.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
15 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
16 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
19 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25 * POSSIBILITY OF SUCH DAMAGE.
31 #ifndef __TCP_COMMON__
32 #define __TCP_COMMON__
33 /********************/
34 /* TCP FW CONSTANTS */
35 /********************/
37 #define TCP_INVALID_TIMEOUT_VAL -1
41 * OOO opaque data received from LL2
45 __le32 cid /* connection ID */;
46 u8 drop_isle /* isle number of the first isle to drop */;
47 u8 drop_size /* number of isles to drop */;
48 u8 ooo_opcode /* (use enum tcp_seg_placement_event) */;
49 u8 ooo_isle /* OOO isle number to add the packet to */;
54 * tcp connect mode enum
65 * tcp function init parameters
67 struct tcp_init_params
69 __le32 two_msl_timer /* 2MSL (used for TIME_WAIT state) timeout value */;
70 __le16 tx_sws_timer /* Transmission silly window syndrom timeout value */;
71 u8 maxFinRT /* Minimum Fin RT */;
88 * tcp offload parameters
90 struct tcp_offload_params
92 __le16 local_mac_addr_lo;
93 __le16 local_mac_addr_mid;
94 __le16 local_mac_addr_hi;
95 __le16 remote_mac_addr_lo;
96 __le16 remote_mac_addr_mid;
97 __le16 remote_mac_addr_hi;
100 #define TCP_OFFLOAD_PARAMS_TS_EN_MASK 0x1 /* timestamp enable */
101 #define TCP_OFFLOAD_PARAMS_TS_EN_SHIFT 0
102 #define TCP_OFFLOAD_PARAMS_DA_EN_MASK 0x1 /* delayed ack enabled */
103 #define TCP_OFFLOAD_PARAMS_DA_EN_SHIFT 1
104 #define TCP_OFFLOAD_PARAMS_KA_EN_MASK 0x1 /* keep alive enabled */
105 #define TCP_OFFLOAD_PARAMS_KA_EN_SHIFT 2
106 #define TCP_OFFLOAD_PARAMS_NAGLE_EN_MASK 0x1 /* nagle algorithm enabled */
107 #define TCP_OFFLOAD_PARAMS_NAGLE_EN_SHIFT 3
108 #define TCP_OFFLOAD_PARAMS_DA_CNT_EN_MASK 0x1 /* delayed ack counter enabled */
109 #define TCP_OFFLOAD_PARAMS_DA_CNT_EN_SHIFT 4
110 #define TCP_OFFLOAD_PARAMS_FIN_SENT_MASK 0x1 /* fin already sent to far end */
111 #define TCP_OFFLOAD_PARAMS_FIN_SENT_SHIFT 5
112 #define TCP_OFFLOAD_PARAMS_FIN_RECEIVED_MASK 0x1 /* fin received */
113 #define TCP_OFFLOAD_PARAMS_FIN_RECEIVED_SHIFT 6
114 #define TCP_OFFLOAD_PARAMS_RESERVED0_MASK 0x1
115 #define TCP_OFFLOAD_PARAMS_RESERVED0_SHIFT 7
124 __le16 mss /* the mss derived from remote mss and local mtu, ipVersion options and tags */;
126 u8 connect_mode /* TCP connect mode: use enum tcp_connect_mode */;
127 __le16 srtt /* in ms */;
128 __le32 cwnd /* absolute congestion window */;
137 __le32 snd_wnd /* absolute send window (not scaled) */;
138 __le32 rcv_wnd /* absolute receive window (not scaled) */;
139 __le32 snd_wl1 /* the segment sequence number used for the last window update */;
140 __le32 ts_recent /* The timestamp value to send in the next ACK */;
141 __le32 ts_recent_age /* The length of time, in ms, since the most recent timestamp was received */;
142 __le32 total_rt /* The total time, in ms, that has been spent retransmitting the current TCP segment */;
143 __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. */;
144 __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. */;
145 u8 dup_ack_cnt /* The number of ACKs that have been accepted for the same sequence number */;
146 u8 snd_wnd_probe_cnt /* The current send window probe round */;
147 u8 ka_probe_cnt /* the number of keepalive probes that have been sent that have not received a response */;
148 u8 rt_cnt /* The number of retransmits that have been sent */;
149 __le16 rtt_var /* in ms */;
150 __le16 fw_internal /* fw internal use - initialize value = 0 */;
151 __le32 ka_timeout /* This member specifies, in ms, the timeout interval for inactivity before sending a keepalive probe */;
152 __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 */;
153 __le32 max_rt_time /* This member specifies, in ms, the maximum time that the offload target should spend retransmitting a segment */;
154 __le32 initial_rcv_wnd /* Initial receive window */;
156 u8 ack_frequency /* delayed ack counter threshold */;
157 __le16 da_timeout_value /* delayed ack timeout value in ms */;
163 * tcp offload parameters
165 struct tcp_offload_params_opt2
167 __le16 local_mac_addr_lo;
168 __le16 local_mac_addr_mid;
169 __le16 local_mac_addr_hi;
170 __le16 remote_mac_addr_lo;
171 __le16 remote_mac_addr_mid;
172 __le16 remote_mac_addr_hi;
175 #define TCP_OFFLOAD_PARAMS_OPT2_TS_EN_MASK 0x1 /* timestamp enable */
176 #define TCP_OFFLOAD_PARAMS_OPT2_TS_EN_SHIFT 0
177 #define TCP_OFFLOAD_PARAMS_OPT2_DA_EN_MASK 0x1 /* delayed ack enabled */
178 #define TCP_OFFLOAD_PARAMS_OPT2_DA_EN_SHIFT 1
179 #define TCP_OFFLOAD_PARAMS_OPT2_KA_EN_MASK 0x1 /* keep alive enabled */
180 #define TCP_OFFLOAD_PARAMS_OPT2_KA_EN_SHIFT 2
181 #define TCP_OFFLOAD_PARAMS_OPT2_RESERVED0_MASK 0x1F
182 #define TCP_OFFLOAD_PARAMS_OPT2_RESERVED0_SHIFT 3
191 __le16 mss /* the mss derived from remote mss and local mtu, ipVersion options and tags */;
193 u8 connect_mode /* TCP connect mode: use enum tcp_connect_mode */;
194 __le16 syn_ip_payload_length /* length of Tcp header in SYN packet - relevent for passive mode */;
195 __le32 syn_phy_addr_lo /* physical address (low) of SYN buffer - relevent for passive mode */;
196 __le32 syn_phy_addr_hi /* physical address (high) of SYN buffer - relevent for passive mode */;
197 __le32 reserved1[22];
204 enum tcp_seg_placement_event
207 TCP_EVENT_ADD_NEW_ISLE,
208 TCP_EVENT_ADD_ISLE_RIGHT,
209 TCP_EVENT_ADD_ISLE_LEFT,
211 TCP_EVENT_DELETE_ISLES,
213 MAX_TCP_SEG_PLACEMENT_EVENT
218 * tcp init parameters
220 struct tcp_update_params
223 #define TCP_UPDATE_PARAMS_REMOTE_MAC_ADDR_CHANGED_MASK 0x1
224 #define TCP_UPDATE_PARAMS_REMOTE_MAC_ADDR_CHANGED_SHIFT 0
225 #define TCP_UPDATE_PARAMS_MSS_CHANGED_MASK 0x1
226 #define TCP_UPDATE_PARAMS_MSS_CHANGED_SHIFT 1
227 #define TCP_UPDATE_PARAMS_TTL_CHANGED_MASK 0x1
228 #define TCP_UPDATE_PARAMS_TTL_CHANGED_SHIFT 2
229 #define TCP_UPDATE_PARAMS_TOS_OR_TC_CHANGED_MASK 0x1
230 #define TCP_UPDATE_PARAMS_TOS_OR_TC_CHANGED_SHIFT 3
231 #define TCP_UPDATE_PARAMS_KA_TIMEOUT_CHANGED_MASK 0x1
232 #define TCP_UPDATE_PARAMS_KA_TIMEOUT_CHANGED_SHIFT 4
233 #define TCP_UPDATE_PARAMS_KA_INTERVAL_CHANGED_MASK 0x1
234 #define TCP_UPDATE_PARAMS_KA_INTERVAL_CHANGED_SHIFT 5
235 #define TCP_UPDATE_PARAMS_MAX_RT_TIME_CHANGED_MASK 0x1
236 #define TCP_UPDATE_PARAMS_MAX_RT_TIME_CHANGED_SHIFT 6
237 #define TCP_UPDATE_PARAMS_FLOW_LABEL_CHANGED_MASK 0x1
238 #define TCP_UPDATE_PARAMS_FLOW_LABEL_CHANGED_SHIFT 7
239 #define TCP_UPDATE_PARAMS_INITIAL_RCV_WND_CHANGED_MASK 0x1
240 #define TCP_UPDATE_PARAMS_INITIAL_RCV_WND_CHANGED_SHIFT 8
241 #define TCP_UPDATE_PARAMS_KA_MAX_PROBE_CNT_CHANGED_MASK 0x1
242 #define TCP_UPDATE_PARAMS_KA_MAX_PROBE_CNT_CHANGED_SHIFT 9
243 #define TCP_UPDATE_PARAMS_KA_EN_CHANGED_MASK 0x1
244 #define TCP_UPDATE_PARAMS_KA_EN_CHANGED_SHIFT 10
245 #define TCP_UPDATE_PARAMS_NAGLE_EN_CHANGED_MASK 0x1
246 #define TCP_UPDATE_PARAMS_NAGLE_EN_CHANGED_SHIFT 11
247 #define TCP_UPDATE_PARAMS_KA_EN_MASK 0x1
248 #define TCP_UPDATE_PARAMS_KA_EN_SHIFT 12
249 #define TCP_UPDATE_PARAMS_NAGLE_EN_MASK 0x1
250 #define TCP_UPDATE_PARAMS_NAGLE_EN_SHIFT 13
251 #define TCP_UPDATE_PARAMS_KA_RESTART_MASK 0x1
252 #define TCP_UPDATE_PARAMS_KA_RESTART_SHIFT 14
253 #define TCP_UPDATE_PARAMS_RETRANSMIT_RESTART_MASK 0x1
254 #define TCP_UPDATE_PARAMS_RETRANSMIT_RESTART_SHIFT 15
255 __le16 remote_mac_addr_lo;
256 __le16 remote_mac_addr_mid;
257 __le16 remote_mac_addr_hi;
265 __le32 initial_rcv_wnd;
272 * toe upload parameters
274 struct tcp_upload_params
280 __le32 snd_wnd /* absolute send window (not scaled) */;
281 __le32 rcv_wnd /* absolute receive window (not scaled) */;
282 __le32 snd_wl1 /* the segment sequence number used for the last window update */;
283 __le32 cwnd /* absolute congestion window */;
285 __le16 srtt /* in ms */;
286 __le16 rtt_var /* in ms */;
287 __le32 ts_time /* The current value of the adjusted timestamp */;
288 __le32 ts_recent /* The timestamp value to send in the next ACK */;
289 __le32 ts_recent_age /* The length of time, in ms, since the most recent timestamp was received */;
290 __le32 total_rt /* The total time, in ms, that has been spent retransmitting the current TCP segment */;
291 __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. */;
292 __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. */;
293 u8 dup_ack_cnt /* The number of ACKs that have been accepted for the same sequence number */;
294 u8 snd_wnd_probe_cnt /* The current send window probe round */;
295 u8 ka_probe_cnt /* the number of keepalive probes that have been sent that have not received a response */;
296 u8 rt_cnt /* The number of retransmits that have been sent */;
300 #endif /* __TCP_COMMON__ */