![]() |
|
|||
0001 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ 0002 /* 0003 * FC Transport BSG Interface 0004 * 0005 * Copyright (C) 2008 James Smart, Emulex Corporation 0006 */ 0007 0008 #ifndef SCSI_BSG_FC_H 0009 #define SCSI_BSG_FC_H 0010 0011 #include <linux/types.h> 0012 0013 /* 0014 * This file intended to be included by both kernel and user space 0015 */ 0016 0017 /* 0018 * FC Transport SGIO v4 BSG Message Support 0019 */ 0020 0021 /* Default BSG request timeout (in seconds) */ 0022 #define FC_DEFAULT_BSG_TIMEOUT (10 * HZ) 0023 0024 0025 /* 0026 * Request Message Codes supported by the FC Transport 0027 */ 0028 0029 /* define the class masks for the message codes */ 0030 #define FC_BSG_CLS_MASK 0xF0000000 /* find object class */ 0031 #define FC_BSG_HST_MASK 0x80000000 /* fc host class */ 0032 #define FC_BSG_RPT_MASK 0x40000000 /* fc rport class */ 0033 0034 /* fc_host Message Codes */ 0035 #define FC_BSG_HST_ADD_RPORT (FC_BSG_HST_MASK | 0x00000001) 0036 #define FC_BSG_HST_DEL_RPORT (FC_BSG_HST_MASK | 0x00000002) 0037 #define FC_BSG_HST_ELS_NOLOGIN (FC_BSG_HST_MASK | 0x00000003) 0038 #define FC_BSG_HST_CT (FC_BSG_HST_MASK | 0x00000004) 0039 #define FC_BSG_HST_VENDOR (FC_BSG_HST_MASK | 0x000000FF) 0040 0041 /* fc_rport Message Codes */ 0042 #define FC_BSG_RPT_ELS (FC_BSG_RPT_MASK | 0x00000001) 0043 #define FC_BSG_RPT_CT (FC_BSG_RPT_MASK | 0x00000002) 0044 0045 0046 0047 /* 0048 * FC Address Identifiers in Message Structures : 0049 * 0050 * Whenever a command payload contains a FC Address Identifier 0051 * (aka port_id), the value is effectively in big-endian 0052 * order, thus the array elements are decoded as follows: 0053 * element [0] is bits 23:16 of the FC Address Identifier 0054 * element [1] is bits 15:8 of the FC Address Identifier 0055 * element [2] is bits 7:0 of the FC Address Identifier 0056 */ 0057 0058 0059 /* 0060 * FC Host Messages 0061 */ 0062 0063 /* FC_BSG_HST_ADDR_PORT : */ 0064 0065 /* Request: 0066 * This message requests the FC host to login to the remote port 0067 * at the specified N_Port_Id. The remote port is to be enumerated 0068 * with the transport upon completion of the login. 0069 */ 0070 struct fc_bsg_host_add_rport { 0071 __u8 reserved; 0072 0073 /* FC Address Identier of the remote port to login to */ 0074 __u8 port_id[3]; 0075 }; 0076 0077 /* Response: 0078 * There is no additional response data - fc_bsg_reply->result is sufficient 0079 */ 0080 0081 0082 /* FC_BSG_HST_DEL_RPORT : */ 0083 0084 /* Request: 0085 * This message requests the FC host to remove an enumerated 0086 * remote port and to terminate the login to it. 0087 * 0088 * Note: The driver is free to reject this request if it desires to 0089 * remain logged in with the remote port. 0090 */ 0091 struct fc_bsg_host_del_rport { 0092 __u8 reserved; 0093 0094 /* FC Address Identier of the remote port to logout of */ 0095 __u8 port_id[3]; 0096 }; 0097 0098 /* Response: 0099 * There is no additional response data - fc_bsg_reply->result is sufficient 0100 */ 0101 0102 0103 /* FC_BSG_HST_ELS_NOLOGIN : */ 0104 0105 /* Request: 0106 * This message requests the FC_Host to send an ELS to a specific 0107 * N_Port_ID. The host does not need to log into the remote port, 0108 * nor does it need to enumerate the rport for further traffic 0109 * (although, the FC host is free to do so if it desires). 0110 */ 0111 struct fc_bsg_host_els { 0112 /* 0113 * ELS Command Code being sent (must be the same as byte 0 0114 * of the payload) 0115 */ 0116 __u8 command_code; 0117 0118 /* FC Address Identier of the remote port to send the ELS to */ 0119 __u8 port_id[3]; 0120 }; 0121 0122 /* Response: 0123 */ 0124 /* fc_bsg_ctels_reply->status values */ 0125 #define FC_CTELS_STATUS_OK 0x00000000 0126 #define FC_CTELS_STATUS_REJECT 0x00000001 0127 #define FC_CTELS_STATUS_P_RJT 0x00000002 0128 #define FC_CTELS_STATUS_F_RJT 0x00000003 0129 #define FC_CTELS_STATUS_P_BSY 0x00000004 0130 #define FC_CTELS_STATUS_F_BSY 0x00000006 0131 struct fc_bsg_ctels_reply { 0132 /* 0133 * Note: An ELS LS_RJT may be reported in 2 ways: 0134 * a) A status of FC_CTELS_STATUS_OK is returned. The caller 0135 * is to look into the ELS receive payload to determine 0136 * LS_ACC or LS_RJT (by contents of word 0). The reject 0137 * data will be in word 1. 0138 * b) A status of FC_CTELS_STATUS_REJECT is returned, The 0139 * rjt_data field will contain valid data. 0140 * 0141 * Note: ELS LS_ACC is determined by an FC_CTELS_STATUS_OK, and 0142 * the receive payload word 0 indicates LS_ACC 0143 * (e.g. value is 0x02xxxxxx). 0144 * 0145 * Note: Similarly, a CT Reject may be reported in 2 ways: 0146 * a) A status of FC_CTELS_STATUS_OK is returned. The caller 0147 * is to look into the CT receive payload to determine 0148 * Accept or Reject (by contents of word 2). The reject 0149 * data will be in word 3. 0150 * b) A status of FC_CTELS_STATUS_REJECT is returned, The 0151 * rjt_data field will contain valid data. 0152 * 0153 * Note: x_RJT/BSY status will indicae that the rjt_data field 0154 * is valid and contains the reason/explanation values. 0155 */ 0156 __u32 status; /* See FC_CTELS_STATUS_xxx */ 0157 0158 /* valid if status is not FC_CTELS_STATUS_OK */ 0159 struct { 0160 __u8 action; /* fragment_id for CT REJECT */ 0161 __u8 reason_code; 0162 __u8 reason_explanation; 0163 __u8 vendor_unique; 0164 } rjt_data; 0165 }; 0166 0167 0168 /* FC_BSG_HST_CT : */ 0169 0170 /* Request: 0171 * This message requests that a CT Request be performed with the 0172 * indicated N_Port_ID. The driver is responsible for logging in with 0173 * the fabric and/or N_Port_ID, etc as per FC rules. This request does 0174 * not mandate that the driver must enumerate the destination in the 0175 * transport. The driver is allowed to decide whether to enumerate it, 0176 * and whether to tear it down after the request. 0177 */ 0178 struct fc_bsg_host_ct { 0179 __u8 reserved; 0180 0181 /* FC Address Identier of the remote port to send the ELS to */ 0182 __u8 port_id[3]; 0183 0184 /* 0185 * We need words 0-2 of the generic preamble for the LLD's 0186 */ 0187 __u32 preamble_word0; /* revision & IN_ID */ 0188 __u32 preamble_word1; /* GS_Type, GS_SubType, Options, Rsvd */ 0189 __u32 preamble_word2; /* Cmd Code, Max Size */ 0190 0191 }; 0192 /* Response: 0193 * 0194 * The reply structure is an fc_bsg_ctels_reply structure 0195 */ 0196 0197 0198 /* FC_BSG_HST_VENDOR : */ 0199 0200 /* Request: 0201 * Note: When specifying vendor_id, be sure to read the Vendor Type and ID 0202 * formatting requirements specified in scsi_netlink.h 0203 */ 0204 struct fc_bsg_host_vendor { 0205 /* 0206 * Identifies the vendor that the message is formatted for. This 0207 * should be the recipient of the message. 0208 */ 0209 __u64 vendor_id; 0210 0211 /* start of vendor command area */ 0212 __u32 vendor_cmd[]; 0213 }; 0214 0215 /* Response: 0216 */ 0217 struct fc_bsg_host_vendor_reply { 0218 /* start of vendor response area */ 0219 __u32 vendor_rsp[0]; 0220 }; 0221 0222 0223 0224 /* 0225 * FC Remote Port Messages 0226 */ 0227 0228 /* FC_BSG_RPT_ELS : */ 0229 0230 /* Request: 0231 * This message requests that an ELS be performed with the rport. 0232 */ 0233 struct fc_bsg_rport_els { 0234 /* 0235 * ELS Command Code being sent (must be the same as 0236 * byte 0 of the payload) 0237 */ 0238 __u8 els_code; 0239 }; 0240 0241 /* Response: 0242 * 0243 * The reply structure is an fc_bsg_ctels_reply structure 0244 */ 0245 0246 0247 /* FC_BSG_RPT_CT : */ 0248 0249 /* Request: 0250 * This message requests that a CT Request be performed with the rport. 0251 */ 0252 struct fc_bsg_rport_ct { 0253 /* 0254 * We need words 0-2 of the generic preamble for the LLD's 0255 */ 0256 __u32 preamble_word0; /* revision & IN_ID */ 0257 __u32 preamble_word1; /* GS_Type, GS_SubType, Options, Rsvd */ 0258 __u32 preamble_word2; /* Cmd Code, Max Size */ 0259 }; 0260 /* Response: 0261 * 0262 * The reply structure is an fc_bsg_ctels_reply structure 0263 */ 0264 0265 0266 0267 0268 /* request (CDB) structure of the sg_io_v4 */ 0269 struct fc_bsg_request { 0270 __u32 msgcode; 0271 union { 0272 struct fc_bsg_host_add_rport h_addrport; 0273 struct fc_bsg_host_del_rport h_delrport; 0274 struct fc_bsg_host_els h_els; 0275 struct fc_bsg_host_ct h_ct; 0276 struct fc_bsg_host_vendor h_vendor; 0277 0278 struct fc_bsg_rport_els r_els; 0279 struct fc_bsg_rport_ct r_ct; 0280 } rqst_data; 0281 } __attribute__((packed)); 0282 0283 0284 /* response (request sense data) structure of the sg_io_v4 */ 0285 struct fc_bsg_reply { 0286 /* 0287 * The completion result. Result exists in two forms: 0288 * if negative, it is an -Exxx system errno value. There will 0289 * be no further reply information supplied. 0290 * else, it's the 4-byte scsi error result, with driver, host, 0291 * msg and status fields. The per-msgcode reply structure 0292 * will contain valid data. 0293 */ 0294 __u32 result; 0295 0296 /* If there was reply_payload, how much was recevied ? */ 0297 __u32 reply_payload_rcv_len; 0298 0299 union { 0300 struct fc_bsg_host_vendor_reply vendor_reply; 0301 0302 struct fc_bsg_ctels_reply ctels_reply; 0303 } reply_data; 0304 }; 0305 0306 0307 #endif /* SCSI_BSG_FC_H */ 0308
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.1.0 LXR engine. The LXR team |
![]() ![]() |