Commit 2186fc03 authored by Zhangfei Gao's avatar Zhangfei Gao Committed by Konrad Sztyber
Browse files

accel/dpdk_compressdev: Support uadk compress pmd



Add support of UADK Compress Poll Mode Driver to accel/dpdk_compressdev.

build:
./configure --with-dpdk-uadk  --with-dpdk-compressdev
make

./build/bin/spdk_tgt -m 0xf0 --wait-for-rpc

./scripts/rpc.py compressdev_scan_accel_module -p 3
./scripts/rpc.py accel_assign_opc -o compress -m dpdk_compressdev
./scripts/rpc.py accel_assign_opc -o decompress -m dpdk_compressdev
./scripts/rpc.py framework_start_init
./scripts/rpc.py accel_get_opc_assignments

Change-Id: I202c17c3a936208901a3bdc6bb2a11ddc88875f7
Signed-off-by: default avatarZhangfei Gao <zhangfei.gao@linaro.org>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/23738


Reviewed-by: default avatarChangpeng Liu <changpeliu@tencent.com>
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarKonrad Sztyber <konrad.sztyber@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: default avatarJim Harris <jim.harris@samsung.com>
parent 2828b121
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -2187,7 +2187,7 @@ Example response:

Set config and enable compressdev accel module offload.
Select the DPDK polled mode driver (pmd) for the accel compress module,
0 = auto-select, 1= QAT only, 2 = mlx5_pci only.
0 = auto-select, 1= QAT only, 2 = mlx5_pci only, 3 = uadk only.

#### Parameters

+1 −0
Original line number Diff line number Diff line
@@ -81,6 +81,7 @@ endif
# uadk drivers
ifeq ($(findstring y,$(CONFIG_DPDK_UADK)),y)
DPDK_DRIVERS += crypto/uadk
DPDK_DRIVERS += compress/uadk
endif
ifeq ($(CONFIG_CRYPTO),y)
DPDK_DRIVERS += crypto
+5 −0
Original line number Diff line number Diff line
@@ -97,6 +97,11 @@ endif
ifeq ($(CONFIG_VBDEV_COMPRESS_MLX5),y)
DPDK_LIB_LIST += rte_compress_mlx5
endif
ifeq ($(CONFIG_DPDK_UADK),y)
ifneq (, $(wildcard $(DPDK_LIB_DIR)/librte_compress_uadk.*))
DPDK_LIB_LIST += rte_compress_uadk
endif
endif
endif

ifeq ($(DPDK_FRAMEWORK),y)
+1 −1
Original line number Diff line number Diff line
@@ -347,7 +347,7 @@ SYS_LIBS += -lcrypto
SYS_LIBS += -lm

ifeq ($(CONFIG_DPDK_UADK),y)
SYS_LIBS += -lwd -lwd_crypto
SYS_LIBS += -lwd -lwd_crypto -lwd_comp
endif

PKGCONF ?= pkg-config
+26 −1
Original line number Diff line number Diff line
@@ -42,6 +42,7 @@ static bool g_compressdev_initialized = false;
#define MBUF_SPLIT		(1UL << DEFAULT_WINDOW_SIZE)
#define QAT_PMD			"compress_qat"
#define MLX5_PMD		"mlx5_pci"
#define UADK_PMD		"compress_uadk"
#define NUM_MBUFS		65536
#define POOL_CACHE_SIZE		256

@@ -83,6 +84,7 @@ static struct rte_mempool *g_comp_op_mp = NULL; /* comp operations, must be rte
static struct rte_mbuf_ext_shared_info g_shinfo = {};	/* used by DPDK mbuf macros */
static bool g_qat_available = false;
static bool g_mlx5_pci_available = false;
static bool g_uadk_available = false;

/* Create shared (between all ops per PMD) compress xforms. */
static struct rte_comp_xform g_comp_xform = {
@@ -232,6 +234,10 @@ create_compress_dev(uint8_t index)
		g_mlx5_pci_available = true;
	}

	if (strcmp(device->cdev_info.driver_name, UADK_PMD) == 0) {
		g_uadk_available = true;
	}

	return 0;

err_qp:
@@ -682,11 +688,15 @@ _set_pmd(struct compress_io_channel *chan)
			chan->drv_name = QAT_PMD;
		} else if (g_mlx5_pci_available) {
			chan->drv_name = MLX5_PMD;
		} else if (g_uadk_available) {
			chan->drv_name = UADK_PMD;
		}
	} else if (g_opts == COMPRESS_PMD_QAT_ONLY && g_qat_available) {
		chan->drv_name = QAT_PMD;
	} else if (g_opts == COMPRESS_PMD_MLX5_PCI_ONLY && g_mlx5_pci_available) {
		chan->drv_name = MLX5_PMD;
	} else if (g_opts == COMPRESS_PMD_UADK_ONLY && g_uadk_available) {
		chan->drv_name = UADK_PMD;
	} else {
		SPDK_ERRLOG("Requested PMD is not available.\n");
		return false;
@@ -707,6 +717,17 @@ accel_compress_init(void)
		return -EINVAL;
	}

	if (g_opts == COMPRESS_PMD_UADK_ONLY) {
		char *driver_name = UADK_PMD;

		rc = rte_vdev_init(driver_name, NULL);
		if (rc) {
			SPDK_NOTICELOG("Failed to create virtual PMD %s: error %d. "
				       "Possibly %s is not supported by DPDK library. "
				       "Keep going...\n", driver_name, rc, driver_name);
		}
	}

	rc = accel_init_compress_drivers();
	if (rc) {
		assert(TAILQ_EMPTY(&g_compress_devs));
@@ -819,7 +840,7 @@ accel_compress_get_ctx_size(void)
static bool
compress_supports_opcode(enum spdk_accel_opcode opc)
{
	if (g_mlx5_pci_available || g_qat_available) {
	if (g_mlx5_pci_available || g_qat_available || g_uadk_available) {
		switch (opc) {
		case SPDK_ACCEL_OPC_COMPRESS:
		case SPDK_ACCEL_OPC_DECOMPRESS:
@@ -875,6 +896,10 @@ _device_unregister_cb(void *io_device)
		free(dev_qp);
	}

	if (g_opts == COMPRESS_PMD_UADK_ONLY) {
		rte_vdev_uninit(UADK_PMD);
	}

	pthread_mutex_destroy(&g_comp_device_qp_lock);

	rte_mempool_free(g_comp_op_mp);
Loading