| @@ -10,47 +10,26 @@ · 9 unmodified lines |
| 10 | 10 | |
| 11 | 11 | |
| 12 | 12 | /* |
| 13 | | − * ********************** LLDD FC-NVME Host API ******************** |
| 13 | + * ********************** FC-NVME LS API ******************** |
| 14 | 14 | * |
| 15 | | − * For FC LLDD's that are the NVME Host role. |
| 15 | + * Data structures used by both FC-NVME hosts and FC-NVME |
| 16 | + * targets to perform FC-NVME LS requests or transmit |
| 17 | + * responses. |
| 16 | 18 | * |
| 17 | | − * ****************************************************************** |
| 19 | + * *********************************************************** |
| 18 | 20 | */ |
| 19 | 21 | |
| 20 | | − |
| 21 | | − |
| 22 | 22 | /** |
| 23 | | − * struct nvme_fc_port_info - port-specific ids and FC connection-specific |
| 24 | | − * data element used during NVME Host role |
| 25 | | − * registrations |
| 26 | | − * |
| 27 | | − * Static fields describing the port being registered: |
| 28 | | − * @node_name: FC WWNN for the port |
| 29 | | − * @port_name: FC WWPN for the port |
| 30 | | − * @port_role: What NVME roles are supported (see FC_PORT_ROLE_xxx) |
| 31 | | − * @dev_loss_tmo: maximum delay for reconnects to an association on |
| 32 | | − * this device. Used only on a remoteport. |
| 23 | + * struct nvmefc_ls_req - Request structure passed from the transport |
| 24 | + * to the LLDD to perform a NVME-FC LS request and obtain |
| 25 | + * a response. |
| 26 | + * Used by nvme-fc transport (host) to send LS's such as |
| 27 | + * Create Association, Create Connection and Disconnect |
| 28 | + * Association. |
| 29 | + * Used by the nvmet-fc transport (controller) to send |
| 30 | + * LS's such as Disconnect Association. |
| 33 | 31 | * |
| 34 | | − * Initialization values for dynamic port fields: |
| 35 | | − * @port_id: FC N_Port_ID currently assigned the port. Upper 8 bits must |
| 36 | | − * be set to 0. |
| 37 | | − */ |
| 38 | | −struct nvme_fc_port_info { |
| 39 | | − u64 node_name; |
| 40 | | − u64 port_name; |
| 41 | | − u32 port_role; |
| 42 | | − u32 port_id; |
| 43 | | − u32 dev_loss_tmo; |
| 44 | | −}; |
| 45 | | − |
| 46 | | − |
| 47 | | −/** |
| 48 | | − * struct nvmefc_ls_req - Request structure passed from NVME-FC transport |
| 49 | | − * to LLDD in order to perform a NVME FC-4 LS |
| 50 | | − * request and obtain a response. |
| 51 | | − * |
| 52 | | − * Values set by the NVME-FC layer prior to calling the LLDD ls_req |
| 53 | | − * entrypoint. |
| 32 | + * Values set by the requestor prior to calling the LLDD ls_req entrypoint: |
| 54 | 33 | * @rqstaddr: pointer to request buffer |
| 55 | 34 | * @rqstdma: PCI DMA address of request buffer |
| 56 | 35 | * @rqstlen: Length, in bytes, of request buffer |
| @@ -63,8 +42,8 @@ struct nvme_fc_port_info { · 6 unmodified lines |
| 63 | 42 | * @private: pointer to memory allocated alongside the ls request structure |
| 64 | 43 | * that is specifically for the LLDD to use while processing the |
| 65 | 44 | * request. The length of the buffer corresponds to the |
| 66 | | − * lsrqst_priv_sz value specified in the nvme_fc_port_template |
| 67 | | − * supplied by the LLDD. |
| 45 | + * lsrqst_priv_sz value specified in the xxx_template supplied |
| 46 | + * by the LLDD. |
| 68 | 47 | * @done: The callback routine the LLDD is to invoke upon completion of |
| 69 | 48 | * the LS request. req argument is the pointer to the original LS |
| 70 | 49 | * request structure. Status argument must be 0 upon success, a |
| @@ -86,6 +65,101 @@ struct nvmefc_ls_req { · 15 unmodified lines |
| 86 | 65 | } __aligned(sizeof(u64)); /* alignment for other things alloc'd with */ |
| 87 | 66 | |
| 88 | 67 | |
| 68 | +/** |
| 69 | + * struct nvmefc_ls_rsp - Structure passed from the transport to the LLDD |
| 70 | + * to request the transmit the NVME-FC LS response to a |
| 71 | + * NVME-FC LS request. The structure originates in the LLDD |
| 72 | + * and is given to the transport via the xxx_rcv_ls_req() |
| 73 | + * transport routine. As such, the structure represents the |
| 74 | + * FC exchange context for the NVME-FC LS request that was |
| 75 | + * received and which the response is to be sent for. |
| 76 | + * Used by the LLDD to pass the nvmet-fc transport (controller) |
| 77 | + * received LS's such as Create Association, Create Connection |
| 78 | + * and Disconnect Association. |
| 79 | + * Used by the LLDD to pass the nvme-fc transport (host) |
| 80 | + * received LS's such as Disconnect Association or Disconnect |
| 81 | + * Connection. |
| 82 | + * |
| 83 | + * The structure is allocated by the LLDD whenever a LS Request is received |
| 84 | + * from the FC link. The address of the structure is passed to the nvmet-fc |
| 85 | + * or nvme-fc layer via the xxx_rcv_ls_req() transport routines. |
| 86 | + * |
| 87 | + * The address of the structure is to be passed back to the LLDD |
| 88 | + * when the response is to be transmit. The LLDD will use the address to |
| 89 | + * map back to the LLDD exchange structure which maintains information such |
| 90 | + * the remote N_Port that sent the LS as well as any FC exchange context. |
| 91 | + * Upon completion of the LS response transmit, the LLDD will pass the |
| 92 | + * address of the structure back to the transport LS rsp done() routine, |
| 93 | + * allowing the transport release dma resources. Upon completion of |
| 94 | + * the done() routine, no further access to the structure will be made by |
| 95 | + * the transport and the LLDD can de-allocate the structure. |
| 96 | + * |
| 97 | + * Field initialization: |
| 98 | + * At the time of the xxx_rcv_ls_req() call, there is no content that |
| 99 | + * is valid in the structure. |
| 100 | + * |
| 101 | + * When the structure is used for the LLDD->xmt_ls_rsp() call, the |
| 102 | + * transport layer will fully set the fields in order to specify the |
| 103 | + * response payload buffer and its length as well as the done routine |
| 104 | + * to be called upon completion of the transmit. The transport layer |
| 105 | + * will also set a private pointer for its own use in the done routine. |
| 106 | + * |
| 107 | + * Values set by the transport layer prior to calling the LLDD xmt_ls_rsp |
| 108 | + * entrypoint: |
| 109 | + * @rspbuf: pointer to the LS response buffer |
| 110 | + * @rspdma: PCI DMA address of the LS response buffer |
| 111 | + * @rsplen: Length, in bytes, of the LS response buffer |
| 112 | + * @done: The callback routine the LLDD is to invoke upon completion of |
| 113 | + * transmitting the LS response. req argument is the pointer to |
| 114 | + * the original ls request. |
| 115 | + * @nvme_fc_private: pointer to an internal transport-specific structure |
| 116 | + * used as part of the transport done() processing. The LLDD is |
| 117 | + * not to access this pointer. |
| 118 | + */ |
| 119 | +struct nvmefc_ls_rsp { |
| 120 | + void *rspbuf; |
| 121 | + dma_addr_t rspdma; |
| 122 | + u16 rsplen; |
| 123 | + |
| 124 | + void (*done)(struct nvmefc_ls_rsp *rsp); |
| 125 | + void *nvme_fc_private; /* LLDD is not to access !! */ |
| 126 | +}; |
| 127 | + |
| 128 | + |
| 129 | + |
| 130 | +/* |
| 131 | + * ********************** LLDD FC-NVME Host API ******************** |
| 132 | + * |
| 133 | + * For FC LLDD's that are the NVME Host role. |
| 134 | + * |
| 135 | + * ****************************************************************** |
| 136 | + */ |
| 137 | + |
| 138 | + |
| 139 | +/** |
| 140 | + * struct nvme_fc_port_info - port-specific ids and FC connection-specific |
| 141 | + * data element used during NVME Host role |
| 142 | + * registrations |
| 143 | + * |
| 144 | + * Static fields describing the port being registered: |
| 145 | + * @node_name: FC WWNN for the port |
| 146 | + * @port_name: FC WWPN for the port |
| 147 | + * @port_role: What NVME roles are supported (see FC_PORT_ROLE_xxx) |
| 148 | + * @dev_loss_tmo: maximum delay for reconnects to an association on |
| 149 | + * this device. Used only on a remoteport. |
| 150 | + * |
| 151 | + * Initialization values for dynamic port fields: |
| 152 | + * @port_id: FC N_Port_ID currently assigned the port. Upper 8 bits must |
| 153 | + * be set to 0. |
| 154 | + */ |
| 155 | +struct nvme_fc_port_info { |
| 156 | + u64 node_name; |
| 157 | + u64 port_name; |
| 158 | + u32 port_role; |
| 159 | + u32 port_id; |
| 160 | + u32 dev_loss_tmo; |
| 161 | +}; |
| 162 | + |
| 89 | 163 | enum nvmefc_fcp_datadir { |
| 90 | 164 | NVMEFC_FCP_NODATA, /* payload_length and sg_cnt will be zero */ |
| 91 | 165 | NVMEFC_FCP_WRITE, |
| @@ -337,6 +411,21 @@ struct nvme_fc_remote_port { · 245 unmodified lines |
| 337 | 411 | * indicating an FC transport Aborted status. |
| 338 | 412 | * Entrypoint is Mandatory. |
| 339 | 413 | * |
| 414 | + * @xmt_ls_rsp: Called to transmit the response to a FC-NVME FC-4 LS service. |
| 415 | + * The nvmefc_ls_rsp structure is the same LLDD-supplied exchange |
| 416 | + * structure specified in the nvme_fc_rcv_ls_req() call made when |
| 417 | + * the LS request was received. The structure will fully describe |
| 418 | + * the buffers for the response payload and the dma address of the |
| 419 | + * payload. The LLDD is to transmit the response (or return a |
| 420 | + * non-zero errno status), and upon completion of the transmit, call |
| 421 | + * the "done" routine specified in the nvmefc_ls_rsp structure |
| 422 | + * (argument to done is the address of the nvmefc_ls_rsp structure |
| 423 | + * itself). Upon the completion of the done routine, the LLDD shall |
| 424 | + * consider the LS handling complete and the nvmefc_ls_rsp structure |
| 425 | + * may be freed/released. |
| 426 | + * Entrypoint is mandatory if the LLDD calls the nvme_fc_rcv_ls_req() |
| 427 | + * entrypoint. |
| 428 | + * |
| 340 | 429 | * @max_hw_queues: indicates the maximum number of hw queues the LLDD |
| 341 | 430 | * supports for cpu affinitization. |
| 342 | 431 | * Value is Mandatory. Must be at least 1. |
| @@ -371,7 +460,7 @@ struct nvme_fc_remote_port { · 28 unmodified lines |
| 371 | 460 | * @lsrqst_priv_sz: The LLDD sets this field to the amount of additional |
| 372 | 461 | * memory that it would like fc nvme layer to allocate on the LLDD's |
| 373 | 462 | * behalf whenever a ls request structure is allocated. The additional |
| 374 | | − * memory area solely for the of the LLDD and its location is |
| 463 | + * memory area is solely for use by the LLDD and its location is |
| 375 | 464 | * specified by the ls_request->private pointer. |
| 376 | 465 | * Value is Mandatory. Allowed to be zero. |
| 377 | 466 | * |
| @@ -405,6 +494,9 @@ struct nvme_fc_port_template { · 27 unmodified lines |
| 405 | 494 | struct nvme_fc_remote_port *, |
| 406 | 495 | void *hw_queue_handle, |
| 407 | 496 | struct nvmefc_fcp_req *); |
| 497 | + int (*xmt_ls_rsp)(struct nvme_fc_local_port *localport, |
| 498 | + struct nvme_fc_remote_port *rport, |
| 499 | + struct nvmefc_ls_rsp *ls_rsp); |
| 408 | 500 | |
| 409 | 501 | u32 max_hw_queues; |
| 410 | 502 | u16 max_sgl_segments; |
| @@ -441,6 +533,34 @@ void nvme_fc_rescan_remoteport(struct nvme_fc_remote_port *remoteport); · 30 unmodified lines |
| 441 | 533 | int nvme_fc_set_remoteport_devloss(struct nvme_fc_remote_port *remoteport, |
| 442 | 534 | u32 dev_loss_tmo); |
| 443 | 535 | |
| 536 | +/* |
| 537 | + * Routine called to pass a NVME-FC LS request, received by the lldd, |
| 538 | + * to the nvme-fc transport. |
| 539 | + * |
| 540 | + * If the return value is zero: the LS was successfully accepted by the |
| 541 | + * transport. |
| 542 | + * If the return value is non-zero: the transport has not accepted the |
| 543 | + * LS. The lldd should ABTS-LS the LS. |
| 544 | + * |
| 545 | + * Note: if the LLDD receives and ABTS for the LS prior to the transport |
| 546 | + * calling the ops->xmt_ls_rsp() routine to transmit a response, the LLDD |
| 547 | + * shall mark the LS as aborted, and when the xmt_ls_rsp() is called: the |
| 548 | + * response shall not be transmit and the struct nvmefc_ls_rsp() done |
| 549 | + * routine shall be called. The LLDD may transmit the ABTS response as |
| 550 | + * soon as the LS was marked or can delay until the xmt_ls_rsp() call is |
| 551 | + * made. |
| 552 | + * Note: if an RCV LS was successfully posted to the transport and the |
| 553 | + * remoteport is then unregistered before xmt_ls_rsp() was called for |
| 554 | + * the lsrsp structure, the transport will still call xmt_ls_rsp() |
| 555 | + * afterward to cleanup the outstanding lsrsp structure. The LLDD should |
| 556 | + * noop the transmission of the rsp and call the lsrsp->done() routine |
| 557 | + * to allow the lsrsp structure to be released. |
| 558 | + */ |
| 559 | +int nvme_fc_rcv_ls_req(struct nvme_fc_remote_port *remoteport, |
| 560 | + struct nvmefc_ls_rsp *lsrsp, |
| 561 | + void *lsreqbuf, u32 lsreqbuf_len); |
| 562 | + |
| 563 | + |
| 444 | 564 | |
| 445 | 565 | /* |
| 446 | 566 | * *************** LLDD FC-NVME Target/Subsystem API *************** |
| @@ -470,55 +590,6 @@ struct nvmet_fc_port_info { · 23 unmodified lines |
| 470 | 590 | }; |
| 471 | 591 | |
| 472 | 592 | |
| 473 | | −/** |
| 474 | | − * struct nvmefc_tgt_ls_req - Structure used between LLDD and NVMET-FC |
| 475 | | − * layer to represent the exchange context for |
| 476 | | − * a FC-NVME Link Service (LS). |
| 477 | | − * |
| 478 | | − * The structure is allocated by the LLDD whenever a LS Request is received |
| 479 | | − * from the FC link. The address of the structure is passed to the nvmet-fc |
| 480 | | − * layer via the nvmet_fc_rcv_ls_req() call. The address of the structure |
| 481 | | − * will be passed back to the LLDD when the response is to be transmit. |
| 482 | | − * The LLDD is to use the address to map back to the LLDD exchange structure |
| 483 | | − * which maintains information such as the targetport the LS was received |
| 484 | | − * on, the remote FC NVME initiator that sent the LS, and any FC exchange |
| 485 | | − * context. Upon completion of the LS response transmit, the address of the |
| 486 | | − * structure will be passed back to the LS rsp done() routine, allowing the |
| 487 | | − * nvmet-fc layer to release dma resources. Upon completion of the done() |
| 488 | | − * routine, no further access will be made by the nvmet-fc layer and the |
| 489 | | − * LLDD can de-allocate the structure. |
| 490 | | − * |
| 491 | | − * Field initialization: |
| 492 | | − * At the time of the nvmet_fc_rcv_ls_req() call, there is no content that |
| 493 | | − * is valid in the structure. |
| 494 | | − * |
| 495 | | − * When the structure is used for the LLDD->xmt_ls_rsp() call, the nvmet-fc |
| 496 | | − * layer will fully set the fields in order to specify the response |
| 497 | | − * payload buffer and its length as well as the done routine to be called |
| 498 | | − * upon compeletion of the transmit. The nvmet-fc layer will also set a |
| 499 | | − * private pointer for its own use in the done routine. |
| 500 | | − * |
| 501 | | − * Values set by the NVMET-FC layer prior to calling the LLDD xmt_ls_rsp |
| 502 | | − * entrypoint. |
| 503 | | − * @rspbuf: pointer to the LS response buffer |
| 504 | | − * @rspdma: PCI DMA address of the LS response buffer |
| 505 | | − * @rsplen: Length, in bytes, of the LS response buffer |
| 506 | | − * @done: The callback routine the LLDD is to invoke upon completion of |
| 507 | | − * transmitting the LS response. req argument is the pointer to |
| 508 | | − * the original ls request. |
| 509 | | − * @nvmet_fc_private: pointer to an internal NVMET-FC layer structure used |
| 510 | | − * as part of the NVMET-FC processing. The LLDD is not to access |
| 511 | | − * this pointer. |
| 512 | | − */ |
| 513 | | −struct nvmefc_tgt_ls_req { |
| 514 | | − void *rspbuf; |
| 515 | | − dma_addr_t rspdma; |
| 516 | | − u16 rsplen; |
| 517 | | − |
| 518 | | − void (*done)(struct nvmefc_tgt_ls_req *req); |
| 519 | | − void *nvmet_fc_private; /* LLDD is not to access !! */ |
| 520 | | −}; |
| 521 | | − |
| 522 | 593 | /* Operations that NVME-FC layer may request the LLDD to perform for FCP */ |
| 523 | 594 | enum { |
| 524 | 595 | NVMET_FCOP_READDATA = 1, /* xmt data to initiator */ |
| @@ -693,17 +764,19 @@ struct nvmet_fc_target_port { · 168 unmodified lines |
| 693 | 764 | * Entrypoint is Mandatory. |
| 694 | 765 | * |
| 695 | 766 | * @xmt_ls_rsp: Called to transmit the response to a FC-NVME FC-4 LS service. |
| 696 | | − * The nvmefc_tgt_ls_req structure is the same LLDD-supplied exchange |
| 767 | + * The nvmefc_ls_rsp structure is the same LLDD-supplied exchange |
| 697 | 768 | * structure specified in the nvmet_fc_rcv_ls_req() call made when |
| 698 | | − * the LS request was received. The structure will fully describe |
| 769 | + * the LS request was received. The structure will fully describe |
| 699 | 770 | * the buffers for the response payload and the dma address of the |
| 700 | | − * payload. The LLDD is to transmit the response (or return a non-zero |
| 701 | | − * errno status), and upon completion of the transmit, call the |
| 702 | | − * "done" routine specified in the nvmefc_tgt_ls_req structure |
| 703 | | − * (argument to done is the ls reqwuest structure itself). |
| 704 | | − * After calling the done routine, the LLDD shall consider the |
| 705 | | − * LS handling complete and the nvmefc_tgt_ls_req structure may |
| 706 | | − * be freed/released. |
| 771 | + * payload. The LLDD is to transmit the response (or return a |
| 772 | + * non-zero errno status), and upon completion of the transmit, call |
| 773 | + * the "done" routine specified in the nvmefc_ls_rsp structure |
| 774 | + * (argument to done is the address of the nvmefc_ls_rsp structure |
| 775 | + * itself). Upon the completion of the done() routine, the LLDD shall |
| 776 | + * consider the LS handling complete and the nvmefc_ls_rsp structure |
| 777 | + * may be freed/released. |
| 778 | + * The transport will always call the xmt_ls_rsp() routine for any |
| 779 | + * LS received. |
| 707 | 780 | * Entrypoint is Mandatory. |
| 708 | 781 | * |
| 709 | 782 | * @fcp_op: Called to perform a data transfer or transmit a response. |
| @@ -798,6 +871,39 @@ struct nvmet_fc_target_port { · 88 unmodified lines |
| 798 | 871 | * should cause the initiator to rescan the discovery controller |
| 799 | 872 | * on the targetport. |
| 800 | 873 | * |
| 874 | + * @ls_req: Called to issue a FC-NVME FC-4 LS service request. |
| 875 | + * The nvme_fc_ls_req structure will fully describe the buffers for |
| 876 | + * the request payload and where to place the response payload. |
| 877 | + * The targetport that is to issue the LS request is identified by |
| 878 | + * the targetport argument. The remote port that is to receive the |
| 879 | + * LS request is identified by the hosthandle argument. The nvmet-fc |
| 880 | + * transport is only allowed to issue FC-NVME LS's on behalf of an |
| 881 | + * association that was created prior by a Create Association LS. |
| 882 | + * The hosthandle will originate from the LLDD in the struct |
| 883 | + * nvmefc_ls_rsp structure for the Create Association LS that |
| 884 | + * was delivered to the transport. The transport will save the |
| 885 | + * hosthandle as an attribute of the association. If the LLDD |
| 886 | + * loses connectivity with the remote port, it must call the |
| 887 | + * nvmet_fc_invalidate_host() routine to remove any references to |
| 888 | + * the remote port in the transport. |
| 889 | + * The LLDD is to allocate an exchange, issue the LS request, obtain |
| 890 | + * the LS response, and call the "done" routine specified in the |
| 891 | + * request structure (argument to done is the ls request structure |
| 892 | + * itself). |
| 893 | + * Entrypoint is Optional - but highly recommended. |
| 894 | + * |
| 895 | + * @ls_abort: called to request the LLDD to abort the indicated ls request. |
| 896 | + * The call may return before the abort has completed. After aborting |
| 897 | + * the request, the LLDD must still call the ls request done routine |
| 898 | + * indicating an FC transport Aborted status. |
| 899 | + * Entrypoint is Mandatory if the ls_req entry point is specified. |
| 900 | + * |
| 901 | + * @host_release: called to inform the LLDD that the request to invalidate |
| 902 | + * the host port indicated by the hosthandle has been fully completed. |
| 903 | + * No associations exist with the host port and there will be no |
| 904 | + * further references to hosthandle. |
| 905 | + * Entrypoint is Mandatory if the lldd calls nvmet_fc_invalidate_host(). |
| 906 | + * |
| 801 | 907 | * @max_hw_queues: indicates the maximum number of hw queues the LLDD |
| 802 | 908 | * supports for cpu affinitization. |
| 803 | 909 | * Value is Mandatory. Must be at least 1. |
| @@ -826,11 +932,19 @@ struct nvmet_fc_target_port { · 22 unmodified lines |
| 826 | 932 | * area solely for the of the LLDD and its location is specified by |
| 827 | 933 | * the targetport->private pointer. |
| 828 | 934 | * Value is Mandatory. Allowed to be zero. |
| 935 | + * |
| 936 | + * @lsrqst_priv_sz: The LLDD sets this field to the amount of additional |
| 937 | + * memory that it would like nvmet-fc layer to allocate on the LLDD's |
| 938 | + * behalf whenever a ls request structure is allocated. The additional |
| 939 | + * memory area is solely for use by the LLDD and its location is |
| 940 | + * specified by the ls_request->private pointer. |
| 941 | + * Value is Mandatory. Allowed to be zero. |
| 942 | + * |
| 829 | 943 | */ |
| 830 | 944 | struct nvmet_fc_target_template { |
| 831 | 945 | void (*targetport_delete)(struct nvmet_fc_target_port *tgtport); |
| 832 | 946 | int (*xmt_ls_rsp)(struct nvmet_fc_target_port *tgtport, |
| 833 | | − struct nvmefc_tgt_ls_req *tls_req); |
| 947 | + struct nvmefc_ls_rsp *ls_rsp); |
| 834 | 948 | int (*fcp_op)(struct nvmet_fc_target_port *tgtport, |
| 835 | 949 | struct nvmefc_tgt_fcp_req *fcpreq); |
| 836 | 950 | void (*fcp_abort)(struct nvmet_fc_target_port *tgtport, |
| @@ -840,6 +954,11 @@ struct nvmet_fc_target_template { · 3 unmodified lines |
| 840 | 954 | void (*defer_rcv)(struct nvmet_fc_target_port *tgtport, |
| 841 | 955 | struct nvmefc_tgt_fcp_req *fcpreq); |
| 842 | 956 | void (*discovery_event)(struct nvmet_fc_target_port *tgtport); |
| 957 | + int (*ls_req)(struct nvmet_fc_target_port *targetport, |
| 958 | + void *hosthandle, struct nvmefc_ls_req *lsreq); |
| 959 | + void (*ls_abort)(struct nvmet_fc_target_port *targetport, |
| 960 | + void *hosthandle, struct nvmefc_ls_req *lsreq); |
| 961 | + void (*host_release)(void *hosthandle); |
| 843 | 962 | |
| 844 | 963 | u32 max_hw_queues; |
| 845 | 964 | u16 max_sgl_segments; |
| @@ -848,7 +967,9 @@ struct nvmet_fc_target_template { · 2 unmodified lines |
| 848 | 967 | |
| 849 | 968 | u32 target_features; |
| 850 | 969 | |
| 970 | + /* sizes of additional private data for data structures */ |
| 851 | 971 | u32 target_priv_sz; |
| 972 | + u32 lsrqst_priv_sz; |
| 852 | 973 | }; |
| 853 | 974 | |
| 854 | 975 | |
| @@ -859,10 +980,61 @@ int nvmet_fc_register_targetport(struct nvmet_fc_port_info *portinfo, · 4 unmodified lines |
| 859 | 980 | |
| 860 | 981 | int nvmet_fc_unregister_targetport(struct nvmet_fc_target_port *tgtport); |
| 861 | 982 | |
| 983 | +/* |
| 984 | + * Routine called to pass a NVME-FC LS request, received by the lldd, |
| 985 | + * to the nvmet-fc transport. |
| 986 | + * |
| 987 | + * If the return value is zero: the LS was successfully accepted by the |
| 988 | + * transport. |
| 989 | + * If the return value is non-zero: the transport has not accepted the |
| 990 | + * LS. The lldd should ABTS-LS the LS. |
| 991 | + * |
| 992 | + * Note: if the LLDD receives and ABTS for the LS prior to the transport |
| 993 | + * calling the ops->xmt_ls_rsp() routine to transmit a response, the LLDD |
| 994 | + * shall mark the LS as aborted, and when the xmt_ls_rsp() is called: the |
| 995 | + * response shall not be transmit and the struct nvmefc_ls_rsp() done |
| 996 | + * routine shall be called. The LLDD may transmit the ABTS response as |
| 997 | + * soon as the LS was marked or can delay until the xmt_ls_rsp() call is |
| 998 | + * made. |
| 999 | + * Note: if an RCV LS was successfully posted to the transport and the |
| 1000 | + * targetport is then unregistered before xmt_ls_rsp() was called for |
| 1001 | + * the lsrsp structure, the transport will still call xmt_ls_rsp() |
| 1002 | + * afterward to cleanup the outstanding lsrsp structure. The LLDD should |
| 1003 | + * noop the transmission of the rsp and call the lsrsp->done() routine |
| 1004 | + * to allow the lsrsp structure to be released. |
| 1005 | + */ |
| 862 | 1006 | int nvmet_fc_rcv_ls_req(struct nvmet_fc_target_port *tgtport, |
| 863 | | − struct nvmefc_tgt_ls_req *lsreq, |
| 1007 | + void *hosthandle, |
| 1008 | + struct nvmefc_ls_rsp *rsp, |
| 864 | 1009 | void *lsreqbuf, u32 lsreqbuf_len); |
| 865 | 1010 | |
| 1011 | +/* |
| 1012 | + * Routine called by the LLDD whenever it has a logout or loss of |
| 1013 | + * connectivity to a NVME-FC host port which there had been active |
| 1014 | + * NVMe controllers for. The host port is indicated by the |
| 1015 | + * hosthandle. The hosthandle is given to the nvmet-fc transport |
| 1016 | + * when a NVME LS was received, typically to create a new association. |
| 1017 | + * The nvmet-fc transport will cache the hostport value with the |
| 1018 | + * association for use in LS requests for the association. |
| 1019 | + * When the LLDD calls this routine, the nvmet-fc transport will |
| 1020 | + * immediately terminate all associations that were created with |
| 1021 | + * the hosthandle host port. |
| 1022 | + * The LLDD, after calling this routine and having control returned, |
| 1023 | + * must assume the transport may subsequently utilize hosthandle as |
| 1024 | + * part of sending LS's to terminate the association. The LLDD |
| 1025 | + * should reject the LS's if they are attempted. |
| 1026 | + * Once the last association has terminated for the hosthandle host |
| 1027 | + * port, the nvmet-fc transport will call the ops->host_release() |
| 1028 | + * callback. As of the callback, the nvmet-fc transport will no |
| 1029 | + * longer reference hosthandle. |
| 1030 | + */ |
| 1031 | +void nvmet_fc_invalidate_host(struct nvmet_fc_target_port *tgtport, |
| 1032 | + void *hosthandle); |
| 1033 | + |
| 1034 | +/* |
| 1035 | + * If nvmet_fc_rcv_fcp_req returns non-zero, the transport has not accepted |
| 1036 | + * the FCP cmd. The lldd should ABTS-LS the cmd. |
| 1037 | + */ |
| 866 | 1038 | int nvmet_fc_rcv_fcp_req(struct nvmet_fc_target_port *tgtport, |
| 867 | 1039 | struct nvmefc_tgt_fcp_req *fcpreq, |
| 868 | 1040 | void *cmdiubuf, u32 cmdiubuf_len); |