2 * This file is part of the Chelsio T4 Ethernet driver for Linux.
4 * Copyright (c) 2003-2010 Chelsio Communications, Inc. All rights reserved.
6 * This software is available to you under a choice of one of two
7 * licenses. You may choose to be licensed under the terms of the GNU
8 * General Public License (GPL) Version 2, available from the file
9 * COPYING in the main directory of this source tree, or the
10 * OpenIB.org BSD license below:
12 * Redistribution and use in source and binary forms, with or
13 * without modification, are permitted provided that the following
16 * - Redistributions of source code must retain the above
17 * copyright notice, this list of conditions and the following
20 * - Redistributions in binary form must reproduce the above
21 * copyright notice, this list of conditions and the following
22 * disclaimer in the documentation and/or other materials
23 * provided with the distribution.
25 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
26 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
27 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
28 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
29 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
30 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
31 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
38 #include <linux/types.h>
41 CPL_PASS_OPEN_REQ = 0x1,
42 CPL_PASS_ACCEPT_RPL = 0x2,
43 CPL_ACT_OPEN_REQ = 0x3,
44 CPL_SET_TCB_FIELD = 0x5,
46 CPL_CLOSE_CON_REQ = 0x8,
47 CPL_CLOSE_LISTSRV_REQ = 0x9,
50 CPL_RX_DATA_ACK = 0xD,
52 CPL_L2T_WRITE_REQ = 0x12,
53 CPL_TID_RELEASE = 0x1A,
55 CPL_CLOSE_LISTSRV_RPL = 0x20,
56 CPL_L2T_WRITE_RPL = 0x23,
57 CPL_PASS_OPEN_RPL = 0x24,
58 CPL_ACT_OPEN_RPL = 0x25,
59 CPL_PEER_CLOSE = 0x26,
60 CPL_ABORT_REQ_RSS = 0x2B,
61 CPL_ABORT_RPL_RSS = 0x2D,
63 CPL_CLOSE_CON_RPL = 0x32,
66 CPL_RDMA_CQE_READ_RSP = 0x36,
67 CPL_RDMA_CQE_ERR = 0x37,
69 CPL_SET_TCB_RPL = 0x3A,
71 CPL_RX_DDP_COMPLETE = 0x3F,
73 CPL_ACT_ESTABLISH = 0x40,
74 CPL_PASS_ESTABLISH = 0x41,
75 CPL_RX_DATA_DDP = 0x42,
76 CPL_PASS_ACCEPT_REQ = 0x44,
78 CPL_RDMA_READ_REQ = 0x60,
80 CPL_PASS_OPEN_REQ6 = 0x81,
81 CPL_ACT_OPEN_REQ6 = 0x83,
83 CPL_RDMA_TERMINATE = 0xA2,
84 CPL_RDMA_WRITE = 0xA4,
85 CPL_SGE_EGR_UPDATE = 0xA5,
95 CPL_TX_PKT_LSO = 0xED,
103 CPL_ERR_TCAM_FULL = 3,
104 CPL_ERR_BAD_LENGTH = 15,
105 CPL_ERR_BAD_ROUTE = 18,
106 CPL_ERR_CONN_RESET = 20,
107 CPL_ERR_CONN_EXIST_SYNRECV = 21,
108 CPL_ERR_CONN_EXIST = 22,
109 CPL_ERR_ARP_MISS = 23,
110 CPL_ERR_BAD_SYN = 24,
111 CPL_ERR_CONN_TIMEDOUT = 30,
112 CPL_ERR_XMIT_TIMEDOUT = 31,
113 CPL_ERR_PERSIST_TIMEDOUT = 32,
114 CPL_ERR_FINWAIT2_TIMEDOUT = 33,
115 CPL_ERR_KEEPALIVE_TIMEDOUT = 34,
116 CPL_ERR_RTX_NEG_ADVICE = 35,
117 CPL_ERR_PERSIST_NEG_ADVICE = 36,
118 CPL_ERR_ABORT_FAILED = 42,
119 CPL_ERR_IWARP_FLM = 50,
130 ULP_CRC_HEADER = 1 << 0,
131 ULP_CRC_DATA = 1 << 1
135 CPL_ABORT_SEND_RST = 0,
139 enum { /* TX_PKT_XT checksum types */
158 #define CPL_OPCODE(x) ((x) << 24)
159 #define MK_OPCODE_TID(opcode, tid) (CPL_OPCODE(opcode) | (tid))
160 #define OPCODE_TID(cmd) ((cmd)->ot.opcode_tid)
161 #define GET_TID(cmd) (ntohl(OPCODE_TID(cmd)) & 0xFFFFFF)
163 /* partitioning of TID fields that also carry a queue id */
164 #define GET_TID_TID(x) ((x) & 0x3fff)
165 #define GET_TID_QID(x) (((x) >> 14) & 0x3ff)
166 #define TID_QID(x) ((x) << 14)
170 #if defined(__LITTLE_ENDIAN_BITFIELD)
189 struct work_request_hdr {
195 #define WR_HDR struct work_request_hdr wr
197 struct cpl_pass_open_req {
205 #define TX_CHAN(x) ((x) << 2)
206 #define DELACK(x) ((x) << 5)
207 #define ULP_MODE(x) ((x) << 8)
208 #define RCV_BUFSIZ(x) ((x) << 12)
209 #define DSCP(x) ((x) << 22)
210 #define SMAC_SEL(x) ((u64)(x) << 28)
211 #define L2T_IDX(x) ((u64)(x) << 36)
212 #define NAGLE(x) ((u64)(x) << 49)
213 #define WND_SCALE(x) ((u64)(x) << 50)
214 #define KEEP_ALIVE(x) ((u64)(x) << 54)
215 #define MSS_IDX(x) ((u64)(x) << 60)
217 #define SYN_RSS_ENABLE (1 << 0)
218 #define SYN_RSS_QUEUE(x) ((x) << 2)
219 #define CONN_POLICY_ASK (1 << 22)
222 struct cpl_pass_open_req6 {
235 struct cpl_pass_open_rpl {
241 struct cpl_pass_accept_rpl {
245 #define RSS_QUEUE(x) ((x) << 0)
246 #define RSS_QUEUE_VALID (1 << 10)
247 #define RX_COALESCE_VALID(x) ((x) << 11)
248 #define RX_COALESCE(x) ((x) << 12)
249 #define TX_QUEUE(x) ((x) << 23)
250 #define RX_CHANNEL(x) ((x) << 26)
251 #define WND_SCALE_EN(x) ((x) << 28)
252 #define TSTAMPS_EN(x) ((x) << 29)
253 #define SACK_EN(x) ((x) << 30)
257 struct cpl_act_open_req {
269 struct cpl_act_open_req6 {
283 struct cpl_act_open_rpl {
286 #define GET_AOPEN_STATUS(x) ((x) & 0xff)
287 #define GET_AOPEN_ATID(x) (((x) >> 8) & 0xffffff)
290 struct cpl_pass_establish {
294 #define GET_POPEN_TID(x) ((x) & 0xffffff)
295 #define GET_POPEN_TOS(x) (((x) >> 24) & 0xff)
298 #define GET_TCPOPT_WSCALE_OK(x) (((x) >> 5) & 1)
299 #define GET_TCPOPT_SACK(x) (((x) >> 6) & 1)
300 #define GET_TCPOPT_TSTAMP(x) (((x) >> 7) & 1)
301 #define GET_TCPOPT_SND_WSCALE(x) (((x) >> 8) & 0xf)
302 #define GET_TCPOPT_MSS(x) (((x) >> 12) & 0xf)
307 struct cpl_act_establish {
321 #define QUEUENO(x) ((x) << 0)
322 #define REPLY_CHAN(x) ((x) << 14)
323 #define NO_REPLY(x) ((x) << 15)
327 struct cpl_set_tcb_field {
332 #define TCB_WORD(x) ((x) << 0)
333 #define TCB_COOKIE(x) ((x) << 5)
338 struct cpl_set_tcb_rpl {
346 struct cpl_close_con_req {
352 struct cpl_close_con_rpl {
360 struct cpl_close_listsvr_req {
364 #define LISTSVR_IPV6 (1 << 14)
368 struct cpl_close_listsvr_rpl {
374 struct cpl_abort_req_rss {
380 struct cpl_abort_req {
389 struct cpl_abort_rpl_rss {
395 struct cpl_abort_rpl {
404 struct cpl_peer_close {
409 struct cpl_tid_release {
415 struct cpl_tx_pkt_core {
417 #define TXPKT_VF(x) ((x) << 0)
418 #define TXPKT_PF(x) ((x) << 8)
419 #define TXPKT_VF_VLD (1 << 11)
420 #define TXPKT_OVLAN_IDX(x) ((x) << 12)
421 #define TXPKT_INTF(x) ((x) << 16)
422 #define TXPKT_INS_OVLAN (1 << 21)
423 #define TXPKT_OPCODE(x) ((x) << 24)
427 #define TXPKT_CSUM_END(x) ((x) << 12)
428 #define TXPKT_CSUM_START(x) ((x) << 20)
429 #define TXPKT_IPHDR_LEN(x) ((u64)(x) << 20)
430 #define TXPKT_CSUM_LOC(x) ((u64)(x) << 30)
431 #define TXPKT_ETHHDR_LEN(x) ((u64)(x) << 34)
432 #define TXPKT_CSUM_TYPE(x) ((u64)(x) << 40)
433 #define TXPKT_VLAN(x) ((u64)(x) << 44)
434 #define TXPKT_VLAN_VLD (1ULL << 60)
435 #define TXPKT_IPCSUM_DIS (1ULL << 62)
436 #define TXPKT_L4CSUM_DIS (1ULL << 63)
441 struct cpl_tx_pkt_core c;
444 #define cpl_tx_pkt_xt cpl_tx_pkt
446 struct cpl_tx_pkt_lso {
449 #define LSO_TCPHDR_LEN(x) ((x) << 0)
450 #define LSO_IPHDR_LEN(x) ((x) << 4)
451 #define LSO_ETHHDR_LEN(x) ((x) << 16)
452 #define LSO_IPV6(x) ((x) << 20)
453 #define LSO_LAST_SLICE (1 << 22)
454 #define LSO_FIRST_SLICE (1 << 23)
455 #define LSO_OPCODE(x) ((x) << 24)
460 /* encapsulated CPL (TX_PKT, TX_PKT_XT or TX_DATA) follows here */
463 struct cpl_iscsi_hdr {
466 #define ISCSI_PDU_LEN(x) ((x) & 0x7FFF)
467 #define ISCSI_DDP (1 << 15)
481 #if defined(__LITTLE_ENDIAN_BITFIELD)
497 struct cpl_rx_data_ack {
501 #define RX_CREDITS(x) ((x) << 0)
502 #define RX_FORCE_ACK(x) ((x) << 28)
506 struct rss_header rsshdr;
508 #if defined(__LITTLE_ENDIAN_BITFIELD)
525 #define RXF_UDP (1 << 22)
526 #define RXF_TCP (1 << 23)
531 struct cpl_trace_pkt {
534 #if defined(__LITTLE_ENDIAN_BITFIELD)
552 struct cpl_l2t_write_req {
556 #define L2T_W_INFO(x) ((x) << 2)
557 #define L2T_W_PORT(x) ((x) << 8)
558 #define L2T_W_NOREPLY(x) ((x) << 15)
564 struct cpl_l2t_write_rpl {
570 struct cpl_rdma_terminate {
576 struct cpl_sge_egr_update {
578 #define EGR_QID(x) ((x) & 0x1FFFF)
628 ULP_TX_MEM_WRITE = 3,
633 ULP_TX_SC_NOOP = 0x80,
634 ULP_TX_SC_IMM = 0x81,
635 ULP_TX_SC_DSGL = 0x82,
636 ULP_TX_SC_ISGL = 0x83
639 struct ulptx_sge_pair {
646 #define ULPTX_CMD(x) ((x) << 24)
647 #define ULPTX_NSGE(x) ((x) << 0)
650 struct ulptx_sge_pair sge[0];
656 #define ULP_MEMIO_ORDER(x) ((x) << 23)
657 __be32 len16; /* command length */
658 __be32 dlen; /* data length in 32-byte units */
659 #define ULP_MEMIO_DATA_LEN(x) ((x) << 0)
661 #define ULP_MEMIO_ADDR(x) ((x) << 0)
662 #define ULP_MEMIO_LOCK(x) ((x) << 31)
665 #endif /* __T4_MSG_H */