Commit 06557b0a authored by Ben Walker's avatar Ben Walker
Browse files

nvme: Add remove callback to transport scan



Scanning the transport may result in both new
devices and removed devices, so pass the callback
for both operations.

Change-Id: I6f73dbe6fd7cf61575c354b43f8ae3e2a01e2965
Signed-off-by: default avatarBen Walker <benjamin.walker@intel.com>
parent d70ff832
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -426,7 +426,7 @@ _spdk_nvme_probe(const struct spdk_nvme_transport_id *trid, void *cb_ctx,
		}
	}

	nvme_transport_ctrlr_scan(trid, probe_cb, cb_ctx);
	nvme_transport_ctrlr_scan(trid, cb_ctx, probe_cb, remove_cb);

	if (!spdk_process_is_primary()) {
		TAILQ_FOREACH(ctrlr, &g_spdk_nvme_driver->attached_ctrlrs, tailq) {
+1 −1
Original line number Diff line number Diff line
@@ -558,7 +558,7 @@ void nvme_qpair_print_completion(struct spdk_nvme_qpair *qpair, struct spdk_nvme
	struct spdk_nvme_ctrlr *nvme_ ## name ## _ctrlr_construct(enum spdk_nvme_transport_type trtype, const struct spdk_nvme_ctrlr_opts *opts, \
		const struct spdk_nvme_probe_info *probe_info, void *devhandle); \
	int nvme_ ## name ## _ctrlr_destruct(struct spdk_nvme_ctrlr *ctrlr); \
	int nvme_ ## name ## _ctrlr_scan(const struct spdk_nvme_transport_id *trid, spdk_nvme_probe_cb probe_cb, void *cb_ctx); \
	int nvme_ ## name ## _ctrlr_scan(const struct spdk_nvme_transport_id *trid, void *cb_ctx, spdk_nvme_probe_cb probe_cb, spdk_nvme_remove_cb remove_cb); \
	int nvme_ ## name ## _ctrlr_attach(enum spdk_nvme_transport_type trtype, spdk_nvme_probe_cb probe_cb, void *cb_ctx, struct spdk_pci_addr *addr); \
	int nvme_ ## name ## _ctrlr_enable(struct spdk_nvme_ctrlr *ctrlr); \
	int nvme_ ## name ## _ctrlr_get_pci_id(struct spdk_nvme_ctrlr *ctrlr, struct spdk_pci_id *pci_id); \
+3 −1
Original line number Diff line number Diff line
@@ -553,7 +553,9 @@ pcie_nvme_enum_cb(void *ctx, struct spdk_pci_device *pci_dev)

int
nvme_pcie_ctrlr_scan(const struct spdk_nvme_transport_id *trid,
		     spdk_nvme_probe_cb probe_cb, void *cb_ctx)
		     void *cb_ctx,
		     spdk_nvme_probe_cb probe_cb,
		     spdk_nvme_remove_cb remove_cb)
{
	struct nvme_pcie_enum_ctx enum_ctx;

+3 −1
Original line number Diff line number Diff line
@@ -1052,7 +1052,9 @@ nvme_fabrics_get_log_discovery_page(struct spdk_nvme_ctrlr *ctrlr,
/* This function must only be called while holding g_spdk_nvme_driver->lock */
int
nvme_rdma_ctrlr_scan(const struct spdk_nvme_transport_id *trid,
		     spdk_nvme_probe_cb probe_cb, void *cb_ctx)
		     void *cb_ctx,
		     spdk_nvme_probe_cb probe_cb,
		     spdk_nvme_remove_cb remove_cb)
{
	struct spdk_nvme_probe_info probe_info;
	struct spdk_nvme_ctrlr_opts discovery_opts;
+4 −2
Original line number Diff line number Diff line
@@ -92,9 +92,11 @@ struct spdk_nvme_ctrlr *

int
nvme_transport_ctrlr_scan(const struct spdk_nvme_transport_id *trid,
			  spdk_nvme_probe_cb probe_cb, void *cb_ctx)
			  void *cb_ctx,
			  spdk_nvme_probe_cb probe_cb,
			  spdk_nvme_remove_cb remove_cb)
{
	NVME_TRANSPORT_CALL(trid->trtype, ctrlr_scan, (trid, probe_cb, cb_ctx));
	NVME_TRANSPORT_CALL(trid->trtype, ctrlr_scan, (trid, cb_ctx, probe_cb, remove_cb));
}

int
Loading