From patchwork Sun Jul 12 20:58:52 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ori Kam X-Patchwork-Id: 73849 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 105F5A052A; Sun, 12 Jul 2020 23:01:09 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 8CE3E1D56E; Sun, 12 Jul 2020 23:00:04 +0200 (CEST) Received: from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129]) by dpdk.org (Postfix) with ESMTP id 6A8D71D56E for ; Sun, 12 Jul 2020 23:00:00 +0200 (CEST) Received: from Internal Mail-Server by MTLPINE1 (envelope-from orika@mellanox.com) with SMTP; 12 Jul 2020 23:59:56 +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 06CKxFG6025997; Sun, 12 Jul 2020 23:59:56 +0300 From: Ori Kam To: jerinj@marvell.com, xiang.w.wang@intel.com, matan@mellanox.com, viacheslavo@mellanox.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, rasland@mellanox.com Date: Sun, 12 Jul 2020 20:58:52 +0000 Message-Id: <1594587541-110442-12-git-send-email-orika@mellanox.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1594587541-110442-1-git-send-email-orika@mellanox.com> References: <1593941027-86651-1-git-send-email-orika@mellanox.com> <1594587541-110442-1-git-send-email-orika@mellanox.com> Subject: [dpdk-dev] [PATCH v2 11/20] regex/mlx5: add get info function 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 adds the get info function. Signed-off-by: Ori Kam --- drivers/regex/mlx5/Makefile | 1 + drivers/regex/mlx5/meson.build | 1 + drivers/regex/mlx5/mlx5_regex.c | 5 ++++- drivers/regex/mlx5/mlx5_regex.h | 5 +++++ drivers/regex/mlx5/mlx5_rxp.c | 41 +++++++++++++++++++++++++++++++++++++++++ 5 files changed, 52 insertions(+), 1 deletion(-) create mode 100644 drivers/regex/mlx5/mlx5_rxp.c diff --git a/drivers/regex/mlx5/Makefile b/drivers/regex/mlx5/Makefile index 3b99570..be23b5a 100644 --- a/drivers/regex/mlx5/Makefile +++ b/drivers/regex/mlx5/Makefile @@ -8,6 +8,7 @@ LIB = librte_pmd_mlx5_regex.a # Sources. SRCS-$(CONFIG_RTE_LIBRTE_MLX5_REGEX_PMD) += mlx5_regex.c +SRCS-$(CONFIG_RTE_LIBRTE_MLX5_REGEX_PMD) += mlx5_rxp.c # Basic CFLAGS. CFLAGS += -O3 diff --git a/drivers/regex/mlx5/meson.build b/drivers/regex/mlx5/meson.build index 327c0ad..d8d35c3 100644 --- a/drivers/regex/mlx5/meson.build +++ b/drivers/regex/mlx5/meson.build @@ -11,6 +11,7 @@ fmt_name = 'mlx5_regex' deps += ['common_mlx5', 'pci', 'bus_pci', 'eal', 'sched', 'regexdev'] sources = files( 'mlx5_regex.c', + 'mlx5_rxp.c', ) cflags_options = [ '-std=c11', diff --git a/drivers/regex/mlx5/mlx5_regex.c b/drivers/regex/mlx5/mlx5_regex.c index c469a10..2c4b7ce 100644 --- a/drivers/regex/mlx5/mlx5_regex.c +++ b/drivers/regex/mlx5/mlx5_regex.c @@ -21,7 +21,10 @@ int mlx5_regex_logtype; -static const struct rte_regexdev_ops mlx5_regexdev_ops = {}; +const struct rte_regexdev_ops mlx5_regexdev_ops = { + .dev_info_get = mlx5_regex_info_get, +}; + static struct ibv_device * mlx5_regex_get_ib_device_match(struct rte_pci_addr *addr) diff --git a/drivers/regex/mlx5/mlx5_regex.h b/drivers/regex/mlx5/mlx5_regex.h index 0ce1e4d..9d0fc16 100644 --- a/drivers/regex/mlx5/mlx5_regex.h +++ b/drivers/regex/mlx5/mlx5_regex.h @@ -11,4 +11,9 @@ struct mlx5_regex_priv { struct rte_pci_device *pci_dev; struct rte_regexdev *regexdev; /* Pointer to the RegEx dev. */ }; + +/* mlx5_rxp.c */ +int mlx5_regex_info_get(struct rte_regexdev *dev, + struct rte_regexdev_info *info); + #endif /* MLX5_REGEX_H */ diff --git a/drivers/regex/mlx5/mlx5_rxp.c b/drivers/regex/mlx5/mlx5_rxp.c new file mode 100644 index 0000000..12d55ed --- /dev/null +++ b/drivers/regex/mlx5/mlx5_rxp.c @@ -0,0 +1,41 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright 2020 Mellanox Technologies, Ltd + */ + +#include +#include +#include +#include +#include + +#include "mlx5_regex.h" + +#define MLX5_REGEX_MAX_MATCHES 255 +#define MLX5_REGEX_MAX_PAYLOAD_SIZE UINT16_MAX +#define MLX5_REGEX_MAX_RULES_PER_GROUP UINT16_MAX +#define MLX5_REGEX_MAX_GROUPS UINT16_MAX + +/** + * DPDK callback for reading device info. + * + * @param dev + * Pointer to RegEx device structure. + * @param[out] info + * Pointer to the regexdev info structure to be filled with the contextual + * information of the device. + * + * @return + * 0 on success, a negative errno value otherwise and rte_errno is set. + */ +int +mlx5_regex_info_get(struct rte_regexdev *dev __rte_unused, + struct rte_regexdev_info *info) +{ + info->max_matches = MLX5_REGEX_MAX_MATCHES; + info->max_payload_size = MLX5_REGEX_MAX_PAYLOAD_SIZE; + info->max_rules_per_group = MLX5_REGEX_MAX_RULES_PER_GROUP; + info->max_groups = MLX5_REGEX_MAX_GROUPS; + info->regexdev_capa = RTE_REGEXDEV_SUPP_PCRE_GREEDY_F; + info->rule_flags = 0; + return 0; +}