2 * Copyright (c) 2004-2007 Chelsio, Inc. All rights reserved.
4 * This software is available to you under a choice of one of two
5 * licenses. You may choose to be licensed under the terms of the GNU
6 * General Public License (GPL) Version 2, available from the file
7 * COPYING in the main directory of this source tree, or the
8 * OpenIB.org BSD license below:
10 * Redistribution and use in source and binary forms, with or
11 * without modification, are permitted provided that the following
14 * - Redistributions of source code must retain the above
15 * copyright notice, this list of conditions and the following
18 * - Redistributions in binary form must reproduce the above
19 * copyright notice, this list of conditions and the following
20 * disclaimer in the documentation and/or other materials
21 * provided with the distribution.
23 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
27 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
28 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
29 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
35 #if !defined(__LITTLE_ENDIAN_BITFIELD) && !defined(__BIG_ENDIAN_BITFIELD)
36 # include <asm/byteorder.h>
40 CPL_PASS_OPEN_REQ = 0x1,
41 CPL_PASS_ACCEPT_RPL = 0x2,
42 CPL_ACT_OPEN_REQ = 0x3,
44 CPL_SET_TCB_FIELD = 0x5,
47 CPL_CLOSE_CON_REQ = 0x8,
48 CPL_CLOSE_LISTSRV_REQ = 0x9,
52 CPL_RX_DATA_ACK = 0xD,
54 CPL_RTE_DELETE_REQ = 0xF,
55 CPL_RTE_WRITE_REQ = 0x10,
56 CPL_RTE_READ_REQ = 0x11,
57 CPL_L2T_WRITE_REQ = 0x12,
58 CPL_L2T_READ_REQ = 0x13,
59 CPL_SMT_WRITE_REQ = 0x14,
60 CPL_SMT_READ_REQ = 0x15,
61 CPL_TX_PKT_LSO = 0x16,
64 CPL_TID_RELEASE = 0x1A,
66 CPL_CLOSE_LISTSRV_RPL = 0x20,
68 CPL_GET_TCB_RPL = 0x22,
69 CPL_L2T_WRITE_RPL = 0x23,
70 CPL_PCMD_READ_RPL = 0x24,
72 CPL_PEER_CLOSE = 0x26,
73 CPL_RTE_DELETE_RPL = 0x27,
74 CPL_RTE_WRITE_RPL = 0x28,
75 CPL_RX_DDP_COMPLETE = 0x29,
76 CPL_RX_PHYS_ADDR = 0x2A,
78 CPL_RX_URG_NOTIFY = 0x2C,
79 CPL_SET_TCB_RPL = 0x2D,
80 CPL_SMT_WRITE_RPL = 0x2E,
81 CPL_TX_DATA_ACK = 0x2F,
83 CPL_ABORT_REQ_RSS = 0x30,
84 CPL_ABORT_RPL_RSS = 0x31,
85 CPL_CLOSE_CON_RPL = 0x32,
87 CPL_L2T_READ_RPL = 0x34,
89 CPL_RDMA_CQE_READ_RSP = 0x36,
90 CPL_RDMA_CQE_ERR = 0x37,
91 CPL_RTE_READ_RPL = 0x38,
94 CPL_ACT_OPEN_RPL = 0x40,
95 CPL_PASS_OPEN_RPL = 0x41,
96 CPL_RX_DATA_DDP = 0x42,
97 CPL_SMT_READ_RPL = 0x43,
99 CPL_ACT_ESTABLISH = 0x50,
100 CPL_PASS_ESTABLISH = 0x51,
102 CPL_PASS_ACCEPT_REQ = 0x70,
104 CPL_ASYNC_NOTIF = 0x80, /* fake opcode for async notifications */
106 CPL_TX_DMA_ACK = 0xA0,
107 CPL_RDMA_READ_REQ = 0xA1,
108 CPL_RDMA_TERMINATE = 0xA2,
109 CPL_TRACE_PKT = 0xA3,
110 CPL_RDMA_EC_STATUS = 0xA5,
112 NUM_CPL_CMDS /* must be last and previous entries must be sorted */
117 CPL_ERR_TCAM_PARITY = 1,
118 CPL_ERR_TCAM_FULL = 3,
119 CPL_ERR_CONN_RESET = 20,
120 CPL_ERR_CONN_EXIST = 22,
121 CPL_ERR_ARP_MISS = 23,
122 CPL_ERR_BAD_SYN = 24,
123 CPL_ERR_CONN_TIMEDOUT = 30,
124 CPL_ERR_XMIT_TIMEDOUT = 31,
125 CPL_ERR_PERSIST_TIMEDOUT = 32,
126 CPL_ERR_FINWAIT2_TIMEDOUT = 33,
127 CPL_ERR_KEEPALIVE_TIMEDOUT = 34,
128 CPL_ERR_RTX_NEG_ADVICE = 35,
129 CPL_ERR_PERSIST_NEG_ADVICE = 36,
130 CPL_ERR_ABORT_FAILED = 42,
135 CPL_CONN_POLICY_AUTO = 0,
136 CPL_CONN_POLICY_ASK = 1,
137 CPL_CONN_POLICY_DENY = 3
148 ULP_CRC_HEADER = 1 << 0,
149 ULP_CRC_DATA = 1 << 1
153 CPL_PASS_OPEN_ACCEPT,
158 CPL_ABORT_SEND_RST = 0,
160 CPL_ABORT_POST_CLOSE_REQ = 2
163 enum { /* TX_PKT_LSO ethernet types */
170 enum { /* TCP congestion control algorithms */
183 #define V_OPCODE(x) ((x) << S_OPCODE)
184 #define G_OPCODE(x) (((x) >> S_OPCODE) & 0xFF)
185 #define G_TID(x) ((x) & 0xFFFFFF)
187 /* tid is assumed to be 24-bits */
188 #define MK_OPCODE_TID(opcode, tid) (V_OPCODE(opcode) | (tid))
190 #define OPCODE_TID(cmd) ((cmd)->ot.opcode_tid)
192 /* extract the TID from a CPL command */
193 #define GET_TID(cmd) (G_TID(ntohl(OPCODE_TID(cmd))))
198 #if defined(__LITTLE_ENDIAN_BITFIELD)
213 #if defined(__LITTLE_ENDIAN_BITFIELD)
225 struct work_request_hdr {
231 #define S_WR_SGE_CREDITS 0
232 #define M_WR_SGE_CREDITS 0xFF
233 #define V_WR_SGE_CREDITS(x) ((x) << S_WR_SGE_CREDITS)
234 #define G_WR_SGE_CREDITS(x) (((x) >> S_WR_SGE_CREDITS) & M_WR_SGE_CREDITS)
236 #define S_WR_SGLSFLT 8
237 #define M_WR_SGLSFLT 0xFF
238 #define V_WR_SGLSFLT(x) ((x) << S_WR_SGLSFLT)
239 #define G_WR_SGLSFLT(x) (((x) >> S_WR_SGLSFLT) & M_WR_SGLSFLT)
241 #define S_WR_BCNTLFLT 16
242 #define M_WR_BCNTLFLT 0xF
243 #define V_WR_BCNTLFLT(x) ((x) << S_WR_BCNTLFLT)
244 #define G_WR_BCNTLFLT(x) (((x) >> S_WR_BCNTLFLT) & M_WR_BCNTLFLT)
246 #define S_WR_DATATYPE 20
247 #define V_WR_DATATYPE(x) ((x) << S_WR_DATATYPE)
248 #define F_WR_DATATYPE V_WR_DATATYPE(1U)
250 #define S_WR_COMPL 21
251 #define V_WR_COMPL(x) ((x) << S_WR_COMPL)
252 #define F_WR_COMPL V_WR_COMPL(1U)
255 #define V_WR_EOP(x) ((x) << S_WR_EOP)
256 #define F_WR_EOP V_WR_EOP(1U)
259 #define V_WR_SOP(x) ((x) << S_WR_SOP)
260 #define F_WR_SOP V_WR_SOP(1U)
264 #define V_WR_OP(x) ((x) << S_WR_OP)
265 #define G_WR_OP(x) (((x) >> S_WR_OP) & M_WR_OP)
269 #define M_WR_LEN 0xFF
270 #define V_WR_LEN(x) ((x) << S_WR_LEN)
271 #define G_WR_LEN(x) (((x) >> S_WR_LEN) & M_WR_LEN)
274 #define M_WR_TID 0xFFFFF
275 #define V_WR_TID(x) ((x) << S_WR_TID)
276 #define G_WR_TID(x) (((x) >> S_WR_TID) & M_WR_TID)
278 #define S_WR_CR_FLUSH 30
279 #define V_WR_CR_FLUSH(x) ((x) << S_WR_CR_FLUSH)
280 #define F_WR_CR_FLUSH V_WR_CR_FLUSH(1U)
283 #define V_WR_GEN(x) ((x) << S_WR_GEN)
284 #define F_WR_GEN V_WR_GEN(1U)
286 # define WR_HDR struct work_request_hdr wr
290 # define RSS_HDR struct rss_header rss_hdr;
293 /* option 0 lower-half fields */
294 #define S_CPL_STATUS 0
295 #define M_CPL_STATUS 0xFF
296 #define V_CPL_STATUS(x) ((x) << S_CPL_STATUS)
297 #define G_CPL_STATUS(x) (((x) >> S_CPL_STATUS) & M_CPL_STATUS)
299 #define S_INJECT_TIMER 6
300 #define V_INJECT_TIMER(x) ((x) << S_INJECT_TIMER)
301 #define F_INJECT_TIMER V_INJECT_TIMER(1U)
303 #define S_NO_OFFLOAD 7
304 #define V_NO_OFFLOAD(x) ((x) << S_NO_OFFLOAD)
305 #define F_NO_OFFLOAD V_NO_OFFLOAD(1U)
308 #define M_ULP_MODE 0xF
309 #define V_ULP_MODE(x) ((x) << S_ULP_MODE)
310 #define G_ULP_MODE(x) (((x) >> S_ULP_MODE) & M_ULP_MODE)
312 #define S_RCV_BUFSIZ 12
313 #define M_RCV_BUFSIZ 0x3FFF
314 #define V_RCV_BUFSIZ(x) ((x) << S_RCV_BUFSIZ)
315 #define G_RCV_BUFSIZ(x) (((x) >> S_RCV_BUFSIZ) & M_RCV_BUFSIZ)
319 #define V_TOS(x) ((x) << S_TOS)
320 #define G_TOS(x) (((x) >> S_TOS) & M_TOS)
322 /* option 0 upper-half fields */
324 #define V_DELACK(x) ((x) << S_DELACK)
325 #define F_DELACK V_DELACK(1U)
328 #define V_NO_CONG(x) ((x) << S_NO_CONG)
329 #define F_NO_CONG V_NO_CONG(1U)
331 #define S_SRC_MAC_SEL 2
332 #define M_SRC_MAC_SEL 0x3
333 #define V_SRC_MAC_SEL(x) ((x) << S_SRC_MAC_SEL)
334 #define G_SRC_MAC_SEL(x) (((x) >> S_SRC_MAC_SEL) & M_SRC_MAC_SEL)
337 #define M_L2T_IDX 0x7FF
338 #define V_L2T_IDX(x) ((x) << S_L2T_IDX)
339 #define G_L2T_IDX(x) (((x) >> S_L2T_IDX) & M_L2T_IDX)
341 #define S_TX_CHANNEL 15
342 #define V_TX_CHANNEL(x) ((x) << S_TX_CHANNEL)
343 #define F_TX_CHANNEL V_TX_CHANNEL(1U)
345 #define S_TCAM_BYPASS 16
346 #define V_TCAM_BYPASS(x) ((x) << S_TCAM_BYPASS)
347 #define F_TCAM_BYPASS V_TCAM_BYPASS(1U)
350 #define V_NAGLE(x) ((x) << S_NAGLE)
351 #define F_NAGLE V_NAGLE(1U)
353 #define S_WND_SCALE 18
354 #define M_WND_SCALE 0xF
355 #define V_WND_SCALE(x) ((x) << S_WND_SCALE)
356 #define G_WND_SCALE(x) (((x) >> S_WND_SCALE) & M_WND_SCALE)
358 #define S_KEEP_ALIVE 22
359 #define V_KEEP_ALIVE(x) ((x) << S_KEEP_ALIVE)
360 #define F_KEEP_ALIVE V_KEEP_ALIVE(1U)
362 #define S_MAX_RETRANS 23
363 #define M_MAX_RETRANS 0xF
364 #define V_MAX_RETRANS(x) ((x) << S_MAX_RETRANS)
365 #define G_MAX_RETRANS(x) (((x) >> S_MAX_RETRANS) & M_MAX_RETRANS)
367 #define S_MAX_RETRANS_OVERRIDE 27
368 #define V_MAX_RETRANS_OVERRIDE(x) ((x) << S_MAX_RETRANS_OVERRIDE)
369 #define F_MAX_RETRANS_OVERRIDE V_MAX_RETRANS_OVERRIDE(1U)
372 #define M_MSS_IDX 0xF
373 #define V_MSS_IDX(x) ((x) << S_MSS_IDX)
374 #define G_MSS_IDX(x) (((x) >> S_MSS_IDX) & M_MSS_IDX)
376 /* option 1 fields */
377 #define S_RSS_ENABLE 0
378 #define V_RSS_ENABLE(x) ((x) << S_RSS_ENABLE)
379 #define F_RSS_ENABLE V_RSS_ENABLE(1U)
381 #define S_RSS_MASK_LEN 1
382 #define M_RSS_MASK_LEN 0x7
383 #define V_RSS_MASK_LEN(x) ((x) << S_RSS_MASK_LEN)
384 #define G_RSS_MASK_LEN(x) (((x) >> S_RSS_MASK_LEN) & M_RSS_MASK_LEN)
387 #define M_CPU_IDX 0x3F
388 #define V_CPU_IDX(x) ((x) << S_CPU_IDX)
389 #define G_CPU_IDX(x) (((x) >> S_CPU_IDX) & M_CPU_IDX)
391 #define S_MAC_MATCH_VALID 18
392 #define V_MAC_MATCH_VALID(x) ((x) << S_MAC_MATCH_VALID)
393 #define F_MAC_MATCH_VALID V_MAC_MATCH_VALID(1U)
395 #define S_CONN_POLICY 19
396 #define M_CONN_POLICY 0x3
397 #define V_CONN_POLICY(x) ((x) << S_CONN_POLICY)
398 #define G_CONN_POLICY(x) (((x) >> S_CONN_POLICY) & M_CONN_POLICY)
400 #define S_SYN_DEFENSE 21
401 #define V_SYN_DEFENSE(x) ((x) << S_SYN_DEFENSE)
402 #define F_SYN_DEFENSE V_SYN_DEFENSE(1U)
404 #define S_VLAN_PRI 22
405 #define M_VLAN_PRI 0x3
406 #define V_VLAN_PRI(x) ((x) << S_VLAN_PRI)
407 #define G_VLAN_PRI(x) (((x) >> S_VLAN_PRI) & M_VLAN_PRI)
409 #define S_VLAN_PRI_VALID 24
410 #define V_VLAN_PRI_VALID(x) ((x) << S_VLAN_PRI_VALID)
411 #define F_VLAN_PRI_VALID V_VLAN_PRI_VALID(1U)
413 #define S_PKT_TYPE 25
414 #define M_PKT_TYPE 0x3
415 #define V_PKT_TYPE(x) ((x) << S_PKT_TYPE)
416 #define G_PKT_TYPE(x) (((x) >> S_PKT_TYPE) & M_PKT_TYPE)
418 #define S_MAC_MATCH 27
419 #define M_MAC_MATCH 0x1F
420 #define V_MAC_MATCH(x) ((x) << S_MAC_MATCH)
421 #define G_MAC_MATCH(x) (((x) >> S_MAC_MATCH) & M_MAC_MATCH)
423 /* option 2 fields */
424 #define S_CPU_INDEX 0
425 #define M_CPU_INDEX 0x7F
426 #define V_CPU_INDEX(x) ((x) << S_CPU_INDEX)
427 #define G_CPU_INDEX(x) (((x) >> S_CPU_INDEX) & M_CPU_INDEX)
429 #define S_CPU_INDEX_VALID 7
430 #define V_CPU_INDEX_VALID(x) ((x) << S_CPU_INDEX_VALID)
431 #define F_CPU_INDEX_VALID V_CPU_INDEX_VALID(1U)
433 #define S_RX_COALESCE 8
434 #define M_RX_COALESCE 0x3
435 #define V_RX_COALESCE(x) ((x) << S_RX_COALESCE)
436 #define G_RX_COALESCE(x) (((x) >> S_RX_COALESCE) & M_RX_COALESCE)
438 #define S_RX_COALESCE_VALID 10
439 #define V_RX_COALESCE_VALID(x) ((x) << S_RX_COALESCE_VALID)
440 #define F_RX_COALESCE_VALID V_RX_COALESCE_VALID(1U)
442 #define S_CONG_CONTROL_FLAVOR 11
443 #define M_CONG_CONTROL_FLAVOR 0x3
444 #define V_CONG_CONTROL_FLAVOR(x) ((x) << S_CONG_CONTROL_FLAVOR)
445 #define G_CONG_CONTROL_FLAVOR(x) (((x) >> S_CONG_CONTROL_FLAVOR) & M_CONG_CONTROL_FLAVOR)
447 #define S_PACING_FLAVOR 13
448 #define M_PACING_FLAVOR 0x3
449 #define V_PACING_FLAVOR(x) ((x) << S_PACING_FLAVOR)
450 #define G_PACING_FLAVOR(x) (((x) >> S_PACING_FLAVOR) & M_PACING_FLAVOR)
452 #define S_FLAVORS_VALID 15
453 #define V_FLAVORS_VALID(x) ((x) << S_FLAVORS_VALID)
454 #define F_FLAVORS_VALID V_FLAVORS_VALID(1U)
456 #define S_RX_FC_DISABLE 16
457 #define V_RX_FC_DISABLE(x) ((x) << S_RX_FC_DISABLE)
458 #define F_RX_FC_DISABLE V_RX_FC_DISABLE(1U)
460 #define S_RX_FC_VALID 17
461 #define V_RX_FC_VALID(x) ((x) << S_RX_FC_VALID)
462 #define F_RX_FC_VALID V_RX_FC_VALID(1U)
464 struct cpl_pass_open_req {
477 struct cpl_pass_open_rpl {
478 RSS_HDR union opcode_tid ot;
487 struct cpl_pass_establish {
488 RSS_HDR union opcode_tid ot;
500 /* cpl_pass_establish.tos_tid fields */
501 #define S_PASS_OPEN_TID 0
502 #define M_PASS_OPEN_TID 0xFFFFFF
503 #define V_PASS_OPEN_TID(x) ((x) << S_PASS_OPEN_TID)
504 #define G_PASS_OPEN_TID(x) (((x) >> S_PASS_OPEN_TID) & M_PASS_OPEN_TID)
506 #define S_PASS_OPEN_TOS 24
507 #define M_PASS_OPEN_TOS 0xFF
508 #define V_PASS_OPEN_TOS(x) ((x) << S_PASS_OPEN_TOS)
509 #define G_PASS_OPEN_TOS(x) (((x) >> S_PASS_OPEN_TOS) & M_PASS_OPEN_TOS)
511 /* cpl_pass_establish.l2t_idx fields */
512 #define S_L2T_IDX16 5
513 #define M_L2T_IDX16 0x7FF
514 #define V_L2T_IDX16(x) ((x) << S_L2T_IDX16)
515 #define G_L2T_IDX16(x) (((x) >> S_L2T_IDX16) & M_L2T_IDX16)
517 /* cpl_pass_establish.tcp_opt fields (also applies act_open_establish) */
518 #define G_TCPOPT_WSCALE_OK(x) (((x) >> 5) & 1)
519 #define G_TCPOPT_SACK(x) (((x) >> 6) & 1)
520 #define G_TCPOPT_TSTAMP(x) (((x) >> 7) & 1)
521 #define G_TCPOPT_SND_WSCALE(x) (((x) >> 8) & 0xf)
522 #define G_TCPOPT_MSS(x) (((x) >> 12) & 0xf)
524 struct cpl_pass_accept_req {
525 RSS_HDR union opcode_tid ot;
531 struct tcp_options tcp_options;
535 #if defined(__LITTLE_ENDIAN_BITFIELD)
551 struct cpl_pass_accept_rpl {
561 struct cpl_act_open_req {
574 /* cpl_act_open_req.params fields */
575 #define S_AOPEN_VLAN_PRI 9
576 #define M_AOPEN_VLAN_PRI 0x3
577 #define V_AOPEN_VLAN_PRI(x) ((x) << S_AOPEN_VLAN_PRI)
578 #define G_AOPEN_VLAN_PRI(x) (((x) >> S_AOPEN_VLAN_PRI) & M_AOPEN_VLAN_PRI)
580 #define S_AOPEN_VLAN_PRI_VALID 11
581 #define V_AOPEN_VLAN_PRI_VALID(x) ((x) << S_AOPEN_VLAN_PRI_VALID)
582 #define F_AOPEN_VLAN_PRI_VALID V_AOPEN_VLAN_PRI_VALID(1U)
584 #define S_AOPEN_PKT_TYPE 12
585 #define M_AOPEN_PKT_TYPE 0x3
586 #define V_AOPEN_PKT_TYPE(x) ((x) << S_AOPEN_PKT_TYPE)
587 #define G_AOPEN_PKT_TYPE(x) (((x) >> S_AOPEN_PKT_TYPE) & M_AOPEN_PKT_TYPE)
589 #define S_AOPEN_MAC_MATCH 14
590 #define M_AOPEN_MAC_MATCH 0x1F
591 #define V_AOPEN_MAC_MATCH(x) ((x) << S_AOPEN_MAC_MATCH)
592 #define G_AOPEN_MAC_MATCH(x) (((x) >> S_AOPEN_MAC_MATCH) & M_AOPEN_MAC_MATCH)
594 #define S_AOPEN_MAC_MATCH_VALID 19
595 #define V_AOPEN_MAC_MATCH_VALID(x) ((x) << S_AOPEN_MAC_MATCH_VALID)
596 #define F_AOPEN_MAC_MATCH_VALID V_AOPEN_MAC_MATCH_VALID(1U)
598 #define S_AOPEN_IFF_VLAN 20
599 #define M_AOPEN_IFF_VLAN 0xFFF
600 #define V_AOPEN_IFF_VLAN(x) ((x) << S_AOPEN_IFF_VLAN)
601 #define G_AOPEN_IFF_VLAN(x) (((x) >> S_AOPEN_IFF_VLAN) & M_AOPEN_IFF_VLAN)
603 struct cpl_act_open_rpl {
604 RSS_HDR union opcode_tid ot;
614 struct cpl_act_establish {
615 RSS_HDR union opcode_tid ot;
634 struct cpl_get_tcb_rpl {
635 RSS_HDR union opcode_tid ot;
649 /* cpl_set_tcb.reply fields */
651 #define V_NO_REPLY(x) ((x) << S_NO_REPLY)
652 #define F_NO_REPLY V_NO_REPLY(1U)
654 struct cpl_set_tcb_field {
664 struct cpl_set_tcb_rpl {
665 RSS_HDR union opcode_tid ot;
674 #if defined(__LITTLE_ENDIAN_BITFIELD)
688 struct cpl_pcmd_reply {
689 RSS_HDR union opcode_tid ot;
695 struct cpl_close_con_req {
701 struct cpl_close_con_rpl {
702 RSS_HDR union opcode_tid ot;
709 struct cpl_close_listserv_req {
717 struct cpl_close_listserv_rpl {
718 RSS_HDR union opcode_tid ot;
723 struct cpl_abort_req_rss {
724 RSS_HDR union opcode_tid ot;
731 struct cpl_abort_req {
740 struct cpl_abort_rpl_rss {
741 RSS_HDR union opcode_tid ot;
748 struct cpl_abort_rpl {
757 struct cpl_peer_close {
758 RSS_HDR union opcode_tid ot;
771 /* tx_data_wr.param fields */
773 #define M_TX_PORT 0x7
774 #define V_TX_PORT(x) ((x) << S_TX_PORT)
775 #define G_TX_PORT(x) (((x) >> S_TX_PORT) & M_TX_PORT)
779 #define V_TX_MSS(x) ((x) << S_TX_MSS)
780 #define G_TX_MSS(x) (((x) >> S_TX_MSS) & M_TX_MSS)
783 #define M_TX_QOS 0xFF
784 #define V_TX_QOS(x) ((x) << S_TX_QOS)
785 #define G_TX_QOS(x) (((x) >> S_TX_QOS) & M_TX_QOS)
787 #define S_TX_SNDBUF 16
788 #define M_TX_SNDBUF 0xFFFF
789 #define V_TX_SNDBUF(x) ((x) << S_TX_SNDBUF)
790 #define G_TX_SNDBUF(x) (((x) >> S_TX_SNDBUF) & M_TX_SNDBUF)
800 /* cpl_tx_data.flags fields */
801 #define S_TX_ULP_SUBMODE 6
802 #define M_TX_ULP_SUBMODE 0xF
803 #define V_TX_ULP_SUBMODE(x) ((x) << S_TX_ULP_SUBMODE)
804 #define G_TX_ULP_SUBMODE(x) (((x) >> S_TX_ULP_SUBMODE) & M_TX_ULP_SUBMODE)
806 #define S_TX_ULP_MODE 10
807 #define M_TX_ULP_MODE 0xF
808 #define V_TX_ULP_MODE(x) ((x) << S_TX_ULP_MODE)
809 #define G_TX_ULP_MODE(x) (((x) >> S_TX_ULP_MODE) & M_TX_ULP_MODE)
811 #define S_TX_SHOVE 14
812 #define V_TX_SHOVE(x) ((x) << S_TX_SHOVE)
813 #define F_TX_SHOVE V_TX_SHOVE(1U)
816 #define V_TX_MORE(x) ((x) << S_TX_MORE)
817 #define F_TX_MORE V_TX_MORE(1U)
819 /* additional tx_data_wr.flags fields */
820 #define S_TX_CPU_IDX 0
821 #define M_TX_CPU_IDX 0x3F
822 #define V_TX_CPU_IDX(x) ((x) << S_TX_CPU_IDX)
823 #define G_TX_CPU_IDX(x) (((x) >> S_TX_CPU_IDX) & M_TX_CPU_IDX)
826 #define V_TX_URG(x) ((x) << S_TX_URG)
827 #define F_TX_URG V_TX_URG(1U)
829 #define S_TX_CLOSE 17
830 #define V_TX_CLOSE(x) ((x) << S_TX_CLOSE)
831 #define F_TX_CLOSE V_TX_CLOSE(1U)
834 #define V_TX_INIT(x) ((x) << S_TX_INIT)
835 #define F_TX_INIT V_TX_INIT(1U)
837 #define S_TX_IMM_ACK 19
838 #define V_TX_IMM_ACK(x) ((x) << S_TX_IMM_ACK)
839 #define F_TX_IMM_ACK V_TX_IMM_ACK(1U)
841 #define S_TX_IMM_DMA 20
842 #define V_TX_IMM_DMA(x) ((x) << S_TX_IMM_DMA)
843 #define F_TX_IMM_DMA V_TX_IMM_DMA(1U)
845 struct cpl_tx_data_ack {
846 RSS_HDR union opcode_tid ot;
851 RSS_HDR union opcode_tid ot;
858 struct cpl_rdma_ec_status {
859 RSS_HDR union opcode_tid ot;
864 struct mngt_pktsched_wr {
877 struct cpl_iscsi_hdr {
878 RSS_HDR union opcode_tid ot;
887 /* cpl_iscsi_hdr.pdu_len_ddp fields */
888 #define S_ISCSI_PDU_LEN 0
889 #define M_ISCSI_PDU_LEN 0x7FFF
890 #define V_ISCSI_PDU_LEN(x) ((x) << S_ISCSI_PDU_LEN)
891 #define G_ISCSI_PDU_LEN(x) (((x) >> S_ISCSI_PDU_LEN) & M_ISCSI_PDU_LEN)
893 #define S_ISCSI_DDP 15
894 #define V_ISCSI_DDP(x) ((x) << S_ISCSI_DDP)
895 #define F_ISCSI_DDP V_ISCSI_DDP(1U)
898 RSS_HDR union opcode_tid ot;
903 #if defined(__LITTLE_ENDIAN_BITFIELD)
917 struct cpl_rx_data_ack {
923 /* cpl_rx_data_ack.ack_seq fields */
924 #define S_RX_CREDITS 0
925 #define M_RX_CREDITS 0x7FFFFFF
926 #define V_RX_CREDITS(x) ((x) << S_RX_CREDITS)
927 #define G_RX_CREDITS(x) (((x) >> S_RX_CREDITS) & M_RX_CREDITS)
929 #define S_RX_MODULATE 27
930 #define V_RX_MODULATE(x) ((x) << S_RX_MODULATE)
931 #define F_RX_MODULATE V_RX_MODULATE(1U)
933 #define S_RX_FORCE_ACK 28
934 #define V_RX_FORCE_ACK(x) ((x) << S_RX_FORCE_ACK)
935 #define F_RX_FORCE_ACK V_RX_FORCE_ACK(1U)
937 #define S_RX_DACK_MODE 29
938 #define M_RX_DACK_MODE 0x3
939 #define V_RX_DACK_MODE(x) ((x) << S_RX_DACK_MODE)
940 #define G_RX_DACK_MODE(x) (((x) >> S_RX_DACK_MODE) & M_RX_DACK_MODE)
942 #define S_RX_DACK_CHANGE 31
943 #define V_RX_DACK_CHANGE(x) ((x) << S_RX_DACK_CHANGE)
944 #define F_RX_DACK_CHANGE V_RX_DACK_CHANGE(1U)
946 struct cpl_rx_urg_notify {
947 RSS_HDR union opcode_tid ot;
951 struct cpl_rx_ddp_complete {
952 RSS_HDR union opcode_tid ot;
956 struct cpl_rx_data_ddp {
957 RSS_HDR union opcode_tid ot;
966 __be32 ddpvld_status;
969 /* cpl_rx_data_ddp.ddpvld_status fields */
970 #define S_DDP_STATUS 0
971 #define M_DDP_STATUS 0xFF
972 #define V_DDP_STATUS(x) ((x) << S_DDP_STATUS)
973 #define G_DDP_STATUS(x) (((x) >> S_DDP_STATUS) & M_DDP_STATUS)
975 #define S_DDP_VALID 15
976 #define M_DDP_VALID 0x1FFFF
977 #define V_DDP_VALID(x) ((x) << S_DDP_VALID)
978 #define G_DDP_VALID(x) (((x) >> S_DDP_VALID) & M_DDP_VALID)
980 #define S_DDP_PPOD_MISMATCH 15
981 #define V_DDP_PPOD_MISMATCH(x) ((x) << S_DDP_PPOD_MISMATCH)
982 #define F_DDP_PPOD_MISMATCH V_DDP_PPOD_MISMATCH(1U)
985 #define V_DDP_PDU(x) ((x) << S_DDP_PDU)
986 #define F_DDP_PDU V_DDP_PDU(1U)
988 #define S_DDP_LLIMIT_ERR 17
989 #define V_DDP_LLIMIT_ERR(x) ((x) << S_DDP_LLIMIT_ERR)
990 #define F_DDP_LLIMIT_ERR V_DDP_LLIMIT_ERR(1U)
992 #define S_DDP_PPOD_PARITY_ERR 18
993 #define V_DDP_PPOD_PARITY_ERR(x) ((x) << S_DDP_PPOD_PARITY_ERR)
994 #define F_DDP_PPOD_PARITY_ERR V_DDP_PPOD_PARITY_ERR(1U)
996 #define S_DDP_PADDING_ERR 19
997 #define V_DDP_PADDING_ERR(x) ((x) << S_DDP_PADDING_ERR)
998 #define F_DDP_PADDING_ERR V_DDP_PADDING_ERR(1U)
1000 #define S_DDP_HDRCRC_ERR 20
1001 #define V_DDP_HDRCRC_ERR(x) ((x) << S_DDP_HDRCRC_ERR)
1002 #define F_DDP_HDRCRC_ERR V_DDP_HDRCRC_ERR(1U)
1004 #define S_DDP_DATACRC_ERR 21
1005 #define V_DDP_DATACRC_ERR(x) ((x) << S_DDP_DATACRC_ERR)
1006 #define F_DDP_DATACRC_ERR V_DDP_DATACRC_ERR(1U)
1008 #define S_DDP_INVALID_TAG 22
1009 #define V_DDP_INVALID_TAG(x) ((x) << S_DDP_INVALID_TAG)
1010 #define F_DDP_INVALID_TAG V_DDP_INVALID_TAG(1U)
1012 #define S_DDP_ULIMIT_ERR 23
1013 #define V_DDP_ULIMIT_ERR(x) ((x) << S_DDP_ULIMIT_ERR)
1014 #define F_DDP_ULIMIT_ERR V_DDP_ULIMIT_ERR(1U)
1016 #define S_DDP_OFFSET_ERR 24
1017 #define V_DDP_OFFSET_ERR(x) ((x) << S_DDP_OFFSET_ERR)
1018 #define F_DDP_OFFSET_ERR V_DDP_OFFSET_ERR(1U)
1020 #define S_DDP_COLOR_ERR 25
1021 #define V_DDP_COLOR_ERR(x) ((x) << S_DDP_COLOR_ERR)
1022 #define F_DDP_COLOR_ERR V_DDP_COLOR_ERR(1U)
1024 #define S_DDP_TID_MISMATCH 26
1025 #define V_DDP_TID_MISMATCH(x) ((x) << S_DDP_TID_MISMATCH)
1026 #define F_DDP_TID_MISMATCH V_DDP_TID_MISMATCH(1U)
1028 #define S_DDP_INVALID_PPOD 27
1029 #define V_DDP_INVALID_PPOD(x) ((x) << S_DDP_INVALID_PPOD)
1030 #define F_DDP_INVALID_PPOD V_DDP_INVALID_PPOD(1U)
1032 #define S_DDP_ULP_MODE 28
1033 #define M_DDP_ULP_MODE 0xF
1034 #define V_DDP_ULP_MODE(x) ((x) << S_DDP_ULP_MODE)
1035 #define G_DDP_ULP_MODE(x) (((x) >> S_DDP_ULP_MODE) & M_DDP_ULP_MODE)
1037 /* cpl_rx_data_ddp.ddp_report fields */
1038 #define S_DDP_OFFSET 0
1039 #define M_DDP_OFFSET 0x3FFFFF
1040 #define V_DDP_OFFSET(x) ((x) << S_DDP_OFFSET)
1041 #define G_DDP_OFFSET(x) (((x) >> S_DDP_OFFSET) & M_DDP_OFFSET)
1043 #define S_DDP_URG 24
1044 #define V_DDP_URG(x) ((x) << S_DDP_URG)
1045 #define F_DDP_URG V_DDP_URG(1U)
1047 #define S_DDP_PSH 25
1048 #define V_DDP_PSH(x) ((x) << S_DDP_PSH)
1049 #define F_DDP_PSH V_DDP_PSH(1U)
1051 #define S_DDP_BUF_COMPLETE 26
1052 #define V_DDP_BUF_COMPLETE(x) ((x) << S_DDP_BUF_COMPLETE)
1053 #define F_DDP_BUF_COMPLETE V_DDP_BUF_COMPLETE(1U)
1055 #define S_DDP_BUF_TIMED_OUT 27
1056 #define V_DDP_BUF_TIMED_OUT(x) ((x) << S_DDP_BUF_TIMED_OUT)
1057 #define F_DDP_BUF_TIMED_OUT V_DDP_BUF_TIMED_OUT(1U)
1059 #define S_DDP_BUF_IDX 28
1060 #define V_DDP_BUF_IDX(x) ((x) << S_DDP_BUF_IDX)
1061 #define F_DDP_BUF_IDX V_DDP_BUF_IDX(1U)
1069 struct cpl_tx_pkt_lso {
1078 /* cpl_tx_pkt*.cntrl fields */
1079 #define S_TXPKT_VLAN 0
1080 #define M_TXPKT_VLAN 0xFFFF
1081 #define V_TXPKT_VLAN(x) ((x) << S_TXPKT_VLAN)
1082 #define G_TXPKT_VLAN(x) (((x) >> S_TXPKT_VLAN) & M_TXPKT_VLAN)
1084 #define S_TXPKT_INTF 16
1085 #define M_TXPKT_INTF 0xF
1086 #define V_TXPKT_INTF(x) ((x) << S_TXPKT_INTF)
1087 #define G_TXPKT_INTF(x) (((x) >> S_TXPKT_INTF) & M_TXPKT_INTF)
1089 #define S_TXPKT_IPCSUM_DIS 20
1090 #define V_TXPKT_IPCSUM_DIS(x) ((x) << S_TXPKT_IPCSUM_DIS)
1091 #define F_TXPKT_IPCSUM_DIS V_TXPKT_IPCSUM_DIS(1U)
1093 #define S_TXPKT_L4CSUM_DIS 21
1094 #define V_TXPKT_L4CSUM_DIS(x) ((x) << S_TXPKT_L4CSUM_DIS)
1095 #define F_TXPKT_L4CSUM_DIS V_TXPKT_L4CSUM_DIS(1U)
1097 #define S_TXPKT_VLAN_VLD 22
1098 #define V_TXPKT_VLAN_VLD(x) ((x) << S_TXPKT_VLAN_VLD)
1099 #define F_TXPKT_VLAN_VLD V_TXPKT_VLAN_VLD(1U)
1101 #define S_TXPKT_LOOPBACK 23
1102 #define V_TXPKT_LOOPBACK(x) ((x) << S_TXPKT_LOOPBACK)
1103 #define F_TXPKT_LOOPBACK V_TXPKT_LOOPBACK(1U)
1105 #define S_TXPKT_OPCODE 24
1106 #define M_TXPKT_OPCODE 0xFF
1107 #define V_TXPKT_OPCODE(x) ((x) << S_TXPKT_OPCODE)
1108 #define G_TXPKT_OPCODE(x) (((x) >> S_TXPKT_OPCODE) & M_TXPKT_OPCODE)
1110 /* cpl_tx_pkt_lso.lso_info fields */
1112 #define M_LSO_MSS 0x3FFF
1113 #define V_LSO_MSS(x) ((x) << S_LSO_MSS)
1114 #define G_LSO_MSS(x) (((x) >> S_LSO_MSS) & M_LSO_MSS)
1116 #define S_LSO_ETH_TYPE 14
1117 #define M_LSO_ETH_TYPE 0x3
1118 #define V_LSO_ETH_TYPE(x) ((x) << S_LSO_ETH_TYPE)
1119 #define G_LSO_ETH_TYPE(x) (((x) >> S_LSO_ETH_TYPE) & M_LSO_ETH_TYPE)
1121 #define S_LSO_TCPHDR_WORDS 16
1122 #define M_LSO_TCPHDR_WORDS 0xF
1123 #define V_LSO_TCPHDR_WORDS(x) ((x) << S_LSO_TCPHDR_WORDS)
1124 #define G_LSO_TCPHDR_WORDS(x) (((x) >> S_LSO_TCPHDR_WORDS) & M_LSO_TCPHDR_WORDS)
1126 #define S_LSO_IPHDR_WORDS 20
1127 #define M_LSO_IPHDR_WORDS 0xF
1128 #define V_LSO_IPHDR_WORDS(x) ((x) << S_LSO_IPHDR_WORDS)
1129 #define G_LSO_IPHDR_WORDS(x) (((x) >> S_LSO_IPHDR_WORDS) & M_LSO_IPHDR_WORDS)
1131 #define S_LSO_IPV6 24
1132 #define V_LSO_IPV6(x) ((x) << S_LSO_IPV6)
1133 #define F_LSO_IPV6 V_LSO_IPV6(1U)
1135 struct cpl_trace_pkt {
1138 #if defined(__LITTLE_ENDIAN_BITFIELD)
1146 #if defined(__LITTLE_ENDIAN_BITFIELD)
1154 #endif /* CHELSIO_FW */
1157 #if defined(__LITTLE_ENDIAN_BITFIELD)
1169 RSS_HDR __u8 opcode;
1170 #if defined(__LITTLE_ENDIAN_BITFIELD)
1188 struct cpl_l2t_write_req {
1190 union opcode_tid ot;
1196 /* cpl_l2t_write_req.params fields */
1197 #define S_L2T_W_IDX 0
1198 #define M_L2T_W_IDX 0x7FF
1199 #define V_L2T_W_IDX(x) ((x) << S_L2T_W_IDX)
1200 #define G_L2T_W_IDX(x) (((x) >> S_L2T_W_IDX) & M_L2T_W_IDX)
1202 #define S_L2T_W_VLAN 11
1203 #define M_L2T_W_VLAN 0xFFF
1204 #define V_L2T_W_VLAN(x) ((x) << S_L2T_W_VLAN)
1205 #define G_L2T_W_VLAN(x) (((x) >> S_L2T_W_VLAN) & M_L2T_W_VLAN)
1207 #define S_L2T_W_IFF 23
1208 #define M_L2T_W_IFF 0xF
1209 #define V_L2T_W_IFF(x) ((x) << S_L2T_W_IFF)
1210 #define G_L2T_W_IFF(x) (((x) >> S_L2T_W_IFF) & M_L2T_W_IFF)
1212 #define S_L2T_W_PRIO 27
1213 #define M_L2T_W_PRIO 0x7
1214 #define V_L2T_W_PRIO(x) ((x) << S_L2T_W_PRIO)
1215 #define G_L2T_W_PRIO(x) (((x) >> S_L2T_W_PRIO) & M_L2T_W_PRIO)
1217 struct cpl_l2t_write_rpl {
1218 RSS_HDR union opcode_tid ot;
1223 struct cpl_l2t_read_req {
1225 union opcode_tid ot;
1230 struct cpl_l2t_read_rpl {
1231 RSS_HDR union opcode_tid ot;
1237 /* cpl_l2t_read_rpl.params fields */
1238 #define S_L2T_R_PRIO 0
1239 #define M_L2T_R_PRIO 0x7
1240 #define V_L2T_R_PRIO(x) ((x) << S_L2T_R_PRIO)
1241 #define G_L2T_R_PRIO(x) (((x) >> S_L2T_R_PRIO) & M_L2T_R_PRIO)
1243 #define S_L2T_R_VLAN 8
1244 #define M_L2T_R_VLAN 0xFFF
1245 #define V_L2T_R_VLAN(x) ((x) << S_L2T_R_VLAN)
1246 #define G_L2T_R_VLAN(x) (((x) >> S_L2T_R_VLAN) & M_L2T_R_VLAN)
1248 #define S_L2T_R_IFF 20
1249 #define M_L2T_R_IFF 0xF
1250 #define V_L2T_R_IFF(x) ((x) << S_L2T_R_IFF)
1251 #define G_L2T_R_IFF(x) (((x) >> S_L2T_R_IFF) & M_L2T_R_IFF)
1253 #define S_L2T_STATUS 24
1254 #define M_L2T_STATUS 0xFF
1255 #define V_L2T_STATUS(x) ((x) << S_L2T_STATUS)
1256 #define G_L2T_STATUS(x) (((x) >> S_L2T_STATUS) & M_L2T_STATUS)
1258 struct cpl_smt_write_req {
1260 union opcode_tid ot;
1262 #if defined(__LITTLE_ENDIAN_BITFIELD)
1276 struct cpl_smt_write_rpl {
1277 RSS_HDR union opcode_tid ot;
1282 struct cpl_smt_read_req {
1284 union opcode_tid ot;
1286 #if defined(__LITTLE_ENDIAN_BITFIELD)
1296 struct cpl_smt_read_rpl {
1297 RSS_HDR union opcode_tid ot;
1299 #if defined(__LITTLE_ENDIAN_BITFIELD)
1313 struct cpl_rte_delete_req {
1315 union opcode_tid ot;
1319 /* { cpl_rte_delete_req, cpl_rte_read_req }.params fields */
1320 #define S_RTE_REQ_LUT_IX 8
1321 #define M_RTE_REQ_LUT_IX 0x7FF
1322 #define V_RTE_REQ_LUT_IX(x) ((x) << S_RTE_REQ_LUT_IX)
1323 #define G_RTE_REQ_LUT_IX(x) (((x) >> S_RTE_REQ_LUT_IX) & M_RTE_REQ_LUT_IX)
1325 #define S_RTE_REQ_LUT_BASE 19
1326 #define M_RTE_REQ_LUT_BASE 0x7FF
1327 #define V_RTE_REQ_LUT_BASE(x) ((x) << S_RTE_REQ_LUT_BASE)
1328 #define G_RTE_REQ_LUT_BASE(x) (((x) >> S_RTE_REQ_LUT_BASE) & M_RTE_REQ_LUT_BASE)
1330 #define S_RTE_READ_REQ_SELECT 31
1331 #define V_RTE_READ_REQ_SELECT(x) ((x) << S_RTE_READ_REQ_SELECT)
1332 #define F_RTE_READ_REQ_SELECT V_RTE_READ_REQ_SELECT(1U)
1334 struct cpl_rte_delete_rpl {
1335 RSS_HDR union opcode_tid ot;
1340 struct cpl_rte_write_req {
1342 union opcode_tid ot;
1343 #if defined(__LITTLE_ENDIAN_BITFIELD)
1346 __u8 write_l2t_lut:1;
1348 __u8 write_l2t_lut:1;
1360 /* cpl_rte_write_req.lut_params fields */
1361 #define S_RTE_WRITE_REQ_LUT_IX 10
1362 #define M_RTE_WRITE_REQ_LUT_IX 0x7FF
1363 #define V_RTE_WRITE_REQ_LUT_IX(x) ((x) << S_RTE_WRITE_REQ_LUT_IX)
1364 #define G_RTE_WRITE_REQ_LUT_IX(x) (((x) >> S_RTE_WRITE_REQ_LUT_IX) & M_RTE_WRITE_REQ_LUT_IX)
1366 #define S_RTE_WRITE_REQ_LUT_BASE 21
1367 #define M_RTE_WRITE_REQ_LUT_BASE 0x7FF
1368 #define V_RTE_WRITE_REQ_LUT_BASE(x) ((x) << S_RTE_WRITE_REQ_LUT_BASE)
1369 #define G_RTE_WRITE_REQ_LUT_BASE(x) (((x) >> S_RTE_WRITE_REQ_LUT_BASE) & M_RTE_WRITE_REQ_LUT_BASE)
1371 struct cpl_rte_write_rpl {
1372 RSS_HDR union opcode_tid ot;
1377 struct cpl_rte_read_req {
1379 union opcode_tid ot;
1383 struct cpl_rte_read_rpl {
1384 RSS_HDR union opcode_tid ot;
1388 #if defined(__LITTLE_ENDIAN_BITFIELD)
1399 struct cpl_tid_release {
1401 union opcode_tid ot;
1405 struct cpl_barrier {
1411 struct cpl_rdma_read_req {
1416 struct cpl_rdma_terminate {
1420 #if defined(__LITTLE_ENDIAN_BITFIELD)
1434 /* cpl_rdma_terminate.tid_len fields */
1435 #define S_FLIT_CNT 0
1436 #define M_FLIT_CNT 0xFF
1437 #define V_FLIT_CNT(x) ((x) << S_FLIT_CNT)
1438 #define G_FLIT_CNT(x) (((x) >> S_FLIT_CNT) & M_FLIT_CNT)
1440 #define S_TERM_TID 8
1441 #define M_TERM_TID 0xFFFFF
1442 #define V_TERM_TID(x) ((x) << S_TERM_TID)
1443 #define G_TERM_TID(x) (((x) >> S_TERM_TID) & M_TERM_TID)
1444 #endif /* T3_CPL_H */