Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F138057863
D53765.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
3 KB
Referenced Files
None
Subscribers
None
D53765.diff
View Options
diff --git a/sys/dev/nvd/nvd.c b/sys/dev/nvd/nvd.c
--- a/sys/dev/nvd/nvd.c
+++ b/sys/dev/nvd/nvd.c
@@ -550,7 +550,7 @@
}
static int
-nvdc_ns_changed(device_t dev, struct nvme_namespace *ns)
+nvdc_ns_changed(device_t dev, uint32_t nsid)
{
// XXX NOT YET
return ENXIO;
diff --git a/sys/dev/nvme/nvme.c b/sys/dev/nvme/nvme.c
--- a/sys/dev/nvme/nvme.c
+++ b/sys/dev/nvme/nvme.c
@@ -235,30 +235,6 @@
}
}
-void
-nvme_notify_ns(struct nvme_controller *ctrlr, int nsid)
-{
- struct nvme_consumer *cons;
- struct nvme_namespace *ns;
- void *ctrlr_cookie;
- uint32_t i;
-
- KASSERT(nsid <= NVME_MAX_NAMESPACES,
- ("%s: Namespace notification to nsid %d exceeds range\n",
- device_get_nameunit(ctrlr->dev), nsid));
-
- if (!ctrlr->is_initialized)
- return;
-
- ns = &ctrlr->ns[nsid - 1];
- for (i = 0; i < NVME_MAX_CONSUMERS; i++) {
- cons = &nvme_consumer[i];
- if (cons->id != INVALID_CONSUMER_ID && cons->ns_fn != NULL &&
- (ctrlr_cookie = ctrlr->cons_cookie[i]) != NULL)
- ns->cons_cookie[i] = (*cons->ns_fn)(ns, ctrlr_cookie);
- }
-}
-
struct nvme_consumer *
nvme_register_consumer(nvme_cons_ns_fn_t ns_fn, nvme_cons_ctrlr_fn_t ctrlr_fn,
nvme_cons_async_fn_t async_fn,
diff --git a/sys/dev/nvme/nvme_ctrlr.c b/sys/dev/nvme/nvme_ctrlr.c
--- a/sys/dev/nvme/nvme_ctrlr.c
+++ b/sys/dev/nvme/nvme_ctrlr.c
@@ -1232,13 +1232,28 @@
nvme_ctrlr_cmd_set_async_event_config(aer->ctrlr,
aer->ctrlr->async_event_config, NULL, NULL);
} else if (aer->log_page_id == NVME_LOG_CHANGED_NAMESPACE) {
- struct nvme_ns_list *nsl =
- (struct nvme_ns_list *)aer->log_page_buffer;
+ device_t *children;
+ int n_children;
+ struct nvme_ns_list *nsl;
+
+ if (device_get_children(aer->ctrlr->dev, &children, &n_children) != 0) {
+ children = NULL;
+ n_children = 0;
+ }
+ nsl = (struct nvme_ns_list *)aer->log_page_buffer;
for (int i = 0; i < nitems(nsl->ns) && nsl->ns[i] != 0; i++) {
if (nsl->ns[i] > NVME_MAX_NAMESPACES)
break;
- nvme_notify_ns(aer->ctrlr, nsl->ns[i]);
+ /*
+ * I think we need to query the name space here and see
+ * if it went away, arrived, or changed in size and call
+ * the nuanced routine (after constructing or before
+ * destructing the namespace). XXX needs more work XXX.
+ */
+ for (int j = 0; j < n_children; j++)
+ NVME_NS_CHANGED(children[j], nsl->ns[i]);
}
+ free(children, M_TEMP);
}
/*
diff --git a/sys/dev/nvme/nvme_if.m b/sys/dev/nvme/nvme_if.m
--- a/sys/dev/nvme/nvme_if.m
+++ b/sys/dev/nvme/nvme_if.m
@@ -33,7 +33,7 @@
#
METHOD int ns_changed {
device_t dev; /* nvme device */
- struct nvme_namespace *ns; /* information about the namespace */
+ uint32_t nsid; /* nsid that just changed */
};
#
diff --git a/sys/dev/nvme/nvme_private.h b/sys/dev/nvme/nvme_private.h
--- a/sys/dev/nvme/nvme_private.h
+++ b/sys/dev/nvme/nvme_private.h
@@ -561,7 +561,6 @@
uint32_t log_page_id, void *log_page_buffer,
uint32_t log_page_size);
void nvme_notify_fail_consumers(struct nvme_controller *ctrlr);
-void nvme_notify_ns(struct nvme_controller *ctrlr, int nsid);
void nvme_ctrlr_shared_handler(void *arg);
void nvme_ctrlr_get_ident(const struct nvme_controller *ctrlr, uint8_t *sn);
diff --git a/sys/dev/nvme/nvme_sim.c b/sys/dev/nvme/nvme_sim.c
--- a/sys/dev/nvme/nvme_sim.c
+++ b/sys/dev/nvme/nvme_sim.c
@@ -417,7 +417,7 @@
}
static int
-nvme_sim_ns_changed(device_t dev, struct nvme_namespace *ns)
+nvme_sim_ns_changed(device_t dev, uint32_t nsid)
{
// XXX NOT YET
return ENXIO;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Nov 29, 1:30 PM (4 h, 38 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
26337161
Default Alt Text
D53765.diff (3 KB)
Attached To
Mode
D53765: nvme: Connect the ns changed AER to nvmec_delta_ns
Attached
Detach File
Event Timeline
Log In to Comment