Commit e5a19b3e authored by paul luse's avatar paul luse Committed by Tomasz Zawadzki
Browse files

lib/idxd: replace bit arrays with lists



The bit arrays were used for dynamic flow control in a previous
implementation.  They are no longer needed as flow control is
now static and managed solely in the idxd plug in module. Use
simple lists of descriptors and completion records instead.

This is a simpler implementation and will allow for some future
clean up of structures as well.

Signed-off-by: default avatarpaul luse <paul.e.luse@intel.com>
Change-Id: I8c4cce12e88ac5416e3fe29a416487759214ec9f
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8922


Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarZiye Yang <ziye.yang@intel.com>
parent a8ca2e74
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -34,7 +34,7 @@
SPDK_ROOT_DIR := $(abspath $(CURDIR)/../..)
include $(SPDK_ROOT_DIR)/mk/spdk.common.mk

SO_VER := 5
SO_VER := 6
SO_MINOR := 0

C_SRCS = idxd.c idxd_user.c
+123 −151

File changed.

Preview size limit exceeded, changes collapsed.

+13 −25
Original line number Diff line number Diff line
@@ -39,7 +39,6 @@
#include "spdk/idxd.h"
#include "spdk/queue.h"
#include "spdk/mmio.h"
#include "spdk/bit_array.h"

#include "idxd_spec.h"

@@ -83,7 +82,7 @@ static inline void movdir64b(void *dst, const void *src)
 */
struct idxd_batch {
	struct idxd_hw_desc		*user_desc;
	struct idxd_comp		*user_completions;
	struct idxd_ops			*user_ops;
	uint8_t				index;
	TAILQ_ENTRY(idxd_batch)		link;
};
@@ -95,37 +94,27 @@ struct device_config {
	uint16_t	total_engines;
};

struct idxd_comp ;
struct idxd_ops;

struct spdk_idxd_io_channel {
	struct spdk_idxd_device			*idxd;
	/* The portal is the address that we write descriptors to for submission. */
	void					*portal;
	uint32_t				portal_offset;
	uint16_t				ring_size;

	/*
	 * Descriptors and completions share the same index. User descriptors
	 * (those included in a batch) are managed independently from data descriptors
	 * and are located in the batch structure.
	 * User descriptors (those included in a batch) are managed independently from
	 * data descriptors and are located in the batch structure.
	 */
	struct idxd_hw_desc			*desc;
	struct idxd_comp			*completions;

	/* Current list of oustanding completion addresses to poll. */
	TAILQ_HEAD(comp_head, idxd_comp)	comp_ctx_oustanding;

	/*
	 * We use one bit array to track ring slots for both
	 * desc and completions.
	 *
	 */
	struct spdk_bit_array			*ring_slots;
	void					*desc_base;
	TAILQ_HEAD(, idxd_ops)			ops_pool;
	/* Current list of oustanding operations to poll. */
	TAILQ_HEAD(op_head, idxd_ops)		ops_outstanding;
	void					*ops_base;

	/* Lists of batches, free and in use. */
	TAILQ_HEAD(, idxd_batch)		batch_pool;
	TAILQ_HEAD(, idxd_batch)		batches;

	void					*batch_base;
};

@@ -152,19 +141,18 @@ struct idxd_group {
 * This struct wraps the hardware completion record which is 32 bytes in
 * size and must be 32 byte aligned.
 */
struct idxd_comp {
struct idxd_ops {
	struct idxd_hw_comp_record	hw;
	void				*cb_arg;
	spdk_idxd_req_cb		cb_fn;
	struct idxd_batch		*batch;
	struct idxd_hw_desc		*desc;
	uint32_t			*crc_dst;
	uint32_t			index;
	bool				batch_op;
	char				pad[3];
	TAILQ_ENTRY(idxd_comp)		link;
	char				pad[7];
	TAILQ_ENTRY(idxd_ops)		link;
};
SPDK_STATIC_ASSERT(sizeof(struct idxd_comp) == 96, "size mismatch");
SPDK_STATIC_ASSERT(sizeof(struct idxd_ops) == 96, "size mismatch");

struct idxd_wq {
	struct spdk_idxd_device		*idxd;
+1 −1
Original line number Diff line number Diff line
@@ -47,7 +47,7 @@ DEPDIRS-rte_vhost :=
DEPDIRS-env_dpdk := log util

DEPDIRS-ioat := log
DEPDIRS-idxd := log util
DEPDIRS-idxd := log
DEPDIRS-sock := log $(JSON_LIBS)
DEPDIRS-util := log
DEPDIRS-vmd := log