[PATCH 4/4] nvme-fabrics: add explicit deregistration on disconnect.
Martin Belanger
nitram_67 at hotmail.com
Tue Jan 25 06:59:56 PST 2022
From: Martin Belanger <martin.belanger at dell.com>
Per TP8010, a host explicitly registered with a Discovery
Controller (DC) must deregister on disconnect. This patch
sends a DIM PDU to DCs to deregister the host on disconnect.
Signed-off-by: Martin Belanger <martin.belanger at dell.com>
---
drivers/nvme/host/tcp.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/drivers/nvme/host/tcp.c b/drivers/nvme/host/tcp.c
index 970b7df574a4..804d927b4b81 100644
--- a/drivers/nvme/host/tcp.c
+++ b/drivers/nvme/host/tcp.c
@@ -2176,6 +2176,16 @@ static void nvme_tcp_teardown_ctrl(struct nvme_ctrl *ctrl, bool shutdown)
static void nvme_tcp_delete_ctrl(struct nvme_ctrl *ctrl)
{
+ if (ctrl->opts->explicit_registration &&
++ ((ctrl->dctype == NVME_DCTYPE_DDC) ||
+ (ctrl->dctype == NVME_DCTYPE_CDC))) {
+ /* Deregister from discovery controller */
+ union nvmf_tsas tsas = {.tcp.sectype = NVMF_TCP_SECTYPE_NONE};
+
+ nvmf_disc_info_mgmt(ctrl, NVME_TAS_DEREGISTER, NVMF_TRTYPE_TCP,
+ nvme_get_adrfam(ctrl), "", &tsas);
+ }
+
nvme_tcp_teardown_ctrl(ctrl, true);
}
--
2.34.1
More information about the Linux-nvme
mailing list