From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 23308A00C5; Mon, 6 Jul 2020 19:37:14 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id E2EF01DBA8; Mon, 6 Jul 2020 19:37:04 +0200 (CEST) Received: from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129]) by dpdk.org (Postfix) with ESMTP id 1AAA01DB98 for ; Mon, 6 Jul 2020 19:37:02 +0200 (CEST) Received: from Internal Mail-Server by MTLPINE1 (envelope-from orika@mellanox.com) with SMTP; 6 Jul 2020 20:36:59 +0300 Received: from pegasus04.mtr.labs.mlnx. (pegasus04.mtr.labs.mlnx [10.210.16.126]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id 066HatUj011737; Mon, 6 Jul 2020 20:36:59 +0300 From: Ori Kam To: jerinj@marvell.com, xiang.w.wang@intel.com Cc: guyk@marvell.com, dev@dpdk.org, pbhagavatula@marvell.com, shahafs@mellanox.com, hemant.agrawal@nxp.com, opher@mellanox.com, alexr@mellanox.com, dovrat@marvell.com, pkapoor@marvell.com, nipun.gupta@nxp.com, bruce.richardson@intel.com, yang.a.hong@intel.com, harry.chang@intel.com, gu.jian1@zte.com.cn, shanjiangh@chinatelecom.cn, zhangy.yun@chinatelecom.cn, lixingfu@huachentel.com, wushuai@inspur.com, yuyingxia@yxlink.com, fanchenggang@sunyainfo.com, davidfgao@tencent.com, liuzhong1@chinaunicom.cn, zhaoyong11@huawei.com, oc@yunify.com, jim@netgate.com, hongjun.ni@intel.com, deri@ntop.org, fc@napatech.com, arthur.su@lionic.com, thomas@monjalon.net, orika@mellanox.com Date: Mon, 6 Jul 2020 17:36:47 +0000 Message-Id: <1594057009-75673-3-git-send-email-orika@mellanox.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1594057009-75673-1-git-send-email-orika@mellanox.com> References: <1585464438-111285-1-git-send-email-orika@mellanox.com> <1594057009-75673-1-git-send-email-orika@mellanox.com> Subject: [dpdk-dev] [PATCH v5 2/4] regexdev: add regex core h file 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" This commit introduce the rte_regexdev_core.h file. This file holds internal structures and API that are used by the regexdev. Signed-off-by: Ori Kam Acked-by: Guy Kaneti --- v5: * No changes. v4: * No changes. v3: * Align internal function pointers API to the RTE level API. v2: * Move private data to rte_regexdev struct. --- lib/librte_regexdev/Makefile | 1 + lib/librte_regexdev/meson.build | 2 +- lib/librte_regexdev/rte_regexdev.h | 2 + lib/librte_regexdev/rte_regexdev_core.h | 161 ++++++++++++++++++++++++++++++++ 4 files changed, 165 insertions(+), 1 deletion(-) create mode 100644 lib/librte_regexdev/rte_regexdev_core.h diff --git a/lib/librte_regexdev/Makefile b/lib/librte_regexdev/Makefile index 2e2925e..e27451f 100644 --- a/lib/librte_regexdev/Makefile +++ b/lib/librte_regexdev/Makefile @@ -24,6 +24,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_REGEXDEV) := rte_regexdev.c # export include files SYMLINK-$(CONFIG_RTE_LIBRTE_REGEXDEV)-include += rte_regexdev.h +SYMLINK-$(CONFIG_RTE_LIBRTE_REGEXDEV)-include += rte_regexdev_core.h # versioning export map EXPORT_MAP := rte_regexdev_version.map diff --git a/lib/librte_regexdev/meson.build b/lib/librte_regexdev/meson.build index 5256591..32e8da7 100644 --- a/lib/librte_regexdev/meson.build +++ b/lib/librte_regexdev/meson.build @@ -2,5 +2,5 @@ # Copyright(C) 2020 Mellanox Technologies, Ltd sources = files('rte_regexdev.c') -headers = files('rte_regexdev.h') +headers = files('rte_regexdev.h', 'rte_regexdev_core.h') deps += ['mbuf'] diff --git a/lib/librte_regexdev/rte_regexdev.h b/lib/librte_regexdev/rte_regexdev.h index b8a5346..3101b4a 100644 --- a/lib/librte_regexdev/rte_regexdev.h +++ b/lib/librte_regexdev/rte_regexdev.h @@ -1466,6 +1466,8 @@ struct rte_regex_ops { rte_regexdev_dequeue_burst(uint8_t dev_id, uint16_t qp_id, struct rte_regex_ops **ops, uint16_t nb_ops); +#include "rte_regexdev_core.h" + #ifdef __cplusplus } #endif diff --git a/lib/librte_regexdev/rte_regexdev_core.h b/lib/librte_regexdev/rte_regexdev_core.h new file mode 100644 index 0000000..ddf764e --- /dev/null +++ b/lib/librte_regexdev/rte_regexdev_core.h @@ -0,0 +1,161 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(C) 2020 Mellanox Technologies, Ltd + */ + +#ifndef _RTE_REGEX_CORE_H_ +#define _RTE_REGEX_CORE_H_ + +/** + * @file + * + * RTE RegEx Device internal header. + * + * This header contains internal data types, that are used by the RegEx devices + * in order to expose their ops to the class. + * + * Applications should not use these API directly. + * + */ + +struct rte_regexdev; + +typedef int (*regexdev_info_get_t)(struct rte_regexdev *dev, + struct rte_regexdev_info *info); +/**< @internal Get the RegEx device info. */ + +typedef int (*regexdev_configure_t)(struct rte_regexdev *dev, + const struct rte_regexdev_config *cfg); +/**< @internal Configure the RegEx device. */ + +typedef int (*regexdev_qp_setup_t)(struct rte_regexdev *dev, uint16_t id, + const struct rte_regexdev_qp_conf *qp_conf); +/**< @internal Setup a queue pair.*/ + +typedef int (*regexdev_start_t)(struct rte_regexdev *dev); +/**< @internal Start the RegEx device. */ + +typedef int (*regexdev_stop_t)(struct rte_regexdev *dev); +/**< @internal Stop the RegEx device. */ + +typedef int (*regexdev_close_t)(struct rte_regexdev *dev); +/**< @internal Close the RegEx device. */ + +typedef int (*regexdev_attr_get_t)(struct rte_regexdev *dev, + enum rte_regexdev_attr_id id, + void *value); +/**< @internal Get selected attribute from RegEx device. */ + +typedef int (*regexdev_attr_set_t)(struct rte_regexdev *dev, + enum rte_regexdev_attr_id id, + const void *value); +/**< @internal Set selected attribute to RegEx device. */ + +typedef int (*regexdev_rule_db_update_t)(struct rte_regexdev *dev, + const struct rte_regexdev_rule *rules, + uint16_t nb_rules); +/**< @internal Update the rule database for the RegEx device. */ + +typedef int (*regexdev_rule_db_compile_activate_t)(struct rte_regexdev *dev); +/**< @internal Compile the rule database and activate it. */ + +typedef int (*regexdev_rule_db_import_t)(struct rte_regexdev *dev, + const char *rule_db, + uint32_t rule_db_len); +/**< @internal Upload a pre created rule database to the RegEx device. */ + +typedef int (*regexdev_rule_db_export_t)(struct rte_regexdev *dev, + char *rule_db); +/**< @internal Export the current rule database from the RegEx device. */ + +typedef int (*regexdev_xstats_names_get_t)(struct rte_regexdev *dev, + struct rte_regexdev_xstats_map + *xstats_map); +/**< @internal Get xstats name map for the RegEx device. */ + +typedef int (*regexdev_xstats_get_t)(struct rte_regexdev *dev, + const uint16_t *ids, uint64_t *values, + uint16_t nb_values); +/**< @internal Get xstats values for the RegEx device. */ + +typedef int (*regexdev_xstats_by_name_get_t)(struct rte_regexdev *dev, + const char *name, uint16_t *id, + uint64_t *value); +/**< @internal Get xstat value for the RegEx device based on the xstats name. */ + +typedef int (*regexdev_xstats_reset_t)(struct rte_regexdev *dev, + const uint16_t *ids, + uint16_t nb_ids); +/**< @internal Reset xstats values for the RegEx device. */ + +typedef int (*regexdev_selftest_t)(struct rte_regexdev *dev); +/**< @internal Trigger RegEx self test. */ + +typedef int (*regexdev_dump_t)(struct rte_regexdev *dev, FILE *f); +/**< @internal Dump internal information about the RegEx device. */ + +typedef uint16_t (*regexdev_enqueue_t)(struct rte_regexdev *dev, uint16_t qp_id, + struct rte_regex_ops **ops, + uint16_t nb_ops); +/**< @internal Enqueue a burst of scan requests to a queue on RegEx device. */ + +typedef uint16_t (*regexdev_dequeue_t)(struct rte_regexdev *dev, uint16_t qp_id, + struct rte_regex_ops **ops, + uint16_t nb_ops); +/**< @internal Dequeue a burst of scan response from a queue on RegEx device. */ + +/** + * RegEx device operations + */ +struct rte_regexdev_ops { + regexdev_info_get_t dev_info_get; + regexdev_configure_t dev_configure; + regexdev_qp_setup_t dev_qp_setup; + regexdev_start_t dev_start; + regexdev_stop_t dev_stop; + regexdev_close_t dev_close; + regexdev_attr_get_t dev_attr_get; + regexdev_attr_set_t dev_attr_set; + regexdev_rule_db_update_t dev_rule_db_update; + regexdev_rule_db_compile_activate_t dev_rule_db_compile_activate; + regexdev_rule_db_import_t dev_db_import; + regexdev_rule_db_export_t dev_db_export; + regexdev_xstats_names_get_t dev_xstats_names_get; + regexdev_xstats_get_t dev_xstats_get; + regexdev_xstats_by_name_get_t dev_xstats_by_name_get; + regexdev_xstats_reset_t dev_xstats_reset; + regexdev_selftest_t dev_selftest; + regexdev_dump_t dev_dump; +}; + +#define RTE_REGEXDEV_NAME_MAX_LEN +/** + * @internal + * The data part, with no function pointers, associated with each RegEx device. + * + * This structure is safe to place in shared memory to be common among different + * processes in a multi-process configuration. + */ +struct rte_regexdev_data { + void *dev_private; /**< PMD-specific private data. */ +} __rte_cache_aligned; + +/** + * @internal + * The generic data structure associated with each RegEx device. + * + * Pointers to burst-oriented packet receive and transmit functions are + * located at the beginning of the structure, along with the pointer to + * where all the data elements for the particular device are stored in shared + * memory. This split allows the function pointer and driver data to be per- + * process, while the actual configuration data for the device is shared. + */ +struct rte_regexdev { + regexdev_enqueue_t enqueue; + regexdev_dequeue_t dequeue; + const struct rte_regexdev_ops *dev_ops; + /**< Functions exported by PMD */ + struct rte_device *device; /**< Backing device */ + struct rte_regexdev_data *data; /**< Pointer to device data. */ +} __rte_cache_aligned; + +#endif /* _RTE_REGEX_CORE_H_ */ -- 1.8.3.1