From 9f0b1d763a241ce581952953f16a17cf89b01ec6 Mon Sep 17 00:00:00 2001 From: Naresh Gottumukkala Date: Fri, 8 Jan 2021 04:50:06 +0000 Subject: [PATCH] nvmf/fc: Extend nvmf_fc_lld_fini to take spdk_nvmf_transport_destroy_done_cb. As LLD cleanup is asynchronous in nature, Pass the spdk_nvmf_transport_destroy_done_cb to LLD and it will be called once the cleanup is completed. Dont forcefully remove fc_ports by nvmf_fc_port_cleanup function. LLD will drive the fc_ports cleanup gracefully as part of nvmf_fc_lld_fini. Signed-off-by: Naresh Gottumukkala Change-Id: I537b9ea817eda26a0469114821e2288d2ba9d91c Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5827 Community-CI: Broadcom CI Community-CI: Mellanox Build Bot Reviewed-by: Shuhei Matsumoto Reviewed-by: Jim Harris Tested-by: SPDK CI Jenkins --- CHANGELOG.md | 3 +++ lib/nvmf/fc.c | 18 +----------------- test/unit/lib/nvmf/fc.c/fc_ut.c | 2 +- 3 files changed, 5 insertions(+), 18 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f4fae1242..bb0e20af2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -53,6 +53,9 @@ Change the return type of function `spdk_nbd_stop` from void to int. And update ### nvmf +nvmf_fc_lld_fini() now takes callback and hence updating FC Broadcom LLD driver +to the latest is required. + FC transport supported primary tagging and VMID. Broadcom FC LLD driver and SPDK NVMe-oF FC transport consolidated one LLD API, diff --git a/lib/nvmf/fc.c b/lib/nvmf/fc.c index a69a1d643..06d846bf3 100644 --- a/lib/nvmf/fc.c +++ b/lib/nvmf/fc.c @@ -968,17 +968,6 @@ nvmf_fc_port_lookup(uint8_t port_hdl) return NULL; } -static void -nvmf_fc_port_cleanup(void) -{ - struct spdk_nvmf_fc_port *fc_port, *tmp; - - TAILQ_FOREACH_SAFE(fc_port, &g_spdk_nvmf_fc_port_list, link, tmp) { - TAILQ_REMOVE(&g_spdk_nvmf_fc_port_list, fc_port, link); - free(fc_port); - } -} - uint32_t nvmf_fc_get_prli_service_params(void) { @@ -2042,14 +2031,9 @@ nvmf_fc_destroy(struct spdk_nvmf_transport *transport, g_nvmf_fgroup_count = 0; /* low level FC driver clean up */ - nvmf_fc_lld_fini(); - - nvmf_fc_port_cleanup(); + nvmf_fc_lld_fini(cb_fn, cb_arg); } - if (cb_fn) { - cb_fn(cb_arg); - } return 0; } diff --git a/test/unit/lib/nvmf/fc.c/fc_ut.c b/test/unit/lib/nvmf/fc.c/fc_ut.c index f1421b987..a7603a7bc 100644 --- a/test/unit/lib/nvmf/fc.c/fc_ut.c +++ b/test/unit/lib/nvmf/fc.c/fc_ut.c @@ -195,7 +195,7 @@ nvmf_fc_lld_init(void) static bool g_lld_fini_called = false; void -nvmf_fc_lld_fini(void) +nvmf_fc_lld_fini(spdk_nvmf_transport_destroy_done_cb cb_fn, void *ctx) { g_lld_fini_called = true; }