1 /* SPDX-License-Identifier: GPL-2.0 */
2 /* Marvell RVU Ethernet driver
4 * Copyright (C) 2020 Marvell.
11 /* NIX WQE/CQE size 128 byte or 512 byte */
22 enum nix_send_ldtype {
23 NIX_SEND_LDTYPE_LDD = 0x0,
24 NIX_SEND_LDTYPE_LDT = 0x1,
25 NIX_SEND_LDTYPE_LDWB = 0x2,
30 NIX_SENDL3TYPE_NONE = 0x0,
31 NIX_SENDL3TYPE_IP4 = 0x2,
32 NIX_SENDL3TYPE_IP4_CKSUM = 0x3,
33 NIX_SENDL3TYPE_IP6 = 0x4,
38 NIX_SENDL4TYPE_TCP_CKSUM,
39 NIX_SENDL4TYPE_SCTP_CKSUM,
40 NIX_SENDL4TYPE_UDP_CKSUM,
43 /* NIX wqe/cqe types */
45 NIX_XQE_TYPE_INVALID = 0x0,
46 NIX_XQE_TYPE_RX = 0x1,
47 NIX_XQE_TYPE_RX_IPSECS = 0x2,
48 NIX_XQE_TYPE_RX_IPSECH = 0x3,
49 NIX_XQE_TYPE_RX_IPSECD = 0x4,
50 NIX_XQE_TYPE_SEND = 0x8,
53 /* NIX CQE/SQE subdescriptor types */
66 /* Algorithm for nix_sqe_mem_s header (value of the `alg` field) */
68 NIX_SENDMEMALG_E_SET = 0x0,
69 NIX_SENDMEMALG_E_SETTSTMP = 0x1,
70 NIX_SENDMEMALG_E_SETRSLT = 0x2,
71 NIX_SENDMEMALG_E_ADD = 0x8,
72 NIX_SENDMEMALG_E_SUB = 0x9,
73 NIX_SENDMEMALG_E_ADDLEN = 0xa,
74 NIX_SENDMEMALG_E_SUBLEN = 0xb,
75 NIX_SENDMEMALG_E_ADDMBUF = 0xc,
76 NIX_SENDMEMALG_E_SUBMBUF = 0xd,
77 NIX_SENDMEMALG_E_ENUM_LAST = 0xe,
80 /* NIX CQE header structure */
81 struct nix_cqe_hdr_s {
84 u64 reserved_52_57 : 6;
89 /* NIX CQE RX parse structure */
90 struct nix_rx_parse_s {
106 u64 pkt_lenm1 : 16; /* W1 */
119 u64 laflags : 8; /* W2 */
127 u64 eoh_ptr : 8; /* W3 */
131 u64 laptr : 8; /* W4 */
139 u64 vtag0_ptr : 8; /* W5 */
141 u64 flow_key_alg : 5;
142 u64 rsvd_359_341 : 19;
144 u64 rsvd_383_362 : 22;
145 u64 rsvd_447_384; /* W6 */
148 /* NIX CQE RX scatter/gather subdescriptor structure */
150 u64 seg_size : 16; /* W0 */
161 struct nix_send_comp_s {
167 struct nix_cqe_rx_s {
168 struct nix_cqe_hdr_s hdr;
169 struct nix_rx_parse_s parse;
170 struct nix_rx_sg_s sg;
173 struct nix_cqe_tx_s {
174 struct nix_cqe_hdr_s hdr;
175 struct nix_send_comp_s comp;
178 /* NIX SQE header structure */
179 struct nix_sqe_hdr_s {
180 u64 total : 18; /* W0 */
187 u64 ol3ptr : 8; /* W1 */
199 /* NIX send extended header subdescriptor structure */
200 struct nix_sqe_ext_s {
201 u64 lso_mps : 14; /* W0 */
214 u64 vlan0_ins_ptr : 8; /* W1 */
215 u64 vlan0_ins_tci : 16;
216 u64 vlan1_ins_ptr : 8;
217 u64 vlan1_ins_tci : 16;
218 u64 vlan0_ins_ena : 1;
219 u64 vlan1_ins_ena : 1;
221 u64 rsvd_127_116 : 12;
224 struct nix_sqe_sg_s {
237 /* NIX send memory subdescriptor structure */
238 struct nix_sqe_mem_s {
239 u64 start_offset : 8;
242 u64 udp_csum_crt : 1;
256 enum nix_cqerrint_e {
257 NIX_CQERRINT_DOOR_ERR = 0,
258 NIX_CQERRINT_WR_FULL = 1,
259 NIX_CQERRINT_CQE_FAULT = 2,
262 #define NIX_CQERRINT_BITS (BIT_ULL(NIX_CQERRINT_DOOR_ERR) | \
263 BIT_ULL(NIX_CQERRINT_CQE_FAULT))
270 #define NIX_RQINT_BITS (BIT_ULL(NIX_RQINT_DROP) | BIT_ULL(NIX_RQINT_RED))
273 NIX_SQINT_LMT_ERR = 0,
274 NIX_SQINT_MNQ_ERR = 1,
275 NIX_SQINT_SEND_ERR = 2,
276 NIX_SQINT_SQB_ALLOC_FAIL = 3,
279 #define NIX_SQINT_BITS (BIT_ULL(NIX_SQINT_LMT_ERR) | \
280 BIT_ULL(NIX_SQINT_MNQ_ERR) | \
281 BIT_ULL(NIX_SQINT_SEND_ERR) | \
282 BIT_ULL(NIX_SQINT_SQB_ALLOC_FAIL))
286 NIX_SQOPERR_CTX_FAULT = 1,
287 NIX_SQOPERR_CTX_POISON = 2,
288 NIX_SQOPERR_DISABLED = 3,
289 NIX_SQOPERR_SIZE_ERR = 4,
290 NIX_SQOPERR_OFLOW = 5,
291 NIX_SQOPERR_SQB_NULL = 6,
292 NIX_SQOPERR_SQB_FAULT = 7,
293 NIX_SQOPERR_SQE_SZ_ZERO = 8,
298 NIX_MNQERR_SQ_CTX_FAULT = 0,
299 NIX_MNQERR_SQ_CTX_POISON = 1,
300 NIX_MNQERR_SQB_FAULT = 2,
301 NIX_MNQERR_SQB_POISON = 3,
302 NIX_MNQERR_TOTAL_ERR = 4,
303 NIX_MNQERR_LSO_ERR = 5,
304 NIX_MNQERR_CQ_QUERY_ERR = 6,
305 NIX_MNQERR_MAX_SQE_SIZE_ERR = 7,
306 NIX_MNQERR_MAXLEN_ERR = 8,
307 NIX_MNQERR_SQE_SIZEM1_ZERO = 9,
311 enum nix_snd_status_e {
312 NIX_SND_STATUS_GOOD = 0x0,
313 NIX_SND_STATUS_SQ_CTX_FAULT = 0x1,
314 NIX_SND_STATUS_SQ_CTX_POISON = 0x2,
315 NIX_SND_STATUS_SQB_FAULT = 0x3,
316 NIX_SND_STATUS_SQB_POISON = 0x4,
317 NIX_SND_STATUS_HDR_ERR = 0x5,
318 NIX_SND_STATUS_EXT_ERR = 0x6,
319 NIX_SND_STATUS_JUMP_FAULT = 0x7,
320 NIX_SND_STATUS_JUMP_POISON = 0x8,
321 NIX_SND_STATUS_CRC_ERR = 0x10,
322 NIX_SND_STATUS_IMM_ERR = 0x11,
323 NIX_SND_STATUS_SG_ERR = 0x12,
324 NIX_SND_STATUS_MEM_ERR = 0x13,
325 NIX_SND_STATUS_INVALID_SUBDC = 0x14,
326 NIX_SND_STATUS_SUBDC_ORDER_ERR = 0x15,
327 NIX_SND_STATUS_DATA_FAULT = 0x16,
328 NIX_SND_STATUS_DATA_POISON = 0x17,
329 NIX_SND_STATUS_NPC_DROP_ACTION = 0x20,
330 NIX_SND_STATUS_LOCK_VIOL = 0x21,
331 NIX_SND_STATUS_NPC_UCAST_CHAN_ERR = 0x22,
332 NIX_SND_STATUS_NPC_MCAST_CHAN_ERR = 0x23,
333 NIX_SND_STATUS_NPC_MCAST_ABORT = 0x24,
334 NIX_SND_STATUS_NPC_VTAG_PTR_ERR = 0x25,
335 NIX_SND_STATUS_NPC_VTAG_SIZE_ERR = 0x26,
336 NIX_SND_STATUS_SEND_MEM_FAULT = 0x27,
337 NIX_SND_STATUS_SEND_STATS_ERR = 0x28,
341 #endif /* OTX2_STRUCT_H */