162306a36Sopenharmony_ci/* 57xx_iscsi_constants.h: QLogic NetXtreme II iSCSI HSI
262306a36Sopenharmony_ci *
362306a36Sopenharmony_ci * Copyright (c) 2006 - 2013 Broadcom Corporation
462306a36Sopenharmony_ci * Copyright (c) 2014, QLogic Corporation
562306a36Sopenharmony_ci *
662306a36Sopenharmony_ci * This program is free software; you can redistribute it and/or modify
762306a36Sopenharmony_ci * it under the terms of the GNU General Public License as published by
862306a36Sopenharmony_ci * the Free Software Foundation.
962306a36Sopenharmony_ci *
1062306a36Sopenharmony_ci * Written by: Anil Veerabhadrappa (anilgv@broadcom.com)
1162306a36Sopenharmony_ci * Previously Maintained by: Eddie Wai (eddie.wai@broadcom.com)
1262306a36Sopenharmony_ci * Maintained by: QLogic-Storage-Upstream@qlogic.com
1362306a36Sopenharmony_ci */
1462306a36Sopenharmony_ci#ifndef __57XX_ISCSI_CONSTANTS_H_
1562306a36Sopenharmony_ci#define __57XX_ISCSI_CONSTANTS_H_
1662306a36Sopenharmony_ci
1762306a36Sopenharmony_ci/**
1862306a36Sopenharmony_ci* This file defines HSI constants for the iSCSI flows
1962306a36Sopenharmony_ci*/
2062306a36Sopenharmony_ci
2162306a36Sopenharmony_ci/* iSCSI request op codes */
2262306a36Sopenharmony_ci#define ISCSI_OPCODE_CLEANUP_REQUEST    (7)
2362306a36Sopenharmony_ci
2462306a36Sopenharmony_ci/* iSCSI response/messages op codes */
2562306a36Sopenharmony_ci#define ISCSI_OPCODE_CLEANUP_RESPONSE 		(0x27)
2662306a36Sopenharmony_ci#define ISCSI_OPCODE_NOPOUT_LOCAL_COMPLETION    (0)
2762306a36Sopenharmony_ci
2862306a36Sopenharmony_ci/* iSCSI task types */
2962306a36Sopenharmony_ci#define ISCSI_TASK_TYPE_READ    (0)
3062306a36Sopenharmony_ci#define ISCSI_TASK_TYPE_WRITE   (1)
3162306a36Sopenharmony_ci#define ISCSI_TASK_TYPE_MPATH   (2)
3262306a36Sopenharmony_ci
3362306a36Sopenharmony_ci/* initial CQ sequence numbers */
3462306a36Sopenharmony_ci#define ISCSI_INITIAL_SN    (1)
3562306a36Sopenharmony_ci
3662306a36Sopenharmony_ci/* KWQ (kernel work queue) layer codes */
3762306a36Sopenharmony_ci#define ISCSI_KWQE_LAYER_CODE   (6)
3862306a36Sopenharmony_ci
3962306a36Sopenharmony_ci/* KWQ (kernel work queue) request op codes */
4062306a36Sopenharmony_ci#define ISCSI_KWQE_OPCODE_OFFLOAD_CONN1 (0)
4162306a36Sopenharmony_ci#define ISCSI_KWQE_OPCODE_OFFLOAD_CONN2 (1)
4262306a36Sopenharmony_ci#define ISCSI_KWQE_OPCODE_UPDATE_CONN   (2)
4362306a36Sopenharmony_ci#define ISCSI_KWQE_OPCODE_DESTROY_CONN  (3)
4462306a36Sopenharmony_ci#define ISCSI_KWQE_OPCODE_INIT1         (4)
4562306a36Sopenharmony_ci#define ISCSI_KWQE_OPCODE_INIT2         (5)
4662306a36Sopenharmony_ci
4762306a36Sopenharmony_ci/* KCQ (kernel completion queue) response op codes */
4862306a36Sopenharmony_ci#define ISCSI_KCQE_OPCODE_OFFLOAD_CONN  (0x10)
4962306a36Sopenharmony_ci#define ISCSI_KCQE_OPCODE_UPDATE_CONN   (0x12)
5062306a36Sopenharmony_ci#define ISCSI_KCQE_OPCODE_DESTROY_CONN  (0x13)
5162306a36Sopenharmony_ci#define ISCSI_KCQE_OPCODE_INIT          (0x14)
5262306a36Sopenharmony_ci#define ISCSI_KCQE_OPCODE_FW_CLEAN_TASK	(0x15)
5362306a36Sopenharmony_ci#define ISCSI_KCQE_OPCODE_TCP_RESET     (0x16)
5462306a36Sopenharmony_ci#define ISCSI_KCQE_OPCODE_TCP_SYN       (0x17)
5562306a36Sopenharmony_ci#define ISCSI_KCQE_OPCODE_TCP_FIN       (0X18)
5662306a36Sopenharmony_ci#define ISCSI_KCQE_OPCODE_TCP_ERROR     (0x19)
5762306a36Sopenharmony_ci#define ISCSI_KCQE_OPCODE_CQ_EVENT_NOTIFICATION (0x20)
5862306a36Sopenharmony_ci#define ISCSI_KCQE_OPCODE_ISCSI_ERROR   (0x21)
5962306a36Sopenharmony_ci
6062306a36Sopenharmony_ci/* KCQ (kernel completion queue) completion status */
6162306a36Sopenharmony_ci#define ISCSI_KCQE_COMPLETION_STATUS_SUCCESS                            (0x0)
6262306a36Sopenharmony_ci#define ISCSI_KCQE_COMPLETION_STATUS_INVALID_OPCODE                     (0x1)
6362306a36Sopenharmony_ci#define ISCSI_KCQE_COMPLETION_STATUS_CTX_ALLOC_FAILURE                  (0x2)
6462306a36Sopenharmony_ci#define ISCSI_KCQE_COMPLETION_STATUS_CTX_FREE_FAILURE                   (0x3)
6562306a36Sopenharmony_ci#define ISCSI_KCQE_COMPLETION_STATUS_NIC_ERROR                          (0x4)
6662306a36Sopenharmony_ci
6762306a36Sopenharmony_ci#define ISCSI_KCQE_COMPLETION_STATUS_HDR_DIG_ERR                        (0x5)
6862306a36Sopenharmony_ci#define ISCSI_KCQE_COMPLETION_STATUS_DATA_DIG_ERR                       (0x6)
6962306a36Sopenharmony_ci
7062306a36Sopenharmony_ci#define ISCSI_KCQE_COMPLETION_STATUS_PROTOCOL_ERR_UNEXPECTED_OPCODE     (0xa)
7162306a36Sopenharmony_ci#define ISCSI_KCQE_COMPLETION_STATUS_PROTOCOL_ERR_OPCODE                (0xb)
7262306a36Sopenharmony_ci#define ISCSI_KCQE_COMPLETION_STATUS_PROTOCOL_ERR_AHS_LEN               (0xc)
7362306a36Sopenharmony_ci#define ISCSI_KCQE_COMPLETION_STATUS_PROTOCOL_ERR_ITT                   (0xd)
7462306a36Sopenharmony_ci#define ISCSI_KCQE_COMPLETION_STATUS_PROTOCOL_ERR_STATSN                (0xe)
7562306a36Sopenharmony_ci
7662306a36Sopenharmony_ci/* Response */
7762306a36Sopenharmony_ci#define ISCSI_KCQE_COMPLETION_STATUS_PROTOCOL_ERR_EXP_DATASN            (0xf)
7862306a36Sopenharmony_ci#define ISCSI_KCQE_COMPLETION_STATUS_PROTOCOL_ERR_PEND_R2T              (0x10)
7962306a36Sopenharmony_ci#define ISCSI_KCQE_COMPLETION_STATUS_PROTOCOL_ERR_DATA_SEG_LEN_IS_ZERO  (0x2c)
8062306a36Sopenharmony_ci#define ISCSI_KCQE_COMPLETION_STATUS_PROTOCOL_ERR_DATA_SEG_LEN_TOO_BIG  (0x2d)
8162306a36Sopenharmony_ci#define ISCSI_KCQE_COMPLETION_STATUS_PROTOCOL_ERR_O_U_0                 (0x11)
8262306a36Sopenharmony_ci#define ISCSI_KCQE_COMPLETION_STATUS_PROTOCOL_ERR_O_U_1                 (0x12)
8362306a36Sopenharmony_ci#define ISCSI_KCQE_COMPLETION_STATUS_PROTOCOL_ERR_O_U_2                 (0x13)
8462306a36Sopenharmony_ci#define ISCSI_KCQE_COMPLETION_STATUS_PROTOCOL_ERR_O_U_3                 (0x14)
8562306a36Sopenharmony_ci#define ISCSI_KCQE_COMPLETION_STATUS_PROTOCOL_ERR_O_U_4                 (0x15)
8662306a36Sopenharmony_ci#define ISCSI_KCQE_COMPLETION_STATUS_PROTOCOL_ERR_O_U_5                 (0x16)
8762306a36Sopenharmony_ci#define ISCSI_KCQE_COMPLETION_STATUS_PROTOCOL_ERR_O_U_6                 (0x17)
8862306a36Sopenharmony_ci
8962306a36Sopenharmony_ci/* Data-In */
9062306a36Sopenharmony_ci#define ISCSI_KCQE_COMPLETION_STATUS_PROTOCOL_ERR_REMAIN_RCV_LEN        (0x18)
9162306a36Sopenharmony_ci#define ISCSI_KCQE_COMPLETION_STATUS_PROTOCOL_ERR_MAX_RCV_PDU_LEN       (0x19)
9262306a36Sopenharmony_ci#define ISCSI_KCQE_COMPLETION_STATUS_PROTOCOL_ERR_F_BIT_ZERO            (0x1a)
9362306a36Sopenharmony_ci#define ISCSI_KCQE_COMPLETION_STATUS_PROTOCOL_ERR_TTT_NOT_RSRV          (0x1b)
9462306a36Sopenharmony_ci#define ISCSI_KCQE_COMPLETION_STATUS_PROTOCOL_ERR_DATASN                (0x1c)
9562306a36Sopenharmony_ci#define ISCSI_KCQE_COMPLETION_STATUS_PROTOCOL_ERR_REMAIN_BURST_LEN      (0x1d)
9662306a36Sopenharmony_ci
9762306a36Sopenharmony_ci/* R2T */
9862306a36Sopenharmony_ci#define ISCSI_KCQE_COMPLETION_STATUS_PROTOCOL_ERR_BUFFER_OFF            (0x1f)
9962306a36Sopenharmony_ci#define ISCSI_KCQE_COMPLETION_STATUS_PROTOCOL_ERR_LUN                   (0x20)
10062306a36Sopenharmony_ci#define ISCSI_KCQE_COMPLETION_STATUS_PROTOCOL_ERR_R2TSN                 (0x21)
10162306a36Sopenharmony_ci#define ISCSI_KCQE_COMPLETION_STATUS_PROTOCOL_ERR_DESIRED_DATA_TRNS_LEN_0 (0x22)
10262306a36Sopenharmony_ci#define ISCSI_KCQE_COMPLETION_STATUS_PROTOCOL_ERR_DESIRED_DATA_TRNS_LEN_1 (0x23)
10362306a36Sopenharmony_ci#define ISCSI_KCQE_COMPLETION_STATUS_PROTOCOL_ERR_PEND_R2T_EXCEED       (0x24)
10462306a36Sopenharmony_ci#define ISCSI_KCQE_COMPLETION_STATUS_PROTOCOL_ERR_TTT_IS_RSRV           (0x25)
10562306a36Sopenharmony_ci#define ISCSI_KCQE_COMPLETION_STATUS_PROTOCOL_ERR_MAX_BURST_LEN         (0x26)
10662306a36Sopenharmony_ci#define ISCSI_KCQE_COMPLETION_STATUS_PROTOCOL_ERR_DATA_SEG_LEN_NOT_ZERO (0x27)
10762306a36Sopenharmony_ci
10862306a36Sopenharmony_ci/* TMF */
10962306a36Sopenharmony_ci#define ISCSI_KCQE_COMPLETION_STATUS_PROTOCOL_ERR_REJECT_PDU_LEN        (0x28)
11062306a36Sopenharmony_ci#define ISCSI_KCQE_COMPLETION_STATUS_PROTOCOL_ERR_ASYNC_PDU_LEN         (0x29)
11162306a36Sopenharmony_ci#define ISCSI_KCQE_COMPLETION_STATUS_PROTOCOL_ERR_NOPIN_PDU_LEN         (0x2a)
11262306a36Sopenharmony_ci#define ISCSI_KCQE_COMPLETION_STATUS_PROTOCOL_ERR_PEND_R2T_IN_CLEANUP   (0x2b)
11362306a36Sopenharmony_ci
11462306a36Sopenharmony_ci/* IP/TCP processing errors: */
11562306a36Sopenharmony_ci#define ISCI_KCQE_COMPLETION_STATUS_TCP_ERROR_IP_FRAGMENT               (0x40)
11662306a36Sopenharmony_ci#define ISCI_KCQE_COMPLETION_STATUS_TCP_ERROR_IP_OPTIONS                (0x41)
11762306a36Sopenharmony_ci#define ISCI_KCQE_COMPLETION_STATUS_TCP_ERROR_URGENT_FLAG               (0x42)
11862306a36Sopenharmony_ci#define ISCI_KCQE_COMPLETION_STATUS_TCP_ERROR_MAX_RTRANS                (0x43)
11962306a36Sopenharmony_ci
12062306a36Sopenharmony_ci/* iSCSI licensing errors */
12162306a36Sopenharmony_ci/* general iSCSI license not installed */
12262306a36Sopenharmony_ci#define ISCSI_KCQE_COMPLETION_STATUS_ISCSI_NOT_SUPPORTED                (0x50)
12362306a36Sopenharmony_ci/* additional LOM specific iSCSI license not installed */
12462306a36Sopenharmony_ci#define ISCSI_KCQE_COMPLETION_STATUS_LOM_ISCSI_NOT_ENABLED              (0x51)
12562306a36Sopenharmony_ci
12662306a36Sopenharmony_ci#define ISCSI_KCQE_COMPLETION_STATUS_CID_BUSY				(0x80)
12762306a36Sopenharmony_ci#define ISCSI_KCQE_COMPLETION_STATUS_PARITY_ERR                         (0x81)
12862306a36Sopenharmony_ci
12962306a36Sopenharmony_ci/* SQ/RQ/CQ DB structure sizes */
13062306a36Sopenharmony_ci#define ISCSI_SQ_DB_SIZE    (16)
13162306a36Sopenharmony_ci#define ISCSI_RQ_DB_SIZE    (64)
13262306a36Sopenharmony_ci#define ISCSI_CQ_DB_SIZE    (80)
13362306a36Sopenharmony_ci
13462306a36Sopenharmony_ci#define ISCSI_SQN_TO_NOTIFY_NOT_VALID                                   0xFFFF
13562306a36Sopenharmony_ci
13662306a36Sopenharmony_ci/* Page size codes (for flags field in connection offload request) */
13762306a36Sopenharmony_ci#define ISCSI_PAGE_SIZE_256     (0)
13862306a36Sopenharmony_ci#define ISCSI_PAGE_SIZE_512     (1)
13962306a36Sopenharmony_ci#define ISCSI_PAGE_SIZE_1K      (2)
14062306a36Sopenharmony_ci#define ISCSI_PAGE_SIZE_2K      (3)
14162306a36Sopenharmony_ci#define ISCSI_PAGE_SIZE_4K      (4)
14262306a36Sopenharmony_ci#define ISCSI_PAGE_SIZE_8K      (5)
14362306a36Sopenharmony_ci#define ISCSI_PAGE_SIZE_16K     (6)
14462306a36Sopenharmony_ci#define ISCSI_PAGE_SIZE_32K     (7)
14562306a36Sopenharmony_ci#define ISCSI_PAGE_SIZE_64K     (8)
14662306a36Sopenharmony_ci#define ISCSI_PAGE_SIZE_128K    (9)
14762306a36Sopenharmony_ci#define ISCSI_PAGE_SIZE_256K    (10)
14862306a36Sopenharmony_ci#define ISCSI_PAGE_SIZE_512K    (11)
14962306a36Sopenharmony_ci#define ISCSI_PAGE_SIZE_1M      (12)
15062306a36Sopenharmony_ci#define ISCSI_PAGE_SIZE_2M      (13)
15162306a36Sopenharmony_ci#define ISCSI_PAGE_SIZE_4M      (14)
15262306a36Sopenharmony_ci#define ISCSI_PAGE_SIZE_8M      (15)
15362306a36Sopenharmony_ci
15462306a36Sopenharmony_ci/* Iscsi PDU related defines */
15562306a36Sopenharmony_ci#define ISCSI_HEADER_SIZE   (48)
15662306a36Sopenharmony_ci#define ISCSI_DIGEST_SHIFT  (2)
15762306a36Sopenharmony_ci#define ISCSI_DIGEST_SIZE   (4)
15862306a36Sopenharmony_ci
15962306a36Sopenharmony_ci#define B577XX_ISCSI_CONNECTION_TYPE    3
16062306a36Sopenharmony_ci
16162306a36Sopenharmony_ci#endif /*__57XX_ISCSI_CONSTANTS_H_ */
162