18c2ecf20Sopenharmony_ci/* 57xx_iscsi_constants.h: QLogic NetXtreme II iSCSI HSI
28c2ecf20Sopenharmony_ci *
38c2ecf20Sopenharmony_ci * Copyright (c) 2006 - 2013 Broadcom Corporation
48c2ecf20Sopenharmony_ci * Copyright (c) 2014, QLogic Corporation
58c2ecf20Sopenharmony_ci *
68c2ecf20Sopenharmony_ci * This program is free software; you can redistribute it and/or modify
78c2ecf20Sopenharmony_ci * it under the terms of the GNU General Public License as published by
88c2ecf20Sopenharmony_ci * the Free Software Foundation.
98c2ecf20Sopenharmony_ci *
108c2ecf20Sopenharmony_ci * Written by: Anil Veerabhadrappa (anilgv@broadcom.com)
118c2ecf20Sopenharmony_ci * Previously Maintained by: Eddie Wai (eddie.wai@broadcom.com)
128c2ecf20Sopenharmony_ci * Maintained by: QLogic-Storage-Upstream@qlogic.com
138c2ecf20Sopenharmony_ci */
148c2ecf20Sopenharmony_ci#ifndef __57XX_ISCSI_CONSTANTS_H_
158c2ecf20Sopenharmony_ci#define __57XX_ISCSI_CONSTANTS_H_
168c2ecf20Sopenharmony_ci
178c2ecf20Sopenharmony_ci/**
188c2ecf20Sopenharmony_ci* This file defines HSI constants for the iSCSI flows
198c2ecf20Sopenharmony_ci*/
208c2ecf20Sopenharmony_ci
218c2ecf20Sopenharmony_ci/* iSCSI request op codes */
228c2ecf20Sopenharmony_ci#define ISCSI_OPCODE_CLEANUP_REQUEST    (7)
238c2ecf20Sopenharmony_ci
248c2ecf20Sopenharmony_ci/* iSCSI response/messages op codes */
258c2ecf20Sopenharmony_ci#define ISCSI_OPCODE_CLEANUP_RESPONSE 		(0x27)
268c2ecf20Sopenharmony_ci#define ISCSI_OPCODE_NOPOUT_LOCAL_COMPLETION    (0)
278c2ecf20Sopenharmony_ci
288c2ecf20Sopenharmony_ci/* iSCSI task types */
298c2ecf20Sopenharmony_ci#define ISCSI_TASK_TYPE_READ    (0)
308c2ecf20Sopenharmony_ci#define ISCSI_TASK_TYPE_WRITE   (1)
318c2ecf20Sopenharmony_ci#define ISCSI_TASK_TYPE_MPATH   (2)
328c2ecf20Sopenharmony_ci
338c2ecf20Sopenharmony_ci/* initial CQ sequence numbers */
348c2ecf20Sopenharmony_ci#define ISCSI_INITIAL_SN    (1)
358c2ecf20Sopenharmony_ci
368c2ecf20Sopenharmony_ci/* KWQ (kernel work queue) layer codes */
378c2ecf20Sopenharmony_ci#define ISCSI_KWQE_LAYER_CODE   (6)
388c2ecf20Sopenharmony_ci
398c2ecf20Sopenharmony_ci/* KWQ (kernel work queue) request op codes */
408c2ecf20Sopenharmony_ci#define ISCSI_KWQE_OPCODE_OFFLOAD_CONN1 (0)
418c2ecf20Sopenharmony_ci#define ISCSI_KWQE_OPCODE_OFFLOAD_CONN2 (1)
428c2ecf20Sopenharmony_ci#define ISCSI_KWQE_OPCODE_UPDATE_CONN   (2)
438c2ecf20Sopenharmony_ci#define ISCSI_KWQE_OPCODE_DESTROY_CONN  (3)
448c2ecf20Sopenharmony_ci#define ISCSI_KWQE_OPCODE_INIT1         (4)
458c2ecf20Sopenharmony_ci#define ISCSI_KWQE_OPCODE_INIT2         (5)
468c2ecf20Sopenharmony_ci
478c2ecf20Sopenharmony_ci/* KCQ (kernel completion queue) response op codes */
488c2ecf20Sopenharmony_ci#define ISCSI_KCQE_OPCODE_OFFLOAD_CONN  (0x10)
498c2ecf20Sopenharmony_ci#define ISCSI_KCQE_OPCODE_UPDATE_CONN   (0x12)
508c2ecf20Sopenharmony_ci#define ISCSI_KCQE_OPCODE_DESTROY_CONN  (0x13)
518c2ecf20Sopenharmony_ci#define ISCSI_KCQE_OPCODE_INIT          (0x14)
528c2ecf20Sopenharmony_ci#define ISCSI_KCQE_OPCODE_FW_CLEAN_TASK	(0x15)
538c2ecf20Sopenharmony_ci#define ISCSI_KCQE_OPCODE_TCP_RESET     (0x16)
548c2ecf20Sopenharmony_ci#define ISCSI_KCQE_OPCODE_TCP_SYN       (0x17)
558c2ecf20Sopenharmony_ci#define ISCSI_KCQE_OPCODE_TCP_FIN       (0X18)
568c2ecf20Sopenharmony_ci#define ISCSI_KCQE_OPCODE_TCP_ERROR     (0x19)
578c2ecf20Sopenharmony_ci#define ISCSI_KCQE_OPCODE_CQ_EVENT_NOTIFICATION (0x20)
588c2ecf20Sopenharmony_ci#define ISCSI_KCQE_OPCODE_ISCSI_ERROR   (0x21)
598c2ecf20Sopenharmony_ci
608c2ecf20Sopenharmony_ci/* KCQ (kernel completion queue) completion status */
618c2ecf20Sopenharmony_ci#define ISCSI_KCQE_COMPLETION_STATUS_SUCCESS                            (0x0)
628c2ecf20Sopenharmony_ci#define ISCSI_KCQE_COMPLETION_STATUS_INVALID_OPCODE                     (0x1)
638c2ecf20Sopenharmony_ci#define ISCSI_KCQE_COMPLETION_STATUS_CTX_ALLOC_FAILURE                  (0x2)
648c2ecf20Sopenharmony_ci#define ISCSI_KCQE_COMPLETION_STATUS_CTX_FREE_FAILURE                   (0x3)
658c2ecf20Sopenharmony_ci#define ISCSI_KCQE_COMPLETION_STATUS_NIC_ERROR                          (0x4)
668c2ecf20Sopenharmony_ci
678c2ecf20Sopenharmony_ci#define ISCSI_KCQE_COMPLETION_STATUS_HDR_DIG_ERR                        (0x5)
688c2ecf20Sopenharmony_ci#define ISCSI_KCQE_COMPLETION_STATUS_DATA_DIG_ERR                       (0x6)
698c2ecf20Sopenharmony_ci
708c2ecf20Sopenharmony_ci#define ISCSI_KCQE_COMPLETION_STATUS_PROTOCOL_ERR_UNEXPECTED_OPCODE     (0xa)
718c2ecf20Sopenharmony_ci#define ISCSI_KCQE_COMPLETION_STATUS_PROTOCOL_ERR_OPCODE                (0xb)
728c2ecf20Sopenharmony_ci#define ISCSI_KCQE_COMPLETION_STATUS_PROTOCOL_ERR_AHS_LEN               (0xc)
738c2ecf20Sopenharmony_ci#define ISCSI_KCQE_COMPLETION_STATUS_PROTOCOL_ERR_ITT                   (0xd)
748c2ecf20Sopenharmony_ci#define ISCSI_KCQE_COMPLETION_STATUS_PROTOCOL_ERR_STATSN                (0xe)
758c2ecf20Sopenharmony_ci
768c2ecf20Sopenharmony_ci/* Response */
778c2ecf20Sopenharmony_ci#define ISCSI_KCQE_COMPLETION_STATUS_PROTOCOL_ERR_EXP_DATASN            (0xf)
788c2ecf20Sopenharmony_ci#define ISCSI_KCQE_COMPLETION_STATUS_PROTOCOL_ERR_PEND_R2T              (0x10)
798c2ecf20Sopenharmony_ci#define ISCSI_KCQE_COMPLETION_STATUS_PROTOCOL_ERR_DATA_SEG_LEN_IS_ZERO  (0x2c)
808c2ecf20Sopenharmony_ci#define ISCSI_KCQE_COMPLETION_STATUS_PROTOCOL_ERR_DATA_SEG_LEN_TOO_BIG  (0x2d)
818c2ecf20Sopenharmony_ci#define ISCSI_KCQE_COMPLETION_STATUS_PROTOCOL_ERR_O_U_0                 (0x11)
828c2ecf20Sopenharmony_ci#define ISCSI_KCQE_COMPLETION_STATUS_PROTOCOL_ERR_O_U_1                 (0x12)
838c2ecf20Sopenharmony_ci#define ISCSI_KCQE_COMPLETION_STATUS_PROTOCOL_ERR_O_U_2                 (0x13)
848c2ecf20Sopenharmony_ci#define ISCSI_KCQE_COMPLETION_STATUS_PROTOCOL_ERR_O_U_3                 (0x14)
858c2ecf20Sopenharmony_ci#define ISCSI_KCQE_COMPLETION_STATUS_PROTOCOL_ERR_O_U_4                 (0x15)
868c2ecf20Sopenharmony_ci#define ISCSI_KCQE_COMPLETION_STATUS_PROTOCOL_ERR_O_U_5                 (0x16)
878c2ecf20Sopenharmony_ci#define ISCSI_KCQE_COMPLETION_STATUS_PROTOCOL_ERR_O_U_6                 (0x17)
888c2ecf20Sopenharmony_ci
898c2ecf20Sopenharmony_ci/* Data-In */
908c2ecf20Sopenharmony_ci#define ISCSI_KCQE_COMPLETION_STATUS_PROTOCOL_ERR_REMAIN_RCV_LEN        (0x18)
918c2ecf20Sopenharmony_ci#define ISCSI_KCQE_COMPLETION_STATUS_PROTOCOL_ERR_MAX_RCV_PDU_LEN       (0x19)
928c2ecf20Sopenharmony_ci#define ISCSI_KCQE_COMPLETION_STATUS_PROTOCOL_ERR_F_BIT_ZERO            (0x1a)
938c2ecf20Sopenharmony_ci#define ISCSI_KCQE_COMPLETION_STATUS_PROTOCOL_ERR_TTT_NOT_RSRV          (0x1b)
948c2ecf20Sopenharmony_ci#define ISCSI_KCQE_COMPLETION_STATUS_PROTOCOL_ERR_DATASN                (0x1c)
958c2ecf20Sopenharmony_ci#define ISCSI_KCQE_COMPLETION_STATUS_PROTOCOL_ERR_REMAIN_BURST_LEN      (0x1d)
968c2ecf20Sopenharmony_ci
978c2ecf20Sopenharmony_ci/* R2T */
988c2ecf20Sopenharmony_ci#define ISCSI_KCQE_COMPLETION_STATUS_PROTOCOL_ERR_BUFFER_OFF            (0x1f)
998c2ecf20Sopenharmony_ci#define ISCSI_KCQE_COMPLETION_STATUS_PROTOCOL_ERR_LUN                   (0x20)
1008c2ecf20Sopenharmony_ci#define ISCSI_KCQE_COMPLETION_STATUS_PROTOCOL_ERR_R2TSN                 (0x21)
1018c2ecf20Sopenharmony_ci#define ISCSI_KCQE_COMPLETION_STATUS_PROTOCOL_ERR_DESIRED_DATA_TRNS_LEN_0 (0x22)
1028c2ecf20Sopenharmony_ci#define ISCSI_KCQE_COMPLETION_STATUS_PROTOCOL_ERR_DESIRED_DATA_TRNS_LEN_1 (0x23)
1038c2ecf20Sopenharmony_ci#define ISCSI_KCQE_COMPLETION_STATUS_PROTOCOL_ERR_PEND_R2T_EXCEED       (0x24)
1048c2ecf20Sopenharmony_ci#define ISCSI_KCQE_COMPLETION_STATUS_PROTOCOL_ERR_TTT_IS_RSRV           (0x25)
1058c2ecf20Sopenharmony_ci#define ISCSI_KCQE_COMPLETION_STATUS_PROTOCOL_ERR_MAX_BURST_LEN         (0x26)
1068c2ecf20Sopenharmony_ci#define ISCSI_KCQE_COMPLETION_STATUS_PROTOCOL_ERR_DATA_SEG_LEN_NOT_ZERO (0x27)
1078c2ecf20Sopenharmony_ci
1088c2ecf20Sopenharmony_ci/* TMF */
1098c2ecf20Sopenharmony_ci#define ISCSI_KCQE_COMPLETION_STATUS_PROTOCOL_ERR_REJECT_PDU_LEN        (0x28)
1108c2ecf20Sopenharmony_ci#define ISCSI_KCQE_COMPLETION_STATUS_PROTOCOL_ERR_ASYNC_PDU_LEN         (0x29)
1118c2ecf20Sopenharmony_ci#define ISCSI_KCQE_COMPLETION_STATUS_PROTOCOL_ERR_NOPIN_PDU_LEN         (0x2a)
1128c2ecf20Sopenharmony_ci#define ISCSI_KCQE_COMPLETION_STATUS_PROTOCOL_ERR_PEND_R2T_IN_CLEANUP   (0x2b)
1138c2ecf20Sopenharmony_ci
1148c2ecf20Sopenharmony_ci/* IP/TCP processing errors: */
1158c2ecf20Sopenharmony_ci#define ISCI_KCQE_COMPLETION_STATUS_TCP_ERROR_IP_FRAGMENT               (0x40)
1168c2ecf20Sopenharmony_ci#define ISCI_KCQE_COMPLETION_STATUS_TCP_ERROR_IP_OPTIONS                (0x41)
1178c2ecf20Sopenharmony_ci#define ISCI_KCQE_COMPLETION_STATUS_TCP_ERROR_URGENT_FLAG               (0x42)
1188c2ecf20Sopenharmony_ci#define ISCI_KCQE_COMPLETION_STATUS_TCP_ERROR_MAX_RTRANS                (0x43)
1198c2ecf20Sopenharmony_ci
1208c2ecf20Sopenharmony_ci/* iSCSI licensing errors */
1218c2ecf20Sopenharmony_ci/* general iSCSI license not installed */
1228c2ecf20Sopenharmony_ci#define ISCSI_KCQE_COMPLETION_STATUS_ISCSI_NOT_SUPPORTED                (0x50)
1238c2ecf20Sopenharmony_ci/* additional LOM specific iSCSI license not installed */
1248c2ecf20Sopenharmony_ci#define ISCSI_KCQE_COMPLETION_STATUS_LOM_ISCSI_NOT_ENABLED              (0x51)
1258c2ecf20Sopenharmony_ci
1268c2ecf20Sopenharmony_ci#define ISCSI_KCQE_COMPLETION_STATUS_CID_BUSY				(0x80)
1278c2ecf20Sopenharmony_ci#define ISCSI_KCQE_COMPLETION_STATUS_PARITY_ERR                         (0x81)
1288c2ecf20Sopenharmony_ci
1298c2ecf20Sopenharmony_ci/* SQ/RQ/CQ DB structure sizes */
1308c2ecf20Sopenharmony_ci#define ISCSI_SQ_DB_SIZE    (16)
1318c2ecf20Sopenharmony_ci#define ISCSI_RQ_DB_SIZE    (64)
1328c2ecf20Sopenharmony_ci#define ISCSI_CQ_DB_SIZE    (80)
1338c2ecf20Sopenharmony_ci
1348c2ecf20Sopenharmony_ci#define ISCSI_SQN_TO_NOTIFY_NOT_VALID                                   0xFFFF
1358c2ecf20Sopenharmony_ci
1368c2ecf20Sopenharmony_ci/* Page size codes (for flags field in connection offload request) */
1378c2ecf20Sopenharmony_ci#define ISCSI_PAGE_SIZE_256     (0)
1388c2ecf20Sopenharmony_ci#define ISCSI_PAGE_SIZE_512     (1)
1398c2ecf20Sopenharmony_ci#define ISCSI_PAGE_SIZE_1K      (2)
1408c2ecf20Sopenharmony_ci#define ISCSI_PAGE_SIZE_2K      (3)
1418c2ecf20Sopenharmony_ci#define ISCSI_PAGE_SIZE_4K      (4)
1428c2ecf20Sopenharmony_ci#define ISCSI_PAGE_SIZE_8K      (5)
1438c2ecf20Sopenharmony_ci#define ISCSI_PAGE_SIZE_16K     (6)
1448c2ecf20Sopenharmony_ci#define ISCSI_PAGE_SIZE_32K     (7)
1458c2ecf20Sopenharmony_ci#define ISCSI_PAGE_SIZE_64K     (8)
1468c2ecf20Sopenharmony_ci#define ISCSI_PAGE_SIZE_128K    (9)
1478c2ecf20Sopenharmony_ci#define ISCSI_PAGE_SIZE_256K    (10)
1488c2ecf20Sopenharmony_ci#define ISCSI_PAGE_SIZE_512K    (11)
1498c2ecf20Sopenharmony_ci#define ISCSI_PAGE_SIZE_1M      (12)
1508c2ecf20Sopenharmony_ci#define ISCSI_PAGE_SIZE_2M      (13)
1518c2ecf20Sopenharmony_ci#define ISCSI_PAGE_SIZE_4M      (14)
1528c2ecf20Sopenharmony_ci#define ISCSI_PAGE_SIZE_8M      (15)
1538c2ecf20Sopenharmony_ci
1548c2ecf20Sopenharmony_ci/* Iscsi PDU related defines */
1558c2ecf20Sopenharmony_ci#define ISCSI_HEADER_SIZE   (48)
1568c2ecf20Sopenharmony_ci#define ISCSI_DIGEST_SHIFT  (2)
1578c2ecf20Sopenharmony_ci#define ISCSI_DIGEST_SIZE   (4)
1588c2ecf20Sopenharmony_ci
1598c2ecf20Sopenharmony_ci#define B577XX_ISCSI_CONNECTION_TYPE    3
1608c2ecf20Sopenharmony_ci
1618c2ecf20Sopenharmony_ci#endif /*__57XX_ISCSI_CONSTANTS_H_ */
162