![]() |
|
|||
0001 /* SPDX-License-Identifier: GPL-2.0 */ 0002 /* 0003 * Copyright (c) 2016, Avago Technologies 0004 */ 0005 0006 #ifndef _NVME_FC_DRIVER_H 0007 #define _NVME_FC_DRIVER_H 1 0008 0009 #include <linux/scatterlist.h> 0010 #include <linux/blk-mq.h> 0011 0012 0013 /* 0014 * ********************** FC-NVME LS API ******************** 0015 * 0016 * Data structures used by both FC-NVME hosts and FC-NVME 0017 * targets to perform FC-NVME LS requests or transmit 0018 * responses. 0019 * 0020 * *********************************************************** 0021 */ 0022 0023 /** 0024 * struct nvmefc_ls_req - Request structure passed from the transport 0025 * to the LLDD to perform a NVME-FC LS request and obtain 0026 * a response. 0027 * Used by nvme-fc transport (host) to send LS's such as 0028 * Create Association, Create Connection and Disconnect 0029 * Association. 0030 * Used by the nvmet-fc transport (controller) to send 0031 * LS's such as Disconnect Association. 0032 * 0033 * Values set by the requestor prior to calling the LLDD ls_req entrypoint: 0034 * @rqstaddr: pointer to request buffer 0035 * @rqstdma: PCI DMA address of request buffer 0036 * @rqstlen: Length, in bytes, of request buffer 0037 * @rspaddr: pointer to response buffer 0038 * @rspdma: PCI DMA address of response buffer 0039 * @rsplen: Length, in bytes, of response buffer 0040 * @timeout: Maximum amount of time, in seconds, to wait for the LS response. 0041 * If timeout exceeded, LLDD to abort LS exchange and complete 0042 * LS request with error status. 0043 * @private: pointer to memory allocated alongside the ls request structure 0044 * that is specifically for the LLDD to use while processing the 0045 * request. The length of the buffer corresponds to the 0046 * lsrqst_priv_sz value specified in the xxx_template supplied 0047 * by the LLDD. 0048 * @done: The callback routine the LLDD is to invoke upon completion of 0049 * the LS request. req argument is the pointer to the original LS 0050 * request structure. Status argument must be 0 upon success, a 0051 * negative errno on failure (example: -ENXIO). 0052 */ 0053 struct nvmefc_ls_req { 0054 void *rqstaddr; 0055 dma_addr_t rqstdma; 0056 u32 rqstlen; 0057 void *rspaddr; 0058 dma_addr_t rspdma; 0059 u32 rsplen; 0060 u32 timeout; 0061 0062 void *private; 0063 0064 void (*done)(struct nvmefc_ls_req *req, int status); 0065 0066 } __aligned(sizeof(u64)); /* alignment for other things alloc'd with */ 0067 0068 0069 /** 0070 * struct nvmefc_ls_rsp - Structure passed from the transport to the LLDD 0071 * to request the transmit the NVME-FC LS response to a 0072 * NVME-FC LS request. The structure originates in the LLDD 0073 * and is given to the transport via the xxx_rcv_ls_req() 0074 * transport routine. As such, the structure represents the 0075 * FC exchange context for the NVME-FC LS request that was 0076 * received and which the response is to be sent for. 0077 * Used by the LLDD to pass the nvmet-fc transport (controller) 0078 * received LS's such as Create Association, Create Connection 0079 * and Disconnect Association. 0080 * Used by the LLDD to pass the nvme-fc transport (host) 0081 * received LS's such as Disconnect Association or Disconnect 0082 * Connection. 0083 * 0084 * The structure is allocated by the LLDD whenever a LS Request is received 0085 * from the FC link. The address of the structure is passed to the nvmet-fc 0086 * or nvme-fc layer via the xxx_rcv_ls_req() transport routines. 0087 * 0088 * The address of the structure is to be passed back to the LLDD 0089 * when the response is to be transmit. The LLDD will use the address to 0090 * map back to the LLDD exchange structure which maintains information such 0091 * the remote N_Port that sent the LS as well as any FC exchange context. 0092 * Upon completion of the LS response transmit, the LLDD will pass the 0093 * address of the structure back to the transport LS rsp done() routine, 0094 * allowing the transport release dma resources. Upon completion of 0095 * the done() routine, no further access to the structure will be made by 0096 * the transport and the LLDD can de-allocate the structure. 0097 * 0098 * Field initialization: 0099 * At the time of the xxx_rcv_ls_req() call, there is no content that 0100 * is valid in the structure. 0101 * 0102 * When the structure is used for the LLDD->xmt_ls_rsp() call, the 0103 * transport layer will fully set the fields in order to specify the 0104 * response payload buffer and its length as well as the done routine 0105 * to be called upon completion of the transmit. The transport layer 0106 * will also set a private pointer for its own use in the done routine. 0107 * 0108 * Values set by the transport layer prior to calling the LLDD xmt_ls_rsp 0109 * entrypoint: 0110 * @rspbuf: pointer to the LS response buffer 0111 * @rspdma: PCI DMA address of the LS response buffer 0112 * @rsplen: Length, in bytes, of the LS response buffer 0113 * @done: The callback routine the LLDD is to invoke upon completion of 0114 * transmitting the LS response. req argument is the pointer to 0115 * the original ls request. 0116 * @nvme_fc_private: pointer to an internal transport-specific structure 0117 * used as part of the transport done() processing. The LLDD is 0118 * not to access this pointer. 0119 */ 0120 struct nvmefc_ls_rsp { 0121 void *rspbuf; 0122 dma_addr_t rspdma; 0123 u16 rsplen; 0124 0125 void (*done)(struct nvmefc_ls_rsp *rsp); 0126 void *nvme_fc_private; /* LLDD is not to access !! */ 0127 }; 0128 0129 0130 0131 /* 0132 * ********************** LLDD FC-NVME Host API ******************** 0133 * 0134 * For FC LLDD's that are the NVME Host role. 0135 * 0136 * ****************************************************************** 0137 */ 0138 0139 0140 /** 0141 * struct nvme_fc_port_info - port-specific ids and FC connection-specific 0142 * data element used during NVME Host role 0143 * registrations 0144 * 0145 * Static fields describing the port being registered: 0146 * @node_name: FC WWNN for the port 0147 * @port_name: FC WWPN for the port 0148 * @port_role: What NVME roles are supported (see FC_PORT_ROLE_xxx) 0149 * @dev_loss_tmo: maximum delay for reconnects to an association on 0150 * this device. Used only on a remoteport. 0151 * 0152 * Initialization values for dynamic port fields: 0153 * @port_id: FC N_Port_ID currently assigned the port. Upper 8 bits must 0154 * be set to 0. 0155 */ 0156 struct nvme_fc_port_info { 0157 u64 node_name; 0158 u64 port_name; 0159 u32 port_role; 0160 u32 port_id; 0161 u32 dev_loss_tmo; 0162 }; 0163 0164 enum nvmefc_fcp_datadir { 0165 NVMEFC_FCP_NODATA, /* payload_length and sg_cnt will be zero */ 0166 NVMEFC_FCP_WRITE, 0167 NVMEFC_FCP_READ, 0168 }; 0169 0170 0171 /** 0172 * struct nvmefc_fcp_req - Request structure passed from NVME-FC transport 0173 * to LLDD in order to perform a NVME FCP IO operation. 0174 * 0175 * Values set by the NVME-FC layer prior to calling the LLDD fcp_io 0176 * entrypoint. 0177 * @cmdaddr: pointer to the FCP CMD IU buffer 0178 * @rspaddr: pointer to the FCP RSP IU buffer 0179 * @cmddma: PCI DMA address of the FCP CMD IU buffer 0180 * @rspdma: PCI DMA address of the FCP RSP IU buffer 0181 * @cmdlen: Length, in bytes, of the FCP CMD IU buffer 0182 * @rsplen: Length, in bytes, of the FCP RSP IU buffer 0183 * @payload_length: Length of DATA_IN or DATA_OUT payload data to transfer 0184 * @sg_table: scatter/gather structure for payload data 0185 * @first_sgl: memory for 1st scatter/gather list segment for payload data 0186 * @sg_cnt: number of elements in the scatter/gather list 0187 * @io_dir: direction of the FCP request (see NVMEFC_FCP_xxx) 0188 * @sqid: The nvme SQID the command is being issued on 0189 * @done: The callback routine the LLDD is to invoke upon completion of 0190 * the FCP operation. req argument is the pointer to the original 0191 * FCP IO operation. 0192 * @private: pointer to memory allocated alongside the FCP operation 0193 * request structure that is specifically for the LLDD to use 0194 * while processing the operation. The length of the buffer 0195 * corresponds to the fcprqst_priv_sz value specified in the 0196 * nvme_fc_port_template supplied by the LLDD. 0197 * 0198 * Values set by the LLDD indicating completion status of the FCP operation. 0199 * Must be set prior to calling the done() callback. 0200 * @transferred_length: amount of payload data, in bytes, that were 0201 * transferred. Should equal payload_length on success. 0202 * @rcv_rsplen: length, in bytes, of the FCP RSP IU received. 0203 * @status: Completion status of the FCP operation. must be 0 upon success, 0204 * negative errno value upon failure (ex: -EIO). Note: this is 0205 * NOT a reflection of the NVME CQE completion status. Only the 0206 * status of the FCP operation at the NVME-FC level. 0207 */ 0208 struct nvmefc_fcp_req { 0209 void *cmdaddr; 0210 void *rspaddr; 0211 dma_addr_t cmddma; 0212 dma_addr_t rspdma; 0213 u16 cmdlen; 0214 u16 rsplen; 0215 0216 u32 payload_length; 0217 struct sg_table sg_table; 0218 struct scatterlist *first_sgl; 0219 int sg_cnt; 0220 enum nvmefc_fcp_datadir io_dir; 0221 0222 __le16 sqid; 0223 0224 void (*done)(struct nvmefc_fcp_req *req); 0225 0226 void *private; 0227 0228 u32 transferred_length; 0229 u16 rcv_rsplen; 0230 u32 status; 0231 } __aligned(sizeof(u64)); /* alignment for other things alloc'd with */ 0232 0233 0234 /* 0235 * Direct copy of fc_port_state enum. For later merging 0236 */ 0237 enum nvme_fc_obj_state { 0238 FC_OBJSTATE_UNKNOWN, 0239 FC_OBJSTATE_NOTPRESENT, 0240 FC_OBJSTATE_ONLINE, 0241 FC_OBJSTATE_OFFLINE, /* User has taken Port Offline */ 0242 FC_OBJSTATE_BLOCKED, 0243 FC_OBJSTATE_BYPASSED, 0244 FC_OBJSTATE_DIAGNOSTICS, 0245 FC_OBJSTATE_LINKDOWN, 0246 FC_OBJSTATE_ERROR, 0247 FC_OBJSTATE_LOOPBACK, 0248 FC_OBJSTATE_DELETED, 0249 }; 0250 0251 0252 /** 0253 * struct nvme_fc_local_port - structure used between NVME-FC transport and 0254 * a LLDD to reference a local NVME host port. 0255 * Allocated/created by the nvme_fc_register_localport() 0256 * transport interface. 0257 * 0258 * Fields with static values for the port. Initialized by the 0259 * port_info struct supplied to the registration call. 0260 * @port_num: NVME-FC transport host port number 0261 * @port_role: NVME roles are supported on the port (see FC_PORT_ROLE_xxx) 0262 * @node_name: FC WWNN for the port 0263 * @port_name: FC WWPN for the port 0264 * @private: pointer to memory allocated alongside the local port 0265 * structure that is specifically for the LLDD to use. 0266 * The length of the buffer corresponds to the local_priv_sz 0267 * value specified in the nvme_fc_port_template supplied by 0268 * the LLDD. 0269 * @dev_loss_tmo: maximum delay for reconnects to an association on 0270 * this device. To modify, lldd must call 0271 * nvme_fc_set_remoteport_devloss(). 0272 * 0273 * Fields with dynamic values. Values may change base on link state. LLDD 0274 * may reference fields directly to change them. Initialized by the 0275 * port_info struct supplied to the registration call. 0276 * @port_id: FC N_Port_ID currently assigned the port. Upper 8 bits must 0277 * be set to 0. 0278 * @port_state: Operational state of the port. 0279 */ 0280 struct nvme_fc_local_port { 0281 /* static/read-only fields */ 0282 u32 port_num; 0283 u32 port_role; 0284 u64 node_name; 0285 u64 port_name; 0286 0287 void *private; 0288 0289 /* dynamic fields */ 0290 u32 port_id; 0291 enum nvme_fc_obj_state port_state; 0292 } __aligned(sizeof(u64)); /* alignment for other things alloc'd with */ 0293 0294 0295 /** 0296 * struct nvme_fc_remote_port - structure used between NVME-FC transport and 0297 * a LLDD to reference a remote NVME subsystem port. 0298 * Allocated/created by the nvme_fc_register_remoteport() 0299 * transport interface. 0300 * 0301 * Fields with static values for the port. Initialized by the 0302 * port_info struct supplied to the registration call. 0303 * @port_num: NVME-FC transport remote subsystem port number 0304 * @port_role: NVME roles are supported on the port (see FC_PORT_ROLE_xxx) 0305 * @node_name: FC WWNN for the port 0306 * @port_name: FC WWPN for the port 0307 * @localport: pointer to the NVME-FC local host port the subsystem is 0308 * connected to. 0309 * @private: pointer to memory allocated alongside the remote port 0310 * structure that is specifically for the LLDD to use. 0311 * The length of the buffer corresponds to the remote_priv_sz 0312 * value specified in the nvme_fc_port_template supplied by 0313 * the LLDD. 0314 * 0315 * Fields with dynamic values. Values may change base on link or login 0316 * state. LLDD may reference fields directly to change them. Initialized by 0317 * the port_info struct supplied to the registration call. 0318 * @port_id: FC N_Port_ID currently assigned the port. Upper 8 bits must 0319 * be set to 0. 0320 * @port_state: Operational state of the remote port. Valid values are 0321 * ONLINE or UNKNOWN. 0322 */ 0323 struct nvme_fc_remote_port { 0324 /* static fields */ 0325 u32 port_num; 0326 u32 port_role; 0327 u64 node_name; 0328 u64 port_name; 0329 struct nvme_fc_local_port *localport; 0330 void *private; 0331 u32 dev_loss_tmo; 0332 0333 /* dynamic fields */ 0334 u32 port_id; 0335 enum nvme_fc_obj_state port_state; 0336 } __aligned(sizeof(u64)); /* alignment for other things alloc'd with */ 0337 0338 0339 /** 0340 * struct nvme_fc_port_template - structure containing static entrypoints and 0341 * operational parameters for an LLDD that supports NVME host 0342 * behavior. Passed by reference in port registrations. 0343 * NVME-FC transport remembers template reference and may 0344 * access it during runtime operation. 0345 * 0346 * Host/Initiator Transport Entrypoints/Parameters: 0347 * 0348 * @localport_delete: The LLDD initiates deletion of a localport via 0349 * nvme_fc_deregister_localport(). However, the teardown is 0350 * asynchronous. This routine is called upon the completion of the 0351 * teardown to inform the LLDD that the localport has been deleted. 0352 * Entrypoint is Mandatory. 0353 * 0354 * @remoteport_delete: The LLDD initiates deletion of a remoteport via 0355 * nvme_fc_deregister_remoteport(). However, the teardown is 0356 * asynchronous. This routine is called upon the completion of the 0357 * teardown to inform the LLDD that the remoteport has been deleted. 0358 * Entrypoint is Mandatory. 0359 * 0360 * @create_queue: Upon creating a host<->controller association, queues are 0361 * created such that they can be affinitized to cpus/cores. This 0362 * callback into the LLDD to notify that a controller queue is being 0363 * created. The LLDD may choose to allocate an associated hw queue 0364 * or map it onto a shared hw queue. Upon return from the call, the 0365 * LLDD specifies a handle that will be given back to it for any 0366 * command that is posted to the controller queue. The handle can 0367 * be used by the LLDD to map quickly to the proper hw queue for 0368 * command execution. The mask of cpu's that will map to this queue 0369 * at the block-level is also passed in. The LLDD should use the 0370 * queue id and/or cpu masks to ensure proper affinitization of the 0371 * controller queue to the hw queue. 0372 * Entrypoint is Optional. 0373 * 0374 * @delete_queue: This is the inverse of the crete_queue. During 0375 * host<->controller association teardown, this routine is called 0376 * when a controller queue is being terminated. Any association with 0377 * a hw queue should be termined. If there is a unique hw queue, the 0378 * hw queue should be torn down. 0379 * Entrypoint is Optional. 0380 * 0381 * @poll_queue: Called to poll for the completion of an io on a blk queue. 0382 * Entrypoint is Optional. 0383 * 0384 * @ls_req: Called to issue a FC-NVME FC-4 LS service request. 0385 * The nvme_fc_ls_req structure will fully describe the buffers for 0386 * the request payload and where to place the response payload. The 0387 * LLDD is to allocate an exchange, issue the LS request, obtain the 0388 * LS response, and call the "done" routine specified in the request 0389 * structure (argument to done is the ls request structure itself). 0390 * Entrypoint is Mandatory. 0391 * 0392 * @fcp_io: called to issue a FC-NVME I/O request. The I/O may be for 0393 * an admin queue or an i/o queue. The nvmefc_fcp_req structure will 0394 * fully describe the io: the buffer containing the FC-NVME CMD IU 0395 * (which contains the SQE), the sg list for the payload if applicable, 0396 * and the buffer to place the FC-NVME RSP IU into. The LLDD will 0397 * complete the i/o, indicating the amount of data transferred or 0398 * any transport error, and call the "done" routine specified in the 0399 * request structure (argument to done is the fcp request structure 0400 * itself). 0401 * Entrypoint is Mandatory. 0402 * 0403 * @ls_abort: called to request the LLDD to abort the indicated ls request. 0404 * The call may return before the abort has completed. After aborting 0405 * the request, the LLDD must still call the ls request done routine 0406 * indicating an FC transport Aborted status. 0407 * Entrypoint is Mandatory. 0408 * 0409 * @fcp_abort: called to request the LLDD to abort the indicated fcp request. 0410 * The call may return before the abort has completed. After aborting 0411 * the request, the LLDD must still call the fcp request done routine 0412 * indicating an FC transport Aborted status. 0413 * Entrypoint is Mandatory. 0414 * 0415 * @xmt_ls_rsp: Called to transmit the response to a FC-NVME FC-4 LS service. 0416 * The nvmefc_ls_rsp structure is the same LLDD-supplied exchange 0417 * structure specified in the nvme_fc_rcv_ls_req() call made when 0418 * the LS request was received. The structure will fully describe 0419 * the buffers for the response payload and the dma address of the 0420 * payload. The LLDD is to transmit the response (or return a 0421 * non-zero errno status), and upon completion of the transmit, call 0422 * the "done" routine specified in the nvmefc_ls_rsp structure 0423 * (argument to done is the address of the nvmefc_ls_rsp structure 0424 * itself). Upon the completion of the done routine, the LLDD shall 0425 * consider the LS handling complete and the nvmefc_ls_rsp structure 0426 * may be freed/released. 0427 * Entrypoint is mandatory if the LLDD calls the nvme_fc_rcv_ls_req() 0428 * entrypoint. 0429 * 0430 * @max_hw_queues: indicates the maximum number of hw queues the LLDD 0431 * supports for cpu affinitization. 0432 * Value is Mandatory. Must be at least 1. 0433 * 0434 * @max_sgl_segments: indicates the maximum number of sgl segments supported 0435 * by the LLDD 0436 * Value is Mandatory. Must be at least 1. Recommend at least 256. 0437 * 0438 * @max_dif_sgl_segments: indicates the maximum number of sgl segments 0439 * supported by the LLDD for DIF operations. 0440 * Value is Mandatory. Must be at least 1. Recommend at least 256. 0441 * 0442 * @dma_boundary: indicates the dma address boundary where dma mappings 0443 * will be split across. 0444 * Value is Mandatory. Typical value is 0xFFFFFFFF to split across 0445 * 4Gig address boundarys 0446 * 0447 * @local_priv_sz: The LLDD sets this field to the amount of additional 0448 * memory that it would like fc nvme layer to allocate on the LLDD's 0449 * behalf whenever a localport is allocated. The additional memory 0450 * area solely for the of the LLDD and its location is specified by 0451 * the localport->private pointer. 0452 * Value is Mandatory. Allowed to be zero. 0453 * 0454 * @remote_priv_sz: The LLDD sets this field to the amount of additional 0455 * memory that it would like fc nvme layer to allocate on the LLDD's 0456 * behalf whenever a remoteport is allocated. The additional memory 0457 * area solely for the of the LLDD and its location is specified by 0458 * the remoteport->private pointer. 0459 * Value is Mandatory. Allowed to be zero. 0460 * 0461 * @lsrqst_priv_sz: The LLDD sets this field to the amount of additional 0462 * memory that it would like fc nvme layer to allocate on the LLDD's 0463 * behalf whenever a ls request structure is allocated. The additional 0464 * memory area is solely for use by the LLDD and its location is 0465 * specified by the ls_request->private pointer. 0466 * Value is Mandatory. Allowed to be zero. 0467 * 0468 * @fcprqst_priv_sz: The LLDD sets this field to the amount of additional 0469 * memory that it would like fc nvme layer to allocate on the LLDD's 0470 * behalf whenever a fcp request structure is allocated. The additional 0471 * memory area solely for the of the LLDD and its location is 0472 * specified by the fcp_request->private pointer. 0473 * Value is Mandatory. Allowed to be zero. 0474 */ 0475 struct nvme_fc_port_template { 0476 /* initiator-based functions */ 0477 void (*localport_delete)(struct nvme_fc_local_port *); 0478 void (*remoteport_delete)(struct nvme_fc_remote_port *); 0479 int (*create_queue)(struct nvme_fc_local_port *, 0480 unsigned int qidx, u16 qsize, 0481 void **handle); 0482 void (*delete_queue)(struct nvme_fc_local_port *, 0483 unsigned int qidx, void *handle); 0484 int (*ls_req)(struct nvme_fc_local_port *, 0485 struct nvme_fc_remote_port *, 0486 struct nvmefc_ls_req *); 0487 int (*fcp_io)(struct nvme_fc_local_port *, 0488 struct nvme_fc_remote_port *, 0489 void *hw_queue_handle, 0490 struct nvmefc_fcp_req *); 0491 void (*ls_abort)(struct nvme_fc_local_port *, 0492 struct nvme_fc_remote_port *, 0493 struct nvmefc_ls_req *); 0494 void (*fcp_abort)(struct nvme_fc_local_port *, 0495 struct nvme_fc_remote_port *, 0496 void *hw_queue_handle, 0497 struct nvmefc_fcp_req *); 0498 int (*xmt_ls_rsp)(struct nvme_fc_local_port *localport, 0499 struct nvme_fc_remote_port *rport, 0500 struct nvmefc_ls_rsp *ls_rsp); 0501 void (*map_queues)(struct nvme_fc_local_port *localport, 0502 struct blk_mq_queue_map *map); 0503 0504 u32 max_hw_queues; 0505 u16 max_sgl_segments; 0506 u16 max_dif_sgl_segments; 0507 u64 dma_boundary; 0508 0509 /* sizes of additional private data for data structures */ 0510 u32 local_priv_sz; 0511 u32 remote_priv_sz; 0512 u32 lsrqst_priv_sz; 0513 u32 fcprqst_priv_sz; 0514 }; 0515 0516 0517 /* 0518 * Initiator/Host functions 0519 */ 0520 0521 int nvme_fc_register_localport(struct nvme_fc_port_info *pinfo, 0522 struct nvme_fc_port_template *template, 0523 struct device *dev, 0524 struct nvme_fc_local_port **lport_p); 0525 0526 int nvme_fc_unregister_localport(struct nvme_fc_local_port *localport); 0527 0528 int nvme_fc_register_remoteport(struct nvme_fc_local_port *localport, 0529 struct nvme_fc_port_info *pinfo, 0530 struct nvme_fc_remote_port **rport_p); 0531 0532 int nvme_fc_unregister_remoteport(struct nvme_fc_remote_port *remoteport); 0533 0534 void nvme_fc_rescan_remoteport(struct nvme_fc_remote_port *remoteport); 0535 0536 int nvme_fc_set_remoteport_devloss(struct nvme_fc_remote_port *remoteport, 0537 u32 dev_loss_tmo); 0538 0539 /* 0540 * Routine called to pass a NVME-FC LS request, received by the lldd, 0541 * to the nvme-fc transport. 0542 * 0543 * If the return value is zero: the LS was successfully accepted by the 0544 * transport. 0545 * If the return value is non-zero: the transport has not accepted the 0546 * LS. The lldd should ABTS-LS the LS. 0547 * 0548 * Note: if the LLDD receives and ABTS for the LS prior to the transport 0549 * calling the ops->xmt_ls_rsp() routine to transmit a response, the LLDD 0550 * shall mark the LS as aborted, and when the xmt_ls_rsp() is called: the 0551 * response shall not be transmit and the struct nvmefc_ls_rsp() done 0552 * routine shall be called. The LLDD may transmit the ABTS response as 0553 * soon as the LS was marked or can delay until the xmt_ls_rsp() call is 0554 * made. 0555 * Note: if an RCV LS was successfully posted to the transport and the 0556 * remoteport is then unregistered before xmt_ls_rsp() was called for 0557 * the lsrsp structure, the transport will still call xmt_ls_rsp() 0558 * afterward to cleanup the outstanding lsrsp structure. The LLDD should 0559 * noop the transmission of the rsp and call the lsrsp->done() routine 0560 * to allow the lsrsp structure to be released. 0561 */ 0562 int nvme_fc_rcv_ls_req(struct nvme_fc_remote_port *remoteport, 0563 struct nvmefc_ls_rsp *lsrsp, 0564 void *lsreqbuf, u32 lsreqbuf_len); 0565 0566 0567 /* 0568 * Routine called to get the appid field associated with request by the lldd 0569 * 0570 * If the return value is NULL : the user/libvirt has not set the appid to VM 0571 * If the return value is non-zero: Returns the appid associated with VM 0572 * 0573 * @req: IO request from nvme fc to driver 0574 */ 0575 char *nvme_fc_io_getuuid(struct nvmefc_fcp_req *req); 0576 0577 /* 0578 * *************** LLDD FC-NVME Target/Subsystem API *************** 0579 * 0580 * For FC LLDD's that are the NVME Subsystem role 0581 * 0582 * ****************************************************************** 0583 */ 0584 0585 /** 0586 * struct nvmet_fc_port_info - port-specific ids and FC connection-specific 0587 * data element used during NVME Subsystem role 0588 * registrations 0589 * 0590 * Static fields describing the port being registered: 0591 * @node_name: FC WWNN for the port 0592 * @port_name: FC WWPN for the port 0593 * 0594 * Initialization values for dynamic port fields: 0595 * @port_id: FC N_Port_ID currently assigned the port. Upper 8 bits must 0596 * be set to 0. 0597 */ 0598 struct nvmet_fc_port_info { 0599 u64 node_name; 0600 u64 port_name; 0601 u32 port_id; 0602 }; 0603 0604 0605 /* Operations that NVME-FC layer may request the LLDD to perform for FCP */ 0606 enum { 0607 NVMET_FCOP_READDATA = 1, /* xmt data to initiator */ 0608 NVMET_FCOP_WRITEDATA = 2, /* xmt data from initiator */ 0609 NVMET_FCOP_READDATA_RSP = 3, /* xmt data to initiator and send 0610 * rsp as well 0611 */ 0612 NVMET_FCOP_RSP = 4, /* send rsp frame */ 0613 }; 0614 0615 /** 0616 * struct nvmefc_tgt_fcp_req - Structure used between LLDD and NVMET-FC 0617 * layer to represent the exchange context and 0618 * the specific FC-NVME IU operation(s) to perform 0619 * for a FC-NVME FCP IO. 0620 * 0621 * Structure used between LLDD and nvmet-fc layer to represent the exchange 0622 * context for a FC-NVME FCP I/O operation (e.g. a nvme sqe, the sqe-related 0623 * memory transfers, and its assocated cqe transfer). 0624 * 0625 * The structure is allocated by the LLDD whenever a FCP CMD IU is received 0626 * from the FC link. The address of the structure is passed to the nvmet-fc 0627 * layer via the nvmet_fc_rcv_fcp_req() call. The address of the structure 0628 * will be passed back to the LLDD for the data operations and transmit of 0629 * the response. The LLDD is to use the address to map back to the LLDD 0630 * exchange structure which maintains information such as the targetport 0631 * the FCP I/O was received on, the remote FC NVME initiator that sent the 0632 * FCP I/O, and any FC exchange context. Upon completion of the FCP target 0633 * operation, the address of the structure will be passed back to the FCP 0634 * op done() routine, allowing the nvmet-fc layer to release dma resources. 0635 * Upon completion of the done() routine for either RSP or ABORT ops, no 0636 * further access will be made by the nvmet-fc layer and the LLDD can 0637 * de-allocate the structure. 0638 * 0639 * Field initialization: 0640 * At the time of the nvmet_fc_rcv_fcp_req() call, there is no content that 0641 * is valid in the structure. 0642 * 0643 * When the structure is used for an FCP target operation, the nvmet-fc 0644 * layer will fully set the fields in order to specify the scattergather 0645 * list, the transfer length, as well as the done routine to be called 0646 * upon compeletion of the operation. The nvmet-fc layer will also set a 0647 * private pointer for its own use in the done routine. 0648 * 0649 * Values set by the NVMET-FC layer prior to calling the LLDD fcp_op 0650 * entrypoint. 0651 * @op: Indicates the FCP IU operation to perform (see NVMET_FCOP_xxx) 0652 * @hwqid: Specifies the hw queue index (0..N-1, where N is the 0653 * max_hw_queues value from the LLD's nvmet_fc_target_template) 0654 * that the operation is to use. 0655 * @offset: Indicates the DATA_OUT/DATA_IN payload offset to be tranferred. 0656 * Field is only valid on WRITEDATA, READDATA, or READDATA_RSP ops. 0657 * @timeout: amount of time, in seconds, to wait for a response from the NVME 0658 * host. A value of 0 is an infinite wait. 0659 * Valid only for the following ops: 0660 * WRITEDATA: caps the wait for data reception 0661 * READDATA_RSP & RSP: caps wait for FCP_CONF reception (if used) 0662 * @transfer_length: the length, in bytes, of the DATA_OUT or DATA_IN payload 0663 * that is to be transferred. 0664 * Valid only for the WRITEDATA, READDATA, or READDATA_RSP ops. 0665 * @ba_rjt: Contains the BA_RJT payload that is to be transferred. 0666 * Valid only for the NVMET_FCOP_BA_RJT op. 0667 * @sg: Scatter/gather list for the DATA_OUT/DATA_IN payload data. 0668 * Valid only for the WRITEDATA, READDATA, or READDATA_RSP ops. 0669 * @sg_cnt: Number of valid entries in the scatter/gather list. 0670 * Valid only for the WRITEDATA, READDATA, or READDATA_RSP ops. 0671 * @rspaddr: pointer to the FCP RSP IU buffer to be transmit 0672 * Used by RSP and READDATA_RSP ops 0673 * @rspdma: PCI DMA address of the FCP RSP IU buffer 0674 * Used by RSP and READDATA_RSP ops 0675 * @rsplen: Length, in bytes, of the FCP RSP IU buffer 0676 * Used by RSP and READDATA_RSP ops 0677 * @done: The callback routine the LLDD is to invoke upon completion of 0678 * the operation. req argument is the pointer to the original 0679 * FCP subsystem op request. 0680 * @nvmet_fc_private: pointer to an internal NVMET-FC layer structure used 0681 * as part of the NVMET-FC processing. The LLDD is not to 0682 * reference this field. 0683 * 0684 * Values set by the LLDD indicating completion status of the FCP operation. 0685 * Must be set prior to calling the done() callback. 0686 * @transferred_length: amount of DATA_OUT payload data received by a 0687 * WRITEDATA operation. If not a WRITEDATA operation, value must 0688 * be set to 0. Should equal transfer_length on success. 0689 * @fcp_error: status of the FCP operation. Must be 0 on success; on failure 0690 * must be a NVME_SC_FC_xxxx value. 0691 */ 0692 struct nvmefc_tgt_fcp_req { 0693 u8 op; 0694 u16 hwqid; 0695 u32 offset; 0696 u32 timeout; 0697 u32 transfer_length; 0698 struct fc_ba_rjt ba_rjt; 0699 struct scatterlist *sg; 0700 int sg_cnt; 0701 void *rspaddr; 0702 dma_addr_t rspdma; 0703 u16 rsplen; 0704 0705 void (*done)(struct nvmefc_tgt_fcp_req *); 0706 0707 void *nvmet_fc_private; /* LLDD is not to access !! */ 0708 0709 u32 transferred_length; 0710 int fcp_error; 0711 }; 0712 0713 0714 /* Target Features (Bit fields) LLDD supports */ 0715 enum { 0716 NVMET_FCTGTFEAT_READDATA_RSP = (1 << 0), 0717 /* Bit 0: supports the NVMET_FCPOP_READDATA_RSP op, which 0718 * sends (the last) Read Data sequence followed by the RSP 0719 * sequence in one LLDD operation. Errors during Data 0720 * sequence transmit must not allow RSP sequence to be sent. 0721 */ 0722 }; 0723 0724 0725 /** 0726 * struct nvmet_fc_target_port - structure used between NVME-FC transport and 0727 * a LLDD to reference a local NVME subsystem port. 0728 * Allocated/created by the nvme_fc_register_targetport() 0729 * transport interface. 0730 * 0731 * Fields with static values for the port. Initialized by the 0732 * port_info struct supplied to the registration call. 0733 * @port_num: NVME-FC transport subsystem port number 0734 * @node_name: FC WWNN for the port 0735 * @port_name: FC WWPN for the port 0736 * @private: pointer to memory allocated alongside the local port 0737 * structure that is specifically for the LLDD to use. 0738 * The length of the buffer corresponds to the target_priv_sz 0739 * value specified in the nvme_fc_target_template supplied by 0740 * the LLDD. 0741 * 0742 * Fields with dynamic values. Values may change base on link state. LLDD 0743 * may reference fields directly to change them. Initialized by the 0744 * port_info struct supplied to the registration call. 0745 * @port_id: FC N_Port_ID currently assigned the port. Upper 8 bits must 0746 * be set to 0. 0747 * @port_state: Operational state of the port. 0748 */ 0749 struct nvmet_fc_target_port { 0750 /* static/read-only fields */ 0751 u32 port_num; 0752 u64 node_name; 0753 u64 port_name; 0754 0755 void *private; 0756 0757 /* dynamic fields */ 0758 u32 port_id; 0759 enum nvme_fc_obj_state port_state; 0760 } __aligned(sizeof(u64)); /* alignment for other things alloc'd with */ 0761 0762 0763 /** 0764 * struct nvmet_fc_target_template - structure containing static entrypoints 0765 * and operational parameters for an LLDD that supports NVME 0766 * subsystem behavior. Passed by reference in port 0767 * registrations. NVME-FC transport remembers template 0768 * reference and may access it during runtime operation. 0769 * 0770 * Subsystem/Target Transport Entrypoints/Parameters: 0771 * 0772 * @targetport_delete: The LLDD initiates deletion of a targetport via 0773 * nvmet_fc_unregister_targetport(). However, the teardown is 0774 * asynchronous. This routine is called upon the completion of the 0775 * teardown to inform the LLDD that the targetport has been deleted. 0776 * Entrypoint is Mandatory. 0777 * 0778 * @xmt_ls_rsp: Called to transmit the response to a FC-NVME FC-4 LS service. 0779 * The nvmefc_ls_rsp structure is the same LLDD-supplied exchange 0780 * structure specified in the nvmet_fc_rcv_ls_req() call made when 0781 * the LS request was received. The structure will fully describe 0782 * the buffers for the response payload and the dma address of the 0783 * payload. The LLDD is to transmit the response (or return a 0784 * non-zero errno status), and upon completion of the transmit, call 0785 * the "done" routine specified in the nvmefc_ls_rsp structure 0786 * (argument to done is the address of the nvmefc_ls_rsp structure 0787 * itself). Upon the completion of the done() routine, the LLDD shall 0788 * consider the LS handling complete and the nvmefc_ls_rsp structure 0789 * may be freed/released. 0790 * The transport will always call the xmt_ls_rsp() routine for any 0791 * LS received. 0792 * Entrypoint is Mandatory. 0793 * 0794 * @map_queues: This functions lets the driver expose the queue mapping 0795 * to the block layer. 0796 * Entrypoint is Optional. 0797 * 0798 * @fcp_op: Called to perform a data transfer or transmit a response. 0799 * The nvmefc_tgt_fcp_req structure is the same LLDD-supplied 0800 * exchange structure specified in the nvmet_fc_rcv_fcp_req() call 0801 * made when the FCP CMD IU was received. The op field in the 0802 * structure shall indicate the operation for the LLDD to perform 0803 * relative to the io. 0804 * NVMET_FCOP_READDATA operation: the LLDD is to send the 0805 * payload data (described by sglist) to the host in 1 or 0806 * more FC sequences (preferrably 1). Note: the fc-nvme layer 0807 * may call the READDATA operation multiple times for longer 0808 * payloads. 0809 * NVMET_FCOP_WRITEDATA operation: the LLDD is to receive the 0810 * payload data (described by sglist) from the host via 1 or 0811 * more FC sequences (preferrably 1). The LLDD is to generate 0812 * the XFER_RDY IU(s) corresponding to the data being requested. 0813 * Note: the FC-NVME layer may call the WRITEDATA operation 0814 * multiple times for longer payloads. 0815 * NVMET_FCOP_READDATA_RSP operation: the LLDD is to send the 0816 * payload data (described by sglist) to the host in 1 or 0817 * more FC sequences (preferrably 1). If an error occurs during 0818 * payload data transmission, the LLDD is to set the 0819 * nvmefc_tgt_fcp_req fcp_error and transferred_length field, then 0820 * consider the operation complete. On error, the LLDD is to not 0821 * transmit the FCP_RSP iu. If all payload data is transferred 0822 * successfully, the LLDD is to update the nvmefc_tgt_fcp_req 0823 * transferred_length field and may subsequently transmit the 0824 * FCP_RSP iu payload (described by rspbuf, rspdma, rsplen). 0825 * If FCP_CONF is supported, the LLDD is to await FCP_CONF 0826 * reception to confirm the RSP reception by the host. The LLDD 0827 * may retramsit the FCP_RSP iu if necessary per FC-NVME. Upon 0828 * transmission of the FCP_RSP iu if FCP_CONF is not supported, 0829 * or upon success/failure of FCP_CONF if it is supported, the 0830 * LLDD is to set the nvmefc_tgt_fcp_req fcp_error field and 0831 * consider the operation complete. 0832 * NVMET_FCOP_RSP: the LLDD is to transmit the FCP_RSP iu payload 0833 * (described by rspbuf, rspdma, rsplen). If FCP_CONF is 0834 * supported, the LLDD is to await FCP_CONF reception to confirm 0835 * the RSP reception by the host. The LLDD may retramsit the 0836 * FCP_RSP iu if FCP_CONF is not received per FC-NVME. Upon 0837 * transmission of the FCP_RSP iu if FCP_CONF is not supported, 0838 * or upon success/failure of FCP_CONF if it is supported, the 0839 * LLDD is to set the nvmefc_tgt_fcp_req fcp_error field and 0840 * consider the operation complete. 0841 * Upon completing the indicated operation, the LLDD is to set the 0842 * status fields for the operation (tranferred_length and fcp_error 0843 * status) in the request, then call the "done" routine 0844 * indicated in the fcp request. After the operation completes, 0845 * regardless of whether the FCP_RSP iu was successfully transmit, 0846 * the LLDD-supplied exchange structure must remain valid until the 0847 * transport calls the fcp_req_release() callback to return ownership 0848 * of the exchange structure back to the LLDD so that it may be used 0849 * for another fcp command. 0850 * Note: when calling the done routine for READDATA or WRITEDATA 0851 * operations, the fc-nvme layer may immediate convert, in the same 0852 * thread and before returning to the LLDD, the fcp operation to 0853 * the next operation for the fcp io and call the LLDDs fcp_op 0854 * call again. If fields in the fcp request are to be accessed post 0855 * the done call, the LLDD should save their values prior to calling 0856 * the done routine, and inspect the save values after the done 0857 * routine. 0858 * Returns 0 on success, -<errno> on failure (Ex: -EIO) 0859 * Entrypoint is Mandatory. 0860 * 0861 * @fcp_abort: Called by the transport to abort an active command. 0862 * The command may be in-between operations (nothing active in LLDD) 0863 * or may have an active WRITEDATA operation pending. The LLDD is to 0864 * initiate the ABTS process for the command and return from the 0865 * callback. The ABTS does not need to be complete on the command. 0866 * The fcp_abort callback inherently cannot fail. After the 0867 * fcp_abort() callback completes, the transport will wait for any 0868 * outstanding operation (if there was one) to complete, then will 0869 * call the fcp_req_release() callback to return the command's 0870 * exchange context back to the LLDD. 0871 * Entrypoint is Mandatory. 0872 * 0873 * @fcp_req_release: Called by the transport to return a nvmefc_tgt_fcp_req 0874 * to the LLDD after all operations on the fcp operation are complete. 0875 * This may be due to the command completing or upon completion of 0876 * abort cleanup. 0877 * Entrypoint is Mandatory. 0878 * 0879 * @defer_rcv: Called by the transport to signal the LLLD that it has 0880 * begun processing of a previously received NVME CMD IU. The LLDD 0881 * is now free to re-use the rcv buffer associated with the 0882 * nvmefc_tgt_fcp_req. 0883 * Entrypoint is Optional. 0884 * 0885 * @discovery_event: Called by the transport to generate an RSCN 0886 * change notifications to NVME initiators. The RSCN notifications 0887 * should cause the initiator to rescan the discovery controller 0888 * on the targetport. 0889 * 0890 * @ls_req: Called to issue a FC-NVME FC-4 LS service request. 0891 * The nvme_fc_ls_req structure will fully describe the buffers for 0892 * the request payload and where to place the response payload. 0893 * The targetport that is to issue the LS request is identified by 0894 * the targetport argument. The remote port that is to receive the 0895 * LS request is identified by the hosthandle argument. The nvmet-fc 0896 * transport is only allowed to issue FC-NVME LS's on behalf of an 0897 * association that was created prior by a Create Association LS. 0898 * The hosthandle will originate from the LLDD in the struct 0899 * nvmefc_ls_rsp structure for the Create Association LS that 0900 * was delivered to the transport. The transport will save the 0901 * hosthandle as an attribute of the association. If the LLDD 0902 * loses connectivity with the remote port, it must call the 0903 * nvmet_fc_invalidate_host() routine to remove any references to 0904 * the remote port in the transport. 0905 * The LLDD is to allocate an exchange, issue the LS request, obtain 0906 * the LS response, and call the "done" routine specified in the 0907 * request structure (argument to done is the ls request structure 0908 * itself). 0909 * Entrypoint is Optional - but highly recommended. 0910 * 0911 * @ls_abort: called to request the LLDD to abort the indicated ls request. 0912 * The call may return before the abort has completed. After aborting 0913 * the request, the LLDD must still call the ls request done routine 0914 * indicating an FC transport Aborted status. 0915 * Entrypoint is Mandatory if the ls_req entry point is specified. 0916 * 0917 * @host_release: called to inform the LLDD that the request to invalidate 0918 * the host port indicated by the hosthandle has been fully completed. 0919 * No associations exist with the host port and there will be no 0920 * further references to hosthandle. 0921 * Entrypoint is Mandatory if the lldd calls nvmet_fc_invalidate_host(). 0922 * 0923 * @max_hw_queues: indicates the maximum number of hw queues the LLDD 0924 * supports for cpu affinitization. 0925 * Value is Mandatory. Must be at least 1. 0926 * 0927 * @max_sgl_segments: indicates the maximum number of sgl segments supported 0928 * by the LLDD 0929 * Value is Mandatory. Must be at least 1. Recommend at least 256. 0930 * 0931 * @max_dif_sgl_segments: indicates the maximum number of sgl segments 0932 * supported by the LLDD for DIF operations. 0933 * Value is Mandatory. Must be at least 1. Recommend at least 256. 0934 * 0935 * @dma_boundary: indicates the dma address boundary where dma mappings 0936 * will be split across. 0937 * Value is Mandatory. Typical value is 0xFFFFFFFF to split across 0938 * 4Gig address boundarys 0939 * 0940 * @target_features: The LLDD sets bits in this field to correspond to 0941 * optional features that are supported by the LLDD. 0942 * Refer to the NVMET_FCTGTFEAT_xxx values. 0943 * Value is Mandatory. Allowed to be zero. 0944 * 0945 * @target_priv_sz: The LLDD sets this field to the amount of additional 0946 * memory that it would like fc nvme layer to allocate on the LLDD's 0947 * behalf whenever a targetport is allocated. The additional memory 0948 * area solely for the of the LLDD and its location is specified by 0949 * the targetport->private pointer. 0950 * Value is Mandatory. Allowed to be zero. 0951 * 0952 * @lsrqst_priv_sz: The LLDD sets this field to the amount of additional 0953 * memory that it would like nvmet-fc layer to allocate on the LLDD's 0954 * behalf whenever a ls request structure is allocated. The additional 0955 * memory area is solely for use by the LLDD and its location is 0956 * specified by the ls_request->private pointer. 0957 * Value is Mandatory. Allowed to be zero. 0958 * 0959 */ 0960 struct nvmet_fc_target_template { 0961 void (*targetport_delete)(struct nvmet_fc_target_port *tgtport); 0962 int (*xmt_ls_rsp)(struct nvmet_fc_target_port *tgtport, 0963 struct nvmefc_ls_rsp *ls_rsp); 0964 int (*fcp_op)(struct nvmet_fc_target_port *tgtport, 0965 struct nvmefc_tgt_fcp_req *fcpreq); 0966 void (*fcp_abort)(struct nvmet_fc_target_port *tgtport, 0967 struct nvmefc_tgt_fcp_req *fcpreq); 0968 void (*fcp_req_release)(struct nvmet_fc_target_port *tgtport, 0969 struct nvmefc_tgt_fcp_req *fcpreq); 0970 void (*defer_rcv)(struct nvmet_fc_target_port *tgtport, 0971 struct nvmefc_tgt_fcp_req *fcpreq); 0972 void (*discovery_event)(struct nvmet_fc_target_port *tgtport); 0973 int (*ls_req)(struct nvmet_fc_target_port *targetport, 0974 void *hosthandle, struct nvmefc_ls_req *lsreq); 0975 void (*ls_abort)(struct nvmet_fc_target_port *targetport, 0976 void *hosthandle, struct nvmefc_ls_req *lsreq); 0977 void (*host_release)(void *hosthandle); 0978 0979 u32 max_hw_queues; 0980 u16 max_sgl_segments; 0981 u16 max_dif_sgl_segments; 0982 u64 dma_boundary; 0983 0984 u32 target_features; 0985 0986 /* sizes of additional private data for data structures */ 0987 u32 target_priv_sz; 0988 u32 lsrqst_priv_sz; 0989 }; 0990 0991 0992 int nvmet_fc_register_targetport(struct nvmet_fc_port_info *portinfo, 0993 struct nvmet_fc_target_template *template, 0994 struct device *dev, 0995 struct nvmet_fc_target_port **tgtport_p); 0996 0997 int nvmet_fc_unregister_targetport(struct nvmet_fc_target_port *tgtport); 0998 0999 /* 1000 * Routine called to pass a NVME-FC LS request, received by the lldd, 1001 * to the nvmet-fc transport. 1002 * 1003 * If the return value is zero: the LS was successfully accepted by the 1004 * transport. 1005 * If the return value is non-zero: the transport has not accepted the 1006 * LS. The lldd should ABTS-LS the LS. 1007 * 1008 * Note: if the LLDD receives and ABTS for the LS prior to the transport 1009 * calling the ops->xmt_ls_rsp() routine to transmit a response, the LLDD 1010 * shall mark the LS as aborted, and when the xmt_ls_rsp() is called: the 1011 * response shall not be transmit and the struct nvmefc_ls_rsp() done 1012 * routine shall be called. The LLDD may transmit the ABTS response as 1013 * soon as the LS was marked or can delay until the xmt_ls_rsp() call is 1014 * made. 1015 * Note: if an RCV LS was successfully posted to the transport and the 1016 * targetport is then unregistered before xmt_ls_rsp() was called for 1017 * the lsrsp structure, the transport will still call xmt_ls_rsp() 1018 * afterward to cleanup the outstanding lsrsp structure. The LLDD should 1019 * noop the transmission of the rsp and call the lsrsp->done() routine 1020 * to allow the lsrsp structure to be released. 1021 */ 1022 int nvmet_fc_rcv_ls_req(struct nvmet_fc_target_port *tgtport, 1023 void *hosthandle, 1024 struct nvmefc_ls_rsp *rsp, 1025 void *lsreqbuf, u32 lsreqbuf_len); 1026 1027 /* 1028 * Routine called by the LLDD whenever it has a logout or loss of 1029 * connectivity to a NVME-FC host port which there had been active 1030 * NVMe controllers for. The host port is indicated by the 1031 * hosthandle. The hosthandle is given to the nvmet-fc transport 1032 * when a NVME LS was received, typically to create a new association. 1033 * The nvmet-fc transport will cache the hostport value with the 1034 * association for use in LS requests for the association. 1035 * When the LLDD calls this routine, the nvmet-fc transport will 1036 * immediately terminate all associations that were created with 1037 * the hosthandle host port. 1038 * The LLDD, after calling this routine and having control returned, 1039 * must assume the transport may subsequently utilize hosthandle as 1040 * part of sending LS's to terminate the association. The LLDD 1041 * should reject the LS's if they are attempted. 1042 * Once the last association has terminated for the hosthandle host 1043 * port, the nvmet-fc transport will call the ops->host_release() 1044 * callback. As of the callback, the nvmet-fc transport will no 1045 * longer reference hosthandle. 1046 */ 1047 void nvmet_fc_invalidate_host(struct nvmet_fc_target_port *tgtport, 1048 void *hosthandle); 1049 1050 /* 1051 * If nvmet_fc_rcv_fcp_req returns non-zero, the transport has not accepted 1052 * the FCP cmd. The lldd should ABTS-LS the cmd. 1053 */ 1054 int nvmet_fc_rcv_fcp_req(struct nvmet_fc_target_port *tgtport, 1055 struct nvmefc_tgt_fcp_req *fcpreq, 1056 void *cmdiubuf, u32 cmdiubuf_len); 1057 1058 void nvmet_fc_rcv_fcp_abort(struct nvmet_fc_target_port *tgtport, 1059 struct nvmefc_tgt_fcp_req *fcpreq); 1060 /* 1061 * add a define, visible to the compiler, that indicates support 1062 * for feature. Allows for conditional compilation in LLDDs. 1063 */ 1064 #define NVME_FC_FEAT_UUID 0x0001 1065 1066 #endif /* _NVME_FC_DRIVER_H */
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.1.0 LXR engine. The LXR team |
![]() ![]() |