Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F163273146
D24081.id69557.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D24081.id69557.diff
View Options
Index: usr.sbin/bhyve/pci_nvme.c
===================================================================
--- usr.sbin/bhyve/pci_nvme.c
+++ usr.sbin/bhyve/pci_nvme.c
@@ -185,7 +185,7 @@
struct pci_nvme_ioreq {
struct pci_nvme_softc *sc;
- struct pci_nvme_ioreq *next;
+ STAILQ_ENTRY(pci_nvme_ioreq) link;
struct nvme_submission_queue *nvme_sq;
uint16_t sqid;
@@ -231,7 +231,7 @@
uint32_t num_squeues;
struct pci_nvme_ioreq *ioreqs;
- struct pci_nvme_ioreq *ioreqs_free; /* free list of ioreqs */
+ STAILQ_HEAD(, pci_nvme_ioreq) ioreqs_free; /* free list of ioreqs */
uint32_t pending_ios;
uint32_t ioslots;
sem_t iosemlock;
@@ -1292,8 +1292,7 @@
pthread_mutex_lock(&sc->mtx);
- req->next = sc->ioreqs_free;
- sc->ioreqs_free = req;
+ STAILQ_INSERT_TAIL(&sc->ioreqs_free, req, link);
sc->pending_ios--;
/* when no more IO pending, can set to ready if device reset/enabled */
@@ -1314,12 +1313,10 @@
sem_wait(&sc->iosemlock);
pthread_mutex_lock(&sc->mtx);
- req = sc->ioreqs_free;
+ req = STAILQ_FIRST(&sc->ioreqs_free);
+ STAILQ_REMOVE_HEAD(&sc->ioreqs_free, link);
assert(req != NULL);
- sc->ioreqs_free = req->next;
-
- req->next = NULL;
req->sc = sc;
sc->pending_ios++;
@@ -2108,14 +2105,13 @@
else
error = 0;
+ STAILQ_INIT(&sc->ioreqs_free);
sc->ioreqs = calloc(sc->ioslots, sizeof(struct pci_nvme_ioreq));
for (int i = 0; i < sc->ioslots; i++) {
- if (i < (sc->ioslots-1))
- sc->ioreqs[i].next = &sc->ioreqs[i+1];
+ STAILQ_INSERT_TAIL(&sc->ioreqs_free, &sc->ioreqs[i], link);
pthread_mutex_init(&sc->ioreqs[i].mtx, NULL);
pthread_cond_init(&sc->ioreqs[i].cv, NULL);
}
- sc->ioreqs_free = sc->ioreqs;
sc->intr_coales_aggr_thresh = 1;
pci_set_cfgdata16(pi, PCIR_DEVICE, 0x0A0A);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Jul 22, 3:33 PM (1 h, 43 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
35369870
Default Alt Text
D24081.id69557.diff (1 KB)
Attached To
Mode
D24081: bhyve: use STAILQ in NVMe emulation
Attached
Detach File
Event Timeline
Log In to Comment