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#ifndef _l2_ftq_h_
16#define _l2_ftq_h_
17
18#include "l2_defs.h"
19
20// This is to avoid compiling error for drivers compilation
21#if  !defined (TARGET_CHIP)
22    #define TARGET_CHIP      5709
23#endif
24
25
26
27
28/*
29 *  rxp cmd enqueue definition
30 *  offset: 0000
31 */
32
33
34#if defined(LITTLE_ENDIAN)
35    typedef struct rxpcq_l
36    {
37        u32_t cid;
38	    union{
39            u32_t host_opaque;
40            u32_t generic1;
41        }u1;
42	    union{
43            struct {
44                u16_t status;
45                u8_t  opcode;
46                u8_t  flags;
47            }s1;
48            u32_t generic2;
49        }u2;
50    } rxpcq_l_t;
51
52    typedef rxpcq_l_t rxpcq_t;
53#elif defined(BIG_ENDIAN)
54    typedef struct rxpcq_b
55    {
56        u32_t cid;
57	    union{
58            u32_t host_opaque;
59            u32_t generic1;
60        } u1;
61	    union{
62            struct {
63                u8_t  flags;
64                u8_t  opcode;
65                u16_t status;
66            } s1;
67            u32_t generic2;
68        } u2;
69    } rxpcq_b_t;
70
71    typedef rxpcq_b_t rxpcq_t;
72#endif
73
74
75/*
76 *  rxp enqueue definition
77 *  offset: 0000
78 */
79typedef struct rxpq_b
80{
81    u32_t bits_errors;
82    u32_t bits_status;
83
84    u8_t  bit_mcast_hash_idx;
85    u8_t  bits_acpi_pat;
86    u8_t  knum;
87    u8_t  unused1;
88
89    u16_t rule_tag;
90    u16_t pkt_len;
91
92    u16_t vlan_tag;
93    u8_t  ip_hdr_offset;
94    u8_t  rx_qid;
95
96    u16_t ip_xsum;
97    // this field has been extended to 2-byte in Xinan
98#if (TARGET_CHIP == 5706)
99    u8_t  tcp_udp_hdr_offset;
100    u8_t  unused2;
101#else
102    u16_t tcp_udp_hdr_offset;
103#endif
104    u16_t tcp_udp_xsum;
105    u16_t tcp_payload_len;
106
107    u16_t pseud_xsum;
108    u16_t l2_payload_raw_xsum;
109    // this field has been extended to 2-byte in Xinan
110#if (TARGET_CHIP == 5706)
111    u8_t  data_offset;
112    u8_t  unused3;
113#else
114    u16_t data_offset;
115#endif
116    u16_t l3_payload_raw_xsum;
117
118    u32_t mbuf_cluster;
119    u32_t cid;
120
121    u16_t cs16;
122    u16_t unused4;
123
124    u16_t ext_status;
125    u16_t unused5;
126
127} rxpq_b_t;
128
129typedef struct rxpq_l
130{
131    u32_t bits_errors;
132    u32_t bits_status;
133
134    u8_t  unused1;
135    u8_t  knum;
136    u8_t  bits_acpi_pat;
137    u8_t  bit_mcast_hash_idx;
138
139    u16_t pkt_len;
140    u16_t rule_tag;
141
142    u8_t  rx_qid;
143    u8_t  ip_hdr_offset;
144    u16_t vlan_tag;
145
146    // this field has been extended to 2-byte in Xinan
147#if (TARGET_CHIP == 5706)
148    u8_t  unused2;
149    u8_t tcp_udp_hdr_offset;
150#else
151    u16_t tcp_udp_hdr_offset;
152#endif
153    u16_t ip_xsum;
154
155    u16_t tcp_payload_len;
156    u16_t tcp_udp_xsum;
157
158    u16_t l2_payload_raw_xsum;
159    u16_t pseud_xsum;
160
161    u16_t l3_payload_raw_xsum;
162    // this field has been extended to 2-byte in Xinan
163#if (TARGET_CHIP == 5706)
164    u8_t  unused3;
165    u8_t  data_offset;
166#else
167    u16_t data_offset;
168#endif
169    u32_t mbuf_cluster;
170    u32_t cid;
171
172    u16_t unused4;
173    u16_t cs16;
174
175    u16_t unused5;
176    u16_t ext_status;
177
178} rxpq_l_t;
179
180#if defined(LITTLE_ENDIAN)
181    typedef rxpq_l_t rxpq_t;
182#elif defined(BIG_ENDIAN)
183    typedef rxpq_b_t rxpq_t;
184#endif
185
186/*
187 *  rv2ppq_generic definition
188 */
189typedef struct rv2ppq_generic_b
190{
191    u32_t cid;
192    u32_t mbuf_cluster;
193    u16_t operand_flags;
194    u8_t knum;
195    u8_t opcode;
196        #define GENERIC_OPCODE_RV2PPQ_VALUE_UNUSED               0
197        #define GENERIC_OPCODE_RV2PPQ_VALUE_NOP                  1
198        #define GENERIC_OPCODE_RV2PPQ_VALUE_OPAQUE               2
199        #define GENERIC_OPCODE_RV2PPQ_VALUE_L2_PLACE             3
200        #define GENERIC_OPCODE_RV2PPQ_VALUE_L4_PLACE             4
201        #define GENERIC_OPCODE_RV2PPQ_VALUE_L4_FLUSH             5
202        #define GENERIC_OPCODE_RV2PPQ_VALUE_L5_PLACE            10
203        #define GENERIC_OPCODE_RV2PPQ_VALUE_L5_FLUSH            14
204        #define GENERIC_OPCODE_RV2PPQ_VALUE_DBG_RDMA            17
205        #define GENERIC_OPCODE_RV2PPQ_VALUE_DBG_RV2P            18
206        #define GENERIC_OPCODE_RV2PPQ_VALUE_L4_INDICATE_TIMEOUT 20
207        #define GENERIC_OPCODE_RV2PPQ_VALUE_L2_JUMBO_PLACE      26
208        #define GENERIC_OPCODE_RV2PPQ_VALUE_L2_FLUSH_BD_CHAIN   28
209        #define GENERIC_OPCODE_RV2PPQ_VALUE_FLR                 29 // X1V only
210
211    u16_t operand16_0;    // Note that 16_0 and 16_1 will be absorbed
212    u16_t operand16_1;    // by RDMA and won't be passed to COM
213    u16_t operand16_2;
214    u16_t operand16_3;
215    u16_t operand16_4;
216    u16_t operand16_5;
217    u16_t operand16_6;
218    u16_t operand16_7;
219    u32_t operand32_0;    // Note that 32_0 and 32_1 will be absorbed
220    u32_t operand32_1;    // by RDMA and won't be passed to COM
221    u32_t operand32_2;
222    u32_t operand32_3;
223    u32_t operand32_4;
224    u8_t rdma_action;   // no need to be cleared by RXP, RV2P will do it
225    u8_t cs16_pkt_len;
226    u16_t cs16;
227} rv2ppq_generic_b_t;
228
229typedef struct rv2ppq_generic_l
230{
231    u32_t cid;
232    u32_t mbuf_cluster;
233    u8_t  opcode;
234    u8_t  knum;
235    u16_t operand_flags;
236    u16_t operand16_1;    // by RDMA and won't be passed to COM
237    u16_t operand16_0;    // Note that 16_0 and 16_1 will be absorbed
238    u16_t operand16_3;
239    u16_t operand16_2;
240    u16_t operand16_5;
241    u16_t operand16_4;
242    u16_t operand16_7;
243    u16_t operand16_6;
244    u32_t operand32_0;    // Note that 32_0 and 32_1 will be absorbed
245    u32_t operand32_1;    // by RDMA and won't be passed to COM
246    u32_t operand32_2;
247    u32_t operand32_3;
248    u32_t operand32_4;
249    u16_t cs16;
250    u8_t cs16_pkt_len;
251    u8_t rdma_action;   // no need to be cleared by RXP, RV2P will do it
252} rv2ppq_generic_l_t;
253
254#if defined(LITTLE_ENDIAN)
255    typedef rv2ppq_generic_l_t rv2ppq_generic_t;
256#elif defined(BIG_ENDIAN)
257    typedef rv2ppq_generic_b_t rv2ppq_generic_t;
258#endif
259
260
261
262/*
263 *  rv2ppq_l2_place definition
264 */
265typedef struct rv2ppq_l2_place_b
266{
267    u32_t cid;
268    u32_t mbuf_cluster;
269    u16_t operand_flags;
270        #define L2_OPERAND_FLAGS_PREPEND_L2_FRAME_HEADER  (1<<0)
271        #define L2_OPERAND_FLAGS_LAST                     (1<<1)
272        #define L2_OPERAND_FLAGS_ENQUEUE_TO_MCP           (1<<2)
273        #define L2_OPERAND_FLAGS_DROP_PKT                 (1<<3)
274        #define L2_OPERAND_FLAGS_MCAST                    (1<<4)
275        #define L2_OPERAND_FLAGS_BCAST                    (1<<5)
276        #define L2_OPERAND_FLAGS_VMQ                      (1<<6)
277        #define L2_OPERAND_FLAGS_OOO_PLACE                (1<<7)
278        #define L2_OPERAND_FLAGS_CU_PKT                   (1<<14)
279
280    u8_t knum;
281    u8_t opcode;
282    u16_t offset;
283    u16_t length; // represent look-ahead_hdr length if VMQ flag is set (total pkt len otherwise)
284    u16_t bits_status;
285    u16_t vlan_tag;
286    u16_t ip_xsum;
287    u16_t udp_tcp_xsum;
288    u16_t unused_0;
289    u16_t packet_length; // represent total packet length
290    u32_t unused_1[2];
291    u16_t unused_2;
292    u16_t error_flags;
293        #define L2_ERROR_FLAGS_CRC_ERROR              (1<<1)
294        #define L2_ERROR_FLAGS_PHY_DECODE_ERROR       (1<<2)
295        #define L2_ERROR_FLAGS_ALIGNMENT_ERROR        (1<<3)
296        #define L2_ERROR_FLAGS_TOO_SHORT_ERROR        (1<<4)
297        #define L2_ERROR_FLAGS_GIANT_FRAME_ERROR      (1<<5)
298
299    u32_t hash;
300    u32_t rt_bt;
301    u8_t rdma_action;  // no need to be cleared by RXP, RV2P will do it
302    u8_t cs16_pkt_len;
303    u16_t cs16;
304
305} rv2ppq_l2_place_b_t;
306
307typedef struct rv2ppq_l2_place_l
308{
309    u32_t cid;
310    u32_t mbuf_cluster;
311    u8_t opcode;
312    u8_t knum;
313    u16_t operand_flags;
314    u16_t length; // represent look-ahead_hdr_length if VMQ flag is set (total pkt len otherwise)
315    u16_t offset;
316    u16_t vlan_tag;
317    u16_t bits_status;
318    u16_t udp_tcp_xsum;
319    u16_t ip_xsum;
320    u16_t packet_length; // represent total packet length if VMQ flag is set
321    u16_t unused_0;
322    u32_t unused_1[2];
323    u16_t error_flags;
324    u16_t unused_2;
325    u32_t hash;
326    u32_t rt_bt;
327    u16_t cs16;
328    u8_t cs16_pkt_len;
329    u8_t rdma_action;  // no need to be cleared by RXP, RV2P will do it
330
331} rv2ppq_l2_place_l_t;
332
333#if defined(LITTLE_ENDIAN)
334    typedef rv2ppq_l2_place_l_t rv2ppq_l2_place_t;
335#elif defined(BIG_ENDIAN)
336    typedef rv2ppq_l2_place_b_t rv2ppq_l2_place_t;
337#endif
338
339
340/*
341 *  rv2ppq_l2_flush_bd_chain definition
342 */
343typedef struct rv2ppq_l2_flush_bd_chain_b
344{
345    u32_t cid;
346    u32_t unused_0;
347    u16_t unused_1;
348    u8_t unused_2;
349    u8_t opcode;
350    u32_t unused_3[9];
351    u8_t rdma_action; // no need to be cleared by RXP, RV2P will do it
352    u8_t cs16_pkt_len;
353    u16_t cs16;
354
355} rv2ppq_l2_flush_bd_chain_b_t;
356
357typedef struct rv2ppq_l2_flush_bd_chain_l
358{
359    u32_t cid;
360    u32_t unused_0;
361    u8_t opcode;
362    u8_t unused_2;
363    u16_t unused_1;
364    u32_t unused_3[9];
365    u16_t cs16;
366    u8_t cs16_pkt_len;
367    u8_t rdma_action; // no need to be cleared by RXP, RV2P will do it
368
369} rv2ppq_l2_flush_bd_chain_l_t;
370
371#if defined(LITTLE_ENDIAN)
372    typedef rv2ppq_l2_flush_bd_chain_l_t rv2ppq_l2_flush_bd_chain_t;
373#elif defined(BIG_ENDIAN)
374    typedef rv2ppq_l2_flush_bd_chain_b_t rv2ppq_l2_flush_bd_chain_t;
375#endif
376
377/*
378 *  comq_generic definition
379 */
380typedef enum
381{
382    GENERIC_OPCODE_COMQ_VALUE_UNUSED                =  0,
383    GENERIC_OPCODE_COMQ_VALUE_NOP                   = GENERIC_OPCODE_RV2PPQ_VALUE_NOP      ,
384    GENERIC_OPCODE_COMQ_VALUE_OPAQUE                = GENERIC_OPCODE_RV2PPQ_VALUE_OPAQUE   ,
385    GENERIC_OPCODE_COMQ_VALUE_L2_COMPLETION         = GENERIC_OPCODE_RV2PPQ_VALUE_L2_PLACE ,
386    GENERIC_OPCODE_COMQ_VALUE_L4_COMPLETION         = GENERIC_OPCODE_RV2PPQ_VALUE_L4_PLACE ,
387    GENERIC_OPCODE_COMQ_VALUE_L4_FLUSH              = GENERIC_OPCODE_RV2PPQ_VALUE_L4_FLUSH ,
388    GENERIC_OPCODE_COMQ_VALUE_L4_STARTGEN           =  6,
389    GENERIC_OPCODE_COMQ_VALUE_L4_ADDGEN             =  7,
390    GENERIC_OPCODE_COMQ_VALUE_L4_PLACE              =  8,
391    GENERIC_OPCODE_COMQ_VALUE_L4_DISCARDGEN         =  9,
392    GENERIC_OPCODE_COMQ_VALUE_L5_PLACE              = GENERIC_OPCODE_RV2PPQ_VALUE_L5_PLACE,
393    GENERIC_OPCODE_COMQ_VALUE_L2_NOBUFFER           = 11,
394    GENERIC_OPCODE_COMQ_VALUE_L4_ARMPUSH            = 12,
395    GENERIC_OPCODE_COMQ_VALUE_L4_RWINUPDATE         = 13,
396    GENERIC_OPCODE_COMQ_VALUE_L5_FLUSH              = GENERIC_OPCODE_RV2PPQ_VALUE_L5_FLUSH,
397    GENERIC_OPCODE_COMQ_VALUE_L4_INDICATE           = 15,
398    GENERIC_OPCODE_COMQ_VALUE_L4_COPYGEN            = 16,
399    GENERIC_OPCODE_COMQ_VALUE_DBG_RDMA              = GENERIC_OPCODE_RV2PPQ_VALUE_DBG_RDMA,
400    GENERIC_OPCODE_COMQ_VALUE_DBG_RV2P              = GENERIC_OPCODE_RV2PPQ_VALUE_DBG_RV2P,
401    GENERIC_OPCODE_COMQ_VALUE_L4_MQUPLOAD           = 19,
402    GENERIC_OPCODE_COMQ_VALUE_ISCSI_SGL_PLACE	    = 22,
403    GENERIC_OPCODE_COMQ_VALUE_ISCSI_RQ_PLACE 	    = 23,
404    GENERIC_OPCODE_COMQ_VALUE_ISCSI_RQ_FLUSH	    = 24,
405    GENERIC_OPCODE_COMQ_VALUE_ISCSI_SGL_FLUSH	    = 25,
406
407    // Jumbo mode and L2 FLUSH are for Linux only
408    GENERIC_OPCODE_COMQ_VALUE_L2_JUMBO_COMPLETION   = GENERIC_OPCODE_RV2PPQ_VALUE_L2_JUMBO_PLACE,
409    GENERIC_OPCODE_COMQ_VALUE_L2_JUMBO_NOBUFFER     = 27,
410    GENERIC_OPCODE_COMQ_VALUE_L2_FLUSH_BD_CHAIN     = GENERIC_OPCODE_RV2PPQ_VALUE_L2_FLUSH_BD_CHAIN,
411    GENERIC_OPCODE_COMQ_VALUE_FLR                   = GENERIC_OPCODE_RV2PPQ_VALUE_FLR,
412    MAX_COMQ_OPCODE
413}GENERIC_OPCODE_COMQ_t ;
414
415
416typedef struct comq_generic_b
417{
418    u32_t cid;
419    u32_t mbuf_cluster;
420    u16_t operand_flags;
421    u8_t knum;
422    u8_t opcode;
423        #define GENERIC_OPCODE_COMQ_VALUE                   (0xff<<0)
424    u16_t operand16_2;
425    u16_t operand16_3;
426    u16_t operand16_4;
427    u16_t operand16_5;
428    u16_t operand16_6;
429    u16_t operand16_7;
430    u32_t operand32_2;
431    u32_t operand32_3;
432    u32_t operand32_4;
433    u8_t rdma_action;
434    u8_t cs16_pkt_len;
435    u16_t cs16;
436} comq_generic_b_t;
437
438typedef struct comq_generic_l
439{
440    u32_t cid;
441    u32_t mbuf_cluster;
442    u8_t opcode;
443    u8_t knum;
444    u16_t operand_flags;
445    u16_t operand16_3;
446    u16_t operand16_2;
447    u16_t operand16_5;
448    u16_t operand16_4;
449    u16_t operand16_7;
450    u16_t operand16_6;
451    u32_t operand32_2;
452    u32_t operand32_3;
453    u32_t operand32_4;
454    u16_t cs16;
455    u8_t cs16_pkt_len;
456    u8_t rdma_action;
457} comq_generic_l_t;
458
459#if defined(LITTLE_ENDIAN)
460    typedef comq_generic_l_t comq_generic_t;
461#elif defined(BIG_ENDIAN)
462    typedef comq_generic_b_t comq_generic_t;
463#endif
464
465
466/*
467 *  comq_l2_completion definition
468 */
469typedef struct comq_l2_completion_b
470{
471    u32_t cid;
472    u32_t mbuf_cluster;
473    u16_t operand_flags;
474    u8_t knum;
475    u8_t opcode;
476    u16_t bits_status;
477    u16_t vlan_tag;
478    u16_t ip_xsum;
479    u16_t udp_tcp_xsum;
480    u16_t nx_bidx;
481    u16_t packet_length;  // total pkt len (MCP will need this info)
482    u16_t unused_0;
483    u16_t error_flags;
484    u32_t hash;
485    u32_t rt_bt;
486    u8_t rdma_action;
487    u8_t cs16_pkt_len;
488    u16_t cs16;
489
490} comq_l2_completion_b_t;
491
492typedef struct comq_l2_completion_l
493{
494    u32_t cid;
495    u32_t mbuf_cluster;
496    u8_t opcode;
497    u8_t knum;
498    u16_t operand_flags;
499    u16_t vlan_tag;
500    u16_t bits_status;
501    u16_t udp_tcp_xsum;
502    u16_t ip_xsum;
503    u16_t packet_length;  // total pkt len (MCP will need this info)
504    u16_t nx_bidx;
505    u16_t error_flags;
506    u16_t unused_0;
507    u32_t hash;
508    u32_t rt_bt;
509    u16_t cs16;
510    u8_t cs16_pkt_len;
511    u8_t rdma_action;
512
513} comq_l2_completion_l_t;
514
515#if defined(LITTLE_ENDIAN)
516    typedef comq_l2_completion_l_t comq_l2_completion_t;
517#elif defined(BIG_ENDIAN)
518    typedef comq_l2_completion_b_t comq_l2_completion_t;
519#endif
520
521/*
522 *  comq_l2_nobuffer definition
523 */
524typedef struct comq_l2_nobuffer_b
525{
526    u32_t l2_nobuff_cid;
527    u32_t l2_nobuff_mbuf_cluster;
528    u16_t l2_nobuff_operand_flags;
529    u8_t l2_nobuff_knum;
530    u8_t l2_nobuff_opcode;
531    u16_t l2_nobuff_bits_status;
532    u16_t l2_nobuff_vlan_tag;
533    u16_t l2_nobuff_ip_xsum;
534    u16_t l2_nobuff_udp_tcp_xsum;
535    u16_t l2_nobuff_nx_bidx;
536    u16_t l2_nobuff_packet_length;  // total pkt len (MCP will need this info)
537    u16_t unused_1;
538    u16_t l2_nobuff_error_flags;
539    u32_t l2_nobuff_hash;
540    u32_t unused_2;
541    u8_t l2_nobuff_rdma_action;
542    u8_t l2_nobuff_cs16_pkt_len;
543    u16_t l2_nobuff_cs16;
544
545} comq_l2_nobuffer_b_t;
546
547typedef struct comq_l2_nobuffer_l
548{
549    u32_t l2_nobuff_cid;
550    u32_t l2_nobuff_mbuf_cluster;
551    u8_t l2_nobuff_opcode;
552    u8_t l2_nobuff_knum;
553    u16_t l2_nobuff_operand_flags;
554    u16_t l2_nobuff_vlan_tag;
555    u16_t l2_nobuff_bits_status;
556    u16_t l2_nobuff_udp_tcp_xsum;
557    u16_t l2_nobuff_ip_xsum;
558    u16_t l2_nobuff_packet_length;  // total pkt len (MCP will need this info)
559    u16_t l2_nobuff_nx_bidx;
560    u16_t l2_nobuff_error_flags;
561    u16_t unused_1;
562    u32_t l2_nobuff_hash;
563    u32_t unused_2;
564    u16_t l2_nobuff_cs16;
565    u8_t l2_nobuff_cs16_pkt_len;
566    u8_t l2_nobuff_rdma_action;
567
568} comq_l2_nobuffer_l_t;
569
570#if defined(LITTLE_ENDIAN)
571    typedef comq_l2_nobuffer_l_t comq_l2_nobuffer_t;
572#elif defined(BIG_ENDIAN)
573    typedef comq_l2_nobuffer_b_t comq_l2_nobuffer_t;
574#endif
575
576
577/*
578 *  comq_l2_flr definition
579 */
580typedef struct comq_l2_flr_b
581{
582    u32_t cid;
583    u32_t mbuf_cluster;
584    u16_t operand_flags;
585    u8_t  knum;
586    u8_t  opcode;
587    u16_t bits_status;
588    u16_t vlan_tag;
589    u16_t ip_xsum;
590    u16_t udp_tcp_xsum;
591    u16_t nx_bidx;
592    u16_t unused_0;
593    u16_t unused_1;
594    u16_t error_flags;
595    u32_t hash;
596    u32_t unused_2;
597    u8_t  rdma_action;
598    u8_t  cs16_pkt_len;
599    u16_t cs16;
600
601} comq_l2_flr_b_t;
602
603typedef struct comq_l2_flr_l
604{
605    u32_t cid;
606    u32_t mbuf_cluster;
607    u8_t  opcode;
608    u8_t  knum;
609    u16_t operand_flags;
610    u16_t vlan_tag;
611    u16_t bits_status;
612    u16_t udp_tcp_xsum;
613    u16_t ip_xsum;
614    u16_t unused_0;
615    u16_t nx_bidx;
616    u16_t error_flags;
617    u16_t unused_1;
618    u32_t hash;
619    u32_t unused_2;
620    u16_t cs16;
621    u8_t  cs16_pkt_len;
622    u8_t  rdma_action;
623
624} comq_l2_flr_l_t;
625
626#if defined(LITTLE_ENDIAN)
627    typedef comq_l2_flr_l_t comq_l2_flr_t;
628#elif defined(BIG_ENDIAN)
629    typedef comq_l2_flr_b_t comq_l2_flr_t;
630#endif
631
632/*
633 * comxq_t
634 */
635typedef struct comxq_b
636{
637    u32_t cid;
638    u16_t flags;
639    u16_t unused1;
640    u32_t snd_next;
641}comxq_b_t;
642
643typedef struct comxq_l
644{
645    u32_t cid;
646    u16_t unused1;
647    u16_t flags;
648    u32_t snd_next;
649}comxq_l_t;
650
651#if defined(LITTLE_ENDIAN)
652    typedef comxq_l_t comxq_t;
653#elif defined(BIG_ENDIAN)
654    typedef comxq_b_t comxq_t;
655#endif
656
657/*
658 * comtq_t
659 */
660typedef struct comtq_b
661{
662    u32_t cid;
663    u32_t val;
664    u8_t  type;
665    u8_t  unused[3];
666}comtq_b_t;
667
668typedef struct comtq_l
669{
670    u32_t cid;
671    u32_t val;
672    u8_t  unused[3];
673    u8_t  type;
674}comtq_l_t;
675
676#if defined(LITTLE_ENDIAN)
677    typedef comtq_l_t comtq_t;
678#elif defined(BIG_ENDIAN)
679    typedef comtq_b_t comtq_t;
680#endif
681
682/*
683 * csq_t
684 */
685typedef struct csq_b
686{
687    u32_t cid;
688        // bit 7 lsb of CID is always 0, but CSQ can be enqueued by MQ or COM.
689        // For L4, we can use this bit to indicate the source
690        // Note that 7 lsb is ALWAYS masked out to be zero by HW
691        #define CSQ_SRC_MQ     0
692        #define CSQ_SRC_COM    0x80
693        #define CSQ_SRC_MASK   0xFF
694    u8_t  flags;
695    u8_t  unused[3];
696}csq_b_t;
697
698typedef struct csq_l
699{
700    u32_t cid;
701    u8_t  unused[3];
702    u8_t  flags;
703}csq_l_t;
704
705#if defined(LITTLE_ENDIAN)
706    typedef csq_l_t csq_t;
707#elif defined(BIG_ENDIAN)
708    typedef csq_b_t csq_t;
709#endif
710
711/*
712 * cpq_t
713 */
714typedef struct cpq_b
715{
716    u32_t cid;
717}cpq_b_t;
718
719typedef struct cpq_l
720{
721    u32_t cid;
722}cpq_l_t;
723
724#if defined(LITTLE_ENDIAN)
725    typedef cpq_l_t cpq_t;
726#elif defined(BIG_ENDIAN)
727    typedef cpq_b_t cpq_t;
728#endif
729
730/*
731 * rv2ptq_t
732 */
733typedef struct rv2ptq_b
734{
735    u32_t cid;
736}rv2ptq_b_t;
737
738typedef struct rv2ptq_l
739{
740    u32_t cid;
741}rv2ptq_l_t;
742
743#if defined(LITTLE_ENDIAN)
744    typedef rv2ptq_l_t rv2ptq_t;
745#elif defined(BIG_ENDIAN)
746    typedef rv2ptq_b_t rv2ptq_t;
747#endif
748
749
750    /* TX FTQs */
751
752typedef struct tschq_b
753{
754    u32_t cid;
755    u8_t  flags;
756    u8_t  unused[3];
757}tschq_b_t;
758
759typedef struct tschq_l
760{
761    u32_t cid;
762    u8_t  unused[3];
763    u8_t  flags;
764}tschq_l_t;
765
766#if defined(LITTLE_ENDIAN)
767    typedef tschq_l_t tschq_t;
768#elif defined(BIG_ENDIAN)
769    typedef tschq_b_t tschq_t;
770#endif
771
772typedef struct txpq_b
773{
774    u32_t cid;
775    u32_t bseq;
776    u8_t  flags_flags;
777    u8_t  cmd;
778    u8_t  xnum;
779    u8_t  protocol_flags;
780    u32_t tcp_rcv_nxt;
781}txpq_b_t;
782
783typedef struct txpq_l
784{
785    u32_t cid;
786    u32_t bseq;
787    u8_t  protocol_flags;
788    u8_t  xnum;
789    u8_t  cmd;
790    u8_t  flags_flags;
791    u32_t tcp_rcv_nxt;
792}txpq_l_t;
793
794#if defined(LITTLE_ENDIAN)
795    typedef txpq_l_t txpq_t;
796#elif defined(BIG_ENDIAN)
797    typedef txpq_b_t txpq_t;
798#endif
799
800typedef struct tdmaq_b
801{
802    u32_t cid;
803    tx_bidx_boff_t bidx_boff;
804    u32_t bseq;
805    u32_t snd_next;
806    u8_t  cmd;
807    u8_t  xnum;
808    u8_t  knum;
809    u8_t  unused1;
810    u32_t flags_flags;
811    u16_t nbytes;
812    u16_t hole0_boff;
813    u16_t hole1_boff;
814    u16_t hole2_boff;
815    u32_t hole0_fill;
816    u32_t hole1_fill;
817    u32_t hole2_fill;
818    u8_t  fnum;
819    u8_t  txp_act_cmd;
820    u16_t unused2;
821}tdmaq_b_t;
822
823typedef struct tdmaq_l
824{
825    u32_t cid;
826    tx_bidx_boff_t bidx_boff;
827    u32_t bseq;
828    u32_t snd_next;
829    u8_t  unused1;
830    u8_t  knum;
831    u8_t  xnum;
832    u8_t  cmd;
833    u32_t flags_flags;
834    u16_t hole0_boff;
835    u16_t nbytes;
836    u16_t hole2_boff;
837    u16_t hole1_boff;
838    u32_t hole0_fill;
839    u32_t hole1_fill;
840    u32_t hole2_fill;
841    u16_t unused2;
842    u8_t  txp_act_cmd;
843    u8_t  fnum;
844}tdmaq_l_t;
845
846#if defined(LITTLE_ENDIAN)
847    typedef tdmaq_l_t tdmaq_t;
848#elif defined(BIG_ENDIAN)
849    typedef tdmaq_b_t tdmaq_t;
850#endif
851
852typedef struct tpatq_b
853{
854    u32_t cid;
855    u16_t nbytes;
856    u8_t  xnum;
857    u8_t  knum;
858    u32_t flags_flags;
859    u16_t raw_chksum;
860    u16_t tpat_bidx;
861}tpatq_b_t;
862
863typedef struct tpatq_l
864{
865    u32_t cid;
866    u8_t  knum;
867    u8_t  xnum;
868    u16_t nbytes;
869    u32_t flags_flags;
870    u16_t tpat_bidx;
871    u16_t raw_chksum;
872}tpatq_l_t;
873
874#if defined(LITTLE_ENDIAN)
875    typedef tpatq_l_t tpatq_t;
876#elif defined(BIG_ENDIAN)
877    typedef tpatq_b_t tpatq_t;
878#endif
879
880typedef struct taspq_b
881{
882    u16_t taspq_hdr_skip;
883    u16_t taspq_hdr_post_skip;
884    u16_t taspq_hdr_size;
885    u16_t taspq_payload_skip;
886    u16_t taspq_payload_size;
887    u16_t taspq_flags;
888#if (TARGET_CHIP == 5709)
889        #define TASPQ_FLAGS_PKT_END                 TPATF_TASQ_FLAGS_PKT_END
890        #define TASPQ_FLAGS_MGMT_PACKET             TPATF_TASQ_FLAGS_MGMT_PACKET
891        #define TASPQ_FLAGS_DEST_RPC_CATCHUP        TPATF_TASQ_FLAGS_CATCHUP_PACKET
892        #define TASPQ_FLAGS_DONT_GEN_CRC            TPATF_TASQ_FLAGS_DONT_GEN_CRC
893        #define TASPQ_FLAGS_RESERVED                TPATF_TASQ_FLAGS_RESERVED
894        #define TASPQ_FLAGS_DEST_EMAC               TPATF_TASQ_FLAGS_DEST_EMAC
895        #define TASPQ_FLAGS_DEST_RPC_MIRROR         TPATF_TASQ_FLAGS_DEST_RPC_MIRROR
896        #define TASPQ_FLAGS_DEST_RPC_LOOPBACK       TPATF_TASQ_FLAGS_DEST_RPC_LOOPBACK
897        #define TASPQ_FLAGS_MGMT_PKT_TAG            TPATF_TASQ_FLAGS_MGMT_PKT_TAG
898        #define TASPQ_FLAGS_CS16_VLD                TPATF_TASQ_FLAGS_CS16_VLD
899#else
900        #define TASPQ_FLAGS_PKT_END                 TPATF_TASPQ_FLAGS_PKT_END
901        #define TASPQ_FLAGS_MGMT_PACKET             TPATF_TASPQ_FLAGS_MGMT_PACKET
902        #define TASPQ_FLAGS_DEST_RPC_CATCHUP        TPATF_TASPQ_FLAGS_DEST_RPC_CATCHUP
903        #define TASPQ_FLAGS_DONT_GEN_CRC            TPATF_TASPQ_FLAGS_DONT_GEN_CRC
904        #define TASPQ_FLAGS_RESERVED                TPATF_TASPQ_FLAGS_RESERVED
905        #define TASPQ_FLAGS_DEST_EMAC               TPATF_TASPQ_FLAGS_DEST_EMAC
906        #define TASPQ_FLAGS_DEST_RPC_MIRROR         TPATF_TASPQ_FLAGS_DEST_RPC_MIRROR
907        #define TASPQ_FLAGS_DEST_RPC_LOOPBACK       TPATF_TASPQ_FLAGS_DEST_RPC_LOOPBACK
908        #define TASPQ_FLAGS_MGMT_PKT_TAG            TPATF_TASPQ_FLAGS_MGMT_PKT_TAG
909        #define TASPQ_FLAGS_CS16_VLD                TPATF_TASPQ_FLAGS_CS16_VLD
910#endif
911    u16_t taspq_cs16;
912    u16_t taspq_uftq_cmd;  /* Only the upper 16 bit of the ftq cmd is used */
913#if (TARGET_CHIP == 5709)
914        #define TASPQ_FTQ_CMD_CPY_DATA              TPATF_TASQ_FTQ_CMD_CPY_DATA
915        #define TASPQ_FTQ_CMD_ADD_INTERVEN          TPATF_TASQ_FTQ_CMD_ADD_INTERVEN
916        #define TASPQ_FTQ_CMD_ADD_DATA              TPATF_TASQ_FTQ_CMD_ADD_DATA
917        #define TASPQ_FTQ_CMD_BUSY                  TPATF_TASQ_FTQ_CMD_BUSY
918#else
919        #define TASPQ_FTQ_CMD_CPY_DATA              TPATF_TASPQ_FTQ_CMD_CPY_DATA
920        #define TASPQ_FTQ_CMD_ADD_INTERVEN          TPATF_TASPQ_FTQ_CMD_ADD_INTERVEN
921        #define TASPQ_FTQ_CMD_ADD_DATA              TPATF_TASPQ_FTQ_CMD_ADD_DATA
922        #define TASPQ_FTQ_CMD_BUSY                  TPATF_TASPQ_FTQ_CMD_BUSY
923#endif
924} taspq_b_t;
925
926typedef struct taspq_l
927{
928    u16_t taspq_hdr_post_skip;
929    u16_t taspq_hdr_skip;
930    u16_t taspq_payload_skip;
931    u16_t taspq_hdr_size;
932    u16_t taspq_flags;
933#if (TARGET_CHIP == 5709)
934        #define TASPQ_FLAGS_PKT_END                 TPATF_TASQ_FLAGS_PKT_END
935        #define TASPQ_FLAGS_MGMT_PACKET             TPATF_TASQ_FLAGS_MGMT_PACKET
936        #define TASPQ_FLAGS_DEST_RPC_CATCHUP        TPATF_TASQ_FLAGS_CATCHUP_PACKET
937        #define TASPQ_FLAGS_DONT_GEN_CRC            TPATF_TASQ_FLAGS_DONT_GEN_CRC
938        #define TASPQ_FLAGS_RESERVED                TPATF_TASQ_FLAGS_RESERVED
939        #define TASPQ_FLAGS_DEST_EMAC               TPATF_TASQ_FLAGS_DEST_EMAC
940        #define TASPQ_FLAGS_DEST_RPC_MIRROR         TPATF_TASQ_FLAGS_DEST_RPC_MIRROR
941        #define TASPQ_FLAGS_DEST_RPC_LOOPBACK       TPATF_TASQ_FLAGS_DEST_RPC_LOOPBACK
942        #define TASPQ_FLAGS_MGMT_PKT_TAG            TPATF_TASQ_FLAGS_MGMT_PKT_TAG
943        #define TASPQ_FLAGS_CS16_VLD                TPATF_TASQ_FLAGS_CS16_VLD
944#else
945        #define TASPQ_FLAGS_PKT_END                 TPATF_TASPQ_FLAGS_PKT_END
946        #define TASPQ_FLAGS_MGMT_PACKET             TPATF_TASPQ_FLAGS_MGMT_PACKET
947        #define TASPQ_FLAGS_DEST_RPC_CATCHUP        TPATF_TASPQ_FLAGS_DEST_RPC_CATCHUP
948        #define TASPQ_FLAGS_DONT_GEN_CRC            TPATF_TASPQ_FLAGS_DONT_GEN_CRC
949        #define TASPQ_FLAGS_RESERVED                TPATF_TASPQ_FLAGS_RESERVED
950        #define TASPQ_FLAGS_DEST_EMAC               TPATF_TASPQ_FLAGS_DEST_EMAC
951        #define TASPQ_FLAGS_DEST_RPC_MIRROR         TPATF_TASPQ_FLAGS_DEST_RPC_MIRROR
952        #define TASPQ_FLAGS_DEST_RPC_LOOPBACK       TPATF_TASPQ_FLAGS_DEST_RPC_LOOPBACK
953        #define TASPQ_FLAGS_MGMT_PKT_TAG            TPATF_TASPQ_FLAGS_MGMT_PKT_TAG
954        #define TASPQ_FLAGS_CS16_VLD                TPATF_TASPQ_FLAGS_CS16_VLD
955#endif
956    u16_t taspq_payload_size;
957    u16_t taspq_uftq_cmd;  /* Only the upper 16 bit of the ftq cmd is used */
958#if (TARGET_CHIP == 5709)
959        #define TASPQ_FTQ_CMD_CPY_DATA              TPATF_TASQ_FTQ_CMD_CPY_DATA
960        #define TASPQ_FTQ_CMD_ADD_INTERVEN          TPATF_TASQ_FTQ_CMD_ADD_INTERVEN
961        #define TASPQ_FTQ_CMD_ADD_DATA              TPATF_TASQ_FTQ_CMD_ADD_DATA
962        #define TASPQ_FTQ_CMD_BUSY                  TPATF_TASQ_FTQ_CMD_BUSY
963#else
964        #define TASPQ_FTQ_CMD_CPY_DATA              TPATF_TASPQ_FTQ_CMD_CPY_DATA
965        #define TASPQ_FTQ_CMD_ADD_INTERVEN          TPATF_TASPQ_FTQ_CMD_ADD_INTERVEN
966        #define TASPQ_FTQ_CMD_ADD_DATA              TPATF_TASPQ_FTQ_CMD_ADD_DATA
967        #define TASPQ_FTQ_CMD_BUSY                  TPATF_TASPQ_FTQ_CMD_BUSY
968#endif
969    u16_t taspq_cs16;
970} taspq_l_t;
971
972#if defined(LITTLE_ENDIAN)
973    typedef taspq_l_t taspq_t;
974#elif defined(BIG_ENDIAN)
975    typedef taspq_b_t taspq_t;
976#endif
977
978#endif /* _l2_ftq_h_ */
979