From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by dpdk.org (Postfix) with ESMTP id ED734AAAC for ; Tue, 17 Apr 2018 15:35:47 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 17 Apr 2018 06:35:47 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.48,463,1517904000"; d="scan'208";a="34915393" Received: from silpixa00399501.ir.intel.com ([10.237.223.69]) by orsmga006.jf.intel.com with ESMTP; 17 Apr 2018 06:35:46 -0700 From: Lee Daly To: dev@dpdk.org Cc: pablo.de.lara.guarch@intel.com, greg.b.tucker@intel.com, deepak.k.jain@intel.com, fiona.trahe@intel.com, Lee Daly Date: Tue, 17 Apr 2018 14:35:23 +0100 Message-Id: <1523972132-6894-3-git-send-email-lee.daly@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1523972132-6894-1-git-send-email-lee.daly@intel.com> References: <1523038388-29964-1-git-send-email-lee.daly@intel.com> <1523972132-6894-1-git-send-email-lee.daly@intel.com> Subject: [dpdk-dev] [PATCH v3 02/11] compress/isal: add pmd device init and de-init X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Apr 2018 13:35:48 -0000 Signed-off-by: Lee Daly --- drivers/compress/isal/Makefile | 1 + drivers/compress/isal/isal_compress_pmd.c | 96 ++++++++++++++++++++++- drivers/compress/isal/isal_compress_pmd_ops.c | 25 ++++++ drivers/compress/isal/isal_compress_pmd_private.h | 24 ++++++ drivers/compress/isal/meson.build | 2 +- 5 files changed, 145 insertions(+), 3 deletions(-) create mode 100644 drivers/compress/isal/isal_compress_pmd_ops.c create mode 100644 drivers/compress/isal/isal_compress_pmd_private.h diff --git a/drivers/compress/isal/Makefile b/drivers/compress/isal/Makefile index 9b1d866..95904f6 100644 --- a/drivers/compress/isal/Makefile +++ b/drivers/compress/isal/Makefile @@ -25,6 +25,7 @@ EXPORT_MAP := rte_pmd_isal_version.map # library source files SRCS-$(CONFIG_RTE_LIBRTE_PMD_ISAL) += isal_compress_pmd.c +SRCS-$(CONFIG_RTE_LIBRTE_PMD_ISAL) += isal_compress_pmd_ops.c # export include files include $(RTE_SDK)/mk/rte.lib.mk diff --git a/drivers/compress/isal/isal_compress_pmd.c b/drivers/compress/isal/isal_compress_pmd.c index d7137fd..8e658b4 100644 --- a/drivers/compress/isal/isal_compress_pmd.c +++ b/drivers/compress/isal/isal_compress_pmd.c @@ -3,20 +3,102 @@ */ #include +#include +#include #include +#include "isal_compress_pmd_private.h" + +int isal_logtype_driver; + +/* Enqueue burst */ +static uint16_t +isal_comp_pmd_enqueue_burst(void *queue_pair __rte_unused, + struct rte_comp_op **ops __rte_unused, + uint16_t nb_ops __rte_unused) +{ + uint16_t num_enq = 0; + + return num_enq; +} + +/* Dequeue burst */ +static uint16_t +isal_comp_pmd_dequeue_burst(void *queue_pair __rte_unused, + struct rte_comp_op **ops __rte_unused, + uint16_t nb_ops __rte_unused) +{ + uint16_t nb_dequeued = 0; + + return nb_dequeued; +} + +/* Create ISA-L compression device */ +static int +compdev_isal_create(const char *name, struct rte_vdev_device *vdev, + struct rte_compressdev_pmd_init_params *init_params) +{ + struct rte_compressdev *dev; + + dev = rte_compressdev_pmd_create(name, &vdev->device, + sizeof(struct isal_comp_private), init_params); + if (dev == NULL) { + ISAL_PMD_LOG(ERR, "failed to create compressdev vdev"); + return -EFAULT; + } + + dev->dev_ops = isal_compress_pmd_ops; + + /* register rx/tx burst functions for data path */ + dev->dequeue_burst = isal_comp_pmd_dequeue_burst; + dev->enqueue_burst = isal_comp_pmd_enqueue_burst; + + return 0; +} + /** Remove compression device */ static int compdev_isal_remove_dev(struct rte_vdev_device *vdev __rte_unused) { - return 0; + struct rte_compressdev *compdev; + const char *name; + + name = rte_vdev_device_name(vdev); + if (name == NULL) + return -EINVAL; + + compdev = rte_compressdev_pmd_get_named_dev(name); + if (compdev == NULL) + return -ENODEV; + + return rte_compressdev_pmd_destroy(compdev); } /** Initialise ISA-L compression device */ static int compdev_isal_probe(struct rte_vdev_device *dev __rte_unused) { - return 0; + struct rte_compressdev_pmd_init_params init_params = { + "", + rte_socket_id(), + }; + const char *name, *args; + int retval; + + name = rte_vdev_device_name(dev); + if (name == NULL) + return -EINVAL; + + args = rte_vdev_device_args(dev); + + retval = rte_compressdev_pmd_parse_input_args(&init_params, args); + if (retval) { + ISAL_PMD_LOG(ERR, + "Failed to parse initialisation arguments[%s]\n", args); + return -EINVAL; + } + + return compdev_isal_create(name, dev, &init_params); } static struct rte_vdev_driver compdev_isal_pmd_drv = { @@ -27,3 +109,13 @@ static struct rte_vdev_driver compdev_isal_pmd_drv = { RTE_PMD_REGISTER_VDEV(COMPDEV_NAME_ISAL_PMD, compdev_isal_pmd_drv); RTE_PMD_REGISTER_PARAM_STRING(COMPDEV_NAME_ISAL_PMD, "socket_id="); + +RTE_INIT(isal_init_log); + +static void +isal_init_log(void) +{ + isal_logtype_driver = rte_log_register("comp_isal"); + if (isal_logtype_driver >= 0) + rte_log_set_level(isal_logtype_driver, RTE_LOG_INFO); +} diff --git a/drivers/compress/isal/isal_compress_pmd_ops.c b/drivers/compress/isal/isal_compress_pmd_ops.c new file mode 100644 index 0000000..cff05b4 --- /dev/null +++ b/drivers/compress/isal/isal_compress_pmd_ops.c @@ -0,0 +1,25 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2018 Intel Corporation + */ + +#include + +struct rte_compressdev_ops isal_pmd_ops = { + .dev_configure = NULL, + .dev_start = NULL, + .dev_stop = NULL, + .dev_close = NULL, + + .stats_get = NULL, + .stats_reset = NULL, + + .dev_infos_get = NULL, + + .queue_pair_setup = NULL, + .queue_pair_release = NULL, + + .private_xform_create = NULL, + .private_xform_free = NULL, +}; + +struct rte_compressdev_ops *isal_compress_pmd_ops = &isal_pmd_ops; diff --git a/drivers/compress/isal/isal_compress_pmd_private.h b/drivers/compress/isal/isal_compress_pmd_private.h new file mode 100644 index 0000000..09ecfb7 --- /dev/null +++ b/drivers/compress/isal/isal_compress_pmd_private.h @@ -0,0 +1,24 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2018 Intel Corporation + */ + +#ifndef _ISAL_COMP_PMD_PRIVATE_H_ +#define _ISAL_COMP_PMD_PRIVATE_H_ + +#define COMPDEV_NAME_ISAL_PMD compress_isal +/**< ISA-L comp PMD device name */ + +extern int isal_logtype_driver; +#define ISAL_PMD_LOG(level, fmt, args...) \ + rte_log(RTE_LOG_ ## level, isal_logtype_driver, "%s(): "fmt "\n", \ + __func__, ##args) + +/* private data structure for each ISA-L compression device */ +struct isal_comp_private { + struct rte_mempool *priv_xform_mp; +}; + +/** device specific operations function pointer structure */ +extern struct rte_compressdev_ops *isal_compress_pmd_ops; + +#endif /* _ISAL_COMP_PMD_PRIVATE_H_ */ diff --git a/drivers/compress/isal/meson.build b/drivers/compress/isal/meson.build index 4447e20..94c10fd 100644 --- a/drivers/compress/isal/meson.build +++ b/drivers/compress/isal/meson.build @@ -7,7 +7,7 @@ if not dep.found() endif deps += 'bus_vdev' -sources = files('isal_compress_pmd.c') +sources = files('isal_compress_pmd.c', 'isal_compress_pmd_ops.c') ext_deps += dep pkgconfig_extra_libs += '-lisal' -- 2.7.4