xref: /openbmc/linux/drivers/scsi/bnx2i/57xx_iscsi_constants.h (revision e5451c8f8330e03ad3cfa16048b4daf961af434f)
1*f39a7757SVikas Chaudhary /* 57xx_iscsi_constants.h: QLogic NetXtreme II iSCSI HSI
2cf4e6363SMichael Chan  *
30b3bf387SEddie Wai  * Copyright (c) 2006 - 2013 Broadcom Corporation
4*f39a7757SVikas Chaudhary  * Copyright (c) 2014, QLogic Corporation
5cf4e6363SMichael Chan  *
6cf4e6363SMichael Chan  * This program is free software; you can redistribute it and/or modify
7cf4e6363SMichael Chan  * it under the terms of the GNU General Public License as published by
8cf4e6363SMichael Chan  * the Free Software Foundation.
9cf4e6363SMichael Chan  *
10cf4e6363SMichael Chan  * Written by: Anil Veerabhadrappa (anilgv@broadcom.com)
11*f39a7757SVikas Chaudhary  * Previously Maintained by: Eddie Wai (eddie.wai@broadcom.com)
12*f39a7757SVikas Chaudhary  * Maintained by: QLogic-Storage-Upstream@qlogic.com
13cf4e6363SMichael Chan  */
14cf4e6363SMichael Chan #ifndef __57XX_ISCSI_CONSTANTS_H_
15cf4e6363SMichael Chan #define __57XX_ISCSI_CONSTANTS_H_
16cf4e6363SMichael Chan 
17cf4e6363SMichael Chan /**
18cf4e6363SMichael Chan * This file defines HSI constants for the iSCSI flows
19cf4e6363SMichael Chan */
20cf4e6363SMichael Chan 
21cf4e6363SMichael Chan /* iSCSI request op codes */
22cf4e6363SMichael Chan #define ISCSI_OPCODE_CLEANUP_REQUEST    (7)
23cf4e6363SMichael Chan 
24cf4e6363SMichael Chan /* iSCSI response/messages op codes */
25cf4e6363SMichael Chan #define ISCSI_OPCODE_CLEANUP_RESPONSE 		(0x27)
26cf4e6363SMichael Chan #define ISCSI_OPCODE_NOPOUT_LOCAL_COMPLETION    (0)
27cf4e6363SMichael Chan 
28cf4e6363SMichael Chan /* iSCSI task types */
29cf4e6363SMichael Chan #define ISCSI_TASK_TYPE_READ    (0)
30cf4e6363SMichael Chan #define ISCSI_TASK_TYPE_WRITE   (1)
31cf4e6363SMichael Chan #define ISCSI_TASK_TYPE_MPATH   (2)
32cf4e6363SMichael Chan 
33cf4e6363SMichael Chan /* initial CQ sequence numbers */
34cf4e6363SMichael Chan #define ISCSI_INITIAL_SN    (1)
35cf4e6363SMichael Chan 
36cf4e6363SMichael Chan /* KWQ (kernel work queue) layer codes */
37cf4e6363SMichael Chan #define ISCSI_KWQE_LAYER_CODE   (6)
38cf4e6363SMichael Chan 
39cf4e6363SMichael Chan /* KWQ (kernel work queue) request op codes */
40cf4e6363SMichael Chan #define ISCSI_KWQE_OPCODE_OFFLOAD_CONN1 (0)
41cf4e6363SMichael Chan #define ISCSI_KWQE_OPCODE_OFFLOAD_CONN2 (1)
42cf4e6363SMichael Chan #define ISCSI_KWQE_OPCODE_UPDATE_CONN   (2)
43cf4e6363SMichael Chan #define ISCSI_KWQE_OPCODE_DESTROY_CONN  (3)
44cf4e6363SMichael Chan #define ISCSI_KWQE_OPCODE_INIT1         (4)
45cf4e6363SMichael Chan #define ISCSI_KWQE_OPCODE_INIT2         (5)
46cf4e6363SMichael Chan 
47cf4e6363SMichael Chan /* KCQ (kernel completion queue) response op codes */
48cf4e6363SMichael Chan #define ISCSI_KCQE_OPCODE_OFFLOAD_CONN  (0x10)
49cf4e6363SMichael Chan #define ISCSI_KCQE_OPCODE_UPDATE_CONN   (0x12)
50cf4e6363SMichael Chan #define ISCSI_KCQE_OPCODE_DESTROY_CONN  (0x13)
51cf4e6363SMichael Chan #define ISCSI_KCQE_OPCODE_INIT          (0x14)
52cf4e6363SMichael Chan #define ISCSI_KCQE_OPCODE_FW_CLEAN_TASK	(0x15)
53cf4e6363SMichael Chan #define ISCSI_KCQE_OPCODE_TCP_RESET     (0x16)
54cf4e6363SMichael Chan #define ISCSI_KCQE_OPCODE_TCP_SYN       (0x17)
55cf4e6363SMichael Chan #define ISCSI_KCQE_OPCODE_TCP_FIN       (0X18)
56cf4e6363SMichael Chan #define ISCSI_KCQE_OPCODE_TCP_ERROR     (0x19)
57cf4e6363SMichael Chan #define ISCSI_KCQE_OPCODE_CQ_EVENT_NOTIFICATION (0x20)
58cf4e6363SMichael Chan #define ISCSI_KCQE_OPCODE_ISCSI_ERROR   (0x21)
59cf4e6363SMichael Chan 
60cf4e6363SMichael Chan /* KCQ (kernel completion queue) completion status */
61cf4e6363SMichael Chan #define ISCSI_KCQE_COMPLETION_STATUS_SUCCESS                            (0x0)
62cf4e6363SMichael Chan #define ISCSI_KCQE_COMPLETION_STATUS_INVALID_OPCODE                     (0x1)
63cf4e6363SMichael Chan #define ISCSI_KCQE_COMPLETION_STATUS_CTX_ALLOC_FAILURE                  (0x2)
64cf4e6363SMichael Chan #define ISCSI_KCQE_COMPLETION_STATUS_CTX_FREE_FAILURE                   (0x3)
65cf4e6363SMichael Chan #define ISCSI_KCQE_COMPLETION_STATUS_NIC_ERROR                          (0x4)
66cf4e6363SMichael Chan 
67cf4e6363SMichael Chan #define ISCSI_KCQE_COMPLETION_STATUS_HDR_DIG_ERR                        (0x5)
68cf4e6363SMichael Chan #define ISCSI_KCQE_COMPLETION_STATUS_DATA_DIG_ERR                       (0x6)
69cf4e6363SMichael Chan 
70cf4e6363SMichael Chan #define ISCSI_KCQE_COMPLETION_STATUS_PROTOCOL_ERR_UNEXPECTED_OPCODE     (0xa)
71cf4e6363SMichael Chan #define ISCSI_KCQE_COMPLETION_STATUS_PROTOCOL_ERR_OPCODE                (0xb)
72cf4e6363SMichael Chan #define ISCSI_KCQE_COMPLETION_STATUS_PROTOCOL_ERR_AHS_LEN               (0xc)
73cf4e6363SMichael Chan #define ISCSI_KCQE_COMPLETION_STATUS_PROTOCOL_ERR_ITT                   (0xd)
74cf4e6363SMichael Chan #define ISCSI_KCQE_COMPLETION_STATUS_PROTOCOL_ERR_STATSN                (0xe)
75cf4e6363SMichael Chan 
76cf4e6363SMichael Chan /* Response */
77cf4e6363SMichael Chan #define ISCSI_KCQE_COMPLETION_STATUS_PROTOCOL_ERR_EXP_DATASN            (0xf)
78cf4e6363SMichael Chan #define ISCSI_KCQE_COMPLETION_STATUS_PROTOCOL_ERR_PEND_R2T              (0x10)
79cf4e6363SMichael Chan #define ISCSI_KCQE_COMPLETION_STATUS_PROTOCOL_ERR_DATA_SEG_LEN_IS_ZERO  (0x2c)
80cf4e6363SMichael Chan #define ISCSI_KCQE_COMPLETION_STATUS_PROTOCOL_ERR_DATA_SEG_LEN_TOO_BIG  (0x2d)
81cf4e6363SMichael Chan #define ISCSI_KCQE_COMPLETION_STATUS_PROTOCOL_ERR_O_U_0                 (0x11)
82cf4e6363SMichael Chan #define ISCSI_KCQE_COMPLETION_STATUS_PROTOCOL_ERR_O_U_1                 (0x12)
83cf4e6363SMichael Chan #define ISCSI_KCQE_COMPLETION_STATUS_PROTOCOL_ERR_O_U_2                 (0x13)
84cf4e6363SMichael Chan #define ISCSI_KCQE_COMPLETION_STATUS_PROTOCOL_ERR_O_U_3                 (0x14)
85cf4e6363SMichael Chan #define ISCSI_KCQE_COMPLETION_STATUS_PROTOCOL_ERR_O_U_4                 (0x15)
86cf4e6363SMichael Chan #define ISCSI_KCQE_COMPLETION_STATUS_PROTOCOL_ERR_O_U_5                 (0x16)
87cf4e6363SMichael Chan #define ISCSI_KCQE_COMPLETION_STATUS_PROTOCOL_ERR_O_U_6                 (0x17)
88cf4e6363SMichael Chan 
89cf4e6363SMichael Chan /* Data-In */
90cf4e6363SMichael Chan #define ISCSI_KCQE_COMPLETION_STATUS_PROTOCOL_ERR_REMAIN_RCV_LEN        (0x18)
91cf4e6363SMichael Chan #define ISCSI_KCQE_COMPLETION_STATUS_PROTOCOL_ERR_MAX_RCV_PDU_LEN       (0x19)
92cf4e6363SMichael Chan #define ISCSI_KCQE_COMPLETION_STATUS_PROTOCOL_ERR_F_BIT_ZERO            (0x1a)
93cf4e6363SMichael Chan #define ISCSI_KCQE_COMPLETION_STATUS_PROTOCOL_ERR_TTT_NOT_RSRV          (0x1b)
94cf4e6363SMichael Chan #define ISCSI_KCQE_COMPLETION_STATUS_PROTOCOL_ERR_DATASN                (0x1c)
95cf4e6363SMichael Chan #define ISCSI_KCQE_COMPLETION_STATUS_PROTOCOL_ERR_REMAIN_BURST_LEN      (0x1d)
96cf4e6363SMichael Chan 
97cf4e6363SMichael Chan /* R2T */
98cf4e6363SMichael Chan #define ISCSI_KCQE_COMPLETION_STATUS_PROTOCOL_ERR_BUFFER_OFF            (0x1f)
99cf4e6363SMichael Chan #define ISCSI_KCQE_COMPLETION_STATUS_PROTOCOL_ERR_LUN                   (0x20)
100cf4e6363SMichael Chan #define ISCSI_KCQE_COMPLETION_STATUS_PROTOCOL_ERR_R2TSN                 (0x21)
101cf4e6363SMichael Chan #define ISCSI_KCQE_COMPLETION_STATUS_PROTOCOL_ERR_DESIRED_DATA_TRNS_LEN_0 (0x22)
102cf4e6363SMichael Chan #define ISCSI_KCQE_COMPLETION_STATUS_PROTOCOL_ERR_DESIRED_DATA_TRNS_LEN_1 (0x23)
103cf4e6363SMichael Chan #define ISCSI_KCQE_COMPLETION_STATUS_PROTOCOL_ERR_PEND_R2T_EXCEED       (0x24)
104cf4e6363SMichael Chan #define ISCSI_KCQE_COMPLETION_STATUS_PROTOCOL_ERR_TTT_IS_RSRV           (0x25)
105cf4e6363SMichael Chan #define ISCSI_KCQE_COMPLETION_STATUS_PROTOCOL_ERR_MAX_BURST_LEN         (0x26)
106cf4e6363SMichael Chan #define ISCSI_KCQE_COMPLETION_STATUS_PROTOCOL_ERR_DATA_SEG_LEN_NOT_ZERO (0x27)
107cf4e6363SMichael Chan 
108cf4e6363SMichael Chan /* TMF */
109cf4e6363SMichael Chan #define ISCSI_KCQE_COMPLETION_STATUS_PROTOCOL_ERR_REJECT_PDU_LEN        (0x28)
110cf4e6363SMichael Chan #define ISCSI_KCQE_COMPLETION_STATUS_PROTOCOL_ERR_ASYNC_PDU_LEN         (0x29)
111cf4e6363SMichael Chan #define ISCSI_KCQE_COMPLETION_STATUS_PROTOCOL_ERR_NOPIN_PDU_LEN         (0x2a)
112cf4e6363SMichael Chan #define ISCSI_KCQE_COMPLETION_STATUS_PROTOCOL_ERR_PEND_R2T_IN_CLEANUP   (0x2b)
113cf4e6363SMichael Chan 
114cf4e6363SMichael Chan /* IP/TCP processing errors: */
115cf4e6363SMichael Chan #define ISCI_KCQE_COMPLETION_STATUS_TCP_ERROR_IP_FRAGMENT               (0x40)
116cf4e6363SMichael Chan #define ISCI_KCQE_COMPLETION_STATUS_TCP_ERROR_IP_OPTIONS                (0x41)
117cf4e6363SMichael Chan #define ISCI_KCQE_COMPLETION_STATUS_TCP_ERROR_URGENT_FLAG               (0x42)
118cf4e6363SMichael Chan #define ISCI_KCQE_COMPLETION_STATUS_TCP_ERROR_MAX_RTRANS                (0x43)
119cf4e6363SMichael Chan 
120cf4e6363SMichael Chan /* iSCSI licensing errors */
121cf4e6363SMichael Chan /* general iSCSI license not installed */
122cf4e6363SMichael Chan #define ISCSI_KCQE_COMPLETION_STATUS_ISCSI_NOT_SUPPORTED                (0x50)
123cf4e6363SMichael Chan /* additional LOM specific iSCSI license not installed */
124cf4e6363SMichael Chan #define ISCSI_KCQE_COMPLETION_STATUS_LOM_ISCSI_NOT_ENABLED              (0x51)
125cf4e6363SMichael Chan 
126fdf24086SMichael Chan #define ISCSI_KCQE_COMPLETION_STATUS_CID_BUSY				(0x80)
1278ec3e702SMichael Chan #define ISCSI_KCQE_COMPLETION_STATUS_PARITY_ERR                         (0x81)
128fdf24086SMichael Chan 
129cf4e6363SMichael Chan /* SQ/RQ/CQ DB structure sizes */
130cf4e6363SMichael Chan #define ISCSI_SQ_DB_SIZE    (16)
131f4b5ad26SMichael Chan #define ISCSI_RQ_DB_SIZE    (64)
132cf4e6363SMichael Chan #define ISCSI_CQ_DB_SIZE    (80)
133cf4e6363SMichael Chan 
134cf4e6363SMichael Chan #define ISCSI_SQN_TO_NOTIFY_NOT_VALID                                   0xFFFF
135cf4e6363SMichael Chan 
136cf4e6363SMichael Chan /* Page size codes (for flags field in connection offload request) */
137cf4e6363SMichael Chan #define ISCSI_PAGE_SIZE_256     (0)
138cf4e6363SMichael Chan #define ISCSI_PAGE_SIZE_512     (1)
139cf4e6363SMichael Chan #define ISCSI_PAGE_SIZE_1K      (2)
140cf4e6363SMichael Chan #define ISCSI_PAGE_SIZE_2K      (3)
141cf4e6363SMichael Chan #define ISCSI_PAGE_SIZE_4K      (4)
142cf4e6363SMichael Chan #define ISCSI_PAGE_SIZE_8K      (5)
143cf4e6363SMichael Chan #define ISCSI_PAGE_SIZE_16K     (6)
144cf4e6363SMichael Chan #define ISCSI_PAGE_SIZE_32K     (7)
145cf4e6363SMichael Chan #define ISCSI_PAGE_SIZE_64K     (8)
146cf4e6363SMichael Chan #define ISCSI_PAGE_SIZE_128K    (9)
147cf4e6363SMichael Chan #define ISCSI_PAGE_SIZE_256K    (10)
148cf4e6363SMichael Chan #define ISCSI_PAGE_SIZE_512K    (11)
149cf4e6363SMichael Chan #define ISCSI_PAGE_SIZE_1M      (12)
150cf4e6363SMichael Chan #define ISCSI_PAGE_SIZE_2M      (13)
151cf4e6363SMichael Chan #define ISCSI_PAGE_SIZE_4M      (14)
152cf4e6363SMichael Chan #define ISCSI_PAGE_SIZE_8M      (15)
153cf4e6363SMichael Chan 
154cf4e6363SMichael Chan /* Iscsi PDU related defines */
155cf4e6363SMichael Chan #define ISCSI_HEADER_SIZE   (48)
156cf4e6363SMichael Chan #define ISCSI_DIGEST_SHIFT  (2)
157cf4e6363SMichael Chan #define ISCSI_DIGEST_SIZE   (4)
158cf4e6363SMichael Chan 
159cf4e6363SMichael Chan #define B577XX_ISCSI_CONNECTION_TYPE    3
160cf4e6363SMichael Chan 
161cf4e6363SMichael Chan #endif /*__57XX_ISCSI_CONSTANTS_H_ */
162