idxd: Keep ops on a singly linked list
This does not actually need a doubly linked list. Single is enough. That frees up 4 more bytes in the op for other uses. Signed-off-by: Ben Walker <benjamin.walker@intel.com> Change-Id: I8c2a30de175b42815afd0a3ba3c694aef2f35882 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/12258 Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com> Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Changpeng Liu <changpeng.liu@intel.com> Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com> Reviewed-by: Paul Luse <paul.e.luse@intel.com>
This commit is contained in:
parent
863200c7d4
commit
f2efa8f293
@ -60,7 +60,7 @@ spdk_idxd_get_socket(struct spdk_idxd_device *idxd)
|
||||
static inline void
|
||||
_submit_to_hw(struct spdk_idxd_io_channel *chan, struct idxd_ops *op)
|
||||
{
|
||||
TAILQ_INSERT_TAIL(&chan->ops_outstanding, op, link);
|
||||
STAILQ_INSERT_TAIL(&chan->ops_outstanding, op, link);
|
||||
movdir64b(chan->portal + chan->portal_offset, op->desc);
|
||||
chan->portal_offset = (chan->portal_offset + chan->idxd->chan_per_device * PORTAL_STRIDE) &
|
||||
PORTAL_MASK;
|
||||
@ -104,9 +104,9 @@ spdk_idxd_get_channel(struct spdk_idxd_device *idxd)
|
||||
}
|
||||
|
||||
chan->idxd = idxd;
|
||||
TAILQ_INIT(&chan->ops_pool);
|
||||
STAILQ_INIT(&chan->ops_pool);
|
||||
TAILQ_INIT(&chan->batch_pool);
|
||||
TAILQ_INIT(&chan->ops_outstanding);
|
||||
STAILQ_INIT(&chan->ops_outstanding);
|
||||
|
||||
/* Assign WQ, portal */
|
||||
pthread_mutex_lock(&idxd->num_channels_lock);
|
||||
@ -142,7 +142,7 @@ spdk_idxd_get_channel(struct spdk_idxd_device *idxd)
|
||||
}
|
||||
|
||||
for (i = 0; i < num_descriptors; i++) {
|
||||
TAILQ_INSERT_TAIL(&chan->ops_pool, op, link);
|
||||
STAILQ_INSERT_TAIL(&chan->ops_pool, op, link);
|
||||
op->desc = desc;
|
||||
rc = _vtophys(&op->hw, &desc->completion_addr, sizeof(struct idxd_hw_comp_record));
|
||||
if (rc) {
|
||||
@ -326,13 +326,13 @@ _idxd_prep_command(struct spdk_idxd_io_channel *chan, spdk_idxd_req_cb cb_fn, vo
|
||||
struct idxd_ops *op;
|
||||
uint64_t comp_addr;
|
||||
|
||||
if (!TAILQ_EMPTY(&chan->ops_pool)) {
|
||||
op = *_op = TAILQ_FIRST(&chan->ops_pool);
|
||||
if (!STAILQ_EMPTY(&chan->ops_pool)) {
|
||||
op = *_op = STAILQ_FIRST(&chan->ops_pool);
|
||||
desc = *_desc = op->desc;
|
||||
comp_addr = desc->completion_addr;
|
||||
memset(desc, 0, sizeof(*desc));
|
||||
desc->completion_addr = comp_addr;
|
||||
TAILQ_REMOVE(&chan->ops_pool, op, link);
|
||||
STAILQ_REMOVE_HEAD(&chan->ops_pool, link);
|
||||
} else {
|
||||
/* The application needs to handle this, violation of flow control */
|
||||
return -EBUSY;
|
||||
@ -494,8 +494,8 @@ idxd_batch_submit(struct spdk_idxd_io_channel *chan,
|
||||
|
||||
/* Add the batch elements completion contexts to the outstanding list to be polled. */
|
||||
for (i = 0 ; i < batch->index; i++) {
|
||||
TAILQ_INSERT_TAIL(&chan->ops_outstanding, (struct idxd_ops *)&batch->user_ops[i],
|
||||
link);
|
||||
STAILQ_INSERT_TAIL(&chan->ops_outstanding, (struct idxd_ops *)&batch->user_ops[i],
|
||||
link);
|
||||
}
|
||||
batch->index = UINT8_MAX;
|
||||
}
|
||||
@ -732,7 +732,7 @@ spdk_idxd_submit_dualcast(struct spdk_idxd_io_channel *chan, void *dst1, void *d
|
||||
|
||||
return 0;
|
||||
error:
|
||||
TAILQ_INSERT_TAIL(&chan->ops_pool, op, link);
|
||||
STAILQ_INSERT_HEAD(&chan->ops_pool, op, link);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@ -1266,7 +1266,7 @@ spdk_idxd_process_events(struct spdk_idxd_io_channel *chan)
|
||||
|
||||
assert(chan != NULL);
|
||||
|
||||
TAILQ_FOREACH_SAFE(op, &chan->ops_outstanding, link, tmp) {
|
||||
STAILQ_FOREACH_SAFE(op, &chan->ops_outstanding, link, tmp) {
|
||||
if (!IDXD_COMPLETION(op->hw.status)) {
|
||||
/*
|
||||
* oldest locations are at the head of the list so if
|
||||
@ -1276,7 +1276,7 @@ spdk_idxd_process_events(struct spdk_idxd_io_channel *chan)
|
||||
break;
|
||||
}
|
||||
|
||||
TAILQ_REMOVE(&chan->ops_outstanding, op, link);
|
||||
STAILQ_REMOVE_HEAD(&chan->ops_outstanding, link);
|
||||
rc++;
|
||||
|
||||
if (spdk_unlikely(IDXD_FAILURE(op->hw.status))) {
|
||||
@ -1307,9 +1307,9 @@ spdk_idxd_process_events(struct spdk_idxd_io_channel *chan)
|
||||
op->hw.status = 0;
|
||||
if (op->desc->opcode == IDXD_OPCODE_BATCH) {
|
||||
_free_batch(op->batch, chan);
|
||||
TAILQ_INSERT_HEAD(&chan->ops_pool, op, link);
|
||||
STAILQ_INSERT_HEAD(&chan->ops_pool, op, link);
|
||||
} else if (!op->batch) {
|
||||
TAILQ_INSERT_HEAD(&chan->ops_pool, op, link);
|
||||
STAILQ_INSERT_HEAD(&chan->ops_pool, op, link);
|
||||
}
|
||||
|
||||
if (cb_fn) {
|
||||
|
@ -104,9 +104,9 @@ struct spdk_idxd_io_channel {
|
||||
* data descriptors and are located in the batch structure.
|
||||
*/
|
||||
void *desc_base;
|
||||
TAILQ_HEAD(, idxd_ops) ops_pool;
|
||||
STAILQ_HEAD(, idxd_ops) ops_pool;
|
||||
/* Current list of outstanding operations to poll. */
|
||||
TAILQ_HEAD(op_head, idxd_ops) ops_outstanding;
|
||||
STAILQ_HEAD(op_head, idxd_ops) ops_outstanding;
|
||||
void *ops_base;
|
||||
|
||||
TAILQ_HEAD(, idxd_batch) batch_pool;
|
||||
@ -129,8 +129,8 @@ struct idxd_ops {
|
||||
struct idxd_batch *batch;
|
||||
struct idxd_hw_desc *desc;
|
||||
uint32_t *crc_dst;
|
||||
char pad[8];
|
||||
TAILQ_ENTRY(idxd_ops) link;
|
||||
char pad[12];
|
||||
STAILQ_ENTRY(idxd_ops) link;
|
||||
};
|
||||
SPDK_STATIC_ASSERT(sizeof(struct idxd_ops) == 96, "size mismatch");
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user