xref: /titanic_41/usr/src/uts/common/io/bnxe/577xx/include/l4states.h (revision f391a51a4e9639750045473dba1cc2831267c93e)
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 (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://www.opensolaris.org/os/licensing.
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  * Copyright 2014 QLogic Corporation
22  * The contents of this file are subject to the terms of the
23  * QLogic End User License (the "License").
24  * You may not use this file except in compliance with the License.
25  *
26  * You can obtain a copy of the License at
27  * http://www.qlogic.com/Resources/Documents/DriverDownloadHelp/
28  * QLogic_End_User_Software_License.txt
29  * See the License for the specific language governing permissions
30  * and limitations under the License.
31  *
32  ******************************************************************************/
33 
34 #ifndef _L4STATES_H
35 #define _L4STATES_H
36 
37 #include "bcmtype.h"
38 
39 
40 
41 /*******************************************************************************
42  * Disconnect type.
43  ******************************************************************************/
44 
45 typedef enum _l4_disconnect_type_t
46 {
47     L4_DISCONNECT_TYPE_GRACEFUL         = 1,
48     L4_DISCONNECT_TYPE_ABORTIVE         = 2,
49 } l4_disconnect_type_t;
50 
51 
52 
53 /*******************************************************************************
54  * Upload reason.
55  ******************************************************************************/
56 
57 typedef enum _l4_upload_reason_t
58 {
59     L4_UPLOAD_REASON_UNKNOWN            = 0,
60     L4_UPLOAD_REASON_URG                = 1,
61     L4_UPLOAD_REASON_FRAGMENT           = 2,
62     L4_UPLOAD_REASON_IP_OPTION          = 3,
63     L4_UPLOAD_REASON_KEEP_ALIVE_TIMEOUT = 4,
64     L4_UPLOAD_REASON_UPLOAD_REQUESTED   = 5,
65     L4_UPLOAD_REASON_LOW_ACTIVITY       = 6,
66     L4_UPLOAD_REASON_HIGH_DROP_RATE     = 7,
67     L4_UPLOAD_REASON_SMALL_IO           = 8,
68     L4_UPLOAD_REASON_NO_BUFFER_PRE_POSTING     = 9,
69     L4_UPLOAD_REASON_HIGH_OUT_OF_ORDER_PACKETS = 10,
70     L4_UPLOAD_REASON_RETRANSMIT_TIMEOUT = 11,
71     L4_UPLOAD_REASON_MAX
72 } l4_upload_reason_t;
73 
74 
75 
76 /*******************************************************************************
77 * TCP connection state.
78  ******************************************************************************/
79 
80 typedef enum _l4_tcp_con_state_t
81 {
82     L4_TCP_CON_STATE_UNDEFINED          = 0,
83     L4_TCP_CON_STATE_CLOSED             = 1,
84     L4_TCP_CON_STATE_SYN_SENT           = 2,
85     L4_TCP_CON_STATE_SYN_RCVD           = 3,
86     L4_TCP_CON_STATE_ESTABLISHED        = 4,
87     L4_TCP_CON_STATE_FIN_WAIT1          = 5,
88     L4_TCP_CON_STATE_FIN_WAIT2          = 6,
89     L4_TCP_CON_STATE_CLOSING            = 7,
90     L4_TCP_CON_STATE_CLOSE_WAIT         = 8,
91     L4_TCP_CON_STATE_LAST_ACK           = 9,
92     L4_TCP_CON_STATE_TIME_WAIT          = 10,
93     L4_TCP_CON_STATE_LISTEN             = 11,
94     L4_TCP_CON_STATE_MAX
95 } l4_tcp_con_state_t;
96 
97 
98 
99 /*******************************************************************************
100  * Neighbor information.
101  ******************************************************************************/
102 
103 typedef struct _l4_neigh_const_state_t
104 {
105     u8_t src_addr[8];
106     u16_t vlan_tag;     /* 4 MSBs are always 0 */
107 } l4_neigh_const_state_t;
108 
109 
110 typedef struct _l4_neigh_cached_state_t
111 {
112     u8_t dst_addr[8];
113 
114     u32_t host_reachability_delta;
115 } l4_neigh_cached_state_t;
116 
117 
118 typedef struct _l4_neigh_delegated_state_t
119 {
120     u32_t nic_reachability_delta;
121 } l4_neigh_delegated_state_t;
122 
123 
124 
125 /*******************************************************************************
126  * Path information.
127  ******************************************************************************/
128 
129 typedef struct _l4_path_const_state_t
130 {
131     u8_t ip_version;
132     #define IP_VERSION_IPV4     4
133     #define IP_VERSION_IPV6     6
134 
135     u8_t _pad[3];
136 
137     union _u_ip_type_t
138     {
139         struct _ip_v4_t
140         {
141             u32_t dst_ip;
142             u32_t src_ip;
143         } ipv4;
144 
145         struct _ip_v6_t
146         {
147             u32_t dst_ip[4];
148             u32_t src_ip[4];
149         } ipv6;
150     } u;
151 } l4_path_const_state_t;
152 
153 
154 typedef struct _l4_path_cached_state_t
155 {
156     u32_t path_mtu;
157 } l4_path_cached_state_t;
158 
159 
160 typedef struct _l4_path_delegated_state_t
161 {
162     u16_t ipv4_current_ip_id;
163     u16_t _pad;
164 } l4_path_delegated_state_t;
165 
166 
167 
168 /*******************************************************************************
169  * TCP destination and source ports.
170  ******************************************************************************/
171 
172 typedef struct _l4_tcp_const_state_t
173 {
174     u16_t tcp_flags;
175     #define TCP_FLAG_ENABLE_TIME_STAMP      0x0001
176     #define TCP_FLAG_ENABLE_SACK            0x0002
177     #define TCP_FLAG_ENABLE_WIN_SCALING     0x0004
178 
179     u16_t dst_port; /* in host order */
180     u16_t src_port; /* in host order */
181 
182     u16_t remote_mss;
183 
184     u8_t snd_seg_scale:4;   /* 0 if win scaling is disabled */
185     u8_t rcv_seg_scale:4;   /* 0 if win scaling is disabled */
186     u8_t _pad[3];
187 
188     u32_t hash_value;
189 } l4_tcp_const_state_t;
190 
191 
192 typedef struct _l4_tcp_cached_state_t
193 {
194     u16_t tcp_flags;
195     #define TCP_FLAG_ENABLE_KEEP_ALIVE      0x01
196     #define TCP_FLAG_ENABLE_NAGLING         0x02
197     #define TCP_FLAG_RESTART_KEEP_ALIVE     0x04
198     #define TCP_FLAG_RESTART_MAX_RT         0x08
199     #define TCP_FLAG_UPDATE_RCV_WINDOW      0x10
200 
201     u16_t _pad;
202 
203     u32_t initial_rcv_wnd;
204     u8_t ttl_or_hop_limit;
205     u8_t tos_or_traffic_class;
206     u8_t ka_probe_cnt;
207     u8_t user_priority; /* 5 MSBs are always 0 */
208     u32_t rcv_indication_size;
209     u32_t ka_time_out;
210     u32_t ka_interval;
211     u32_t max_rt;
212 
213     /* ipv6 fields. */
214     u32_t flow_label;
215 } l4_tcp_cached_state_t;
216 
217 
218 typedef struct _l4_tcp_delegated_state_t
219 {
220     u32_t con_state;  /* l4_tcp_con_state_t */
221 
222     u32_t recv_next;
223     u32_t recv_win_seq; /* ndis_tcp_delegated->RcvWnd + ndis_tcp_delegated->RcvNxt    */
224     u32_t send_una;
225     u32_t send_next;
226     u32_t send_max;
227     u32_t send_win;     /* ndis_tcp_delegated->SndWnd    + ndis_tcp_delegated->SndUna */
228     u32_t max_send_win; /* ndis_tcp_delegated->MaxSndWnd */
229     u32_t send_wl1;
230     u32_t send_cwin;    /* ndis_tcp_delegated->CWnd      + ndis_tcp_delegated->SndUna */
231     u32_t ss_thresh;
232     u16_t sm_rtt;       /* ndis_tcp_delegated->SRtt */
233     u16_t sm_delta;     /* ndis_tcp_delegated->RttVar */
234     u32_t tstamp;       /* ndis_tcp_delegated->TsTime */
235     u32_t ts_recent;
236     u32_t ts_recent_age;
237     u32_t total_rt;
238     u8_t dup_ack_count;
239     u8_t snd_wnd_probe_count;
240     u16_t _pad;
241 
242     /* TODO: remove the union in the next if version change. */
243     union _keep_alive_or_retransmit_t
244     {
245         struct _keep_alive_t
246         {
247             u8_t probe_cnt;
248             u32_t timeout_delta;
249         } keep_alive;
250 
251         struct _retransmit_t
252         {
253             u8_t num_retx;
254             u32_t retx_ms;
255         } retransmit;
256     } u;
257 } l4_tcp_delegated_state_t;
258 
259 
260 
261 /*******************************************************************************
262  * Set offload parameters.
263  ******************************************************************************/
264 
265 typedef struct _l4_ofld_params_t
266 {
267     u32_t flags;
268     #define OFLD_PARAM_FLAG_SNAP_ENCAP          0x0001
269 
270     u32_t ticks_per_second;
271     u8_t ack_frequency;
272     u8_t delayed_ack_ticks;
273     u8_t max_retx;
274     u8_t doubt_reachability_retx;
275     u32_t sws_prevention_ticks;
276     u32_t dup_ack_threshold;
277     u32_t push_ticks;
278     u32_t nce_stale_ticks;
279     u16_t starting_ip_id;
280     u16_t _pad;
281 } l4_ofld_params_t;
282 
283 
284 
285 #endif /* _L4STATES_H */
286 
287