![]() |
|
|||
0001 /* SPDX-License-Identifier: GPL-2.0-only */ 0002 /* 0003 * Copyright(c) 2007 Intel Corporation. All rights reserved. 0004 * 0005 * Maintained at www.Open-FCoE.org 0006 */ 0007 0008 #ifndef _FC_FCP_H_ 0009 #define _FC_FCP_H_ 0010 0011 #include <scsi/scsi.h> 0012 0013 /* 0014 * Fibre Channel Protocol for SCSI. 0015 * From T10 FCP-3, T10 project 1560-D Rev 4, Sept. 13, 2005. 0016 */ 0017 0018 /* 0019 * fc/fs.h defines FC_TYPE_FCP. 0020 */ 0021 0022 /* 0023 * Service parameter page parameters (word 3 bits) for Process Login. 0024 */ 0025 #define FCP_SPPF_TASK_RETRY_ID 0x0200 /* task retry ID requested */ 0026 #define FCP_SPPF_RETRY 0x0100 /* retry supported */ 0027 #define FCP_SPPF_CONF_COMPL 0x0080 /* confirmed completion allowed */ 0028 #define FCP_SPPF_OVLY_ALLOW 0x0040 /* data overlay allowed */ 0029 #define FCP_SPPF_INIT_FCN 0x0020 /* initiator function */ 0030 #define FCP_SPPF_TARG_FCN 0x0010 /* target function */ 0031 #define FCP_SPPF_RD_XRDY_DIS 0x0002 /* disable XFER_RDY for reads */ 0032 #define FCP_SPPF_WR_XRDY_DIS 0x0001 /* disable XFER_RDY for writes */ 0033 0034 /* 0035 * FCP_CMND IU Payload. 0036 */ 0037 struct fcp_cmnd { 0038 struct scsi_lun fc_lun; /* logical unit number */ 0039 __u8 fc_cmdref; /* command reference number */ 0040 __u8 fc_pri_ta; /* priority and task attribute */ 0041 __u8 fc_tm_flags; /* task management flags */ 0042 __u8 fc_flags; /* additional len & flags */ 0043 __u8 fc_cdb[16]; /* base CDB */ 0044 __be32 fc_dl; /* data length (must follow fc_cdb) */ 0045 }; 0046 0047 #define FCP_CMND_LEN 32 /* expected length of structure */ 0048 0049 struct fcp_cmnd32 { 0050 struct scsi_lun fc_lun; /* logical unit number */ 0051 __u8 fc_cmdref; /* command reference number */ 0052 __u8 fc_pri_ta; /* priority and task attribute */ 0053 __u8 fc_tm_flags; /* task management flags */ 0054 __u8 fc_flags; /* additional len & flags */ 0055 __u8 fc_cdb[32]; /* base CDB */ 0056 __be32 fc_dl; /* data length (must follow fc_cdb) */ 0057 }; 0058 0059 #define FCP_CMND32_LEN 48 /* expected length of structure */ 0060 #define FCP_CMND32_ADD_LEN (16 / 4) /* Additional cdb length */ 0061 0062 /* 0063 * fc_pri_ta. 0064 */ 0065 #define FCP_PTA_SIMPLE 0 /* simple task attribute */ 0066 #define FCP_PTA_HEADQ 1 /* head of queue task attribute */ 0067 #define FCP_PTA_ORDERED 2 /* ordered task attribute */ 0068 #define FCP_PTA_ACA 4 /* auto. contingent allegiance */ 0069 #define FCP_PTA_MASK 7 /* mask for task attribute field */ 0070 #define FCP_PRI_SHIFT 3 /* priority field starts in bit 3 */ 0071 #define FCP_PRI_RESVD_MASK 0x80 /* reserved bits in priority field */ 0072 0073 /* 0074 * fc_tm_flags - task management flags field. 0075 */ 0076 #define FCP_TMF_CLR_ACA 0x40 /* clear ACA condition */ 0077 #define FCP_TMF_TGT_RESET 0x20 /* target reset task management, 0078 deprecated as of FCP-3 */ 0079 #define FCP_TMF_LUN_RESET 0x10 /* logical unit reset task management */ 0080 #define FCP_TMF_CLR_TASK_SET 0x04 /* clear task set */ 0081 #define FCP_TMF_ABT_TASK_SET 0x02 /* abort task set */ 0082 0083 /* 0084 * fc_flags. 0085 * Bits 7:2 are the additional FCP_CDB length / 4. 0086 */ 0087 #define FCP_CFL_LEN_MASK 0xfc /* mask for additional length */ 0088 #define FCP_CFL_LEN_SHIFT 2 /* shift bits for additional length */ 0089 #define FCP_CFL_RDDATA 0x02 /* read data */ 0090 #define FCP_CFL_WRDATA 0x01 /* write data */ 0091 0092 /* 0093 * FCP_TXRDY IU - transfer ready payload. 0094 */ 0095 struct fcp_txrdy { 0096 __be32 ft_data_ro; /* data relative offset */ 0097 __be32 ft_burst_len; /* burst length */ 0098 __u8 _ft_resvd[4]; /* reserved */ 0099 }; 0100 0101 #define FCP_TXRDY_LEN 12 /* expected length of structure */ 0102 0103 /* 0104 * FCP_RESP IU - response payload. 0105 * 0106 * The response payload comes in three parts: the flags/status, the 0107 * sense/response lengths and the sense data/response info section. 0108 * 0109 * From FCP3r04, note 6 of section 9.5.13: 0110 * 0111 * Some early implementations presented the FCP_RSP IU without the FCP_RESID, 0112 * FCP_SNS_LEN, and FCP_RSP_LEN fields if the FCP_RESID_UNDER, FCP_RESID_OVER, 0113 * FCP_SNS_LEN_VALID, and FCP_RSP_LEN_VALID bits were all set to zero. This 0114 * non-standard behavior should be tolerated. 0115 * 0116 * All response frames will always contain the fcp_resp template. Some 0117 * will also include the fcp_resp_len template. 0118 * 0119 * From Table 23, the FCP_RSP_INFO can either be 4 bytes or 8 bytes, both 0120 * are valid length. 0121 */ 0122 struct fcp_resp { 0123 __u8 _fr_resvd[8]; /* reserved */ 0124 __be16 fr_retry_delay; /* retry delay timer */ 0125 __u8 fr_flags; /* flags */ 0126 __u8 fr_status; /* SCSI status code */ 0127 }; 0128 0129 #define FCP_RESP_LEN 12 /* expected length of structure */ 0130 0131 struct fcp_resp_ext { 0132 __be32 fr_resid; /* Residual value */ 0133 __be32 fr_sns_len; /* SCSI Sense length */ 0134 __be32 fr_rsp_len; /* Response Info length */ 0135 0136 /* 0137 * Optionally followed by RSP info and/or SNS info and/or 0138 * bidirectional read residual length, if any. 0139 */ 0140 }; 0141 0142 #define FCP_RESP_EXT_LEN 12 /* expected length of the structure */ 0143 0144 struct fcp_resp_rsp_info { 0145 __u8 _fr_resvd[3]; /* reserved */ 0146 __u8 rsp_code; /* Response Info Code */ 0147 __u8 _fr_resvd2[4]; /* reserved */ 0148 }; 0149 0150 #define FCP_RESP_RSP_INFO_LEN4 4 /* without reserved field */ 0151 #define FCP_RESP_RSP_INFO_LEN8 8 /* with reserved field */ 0152 0153 struct fcp_resp_with_ext { 0154 struct fcp_resp resp; 0155 struct fcp_resp_ext ext; 0156 }; 0157 0158 #define FCP_RESP_WITH_EXT (FCP_RESP_LEN + FCP_RESP_EXT_LEN) 0159 0160 /* 0161 * fr_flags. 0162 */ 0163 #define FCP_BIDI_RSP 0x80 /* bidirectional read response */ 0164 #define FCP_BIDI_READ_UNDER 0x40 /* bidir. read less than requested */ 0165 #define FCP_BIDI_READ_OVER 0x20 /* DL insufficient for full transfer */ 0166 #define FCP_CONF_REQ 0x10 /* confirmation requested */ 0167 #define FCP_RESID_UNDER 0x08 /* transfer shorter than expected */ 0168 #define FCP_RESID_OVER 0x04 /* DL insufficient for full transfer */ 0169 #define FCP_SNS_LEN_VAL 0x02 /* SNS_LEN field is valid */ 0170 #define FCP_RSP_LEN_VAL 0x01 /* RSP_LEN field is valid */ 0171 0172 /* 0173 * rsp_codes 0174 */ 0175 enum fcp_resp_rsp_codes { 0176 FCP_TMF_CMPL = 0, 0177 FCP_DATA_LEN_INVALID = 1, 0178 FCP_CMND_FIELDS_INVALID = 2, 0179 FCP_DATA_PARAM_MISMATCH = 3, 0180 FCP_TMF_REJECTED = 4, 0181 FCP_TMF_FAILED = 5, 0182 FCP_TMF_INVALID_LUN = 9, 0183 }; 0184 0185 /* 0186 * FCP SRR Link Service request - Sequence Retransmission Request. 0187 */ 0188 struct fcp_srr { 0189 __u8 srr_op; /* opcode ELS_SRR */ 0190 __u8 srr_resvd[3]; /* opcode / reserved - must be zero */ 0191 __be16 srr_ox_id; /* OX_ID of failed command */ 0192 __be16 srr_rx_id; /* RX_ID of failed command */ 0193 __be32 srr_rel_off; /* relative offset */ 0194 __u8 srr_r_ctl; /* r_ctl for the information unit */ 0195 __u8 srr_resvd2[3]; /* reserved */ 0196 }; 0197 0198 /* 0199 * Feature bits in name server FC-4 Features object. 0200 */ 0201 #define FCP_FEAT_TARG (1 << 0) /* target function supported */ 0202 #define FCP_FEAT_INIT (1 << 1) /* initiator function supported */ 0203 0204 #endif /* _FC_FCP_H_ */
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.1.0 LXR engine. The LXR team |
![]() ![]() |