/* QLogic qed NIC Driver
* Copyright (c) 2015-2017 QLogic Corporation
*
* This software is available to you under a choice of one of two
* licenses. You may choose to be licensed under the terms of the GNU
* General Public License (GPL) Version 2, available from the file
* COPYING in the main directory of this source tree, or the
* OpenIB.org BSD license below:
*
* Redistribution and use in source and binary forms, with or
* without modification, are permitted provided that the following
* conditions are met:
*
* - Redistributions of source code must retain the above
* copyright notice, this list of conditions and the following
* disclaimer.
*
* - Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and /or other materials
* provided with the distribution.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#ifndef __ISCSI_COMMON__
#define __ISCSI_COMMON__
/**********************/
/* ISCSI FW CONSTANTS */
/**********************/
/* iSCSI HSI constants */
#define ISCSI_DEFAULT_MTU (1500)
/* KWQ (kernel work queue) layer codes */
#define ISCSI_SLOW_PATH_LAYER_CODE (6)
/* iSCSI parameter defaults */
#define ISCSI_DEFAULT_HEADER_DIGEST (0)
#define ISCSI_DEFAULT_DATA_DIGEST (0)
#define ISCSI_DEFAULT_INITIAL_R2T (1)
#define ISCSI_DEFAULT_IMMEDIATE_DATA (1)
#define ISCSI_DEFAULT_MAX_PDU_LENGTH (0x2000)
#define ISCSI_DEFAULT_FIRST_BURST_LENGTH (0x10000)
#define ISCSI_DEFAULT_MAX_BURST_LENGTH (0x40000)
#define ISCSI_DEFAULT_MAX_OUTSTANDING_R2T (1)
/* iSCSI parameter limits */
#define ISCSI_MIN_VAL_MAX_PDU_LENGTH (0x200)
#define ISCSI_MAX_VAL_MAX_PDU_LENGTH (0xffffff)
#define ISCSI_MIN_VAL_BURST_LENGTH (0x200)
#define ISCSI_MAX_VAL_BURST_LENGTH (0xffffff)
#define ISCSI_MIN_VAL_MAX_OUTSTANDING_R2T (1)
#define ISCSI_MAX_VAL_MAX_OUTSTANDING_R2T (0xff)
#define ISCSI_AHS_CNTL_SIZE 4
#define ISCSI_WQE_NUM_SGES_SLOWIO (0xf)
/* iSCSI reserved params */
#define ISCSI_ITT_ALL_ONES (0xffffffff)
#define ISCSI_TTT_ALL_ONES (0xffffffff)
#define ISCSI_OPTION_1_OFF_CHIP_TCP 1
#define ISCSI_OPTION_2_ON_CHIP_TCP 2
#define ISCSI_INITIATOR_MODE 0
#define ISCSI_TARGET_MODE 1
/* iSCSI request op codes */
#define ISCSI_OPCODE_NOP_OUT (0)
#define ISCSI_OPCODE_SCSI_CMD (1)
#define ISCSI_OPCODE_TMF_REQUEST (2)
#define ISCSI_OPCODE_LOGIN_REQUEST (3)
#define ISCSI_OPCODE_TEXT_REQUEST (4)
#define ISCSI_OPCODE_DATA_OUT (5)
#define ISCSI_OPCODE_LOGOUT_REQUEST (6)
/* iSCSI response/messages op codes */
#define ISCSI_OPCODE_NOP_IN (0x20)
#define ISCSI_OPCODE_SCSI_RESPONSE (0x21)
#define ISCSI_OPCODE_TMF_RESPONSE (0x22)
#define ISCSI_OPCODE_LOGIN_RESPONSE (0x23)
#define ISCSI_OPCODE_TEXT_RESPONSE (0x24)
#define ISCSI_OPCODE_DATA_IN (0x25)
#define ISCSI_OPCODE_LOGOUT_RESPONSE (0x26)
#define ISCSI_OPCODE_R2T (0x31)
#define ISCSI_OPCODE_ASYNC_MSG (0x32)
#define ISCSI_OPCODE_REJECT (0x3f)
/* iSCSI stages */
#define ISCSI_STAGE_SECURITY_NEGOTIATION (0)
#define ISCSI_STAGE_LOGIN_OPERATIONAL_NEGOTIATION (1)
#define ISCSI_STAGE_FULL_FEATURE_PHASE (3)
/* iSCSI CQE errors */
#define CQE_ERROR_BITMAP_DATA_DIGEST (0x08)
#define CQE_ERROR_BITMAP_RCV_ON_INVALID_CONN (0x10)
#define CQE_ERROR_BITMAP_DATA_TRUNCATED (0x20)
/* Union of data bd_opaque/ tq_tid */
union bd_opaque_tq_union {
__le16 bd_opaque;
__le16 tq_tid;
};
/* ISCSI SGL entry */
struct cqe_error_bitmap {
u8 cqe_error_status_bits;
#define CQE_ERROR_BITMAP_DIF_ERR_BITS_MASK 0x7
#define CQE_ERROR_BITMAP_DIF_ERR_BITS_SHIFT 0
#define CQE_ERROR_BITMAP_DATA_DIGEST_ERR_MASK 0x1
#define CQE_ERROR_BITMAP_DATA_DIGEST_ERR_SHIFT 3
#define CQE_ERROR_BITMAP_RCV_ON_INVALID_CONN_MASK 0x1
#define CQE_ERROR_BITMAP_RCV_ON_INVALID_CONN_SHIFT 4
#define CQE_ERROR_BITMAP_DATA_TRUNCATED_ERR_MASK 0x1
#define CQE_ERROR_BITMAP_DATA_TRUNCATED_ERR_SHIFT 5
#define CQE_ERROR_BITMAP_UNDER_RUN_ERR_MASK 0x1
#define CQE_ERROR_BITMAP_UNDER_RUN_ERR_SHIFT 6
#define CQE_ERROR_BITMAP_RESERVED2_MASK 0x1
#define CQE_ERROR_BITMAP_RESERVED2_SHIFT 7
};
union cqe_error_status {
u8 error_status;
struct cqe_error_bitmap error_bits;
};
/* iSCSI Login Response PDU header */
struct data_hdr {
__le32 data[12];
};
struct lun_mapper_addr_reserved {
struct regpair lun_mapper_addr;
u8 reserved0[8];
};
/* rdif conetxt for dif on immediate */
struct dif_on_immediate_params {
__le32 initial_ref_tag;
__le16 application_tag;
__le16 application_tag_mask;
__le16 flags1;
#define DIF_ON_IMMEDIATE_PARAMS_VALIDATE_GUARD_MASK 0x1
#define DIF_ON_IMMEDIATE_PARAMS_VALIDATE_GUARD_SHIFT 0
#define DIF_ON_IMMEDIATE_PARAMS_VALIDATE_APP_TAG_MASK 0x1
#define DIF_ON_IMMEDIATE_PARAMS_VALIDATE_APP_TAG_SHIFT 1
#define DIF_ON_IMMEDIATE_PARAMS_VALIDATE_REF_TAG_MASK 0x1
#define DIF_ON_IMMEDIATE_PARAMS_VALIDATE_REF_TAG_SHIFT 2
#define DIF_ON_IMMEDIATE_PARAMS_FORWARD_GUARD_MASK 0x1
#define DIF_ON_IMMEDIATE_PARAMS_FORWARD_GUARD_SHIFT 3
#define DIF_ON_IMMEDIATE_PARAMS_FORWARD_APP_TAG_MASK 0x1
#define DIF_ON_IMMEDIATE_PARAMS_FORWARD_APP_TAG_SHIFT 4
#define DIF_ON_IMMEDIATE_PARAMS_FORWARD_REF_TAG_MASK 0x1
#define DIF_ON_IMMEDIATE_PARAMS_FORWARD_REF_TAG_SHIFT 5
#define DIF_ON_IMMEDIATE_PARAMS_INTERVAL_SIZE_MASK 0x1
#define DIF_ON_IMMEDIATE_PARAMS_INTERVAL_SIZE_SHIFT 6
#define DIF_ON_IMMEDIATE_PARAMS_NETWORK_INTERFACE_MASK 0x1
#define DIF_ON_IMMEDIATE_PARAMS_NETWORK_INTE
|