From fd0f154f473c4a652d259235b3133e71f9a1e2ea Mon Sep 17 00:00:00 2001 From: Jim Harris Date: Thu, 10 Feb 2022 11:22:09 +0000 Subject: [PATCH] nvmf: add discovery subsystem entries to discovery log page When generating the discovery log page, add entries for the discovery subsystem, skipping the listener associated with the command generating the log page. Signed-off-by: Jim Harris Change-Id: Id6a14a7d5cdce483f8f3c2eff1b4ededd40bc029 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/11542 Community-CI: Broadcom CI Community-CI: Mellanox Build Bot Reviewed-by: Aleksey Marchuk Reviewed-by: Shuhei Matsumoto Tested-by: SPDK CI Jenkins --- lib/nvmf/ctrlr_discovery.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/nvmf/ctrlr_discovery.c b/lib/nvmf/ctrlr_discovery.c index a6d7d6fae..043d2b2e3 100644 --- a/lib/nvmf/ctrlr_discovery.c +++ b/lib/nvmf/ctrlr_discovery.c @@ -122,16 +122,19 @@ nvmf_generate_discovery_log(struct spdk_nvmf_tgt *tgt, const char *hostnqn, size continue; } - if (subsystem->subtype == SPDK_NVMF_SUBTYPE_DISCOVERY) { - continue; - } - if (!spdk_nvmf_subsystem_host_allowed(subsystem, hostnqn)) { continue; } for (listener = spdk_nvmf_subsystem_get_first_listener(subsystem); listener != NULL; listener = spdk_nvmf_subsystem_get_next_listener(subsystem, listener)) { + if (subsystem->subtype == SPDK_NVMF_SUBTYPE_DISCOVERY && + !spdk_nvme_transport_id_compare(listener->trid, cmd_source_trid)) { + /* Do not generate an entry for the transport ID for the listener + * entry associated with the controller that generated this command. + */ + continue; + } if ((tgt->discovery_filter & SPDK_NVMF_TGT_DISCOVERY_MATCH_TRANSPORT_TYPE) != 0 && !nvmf_discovery_compare_trtype(listener->trid, cmd_source_trid)) {