156b2bdd1SGireesh Nagabhushana /*
256b2bdd1SGireesh Nagabhushana  * This file and its contents are supplied under the terms of the
356b2bdd1SGireesh Nagabhushana  * Common Development and Distribution License ("CDDL"), version 1.0.
456b2bdd1SGireesh Nagabhushana  * You may only use this file in accordance with the terms of version
556b2bdd1SGireesh Nagabhushana  * 1.0 of the CDDL.
656b2bdd1SGireesh Nagabhushana  *
756b2bdd1SGireesh Nagabhushana  * A full copy of the text of the CDDL should have accompanied this
856b2bdd1SGireesh Nagabhushana  * source. A copy of the CDDL is also available via the Internet at
956b2bdd1SGireesh Nagabhushana  * http://www.illumos.org/license/CDDL.
1056b2bdd1SGireesh Nagabhushana  */
1156b2bdd1SGireesh Nagabhushana 
1256b2bdd1SGireesh Nagabhushana /*
133dde7c95SVishal Kulkarni  * Definitions of T4/T5/T6 work request and CPL5 commands and status codes
1456b2bdd1SGireesh Nagabhushana  *
157e6ad469SVishal Kulkarni  * Copyright (C) 2008-2019 Chelsio Communications.  All rights reserved.
1656b2bdd1SGireesh Nagabhushana  *
1756b2bdd1SGireesh Nagabhushana  * Written by Dimitris Michailidis (dm@chelsio.com)
1856b2bdd1SGireesh Nagabhushana  *
1956b2bdd1SGireesh Nagabhushana  * This program is distributed in the hope that it will be useful, but WITHOUT
2056b2bdd1SGireesh Nagabhushana  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
2156b2bdd1SGireesh Nagabhushana  * FITNESS FOR A PARTICULAR PURPOSE.  See the LICENSE file included in this
2256b2bdd1SGireesh Nagabhushana  * release for licensing terms and conditions.
2356b2bdd1SGireesh Nagabhushana  */
2456b2bdd1SGireesh Nagabhushana 
253dde7c95SVishal Kulkarni #ifndef T4_MSG_H
263dde7c95SVishal Kulkarni #define T4_MSG_H
273dde7c95SVishal Kulkarni 
283dde7c95SVishal Kulkarni #if !defined(__LITTLE_ENDIAN_BITFIELD) && !defined(__BIG_ENDIAN_BITFIELD)
293dde7c95SVishal Kulkarni # include <asm/byteorder.h>
303dde7c95SVishal Kulkarni #endif
3156b2bdd1SGireesh Nagabhushana 
3256b2bdd1SGireesh Nagabhushana enum {
333dde7c95SVishal Kulkarni 	CPL_PASS_OPEN_REQ     = 0x1,
343dde7c95SVishal Kulkarni 	CPL_PASS_ACCEPT_RPL   = 0x2,
353dde7c95SVishal Kulkarni 	CPL_ACT_OPEN_REQ      = 0x3,
363dde7c95SVishal Kulkarni 	CPL_SET_TCB           = 0x4,
373dde7c95SVishal Kulkarni 	CPL_SET_TCB_FIELD     = 0x5,
383dde7c95SVishal Kulkarni 	CPL_GET_TCB           = 0x6,
393dde7c95SVishal Kulkarni 	CPL_CLOSE_CON_REQ     = 0x8,
403dde7c95SVishal Kulkarni 	CPL_CLOSE_LISTSRV_REQ = 0x9,
413dde7c95SVishal Kulkarni 	CPL_ABORT_REQ         = 0xA,
423dde7c95SVishal Kulkarni 	CPL_ABORT_RPL         = 0xB,
433dde7c95SVishal Kulkarni 	CPL_TX_DATA           = 0xC,
443dde7c95SVishal Kulkarni 	CPL_RX_DATA_ACK       = 0xD,
453dde7c95SVishal Kulkarni 	CPL_TX_PKT            = 0xE,
463dde7c95SVishal Kulkarni 	CPL_RTE_DELETE_REQ    = 0xF,
473dde7c95SVishal Kulkarni 	CPL_RTE_WRITE_REQ     = 0x10,
483dde7c95SVishal Kulkarni 	CPL_RTE_READ_REQ      = 0x11,
493dde7c95SVishal Kulkarni 	CPL_L2T_WRITE_REQ     = 0x12,
503dde7c95SVishal Kulkarni 	CPL_L2T_READ_REQ      = 0x13,
513dde7c95SVishal Kulkarni 	CPL_SMT_WRITE_REQ     = 0x14,
523dde7c95SVishal Kulkarni 	CPL_SMT_READ_REQ      = 0x15,
533dde7c95SVishal Kulkarni 	CPL_TAG_WRITE_REQ     = 0x16,
543dde7c95SVishal Kulkarni 	CPL_BARRIER           = 0x18,
553dde7c95SVishal Kulkarni 	CPL_TID_RELEASE       = 0x1A,
563dde7c95SVishal Kulkarni 	CPL_TAG_READ_REQ      = 0x1B,
573dde7c95SVishal Kulkarni 	CPL_SRQ_TABLE_REQ     = 0x1C,
583dde7c95SVishal Kulkarni 	CPL_TX_PKT_FSO        = 0x1E,
593dde7c95SVishal Kulkarni 	CPL_TX_DATA_ISO       = 0x1F,
603dde7c95SVishal Kulkarni 
613dde7c95SVishal Kulkarni 	CPL_CLOSE_LISTSRV_RPL = 0x20,
623dde7c95SVishal Kulkarni 	CPL_ERROR             = 0x21,
633dde7c95SVishal Kulkarni 	CPL_GET_TCB_RPL       = 0x22,
643dde7c95SVishal Kulkarni 	CPL_L2T_WRITE_RPL     = 0x23,
653dde7c95SVishal Kulkarni 	CPL_PASS_OPEN_RPL     = 0x24,
663dde7c95SVishal Kulkarni 	CPL_ACT_OPEN_RPL      = 0x25,
673dde7c95SVishal Kulkarni 	CPL_PEER_CLOSE        = 0x26,
683dde7c95SVishal Kulkarni 	CPL_RTE_DELETE_RPL    = 0x27,
693dde7c95SVishal Kulkarni 	CPL_RTE_WRITE_RPL     = 0x28,
703dde7c95SVishal Kulkarni 	CPL_RX_URG_PKT        = 0x29,
713dde7c95SVishal Kulkarni 	CPL_TAG_WRITE_RPL     = 0x2A,
723dde7c95SVishal Kulkarni 	CPL_ABORT_REQ_RSS     = 0x2B,
733dde7c95SVishal Kulkarni 	CPL_RX_URG_NOTIFY     = 0x2C,
743dde7c95SVishal Kulkarni 	CPL_ABORT_RPL_RSS     = 0x2D,
753dde7c95SVishal Kulkarni 	CPL_SMT_WRITE_RPL     = 0x2E,
763dde7c95SVishal Kulkarni 	CPL_TX_DATA_ACK       = 0x2F,
773dde7c95SVishal Kulkarni 
783dde7c95SVishal Kulkarni 	CPL_RX_PHYS_ADDR      = 0x30,
793dde7c95SVishal Kulkarni 	CPL_PCMD_READ_RPL     = 0x31,
803dde7c95SVishal Kulkarni 	CPL_CLOSE_CON_RPL     = 0x32,
813dde7c95SVishal Kulkarni 	CPL_ISCSI_HDR         = 0x33,
823dde7c95SVishal Kulkarni 	CPL_L2T_READ_RPL      = 0x34,
833dde7c95SVishal Kulkarni 	CPL_RDMA_CQE          = 0x35,
843dde7c95SVishal Kulkarni 	CPL_RDMA_CQE_READ_RSP = 0x36,
853dde7c95SVishal Kulkarni 	CPL_RDMA_CQE_ERR      = 0x37,
863dde7c95SVishal Kulkarni 	CPL_RTE_READ_RPL      = 0x38,
873dde7c95SVishal Kulkarni 	CPL_RX_DATA           = 0x39,
883dde7c95SVishal Kulkarni 	CPL_SET_TCB_RPL       = 0x3A,
893dde7c95SVishal Kulkarni 	CPL_RX_PKT            = 0x3B,
903dde7c95SVishal Kulkarni 	CPL_TAG_READ_RPL      = 0x3C,
913dde7c95SVishal Kulkarni 	CPL_HIT_NOTIFY        = 0x3D,
923dde7c95SVishal Kulkarni 	CPL_PKT_NOTIFY        = 0x3E,
933dde7c95SVishal Kulkarni 	CPL_RX_DDP_COMPLETE   = 0x3F,
943dde7c95SVishal Kulkarni 
953dde7c95SVishal Kulkarni 	CPL_ACT_ESTABLISH     = 0x40,
963dde7c95SVishal Kulkarni 	CPL_PASS_ESTABLISH    = 0x41,
973dde7c95SVishal Kulkarni 	CPL_RX_DATA_DDP       = 0x42,
983dde7c95SVishal Kulkarni 	CPL_SMT_READ_RPL      = 0x43,
993dde7c95SVishal Kulkarni 	CPL_PASS_ACCEPT_REQ   = 0x44,
1003dde7c95SVishal Kulkarni 	CPL_RX_ISCSI_CMP      = 0x45,
1013dde7c95SVishal Kulkarni 	CPL_RX_FCOE_DDP       = 0x46,
1023dde7c95SVishal Kulkarni 	CPL_FCOE_HDR          = 0x47,
1033dde7c95SVishal Kulkarni 	CPL_T5_TRACE_PKT      = 0x48,
1043dde7c95SVishal Kulkarni 	CPL_RX_ISCSI_DDP      = 0x49,
1053dde7c95SVishal Kulkarni 	CPL_RX_FCOE_DIF       = 0x4A,
1063dde7c95SVishal Kulkarni 	CPL_RX_DATA_DIF       = 0x4B,
1073dde7c95SVishal Kulkarni 	CPL_ERR_NOTIFY	      = 0x4D,
1083dde7c95SVishal Kulkarni 	CPL_RX_TLS_CMP        = 0x4E,
1093dde7c95SVishal Kulkarni 
1103dde7c95SVishal Kulkarni 	CPL_RDMA_READ_REQ     = 0x60,
1113dde7c95SVishal Kulkarni 	CPL_RX_ISCSI_DIF      = 0x60,
1123dde7c95SVishal Kulkarni 
1133dde7c95SVishal Kulkarni 	CPL_SET_LE_REQ        = 0x80,
1143dde7c95SVishal Kulkarni 	CPL_PASS_OPEN_REQ6    = 0x81,
1153dde7c95SVishal Kulkarni 	CPL_ACT_OPEN_REQ6     = 0x83,
1163dde7c95SVishal Kulkarni 	CPL_TX_TLS_PDU        = 0x88,
1173dde7c95SVishal Kulkarni 	CPL_TX_TLS_SFO        = 0x89,
1183dde7c95SVishal Kulkarni 
1193dde7c95SVishal Kulkarni 	CPL_TX_SEC_PDU        = 0x8A,
1203dde7c95SVishal Kulkarni 	CPL_TX_TLS_ACK        = 0x8B,
1213dde7c95SVishal Kulkarni 
1223dde7c95SVishal Kulkarni 	CPL_RDMA_TERMINATE    = 0xA2,
1233dde7c95SVishal Kulkarni 	CPL_RDMA_WRITE        = 0xA4,
1243dde7c95SVishal Kulkarni 	CPL_SGE_EGR_UPDATE    = 0xA5,
1253dde7c95SVishal Kulkarni 	CPL_SET_LE_RPL        = 0xA6,
1263dde7c95SVishal Kulkarni 	CPL_FW2_MSG           = 0xA7,
1273dde7c95SVishal Kulkarni 	CPL_FW2_PLD           = 0xA8,
1283dde7c95SVishal Kulkarni 	CPL_T5_RDMA_READ_REQ  = 0xA9,
1293dde7c95SVishal Kulkarni 	CPL_RDMA_ATOMIC_REQ   = 0xAA,
1303dde7c95SVishal Kulkarni 	CPL_RDMA_ATOMIC_RPL   = 0xAB,
1313dde7c95SVishal Kulkarni 	CPL_RDMA_IMM_DATA     = 0xAC,
1323dde7c95SVishal Kulkarni 	CPL_RDMA_IMM_DATA_SE  = 0xAD,
1333dde7c95SVishal Kulkarni 	CPL_RX_MPS_PKT        = 0xAF,
1343dde7c95SVishal Kulkarni 
1353dde7c95SVishal Kulkarni 	CPL_TRACE_PKT         = 0xB0,
1363dde7c95SVishal Kulkarni 	CPL_RX2TX_DATA        = 0xB1,
1373dde7c95SVishal Kulkarni 	CPL_TLS_DATA          = 0xB1,
1383dde7c95SVishal Kulkarni 	CPL_ISCSI_DATA        = 0xB2,
1393dde7c95SVishal Kulkarni 	CPL_FCOE_DATA         = 0xB3,
1403dde7c95SVishal Kulkarni 
1413dde7c95SVishal Kulkarni 	CPL_FW4_MSG           = 0xC0,
1423dde7c95SVishal Kulkarni 	CPL_FW4_PLD           = 0xC1,
1433dde7c95SVishal Kulkarni 	CPL_FW4_ACK           = 0xC3,
1443dde7c95SVishal Kulkarni 	CPL_SRQ_TABLE_RPL     = 0xCC,
1453dde7c95SVishal Kulkarni 	CPL_RX_PHYS_DSGL      = 0xD0,
1463dde7c95SVishal Kulkarni 
1473dde7c95SVishal Kulkarni 	CPL_FW6_MSG           = 0xE0,
1483dde7c95SVishal Kulkarni 	CPL_FW6_PLD           = 0xE1,
1493dde7c95SVishal Kulkarni 	CPL_TX_TNL_LSO        = 0xEC,
1503dde7c95SVishal Kulkarni 	CPL_TX_PKT_LSO        = 0xED,
1513dde7c95SVishal Kulkarni 	CPL_TX_PKT_XT         = 0xEE,
1523dde7c95SVishal Kulkarni 
1533dde7c95SVishal Kulkarni 	NUM_CPL_CMDS    /* must be last and previous entries must be sorted */
15456b2bdd1SGireesh Nagabhushana };
15556b2bdd1SGireesh Nagabhushana 
15656b2bdd1SGireesh Nagabhushana enum CPL_error {
1573dde7c95SVishal Kulkarni 	CPL_ERR_NONE               = 0,
1583dde7c95SVishal Kulkarni 	CPL_ERR_TCAM_PARITY        = 1,
1593dde7c95SVishal Kulkarni 	CPL_ERR_TCAM_MISS          = 2,
1603dde7c95SVishal Kulkarni 	CPL_ERR_TCAM_FULL          = 3,
1613dde7c95SVishal Kulkarni 	CPL_ERR_BAD_LENGTH         = 15,
1623dde7c95SVishal Kulkarni 	CPL_ERR_BAD_ROUTE          = 18,
1633dde7c95SVishal Kulkarni 	CPL_ERR_CONN_RESET         = 20,
16456b2bdd1SGireesh Nagabhushana 	CPL_ERR_CONN_EXIST_SYNRECV = 21,
1653dde7c95SVishal Kulkarni 	CPL_ERR_CONN_EXIST         = 22,
1663dde7c95SVishal Kulkarni 	CPL_ERR_ARP_MISS           = 23,
1673dde7c95SVishal Kulkarni 	CPL_ERR_BAD_SYN            = 24,
1683dde7c95SVishal Kulkarni 	CPL_ERR_CONN_TIMEDOUT      = 30,
1693dde7c95SVishal Kulkarni 	CPL_ERR_XMIT_TIMEDOUT      = 31,
17056b2bdd1SGireesh Nagabhushana 	CPL_ERR_PERSIST_TIMEDOUT   = 32,
17156b2bdd1SGireesh Nagabhushana 	CPL_ERR_FINWAIT2_TIMEDOUT  = 33,
17256b2bdd1SGireesh Nagabhushana 	CPL_ERR_KEEPALIVE_TIMEDOUT = 34,
1733dde7c95SVishal Kulkarni 	CPL_ERR_RTX_NEG_ADVICE     = 35,
17456b2bdd1SGireesh Nagabhushana 	CPL_ERR_PERSIST_NEG_ADVICE = 36,
17556b2bdd1SGireesh Nagabhushana 	CPL_ERR_KEEPALV_NEG_ADVICE = 37,
1763dde7c95SVishal Kulkarni 	CPL_ERR_WAIT_ARP_RPL       = 41,
1773dde7c95SVishal Kulkarni 	CPL_ERR_ABORT_FAILED       = 42,
1783dde7c95SVishal Kulkarni 	CPL_ERR_IWARP_FLM          = 50,
1793dde7c95SVishal Kulkarni 	CPL_CONTAINS_READ_RPL      = 60,
1803dde7c95SVishal Kulkarni 	CPL_CONTAINS_WRITE_RPL     = 61,
18156b2bdd1SGireesh Nagabhushana };
18256b2bdd1SGireesh Nagabhushana 
1833dde7c95SVishal Kulkarni /*
1843dde7c95SVishal Kulkarni  * Some of the error codes above implicitly indicate that there is no TID
1853dde7c95SVishal Kulkarni  * allocated with the result of an ACT_OPEN.  We use this predicate to make
1863dde7c95SVishal Kulkarni  * that explicit.
1873dde7c95SVishal Kulkarni  */
act_open_has_tid(int status)1883dde7c95SVishal Kulkarni static inline int act_open_has_tid(int status)
1893dde7c95SVishal Kulkarni {
1903dde7c95SVishal Kulkarni 	return (status != CPL_ERR_TCAM_PARITY &&
1913dde7c95SVishal Kulkarni 		status != CPL_ERR_TCAM_MISS &&
1923dde7c95SVishal Kulkarni 		status != CPL_ERR_TCAM_FULL &&
1933dde7c95SVishal Kulkarni 		status != CPL_ERR_CONN_EXIST_SYNRECV &&
1943dde7c95SVishal Kulkarni 		status != CPL_ERR_CONN_EXIST);
1953dde7c95SVishal Kulkarni }
1963dde7c95SVishal Kulkarni 
19756b2bdd1SGireesh Nagabhushana enum {
19856b2bdd1SGireesh Nagabhushana 	CPL_CONN_POLICY_AUTO = 0,
19956b2bdd1SGireesh Nagabhushana 	CPL_CONN_POLICY_ASK  = 1,
20056b2bdd1SGireesh Nagabhushana 	CPL_CONN_POLICY_FILTER = 2,
20156b2bdd1SGireesh Nagabhushana 	CPL_CONN_POLICY_DENY = 3
20256b2bdd1SGireesh Nagabhushana };
20356b2bdd1SGireesh Nagabhushana 
20456b2bdd1SGireesh Nagabhushana enum {
2053dde7c95SVishal Kulkarni 	ULP_MODE_NONE          = 0,
2063dde7c95SVishal Kulkarni 	ULP_MODE_ISCSI         = 2,
2073dde7c95SVishal Kulkarni 	ULP_MODE_RDMA          = 4,
2083dde7c95SVishal Kulkarni 	ULP_MODE_TCPDDP        = 5,
2093dde7c95SVishal Kulkarni 	ULP_MODE_FCOE          = 6,
2103dde7c95SVishal Kulkarni 	ULP_MODE_TLS           = 8,
21156b2bdd1SGireesh Nagabhushana };
21256b2bdd1SGireesh Nagabhushana 
21356b2bdd1SGireesh Nagabhushana enum {
21456b2bdd1SGireesh Nagabhushana 	ULP_CRC_HEADER = 1 << 0,
21556b2bdd1SGireesh Nagabhushana 	ULP_CRC_DATA   = 1 << 1
21656b2bdd1SGireesh Nagabhushana };
21756b2bdd1SGireesh Nagabhushana 
21856b2bdd1SGireesh Nagabhushana enum {
21956b2bdd1SGireesh Nagabhushana 	CPL_PASS_OPEN_ACCEPT,
22056b2bdd1SGireesh Nagabhushana 	CPL_PASS_OPEN_REJECT,
22156b2bdd1SGireesh Nagabhushana 	CPL_PASS_OPEN_ACCEPT_TNL
22256b2bdd1SGireesh Nagabhushana };
22356b2bdd1SGireesh Nagabhushana 
22456b2bdd1SGireesh Nagabhushana enum {
22556b2bdd1SGireesh Nagabhushana 	CPL_ABORT_SEND_RST = 0,
22656b2bdd1SGireesh Nagabhushana 	CPL_ABORT_NO_RST,
22756b2bdd1SGireesh Nagabhushana };
22856b2bdd1SGireesh Nagabhushana 
2293dde7c95SVishal Kulkarni enum {                     /* TX_PKT_XT checksum types */
2303dde7c95SVishal Kulkarni 	TX_CSUM_TCP    = 0,
2313dde7c95SVishal Kulkarni 	TX_CSUM_UDP    = 1,
2323dde7c95SVishal Kulkarni 	TX_CSUM_CRC16  = 4,
2333dde7c95SVishal Kulkarni 	TX_CSUM_CRC32  = 5,
2343dde7c95SVishal Kulkarni 	TX_CSUM_CRC32C = 6,
2353dde7c95SVishal Kulkarni 	TX_CSUM_FCOE   = 7,
2363dde7c95SVishal Kulkarni 	TX_CSUM_TCPIP  = 8,
2373dde7c95SVishal Kulkarni 	TX_CSUM_UDPIP  = 9,
2383dde7c95SVishal Kulkarni 	TX_CSUM_TCPIP6 = 10,
2393dde7c95SVishal Kulkarni 	TX_CSUM_UDPIP6 = 11,
2403dde7c95SVishal Kulkarni 	TX_CSUM_IP     = 12,
24156b2bdd1SGireesh Nagabhushana };
24256b2bdd1SGireesh Nagabhushana 
2433dde7c95SVishal Kulkarni enum {                     /* packet type in CPL_RX_PKT */
24456b2bdd1SGireesh Nagabhushana 	PKTYPE_XACT_UCAST = 0,
24556b2bdd1SGireesh Nagabhushana 	PKTYPE_HASH_UCAST = 1,
24656b2bdd1SGireesh Nagabhushana 	PKTYPE_XACT_MCAST = 2,
24756b2bdd1SGireesh Nagabhushana 	PKTYPE_HASH_MCAST = 3,
2483dde7c95SVishal Kulkarni 	PKTYPE_PROMISC    = 4,
2493dde7c95SVishal Kulkarni 	PKTYPE_HPROMISC   = 5,
2503dde7c95SVishal Kulkarni 	PKTYPE_BCAST      = 6
25156b2bdd1SGireesh Nagabhushana };
25256b2bdd1SGireesh Nagabhushana 
2533dde7c95SVishal Kulkarni enum {                     /* DMAC type in CPL_RX_PKT */
25456b2bdd1SGireesh Nagabhushana 	DATYPE_UCAST,
25556b2bdd1SGireesh Nagabhushana 	DATYPE_MCAST,
25656b2bdd1SGireesh Nagabhushana 	DATYPE_BCAST
25756b2bdd1SGireesh Nagabhushana };
25856b2bdd1SGireesh Nagabhushana 
2593dde7c95SVishal Kulkarni enum {                     /* TCP congestion control algorithms */
26056b2bdd1SGireesh Nagabhushana 	CONG_ALG_RENO,
26156b2bdd1SGireesh Nagabhushana 	CONG_ALG_TAHOE,
26256b2bdd1SGireesh Nagabhushana 	CONG_ALG_NEWRENO,
26356b2bdd1SGireesh Nagabhushana 	CONG_ALG_HIGHSPEED
26456b2bdd1SGireesh Nagabhushana };
26556b2bdd1SGireesh Nagabhushana 
2663dde7c95SVishal Kulkarni enum {                     /* RSS hash type */
26756b2bdd1SGireesh Nagabhushana 	RSS_HASH_NONE = 0, /* no hash computed */
26856b2bdd1SGireesh Nagabhushana 	RSS_HASH_IP   = 1, /* IP or IPv6 2-tuple hash */
26956b2bdd1SGireesh Nagabhushana 	RSS_HASH_TCP  = 2, /* TCP 4-tuple hash */
27056b2bdd1SGireesh Nagabhushana 	RSS_HASH_UDP  = 3  /* UDP 4-tuple hash */
27156b2bdd1SGireesh Nagabhushana };
27256b2bdd1SGireesh Nagabhushana 
2733dde7c95SVishal Kulkarni enum {                     /* LE commands */
27456b2bdd1SGireesh Nagabhushana 	LE_CMD_READ  = 0x4,
27556b2bdd1SGireesh Nagabhushana 	LE_CMD_WRITE = 0xb
27656b2bdd1SGireesh Nagabhushana };
27756b2bdd1SGireesh Nagabhushana 
2783dde7c95SVishal Kulkarni enum {                     /* LE request size */
27956b2bdd1SGireesh Nagabhushana 	LE_SZ_NONE = 0,
28056b2bdd1SGireesh Nagabhushana 	LE_SZ_33   = 1,
28156b2bdd1SGireesh Nagabhushana 	LE_SZ_66   = 2,
28256b2bdd1SGireesh Nagabhushana 	LE_SZ_132  = 3,
28356b2bdd1SGireesh Nagabhushana 	LE_SZ_264  = 4,
28456b2bdd1SGireesh Nagabhushana 	LE_SZ_528  = 5
28556b2bdd1SGireesh Nagabhushana };
28656b2bdd1SGireesh Nagabhushana 
28756b2bdd1SGireesh Nagabhushana union opcode_tid {
28856b2bdd1SGireesh Nagabhushana 	__be32 opcode_tid;
28956b2bdd1SGireesh Nagabhushana 	__u8 opcode;
29056b2bdd1SGireesh Nagabhushana };
29156b2bdd1SGireesh Nagabhushana 
2923dde7c95SVishal Kulkarni #define S_CPL_OPCODE    24
2933dde7c95SVishal Kulkarni #define V_CPL_OPCODE(x) ((x) << S_CPL_OPCODE)
2943dde7c95SVishal Kulkarni #define G_CPL_OPCODE(x) (((x) >> S_CPL_OPCODE) & 0xFF)
2953dde7c95SVishal Kulkarni #define G_TID(x)    ((x) & 0xFFFFFF)
29656b2bdd1SGireesh Nagabhushana 
29756b2bdd1SGireesh Nagabhushana /* tid is assumed to be 24-bits */
2983dde7c95SVishal Kulkarni #define MK_OPCODE_TID(opcode, tid) (V_CPL_OPCODE(opcode) | (tid))
29956b2bdd1SGireesh Nagabhushana 
3003dde7c95SVishal Kulkarni #define OPCODE_TID(cmd) ((cmd)->ot.opcode_tid)
30156b2bdd1SGireesh Nagabhushana 
30256b2bdd1SGireesh Nagabhushana /* extract the TID from a CPL command */
3033dde7c95SVishal Kulkarni #define GET_TID(cmd) (G_TID(be32_to_cpu(OPCODE_TID(cmd))))
30456b2bdd1SGireesh Nagabhushana 
30556b2bdd1SGireesh Nagabhushana /* partitioning of TID fields that also carry a queue id */
3063dde7c95SVishal Kulkarni #define S_TID_TID    0
3073dde7c95SVishal Kulkarni #define M_TID_TID    0x3fff
3083dde7c95SVishal Kulkarni #define V_TID_TID(x) ((x) << S_TID_TID)
3093dde7c95SVishal Kulkarni #define G_TID_TID(x) (((x) >> S_TID_TID) & M_TID_TID)
31056b2bdd1SGireesh Nagabhushana 
3113dde7c95SVishal Kulkarni #define S_TID_QID    14
3123dde7c95SVishal Kulkarni #define M_TID_QID    0x3ff
3133dde7c95SVishal Kulkarni #define V_TID_QID(x) ((x) << S_TID_QID)
3143dde7c95SVishal Kulkarni #define G_TID_QID(x) (((x) >> S_TID_QID) & M_TID_QID)
31556b2bdd1SGireesh Nagabhushana 
31656b2bdd1SGireesh Nagabhushana union opcode_info {
31756b2bdd1SGireesh Nagabhushana 	__be64 opcode_info;
31856b2bdd1SGireesh Nagabhushana 	__u8 opcode;
31956b2bdd1SGireesh Nagabhushana };
32056b2bdd1SGireesh Nagabhushana 
32156b2bdd1SGireesh Nagabhushana struct tcp_options {
32256b2bdd1SGireesh Nagabhushana 	__be16 mss;
32356b2bdd1SGireesh Nagabhushana 	__u8 wsf;
32456b2bdd1SGireesh Nagabhushana #if defined(__LITTLE_ENDIAN_BITFIELD)
32556b2bdd1SGireesh Nagabhushana 	__u8 :4;
32656b2bdd1SGireesh Nagabhushana 	__u8 unknown:1;
327de483253SVishal Kulkarni 	__u8 ecn:1;
32856b2bdd1SGireesh Nagabhushana 	__u8 sack:1;
32956b2bdd1SGireesh Nagabhushana 	__u8 tstamp:1;
33056b2bdd1SGireesh Nagabhushana #else
33156b2bdd1SGireesh Nagabhushana 	__u8 tstamp:1;
33256b2bdd1SGireesh Nagabhushana 	__u8 sack:1;
333de483253SVishal Kulkarni 	__u8 ecn:1;
33456b2bdd1SGireesh Nagabhushana 	__u8 unknown:1;
33556b2bdd1SGireesh Nagabhushana 	__u8 :4;
33656b2bdd1SGireesh Nagabhushana #endif
33756b2bdd1SGireesh Nagabhushana };
33856b2bdd1SGireesh Nagabhushana 
33956b2bdd1SGireesh Nagabhushana struct rss_header {
34056b2bdd1SGireesh Nagabhushana 	__u8 opcode;
34156b2bdd1SGireesh Nagabhushana #if defined(__LITTLE_ENDIAN_BITFIELD)
34256b2bdd1SGireesh Nagabhushana 	__u8 channel:2;
34356b2bdd1SGireesh Nagabhushana 	__u8 filter_hit:1;
34456b2bdd1SGireesh Nagabhushana 	__u8 filter_tid:1;
34556b2bdd1SGireesh Nagabhushana 	__u8 hash_type:2;
34656b2bdd1SGireesh Nagabhushana 	__u8 ipv6:1;
34756b2bdd1SGireesh Nagabhushana 	__u8 send2fw:1;
34856b2bdd1SGireesh Nagabhushana #else
34956b2bdd1SGireesh Nagabhushana 	__u8 send2fw:1;
35056b2bdd1SGireesh Nagabhushana 	__u8 ipv6:1;
35156b2bdd1SGireesh Nagabhushana 	__u8 hash_type:2;
35256b2bdd1SGireesh Nagabhushana 	__u8 filter_tid:1;
35356b2bdd1SGireesh Nagabhushana 	__u8 filter_hit:1;
35456b2bdd1SGireesh Nagabhushana 	__u8 channel:2;
35556b2bdd1SGireesh Nagabhushana #endif
35656b2bdd1SGireesh Nagabhushana 	__be16 qid;
35756b2bdd1SGireesh Nagabhushana 	__be32 hash_val;
35856b2bdd1SGireesh Nagabhushana };
35956b2bdd1SGireesh Nagabhushana 
3603dde7c95SVishal Kulkarni #define S_HASHTYPE 20
3613dde7c95SVishal Kulkarni #define M_HASHTYPE 0x3
3623dde7c95SVishal Kulkarni #define G_HASHTYPE(x) (((x) >> S_HASHTYPE) & M_HASHTYPE)
36356b2bdd1SGireesh Nagabhushana 
3643dde7c95SVishal Kulkarni #define S_QNUM 0
3653dde7c95SVishal Kulkarni #define M_QNUM 0xFFFF
3663dde7c95SVishal Kulkarni #define G_QNUM(x) (((x) >> S_QNUM) & M_QNUM)
3673dde7c95SVishal Kulkarni 
3683dde7c95SVishal Kulkarni #if defined(RSS_HDR_VLD) || defined(CHELSIO_FW)
3693dde7c95SVishal Kulkarni # define RSS_HDR struct rss_header rss_hdr;
3703dde7c95SVishal Kulkarni #else
3713dde7c95SVishal Kulkarni # define RSS_HDR
3723dde7c95SVishal Kulkarni #endif
37356b2bdd1SGireesh Nagabhushana 
37456b2bdd1SGireesh Nagabhushana #ifndef CHELSIO_FW
37556b2bdd1SGireesh Nagabhushana struct work_request_hdr {
37656b2bdd1SGireesh Nagabhushana 	__be32 wr_hi;
37756b2bdd1SGireesh Nagabhushana 	__be32 wr_mid;
37856b2bdd1SGireesh Nagabhushana 	__be64 wr_lo;
37956b2bdd1SGireesh Nagabhushana };
38056b2bdd1SGireesh Nagabhushana 
38156b2bdd1SGireesh Nagabhushana /* wr_mid fields */
3823dde7c95SVishal Kulkarni #define S_WR_LEN16    0
3833dde7c95SVishal Kulkarni #define M_WR_LEN16    0xFF
3843dde7c95SVishal Kulkarni #define V_WR_LEN16(x) ((x) << S_WR_LEN16)
3853dde7c95SVishal Kulkarni #define G_WR_LEN16(x) (((x) >> S_WR_LEN16) & M_WR_LEN16)
38656b2bdd1SGireesh Nagabhushana 
38756b2bdd1SGireesh Nagabhushana /* wr_hi fields */
3883dde7c95SVishal Kulkarni #define S_WR_OP    24
3893dde7c95SVishal Kulkarni #define M_WR_OP    0xFF
3903dde7c95SVishal Kulkarni #define V_WR_OP(x) ((__u64)(x) << S_WR_OP)
3913dde7c95SVishal Kulkarni #define G_WR_OP(x) (((x) >> S_WR_OP) & M_WR_OP)
3923dde7c95SVishal Kulkarni 
3933dde7c95SVishal Kulkarni # define WR_HDR struct work_request_hdr wr
3943dde7c95SVishal Kulkarni # define WR_HDR_SIZE sizeof(struct work_request_hdr)
39556b2bdd1SGireesh Nagabhushana #else
3963dde7c95SVishal Kulkarni # define WR_HDR
3973dde7c95SVishal Kulkarni # define WR_HDR_SIZE 0
39856b2bdd1SGireesh Nagabhushana #endif
39956b2bdd1SGireesh Nagabhushana 
40056b2bdd1SGireesh Nagabhushana /* option 0 fields */
4013dde7c95SVishal Kulkarni #define S_ACCEPT_MODE    0
4023dde7c95SVishal Kulkarni #define M_ACCEPT_MODE    0x3
4033dde7c95SVishal Kulkarni #define V_ACCEPT_MODE(x) ((x) << S_ACCEPT_MODE)
4043dde7c95SVishal Kulkarni #define G_ACCEPT_MODE(x) (((x) >> S_ACCEPT_MODE) & M_ACCEPT_MODE)
4053dde7c95SVishal Kulkarni 
4063dde7c95SVishal Kulkarni #define S_TX_CHAN    2
4073dde7c95SVishal Kulkarni #define M_TX_CHAN    0x3
4083dde7c95SVishal Kulkarni #define V_TX_CHAN(x) ((x) << S_TX_CHAN)
4093dde7c95SVishal Kulkarni #define G_TX_CHAN(x) (((x) >> S_TX_CHAN) & M_TX_CHAN)
4103dde7c95SVishal Kulkarni 
4113dde7c95SVishal Kulkarni #define S_NO_CONG    4
4123dde7c95SVishal Kulkarni #define V_NO_CONG(x) ((x) << S_NO_CONG)
4133dde7c95SVishal Kulkarni #define F_NO_CONG    V_NO_CONG(1U)
4143dde7c95SVishal Kulkarni 
4153dde7c95SVishal Kulkarni #define S_DELACK    5
4163dde7c95SVishal Kulkarni #define V_DELACK(x) ((x) << S_DELACK)
4173dde7c95SVishal Kulkarni #define F_DELACK    V_DELACK(1U)
4183dde7c95SVishal Kulkarni 
4193dde7c95SVishal Kulkarni #define S_INJECT_TIMER    6
4203dde7c95SVishal Kulkarni #define V_INJECT_TIMER(x) ((x) << S_INJECT_TIMER)
4213dde7c95SVishal Kulkarni #define F_INJECT_TIMER    V_INJECT_TIMER(1U)
4223dde7c95SVishal Kulkarni 
4233dde7c95SVishal Kulkarni #define S_NON_OFFLOAD    7
4243dde7c95SVishal Kulkarni #define V_NON_OFFLOAD(x) ((x) << S_NON_OFFLOAD)
4253dde7c95SVishal Kulkarni #define F_NON_OFFLOAD    V_NON_OFFLOAD(1U)
4263dde7c95SVishal Kulkarni 
4273dde7c95SVishal Kulkarni #define S_ULP_MODE    8
4283dde7c95SVishal Kulkarni #define M_ULP_MODE    0xF
4293dde7c95SVishal Kulkarni #define V_ULP_MODE(x) ((x) << S_ULP_MODE)
4303dde7c95SVishal Kulkarni #define G_ULP_MODE(x) (((x) >> S_ULP_MODE) & M_ULP_MODE)
4313dde7c95SVishal Kulkarni 
4323dde7c95SVishal Kulkarni #define S_RCV_BUFSIZ    12
4333dde7c95SVishal Kulkarni #define M_RCV_BUFSIZ    0x3FFU
4343dde7c95SVishal Kulkarni #define V_RCV_BUFSIZ(x) ((x) << S_RCV_BUFSIZ)
4353dde7c95SVishal Kulkarni #define G_RCV_BUFSIZ(x) (((x) >> S_RCV_BUFSIZ) & M_RCV_BUFSIZ)
4363dde7c95SVishal Kulkarni 
4373dde7c95SVishal Kulkarni #define S_DSCP    22
4383dde7c95SVishal Kulkarni #define M_DSCP    0x3F
4393dde7c95SVishal Kulkarni #define V_DSCP(x) ((x) << S_DSCP)
4403dde7c95SVishal Kulkarni #define G_DSCP(x) (((x) >> S_DSCP) & M_DSCP)
4413dde7c95SVishal Kulkarni 
4423dde7c95SVishal Kulkarni #define S_SMAC_SEL    28
4433dde7c95SVishal Kulkarni #define M_SMAC_SEL    0xFF
4443dde7c95SVishal Kulkarni #define V_SMAC_SEL(x) ((__u64)(x) << S_SMAC_SEL)
4453dde7c95SVishal Kulkarni #define G_SMAC_SEL(x) (((x) >> S_SMAC_SEL) & M_SMAC_SEL)
4463dde7c95SVishal Kulkarni 
4473dde7c95SVishal Kulkarni #define S_L2T_IDX    36
4483dde7c95SVishal Kulkarni #define M_L2T_IDX    0xFFF
4493dde7c95SVishal Kulkarni #define V_L2T_IDX(x) ((__u64)(x) << S_L2T_IDX)
4503dde7c95SVishal Kulkarni #define G_L2T_IDX(x) (((x) >> S_L2T_IDX) & M_L2T_IDX)
4513dde7c95SVishal Kulkarni 
4523dde7c95SVishal Kulkarni #define S_TCAM_BYPASS    48
4533dde7c95SVishal Kulkarni #define V_TCAM_BYPASS(x) ((__u64)(x) << S_TCAM_BYPASS)
4543dde7c95SVishal Kulkarni #define F_TCAM_BYPASS    V_TCAM_BYPASS(1ULL)
4553dde7c95SVishal Kulkarni 
4563dde7c95SVishal Kulkarni #define S_NAGLE    49
4573dde7c95SVishal Kulkarni #define V_NAGLE(x) ((__u64)(x) << S_NAGLE)
4583dde7c95SVishal Kulkarni #define F_NAGLE    V_NAGLE(1ULL)
4593dde7c95SVishal Kulkarni 
4603dde7c95SVishal Kulkarni #define S_WND_SCALE    50
4613dde7c95SVishal Kulkarni #define M_WND_SCALE    0xF
4623dde7c95SVishal Kulkarni #define V_WND_SCALE(x) ((__u64)(x) << S_WND_SCALE)
4633dde7c95SVishal Kulkarni #define G_WND_SCALE(x) (((x) >> S_WND_SCALE) & M_WND_SCALE)
4643dde7c95SVishal Kulkarni 
4653dde7c95SVishal Kulkarni #define S_KEEP_ALIVE    54
4663dde7c95SVishal Kulkarni #define V_KEEP_ALIVE(x) ((__u64)(x) << S_KEEP_ALIVE)
4673dde7c95SVishal Kulkarni #define F_KEEP_ALIVE    V_KEEP_ALIVE(1ULL)
4683dde7c95SVishal Kulkarni 
4693dde7c95SVishal Kulkarni #define S_MAX_RT    55
4703dde7c95SVishal Kulkarni #define M_MAX_RT    0xF
4713dde7c95SVishal Kulkarni #define V_MAX_RT(x) ((__u64)(x) << S_MAX_RT)
4723dde7c95SVishal Kulkarni #define G_MAX_RT(x) (((x) >> S_MAX_RT) & M_MAX_RT)
4733dde7c95SVishal Kulkarni 
4743dde7c95SVishal Kulkarni #define S_MAX_RT_OVERRIDE    59
4753dde7c95SVishal Kulkarni #define V_MAX_RT_OVERRIDE(x) ((__u64)(x) << S_MAX_RT_OVERRIDE)
4763dde7c95SVishal Kulkarni #define F_MAX_RT_OVERRIDE    V_MAX_RT_OVERRIDE(1ULL)
4773dde7c95SVishal Kulkarni 
4783dde7c95SVishal Kulkarni #define S_MSS_IDX    60
4793dde7c95SVishal Kulkarni #define M_MSS_IDX    0xF
4803dde7c95SVishal Kulkarni #define V_MSS_IDX(x) ((__u64)(x) << S_MSS_IDX)
4813dde7c95SVishal Kulkarni #define G_MSS_IDX(x) (((x) >> S_MSS_IDX) & M_MSS_IDX)
48256b2bdd1SGireesh Nagabhushana 
48356b2bdd1SGireesh Nagabhushana /* option 1 fields */
4843dde7c95SVishal Kulkarni #define S_SYN_RSS_ENABLE    0
4853dde7c95SVishal Kulkarni #define V_SYN_RSS_ENABLE(x) ((x) << S_SYN_RSS_ENABLE)
4863dde7c95SVishal Kulkarni #define F_SYN_RSS_ENABLE    V_SYN_RSS_ENABLE(1U)
4873dde7c95SVishal Kulkarni 
4883dde7c95SVishal Kulkarni #define S_SYN_RSS_USE_HASH    1
4893dde7c95SVishal Kulkarni #define V_SYN_RSS_USE_HASH(x) ((x) << S_SYN_RSS_USE_HASH)
4903dde7c95SVishal Kulkarni #define F_SYN_RSS_USE_HASH    V_SYN_RSS_USE_HASH(1U)
4913dde7c95SVishal Kulkarni 
4923dde7c95SVishal Kulkarni #define S_SYN_RSS_QUEUE    2
4933dde7c95SVishal Kulkarni #define M_SYN_RSS_QUEUE    0x3FF
4943dde7c95SVishal Kulkarni #define V_SYN_RSS_QUEUE(x) ((x) << S_SYN_RSS_QUEUE)
4953dde7c95SVishal Kulkarni #define G_SYN_RSS_QUEUE(x) (((x) >> S_SYN_RSS_QUEUE) & M_SYN_RSS_QUEUE)
4963dde7c95SVishal Kulkarni 
4973dde7c95SVishal Kulkarni #define S_LISTEN_INTF    12
4983dde7c95SVishal Kulkarni #define M_LISTEN_INTF    0xFF
4993dde7c95SVishal Kulkarni #define V_LISTEN_INTF(x) ((x) << S_LISTEN_INTF)
5003dde7c95SVishal Kulkarni #define G_LISTEN_INTF(x) (((x) >> S_LISTEN_INTF) & M_LISTEN_INTF)
5013dde7c95SVishal Kulkarni 
5023dde7c95SVishal Kulkarni #define S_LISTEN_FILTER    20
5033dde7c95SVishal Kulkarni #define V_LISTEN_FILTER(x) ((x) << S_LISTEN_FILTER)
5043dde7c95SVishal Kulkarni #define F_LISTEN_FILTER    V_LISTEN_FILTER(1U)
5053dde7c95SVishal Kulkarni 
5063dde7c95SVishal Kulkarni #define S_SYN_DEFENSE    21
5073dde7c95SVishal Kulkarni #define V_SYN_DEFENSE(x) ((x) << S_SYN_DEFENSE)
5083dde7c95SVishal Kulkarni #define F_SYN_DEFENSE    V_SYN_DEFENSE(1U)
5093dde7c95SVishal Kulkarni 
5103dde7c95SVishal Kulkarni #define S_CONN_POLICY    22
5113dde7c95SVishal Kulkarni #define M_CONN_POLICY    0x3
5123dde7c95SVishal Kulkarni #define V_CONN_POLICY(x) ((x) << S_CONN_POLICY)
5133dde7c95SVishal Kulkarni #define G_CONN_POLICY(x) (((x) >> S_CONN_POLICY) & M_CONN_POLICY)
5143dde7c95SVishal Kulkarni 
5153dde7c95SVishal Kulkarni #define S_T5_FILT_INFO    24
5163dde7c95SVishal Kulkarni #define M_T5_FILT_INFO    0xffffffffffULL
5173dde7c95SVishal Kulkarni #define V_T5_FILT_INFO(x) ((x) << S_T5_FILT_INFO)
5183dde7c95SVishal Kulkarni #define G_T5_FILT_INFO(x) (((x) >> S_T5_FILT_INFO) & M_T5_FILT_INFO)
51956b2bdd1SGireesh Nagabhushana 
520de483253SVishal Kulkarni #define S_FILT_INFO    28
521de483253SVishal Kulkarni #define M_FILT_INFO    0xfffffffffULL
522de483253SVishal Kulkarni #define V_FILT_INFO(x) ((x) << S_FILT_INFO)
523de483253SVishal Kulkarni #define G_FILT_INFO(x) (((x) >> S_FILT_INFO) & M_FILT_INFO)
524de483253SVishal Kulkarni 
52556b2bdd1SGireesh Nagabhushana /* option 2 fields */
5263dde7c95SVishal Kulkarni #define S_RSS_QUEUE    0
5273dde7c95SVishal Kulkarni #define M_RSS_QUEUE    0x3FF
5283dde7c95SVishal Kulkarni #define V_RSS_QUEUE(x) ((x) << S_RSS_QUEUE)
5293dde7c95SVishal Kulkarni #define G_RSS_QUEUE(x) (((x) >> S_RSS_QUEUE) & M_RSS_QUEUE)
5303dde7c95SVishal Kulkarni 
5313dde7c95SVishal Kulkarni #define S_RSS_QUEUE_VALID    10
5323dde7c95SVishal Kulkarni #define V_RSS_QUEUE_VALID(x) ((x) << S_RSS_QUEUE_VALID)
5333dde7c95SVishal Kulkarni #define F_RSS_QUEUE_VALID    V_RSS_QUEUE_VALID(1U)
5343dde7c95SVishal Kulkarni 
5353dde7c95SVishal Kulkarni #define S_RX_COALESCE_VALID    11
5363dde7c95SVishal Kulkarni #define V_RX_COALESCE_VALID(x) ((x) << S_RX_COALESCE_VALID)
5373dde7c95SVishal Kulkarni #define F_RX_COALESCE_VALID    V_RX_COALESCE_VALID(1U)
5383dde7c95SVishal Kulkarni 
5393dde7c95SVishal Kulkarni #define S_RX_COALESCE    12
5403dde7c95SVishal Kulkarni #define M_RX_COALESCE    0x3
5413dde7c95SVishal Kulkarni #define V_RX_COALESCE(x) ((x) << S_RX_COALESCE)
5423dde7c95SVishal Kulkarni #define G_RX_COALESCE(x) (((x) >> S_RX_COALESCE) & M_RX_COALESCE)
5433dde7c95SVishal Kulkarni 
5443dde7c95SVishal Kulkarni #define S_CONG_CNTRL    14
5453dde7c95SVishal Kulkarni #define M_CONG_CNTRL    0x3
5463dde7c95SVishal Kulkarni #define V_CONG_CNTRL(x) ((x) << S_CONG_CNTRL)
5473dde7c95SVishal Kulkarni #define G_CONG_CNTRL(x) (((x) >> S_CONG_CNTRL) & M_CONG_CNTRL)
5483dde7c95SVishal Kulkarni 
5493dde7c95SVishal Kulkarni #define S_PACE    16
5503dde7c95SVishal Kulkarni #define M_PACE    0x3
5513dde7c95SVishal Kulkarni #define V_PACE(x) ((x) << S_PACE)
5523dde7c95SVishal Kulkarni #define G_PACE(x) (((x) >> S_PACE) & M_PACE)
5533dde7c95SVishal Kulkarni 
5543dde7c95SVishal Kulkarni #define S_CONG_CNTRL_VALID    18
5553dde7c95SVishal Kulkarni #define V_CONG_CNTRL_VALID(x) ((x) << S_CONG_CNTRL_VALID)
5563dde7c95SVishal Kulkarni #define F_CONG_CNTRL_VALID    V_CONG_CNTRL_VALID(1U)
5573dde7c95SVishal Kulkarni 
5583dde7c95SVishal Kulkarni #define S_T5_ISS    18
5593dde7c95SVishal Kulkarni #define V_T5_ISS(x) ((x) << S_T5_ISS)
5603dde7c95SVishal Kulkarni #define F_T5_ISS    V_T5_ISS(1U)
5613dde7c95SVishal Kulkarni 
5623dde7c95SVishal Kulkarni #define S_PACE_VALID    19
5633dde7c95SVishal Kulkarni #define V_PACE_VALID(x) ((x) << S_PACE_VALID)
5643dde7c95SVishal Kulkarni #define F_PACE_VALID    V_PACE_VALID(1U)
5653dde7c95SVishal Kulkarni 
5663dde7c95SVishal Kulkarni #define S_RX_FC_DISABLE    20
5673dde7c95SVishal Kulkarni #define V_RX_FC_DISABLE(x) ((x) << S_RX_FC_DISABLE)
5683dde7c95SVishal Kulkarni #define F_RX_FC_DISABLE    V_RX_FC_DISABLE(1U)
5693dde7c95SVishal Kulkarni 
5703dde7c95SVishal Kulkarni #define S_RX_FC_DDP    21
5713dde7c95SVishal Kulkarni #define V_RX_FC_DDP(x) ((x) << S_RX_FC_DDP)
5723dde7c95SVishal Kulkarni #define F_RX_FC_DDP    V_RX_FC_DDP(1U)
5733dde7c95SVishal Kulkarni 
5743dde7c95SVishal Kulkarni #define S_RX_FC_VALID    22
5753dde7c95SVishal Kulkarni #define V_RX_FC_VALID(x) ((x) << S_RX_FC_VALID)
5763dde7c95SVishal Kulkarni #define F_RX_FC_VALID    V_RX_FC_VALID(1U)
5773dde7c95SVishal Kulkarni 
5783dde7c95SVishal Kulkarni #define S_TX_QUEUE    23
5793dde7c95SVishal Kulkarni #define M_TX_QUEUE    0x7
5803dde7c95SVishal Kulkarni #define V_TX_QUEUE(x) ((x) << S_TX_QUEUE)
5813dde7c95SVishal Kulkarni #define G_TX_QUEUE(x) (((x) >> S_TX_QUEUE) & M_TX_QUEUE)
5823dde7c95SVishal Kulkarni 
5833dde7c95SVishal Kulkarni #define S_RX_CHANNEL    26
5843dde7c95SVishal Kulkarni #define V_RX_CHANNEL(x) ((x) << S_RX_CHANNEL)
5853dde7c95SVishal Kulkarni #define F_RX_CHANNEL    V_RX_CHANNEL(1U)
5863dde7c95SVishal Kulkarni 
5873dde7c95SVishal Kulkarni #define S_CCTRL_ECN    27
5883dde7c95SVishal Kulkarni #define V_CCTRL_ECN(x) ((x) << S_CCTRL_ECN)
5893dde7c95SVishal Kulkarni #define F_CCTRL_ECN    V_CCTRL_ECN(1U)
5903dde7c95SVishal Kulkarni 
5913dde7c95SVishal Kulkarni #define S_WND_SCALE_EN    28
5923dde7c95SVishal Kulkarni #define V_WND_SCALE_EN(x) ((x) << S_WND_SCALE_EN)
5933dde7c95SVishal Kulkarni #define F_WND_SCALE_EN    V_WND_SCALE_EN(1U)
5943dde7c95SVishal Kulkarni 
5953dde7c95SVishal Kulkarni #define S_TSTAMPS_EN    29
5963dde7c95SVishal Kulkarni #define V_TSTAMPS_EN(x) ((x) << S_TSTAMPS_EN)
5973dde7c95SVishal Kulkarni #define F_TSTAMPS_EN    V_TSTAMPS_EN(1U)
5983dde7c95SVishal Kulkarni 
5993dde7c95SVishal Kulkarni #define S_SACK_EN    30
6003dde7c95SVishal Kulkarni #define V_SACK_EN(x) ((x) << S_SACK_EN)
6013dde7c95SVishal Kulkarni #define F_SACK_EN    V_SACK_EN(1U)
60256b2bdd1SGireesh Nagabhushana 
603de483253SVishal Kulkarni #define S_T5_OPT_2_VALID    31
604de483253SVishal Kulkarni #define V_T5_OPT_2_VALID(x) ((x) << S_T5_OPT_2_VALID)
605de483253SVishal Kulkarni #define F_T5_OPT_2_VALID    V_T5_OPT_2_VALID(1U)
606de483253SVishal Kulkarni 
60756b2bdd1SGireesh Nagabhushana struct cpl_pass_open_req {
60856b2bdd1SGireesh Nagabhushana 	WR_HDR;
60956b2bdd1SGireesh Nagabhushana 	union opcode_tid ot;
61056b2bdd1SGireesh Nagabhushana 	__be16 local_port;
61156b2bdd1SGireesh Nagabhushana 	__be16 peer_port;
61256b2bdd1SGireesh Nagabhushana 	__be32 local_ip;
61356b2bdd1SGireesh Nagabhushana 	__be32 peer_ip;
61456b2bdd1SGireesh Nagabhushana 	__be64 opt0;
61556b2bdd1SGireesh Nagabhushana 	__be64 opt1;
61656b2bdd1SGireesh Nagabhushana };
61756b2bdd1SGireesh Nagabhushana 
61856b2bdd1SGireesh Nagabhushana struct cpl_pass_open_req6 {
61956b2bdd1SGireesh Nagabhushana 	WR_HDR;
62056b2bdd1SGireesh Nagabhushana 	union opcode_tid ot;
62156b2bdd1SGireesh Nagabhushana 	__be16 local_port;
62256b2bdd1SGireesh Nagabhushana 	__be16 peer_port;
62356b2bdd1SGireesh Nagabhushana 	__be64 local_ip_hi;
62456b2bdd1SGireesh Nagabhushana 	__be64 local_ip_lo;
62556b2bdd1SGireesh Nagabhushana 	__be64 peer_ip_hi;
62656b2bdd1SGireesh Nagabhushana 	__be64 peer_ip_lo;
62756b2bdd1SGireesh Nagabhushana 	__be64 opt0;
62856b2bdd1SGireesh Nagabhushana 	__be64 opt1;
62956b2bdd1SGireesh Nagabhushana };
63056b2bdd1SGireesh Nagabhushana 
63156b2bdd1SGireesh Nagabhushana struct cpl_pass_open_rpl {
63256b2bdd1SGireesh Nagabhushana 	RSS_HDR
63356b2bdd1SGireesh Nagabhushana 	union opcode_tid ot;
63456b2bdd1SGireesh Nagabhushana 	__u8 rsvd[3];
63556b2bdd1SGireesh Nagabhushana 	__u8 status;
63656b2bdd1SGireesh Nagabhushana };
63756b2bdd1SGireesh Nagabhushana 
63856b2bdd1SGireesh Nagabhushana struct cpl_pass_establish {
63956b2bdd1SGireesh Nagabhushana 	RSS_HDR
64056b2bdd1SGireesh Nagabhushana 	union opcode_tid ot;
64156b2bdd1SGireesh Nagabhushana 	__be32 rsvd;
64256b2bdd1SGireesh Nagabhushana 	__be32 tos_stid;
64356b2bdd1SGireesh Nagabhushana 	__be16 mac_idx;
64456b2bdd1SGireesh Nagabhushana 	__be16 tcp_opt;
64556b2bdd1SGireesh Nagabhushana 	__be32 snd_isn;
64656b2bdd1SGireesh Nagabhushana 	__be32 rcv_isn;
64756b2bdd1SGireesh Nagabhushana };
64856b2bdd1SGireesh Nagabhushana 
64956b2bdd1SGireesh Nagabhushana /* cpl_pass_establish.tos_stid fields */
6503dde7c95SVishal Kulkarni #define S_PASS_OPEN_TID    0
6513dde7c95SVishal Kulkarni #define M_PASS_OPEN_TID    0xFFFFFF
6523dde7c95SVishal Kulkarni #define V_PASS_OPEN_TID(x) ((x) << S_PASS_OPEN_TID)
6533dde7c95SVishal Kulkarni #define G_PASS_OPEN_TID(x) (((x) >> S_PASS_OPEN_TID) & M_PASS_OPEN_TID)
65456b2bdd1SGireesh Nagabhushana 
6553dde7c95SVishal Kulkarni #define S_PASS_OPEN_TOS    24
6563dde7c95SVishal Kulkarni #define M_PASS_OPEN_TOS    0xFF
6573dde7c95SVishal Kulkarni #define V_PASS_OPEN_TOS(x) ((x) << S_PASS_OPEN_TOS)
6583dde7c95SVishal Kulkarni #define G_PASS_OPEN_TOS(x) (((x) >> S_PASS_OPEN_TOS) & M_PASS_OPEN_TOS)
65956b2bdd1SGireesh Nagabhushana 
66056b2bdd1SGireesh Nagabhushana /* cpl_pass_establish.tcp_opt fields (also applies to act_open_establish) */
6613dde7c95SVishal Kulkarni #define S_TCPOPT_WSCALE_OK	5
6623dde7c95SVishal Kulkarni #define M_TCPOPT_WSCALE_OK  	0x1
6633dde7c95SVishal Kulkarni #define V_TCPOPT_WSCALE_OK(x)	((x) << S_TCPOPT_WSCALE_OK)
6643dde7c95SVishal Kulkarni #define G_TCPOPT_WSCALE_OK(x)	(((x) >> S_TCPOPT_WSCALE_OK) & M_TCPOPT_WSCALE_OK)
6653dde7c95SVishal Kulkarni 
6663dde7c95SVishal Kulkarni #define S_TCPOPT_SACK		6
6673dde7c95SVishal Kulkarni #define M_TCPOPT_SACK		0x1
6683dde7c95SVishal Kulkarni #define V_TCPOPT_SACK(x)	((x) << S_TCPOPT_SACK)
6693dde7c95SVishal Kulkarni #define G_TCPOPT_SACK(x)	(((x) >> S_TCPOPT_SACK) & M_TCPOPT_SACK)
6703dde7c95SVishal Kulkarni 
6713dde7c95SVishal Kulkarni #define S_TCPOPT_TSTAMP		7
6723dde7c95SVishal Kulkarni #define M_TCPOPT_TSTAMP		0x1
6733dde7c95SVishal Kulkarni #define V_TCPOPT_TSTAMP(x)	((x) << S_TCPOPT_TSTAMP)
6743dde7c95SVishal Kulkarni #define G_TCPOPT_TSTAMP(x)	(((x) >> S_TCPOPT_TSTAMP) & M_TCPOPT_TSTAMP)
6753dde7c95SVishal Kulkarni 
6763dde7c95SVishal Kulkarni #define S_TCPOPT_SND_WSCALE	8
6773dde7c95SVishal Kulkarni #define M_TCPOPT_SND_WSCALE	0xF
6783dde7c95SVishal Kulkarni #define V_TCPOPT_SND_WSCALE(x)	((x) << S_TCPOPT_SND_WSCALE)
6793dde7c95SVishal Kulkarni #define G_TCPOPT_SND_WSCALE(x)	(((x) >> S_TCPOPT_SND_WSCALE) & M_TCPOPT_SND_WSCALE)
6803dde7c95SVishal Kulkarni 
6813dde7c95SVishal Kulkarni #define S_TCPOPT_MSS	12
6823dde7c95SVishal Kulkarni #define M_TCPOPT_MSS	0xF
6833dde7c95SVishal Kulkarni #define V_TCPOPT_MSS(x)	((x) << S_TCPOPT_MSS)
6843dde7c95SVishal Kulkarni #define G_TCPOPT_MSS(x)	(((x) >> S_TCPOPT_MSS) & M_TCPOPT_MSS)
68556b2bdd1SGireesh Nagabhushana 
68656b2bdd1SGireesh Nagabhushana struct cpl_pass_accept_req {
68756b2bdd1SGireesh Nagabhushana 	RSS_HDR
68856b2bdd1SGireesh Nagabhushana 	union opcode_tid ot;
68956b2bdd1SGireesh Nagabhushana 	__be16 rsvd;
69056b2bdd1SGireesh Nagabhushana 	__be16 len;
69156b2bdd1SGireesh Nagabhushana 	__be32 hdr_len;
69256b2bdd1SGireesh Nagabhushana 	__be16 vlan;
69356b2bdd1SGireesh Nagabhushana 	__be16 l2info;
69456b2bdd1SGireesh Nagabhushana 	__be32 tos_stid;
69556b2bdd1SGireesh Nagabhushana 	struct tcp_options tcpopt;
69656b2bdd1SGireesh Nagabhushana };
69756b2bdd1SGireesh Nagabhushana 
69856b2bdd1SGireesh Nagabhushana /* cpl_pass_accept_req.hdr_len fields */
6993dde7c95SVishal Kulkarni #define S_SYN_RX_CHAN    0
7003dde7c95SVishal Kulkarni #define M_SYN_RX_CHAN    0xF
7013dde7c95SVishal Kulkarni #define V_SYN_RX_CHAN(x) ((x) << S_SYN_RX_CHAN)
7023dde7c95SVishal Kulkarni #define G_SYN_RX_CHAN(x) (((x) >> S_SYN_RX_CHAN) & M_SYN_RX_CHAN)
7033dde7c95SVishal Kulkarni 
7043dde7c95SVishal Kulkarni #define S_TCP_HDR_LEN    10
7053dde7c95SVishal Kulkarni #define M_TCP_HDR_LEN    0x3F
7063dde7c95SVishal Kulkarni #define V_TCP_HDR_LEN(x) ((x) << S_TCP_HDR_LEN)
7073dde7c95SVishal Kulkarni #define G_TCP_HDR_LEN(x) (((x) >> S_TCP_HDR_LEN) & M_TCP_HDR_LEN)
7083dde7c95SVishal Kulkarni 
7093dde7c95SVishal Kulkarni #define S_T6_TCP_HDR_LEN   8
7103dde7c95SVishal Kulkarni #define V_T6_TCP_HDR_LEN(x) ((x) << S_T6_TCP_HDR_LEN)
7113dde7c95SVishal Kulkarni #define G_T6_TCP_HDR_LEN(x) (((x) >> S_T6_TCP_HDR_LEN) & M_TCP_HDR_LEN)
7123dde7c95SVishal Kulkarni 
7133dde7c95SVishal Kulkarni #define S_IP_HDR_LEN    16
7143dde7c95SVishal Kulkarni #define M_IP_HDR_LEN    0x3FF
7153dde7c95SVishal Kulkarni #define V_IP_HDR_LEN(x) ((x) << S_IP_HDR_LEN)
7163dde7c95SVishal Kulkarni #define G_IP_HDR_LEN(x) (((x) >> S_IP_HDR_LEN) & M_IP_HDR_LEN)
7173dde7c95SVishal Kulkarni 
7183dde7c95SVishal Kulkarni #define S_T6_IP_HDR_LEN    14
7193dde7c95SVishal Kulkarni #define V_T6_IP_HDR_LEN(x) ((x) << S_T6_IP_HDR_LEN)
7203dde7c95SVishal Kulkarni #define G_T6_IP_HDR_LEN(x) (((x) >> S_T6_IP_HDR_LEN) & M_IP_HDR_LEN)
7213dde7c95SVishal Kulkarni 
7223dde7c95SVishal Kulkarni #define S_ETH_HDR_LEN    26
7233dde7c95SVishal Kulkarni #define M_ETH_HDR_LEN    0x3F
7243dde7c95SVishal Kulkarni #define V_ETH_HDR_LEN(x) ((x) << S_ETH_HDR_LEN)
7253dde7c95SVishal Kulkarni #define G_ETH_HDR_LEN(x) (((x) >> S_ETH_HDR_LEN) & M_ETH_HDR_LEN)
7263dde7c95SVishal Kulkarni 
7273dde7c95SVishal Kulkarni #define S_T6_ETH_HDR_LEN    24
7283dde7c95SVishal Kulkarni #define M_T6_ETH_HDR_LEN    0xFF
7293dde7c95SVishal Kulkarni #define V_T6_ETH_HDR_LEN(x) ((x) << S_T6_ETH_HDR_LEN)
7303dde7c95SVishal Kulkarni #define G_T6_ETH_HDR_LEN(x) (((x) >> S_T6_ETH_HDR_LEN) & M_T6_ETH_HDR_LEN)
73156b2bdd1SGireesh Nagabhushana 
73256b2bdd1SGireesh Nagabhushana /* cpl_pass_accept_req.l2info fields */
7333dde7c95SVishal Kulkarni #define S_SYN_MAC_IDX    0
7343dde7c95SVishal Kulkarni #define M_SYN_MAC_IDX    0x1FF
7353dde7c95SVishal Kulkarni #define V_SYN_MAC_IDX(x) ((x) << S_SYN_MAC_IDX)
7363dde7c95SVishal Kulkarni #define G_SYN_MAC_IDX(x) (((x) >> S_SYN_MAC_IDX) & M_SYN_MAC_IDX)
73756b2bdd1SGireesh Nagabhushana 
7383dde7c95SVishal Kulkarni #define S_SYN_XACT_MATCH    9
7393dde7c95SVishal Kulkarni #define V_SYN_XACT_MATCH(x) ((x) << S_SYN_XACT_MATCH)
7403dde7c95SVishal Kulkarni #define F_SYN_XACT_MATCH    V_SYN_XACT_MATCH(1U)
74156b2bdd1SGireesh Nagabhushana 
7423dde7c95SVishal Kulkarni #define S_SYN_INTF    12
7433dde7c95SVishal Kulkarni #define M_SYN_INTF    0xF
7443dde7c95SVishal Kulkarni #define V_SYN_INTF(x) ((x) << S_SYN_INTF)
7453dde7c95SVishal Kulkarni #define G_SYN_INTF(x) (((x) >> S_SYN_INTF) & M_SYN_INTF)
74656b2bdd1SGireesh Nagabhushana 
74756b2bdd1SGireesh Nagabhushana struct cpl_pass_accept_rpl {
74856b2bdd1SGireesh Nagabhushana 	WR_HDR;
74956b2bdd1SGireesh Nagabhushana 	union opcode_tid ot;
75056b2bdd1SGireesh Nagabhushana 	__be32 opt2;
75156b2bdd1SGireesh Nagabhushana 	__be64 opt0;
75256b2bdd1SGireesh Nagabhushana };
75356b2bdd1SGireesh Nagabhushana 
754de483253SVishal Kulkarni struct cpl_t5_pass_accept_rpl {
755de483253SVishal Kulkarni 	WR_HDR;
756de483253SVishal Kulkarni 	union opcode_tid ot;
757de483253SVishal Kulkarni 	__be32 opt2;
758de483253SVishal Kulkarni 	__be64 opt0;
759de483253SVishal Kulkarni 	__be32 iss;
7603dde7c95SVishal Kulkarni 	union {
7613dde7c95SVishal Kulkarni 		__be32 rsvd; /* T5 */
7623dde7c95SVishal Kulkarni 		__be32 opt3; /* T6 */
7633dde7c95SVishal Kulkarni 	};
764de483253SVishal Kulkarni };
765de483253SVishal Kulkarni 
76656b2bdd1SGireesh Nagabhushana struct cpl_act_open_req {
76756b2bdd1SGireesh Nagabhushana 	WR_HDR;
76856b2bdd1SGireesh Nagabhushana 	union opcode_tid ot;
76956b2bdd1SGireesh Nagabhushana 	__be16 local_port;
77056b2bdd1SGireesh Nagabhushana 	__be16 peer_port;
77156b2bdd1SGireesh Nagabhushana 	__be32 local_ip;
77256b2bdd1SGireesh Nagabhushana 	__be32 peer_ip;
77356b2bdd1SGireesh Nagabhushana 	__be64 opt0;
77456b2bdd1SGireesh Nagabhushana 	__be32 params;
77556b2bdd1SGireesh Nagabhushana 	__be32 opt2;
77656b2bdd1SGireesh Nagabhushana };
77756b2bdd1SGireesh Nagabhushana 
778de483253SVishal Kulkarni #define S_FILTER_TUPLE	24
779de483253SVishal Kulkarni #define M_FILTER_TUPLE	0xFFFFFFFFFF
780de483253SVishal Kulkarni #define V_FILTER_TUPLE(x) ((x) << S_FILTER_TUPLE)
781de483253SVishal Kulkarni #define G_FILTER_TUPLE(x) (((x) >> S_FILTER_TUPLE) & M_FILTER_TUPLE)
7823dde7c95SVishal Kulkarni 
783de483253SVishal Kulkarni struct cpl_t5_act_open_req {
784de483253SVishal Kulkarni 	WR_HDR;
785de483253SVishal Kulkarni 	union opcode_tid ot;
786de483253SVishal Kulkarni 	__be16 local_port;
787de483253SVishal Kulkarni 	__be16 peer_port;
788de483253SVishal Kulkarni 	__be32 local_ip;
789de483253SVishal Kulkarni 	__be32 peer_ip;
790de483253SVishal Kulkarni 	__be64 opt0;
7913dde7c95SVishal Kulkarni 	__be32 rsvd;
792de483253SVishal Kulkarni 	__be32 opt2;
793de483253SVishal Kulkarni 	__be64 params;
794de483253SVishal Kulkarni };
795de483253SVishal Kulkarni 
7963dde7c95SVishal Kulkarni struct cpl_t6_act_open_req {
7973dde7c95SVishal Kulkarni 	WR_HDR;
7983dde7c95SVishal Kulkarni 	union opcode_tid ot;
7993dde7c95SVishal Kulkarni 	__be16 local_port;
8003dde7c95SVishal Kulkarni 	__be16 peer_port;
8013dde7c95SVishal Kulkarni 	__be32 local_ip;
8023dde7c95SVishal Kulkarni 	__be32 peer_ip;
8033dde7c95SVishal Kulkarni 	__be64 opt0;
8043dde7c95SVishal Kulkarni 	__be32 rsvd;
8053dde7c95SVishal Kulkarni 	__be32 opt2;
8063dde7c95SVishal Kulkarni 	__be64 params;
8073dde7c95SVishal Kulkarni 	__be32 rsvd2;
8083dde7c95SVishal Kulkarni 	__be32 opt3;
8093dde7c95SVishal Kulkarni };
8103dde7c95SVishal Kulkarni 
8113dde7c95SVishal Kulkarni /* cpl_{t5,t6}_act_open_req.params field */
8123dde7c95SVishal Kulkarni #define S_AOPEN_FCOEMASK	0
8133dde7c95SVishal Kulkarni #define V_AOPEN_FCOEMASK(x)	((x) << S_AOPEN_FCOEMASK)
8143dde7c95SVishal Kulkarni #define F_AOPEN_FCOEMASK	V_AOPEN_FCOEMASK(1U)
8153dde7c95SVishal Kulkarni 
81656b2bdd1SGireesh Nagabhushana struct cpl_act_open_req6 {
81756b2bdd1SGireesh Nagabhushana 	WR_HDR;
81856b2bdd1SGireesh Nagabhushana 	union opcode_tid ot;
81956b2bdd1SGireesh Nagabhushana 	__be16 local_port;
82056b2bdd1SGireesh Nagabhushana 	__be16 peer_port;
82156b2bdd1SGireesh Nagabhushana 	__be64 local_ip_hi;
82256b2bdd1SGireesh Nagabhushana 	__be64 local_ip_lo;
82356b2bdd1SGireesh Nagabhushana 	__be64 peer_ip_hi;
82456b2bdd1SGireesh Nagabhushana 	__be64 peer_ip_lo;
82556b2bdd1SGireesh Nagabhushana 	__be64 opt0;
82656b2bdd1SGireesh Nagabhushana 	__be32 params;
82756b2bdd1SGireesh Nagabhushana 	__be32 opt2;
82856b2bdd1SGireesh Nagabhushana };
82956b2bdd1SGireesh Nagabhushana 
830de483253SVishal Kulkarni struct cpl_t5_act_open_req6 {
831de483253SVishal Kulkarni 	WR_HDR;
832de483253SVishal Kulkarni 	union opcode_tid ot;
833de483253SVishal Kulkarni 	__be16 local_port;
834de483253SVishal Kulkarni 	__be16 peer_port;
835de483253SVishal Kulkarni 	__be64 local_ip_hi;
836de483253SVishal Kulkarni 	__be64 local_ip_lo;
837de483253SVishal Kulkarni 	__be64 peer_ip_hi;
838de483253SVishal Kulkarni 	__be64 peer_ip_lo;
839de483253SVishal Kulkarni 	__be64 opt0;
8403dde7c95SVishal Kulkarni 	__be32 rsvd;
8413dde7c95SVishal Kulkarni 	__be32 opt2;
8423dde7c95SVishal Kulkarni 	__be64 params;
8433dde7c95SVishal Kulkarni };
844