This patch adds support for the nvmet discovery_change transport op. In turn, the transport adds it's own LLDD api callback discovery_event op to request the LLDD to generate an RSCN for the discovery change.
Unified · Split
| @@ -2549,6 +2549,16 @@ nvmet_fc_remove_port(struct nvmet_port *port) · 2548 unmodified lines | ||
| 2549 | 2549 | kfree(pe); |
| 2550 | 2550 | } |
| 2551 | 2551 | |
| 2552 | +static void | |
| 2553 | +nvmet_fc_discovery_chg(struct nvmet_port *port) | |
| 2554 | +{ | |
| 2555 | + struct nvmet_fc_port_entry *pe = port->priv; | |
| 2556 | + struct nvmet_fc_tgtport *tgtport = pe->tgtport; | |
| 2557 | + | |
| 2558 | + if (tgtport && tgtport->ops->discovery_event) | |
| 2559 | + tgtport->ops->discovery_event(&tgtport->fc_target_port); | |
| 2560 | +} | |
| 2561 | + | |
| 2552 | 2562 | static const struct nvmet_fabrics_ops nvmet_fc_tgt_fcp_ops = { |
| 2553 | 2563 | .owner = THIS_MODULE, |
| 2554 | 2564 | .type = NVMF_TRTYPE_FC, |
| @@ -2557,6 +2567,7 @@ static const struct nvmet_fabrics_ops nvmet_fc_tgt_fcp_ops = { · 2 unmodified lines | ||
| 2557 | 2567 | .remove_port = nvmet_fc_remove_port, |
| 2558 | 2568 | .queue_response = nvmet_fc_fcp_nvme_cmd_done, |
| 2559 | 2569 | .delete_ctrl = nvmet_fc_delete_ctrl, |
| 2570 | + .discovery_chg = nvmet_fc_discovery_chg, | |
| 2560 | 2571 | }; |
| 2561 | 2572 | |
| 2562 | 2573 | static int __init nvmet_fc_init_module(void) |
| @@ -791,6 +791,11 @@ struct nvmet_fc_target_port { · 790 unmodified lines | ||
| 791 | 791 | * nvmefc_tgt_fcp_req. |
| 792 | 792 | * Entrypoint is Optional. |
| 793 | 793 | * |
| 794 | + * @discovery_event: Called by the transport to generate an RSCN | |
| 795 | + * change notifications to NVME initiators. The RSCN notifications | |
| 796 | + * should cause the initiator to rescan the discovery controller | |
| 797 | + * on the targetport. | |
| 798 | + * | |
| 794 | 799 | * @max_hw_queues: indicates the maximum number of hw queues the LLDD |
| 795 | 800 | * supports for cpu affinitization. |
| 796 | 801 | * Value is Mandatory. Must be at least 1. |
| @@ -832,6 +837,7 @@ struct nvmet_fc_target_template { · 35 unmodified lines | ||
| 832 | 837 | struct nvmefc_tgt_fcp_req *fcpreq); |
| 833 | 838 | void (*defer_rcv)(struct nvmet_fc_target_port *tgtport, |
| 834 | 839 | struct nvmefc_tgt_fcp_req *fcpreq); |
| 840 | + void (*discovery_event)(struct nvmet_fc_target_port *tgtport); | |
| 835 | 841 | |
| 836 | 842 | u32 max_hw_queues; |
| 837 | 843 | u16 max_sgl_segments; |