Page MenuHomeFreeBSD

D51390.diff
No OneTemporary

D51390.diff

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
@@ -34,6 +34,7 @@
#include <vm/uma.h>
#include "nvme_private.h"
+#include "nvme_if.h"
struct nvme_consumer {
uint32_t id;
@@ -189,23 +190,21 @@
}
void
-nvme_notify_async_consumers(struct nvme_controller *ctrlr,
- const struct nvme_completion *async_cpl,
- uint32_t log_page_id, void *log_page_buffer,
- uint32_t log_page_size)
+nvme_notify_async(struct nvme_controller *ctrlr,
+ const struct nvme_completion *async_cpl,
+ uint32_t log_page_id, void *log_page_buffer, uint32_t log_page_size)
{
- struct nvme_consumer *cons;
- void *ctrlr_cookie;
- uint32_t i;
+ device_t *children;
+ int n_children;
- for (i = 0; i < NVME_MAX_CONSUMERS; i++) {
- cons = &nvme_consumer[i];
- if (cons->id != INVALID_CONSUMER_ID && cons->async_fn != NULL &&
- (ctrlr_cookie = ctrlr->cons_cookie[i]) != NULL) {
- (*cons->async_fn)(ctrlr_cookie, async_cpl,
- log_page_id, log_page_buffer, log_page_size);
- }
- }
+ if (device_get_children(ctrlr->dev, &children, &n_children) != 0)
+ return;
+
+ for (int i = 0; i < n_children; i++)
+ NVME_HANDLE_AEN(children[i], async_cpl, log_page_id,
+ log_page_buffer, log_page_size);
+
+ free(children, M_TEMP);
}
void
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
@@ -1154,8 +1154,7 @@
* Repost another asynchronous event request to replace the one
* that just completed.
*/
- nvme_notify_async_consumers(ctrlr, &aer->cpl, aer->log_page_id,
- NULL, 0);
+ nvme_notify_async(ctrlr, &aer->cpl, aer->log_page_id, NULL, 0);
nvme_ctrlr_construct_and_submit_aer(ctrlr, aer);
goto out;
}
@@ -1180,8 +1179,8 @@
* error, don't pass log page data to the consumers. In
* practice, this case should never happen.
*/
- nvme_notify_async_consumers(aer->ctrlr, &aer->cpl,
- aer->log_page_id, NULL, 0);
+ nvme_notify_async(aer->ctrlr, &aer->cpl, aer->log_page_id,
+ NULL, 0);
goto out;
}
@@ -1261,8 +1260,8 @@
* Pass the cpl data from the original async event completion, not the
* log page fetch.
*/
- nvme_notify_async_consumers(aer->ctrlr, &aer->cpl,
- aer->log_page_id, aer->log_page_buffer, aer->log_page_size);
+ nvme_notify_async(aer->ctrlr, &aer->cpl, aer->log_page_id,
+ aer->log_page_buffer, aer->log_page_size);
/*
* Repost another asynchronous event request to replace the one
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
@@ -556,10 +556,10 @@
#define nvme_free_request(req) free(req, M_NVME)
-void nvme_notify_async_consumers(struct nvme_controller *ctrlr,
- const struct nvme_completion *async_cpl,
- uint32_t log_page_id, void *log_page_buffer,
- uint32_t log_page_size);
+void nvme_notify_async(struct nvme_controller *ctrlr,
+ const struct nvme_completion *async_cpl,
+ 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_ctrlr_shared_handler(void *arg);

File Metadata

Mime Type
text/plain
Expires
Tue, Feb 3, 12:23 PM (9 h, 15 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
28424028
Default Alt Text
D51390.diff (3 KB)

Event Timeline