From: jsmart2021@gmail.com (James Smart)
Subject: [PATCH 1/7] nvmet: add transport discovery change op
Date: Mon, 13 May 2019 15:43:08 -0700 [thread overview]
Message-ID: <20190513224314.24169-2-jsmart2021@gmail.com> (raw)
In-Reply-To: <20190513224314.24169-1-jsmart2021@gmail.com>
Some transports, such as FC-NVME, support discovery controller change
events without the use of a persistent discovery controller. FC receives
events via RSCN from the FC Fabric Controller or subsystem FC port.
This patch adds a nvmet transport op that is called whenever a
discovery change event occurs in the nvmet layer.
To facilitate the callback without adding another layer to cross into
core.c to reference the transport ops, the port structure snapshots
the transport ops when the port is enabled and clears them when disabled.
Signed-off-by: James Smart <jsmart2021 at gmail.com>
---
drivers/nvme/target/core.c | 2 ++
drivers/nvme/target/discovery.c | 4 ++++
drivers/nvme/target/nvmet.h | 2 ++
3 files changed, 8 insertions(+)
diff --git a/drivers/nvme/target/core.c b/drivers/nvme/target/core.c
index 7734a6acff85..43e8c4adc1f4 100644
--- a/drivers/nvme/target/core.c
+++ b/drivers/nvme/target/core.c
@@ -311,6 +311,7 @@ int nvmet_enable_port(struct nvmet_port *port)
port->inline_data_size = 0;
port->enabled = true;
+ port->tr_ops = ops;
return 0;
}
@@ -321,6 +322,7 @@ void nvmet_disable_port(struct nvmet_port *port)
lockdep_assert_held(&nvmet_config_sem);
port->enabled = false;
+ port->tr_ops = NULL;
ops = nvmet_transports[port->disc_addr.trtype];
ops->remove_port(port);
diff --git a/drivers/nvme/target/discovery.c b/drivers/nvme/target/discovery.c
index 5baf269f3f8a..8efca26b4776 100644
--- a/drivers/nvme/target/discovery.c
+++ b/drivers/nvme/target/discovery.c
@@ -41,6 +41,10 @@ void nvmet_port_disc_changed(struct nvmet_port *port,
__nvmet_disc_changed(port, ctrl);
}
mutex_unlock(&nvmet_disc_subsys->lock);
+
+ /* If transport can signal change, notify transport */
+ if (port->tr_ops && port->tr_ops->discovery_chg)
+ port->tr_ops->discovery_chg(port);
}
static void __nvmet_subsys_disc_changed(struct nvmet_port *port,
diff --git a/drivers/nvme/target/nvmet.h b/drivers/nvme/target/nvmet.h
index c25d88fc9dec..dc270944bb25 100644
--- a/drivers/nvme/target/nvmet.h
+++ b/drivers/nvme/target/nvmet.h
@@ -140,6 +140,7 @@ struct nvmet_port {
void *priv;
bool enabled;
int inline_data_size;
+ const struct nvmet_fabrics_ops *tr_ops;
};
static inline struct nvmet_port *to_nvmet_port(struct config_item *item)
@@ -277,6 +278,7 @@ struct nvmet_fabrics_ops {
void (*disc_traddr)(struct nvmet_req *req,
struct nvmet_port *port, char *traddr);
u16 (*install_queue)(struct nvmet_sq *nvme_sq);
+ void (*discovery_chg)(struct nvmet_port *port);
};
#define NVMET_MAX_INLINE_BIOVEC 8
--
2.13.7
next prev parent reply other threads:[~2019-05-13 22:43 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-13 22:43 [PATCH 0/7] nvmet/nvmet_fc: add events for discovery controller rescan James Smart
2019-05-13 22:43 ` James Smart [this message]
2019-05-14 10:12 ` [PATCH 1/7] nvmet: add transport discovery change op Hannes Reinecke
2019-05-13 22:43 ` [PATCH 2/7] nvmet_fc: add transport discovery change event callback support James Smart
2019-05-14 10:17 ` Hannes Reinecke
2019-05-13 22:43 ` [PATCH 3/7] nvme-fcloop: Add support for nvmet discovery_event op James Smart
2019-05-14 10:17 ` Hannes Reinecke
2019-05-13 22:43 ` [PATCH 4/7] lpfc: Add support to generate RSCN events for nport James Smart
2019-05-14 10:20 ` Hannes Reinecke
2019-05-13 22:43 ` [PATCH 5/7] lpfc: add nvmet discovery_event op support James Smart
2019-05-14 10:20 ` Hannes Reinecke
2019-05-13 22:43 ` [PATCH 6/7] lpfc: Add support for translating an RSCN rcv into a discovery rescan James Smart
2019-05-14 10:22 ` Hannes Reinecke
2019-05-14 19:04 ` Arun Easi
2019-05-13 22:43 ` [PATCH 7/7] lpfc: Add sysfs interface to post NVME RSCN James Smart
2019-05-14 10:22 ` Hannes Reinecke
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190513224314.24169-2-jsmart2021@gmail.com \
--to=jsmart2021@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox