1/*
2 * Copyright 2014-2017 Cavium, Inc.
3 * The contents of this file are subject to the terms of the Common Development
4 * and Distribution License, v.1,  (the "License").
5 *
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the License at available
9 * at http://opensource.org/licenses/CDDL-1.0
10 *
11 * See the License for the specific language governing permissions and
12 * limitations under the License.
13 */
14
15
16#ifndef _l5_defs_h_
17#define _l5_defs_h_
18
19#include "5706_reg.h"
20#include "l2_defs.h"
21#include "l2_ftq.h"
22
23/* data structure defs: */
24
25typedef struct ddp_tagged_msg_header
26{
27    u16_t   mpa_length;
28	u16_t   control;
29    u32_t   stag;
30	u64_t   to;
31} ddp_tagged_msg_header_t;
32
33typedef struct ddp_untagged_msg_header
34{
35    u16_t   mpa_length;
36	u16_t   control;
37	union
38	{
39        u32_t   reserved;
40        u32_t   invalidated_stag;
41    } rdmap_rsvd;
42	u32_t   queue_number;
43	u32_t   msn;
44	u32_t   mo;
45} ddp_untagged_msg_header_t;
46
47typedef struct rdmap_read_request_header
48{
49    ddp_untagged_msg_header_t  ddp_header;
50	u32_t  sink_stag;
51	u64_t  sink_to;
52	u32_t  length;
53	u32_t  source_stag;
54	u64_t  source_to;
55} rdmap_read_request_header_t;
56
57
58/****************************************************************************
59 * L5 Window Reference Count Table Entry
60 ****************************************************************************/
61
62typedef struct l5_window_ref_cnt_table_entry
63{
64    u8_t wrcte_pidx;    /* Incremented by CP whenever a SQ work request or
65                           incoming RDMA Read Request is processed that
66                           references the associated window for source data. */
67
68    u8_t wrcte_cidx;    /* Incremented by COM whenever an entry is removed from
69                           the command queue where the associated window is
70                           the data source. */
71
72} l5_window_ref_cnt_table_entry_t;
73
74
75/* constants and macros: */
76
77#define   RDMA_WRITE_CMD      0
78#define   RDMA_READ_REQ_CMD   1
79#define   RDMA_READ_RSP_CMD   2
80#define   RDMA_SEND_CMD       3
81#define   RDMA_SEND_W_EVENT   4
82
83#define   RDMA_MPA_HDR_LENGTH            2
84#define   RDMA_MPA_CRC_LENGTH            4
85#define   RDMA_MPA_MARKER_SIZE           4
86
87#define   RDMA_DDP_TAGGED_HDR_LENGTH     14
88#define   RDMA_DDP_UNTAGGED_HDR_LENGTH   18
89
90#define   RDMA_READ_REQ_MSG_LENGTH       28
91
92#define   RDMA_WRITE_HDR_LENGTH          (RDMA_MPA_HDR_LENGTH + RDMA_DDP_TAGGED_HDR_LENGTH)
93#define   RDMA_SEND_MSG_HDR_LENGTH       (RDMA_MPA_HDR_LENGTH + RDMA_DDP_UNTAGGED_HDR_LENGTH)
94#define   RDMA_READ_REQ_HDR_LENGTH       (RDMA_MPA_HDR_LENGTH + RDMA_DDP_UNTAGGED_HDR_LENGTH + RDMA_READ_REQ_MSG_LENGTH)
95#define   RDMA_READ_RESP_HDR_LENGTH      (RDMA_MPA_HDR_LENGTH + RDMA_DDP_TAGGED_HDR_LENGTH)
96
97#define   RDMA_STANDARD_L5_OVERHEAD (RDMA_STANDARD_HDR_LENGTH + RDMA_MPA_HDR_LENGTH + RDMA_MPA_CRC_LENGTH)
98#define   RDMA_READ_REQ_L5_OVERHEAD (RDMA_READ_REQ_HDR_LENGTH + RDMA_MPA_HDR_LENGTH + RDMA_MPA_CRC_LENGTH)
99
100#define   RDMA_SEND_QUEUE_NUMBER    0x00000000
101#define   RDMA_READ_QUEUE_NUMBER    0x00000001
102#define   RDMA_TERM_QUEUE_NUMBER    0x00000002
103
104#define   RDMA_MPA_MARKER_INTERVAL       512                                                /* MPA marker interval */
105#define   RDMA_DATA_MARKER_INTERVAL      (RDMA_MPA_MARKER_INTERVAL - RDMA_MPA_MARKER_SIZE)  /* Data between markers */
106#define   RDMA_MPA_MARKER_INTERVAL_SHIFT   9
107
108#define   DDP_CTRL_RDMA_WRITE           0x8000
109#define   DDP_CTRL_RDMA_READ_REQ        0x0001
110#define   DDP_CTRL_RDMA_READ_RSP        0x8002
111#define   DDP_CTRL_SEND_MSG             0x0003
112#define   DDP_CTRL_SEND_INV_MSG         0x0004
113#define   DDP_CTRL_SEND_EVT_MSG         0x0005
114#define   DDP_CTRL_SEND_INV_EVT_MSG     0x0006
115
116#define   DDP_CTRL_L_BIT                0x4000
117#define   DDP_CTRL_T_BIT                0x8000
118
119#define   DDP_CTRL_DDP_VERSION_MASK     0x0300
120#define   DDP_CTRL_DDP_VERSION          0x0000
121
122#define   DDP_TAGGED_HDR_LENGTH         14
123#define   DDP_UNTAGGED_HDR_LENGTH       18
124
125#define   DDP_QN_SEND_MESSAGE_QUEUE       0x00000000
126#define   DDP_QN_RDMA_READ_REQUEST_QUEUE  0x00000001
127#define   DDP_QN_RDMA_TERMINATE_QUEUE     0x00000002
128
129#define   DDP_MAX_UNTAGGED_QUEUES         0x00000003
130
131#define   RDMAP_CTRL_RDMAP_VERSION_MASK   0x00C0
132#define   RDMAP_CTRL_RDMAP_VERSION        0x0000
133
134#define   RDMAP_CTRL_RDMAP_OPCODE_MASK    0x0F
135
136#define   RDMAP_CTRL_RDMA_WRITE           0x00
137#define   RDMAP_CTRL_RDMA_READ_REQ        0x01
138#define   RDMAP_CTRL_RDMA_READ_RSP        0x02
139#define   RDMAP_CTRL_SEND_MSG             0x03
140#define   RDMAP_CTRL_SEND_W_INV_MSG       0x04
141#define   RDMAP_CTRL_SEND_W_EVT_MSG       0x05
142#define   RDMAP_CTRL_SEND_W_INV_EVT_MSG   0x06
143
144#define   L5_MEMORY_REGION_STAG_BIT       0x00800000
145#define   L5_STAG_INDEX_MASK              0x00FFFFFF
146#define   L5_STAG_KEY_MASK                0xFF000000
147#define   L5_MIN_HOST_PAGE_SIZE           0x100    /* 256 bytes */
148#define   L5_WINDOW_CACHE_KEY_BASE        0x2000
149
150
151/* define context memory-related constants for things
152   like STag validation: */
153
154#define   L5_RX_VCID_SIZE                 128
155
156
157/* L5 RxP protocol errors: */
158
159#define   RX_PROTO_ERR_MPA_LEN_NON_MULT_FOUR     0x00000001
160#define   RX_PROTO_ERR_INVALID_MPA_LEN           0x00000002
161#define   RX_PROTO_ERR_INVALID_MARKER            0x00000003
162#define   RX_PROTO_ERR_INVALID_TAGGED_OPCODE     0x00000004
163#define   RX_PROTO_ERR_INVALID_UNTAGGED_OPCODE   0x00000005
164
165#define   RX_PROTO_ERR_STAG_INVALID              0x00000006
166#define   RX_PROTO_ERR_STAG_BASE_BOUNDS          0x00000007
167#define   RX_PROTO_ERR_STAG_ACCESS_RIGHTS        0x00000008
168#define   RX_PROTO_ERR_STAG_PROTECTION           0x00000009
169#define   RX_PROTO_ERR_STAG_TO_WRAP              0x0000000A
170
171#define   RX_PROTO_ERR_INVALID_DDP_VERSION       0x0000000B
172#define   RX_PROTO_ERR_INVALID_RDMAP_VERSION     0x0000000C
173#define   RX_PROTO_ERR_INVALID_DDP_QUEUE_NUMBER  0x0000000D
174#define   RX_PROTO_ERR_IRD_EXCEEDED              0x0000000E
175
176#define   RX_PROTO_ERR_MSN_GAP                   0x0000000F
177#define   RX_PROTO_ERR_MSN_RANGE                 0x00000010
178
179#define   RX_PROTO_ERR_NO_RCV_BUFF_AVAIL         0x00000011
180#define   RX_PROTO_ERR_RCV_BASE_BOUNDS           0x00000012
181#define   RX_PROTO_ERR_RCV_MO_WRAP               0x00000013
182
183#define   RX_PROTO_ERR_INVALID_MPA_CRC           0x00000014
184
185#define   RX_PROTO_ERR_NO_RCV_BUFF_POSTED        0x00000080
186
187#define   RX_PROTO_ERR_TERM_MSG_RECEIVED         0x000000FF
188
189/* L5 */
190#define L5_TCP_MAX_DACK		2
191
192/* Iscsi */
193
194//#define THIN_CONN_ESTAB
195
196#define RDMA_CONFIG_CRC_OFFSET_SHIFT	18
197
198#define VCID_SIZE          128
199#define VCID_SHIFT         7
200
201#define CID_ENC(_idx)      ((_idx)<<VCID_SHIFT)
202
203#define CID_ISCSI_CONF_PARAMS CID_ENC(46) // context ID of iSCSI configuration params
204
205#define	MAX_RQ_BUF_SIZE			256
206#define ISCSI_CRC_SIZE			4
207#define ISCSI_CRC_SIZE_LOG2		2
208#define ISCSI_HDR_SIZE			48
209#define ISCSI_CRC_RESULT		0x1c2d19ed
210
211#define ISCSI_CRC_TABLE_SIZE 256
212
213#define ISCSI_PROCESS_ERROR			(-1)
214#define ISCSI_PROCESS_WARNING		(-2)
215#define ISCSI_SILENT_DROP			(-3)
216
217/* Completion types */
218#define ISCSI_COMP_TYPE_MP			(0<<0)
219#define ISCSI_COMP_TYPE_FP			(1<<0)
220
221/* Command types for placement in RV2P */
222#define ISCSI_PLACE_TYPE_RQ			(0<<0)
223#define ISCSI_PLACE_TYPE_SGL		(1<<0)
224
225/* RV2P iscsi placement opcodes */
226#define GENERIC_OPCODE_RV2PPQ_VALUE_ISCSI_SGL_PLACE	(22<<0)
227#define GENERIC_OPCODE_RV2PPQ_VALUE_ISCSI_RQ_PLACE 	(23<<0)
228#define GENERIC_OPCODE_RV2PPQ_VALUE_ISCSI_RQ_FLUSH	(24<<0)
229#define GENERIC_OPCODE_RV2PPQ_VALUE_ISCSI_SGL_FLUSH	(25<<0)
230
231/* COM L5 (iSCSI/RDMA) opaque types */
232#define L5_OPAQUE_TCP_ACK_TYPE			(0x80)
233#define L5_OPAQUE_TCP_ERROR_TYPE		(0x81)
234
235/* COM iSCSI opaque types */
236#define ISCSI_OPAQUE_COMPLETION_TYPE	(0x82)
237#define ISCSI_OPAQUE_FREE_MBUF_TYPE		(0x83)
238#define ISCSI_OPAQUE_ERROR_TYPE			(0x84)
239#define ISCSI_OPAQUE_FREE_CU_MBUF_TYPE  (0x85)
240
241#define HDR_ISCSI_OPCODE			(0x3f<<0)
242
243#define ISCSI_INVALID_VALUE			(0xffffffff)
244
245#define TCP_L5CM_MAX_RETRIES 3
246
247typedef struct iscsi_ctx_offsets
248{
249    u32_t task_offset;     // offset of the task array
250    u32_t r2tq_offset;     // offset of R2TQ section
251
252    u32_t max_num_of_tasks;     // maximal number of pending tasks
253    u32_t max_num_of_ccells;    // maximal number of ccells
254} iscsi_ctx_offsets_t;
255
256
257/*
258 *  rv2ppq_iscsi_sgl_place definition
259 */
260typedef struct rv2ppq_iscsi_sgl_place
261{
262	u32_t	iscsi_sgl_place_cid;
263	u32_t 	iscsi_sgl_place_mbuf_cluster;
264	u16_t 	iscsi_sgl_place_operand_flags;
265		#define ISCSI_PLACE_OPERAND_FLAGS_LAST_PKT		(1<<7)
266        #define ISCSI_PLACE_OPERAND_FLAGS_FLUSH			(1<<11)
267		#define ISCSI_PLACE_OPERAND_FLAGS_USE_SEED		(1<<12)
268		#define ISCSI_PLACE_OPERAND_FLAGS_DIGEST_EN		(1<<13)
269		#define ISCSI_PLACE_OPERAND_FLAGS_COMPLETE		(1<<14)
270        /* overloading bit 14 */
271        #define ISCSI_PLACE_OPERAND_FLAGS_CU_PKT        (1<<14)
272		#define ISCSI_PLACE_OPERAND_FLAGS_FREE_MBUF		(1<<15)
273
274	u8_t	iscsi_sgl_place_tcp_flags;
275	u8_t	iscsi_sgl_place_opcode;
276    u16_t 	iscsi_sgl_place_offset; //cut in COM
277	u16_t 	iscsi_sgl_place_length; //cut in COM
278	u16_t 	iscsi_sgl_place_ctx_offset_to_pad_baddr;
279	u16_t 	iscsi_sgl_place_num_pad_bytes;
280	u32_t	iscsi_sgl_place_reserved1;
281	u32_t	iscsi_sgl_place_tcp_ack_sn;
282	u32_t	iscsi_sgl_place_reserved2[2]; //cut in COM
283	u32_t	iscsi_sgl_place_crc_seed;
284		#define ISCSI_PLACE_CRC_SEED_VAL		(0xFFFFFFFF)
285
286	u32_t	iscsi_sgl_place_task_cache_key;
287	u32_t	iscsi_sgl_place_task_cid;
288	u32_t	iscsi_sgl_place_rdma_action;
289} rv2ppq_iscsi_sgl_place_t;
290
291/*
292 *  rv2ppq_iscsi_rq_place definition
293 */
294typedef struct rv2ppq_iscsi_rq_place
295{
296	u32_t	iscsi_rq_place_cid;
297	u32_t	iscsi_rq_place_mbuf_cluster;
298	u16_t	iscsi_rq_place_operand_flags;
299		#define ISCSI_PLACE_OPERAND_FLAGS_PAGE_SIZE_SHIFT	(8)
300		#define ISCSI_PLACE_OPERAND_FLAGS_PAGE_SIZE_MASK	(0xf<<8)
301
302	u8_t	iscsi_rq_place_tcp_flags;
303	u8_t	iscsi_rq_place_opcode;
304	u16_t	iscsi_rq_place_offset; //cut in COM
305	u16_t	iscsi_rq_place_length; //cut in COM
306	u16_t	iscsi_rq_place_ctx_offset_to_pad_baddr;
307	u16_t 	iscsi_rq_place_num_pad_bytes;
308    u32_t	iscsi_rq_place_first_page_offset;
309	u32_t	iscsi_rq_place_tcp_ack_sn;
310	u32_t	iscsi_rq_place_page_table_base_addr_h; //cut in COM
311	u32_t	iscsi_rq_place_page_table_base_addr_l; //cut in COM
312	u32_t	iscsi_rq_place_crc_seed;
313	u32_t	iscsi_rq_place_rbdc_key;
314    u32_t	iscsi_rq_place_rq_buffer_offset;
315	u32_t	iscsi_rq_place_rdma_action;
316} rv2ppq_iscsi_rq_place_t;
317
318/*
319 *  rv2ppq_iscsi_sgl_flush definition
320 */
321typedef struct rv2ppq_iscsi_sgl_flush
322{
323	u32_t	iscsi_sgl_flush_task_cid;
324	u32_t 	iscsi_sgl_flush_unused_a;
325	u16_t	iscsi_sgl_flush_unsused_b;
326	u8_t	iscsi_sgl_flush_unsused_c;
327	u8_t	iscsi_sgl_flush_opcode;
328	u32_t	iscsi_sgl_flush_unsused_d[9];
329} rv2ppq_iscsi_sgl_flush_t;
330
331/*
332 *  rv2ppq_iscsi_rq_flush definition
333 */
334typedef struct rv2ppq_iscsi_rq_flush
335{
336	u32_t	iscsi_rq_flush_cid;
337	u32_t	iscsi_rq_flush_unsused_a;
338	u16_t	iscsi_rq_flush_unsused_b;
339	u8_t	iscsi_rq_flush_unsused_c;
340	u8_t	iscsi_rq_flush_opcode;
341	u32_t	iscsi_rq_flush_unsused_d;
342	u16_t	iscsi_rq_flush_rbdc_key;
343	u16_t	iscsi_rq_flush_unsused_e;
344	u32_t	iscsi_rq_flush_unsused_f[7];
345	u32_t	iscsi_rq_flush_rdma_spec;
346} rv2ppq_iscsi_rq_flush_t;
347
348/*
349 *  comq_iscsi_sgl_place definition
350 */
351typedef struct comq_iscsi_sgl_place
352{
353	u32_t	cid;
354	u32_t	mbuf_cluster;
355	u16_t	operand_flags;
356	u8_t	tcp_flags;
357	u8_t	opcode;
358	u16_t   ctx_offset_to_pad_baddr;
359	u16_t	num_pad_bytes;
360	u32_t   unused;
361	u32_t   tcp_ack_sn;
362	u32_t   crc_result;
363	u32_t   reserved;
364	u32_t   task_cid;
365
366} comq_iscsi_sgl_place_t;
367
368typedef struct itt32_fields
369{
370	u32_t   task_rsrv	: 16;
371	u32_t 	task_type 	: 2;
372	u32_t   task_idx 	: 14;
373
374} itt32_fields_t;
375
376typedef union itt32_union
377{
378    itt32_fields_t 	fields;
379    u32_t           itt32;
380
381} itt32_union_t;
382
383/*
384 *  rv2ppq_opaque_iscsi definition
385 */
386typedef struct rv2ppq_opaque_iscsi_comp_msg_a
387{
388	u32_t	cid;
389	u8_t	unused_a;
390	u8_t	iscsi_err_code;
391    u16_t	hdr_itt;
392	u16_t	opaque_flags_opcode;
393	u8_t	tcp_flags;				// Only 8 bits relevant
394	u8_t	opcode;
395	u16_t 	o_iscsi_unused_b[2];
396	u32_t	hdr_dword0;
397	u32_t	hdr_dword1;
398	u32_t	tcp_ack_sn;
399    u32_t 	o_iscsi_unused_c[2];
400	u32_t	hdr_exp_cmd_sn;
401	u32_t	hdr_max_cmd_sn;
402	u32_t	hdr_res_count;
403} rv2ppq_opaque_iscsi_comp_msg_a_t;
404
405typedef struct rv2ppq_opaque_iscsi_comp_msg_b
406{
407	u32_t	cid;
408	u32_t	reserved0;
409    u16_t	opaque_flags_opcode;
410	u8_t	reserved1;
411	u8_t	opcode;
412	u16_t 	o_iscsi_unused_a[2];
413    u32_t	hdr_dword2;
414	u32_t	hdr_dword3;
415	u32_t	hdr_ttt;
416    u32_t 	o_iscsi_unused_b[2];
417	u32_t	hdr_stat_sn;
418	u32_t	hdr_dword9;
419	u32_t	hdr_dword10;
420} rv2ppq_opaque_iscsi_comp_msg_b_t;
421
422typedef struct rv2ppq_opaque_iscsi_free_mbuf
423{
424	u32_t	cid;
425	u32_t 	mbuf_cluster;
426	u16_t	opaque_flags_opcode;
427	u8_t	rsrv;
428	u8_t	opcode;
429	u16_t 	o_iscsi_unused_a[2];
430	u16_t 	o_iscsi_allowed16[6];
431	u32_t 	o_iscsi_unused_b[2];
432	u32_t 	o_iscsi_allowed32[3];
433} rv2ppq_opaque_iscsi_free_mbuf_t;
434
435typedef union rv2ppq_opaque_iscsi
436{
437	rv2ppq_opaque_iscsi_comp_msg_a_t	rv2p_o_comp_msg_a;
438    rv2ppq_opaque_iscsi_comp_msg_b_t	rv2p_o_comp_msg_b;
439	rv2ppq_opaque_iscsi_free_mbuf_t		rv2p_o_free_mbuf;
440
441} rv2ppq_opaque_iscsi_t;
442
443// Used for TCP messages from RXP to COM (Mutual to RDMA and iSCSI)
444typedef struct rv2ppq_opaque_l5
445{
446	u32_t	cid;
447	u32_t 	o_l5_allowed32_a;
448	u16_t	opaque_flags_opcode;
449	u8_t	tcp_flags;
450	u8_t	opcode;
451	u16_t 	o_l5_unused_a[2];
452	u16_t 	o_l5_allowed16[4];
453	u32_t	tcp_ack_sn;
454	u32_t 	o_l5_unused_b[2];
455	u32_t 	o_l5_allowed32_b[3];
456} rv2ppq_opaque_l5_t;
457
458/*
459 *  comq_opaque_iscsi definition
460 */
461typedef struct comq_opaque_iscsi_comp_msg_a
462{
463	u32_t	cid;
464	u8_t	unused;
465	u8_t	iscsi_err_code;
466    u16_t	hdr_itt;
467	u16_t	opaque_flags_opcode;
468	u8_t	tcp_flags;				// Only 8 bits relevant
469	u8_t	opcode;
470    u32_t	hdr_dword0;
471	u32_t	hdr_dword1;
472	u32_t	tcp_ack_sn;
473	u32_t	hdr_exp_cmd_sn;
474	u32_t	hdr_max_cmd_sn;
475	u32_t	hdr_res_count;
476
477} comq_opaque_iscsi_comp_msg_a_t;
478
479typedef struct comq_opaque_iscsi_comp_msg_b
480{
481	u32_t	cid;
482	u32_t	reserved0;
483	u16_t	opaque_flags_opcode;
484	u8_t	reserved1;
485	u8_t	opcode;
486	u32_t	hdr_dword2;
487	u32_t	hdr_dword3;
488    u32_t	hdr_ttt;
489	u32_t	hdr_stat_sn;
490	u32_t	hdr_dword9;
491	u32_t	hdr_dword10;
492
493} comq_opaque_iscsi_comp_msg_b_t;
494
495typedef union comq_opaque_iscsi
496{
497	comq_opaque_iscsi_comp_msg_a_t 	com_o_comp_msg_a;
498	comq_opaque_iscsi_comp_msg_b_t 	com_o_comp_msg_b;
499
500} comq_opaque_iscsi_t;
501
502// TCP opaque message for L5 (no data)
503typedef struct comq_opaque_l5
504{
505	u32_t	cid;
506	u32_t 	o_l5_allowed32_a;
507	u16_t	opaque_flags_opcode;
508	u8_t	tcp_flags;
509	u8_t	opcode;
510	u16_t 	o_l5_allowed16[4];
511	u32_t	tcp_ack_sn;
512    u32_t 	o_l5_allowed32_b[3];
513
514} comq_opaque_l5_t;
515
516typedef struct rv2ppq_opaque_iscsi_kcqe_comp
517{
518    u32_t cid;
519    u32_t iscsi_conn_id;
520    u16_t opaque_flags_opcode;
521    u8_t reserved1;
522    u8_t opcode;
523    u16_t unused_a[2];
524	u32_t reserved2[3];
525    u32_t unused_b[2];
526	u32_t status_code;
527    u32_t reserved3[2];
528} rv2ppq_opaque_iscsi_kcqe_comp_t;
529
530typedef struct comq_opaque_iscsi_kcqe_comp
531{
532	u32_t cid;
533	u32_t iscsi_conn_id;
534	u16_t opaque_flags_opcode;
535	u8_t reserved1;
536	u8_t opcode;
537	u32_t reserved2[3];
538	u32_t status_code;
539	u32_t reserved3[2];
540
541} comq_opaque_iscsi_kcqe_comp_t;
542
543// L5 context manager parameters context struct
544typedef struct l5_cm_fixed_connect_context
545{
546    u32_t fixed_seed /* 32 bits of secret passed by the driver for port 0 */;
547    u32_t rsrv[31] /*  */;
548
549} l5_cm_fixed_connect_context_t;
550
551// TCP general message for L5
552typedef struct comq_l5_tcp
553{
554	u32_t	cid;
555	u32_t	reserved0;
556	u16_t	reserved1;
557	u8_t	tcp_flags;
558		#define L5_FLAGS_TCP_SMALL_WIN		(1<<0)
559		#define L5_FLAGS_TCP_SILENT_DROP	(1<<1)
560		#define L5_FLAGS_TCP_RELEASE_MBUF	(1<<2)
561		#define L5_FLAGS_TCP_ACK_PROCESS	(1<<3)
562		#define L5_FLAGS_TCP_PURE_ACK		(1<<4) // No payload and no window update
563		#define L5_FLAGS_TCP_IP_FRAG		(1<<5)
564		#define L5_FLAGS_TCP_IP_OPTION		(1<<6)
565		#define L5_FLAGS_TCP_URGENT_FLAG	(1<<7)
566
567	u8_t	reserved2;
568    u32_t	reserved3[2];
569	u32_t	tcp_ack_sn;
570	u32_t	reserved4[3];
571
572} comq_l5_tcp_t;
573
574
575
576
577/*
578 *  rv2ppq_l5_place definition
579 */
580typedef struct rv2ppq_l5_place_b
581{
582    u32_t l5_place_cid;
583    u32_t l5_place_mbuf_cluster;
584    u16_t l5_place_operand_flags;
585        #define L5_PLACE_OPERAND_FLAGS_MARKERS_PRESENT      (1<<0)
586        #define L5_PLACE_OPERAND_FLAGS_NEW_ISLAND           (1<<1)
587        #define L5_PLACE_OPERAND_FLAGS_TCP_HOLE_CLOSED      (1<<2)
588        #define L5_PLACE_OPERAND_FLAGS_IN_ORDER             (1<<3)
589        #define L5_PLACE_OPERAND_FLAGS_LBIT_STATUS          (1<<4)
590        #define L5_PLACE_OPERAND_FLAGS_FLUSH                (1<<5)
591        #define L5_PLACE_OPERAND_FLAGS_PG_SZ                (0xf<<8)
592            #define L5_PLACE_OPERAND_FLAGS_PG_SZ_256        (0<<8)
593            #define L5_PLACE_OPERAND_FLAGS_PG_SZ_512        (1<<8)
594            #define L5_PLACE_OPERAND_FLAGS_PG_SZ_1K         (2<<8)
595            #define L5_PLACE_OPERAND_FLAGS_PG_SZ_2K         (3<<8)
596            #define L5_PLACE_OPERAND_FLAGS_PG_SZ_4K         (4<<8)
597            #define L5_PLACE_OPERAND_FLAGS_PG_SZ_8K         (5<<8)
598            #define L5_PLACE_OPERAND_FLAGS_PG_SZ_16K        (6<<8)
599            #define L5_PLACE_OPERAND_FLAGS_PG_SZ_32K        (7<<8)
600            #define L5_PLACE_OPERAND_FLAGS_PG_SZ_64K        (8<<8)
601            #define L5_PLACE_OPERAND_FLAGS_PG_SZ_128K       (9<<8)
602            #define L5_PLACE_OPERAND_FLAGS_PG_SZ_256K       (10<<8)
603            #define L5_PLACE_OPERAND_FLAGS_PG_SZ_512K       (11<<8)
604            #define L5_PLACE_OPERAND_FLAGS_PG_SZ_1M         (12<<8)
605            #define L5_PLACE_OPERAND_FLAGS_PG_SZ_2M         (13<<8)
606            #define L5_PLACE_OPERAND_FLAGS_PG_SZ_4M         (14<<8)
607            #define L5_PLACE_OPERAND_FLAGS_PG_SZ_8M         (15<<8)
608
609    u8_t l5_place_knum;
610    u8_t l5_place_opcode;
611    u16_t l5_place_offset;
612    u16_t l5_place_length;
613    u16_t l5_place_offset_to_first_marker;
614    u16_t l5_place_rbdc_key;
615    u32_t l5_place_first_page_offset;
616    u16_t l5_place_l5_header_length;
617    u16_t l5_place_l5_cmd_type;
618        #define L5_PLACE_L5_CMD_TYPE_CMD_VALUE              (0xf<<0)
619            #define L5_PLACE_L5_CMD_TYPE_CMD_VALUE_UNDEFINED  (0<<0)
620            #define L5_PLACE_L5_CMD_TYPE_CMD_VALUE_SEND     (1<<0)
621            #define L5_PLACE_L5_CMD_TYPE_CMD_VALUE_SEND_W_SE  (2<<0)
622            #define L5_PLACE_L5_CMD_TYPE_CMD_VALUE_SEND_W_INV  (3<<0)
623            #define L5_PLACE_L5_CMD_TYPE_CMD_VALUE_SEND_W_SE_INV  (4<<0)
624            #define L5_PLACE_L5_CMD_TYPE_CMD_VALUE_RDMA_WRITE  (5<<0)
625            #define L5_PLACE_L5_CMD_TYPE_CMD_VALUE_RDMA_READ  (6<<0)
626            #define L5_PLACE_L5_CMD_TYPE_CMD_VALUE_RDMA_READ_W_INV  (7<<0)
627            #define L5_PLACE_L5_CMD_TYPE_CMD_VALUE_WINDOW_BIND  (8<<0)
628            #define L5_PLACE_L5_CMD_TYPE_CMD_VALUE_FAST_REGISTER  (9<<0)
629            #define L5_PLACE_L5_CMD_TYPE_CMD_VALUE_LOCAL_INVALIDATE  (10<<0)
630            #define L5_PLACE_L5_CMD_TYPE_CMD_VALUE_RDMA_READ_RESPONSE  (11<<0)
631            #define L5_PLACE_L5_CMD_TYPE_CMD_VALUE_TCP_ACK  (12<<0)
632
633    u32_t l5_place_page_table_base_addr_h;
634    u32_t l5_place_page_table_base_addr_l;
635    u32_t l5_place_tcp_ack_seq;
636    u32_t l5_place_sink_bfr_target_offset_h;
637    u32_t l5_place_sink_bfr_target_offset_l;
638    u8_t l5_place_rdma_action;  // no need to be cleared by RXP, RV2P will do it
639    u8_t l5_place_cs16_pkt_len;
640    u16_t l5_place_cs16;
641} rv2ppq_l5_place_b_t;
642
643typedef struct rv2ppq_l5_place_l
644{
645    u32_t l5_place_cid;
646    u32_t l5_place_mbuf_cluster;
647    u8_t l5_place_opcode;
648    u8_t l5_place_knum;
649    u16_t l5_place_operand_flags;
650    u16_t l5_place_length;
651    u16_t l5_place_offset;
652    u16_t l5_place_rbdc_key;
653    u16_t l5_place_offset_to_first_marker;
654    u32_t l5_place_first_page_offset;
655    u16_t l5_place_l5_cmd_type;
656    u16_t l5_place_l5_header_length;
657    u32_t l5_place_page_table_base_addr_h;
658    u32_t l5_place_page_table_base_addr_l;
659    u32_t l5_place_tcp_ack_seq;
660    u32_t l5_place_sink_bfr_target_offset_h;
661    u32_t l5_place_sink_bfr_target_offset_l;
662    u16_t l5_place_cs16;
663    u8_t l5_place_cs16_pkt_len;
664    u8_t l5_place_rdma_action;  // no need to be cleared by RXP, RV2P will do it
665} rv2ppq_l5_place_l_t;
666
667#if defined(LITTLE_ENDIAN)
668    typedef rv2ppq_l5_place_l_t rv2ppq_l5_place_t;
669#elif defined(BIG_ENDIAN)
670    typedef rv2ppq_l5_place_b_t rv2ppq_l5_place_t;
671#endif
672
673
674/*
675 *  rv2ppq_l5_flush definition
676 */
677typedef struct rv2ppq_l5_flush_b
678{
679    u32_t unused_0[2];
680    u16_t unused_1;
681    u8_t unused_2;
682    u8_t l5_flush_opcode;
683    u32_t unused_3;
684    u16_t l5_flush_rbdc_key;
685    u16_t unused_4;
686    u32_t unused_5[7];
687    u8_t l5_flush_rdma_action;  // no need to be cleared by RXP, RV2P will do it
688    u8_t l5_flush_cs16_pkt_len;
689    u16_t l5_flush_cs16;
690} rv2ppq_l5_flush_b_t;
691
692typedef struct rv2ppq_l5_flush_l
693{
694    u32_t unused_0[2];
695    u8_t l5_flush_opcode;
696    u8_t unused_2;
697    u16_t unused_1;
698    u32_t unused_3;
699    u16_t unused_4;
700    u16_t l5_flush_rbdc_key;
701    u32_t unused_5[7];
702    u16_t l5_flush_cs16;
703    u8_t l5_flush_cs16_pkt_len;
704    u8_t l5_flush_rdma_action;  // no need to be cleared by RXP, RV2P will do it
705} rv2ppq_l5_flush_l_t;
706
707#if defined(LITTLE_ENDIAN)
708    typedef rv2ppq_l5_flush_l_t rv2ppq_l5_flush_t;
709#elif defined(BIG_ENDIAN)
710    typedef rv2ppq_l5_flush_b_t rv2ppq_l5_flush_t;
711#endif
712
713
714
715/*
716 *  comq_l5_place definition
717 */
718typedef struct comq_l5_place_b
719{
720    u32_t l5_place_cid;
721    u32_t l5_place_mbuf_cluster;
722    u16_t l5_place_operand_flags;
723        #define L5_PLACE_OPERAND_FLAGS_MARKERS_PRESENT      (1<<0)
724        #define L5_PLACE_OPERAND_FLAGS_NEW_ISLAND           (1<<1)
725        #define L5_PLACE_OPERAND_FLAGS_TCP_HOLE_CLOSED      (1<<2)
726        #define L5_PLACE_OPERAND_FLAGS_IN_ORDER             (1<<3)
727        #define L5_PLACE_OPERAND_FLAGS_LBIT_STATUS          (1<<4)
728        #define L5_PLACE_OPERAND_FLAGS_PG_SZ                (0xf<<8)
729            #define L5_PLACE_OPERAND_FLAGS_PG_SZ_256        (0<<8)
730            #define L5_PLACE_OPERAND_FLAGS_PG_SZ_512        (1<<8)
731            #define L5_PLACE_OPERAND_FLAGS_PG_SZ_1K         (2<<8)
732            #define L5_PLACE_OPERAND_FLAGS_PG_SZ_2K         (3<<8)
733            #define L5_PLACE_OPERAND_FLAGS_PG_SZ_4K         (4<<8)
734            #define L5_PLACE_OPERAND_FLAGS_PG_SZ_8K         (5<<8)
735            #define L5_PLACE_OPERAND_FLAGS_PG_SZ_16K        (6<<8)
736            #define L5_PLACE_OPERAND_FLAGS_PG_SZ_32K        (7<<8)
737            #define L5_PLACE_OPERAND_FLAGS_PG_SZ_64K        (8<<8)
738            #define L5_PLACE_OPERAND_FLAGS_PG_SZ_128K       (9<<8)
739            #define L5_PLACE_OPERAND_FLAGS_PG_SZ_256K       (10<<8)
740            #define L5_PLACE_OPERAND_FLAGS_PG_SZ_512K       (11<<8)
741            #define L5_PLACE_OPERAND_FLAGS_PG_SZ_1M         (12<<8)
742            #define L5_PLACE_OPERAND_FLAGS_PG_SZ_2M         (13<<8)
743            #define L5_PLACE_OPERAND_FLAGS_PG_SZ_4M         (14<<8)
744            #define L5_PLACE_OPERAND_FLAGS_PG_SZ_8M         (15<<8)
745
746    u8_t l5_place_knum;
747    u8_t l5_place_opcode;
748    u16_t l5_place_offset_to_first_marker;
749    u16_t l5_place_rbdc_key;
750    u32_t l5_place_first_page_offset;
751    u16_t l5_place_l5_header_length;
752    u16_t l5_place_l5_cmd_type;
753        #define L5_PLACE_L5_CMD_TYPE_CMD_VALUE              (0xf<<0)
754            #define L5_PLACE_L5_CMD_TYPE_CMD_VALUE_UNDEFINED  (0<<0)
755            #define L5_PLACE_L5_CMD_TYPE_CMD_VALUE_SEND     (1<<0)
756            #define L5_PLACE_L5_CMD_TYPE_CMD_VALUE_SEND_W_SE  (2<<0)
757            #define L5_PLACE_L5_CMD_TYPE_CMD_VALUE_SEND_W_INV  (3<<0)
758            #define L5_PLACE_L5_CMD_TYPE_CMD_VALUE_SEND_W_SE_INV  (4<<0)
759            #define L5_PLACE_L5_CMD_TYPE_CMD_VALUE_RDMA_WRITE  (5<<0)
760            #define L5_PLACE_L5_CMD_TYPE_CMD_VALUE_RDMA_READ  (6<<0)
761            #define L5_PLACE_L5_CMD_TYPE_CMD_VALUE_RDMA_READ_W_INV  (7<<0)
762            #define L5_PLACE_L5_CMD_TYPE_CMD_VALUE_WINDOW_BIND  (8<<0)
763            #define L5_PLACE_L5_CMD_TYPE_CMD_VALUE_FAST_REGISTER  (9<<0)
764            #define L5_PLACE_L5_CMD_TYPE_CMD_VALUE_LOCAL_INVALIDATE  (10<<0)
765            #define L5_PLACE_L5_CMD_TYPE_CMD_VALUE_RDMA_READ_RESPONSE  (11<<0)
766            #define L5_PLACE_L5_CMD_TYPE_CMD_VALUE_TCP_ACK  (12<<0)
767
768    u32_t l5_place_tcp_ack_seq;
769    u32_t l5_place_sink_bfr_target_offset_h;
770    u32_t l5_place_sink_bfr_target_offset_l;
771    u8_t l5_place_rdma_action;
772    u8_t l5_place_cs16_pkt_len;
773    u16_t l5_place_cs16;
774} comq_l5_place_b_t;
775
776typedef struct comq_l5_place_l
777
778{
779    u32_t l5_place_cid;
780    u32_t l5_place_mbuf_cluster;
781    u8_t l5_place_opcode;
782    u8_t l5_place_knum;
783    u16_t l5_place_operand_flags;
784    u16_t l5_place_rbdc_key;
785    u16_t l5_place_offset_to_first_marker;
786    u32_t l5_place_first_page_offset;
787    u16_t l5_place_l5_cmd_type;
788    u16_t l5_place_l5_header_length;
789    u32_t l5_place_tcp_ack_seq;
790    u32_t l5_place_sink_bfr_target_offset_h;
791    u32_t l5_place_sink_bfr_target_offset_l;
792    u16_t l5_place_cs16;
793    u8_t l5_place_cs16_pkt_len;
794    u8_t l5_place_rdma_action;
795} comq_l5_place_l_t;
796
797#if defined(LITTLE_ENDIAN)
798    typedef comq_l5_place_l_t comq_l5_place_t;
799#elif defined(BIG_ENDIAN)
800    typedef comq_l5_place_b_t comq_l5_place_t;
801#endif
802
803
804/*
805 *  comq_l5_flush definition
806 */
807typedef struct comq_l5_flush_b
808{
809    u32_t unused_0[2];
810    u16_t unused_1;
811    u8_t unused_2;
812    u8_t l5_flush_opcode;
813    u16_t l5_flush_rbdc_key;
814    u16_t unused_3;
815    u32_t unused_4[5];
816    u8_t l5_flush_rdma_action;
817    u8_t l5_flush_cs16_pkt_len;
818    u16_t l5_flush_cs16;
819} comq_l5_flush_b_t;
820
821typedef struct comq_l5_flush_l
822{
823    u32_t unused_0[2];
824    u8_t l5_flush_opcode;
825    u8_t unused_2;
826    u16_t unused_1;
827    u16_t unused_3;
828    u16_t l5_flush_rbdc_key;
829    u32_t unused_4[5];
830    u16_t l5_flush_cs16;
831    u8_t l5_flush_cs16_pkt_len;
832    u8_t l5_flush_rdma_action;
833} comq_l5_flush_l_t;
834
835#if defined(LITTLE_ENDIAN)
836    typedef comq_l5_flush_l_t comq_l5_flush_t;
837#elif defined(BIG_ENDIAN)
838    typedef comq_l5_flush_b_t comq_l5_flush_t;
839#endif
840
841/*
842 *  l5_local_region_table_entry_b definition
843 */
844typedef struct l5_local_region_table_entry_b
845{
846    u8_t rte_flags;
847
848    u8_t rte_bind_cnt;
849    u16_t rte_pd;
850} l5_local_region_table_entry_b_t;
851
852
853
854/*
855 *  l5_local_region_table_entry_b definition
856 */
857typedef struct l5_local_region_table_entry_b_xi
858{
859    u8_t rte_flags;
860        #define RTE_FLAGS_FLAGS_MASK                        (0xff<<0)
861            #define RTE_FLAGS_FLAGS_MASK_UNDEFINED          (0<<0)
862            #define RTE_FLAGS_FLAGS_MASK_VALID              (1<<0)
863            #define RTE_FLAGS_FLAGS_MASK_LOCAL_READ         (2<<0)
864            #define RTE_FLAGS_FLAGS_MASK_LOCAL_WRITE        (4<<0)
865            #define RTE_FLAGS_FLAGS_MASK_REMOTE_REGION      (8<<0)
866            #define RTE_FLAGS_FLAGS_MASK_ALLOW_WIND_BIND    (16<<0)
867            #define RTE_FLAGS_FLAGS_MASK_INVALIDATE_IN_PROGRESS  (32<<0)
868            #define RTE_FLAGS_FLAGS_MASK_RX_FLUSH_IN_PROGRESS  (64<<0)
869
870    u8_t rte_bind_cnt;
871    u16_t rte_pd;
872} l5_local_region_table_entry_b_xi_t;
873
874
875/*
876 *  l5_local_region_table_entry_l definition
877 */
878typedef struct l5_local_region_table_entry_l
879{
880    u16_t rte_pd;
881    u8_t rte_bind_cnt;
882    u8_t rte_flags;
883
884} l5_local_region_table_entry_l_t;
885
886
887
888/*
889 *  l5_local_region_table_entry_l definition
890 */
891typedef struct l5_local_region_table_entry_l_xi
892{
893    u16_t rte_pd;
894    u8_t rte_bind_cnt;
895    u8_t rte_flags;
896        #define RTE_FLAGS_FLAGS_MASK                        (0xff<<0)
897            #define RTE_FLAGS_FLAGS_MASK_UNDEFINED          (0<<0)
898            #define RTE_FLAGS_FLAGS_MASK_VALID              (1<<0)
899            #define RTE_FLAGS_FLAGS_MASK_LOCAL_READ         (2<<0)
900            #define RTE_FLAGS_FLAGS_MASK_LOCAL_WRITE        (4<<0)
901            #define RTE_FLAGS_FLAGS_MASK_REMOTE_REGION      (8<<0)
902            #define RTE_FLAGS_FLAGS_MASK_ALLOW_WIND_BIND    (16<<0)
903            #define RTE_FLAGS_FLAGS_MASK_INVALIDATE_IN_PROGRESS  (32<<0)
904            #define RTE_FLAGS_FLAGS_MASK_RX_FLUSH_IN_PROGRESS  (64<<0)
905
906} l5_local_region_table_entry_l_xi_t;
907
908
909/*
910 * l5_local_region_table_entry select
911 */
912#if defined(LITTLE_ENDIAN)
913    typedef l5_local_region_table_entry_l_t l5_local_region_table_entry_t;
914    typedef l5_local_region_table_entry_l_xi_t l5_local_region_table_entry_xi_t;
915#elif defined(BIG_ENDIAN)
916    typedef l5_local_region_table_entry_b_t l5_local_region_table_entry_t;
917    typedef l5_local_region_table_entry_b_xi_t l5_local_region_table_entry_xi_t;
918#endif
919
920
921/*
922 *  l5_remote_region_table_entry_b definition
923 */
924typedef struct l5_remote_region_table_entry_b
925{
926    u8_t rte_flags;
927
928    u8_t rte_wintbl_stag_hi;
929    u16_t rte_wintbl_stag_lo;
930} l5_remote_region_table_entry_b_t;
931
932
933
934/*
935 *  l5_remote_region_table_entry_b definition
936 */
937typedef struct l5_remote_region_table_entry_b_xi
938{
939    u8_t rte_flags;
940        #define RTE_FLAGS_FLAGS_MASK                        (0xff<<0)
941            #define RTE_FLAGS_FLAGS_MASK_UNDEFINED          (0<<0)
942            #define RTE_FLAGS_FLAGS_MASK_VALID              (1<<0)
943            #define RTE_FLAGS_FLAGS_MASK_LOCAL_READ         (2<<0)
944            #define RTE_FLAGS_FLAGS_MASK_LOCAL_WRITE        (4<<0)
945            #define RTE_FLAGS_FLAGS_MASK_REMOTE_REGION      (8<<0)
946            #define RTE_FLAGS_FLAGS_MASK_ALLOW_WIND_BIND    (16<<0)
947            #define RTE_FLAGS_FLAGS_MASK_INVALIDATE_IN_PROGRESS  (32<<0)
948            #define RTE_FLAGS_FLAGS_MASK_RX_FLUSH_IN_PROGRESS  (64<<0)
949
950    u8_t rte_wintbl_stag_hi;
951    u16_t rte_wintbl_stag_lo;
952} l5_remote_region_table_entry_b_xi_t;
953
954
955/*
956 *  l5_remote_region_table_entry_l definition
957 */
958typedef struct l5_remote_region_table_entry_l
959{
960    u16_t rte_wintbl_stag_lo;
961    u8_t rte_wintbl_stag_hi;
962    u8_t rte_flags;
963
964} l5_remote_region_table_entry_l_t;
965
966
967
968/*
969 *  l5_remote_region_table_entry_l definition
970 */
971typedef struct l5_remote_region_table_entry_l_xi
972{
973    u16_t rte_wintbl_stag_lo;
974    u8_t rte_wintbl_stag_hi;
975    u8_t rte_flags;
976        #define RTE_FLAGS_FLAGS_MASK                        (0xff<<0)
977            #define RTE_FLAGS_FLAGS_MASK_UNDEFINED          (0<<0)
978            #define RTE_FLAGS_FLAGS_MASK_VALID              (1<<0)
979            #define RTE_FLAGS_FLAGS_MASK_LOCAL_READ         (2<<0)
980            #define RTE_FLAGS_FLAGS_MASK_LOCAL_WRITE        (4<<0)
981            #define RTE_FLAGS_FLAGS_MASK_REMOTE_REGION      (8<<0)
982            #define RTE_FLAGS_FLAGS_MASK_ALLOW_WIND_BIND    (16<<0)
983            #define RTE_FLAGS_FLAGS_MASK_INVALIDATE_IN_PROGRESS  (32<<0)
984            #define RTE_FLAGS_FLAGS_MASK_RX_FLUSH_IN_PROGRESS  (64<<0)
985
986} l5_remote_region_table_entry_l_xi_t;
987
988
989/*
990 * l5_remote_region_table_entry select
991 */
992#if defined(LITTLE_ENDIAN)
993    typedef l5_remote_region_table_entry_l_t l5_remote_region_table_entry_t;
994    typedef l5_remote_region_table_entry_l_xi_t l5_remote_region_table_entry_xi_t;
995#elif defined(BIG_ENDIAN)
996    typedef l5_remote_region_table_entry_b_t l5_remote_region_table_entry_t;
997    typedef l5_remote_region_table_entry_b_xi_t l5_remote_region_table_entry_xi_t;
998#endif
999
1000
1001/*
1002 *  l5_region_ref_cnt_table_entry_b definition
1003 */
1004typedef struct l5_region_ref_cnt_table_entry_b
1005{
1006    u16_t rrcte_pidx;
1007    u16_t rrcte_cidx;
1008} l5_region_ref_cnt_table_entry_b_t;
1009
1010
1011
1012/*
1013 *  l5_region_ref_cnt_table_entry_b definition
1014 */
1015typedef struct l5_region_ref_cnt_table_entry_b_xi
1016{
1017    u16_t rrcte_pidx;
1018    u16_t rrcte_cidx;
1019} l5_region_ref_cnt_table_entry_b_xi_t;
1020
1021
1022/*
1023 *  l5_region_ref_cnt_table_entry_l definition
1024 */
1025typedef struct l5_region_ref_cnt_table_entry_l
1026{
1027    u16_t rrcte_cidx;
1028    u16_t rrcte_pidx;
1029} l5_region_ref_cnt_table_entry_l_t;
1030
1031
1032
1033/*
1034 *  l5_region_ref_cnt_table_entry_l definition
1035 */
1036typedef struct l5_region_ref_cnt_table_entry_l_xi
1037{
1038    u16_t rrcte_cidx;
1039    u16_t rrcte_pidx;
1040} l5_region_ref_cnt_table_entry_l_xi_t;
1041
1042
1043/*
1044 * l5_region_ref_cnt_table_entry select
1045 */
1046#if defined(LITTLE_ENDIAN)
1047    typedef l5_region_ref_cnt_table_entry_l_t l5_region_ref_cnt_table_entry_t;
1048    typedef l5_region_ref_cnt_table_entry_l_xi_t l5_region_ref_cnt_table_entry_xi_t;
1049#elif defined(BIG_ENDIAN)
1050    typedef l5_region_ref_cnt_table_entry_b_t l5_region_ref_cnt_table_entry_t;
1051    typedef l5_region_ref_cnt_table_entry_b_xi_t l5_region_ref_cnt_table_entry_xi_t;
1052#endif
1053
1054
1055/*
1056 *  l5_window_table_entry_b definition
1057 */
1058typedef struct l5_window_table_entry_b
1059{
1060    u32_t wte_virtual_base_addr_hi;
1061    u32_t wte_virtual_base_addr_lo;
1062    u32_t wte_pt_phy_base_addr_hi;
1063    u32_t wte_pt_phy_base_addr_lo;
1064    u32_t wte_length;
1065    u32_t wte_qp_or_pd;
1066    u16_t wte_region_table_index;
1067    u16_t wte_cache_key;
1068    u16_t wte_flags;
1069
1070    u8_t wte_bind_cnt;
1071    u8_t wte_stag_key;
1072} l5_window_table_entry_b_t;
1073
1074
1075
1076/*
1077 *  l5_window_table_entry_b definition
1078 */
1079typedef struct l5_window_table_entry_b_xi
1080{
1081    u32_t wte_virtual_base_addr_hi;
1082    u32_t wte_virtual_base_addr_lo;
1083    u32_t wte_pt_phy_base_addr_hi;
1084    u32_t wte_pt_phy_base_addr_lo;
1085    u32_t wte_length;
1086    u32_t wte_qp_or_pd;
1087    u16_t wte_region_table_index;
1088    u16_t wte_cache_key;
1089    u16_t wte_flags;
1090        #define WTE_FLAGS_REGION_PAGE_SIZE                  (0xf<<0)
1091            #define WTE_FLAGS_REGION_PAGE_SIZE_256          (0<<0)
1092            #define WTE_FLAGS_REGION_PAGE_SIZE_512          (1<<0)
1093            #define WTE_FLAGS_REGION_PAGE_SIZE_1K           (2<<0)
1094            #define WTE_FLAGS_REGION_PAGE_SIZE_2K           (3<<0)
1095            #define WTE_FLAGS_REGION_PAGE_SIZE_4K           (4<<0)
1096            #define WTE_FLAGS_REGION_PAGE_SIZE_8K           (5<<0)
1097            #define WTE_FLAGS_REGION_PAGE_SIZE_16K          (6<<0)
1098            #define WTE_FLAGS_REGION_PAGE_SIZE_32K          (7<<0)
1099            #define WTE_FLAGS_REGION_PAGE_SIZE_64K          (8<<0)
1100            #define WTE_FLAGS_REGION_PAGE_SIZE_128K         (9<<0)
1101            #define WTE_FLAGS_REGION_PAGE_SIZE_256K         (10<<0)
1102            #define WTE_FLAGS_REGION_PAGE_SIZE_512K         (11<<0)
1103            #define WTE_FLAGS_REGION_PAGE_SIZE_1M           (12<<0)
1104            #define WTE_FLAGS_REGION_PAGE_SIZE_2M           (13<<0)
1105            #define WTE_FLAGS_REGION_PAGE_SIZE_4M           (14<<0)
1106            #define WTE_FLAGS_REGION_PAGE_SIZE_8M           (15<<0)
1107        #define WTE_FLAGS_WT_FLAGS                          (0xfff<<4)
1108            #define WTE_FLAGS_WT_FLAGS_WT_UNDEFINED         (0<<4)
1109            #define WTE_FLAGS_WT_FLAGS_VALID                (1<<4)
1110            #define WTE_FLAGS_WT_FLAGS_REGION               (2<<4)
1111            #define WTE_FLAGS_WT_FLAGS_UNBOUND_WINDOW       (4<<4)
1112            #define WTE_FLAGS_WT_FLAGS_BOUND_WINDOW         (8<<4)
1113            #define WTE_FLAGS_WT_FLAGS_REMOTE_READ          (16<<4)
1114            #define WTE_FLAGS_WT_FLAGS_REMOTE_WRITE         (32<<4)
1115            #define WTE_FLAGS_WT_FLAGS_ALLOW_WINDOW_BINDS   (64<<4)
1116            #define WTE_FLAGS_WT_FLAGS_INVALIDATE_IN_PROGRESS  (128<<4)
1117            #define WTE_FLAGS_WT_FLAGS_RX_FLUSH_IN_PROGRESS  (256<<4)
1118            #define WTE_FLAGS_WT_FLAGS_READ_W_LINV_IN_PROGRESS  (512<<4)
1119            #define WTE_FLAGS_WT_FLAGS_DEALLOCATE_FLUSH_INITIATED  (1024<<4)
1120            #define WTE_FLAGS_WT_FLAGS_DEALLOCATE_FLUSH_COMPLETE  (2048<<4)
1121
1122    u8_t wte_bind_cnt;
1123    u8_t wte_stag_key;
1124} l5_window_table_entry_b_xi_t;
1125
1126
1127/*
1128 *  l5_window_table_entry_l definition
1129 */
1130typedef struct l5_window_table_entry_l
1131{
1132    u32_t wte_virtual_base_addr_hi;
1133    u32_t wte_virtual_base_addr_lo;
1134    u32_t wte_pt_phy_base_addr_hi;
1135    u32_t wte_pt_phy_base_addr_lo;
1136    u32_t wte_length;
1137    u32_t wte_qp_or_pd;
1138    u16_t wte_cache_key;
1139    u16_t wte_region_table_index;
1140    u8_t wte_stag_key;
1141    u8_t wte_bind_cnt;
1142    u16_t wte_flags;
1143
1144} l5_window_table_entry_l_t;
1145
1146
1147
1148/*
1149 *  l5_window_table_entry_l definition
1150 */
1151typedef struct l5_window_table_entry_l_xi
1152{
1153    u32_t wte_virtual_base_addr_hi;
1154    u32_t wte_virtual_base_addr_lo;
1155    u32_t wte_pt_phy_base_addr_hi;
1156    u32_t wte_pt_phy_base_addr_lo;
1157    u32_t wte_length;
1158    u32_t wte_qp_or_pd;
1159    u16_t wte_cache_key;
1160    u16_t wte_region_table_index;
1161    u8_t wte_stag_key;
1162    u8_t wte_bind_cnt;
1163    u16_t wte_flags;
1164        #define WTE_FLAGS_REGION_PAGE_SIZE                  (0xf<<0)
1165            #define WTE_FLAGS_REGION_PAGE_SIZE_256          (0<<0)
1166            #define WTE_FLAGS_REGION_PAGE_SIZE_512          (1<<0)
1167            #define WTE_FLAGS_REGION_PAGE_SIZE_1K           (2<<0)
1168            #define WTE_FLAGS_REGION_PAGE_SIZE_2K           (3<<0)
1169            #define WTE_FLAGS_REGION_PAGE_SIZE_4K           (4<<0)
1170            #define WTE_FLAGS_REGION_PAGE_SIZE_8K           (5<<0)
1171            #define WTE_FLAGS_REGION_PAGE_SIZE_16K          (6<<0)
1172            #define WTE_FLAGS_REGION_PAGE_SIZE_32K          (7<<0)
1173            #define WTE_FLAGS_REGION_PAGE_SIZE_64K          (8<<0)
1174            #define WTE_FLAGS_REGION_PAGE_SIZE_128K         (9<<0)
1175            #define WTE_FLAGS_REGION_PAGE_SIZE_256K         (10<<0)
1176            #define WTE_FLAGS_REGION_PAGE_SIZE_512K         (11<<0)
1177            #define WTE_FLAGS_REGION_PAGE_SIZE_1M           (12<<0)
1178            #define WTE_FLAGS_REGION_PAGE_SIZE_2M           (13<<0)
1179            #define WTE_FLAGS_REGION_PAGE_SIZE_4M           (14<<0)
1180            #define WTE_FLAGS_REGION_PAGE_SIZE_8M           (15<<0)
1181        #define WTE_FLAGS_WT_FLAGS                          (0xfff<<4)
1182            #define WTE_FLAGS_WT_FLAGS_WT_UNDEFINED         (0<<4)
1183            #define WTE_FLAGS_WT_FLAGS_VALID                (1<<4)
1184            #define WTE_FLAGS_WT_FLAGS_REGION               (2<<4)
1185            #define WTE_FLAGS_WT_FLAGS_UNBOUND_WINDOW       (4<<4)
1186            #define WTE_FLAGS_WT_FLAGS_BOUND_WINDOW         (8<<4)
1187            #define WTE_FLAGS_WT_FLAGS_REMOTE_READ          (16<<4)
1188            #define WTE_FLAGS_WT_FLAGS_REMOTE_WRITE         (32<<4)
1189            #define WTE_FLAGS_WT_FLAGS_ALLOW_WINDOW_BINDS   (64<<4)
1190            #define WTE_FLAGS_WT_FLAGS_INVALIDATE_IN_PROGRESS  (128<<4)
1191            #define WTE_FLAGS_WT_FLAGS_RX_FLUSH_IN_PROGRESS  (256<<4)
1192            #define WTE_FLAGS_WT_FLAGS_READ_W_LINV_IN_PROGRESS  (512<<4)
1193            #define WTE_FLAGS_WT_FLAGS_DEALLOCATE_FLUSH_INITIATED  (1024<<4)
1194            #define WTE_FLAGS_WT_FLAGS_DEALLOCATE_FLUSH_COMPLETE  (2048<<4)
1195
1196} l5_window_table_entry_l_xi_t;
1197
1198
1199/*
1200 * l5_window_table_entry select
1201 */
1202#if defined(LITTLE_ENDIAN)
1203    typedef l5_window_table_entry_l_t l5_window_table_entry_t;
1204    typedef l5_window_table_entry_l_xi_t l5_window_table_entry_xi_t;
1205#elif defined(BIG_ENDIAN)
1206    typedef l5_window_table_entry_b_t l5_window_table_entry_t;
1207    typedef l5_window_table_entry_b_xi_t l5_window_table_entry_xi_t;
1208#endif
1209
1210
1211/*
1212 *  l5_cq_table_entry_b definition
1213 */
1214typedef struct l5_cq_table_entry_b
1215{
1216    u32_t cqte_pgtbl_phaddr_hi;
1217    u8_t cqte_pgtbl_phaddr_lo[3];
1218    u8_t cqte_flags;
1219
1220    u16_t cqte_pidx;
1221    u16_t cqte_cqes_per_page;
1222    u16_t cqte_max_cqes;
1223    u16_t cqte_nx_qe_self_seq;
1224    u16_t cqte_nx_pg_qidx;
1225    u16_t cqte_pgtbl_pgidx;
1226    u16_t cqte_pgtbl_npages;
1227    u16_t cqte_cqe_pidx;
1228    u32_t cqte_cached_pte_phaddr_hi;
1229    u32_t cqte_cached_pte_phaddr_lo;
1230} l5_cq_table_entry_b_t;
1231
1232
1233/*
1234 *  l5_cq_table_entry_b definition
1235 */
1236typedef struct l5_cq_table_entry_b_xi
1237{
1238    u32_t cqte_pgtbl_phaddr_hi;
1239    u8_t cqte_pgtbl_phaddr_lo[3];
1240    u8_t cqte_flags;
1241        #define CQTE_FLAGS_PAGE_SIZE                        (0xf<<0)
1242            #define CQTE_FLAGS_PAGE_SIZE_256                (0<<0)
1243            #define CQTE_FLAGS_PAGE_SIZE_512                (1<<0)
1244            #define CQTE_FLAGS_PAGE_SIZE_1K                 (2<<0)
1245            #define CQTE_FLAGS_PAGE_SIZE_2K                 (3<<0)
1246            #define CQTE_FLAGS_PAGE_SIZE_4K                 (4<<0)
1247            #define CQTE_FLAGS_PAGE_SIZE_8K                 (5<<0)
1248            #define CQTE_FLAGS_PAGE_SIZE_16K                (6<<0)
1249            #define CQTE_FLAGS_PAGE_SIZE_32K                (7<<0)
1250            #define CQTE_FLAGS_PAGE_SIZE_64K                (8<<0)
1251            #define CQTE_FLAGS_PAGE_SIZE_128K               (9<<0)
1252            #define CQTE_FLAGS_PAGE_SIZE_256K               (10<<0)
1253            #define CQTE_FLAGS_PAGE_SIZE_512K               (11<<0)
1254            #define CQTE_FLAGS_PAGE_SIZE_1M                 (12<<0)
1255            #define CQTE_FLAGS_PAGE_SIZE_2M                 (13<<0)
1256        #define CQTE_FLAGS_FLAGS                            (0xf<<4)
1257            #define CQTE_FLAGS_FLAGS_UNDEFINED              (0<<4)
1258            #define CQTE_FLAGS_FLAGS_VALID                  (1<<4)
1259            #define CQTE_FLAGS_FLAGS_ARMED                  (2<<4)
1260            #define CQTE_FLAGS_FLAGS_ARMED_SEND_SE          (4<<4)
1261            #define CQTE_FLAGS_FLAGS_CQE_NOT_ARMED          (8<<4)
1262
1263    u16_t cqte_pidx;
1264    u16_t cqte_cqes_per_page;
1265    u16_t cqte_max_cqes;
1266    u16_t cqte_nx_qe_self_seq;
1267    u16_t cqte_nx_pg_qidx;
1268    u16_t cqte_pgtbl_pgidx;
1269    u16_t cqte_pgtbl_npages;
1270    u16_t cqte_cqe_pidx;
1271    u32_t cqte_cached_pte_phaddr_hi;
1272    u32_t cqte_cached_pte_phaddr_lo;
1273} l5_cq_table_entry_b_xi_t;
1274
1275
1276/*
1277 *  l5_cq_table_entry_l definition
1278 */
1279typedef struct l5_cq_table_entry_l
1280{
1281    u32_t cqte_pgtbl_phaddr_hi;
1282    u8_t cqte_flags;
1283
1284    u8_t cqte_pgtbl_phaddr_lo[3];
1285    u16_t cqte_cqes_per_page;
1286    u16_t cqte_pidx;
1287    u16_t cqte_nx_qe_self_seq;
1288    u16_t cqte_max_cqes;
1289    u16_t cqte_pgtbl_pgidx;
1290    u16_t cqte_nx_pg_qidx;
1291    u16_t cqte_cqe_pidx;
1292    u16_t cqte_pgtbl_npages;
1293    u32_t cqte_cached_pte_phaddr_hi;
1294    u32_t cqte_cached_pte_phaddr_lo;
1295} l5_cq_table_entry_l_t;
1296
1297
1298
1299/*
1300 *  l5_cq_table_entry_l definition
1301 */
1302typedef struct l5_cq_table_entry_l_xi
1303{
1304    u32_t cqte_pgtbl_phaddr_hi;
1305    u8_t cqte_flags;
1306        #define CQTE_FLAGS_PAGE_SIZE                        (0xf<<0)
1307            #define CQTE_FLAGS_PAGE_SIZE_256                (0<<0)
1308            #define CQTE_FLAGS_PAGE_SIZE_512                (1<<0)
1309            #define CQTE_FLAGS_PAGE_SIZE_1K                 (2<<0)
1310            #define CQTE_FLAGS_PAGE_SIZE_2K                 (3<<0)
1311            #define CQTE_FLAGS_PAGE_SIZE_4K                 (4<<0)
1312            #define CQTE_FLAGS_PAGE_SIZE_8K                 (5<<0)
1313            #define CQTE_FLAGS_PAGE_SIZE_16K                (6<<0)
1314            #define CQTE_FLAGS_PAGE_SIZE_32K                (7<<0)
1315            #define CQTE_FLAGS_PAGE_SIZE_64K                (8<<0)
1316            #define CQTE_FLAGS_PAGE_SIZE_128K               (9<<0)
1317            #define CQTE_FLAGS_PAGE_SIZE_256K               (10<<0)
1318            #define CQTE_FLAGS_PAGE_SIZE_512K               (11<<0)
1319            #define CQTE_FLAGS_PAGE_SIZE_1M                 (12<<0)
1320            #define CQTE_FLAGS_PAGE_SIZE_2M                 (13<<0)
1321        #define CQTE_FLAGS_FLAGS                            (0xf<<4)
1322            #define CQTE_FLAGS_FLAGS_UNDEFINED              (0<<4)
1323            #define CQTE_FLAGS_FLAGS_VALID                  (1<<4)
1324            #define CQTE_FLAGS_FLAGS_ARMED                  (2<<4)
1325            #define CQTE_FLAGS_FLAGS_ARMED_SEND_SE          (4<<4)
1326            #define CQTE_FLAGS_FLAGS_CQE_NOT_ARMED          (8<<4)
1327
1328    u8_t cqte_pgtbl_phaddr_lo[3];
1329    u16_t cqte_cqes_per_page;
1330    u16_t cqte_pidx;
1331    u16_t cqte_nx_qe_self_seq;
1332    u16_t cqte_max_cqes;
1333    u16_t cqte_pgtbl_pgidx;
1334    u16_t cqte_nx_pg_qidx;
1335    u16_t cqte_cqe_pidx;
1336    u16_t cqte_pgtbl_npages;
1337    u32_t cqte_cached_pte_phaddr_hi;
1338    u32_t cqte_cached_pte_phaddr_lo;
1339} l5_cq_table_entry_l_xi_t;
1340
1341
1342/*
1343 * l5_cq_table_entry select
1344 */
1345#if defined(LITTLE_ENDIAN)
1346    typedef l5_cq_table_entry_l_t l5_cq_table_entry_t;
1347    typedef l5_cq_table_entry_l_xi_t l5_cq_table_entry_xi_t;
1348#elif defined(BIG_ENDIAN)
1349    typedef l5_cq_table_entry_b_t l5_cq_table_entry_t;
1350    typedef l5_cq_table_entry_b_xi_t l5_cq_table_entry_xi_t;
1351#endif
1352
1353
1354/*
1355 *  l5_cmd_cell_b definition
1356 */
1357typedef struct l5_cmd_cell_b
1358{
1359    u16_t l5ccell_cmd_type;
1360
1361    u16_t l5ccell_wq_idx;
1362    u8_t unused_0;
1363    u8_t l5ccell_cmd_val;
1364    u16_t l5ccell_distance_to_first_marker;
1365    u32_t unused_1;
1366    u32_t l5ccell_ddp_hdr_word1;
1367    u32_t l5ccell_ddp_hdr_word2;
1368    u32_t l5ccell_ddp_hdr_word3;
1369    u32_t l5ccell_tcp_sn_first_byte;
1370    u32_t l5ccell_tcp_sn_last_byte;
1371} l5_cmd_cell_b_t;
1372
1373
1374
1375/*
1376 *  l5_cmd_cell_l definition
1377 */
1378typedef struct l5_cmd_cell_l
1379{
1380    u16_t l5ccell_wq_idx;
1381    u16_t l5ccell_cmd_type;
1382
1383    u16_t l5ccell_distance_to_first_marker;
1384    u8_t l5ccell_cmd_val;
1385    u8_t unused_0;
1386    u32_t unused_1;
1387    u32_t l5ccell_ddp_hdr_word1;
1388    u32_t l5ccell_ddp_hdr_word2;
1389    u32_t l5ccell_ddp_hdr_word3;
1390    u32_t l5ccell_tcp_sn_first_byte;
1391    u32_t l5ccell_tcp_sn_last_byte;
1392} l5_cmd_cell_l_t;
1393
1394
1395
1396/*
1397 * l5_cmd_cell select
1398 */
1399#if defined(LITTLE_ENDIAN)
1400    typedef l5_cmd_cell_l_t l5_cmd_cell_t;
1401#elif defined(BIG_ENDIAN)
1402    typedef l5_cmd_cell_b_t l5_cmd_cell_t;
1403#endif
1404
1405
1406/*
1407 *  l5_abuf_cell_b definition
1408 */
1409typedef struct l5_abuf_cell_b
1410{
1411    u32_t l5acell_pgtbl_phaddr_hi;
1412    u8_t l5acell_pgtbl_phaddr_lo[3];
1413    u8_t l5acell_flags;
1414
1415    u16_t l5acell_wq_idx;
1416    u16_t l5acell_first_page_offset;
1417    u32_t l5acell_buffer_offset;
1418    u16_t l5acell_rbdc_key;
1419    u16_t l5acell_receive_length;
1420    u32_t l5acell_buffer_length;
1421    u32_t l5acell_tcp_sn_L_bit_segment;
1422} l5_abuf_cell_b_t;
1423
1424
1425
1426/*
1427 *  l5_abuf_cell_b definition
1428 */
1429typedef struct l5_abuf_cell_b_xi
1430{
1431    u32_t l5acell_pgtbl_phaddr_hi;
1432    u8_t l5acell_pgtbl_phaddr_lo[3];
1433    u8_t l5acell_flags;
1434        #define L5ACELL_FLAGS_REGION_PAGE_SIZE              (0xf<<0)
1435            #define L5ACELL_FLAGS_REGION_PAGE_SIZE_256      (0<<0)
1436            #define L5ACELL_FLAGS_REGION_PAGE_SIZE_512      (1<<0)
1437            #define L5ACELL_FLAGS_REGION_PAGE_SIZE_1K       (2<<0)
1438            #define L5ACELL_FLAGS_REGION_PAGE_SIZE_2K       (3<<0)
1439            #define L5ACELL_FLAGS_REGION_PAGE_SIZE_4K       (4<<0)
1440            #define L5ACELL_FLAGS_REGION_PAGE_SIZE_8K       (5<<0)
1441            #define L5ACELL_FLAGS_REGION_PAGE_SIZE_16K      (6<<0)
1442            #define L5ACELL_FLAGS_REGION_PAGE_SIZE_32K      (7<<0)
1443            #define L5ACELL_FLAGS_REGION_PAGE_SIZE_64K      (8<<0)
1444            #define L5ACELL_FLAGS_REGION_PAGE_SIZE_128K     (9<<0)
1445            #define L5ACELL_FLAGS_REGION_PAGE_SIZE_256K     (10<<0)
1446            #define L5ACELL_FLAGS_REGION_PAGE_SIZE_512K     (11<<0)
1447            #define L5ACELL_FLAGS_REGION_PAGE_SIZE_1M       (12<<0)
1448            #define L5ACELL_FLAGS_REGION_PAGE_SIZE_2M       (13<<0)
1449            #define L5ACELL_FLAGS_REGION_PAGE_SIZE_4M       (14<<0)
1450            #define L5ACELL_FLAGS_REGION_PAGE_SIZE_8M       (15<<0)
1451        #define L5ACELL_FLAGS_ABUF_FLAGS                    (0xf<<4)
1452            #define L5ACELL_FLAGS_ABUF_FLAGS_ABUF_UNDEFINED  (0<<4)
1453            #define L5ACELL_FLAGS_ABUF_FLAGS_L_BIT_RCVD     (1<<4)
1454            #define L5ACELL_FLAGS_ABUF_FLAGS_GEN_EVT        (2<<4)
1455            #define L5ACELL_FLAGS_ABUF_FLAGS_INV_STAG       (4<<4)
1456            #define L5ACELL_FLAGS_ABUF_FLAGS_COMP_ERROR     (8<<4)
1457
1458    u16_t l5acell_wq_idx;
1459    u16_t l5acell_first_page_offset;
1460    u32_t l5acell_buffer_offset;
1461    u16_t l5acell_rbdc_key;
1462    u16_t l5acell_receive_length;
1463    u32_t l5acell_buffer_length;
1464    u32_t l5acell_tcp_sn_L_bit_segment;
1465} l5_abuf_cell_b_xi_t;
1466
1467
1468/*
1469 *  l5_abuf_cell_l definition
1470 */
1471typedef struct l5_abuf_cell_l
1472{
1473    u32_t l5acell_pgtbl_phaddr_hi;
1474    u8_t l5acell_flags;
1475
1476    u8_t l5acell_pgtbl_phaddr_lo[3];
1477    u16_t l5acell_first_page_offset;
1478    u16_t l5acell_wq_idx;
1479    u32_t l5acell_buffer_offset;
1480    u16_t l5acell_receive_length;
1481    u16_t l5acell_rbdc_key;
1482    u32_t l5acell_buffer_length;
1483    u32_t l5acell_tcp_sn_L_bit_segment;
1484} l5_abuf_cell_l_t;
1485
1486
1487
1488/*
1489 *  l5_abuf_cell_l definition
1490 */
1491typedef struct l5_abuf_cell_l_xi
1492{
1493    u32_t l5acell_pgtbl_phaddr_hi;
1494    u8_t l5acell_flags;
1495        #define L5ACELL_FLAGS_REGION_PAGE_SIZE              (0xf<<0)
1496            #define L5ACELL_FLAGS_REGION_PAGE_SIZE_256      (0<<0)
1497            #define L5ACELL_FLAGS_REGION_PAGE_SIZE_512      (1<<0)
1498            #define L5ACELL_FLAGS_REGION_PAGE_SIZE_1K       (2<<0)
1499            #define L5ACELL_FLAGS_REGION_PAGE_SIZE_2K       (3<<0)
1500            #define L5ACELL_FLAGS_REGION_PAGE_SIZE_4K       (4<<0)
1501            #define L5ACELL_FLAGS_REGION_PAGE_SIZE_8K       (5<<0)
1502            #define L5ACELL_FLAGS_REGION_PAGE_SIZE_16K      (6<<0)
1503            #define L5ACELL_FLAGS_REGION_PAGE_SIZE_32K      (7<<0)
1504            #define L5ACELL_FLAGS_REGION_PAGE_SIZE_64K      (8<<0)
1505            #define L5ACELL_FLAGS_REGION_PAGE_SIZE_128K     (9<<0)
1506            #define L5ACELL_FLAGS_REGION_PAGE_SIZE_256K     (10<<0)
1507            #define L5ACELL_FLAGS_REGION_PAGE_SIZE_512K     (11<<0)
1508            #define L5ACELL_FLAGS_REGION_PAGE_SIZE_1M       (12<<0)
1509            #define L5ACELL_FLAGS_REGION_PAGE_SIZE_2M       (13<<0)
1510            #define L5ACELL_FLAGS_REGION_PAGE_SIZE_4M       (14<<0)
1511            #define L5ACELL_FLAGS_REGION_PAGE_SIZE_8M       (15<<0)
1512        #define L5ACELL_FLAGS_ABUF_FLAGS                    (0xf<<4)
1513            #define L5ACELL_FLAGS_ABUF_FLAGS_ABUF_UNDEFINED  (0<<4)
1514            #define L5ACELL_FLAGS_ABUF_FLAGS_L_BIT_RCVD     (1<<4)
1515            #define L5ACELL_FLAGS_ABUF_FLAGS_GEN_EVT        (2<<4)
1516            #define L5ACELL_FLAGS_ABUF_FLAGS_INV_STAG       (4<<4)
1517            #define L5ACELL_FLAGS_ABUF_FLAGS_COMP_ERROR     (8<<4)
1518
1519    u8_t l5acell_pgtbl_phaddr_lo[3];
1520    u16_t l5acell_first_page_offset;
1521    u16_t l5acell_wq_idx;
1522    u32_t l5acell_buffer_offset;
1523    u16_t l5acell_receive_length;
1524    u16_t l5acell_rbdc_key;
1525    u32_t l5acell_buffer_length;
1526    u32_t l5acell_tcp_sn_L_bit_segment;
1527} l5_abuf_cell_l_xi_t;
1528
1529
1530/*
1531 * l5_abuf_cell select
1532 */
1533#if defined(LITTLE_ENDIAN)
1534    typedef l5_abuf_cell_l_t l5_abuf_cell_t;
1535    typedef l5_abuf_cell_l_xi_t l5_abuf_cell_xi_t;
1536#elif defined(BIG_ENDIAN)
1537    typedef l5_abuf_cell_b_t l5_abuf_cell_t;
1538    typedef l5_abuf_cell_b_xi_t l5_abuf_cell_xi_t;
1539#endif
1540
1541
1542/*
1543 *  l5_irrq_entry_b definition
1544 */
1545typedef struct l5_irrq_entry_b
1546{
1547    u32_t irrqe_sink_stag;
1548    u32_t irrqe_sink_to_hi;
1549    u32_t irrqe_sink_to_lo;
1550    u32_t irrqe_msg_length;
1551    u32_t irrqe_source_stag;
1552    u32_t irrqe_source_to_hi;
1553    u32_t irrqe_source_to_lo;
1554} l5_irrq_entry_b_t;
1555
1556
1557
1558/*
1559 *  l5_irrq_entry_b definition
1560 */
1561typedef struct l5_irrq_entry_b_xi
1562{
1563    u32_t irrqe_sink_stag;
1564    u32_t irrqe_sink_to_hi;
1565    u32_t irrqe_sink_to_lo;
1566    u32_t irrqe_msg_length;
1567    u32_t irrqe_source_stag;
1568    u32_t irrqe_source_to_hi;
1569    u32_t irrqe_source_to_lo;
1570} l5_irrq_entry_b_xi_t;
1571
1572
1573/*
1574 *  l5_irrq_entry_l definition
1575 */
1576typedef struct l5_irrq_entry_l
1577{
1578    u32_t irrqe_sink_stag;
1579    u32_t irrqe_sink_to_hi;
1580    u32_t irrqe_sink_to_lo;
1581    u32_t irrqe_msg_length;
1582    u32_t irrqe_source_stag;
1583    u32_t irrqe_source_to_hi;
1584    u32_t irrqe_source_to_lo;
1585} l5_irrq_entry_l_t;
1586
1587
1588
1589/*
1590 *  l5_irrq_entry_l definition
1591 */
1592typedef struct l5_irrq_entry_l_xi
1593{
1594    u32_t irrqe_sink_stag;
1595    u32_t irrqe_sink_to_hi;
1596    u32_t irrqe_sink_to_lo;
1597    u32_t irrqe_msg_length;
1598    u32_t irrqe_source_stag;
1599    u32_t irrqe_source_to_hi;
1600    u32_t irrqe_source_to_lo;
1601} l5_irrq_entry_l_xi_t;
1602
1603
1604/*
1605 * l5_irrq_entry select
1606 */
1607#if defined(LITTLE_ENDIAN)
1608    typedef l5_irrq_entry_l_t l5_irrq_entry_t;
1609    typedef l5_irrq_entry_l_xi_t l5_irrq_entry_xi_t;
1610#elif defined(BIG_ENDIAN)
1611    typedef l5_irrq_entry_b_t l5_irrq_entry_t;
1612    typedef l5_irrq_entry_b_xi_t l5_irrq_entry_xi_t;
1613#endif
1614
1615
1616/*
1617 *  l5_orrq_entry_b definition
1618 */
1619typedef struct l5_orrq_entry_b
1620{
1621    u32_t orrqe_tcp_sn_read_rsp_L_bit_segment;
1622    u32_t orrqe_source_to_hi;
1623    u32_t orrqe_source_to_low;
1624} l5_orrq_entry_b_t;
1625
1626
1627
1628/*
1629 *  l5_orrq_entry_b definition
1630 */
1631typedef struct l5_orrq_entry_b_xi
1632{
1633    u32_t orrqe_tcp_sn_read_rsp_L_bit_segment;
1634    u32_t orrqe_source_to_hi;
1635    u32_t orrqe_source_to_low;
1636} l5_orrq_entry_b_xi_t;
1637
1638
1639/*
1640 *  l5_orrq_entry_l definition
1641 */
1642typedef struct l5_orrq_entry_l
1643{
1644    u32_t orrqe_tcp_sn_read_rsp_L_bit_segment;
1645    u32_t orrqe_source_to_hi;
1646    u32_t orrqe_source_to_low;
1647} l5_orrq_entry_l_t;
1648
1649
1650
1651/*
1652 *  l5_orrq_entry_l definition
1653 */
1654typedef struct l5_orrq_entry_l_xi
1655{
1656    u32_t orrqe_tcp_sn_read_rsp_L_bit_segment;
1657    u32_t orrqe_source_to_hi;
1658    u32_t orrqe_source_to_low;
1659} l5_orrq_entry_l_xi_t;
1660
1661
1662/*
1663 * l5_orrq_entry select
1664 */
1665#if defined(LITTLE_ENDIAN)
1666    typedef l5_orrq_entry_l_t l5_orrq_entry_t;
1667    typedef l5_orrq_entry_l_xi_t l5_orrq_entry_xi_t;
1668#elif defined(BIG_ENDIAN)
1669    typedef l5_orrq_entry_b_t l5_orrq_entry_t;
1670    typedef l5_orrq_entry_b_xi_t l5_orrq_entry_xi_t;
1671#endif
1672
1673
1674/*
1675 *  l5_context_b definition
1676 */
1677typedef struct l5_context_b
1678{
1679    u8_t l5ctx_type;
1680
1681    u8_t l5ctx_size;
1682    u16_t l5ctx_cq_cidx;
1683    u8_t l5ctx_gen_bd_max;
1684    u8_t l5ctx_oubits;
1685
1686    u16_t l5ctx_sq_pidx;
1687    u16_t l5ctx_tcp_pgid;
1688    u16_t l5ctx_rq_pidx;
1689    u32_t l5ctx_tcp_timer1;
1690
1691    u16_t l5ctx_tcp_timer2;
1692
1693    u16_t l5ctx_tcp_timer3;
1694
1695    u16_t l5ctx_tcp_timer4;
1696
1697    u16_t l5ctx_tcp_timer5;
1698
1699    u32_t l5ctx_tcp_snd_wl1;
1700    u32_t l5ctx_tcp_snd_wl2;
1701    u8_t l5ctx_tcp_ttl;
1702    u8_t l5ctx_tcp_tos;
1703    u8_t l5ctx_tcp_dack;
1704    u8_t l5ctx_tcp_modes;
1705
1706    u32_t l5ctx_tcp_max_adv_win;
1707    u32_t l5ctx_tcp_timer;
1708    u32_t l5ctx_tcp_ip_src;
1709    u32_t l5ctx_tcp_ip_dst;
1710    u8_t l5ctx_tcp_iphdr_nbytes;
1711    u8_t l5ctx_tcp_snd_seg_scale;
1712    u8_t l5ctx_tcp_rcv_seg_scale;
1713    u8_t l5ctx_tcp_tcp_hlen;
1714    u16_t l5ctx_tcp_src_port;
1715    u16_t l5ctx_tcp_dst_port;
1716    u16_t l5ctx_tcp_mss;
1717    u8_t l5ctx_tcp_flags;
1718
1719    u8_t l5ctx_tcp_state;
1720
1721    u32_t l5ctx_tcp_rcv_next;
1722    u32_t l5ctx_last_ack_sent;
1723    u32_t l5ctx_tcp_rcv_win_seq;
1724    u32_t l5ctx_tcp_snd_una;
1725    u32_t l5ctx_tcp_snd_next;
1726    u32_t l5ctx_tcp_snd_max;
1727    u32_t l5ctx_tcp_snd_win;
1728    u32_t l5ctx_tcp_snd_cwin;
1729    u32_t l5ctx_tcp_tstamp;
1730    u32_t l5ctx_tcp_ssthresh;
1731    u16_t l5ctx_tcp_sm_rtt;
1732    u16_t l5ctx_tcp_sm_delta;
1733    u32_t l5ctx_tcp_max_snd_win;
1734    u32_t l5ctx_tcp_tsch_snd_next;
1735    u32_t l5ctx_tcp_slot_size;
1736
1737    u8_t l5ctx_tcp_cp_cmd;
1738    u8_t l5ctx_tcp_tsch_cmd;
1739    u8_t l5ctx_tcp_cons_retx_num;
1740    u8_t l5ctx_tcp_tsch_xnum;
1741
1742    u8_t l5ctx_tcp_num_dupack;
1743    u8_t l5ctx_tcp_tx_protocol_flags;
1744
1745    u8_t l5ctx_tcp_prod_retx_num;
1746    u8_t l5ctx_tcp_tsch_cons_retx_num;
1747    u8_t l5ctx_tcp_comp_cons_retx_num;
1748    u8_t l5ctx_tcp_num_retx;
1749    u8_t l5ctx_tcp_upload_reason;
1750
1751    u8_t l5ctx_tcp_txp_cmd;
1752    u32_t unused_0;
1753    tcp_context_cmd_cell_b_te_t l5ctx_cmd[3];
1754    u16_t l5ctx_snd_q_max_wqes;
1755    u16_t l5ctx_snd_q_fw_qidx;
1756    u16_t l5ctx_snd_q_nx_pg_qidx;
1757    u16_t l5ctx_snd_q_pgtbl_pgidx;
1758    u16_t l5ctx_snd_q_wqes_per_page;
1759    u16_t l5ctx_snd_q_num_pages;
1760    u8_t l5ctx_snd_q_pidx;
1761    u8_t l5ctx_snd_q_cidx;
1762    u8_t l5ctx_snd_q_max_cached_wqes;
1763    u8_t l5ctx_snd_q_flags;
1764
1765    u32_t l5ctx_snd_q_pgtbl_phaddr_hi;
1766    u8_t l5ctx_snd_q_pgtbl_phaddr_lo[3];
1767    u8_t l5ctx_snd_q_read_rsp_wait;
1768    u32_t l5ctx_snd_q_cached_pte_phaddr_hi;
1769    u32_t l5ctx_snd_q_cached_pte_phaddr_lo;
1770    l5_cmd_cell_b_t l5ctx_snd_q_cmd[3];
1771    u16_t l5ctx_rcv_q_max_wqes;
1772    u16_t l5ctx_rcv_q_fw_qidx;
1773    u16_t l5ctx_rcv_q_nx_pg_qidx;
1774    u16_t l5ctx_rcv_q_pgtbl_pgidx;
1775    u16_t l5ctx_rcv_q_wqes_per_page;
1776    u16_t l5ctx_rcv_q_num_pages;
1777    u8_t l5ctx_rcv_q_pidx;
1778    u8_t l5ctx_rcv_q_rxp_cidx;
1779    u8_t l5ctx_rcv_q_com_cidx;
1780    u8_t l5ctx_rcv_q_flags;
1781
1782    u32_t l5ctx_rcv_q_pgtbl_phaddr_hi;
1783    u8_t l5ctx_rcv_q_pgtbl_phaddr_lo[3];
1784    u8_t l5ctx_rcv_q_qp_ou_state;
1785        #define L5CTX_RCV_Q_QP_OU_STATE_UPLOADED            (1<<0)
1786        #define L5CTX_RCV_Q_QP_OU_STATE_OFFLOADED           (1<<1)
1787        #define L5CTX_RCV_Q_QP_OU_STATE_UPLOAD_REQ          (1<<2)
1788        #define L5CTX_RCV_Q_QP_OU_STATE_OFFLOAD_REQ         (1<<3)
1789
1790    u32_t l5ctx_rcv_q_cached_pte_phaddr_hi;
1791    u32_t l5ctx_rcv_q_cached_pte_phaddr_lo;
1792    l5_abuf_cell_b_t l5ctx_rcv_q_abuf[2];
1793    u32_t l5ctx_cq_cid;
1794    u32_t l5ctx_curr_send_msn;
1795    u32_t l5ctx_curr_rdma_read_msn;
1796    u16_t l5ctx_pd;
1797    u8_t l5ctx_rcv_path_op_state;
1798
1799    u8_t l5ctx_ird;
1800    u32_t l5ctx_tx_initial_tcp_sn;
1801    u16_t l5ctx_tsch_mult_value;
1802    u8_t l5ctx_null_cmd_cell_pidx;
1803    u8_t l5ctx_null_cmd_cell_cidx;
1804    l5_orrq_entry_b_t l5ctx_orrq[1];
1805    l5_irrq_entry_b_t l5ctx_irrq[1];
1806    u8_t l5ctx_miq_index;
1807    u8_t l5ctx_rx_comp_flags;
1808
1809    u8_t l5ctx_qp_flags;
1810
1811    u8_t l5ctx_upload_flag;
1812
1813    u8_t l5ctx_upload_rxp;
1814
1815    u8_t l5ctx_ooo_read_resp_segs_w_L_bit;
1816    u8_t l5ctx_ooo_send_msg_segs_w_L_bit;
1817    u8_t l5ctx_ooo_read_request_msgs;
1818    u32_t l5ctx_high_tcp_ack_sn_rcvd;
1819    u32_t l5ctx_rx_initial_tcp_sn;
1820    u32_t l5ctx_send_msg_high_msn_completed;
1821    u32_t l5ctx_read_req_high_msn_queued;
1822    u32_t l5ctx_rsvd_l4_hole_mgmt[3];
1823    u16_t l5ctx_cam_index;
1824    u16_t l5ctx_offload_flag;
1825} l5_context_b_t;
1826
1827
1828
1829/*
1830 *  l5_context_b definition
1831 */
1832typedef struct l5_context_b_xi
1833{
1834    u32_t l5ctx_tcp_tsch_snd_next;
1835    u32_t l5ctx_tcp_snd_max;
1836    u8_t l5ctx_tcp_cp_cmd;
1837    u8_t l5ctx_tcp_tsch_cmd;
1838    u8_t l5ctx_tcp_cons_retx_num;
1839    u8_t l5ctx_tcp_tsch_xnum;
1840        #define L5CTX_TCP_TSCH_XNUM_VAL                     (0x7f<<0)
1841        #define L5CTX_TCP_TSCH_XNUM_L4                      (1<<7)
1842
1843    u16_t l5ctx_tcp_pgid;
1844        #define L5CTX_TCP_PGID_VAL                          (0x3fff<<0)
1845
1846    u8_t l5ctx_tcp_prod_retx_num;
1847    u8_t l5ctx_tcp_tsch_cons_retx_num;
1848    u8_t l5ctx_tcp_l2_slot_size;
1849    u8_t unused_0;
1850    u16_t unused_1;
1851    u32_t unused_2;
1852    u8_t l5ctx_tcp_ttl;
1853    u8_t l5ctx_tcp_tos;
1854    u8_t l5ctx_tcp_dack;
1855    u8_t l5ctx_tcp_modes;
1856        #define L5CTX_TCP_MODES_RST_INDICATED               (1<<0)
1857        #define L5CTX_TCP_MODES_DISC_BD                     (1<<1)
1858        #define L5CTX_TCP_MODES_UPLOAD_INITED               (1<<2)
1859        #define L5CTX_TCP_MODES_RMT_DISC                    (1<<3)
1860        #define L5CTX_TCP_MODES_PG_INVALIDATED              (1<<4)
1861        #define L5CTX_TCP_MODES_ABORT_PENDING               (1<<5)
1862        #define L5CTX_TCP_MODES_DISC_PENDING                (1<<6)
1863        #define L5CTX_TCP_MODES_SS                          (1<<7)
1864
1865    u32_t l5ctx_tcp_max_adv_win;
1866    u32_t l5ctx_timer;
1867    u32_t l5ctx_tcp_ip_src;
1868    u32_t l5ctx_tcp_ip_dst;
1869    u8_t l5ctx_tcp_iphdr_nbytes;
1870    u8_t l5ctx_tcp_snd_seg_scale;
1871    u8_t l5ctx_tcp_rcv_seg_scale;
1872    u8_t l5ctx_tcp_tcp_hlen;
1873    u16_t l5ctx_tcp_src_port;
1874    u16_t l5ctx_tcp_dst_port;
1875    u32_t l5ctx_tx_initial_tcp_sn;
1876    u8_t l5ctx_upload_flag;
1877        #define L5CTX_UPLOAD_FLAG_TXP                       (1<<0)
1878        #define L5CTX_UPLOAD_FLAG_TXP_COM                   (1<<1)
1879    u8_t unused_3;
1880    u16_t unused_4;
1881    u32_t unused_5[17];
1882
1883    u8_t l5ctx_type;
1884        #define L5CTX_TYPE_TYPE                             (0xf<<4)
1885            #define L5CTX_TYPE_TYPE_EMPTY                   (0<<4)
1886            #define L5CTX_TYPE_TYPE_L2                      (1<<4)
1887            #define L5CTX_TYPE_TYPE_TCP                     (2<<4)
1888            #define L5CTX_TYPE_TYPE_L5                      (3<<4)
1889            #define L5CTX_TYPE_TYPE_L2_BD_CHN               (4<<4)
1890
1891    u8_t l5ctx_size;
1892        #define L5CTX_SIZE_ARM_CQ                           (1<<0)
1893
1894    u16_t l5ctx_cq_cidx;
1895    u8_t l5ctx_gen_bd_max;
1896    u8_t l5ctx_oubits;
1897        #define L5CTX_OUBITS_ACTIVATE                       (1<<0)
1898        #define L5CTX_OUBITS_CP_UPLOAD                      (1<<1)
1899        #define L5CTX_OUBITS_RXP_UPLOAD                     (1<<2)
1900        #define L5CTX_OUBITS_TXP_UPLOAD                     (1<<3)
1901        #define L5CTX_OUBITS_COM_RX_UPLOAD                  (1<<4)
1902        #define L5CTX_OUBITS_COM_TX_UPLOAD                  (1<<5)
1903        #define L5CTX_OUBITS_CP_UPLOAD_COMP                 (1<<6)
1904        #define L5CTX_OUBITS_HOST_ACK                       (1<<7)
1905
1906    u16_t l5ctx_sq_pidx;
1907    u16_t unused_6;
1908    u16_t l5ctx_rq_pidx;
1909    u32_t l5ctx_tcp_timer1;
1910        #define L5CTX_TCP_TIMER1_DISABLE                    (1UL<<0)
1911        #define L5CTX_TCP_TIMER1_VALUE                      (0x7fffffffL<<1)
1912
1913    u16_t l5ctx_tcp_timer2;
1914        #define L5CTX_TCP_TIMER2_DISABLE                    (1<<0)
1915        #define L5CTX_TCP_TIMER2_VALUE                      (0x7fff<<1)
1916
1917    u16_t l5ctx_tcp_timer3;
1918        #define L5CTX_TCP_TIMER3_DISABLE                    (1<<0)
1919        #define L5CTX_TCP_TIMER3_VALUE                      (0x7fff<<1)
1920
1921    u16_t l5ctx_tcp_timer4;
1922        #define L5CTX_TCP_TIMER4_DISABLE                    (1<<0)
1923        #define L5CTX_TCP_TIMER4_VALUE                      (0x7fff<<1)
1924
1925    u16_t l5ctx_tcp_timer5;
1926        #define L5CTX_TCP_TIMER5_DISABLE                    (1<<0)
1927        #define L5CTX_TCP_TIMER5_VALUE                      (0x7fff<<1)
1928
1929    u32_t l5ctx_tcp_slot_size;
1930        #define L5CTX_TCP_SLOT_SIZE_SLOT_SIZE               (0xffffffL<<0)
1931        #define L5CTX_TCP_SLOT_SIZE_CMD_MAX                 (0x7fL<<24)
1932        #define L5CTX_TCP_SLOT_SIZE_STOP                    (1UL<<31)
1933
1934    u32_t l5ctx_tcp_snd_cwin;
1935    u32_t l5ctx_tcp_snd_win;
1936    u8_t l5ctx_tcp_num_dupack;
1937    u8_t l5ctx_tcp_tx_protocol_flags;
1938        #define L5CTX_TCP_TX_PROTOCOL_FLAGS_TIMER_DELAY_ACK  (1<<0)
1939        #define L5CTX_TCP_TX_PROTOCOL_FLAGS_UPLOAD          (1<<1)
1940        #define L5CTX_TCP_TX_PROTOCOL_FLAGS_FORCE_ACK       (1<<2)
1941        #define L5CTX_TCP_TX_PROTOCOL_FLAGS_LAST_ACK        (1<<3)
1942        #define L5CTX_TCP_TX_PROTOCOL_FLAGS_LAST_RST        (1<<4)
1943        #define L5CTX_TCP_TX_PROTOCOL_FLAGS_FORCE_RST       (1<<5)
1944        #define L5CTX_TCP_TX_PROTOCOL_FLAGS_FORCE_ACK_MINUS  (1<<6)
1945        #define L5CTX_TCP_TX_PROTOCOL_FLAGS_TSCH_WA         (1<<7)
1946
1947    u8_t l5ctx_upload_rxp;
1948        #define L5CTX_UPLOAD_RXP_COM                        (1<<0)
1949
1950    u8_t l5ctx_qp_ou_state;
1951        #define L5CTX_QP_OU_STATE_UPLOADED                  (1<<0)
1952        #define L5CTX_QP_OU_STATE_OFFLOADED                 (1<<1)
1953        #define L5CTX_QP_OU_STATE_UPLOAD_REQ                (1<<2)
1954        #define L5CTX_QP_OU_STATE_OFFLOAD_REQ               (1<<3)
1955    u32_t unused_7;
1956
1957    u16_t l5ctx_tcp_mss;
1958    u8_t l5ctx_tcp_flags;
1959        #define L5CTX_TCP_FLAGS_NO_DELAY_ACK                (1<<0)
1960        #define L5CTX_TCP_FLAGS_KEEP_ALIVE                  (1<<1)
1961        #define L5CTX_TCP_FLAGS_NAGLE                       (1<<2)
1962        #define L5CTX_TCP_FLAGS_TIME_STAMP                  (1<<3)
1963        #define L5CTX_TCP_FLAGS_SACK                        (1<<4)
1964        #define L5CTX_TCP_FLAGS_SEG_SCALING                 (1<<5)
1965
1966    u8_t l5ctx_tcp_state;
1967        #define L5CTX_TCP_STATE_VALUE                       (0xff<<0)
1968            #define L5CTX_TCP_STATE_VALUE_UNDEFINED         (0<<0)
1969            #define L5CTX_TCP_STATE_VALUE_LISTEN            (2<<0)
1970            #define L5CTX_TCP_STATE_VALUE_SYN_SENT          (4<<0)
1971            #define L5CTX_TCP_STATE_VALUE_SYN_RECV          (6<<0)
1972            #define L5CTX_TCP_STATE_VALUE_CLOSE_WAIT        (8<<0)
1973            #define L5CTX_TCP_STATE_VALUE_ESTABLISHED       (10<<0)
1974            #define L5CTX_TCP_STATE_VALUE_FIN_WAIT1         (12<<0)
1975            #define L5CTX_TCP_STATE_VALUE_FIN_WAIT2         (14<<0)
1976            #define L5CTX_TCP_STATE_VALUE_TIME_WAIT         (16<<0)
1977            #define L5CTX_TCP_STATE_VALUE_CLOSE             (18<<0)
1978            #define L5CTX_TCP_STATE_VALUE_LAST_ACK          (20<<0)
1979            #define L5CTX_TCP_STATE_VALUE_CLOSING           (22<<0)
1980
1981    u32_t l5ctx_tcp_rcv_next;
1982    u32_t l5ctx_last_ack_sent;
1983    u32_t l5ctx_tcp_rcv_win_seq;
1984    u32_t l5ctx_tcp_snd_una;
1985    u32_t l5ctx_tcp_snd_next;
1986    u32_t l5ctx_tcp_tstamp;
1987    u32_t l5ctx_tcp_ssthresh;
1988    u16_t l5ctx_tcp_sm_rtt;
1989    u16_t l5ctx_tcp_sm_delta;
1990    u32_t l5ctx_tcp_max_snd_win;
1991    u8_t l5ctx_tcp_comp_cons_retx_num;
1992    u8_t l5ctx_tcp_num_retx;
1993    u8_t unused_8;
1994    u8_t l5ctx_tcp_txp_cmd;
1995    u32_t unused_9;
1996    u8_t l5ctx_snd_q_max_cached_wqes;
1997    u8_t l5ctx_null_cmd_cell_pidx;
1998    u8_t l5ctx_null_cmd_cell_cidx;
1999    u8_t l5ctx_qp_flags;
2000        #define L5CTX_QP_FLAGS_QP_VALID                     (1<<0)
2001        #define L5CTX_QP_FLAGS_SUPPORTS_LAZY_WQES           (1<<1)
2002        #define L5CTX_QP_FLAGS_INBOUND_RDMA_READ_DISABLED   (1<<2)
2003        #define L5CTX_QP_FLAGS_INBOUND_RDMA_WRITE_DISABLED  (1<<3)
2004        #define L5CTX_QP_FLAGS_WINDOW_BINDS_ENABLED         (1<<4)
2005        #define L5CTX_QP_FLAGS_LOCAL_INVALIDATE_IN_PROGRESS  (1<<5)
2006
2007    l5_orrq_entry_b_xi_t l5ctx_orrq[1];
2008    u32_t l5ctx_cq_cid;
2009    u32_t unused_10[4];
2010    u32_t l5ctx_rdma_crc;
2011    u32_t l5ctx_tcp_snd_wl1;
2012    u32_t l5ctx_tcp_snd_wl2;
2013    u16_t unused_11;
2014    u8_t l5ctx_tcp_upload_reason;
2015        #define L5CTX_TCP_UPLOAD_REASON_KEEP_ALIVE          (1<<0)
2016        #define L5CTX_TCP_UPLOAD_REASON_FIN                 (1<<1)
2017        #define L5CTX_TCP_UPLOAD_REASON_URG                 (1<<2)
2018        #define L5CTX_TCP_UPLOAD_REASON_FRAGMENT            (1<<3)
2019        #define L5CTX_TCP_UPLOAD_REASON_IP_OPTION           (1<<4)
2020        #define L5CTX_TCP_UPLOAD_REASON_RST                 (1<<5)
2021        #define L5CTX_TCP_UPLOAD_REASON_SYN                 (1<<6)
2022        #define L5CTX_TCP_UPLOAD_REASON_TIMEOUT             (1<<7)
2023    u8_t unused_12;
2024
2025    u32_t l5ctx_tcp_offload_seq;
2026    u32_t l5ctx_pg_cwin;
2027    u32_t l5ctx_high_tcp_ack_sn_rcvd;
2028    u16_t l5ctx_pd;
2029    u8_t l5ctx_snd_q_cidx;
2030    u8_t l5ctx_snd_q_pidx;
2031    u8_t l5ctx_read_rsp_wait;
2032    u8_t l5ctx_rcv_q_flags;
2033        #define L5CTX_RCV_Q_FLAGS_PAGE_SIZE                 (0xf<<0)
2034            #define L5CTX_RCV_Q_FLAGS_PAGE_SIZE_256         (0<<0)
2035            #define L5CTX_RCV_Q_FLAGS_PAGE_SIZE_512         (1<<0)
2036            #define L5CTX_RCV_Q_FLAGS_PAGE_SIZE_1K          (2<<0)
2037            #define L5CTX_RCV_Q_FLAGS_PAGE_SIZE_2K          (3<<0)
2038            #define L5CTX_RCV_Q_FLAGS_PAGE_SIZE_4K          (4<<0)
2039            #define L5CTX_RCV_Q_FLAGS_PAGE_SIZE_8K          (5<<0)
2040            #define L5CTX_RCV_Q_FLAGS_PAGE_SIZE_16K         (6<<0)
2041            #define L5CTX_RCV_Q_FLAGS_PAGE_SIZE_32K         (7<<0)
2042            #define L5CTX_RCV_Q_FLAGS_PAGE_SIZE_64K         (8<<0)
2043            #define L5CTX_RCV_Q_FLAGS_PAGE_SIZE_128K        (9<<0)
2044            #define L5CTX_RCV_Q_FLAGS_PAGE_SIZE_256K        (10<<0)
2045            #define L5CTX_RCV_Q_FLAGS_PAGE_SIZE_512K        (11<<0)
2046            #define L5CTX_RCV_Q_FLAGS_PAGE_SIZE_1M          (12<<0)
2047            #define L5CTX_RCV_Q_FLAGS_PAGE_SIZE_2M          (13<<0)
2048        #define L5CTX_RCV_Q_FLAGS_QUEUE_SIZE                (0xf<<4)
2049            #define L5CTX_RCV_Q_FLAGS_QUEUE_SIZE_1          (0<<4)
2050            #define L5CTX_RCV_Q_FLAGS_QUEUE_SIZE_2          (1<<4)
2051            #define L5CTX_RCV_Q_FLAGS_QUEUE_SIZE_4          (2<<4)
2052            #define L5CTX_RCV_Q_FLAGS_QUEUE_SIZE_8          (3<<4)
2053            #define L5CTX_RCV_Q_FLAGS_QUEUE_SIZE_16         (4<<4)
2054            #define L5CTX_RCV_Q_FLAGS_QUEUE_SIZE_32         (5<<4)
2055            #define L5CTX_RCV_Q_FLAGS_QUEUE_SIZE_64         (6<<4)
2056            #define L5CTX_RCV_Q_FLAGS_QUEUE_SIZE_128        (7<<4)
2057
2058    u8_t l5ctx_rcv_q_pidx;
2059    u8_t l5ctx_rcv_q_rxp_cidx;
2060    u8_t l5ctx_rcv_q_com_cidx;
2061    u8_t l5ctx_ird;
2062    u8_t l5ctx_rx_comp_flags;
2063        #define L5CTX_RX_COMP_FLAGS_TCP_HOLE_EXISTS         (1<<0)
2064        #define L5CTX_RX_COMP_FLAGS_MARKER_IN_ISLAND        (1<<1)
2065        #define L5CTX_RX_COMP_FLAGS_READ_REQ_OUTSTANDING    (1<<2)
2066        #define L5CTX_RX_COMP_FLAGS_TCP_ISLAND_CREATED      (1<<3)
2067
2068    u8_t l5ctx_ooo_read_resp_segs_w_L_bit;
2069    u8_t l5ctx_ooo_send_msg_segs_w_L_bit;
2070    u8_t l5ctx_ooo_read_request_msgs;
2071    u8_t l5ctx_miq_index;
2072    u8_t l5ctx_rcv_path_op_state;
2073        #define L5CTX_RCV_PATH_OP_STATE_OPERATIONAL         (1<<0)
2074        #define L5CTX_RCV_PATH_OP_STATE_BYPASS              (1<<1)
2075
2076    u32_t l5ctx_send_msg_high_msn_completed;
2077    u32_t l5ctx_read_req_high_msn_queued;
2078    u32_t l5ctx_rx_initial_tcp_sn;
2079    u32_t l5ctx_rsvd_l4_hole_mgmt[4];
2080    l5_irrq_entry_b_xi_t l5ctx_irrq[1];
2081    l5_abuf_cell_b_xi_t l5ctx_rcv_q_abuf[2];
2082    u32_t unused_13[9];
2083    u16_t l5ctx_snd_q_max_wqes;
2084    u16_t l5ctx_snd_q_fw_qidx;
2085    u16_t l5ctx_snd_q_pgtbl_pgidx;
2086    u16_t l5ctx_snd_q_wqes_per_page;
2087    u16_t l5ctx_snd_q_num_pages;
2088    u16_t l5ctx_snd_q_nx_pg_qidx;
2089    u32_t l5ctx_snd_q_pgtbl_phaddr_hi;
2090    u8_t l5ctx_snd_q_pgtbl_phaddr_lo[3];
2091    u8_t l5ctx_snd_q_flags;
2092        #define L5CTX_SND_Q_FLAGS_PAGE_SIZE                 (0xf<<0)
2093            #define L5CTX_SND_Q_FLAGS_PAGE_SIZE_256         (0<<0)
2094            #define L5CTX_SND_Q_FLAGS_PAGE_SIZE_512         (1<<0)
2095            #define L5CTX_SND_Q_FLAGS_PAGE_SIZE_1K          (2<<0)
2096            #define L5CTX_SND_Q_FLAGS_PAGE_SIZE_2K          (3<<0)
2097            #define L5CTX_SND_Q_FLAGS_PAGE_SIZE_4K          (4<<0)
2098            #define L5CTX_SND_Q_FLAGS_PAGE_SIZE_8K          (5<<0)
2099            #define L5CTX_SND_Q_FLAGS_PAGE_SIZE_16K         (6<<0)
2100            #define L5CTX_SND_Q_FLAGS_PAGE_SIZE_32K         (7<<0)
2101            #define L5CTX_SND_Q_FLAGS_PAGE_SIZE_64K         (8<<0)
2102            #define L5CTX_SND_Q_FLAGS_PAGE_SIZE_128K        (9<<0)
2103            #define L5CTX_SND_Q_FLAGS_PAGE_SIZE_256K        (10<<0)
2104            #define L5CTX_SND_Q_FLAGS_PAGE_SIZE_512K        (11<<0)
2105            #define L5CTX_SND_Q_FLAGS_PAGE_SIZE_1M          (12<<0)
2106            #define L5CTX_SND_Q_FLAGS_PAGE_SIZE_2M          (13<<0)
2107        #define L5CTX_SND_Q_FLAGS_QUEUE_SIZE                (0xf<<4)
2108            #define L5CTX_SND_Q_FLAGS_QUEUE_SIZE_1          (0<<4)
2109            #define L5CTX_SND_Q_FLAGS_QUEUE_SIZE_2          (1<<4)
2110            #define L5CTX_SND_Q_FLAGS_QUEUE_SIZE_4          (2<<4)
2111            #define L5CTX_SND_Q_FLAGS_QUEUE_SIZE_8          (3<<4)
2112            #define L5CTX_SND_Q_FLAGS_QUEUE_SIZE_16         (4<<4)
2113            #define L5CTX_SND_Q_FLAGS_QUEUE_SIZE_32         (5<<4)
2114            #define L5CTX_SND_Q_FLAGS_QUEUE_SIZE_64         (6<<4)
2115            #define L5CTX_SND_Q_FLAGS_QUEUE_SIZE_128        (7<<4)
2116
2117    u32_t l5ctx_rcv_q_pgtbl_phaddr_hi;
2118    u8_t l5ctx_rcv_q_pgtbl_phaddr_lo[3];
2119    u8_t l5ctx_ord;
2120    u16_t l5ctx_rcv_q_nx_pg_qidx;
2121    u16_t l5ctx_tsch_mult_value;
2122    u16_t l5ctx_rcv_q_max_wqes;
2123    u16_t l5ctx_rcv_q_fw_qidx;
2124    u16_t l5ctx_rcv_q_pgtbl_pgidx;
2125    u16_t l5ctx_rcv_q_wqes_per_page;
2126    u16_t l5ctx_rcv_q_num_pages;
2127    u8_t l5ctx_max_scatter_list_elements;
2128    u8_t l5ctx_max_gather_list_elements;
2129    u32_t l5ctx_curr_send_msn;
2130    u32_t l5ctx_curr_rdma_read_msn;
2131    u32_t l5ctx_snd_q_cached_pte_phaddr_hi;
2132    u32_t l5ctx_snd_q_cached_pte_phaddr_lo;
2133    u32_t l5ctx_rcv_q_cached_pte_phaddr_hi;
2134    u32_t l5ctx_rcv_q_cached_pte_phaddr_lo;
2135    u32_t unused_14[15];
2136    tcp_context_cmd_cell_b_xi_t l5ctx_cmd[3];
2137} l5_context_b_xi_t;
2138
2139
2140/*
2141 *  l5_context_l definition
2142 */
2143typedef struct l5_context_l
2144{
2145    u16_t l5ctx_cq_cidx;
2146    u8_t l5ctx_size;
2147    u8_t l5ctx_type;
2148
2149    u16_t l5ctx_sq_pidx;
2150    u8_t l5ctx_oubits;
2151
2152    u8_t l5ctx_gen_bd_max;
2153    u16_t l5ctx_rq_pidx;
2154    u16_t l5ctx_tcp_pgid;
2155    u32_t l5ctx_tcp_timer1;
2156
2157    u16_t l5ctx_tcp_timer3;
2158
2159    u16_t l5ctx_tcp_timer2;
2160
2161    u16_t l5ctx_tcp_timer5;
2162
2163    u16_t l5ctx_tcp_timer4;
2164
2165    u32_t l5ctx_tcp_snd_wl1;
2166    u32_t l5ctx_tcp_snd_wl2;
2167    u8_t l5ctx_tcp_modes;
2168
2169    u8_t l5ctx_tcp_dack;
2170    u8_t l5ctx_tcp_tos;
2171    u8_t l5ctx_tcp_ttl;
2172    u32_t l5ctx_tcp_max_adv_win;
2173    u32_t l5ctx_tcp_timer;
2174    u32_t l5ctx_tcp_ip_src;
2175    u32_t l5ctx_tcp_ip_dst;
2176    u8_t l5ctx_tcp_tcp_hlen;
2177    u8_t l5ctx_tcp_rcv_seg_scale;
2178    u8_t l5ctx_tcp_snd_seg_scale;
2179    u8_t l5ctx_tcp_iphdr_nbytes;
2180    u16_t l5ctx_tcp_dst_port;
2181    u16_t l5ctx_tcp_src_port;
2182    u8_t l5ctx_tcp_state;
2183
2184    u8_t l5ctx_tcp_flags;
2185
2186    u16_t l5ctx_tcp_mss;
2187    u32_t l5ctx_tcp_rcv_next;
2188    u32_t l5ctx_last_ack_sent;
2189    u32_t l5ctx_tcp_rcv_win_seq;
2190    u32_t l5ctx_tcp_snd_una;
2191    u32_t l5ctx_tcp_snd_next;
2192    u32_t l5ctx_tcp_snd_max;
2193    u32_t l5ctx_tcp_snd_win;
2194    u32_t l5ctx_tcp_snd_cwin;
2195    u32_t l5ctx_tcp_tstamp;
2196    u32_t l5ctx_tcp_ssthresh;
2197    u16_t l5ctx_tcp_sm_delta;
2198    u16_t l5ctx_tcp_sm_rtt;
2199    u32_t l5ctx_tcp_max_snd_win;
2200    u32_t l5ctx_tcp_tsch_snd_next;
2201    u32_t l5ctx_tcp_slot_size;
2202
2203    u8_t l5ctx_tcp_tsch_xnum;
2204
2205    u8_t l5ctx_tcp_cons_retx_num;
2206    u8_t l5ctx_tcp_tsch_cmd;
2207    u8_t l5ctx_tcp_cp_cmd;
2208    u8_t l5ctx_tcp_tsch_cons_retx_num;
2209    u8_t l5ctx_tcp_prod_retx_num;
2210    u8_t l5ctx_tcp_tx_protocol_flags;
2211
2212    u8_t l5ctx_tcp_num_dupack;
2213    u8_t l5ctx_tcp_txp_cmd;
2214    u8_t l5ctx_tcp_upload_reason;
2215
2216    u8_t l5ctx_tcp_num_retx;
2217    u8_t l5ctx_tcp_comp_cons_retx_num;
2218    u32_t unused_0;
2219    tcp_context_cmd_cell_l_te_t l5ctx_cmd[3];
2220    u16_t l5ctx_snd_q_fw_qidx;
2221    u16_t l5ctx_snd_q_max_wqes;
2222    u16_t l5ctx_snd_q_pgtbl_pgidx;
2223    u16_t l5ctx_snd_q_nx_pg_qidx;
2224    u16_t l5ctx_snd_q_num_pages;
2225    u16_t l5ctx_snd_q_wqes_per_page;
2226    u8_t l5ctx_snd_q_flags;
2227
2228    u8_t l5ctx_snd_q_max_cached_wqes;
2229    u8_t l5ctx_snd_q_cidx;
2230    u8_t l5ctx_snd_q_pidx;
2231    u32_t l5ctx_snd_q_pgtbl_phaddr_hi;
2232    u8_t l5ctx_snd_q_read_rsp_wait;
2233    u8_t l5ctx_snd_q_pgtbl_phaddr_lo[3];
2234    u32_t l5ctx_snd_q_cached_pte_phaddr_hi;
2235    u32_t l5ctx_snd_q_cached_pte_phaddr_lo;
2236    l5_cmd_cell_l_t l5ctx_snd_q_cmd[3];
2237    u16_t l5ctx_rcv_q_fw_qidx;
2238    u16_t l5ctx_rcv_q_max_wqes;
2239    u16_t l5ctx_rcv_q_pgtbl_pgidx;
2240    u16_t l5ctx_rcv_q_nx_pg_qidx;
2241    u16_t l5ctx_rcv_q_num_pages;
2242    u16_t l5ctx_rcv_q_wqes_per_page;
2243    u8_t l5ctx_rcv_q_flags;
2244
2245    u8_t l5ctx_rcv_q_com_cidx;
2246    u8_t l5ctx_rcv_q_rxp_cidx;
2247    u8_t l5ctx_rcv_q_pidx;
2248    u32_t l5ctx_rcv_q_pgtbl_phaddr_hi;
2249    u8_t l5ctx_rcv_q_qp_ou_state;
2250        #define L5CTX_RCV_Q_QP_OU_STATE_UPLOADED            (1<<0)
2251        #define L5CTX_RCV_Q_QP_OU_STATE_OFFLOADED           (1<<1)
2252        #define L5CTX_RCV_Q_QP_OU_STATE_UPLOAD_REQ          (1<<2)
2253        #define L5CTX_RCV_Q_QP_OU_STATE_OFFLOAD_REQ         (1<<3)
2254
2255    u8_t l5ctx_rcv_q_pgtbl_phaddr_lo[3];
2256    u32_t l5ctx_rcv_q_cached_pte_phaddr_hi;
2257    u32_t l5ctx_rcv_q_cached_pte_phaddr_lo;
2258    l5_abuf_cell_l_t l5ctx_rcv_q_abuf[2];
2259    u32_t l5ctx_cq_cid;
2260    u32_t l5ctx_curr_send_msn;
2261    u32_t l5ctx_curr_rdma_read_msn;
2262    u8_t l5ctx_ird;
2263    u8_t l5ctx_rcv_path_op_state;
2264
2265    u16_t l5ctx_pd;
2266    u32_t l5ctx_tx_initial_tcp_sn;
2267    u8_t l5ctx_null_cmd_cell_cidx;
2268    u8_t l5ctx_null_cmd_cell_pidx;
2269    u16_t l5ctx_tsch_mult_value;
2270    l5_orrq_entry_l_t l5ctx_orrq[1];
2271    l5_irrq_entry_l_t l5ctx_irrq[1];
2272    u8_t l5ctx_upload_flag;
2273
2274    u8_t l5ctx_qp_flags;
2275
2276    u8_t l5ctx_rx_comp_flags;
2277
2278    u8_t l5ctx_miq_index;
2279    u8_t l5ctx_ooo_read_request_msgs;
2280    u8_t l5ctx_ooo_send_msg_segs_w_L_bit;
2281    u8_t l5ctx_ooo_read_resp_segs_w_L_bit;
2282    u8_t l5ctx_upload_rxp;
2283
2284    u32_t l5ctx_high_tcp_ack_sn_rcvd;
2285    u32_t l5ctx_rx_initial_tcp_sn;
2286    u32_t l5ctx_send_msg_high_msn_completed;
2287    u32_t l5ctx_read_req_high_msn_queued;
2288    u32_t l5ctx_rsvd_l4_hole_mgmt[3];
2289    u16_t l5ctx_offload_flag;
2290    u16_t l5ctx_cam_index;
2291} l5_context_l_t;
2292
2293
2294
2295/*
2296 *  l5_context_l definition
2297 */
2298typedef struct l5_context_l_xi
2299{
2300    u32_t l5ctx_tcp_tsch_snd_next;
2301    u32_t l5ctx_tcp_snd_max;
2302    u8_t l5ctx_tcp_tsch_xnum;
2303        #define L5CTX_TCP_TSCH_XNUM_VAL                     (0x7f<<0)
2304        #define L5CTX_TCP_TSCH_XNUM_L4                      (1<<7)
2305
2306    u8_t l5ctx_tcp_cons_retx_num;
2307    u8_t l5ctx_tcp_tsch_cmd;
2308    u8_t l5ctx_tcp_cp_cmd;
2309    u8_t l5ctx_tcp_tsch_cons_retx_num;
2310    u8_t l5ctx_tcp_prod_retx_num;
2311    u16_t l5ctx_tcp_pgid;
2312        #define L5CTX_TCP_PGID_VAL                          (0x3fff<<0)
2313    u16_t unused_0;
2314    u8_t unused_1;
2315
2316    u8_t l5ctx_tcp_l2_slot_size;
2317    u32_t unused_2;
2318    u8_t l5ctx_tcp_modes;
2319        #define L5CTX_TCP_MODES_RST_INDICATED               (1<<0)
2320        #define L5CTX_TCP_MODES_DISC_BD                     (1<<1)
2321        #define L5CTX_TCP_MODES_UPLOAD_INITED               (1<<2)
2322        #define L5CTX_TCP_MODES_RMT_DISC                    (1<<3)
2323        #define L5CTX_TCP_MODES_PG_INVALIDATED              (1<<4)
2324        #define L5CTX_TCP_MODES_ABORT_PENDING               (1<<5)
2325        #define L5CTX_TCP_MODES_DISC_PENDING                (1<<6)
2326        #define L5CTX_TCP_MODES_SS                          (1<<7)
2327
2328    u8_t l5ctx_tcp_dack;
2329    u8_t l5ctx_tcp_tos;
2330    u8_t l5ctx_tcp_ttl;
2331    u32_t l5ctx_tcp_max_adv_win;
2332    u32_t l5ctx_timer;
2333    u32_t l5ctx_tcp_ip_src;
2334    u32_t l5ctx_tcp_ip_dst;
2335    u8_t l5ctx_tcp_tcp_hlen;
2336    u8_t l5ctx_tcp_rcv_seg_scale;
2337    u8_t l5ctx_tcp_snd_seg_scale;
2338    u8_t l5ctx_tcp_iphdr_nbytes;
2339    u16_t l5ctx_tcp_dst_port;
2340    u16_t l5ctx_tcp_src_port;
2341    u32_t l5ctx_tx_initial_tcp_sn;
2342    u16_t unused_3;
2343    u8_t unused_4;
2344    u8_t l5ctx_upload_flag;
2345        #define L5CTX_UPLOAD_FLAG_TXP                       (1<<0)
2346        #define L5CTX_UPLOAD_FLAG_TXP_COM                   (1<<1)
2347    u32_t unused_5[17];
2348
2349    u16_t l5ctx_cq_cidx;
2350    u8_t l5ctx_size;
2351        #define L5CTX_SIZE_ARM_CQ                           (1<<0)
2352
2353    u8_t l5ctx_type;
2354        #define L5CTX_TYPE_TYPE                             (0xf<<4)
2355            #define L5CTX_TYPE_TYPE_EMPTY                   (0<<4)
2356            #define L5CTX_TYPE_TYPE_L2                      (1<<4)
2357            #define L5CTX_TYPE_TYPE_TCP                     (2<<4)
2358            #define L5CTX_TYPE_TYPE_L5                      (3<<4)
2359            #define L5CTX_TYPE_TYPE_L2_BD_CHN               (4<<4)
2360
2361    u16_t l5ctx_sq_pidx;
2362    u8_t l5ctx_oubits;
2363        #define L5CTX_OUBITS_ACTIVATE                       (1<<0)
2364        #define L5CTX_OUBITS_CP_UPLOAD                      (1<<1)
2365        #define L5CTX_OUBITS_RXP_UPLOAD                     (1<<2)
2366        #define L5CTX_OUBITS_TXP_UPLOAD                     (1<<3)
2367        #define L5CTX_OUBITS_COM_RX_UPLOAD                  (1<<4)
2368        #define L5CTX_OUBITS_COM_TX_UPLOAD                  (1<<5)
2369        #define L5CTX_OUBITS_CP_UPLOAD_COMP                 (1<<6)
2370        #define L5CTX_OUBITS_HOST_ACK                       (1<<7)
2371
2372    u8_t l5ctx_gen_bd_max;
2373    u16_t l5ctx_rq_pidx;
2374    u16_t unused_6;
2375    u32_t l5ctx_tcp_timer1;
2376        #define L5CTX_TCP_TIMER1_DISABLE                    (1UL<<0)
2377        #define L5CTX_TCP_TIMER1_VALUE                      (0x7fffffffL<<1)
2378
2379    u16_t l5ctx_tcp_timer3;
2380        #define L5CTX_TCP_TIMER3_DISABLE                    (1<<0)
2381        #define L5CTX_TCP_TIMER3_VALUE                      (0x7fff<<1)
2382
2383    u16_t l5ctx_tcp_timer2;
2384        #define L5CTX_TCP_TIMER2_DISABLE                    (1<<0)
2385        #define L5CTX_TCP_TIMER2_VALUE                      (0x7fff<<1)
2386
2387    u16_t l5ctx_tcp_timer5;
2388        #define L5CTX_TCP_TIMER5_DISABLE                    (1<<0)
2389        #define L5CTX_TCP_TIMER5_VALUE                      (0x7fff<<1)
2390
2391    u16_t l5ctx_tcp_timer4;
2392        #define L5CTX_TCP_TIMER4_DISABLE                    (1<<0)
2393        #define L5CTX_TCP_TIMER4_VALUE                      (0x7fff<<1)
2394
2395    u32_t l5ctx_tcp_slot_size;
2396        #define L5CTX_TCP_SLOT_SIZE_SLOT_SIZE               (0xffffffL<<0)
2397        #define L5CTX_TCP_SLOT_SIZE_CMD_MAX                 (0x7fL<<24)
2398        #define L5CTX_TCP_SLOT_SIZE_STOP                    (1UL<<31)
2399
2400    u32_t l5ctx_tcp_snd_cwin;
2401    u32_t l5ctx_tcp_snd_win;
2402    u8_t l5ctx_qp_ou_state;
2403        #define L5CTX_QP_OU_STATE_UPLOADED                  (1<<0)
2404        #define L5CTX_QP_OU_STATE_OFFLOADED                 (1<<1)
2405        #define L5CTX_QP_OU_STATE_UPLOAD_REQ                (1<<2)
2406        #define L5CTX_QP_OU_STATE_OFFLOAD_REQ               (1<<3)
2407
2408    u8_t l5ctx_upload_rxp;
2409        #define L5CTX_UPLOAD_RXP_COM                        (1<<0)
2410
2411    u8_t l5ctx_tcp_tx_protocol_flags;
2412        #define L5CTX_TCP_TX_PROTOCOL_FLAGS_TIMER_DELAY_ACK  (1<<0)
2413        #define L5CTX_TCP_TX_PROTOCOL_FLAGS_UPLOAD          (1<<1)
2414        #define L5CTX_TCP_TX_PROTOCOL_FLAGS_FORCE_ACK       (1<<2)
2415        #define L5CTX_TCP_TX_PROTOCOL_FLAGS_LAST_ACK        (1<<3)
2416        #define L5CTX_TCP_TX_PROTOCOL_FLAGS_LAST_RST        (1<<4)
2417        #define L5CTX_TCP_TX_PROTOCOL_FLAGS_FORCE_RST       (1<<5)
2418        #define L5CTX_TCP_TX_PROTOCOL_FLAGS_FORCE_ACK_MINUS  (1<<6)
2419        #define L5CTX_TCP_TX_PROTOCOL_FLAGS_TSCH_WA         (1<<7)
2420
2421    u8_t l5ctx_tcp_num_dupack;
2422    u32_t unused_7;
2423    u8_t l5ctx_tcp_state;
2424        #define L5CTX_TCP_STATE_VALUE                       (0xff<<0)
2425            #define L5CTX_TCP_STATE_VALUE_UNDEFINED         (0<<0)
2426            #define L5CTX_TCP_STATE_VALUE_LISTEN            (2<<0)
2427            #define L5CTX_TCP_STATE_VALUE_SYN_SENT          (4<<0)
2428            #define L5CTX_TCP_STATE_VALUE_SYN_RECV          (6<<0)
2429            #define L5CTX_TCP_STATE_VALUE_CLOSE_WAIT        (8<<0)
2430            #define L5CTX_TCP_STATE_VALUE_ESTABLISHED       (10<<0)
2431            #define L5CTX_TCP_STATE_VALUE_FIN_WAIT1         (12<<0)
2432            #define L5CTX_TCP_STATE_VALUE_FIN_WAIT2         (14<<0)
2433            #define L5CTX_TCP_STATE_VALUE_TIME_WAIT         (16<<0)
2434            #define L5CTX_TCP_STATE_VALUE_CLOSE             (18<<0)
2435            #define L5CTX_TCP_STATE_VALUE_LAST_ACK          (20<<0)
2436            #define L5CTX_TCP_STATE_VALUE_CLOSING           (22<<0)
2437
2438    u8_t l5ctx_tcp_flags;
2439        #define L5CTX_TCP_FLAGS_NO_DELAY_ACK                (1<<0)
2440        #define L5CTX_TCP_FLAGS_KEEP_ALIVE                  (1<<1)
2441        #define L5CTX_TCP_FLAGS_NAGLE                       (1<<2)
2442        #define L5CTX_TCP_FLAGS_TIME_STAMP                  (1<<3)
2443        #define L5CTX_TCP_FLAGS_SACK                        (1<<4)
2444        #define L5CTX_TCP_FLAGS_SEG_SCALING                 (1<<5)
2445
2446    u16_t l5ctx_tcp_mss;
2447    u32_t l5ctx_tcp_rcv_next;
2448    u32_t l5ctx_last_ack_sent;
2449    u32_t l5ctx_tcp_rcv_win_seq;
2450    u32_t l5ctx_tcp_snd_una;
2451    u32_t l5ctx_tcp_snd_next;
2452    u32_t l5ctx_tcp_tstamp;
2453    u32_t l5ctx_tcp_ssthresh;
2454    u16_t l5ctx_tcp_sm_delta;
2455    u16_t l5ctx_tcp_sm_rtt;
2456    u32_t l5ctx_tcp_max_snd_win;
2457    u8_t l5ctx_tcp_txp_cmd;
2458    u8_t unused_8;
2459    u8_t l5ctx_tcp_num_retx;
2460    u8_t l5ctx_tcp_comp_cons_retx_num;
2461    u32_t unused_9;
2462    u8_t l5ctx_qp_flags;
2463        #define L5CTX_QP_FLAGS_QP_VALID                     (1<<0)
2464        #define L5CTX_QP_FLAGS_SUPPORTS_LAZY_WQES           (1<<1)
2465        #define L5CTX_QP_FLAGS_INBOUND_RDMA_READ_DISABLED   (1<<2)
2466        #define L5CTX_QP_FLAGS_INBOUND_RDMA_WRITE_DISABLED  (1<<3)
2467        #define L5CTX_QP_FLAGS_WINDOW_BINDS_ENABLED         (1<<4)
2468        #define L5CTX_QP_FLAGS_LOCAL_INVALIDATE_IN_PROGRESS  (1<<5)
2469
2470    u8_t l5ctx_null_cmd_cell_cidx;
2471    u8_t l5ctx_null_cmd_cell_pidx;
2472    u8_t l5ctx_snd_q_max_cached_wqes;
2473    l5_orrq_entry_l_xi_t l5ctx_orrq[1];
2474    u32_t l5ctx_cq_cid;
2475    u32_t unused_10[4];
2476    u32_t l5ctx_rdma_crc;
2477    u32_t l5ctx_tcp_snd_wl1;
2478    u32_t l5ctx_tcp_snd_wl2;
2479    u8_t unused_11;
2480    u8_t l5ctx_tcp_upload_reason;
2481        #define L5CTX_TCP_UPLOAD_REASON_KEEP_ALIVE          (1<<0)
2482        #define L5CTX_TCP_UPLOAD_REASON_FIN                 (1<<1)
2483        #define L5CTX_TCP_UPLOAD_REASON_URG                 (1<<2)
2484        #define L5CTX_TCP_UPLOAD_REASON_FRAGMENT            (1<<3)
2485        #define L5CTX_TCP_UPLOAD_REASON_IP_OPTION           (1<<4)
2486        #define L5CTX_TCP_UPLOAD_REASON_RST                 (1<<5)
2487        #define L5CTX_TCP_UPLOAD_REASON_SYN                 (1<<6)
2488        #define L5CTX_TCP_UPLOAD_REASON_TIMEOUT             (1<<7)
2489    u16_t unused_12;
2490
2491    u32_t l5ctx_tcp_offload_seq;
2492    u32_t l5ctx_pg_cwin;
2493    u32_t l5ctx_high_tcp_ack_sn_rcvd;
2494    u8_t l5ctx_snd_q_pidx;
2495    u8_t l5ctx_snd_q_cidx;
2496    u16_t l5ctx_pd;
2497    u8_t l5ctx_rcv_q_rxp_cidx;
2498    u8_t l5ctx_rcv_q_pidx;
2499    u8_t l5ctx_rcv_q_flags;
2500        #define L5CTX_RCV_Q_FLAGS_PAGE_SIZE                 (0xf<<0)
2501            #define L5CTX_RCV_Q_FLAGS_PAGE_SIZE_256         (0<<0)
2502            #define L5CTX_RCV_Q_FLAGS_PAGE_SIZE_512         (1<<0)
2503            #define L5CTX_RCV_Q_FLAGS_PAGE_SIZE_1K          (2<<0)
2504            #define L5CTX_RCV_Q_FLAGS_PAGE_SIZE_2K          (3<<0)
2505            #define L5CTX_RCV_Q_FLAGS_PAGE_SIZE_4K          (4<<0)
2506            #define L5CTX_RCV_Q_FLAGS_PAGE_SIZE_8K          (5<<0)
2507            #define L5CTX_RCV_Q_FLAGS_PAGE_SIZE_16K         (6<<0)
2508            #define L5CTX_RCV_Q_FLAGS_PAGE_SIZE_32K         (7<<0)
2509            #define L5CTX_RCV_Q_FLAGS_PAGE_SIZE_64K         (8<<0)
2510            #define L5CTX_RCV_Q_FLAGS_PAGE_SIZE_128K        (9<<0)
2511            #define L5CTX_RCV_Q_FLAGS_PAGE_SIZE_256K        (10<<0)
2512            #define L5CTX_RCV_Q_FLAGS_PAGE_SIZE_512K        (11<<0)
2513            #define L5CTX_RCV_Q_FLAGS_PAGE_SIZE_1M          (12<<0)
2514            #define L5CTX_RCV_Q_FLAGS_PAGE_SIZE_2M          (13<<0)
2515        #define L5CTX_RCV_Q_FLAGS_QUEUE_SIZE                (0xf<<4)
2516            #define L5CTX_RCV_Q_FLAGS_QUEUE_SIZE_1          (0<<4)
2517            #define L5CTX_RCV_Q_FLAGS_QUEUE_SIZE_2          (1<<4)
2518            #define L5CTX_RCV_Q_FLAGS_QUEUE_SIZE_4          (2<<4)
2519            #define L5CTX_RCV_Q_FLAGS_QUEUE_SIZE_8          (3<<4)
2520            #define L5CTX_RCV_Q_FLAGS_QUEUE_SIZE_16         (4<<4)
2521            #define L5CTX_RCV_Q_FLAGS_QUEUE_SIZE_32         (5<<4)
2522            #define L5CTX_RCV_Q_FLAGS_QUEUE_SIZE_64         (6<<4)
2523            #define L5CTX_RCV_Q_FLAGS_QUEUE_SIZE_128        (7<<4)
2524
2525    u8_t l5ctx_read_rsp_wait;
2526    u8_t l5ctx_ooo_read_resp_segs_w_L_bit;
2527    u8_t l5ctx_rx_comp_flags;
2528        #define L5CTX_RX_COMP_FLAGS_TCP_HOLE_EXISTS         (1<<0)
2529        #define L5CTX_RX_COMP_FLAGS_MARKER_IN_ISLAND        (1<<1)
2530        #define L5CTX_RX_COMP_FLAGS_READ_REQ_OUTSTANDING    (1<<2)
2531        #define L5CTX_RX_COMP_FLAGS_TCP_ISLAND_CREATED      (1<<3)
2532
2533    u8_t l5ctx_ird;
2534    u8_t l5ctx_rcv_q_com_cidx;
2535    u8_t l5ctx_rcv_path_op_state;
2536        #define L5CTX_RCV_PATH_OP_STATE_OPERATIONAL         (1<<0)
2537        #define L5CTX_RCV_PATH_OP_STATE_BYPASS              (1<<1)
2538
2539    u8_t l5ctx_miq_index;
2540    u8_t l5ctx_ooo_read_request_msgs;
2541    u8_t l5ctx_ooo_send_msg_segs_w_L_bit;
2542    u32_t l5ctx_send_msg_high_msn_completed;
2543    u32_t l5ctx_read_req_high_msn_queued;
2544    u32_t l5ctx_rx_initial_tcp_sn;
2545    u32_t l5ctx_rsvd_l4_hole_mgmt[4];
2546    l5_irrq_entry_l_xi_t l5ctx_irrq[1];
2547    l5_abuf_cell_l_xi_t l5ctx_rcv_q_abuf[2];
2548    u32_t unused_13[9];
2549    u16_t l5ctx_snd_q_fw_qidx;
2550    u16_t l5ctx_snd_q_max_wqes;
2551    u16_t l5ctx_snd_q_wqes_per_page;
2552    u16_t l5ctx_snd_q_pgtbl_pgidx;
2553    u16_t l5ctx_snd_q_nx_pg_qidx;
2554    u16_t l5ctx_snd_q_num_pages;
2555    u32_t l5ctx_snd_q_pgtbl_phaddr_hi;
2556    u8_t l5ctx_snd_q_flags;
2557        #define L5CTX_SND_Q_FLAGS_PAGE_SIZE                 (0xf<<0)
2558            #define L5CTX_SND_Q_FLAGS_PAGE_SIZE_256         (0<<0)
2559            #define L5CTX_SND_Q_FLAGS_PAGE_SIZE_512         (1<<0)
2560            #define L5CTX_SND_Q_FLAGS_PAGE_SIZE_1K          (2<<0)
2561            #define L5CTX_SND_Q_FLAGS_PAGE_SIZE_2K          (3<<0)
2562            #define L5CTX_SND_Q_FLAGS_PAGE_SIZE_4K          (4<<0)
2563            #define L5CTX_SND_Q_FLAGS_PAGE_SIZE_8K          (5<<0)
2564            #define L5CTX_SND_Q_FLAGS_PAGE_SIZE_16K         (6<<0)
2565            #define L5CTX_SND_Q_FLAGS_PAGE_SIZE_32K         (7<<0)
2566            #define L5CTX_SND_Q_FLAGS_PAGE_SIZE_64K         (8<<0)
2567            #define L5CTX_SND_Q_FLAGS_PAGE_SIZE_128K        (9<<0)
2568            #define L5CTX_SND_Q_FLAGS_PAGE_SIZE_256K        (10<<0)
2569            #define L5CTX_SND_Q_FLAGS_PAGE_SIZE_512K        (11<<0)
2570            #define L5CTX_SND_Q_FLAGS_PAGE_SIZE_1M          (12<<0)
2571            #define L5CTX_SND_Q_FLAGS_PAGE_SIZE_2M          (13<<0)
2572        #define L5CTX_SND_Q_FLAGS_QUEUE_SIZE                (0xf<<4)
2573            #define L5CTX_SND_Q_FLAGS_QUEUE_SIZE_1          (0<<4)
2574            #define L5CTX_SND_Q_FLAGS_QUEUE_SIZE_2          (1<<4)
2575            #define L5CTX_SND_Q_FLAGS_QUEUE_SIZE_4          (2<<4)
2576            #define L5CTX_SND_Q_FLAGS_QUEUE_SIZE_8          (3<<4)
2577            #define L5CTX_SND_Q_FLAGS_QUEUE_SIZE_16         (4<<4)
2578            #define L5CTX_SND_Q_FLAGS_QUEUE_SIZE_32         (5<<4)
2579            #define L5CTX_SND_Q_FLAGS_QUEUE_SIZE_64         (6<<4)
2580            #define L5CTX_SND_Q_FLAGS_QUEUE_SIZE_128        (7<<4)
2581
2582    u8_t l5ctx_snd_q_pgtbl_phaddr_lo[3];
2583    u32_t l5ctx_rcv_q_pgtbl_phaddr_hi;
2584    u8_t l5ctx_ord;
2585    u8_t l5ctx_rcv_q_pgtbl_phaddr_lo[3];
2586    u16_t l5ctx_tsch_mult_value;
2587    u16_t l5ctx_rcv_q_nx_pg_qidx;
2588    u16_t l5ctx_rcv_q_fw_qidx;
2589    u16_t l5ctx_rcv_q_max_wqes;
2590    u16_t l5ctx_rcv_q_wqes_per_page;
2591    u16_t l5ctx_rcv_q_pgtbl_pgidx;
2592    u8_t l5ctx_max_gather_list_elements;
2593    u8_t l5ctx_max_scatter_list_elements;
2594    u16_t l5ctx_rcv_q_num_pages;
2595    u32_t l5ctx_curr_send_msn;
2596    u32_t l5ctx_curr_rdma_read_msn;
2597    u32_t l5ctx_snd_q_cached_pte_phaddr_hi;
2598    u32_t l5ctx_snd_q_cached_pte_phaddr_lo;
2599    u32_t l5ctx_rcv_q_cached_pte_phaddr_hi;
2600    u32_t l5ctx_rcv_q_cached_pte_phaddr_lo;
2601    u32_t unused_14[15];
2602    tcp_context_cmd_cell_l_xi_t l5ctx_cmd[3];
2603} l5_context_l_xi_t;
2604
2605
2606/*
2607 * l5_context select
2608 */
2609#if defined(LITTLE_ENDIAN)
2610    typedef l5_context_l_t l5_context_t;
2611    typedef l5_context_l_xi_t l5_context_xi_t;
2612#elif defined(BIG_ENDIAN)
2613    typedef l5_context_b_t l5_context_t;
2614    typedef l5_context_b_xi_t l5_context_xi_t;
2615#endif
2616
2617
2618#endif /* _l5_defs_h_ */
2619