From patchwork Mon Oct 7 19:33:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Serhii Iliushyk X-Patchwork-Id: 145321 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 45EB845AD8; Mon, 7 Oct 2024 21:35:57 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D8C0E40612; Mon, 7 Oct 2024 21:35:16 +0200 (CEST) Received: from egress-ip42b.ess.de.barracuda.com (egress-ip42b.ess.de.barracuda.com [18.185.115.246]) by mails.dpdk.org (Postfix) with ESMTP id 019CC40616 for ; Mon, 7 Oct 2024 21:35:11 +0200 (CEST) Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05lp2172.outbound.protection.outlook.com [104.47.17.172]) by mx-outbound18-114.eu-central-1b.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Mon, 07 Oct 2024 19:35:11 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=G0UXp3PA7rDwBQbmiIAi3qrgBauZf0fPY13PzfGyWor+qyo8A1sgh11XmFF+8/QAUmR2ncBtZ3A3I7hKqdvy3290AgunAz4dB9ScsTWvpRfrz+qnVh5WkiCitqaXiyQwaVBQnrovwI2/Hcq6gcJP/3C4Rrt+a8mrqgrIZd/zotSYV9Rvmu39UlZj128J27zudvEWIFjZEJg3SbXWOv4smZpg2U4hB0nQIs0JeGvh0lMQA+dD/cusjltiIW+k4UJhUyiqAgcqwdWAvx6PRuFuBqpW5KwlbzKX5GGv9RDuwqhHYW3Id4EGC4jjMC2b3X0UpHM+3jDUTEEhhUUhbtMj5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=ioKXq9wbefaYP6VdfUAchgaemRcCvu0za7Z2flLB11U=; b=gDJtqQvQAVGEjOA90tI3d+eQInirS9fVqV4+LHA+f/hJwIntrVZJ7K7s6PrDUrF+xd44LawboGXJN0tr2WR84PxEuHU6biPC7LiZUBON+NV/5SNgXqExiX1X7Fo04JUjiR9Ohz2rmkFkSv0/wIvq/inZNPwZtavREbc8wmj83XlVZmN1p4iGnpBsbpar20yLi/0xpZhq9z+DSaafa3+hpDwnEqmmZzPBxUjCx6qOUu6PJUIwcjbFa25av8U2IEHaM8LcNQGggWN4ISTe6IQWN2UnPqHccKRvuAk73iMJPeSSNn9fVuyWqcszPFzwVWOzHuZ4ztHFMFsYuMqtyx2aGQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=fail (sender ip is 178.72.21.4) smtp.rcpttodomain=dpdk.org smtp.mailfrom=napatech.com; dmarc=fail (p=reject sp=reject pct=100) action=oreject header.from=napatech.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=napatech.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ioKXq9wbefaYP6VdfUAchgaemRcCvu0za7Z2flLB11U=; b=XMSgE14cnvwLwWGl0xZpHCji5uFbQ/+uVE1nVBeAwBJbL/7cARQ05G+485TU+TSAMM5WWGoSL531L2ysM86OHf2g10ChtsSj1xYPIqdydTQyKph36iBNIOv2aB60Ct14SCOTTqWVxP5SoxMD5sjv89zZVaOKROTLjg/VwmiCHEo= Received: from DB9PR05CA0028.eurprd05.prod.outlook.com (2603:10a6:10:1da::33) by AM9P190MB1218.EURP190.PROD.OUTLOOK.COM (2603:10a6:20b:265::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.22; Mon, 7 Oct 2024 19:35:09 +0000 Received: from DB1PEPF000509EC.eurprd03.prod.outlook.com (2603:10a6:10:1da:cafe::63) by DB9PR05CA0028.outlook.office365.com (2603:10a6:10:1da::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7982.34 via Frontend Transport; Mon, 7 Oct 2024 19:35:09 +0000 X-MS-Exchange-Authentication-Results: spf=fail (sender IP is 178.72.21.4) smtp.mailfrom=napatech.com; dkim=none (message not signed) header.d=none;dmarc=fail action=oreject header.from=napatech.com; Received-SPF: Fail (protection.outlook.com: domain of napatech.com does not designate 178.72.21.4 as permitted sender) receiver=protection.outlook.com; client-ip=178.72.21.4; helo=localhost.localdomain; Received: from localhost.localdomain (178.72.21.4) by DB1PEPF000509EC.mail.protection.outlook.com (10.167.242.70) with Microsoft SMTP Server id 15.20.8048.13 via Frontend Transport; Mon, 7 Oct 2024 19:35:08 +0000 From: Serhii Iliushyk To: dev@dpdk.org Cc: mko-plv@napatech.com, sil-plv@napatech.com, ckm@napatech.com, andrew.rybchenko@oktetlabs.ru, ferruh.yigit@amd.com, Oleksandr Kolomeiets Subject: [PATCH v2 08/50] net/ntnic: add flow backend initialization API Date: Mon, 7 Oct 2024 21:33:44 +0200 Message-ID: <20241007193436.675785-9-sil-plv@napatech.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20241007193436.675785-1-sil-plv@napatech.com> References: <20241006203728.330792-2-sil-plv@napatech.com> <20241007193436.675785-1-sil-plv@napatech.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DB1PEPF000509EC:EE_|AM9P190MB1218:EE_ X-MS-Office365-Filtering-Correlation-Id: 4048c2ea-80c8-4593-6242-08dce7072762 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|1800799024|36860700013|82310400026; X-Microsoft-Antispam-Message-Info: mXxwDXUOPqrLd2N+g8KhOC7Gl8sv+KCh8QZoiQ7z5Nl/wL2UOrJoXRE3YWH8AQ+VOMYIlDfVreZLNhjKZ8MuncPNBt7sBPPxfWgItoRC4MeWBTuE8F2jZW2c5otKFbMlFBYBAKh4YPAPN3zL3er3pkzXIGMGL6d3HjCFDsc05wxsljRuCdxWChxa2Ccb3sd7xRT8EwIzxXjeW479BleDCIQZLYUakQDoW/TmZiuB+SKsnnFnkUa1G0/PaT0IVgIqUgOegA+xU7kev+Jv3z+yV8YsRLqMhbSkji7Y128NUwUpwXElkoLdSZ4fbn4Iql00fwxqp9JyLpCMB4NDgd63kWIywlwo/2+Pw7rZXu5R61cw4gzXE/Fqx80mQD2gUNhK8kGfo3mCV5gTPR+/BDqfhOuoscjURNwJD9nr3bLvEHnrYNsq72SJY/ZxHRIvmvj68Il/N6mC0unlbsFVbO++qLkXziLdYpFfKLIDzygfQafV+ObiiS0PVQViz30KGUq20KCFOZ++4sNgAJD0CxN/2Ud5XAjaA5ty2Ohp1yX0KJBloO7InEpMuEdqNIamH+EooesEW2wIeBm15ABTck106tav02Pr8tZDbiGx5ibO+2gjQx3OywMXO9hiW00IbDKDwQekrR2HsuUWf7t1JSQkfs2kO9YIDgt2+O3SCOQ9ZT+g1D8/OjY4AI4DoVW0UbQUFT0hpUUaBDfiSq6McRR+73K6K/fQvPtRWl2x0StcOOVZ8NX3JR7mf5tdxq6IWo3uOwA8OD7l0lh+SjPJbfnVA2ADmmJWKYZXNykZ8mjp3wYks5TSvnowVTkGtFCMeay6KKjW6njOusSYxK8MEzot5c7A7qUQxhJsxSk+tvUVhB73QeXnGx3GlhegOKfR9feTibSAJidYH30dkrAYk0SYTzojPH1DDg9ks4X5Ix2yhYhDQwu/vHq+dsoPd5rtKekHzRpnpfOJazshq/gl+sXc08nGxczbZpvxknpyoQF7fSZ3h/ypMuaHkUMemiu3MyAYv58tsLd8jNzR6DdJeLE0imfSeXQ+DzLYT5tU6pk1PDNzQ3fkVwhlKrLxLrhPJWZC3qjotEChzjbvCRRP3/njPqvqUjNMkEu1orCMfJRJxTkvf0NsYbTYmE6swkY/JyKtBC4L5JM7KgSZaaftphoBQCLcVKCItFwxtSetkdWMlJT+AgMxTGGfgPvLpEH7n5X4gGymWl7XSR/XhZegKqI8iWJTCT3UEnb6AdrW6xtn4gi9P1ncnxybW/rR7Cjj2QBnW1S+oVzCUKb3qlvO4mbsVqX2YMs8uD90PzlsJHuLiD3DGrv90127dna2gKLhnoTGfhYfpK4QHHjPnaoOvlXUu6LmgUUwBvmrEwnteSgUUkmsOBnjxIv18pE3TL7xPcXv X-Forefront-Antispam-Report: CIP:178.72.21.4; CTRY:DK; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:localhost.localdomain; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230040)(376014)(1800799024)(36860700013)(82310400026); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: oyzCOwPZAKjO8pmGr889BRIVCQQs6ip5RTTYmIM4Wh2F7MJZGJUKJ+0sa+OqITcFBy+pRrD0bm0OgoQa8i+QfDVX97qHyQ2843ZYRuJdcZ8CchHe5A/83C4lHENRNLqDDnacoEB8j87flY/Pfx19HE2+h4op5qnOEltg8MUBqWCQnDafxv0/xDjiiPu+UQe9LvCY9KxhmdwnWwqMbLD4eBIDX62i4V0lpBA5NJnJyk/UyX8/m1hRpvcqVKNTWrVZJMwS8erC8CCoXFsK5jIqe5hMb403am5Ste3u+TehV9puSlKkc7xIfxtSdYTxPoFnf0WCUvSvhsZhkvyOlxgsky3QjZnpY3F3YbV/5raYGmtJ7R7YJ4wWo+OD5AUQuLSdhy311sb0sCII7fWBFWT5KcKOc91hxAqPsLZuPeTZLTNRZX4KfRpmsorf9G8ui/VZhqWZu7eX68eXAjcaOcMbMW6nVAINI5dcOHzIqOzU4SBdcZM2JiGSysvP3tQmcvP/QH9T2qiRhpaiVg9jq0zWBeO22qmcFImy0euEabcLvpz1i+xOEXNGTjypt5HITUG12c68l2XzodJCXKJWLq8c+AhpgToR2TESof/BerytSLRxjE6yiMHoVI+O8bnQN8j9BeohSWrqhgfmNAGbWt/3jg== X-OriginatorOrg: napatech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Oct 2024 19:35:08.8501 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4048c2ea-80c8-4593-6242-08dce7072762 X-MS-Exchange-CrossTenant-Id: c4540d0b-728a-4233-9da5-9ea30c7ec3ed X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=c4540d0b-728a-4233-9da5-9ea30c7ec3ed; Ip=[178.72.21.4]; Helo=[localhost.localdomain] X-MS-Exchange-CrossTenant-AuthSource: DB1PEPF000509EC.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9P190MB1218 X-BESS-ID: 1728329711-304722-3998-4090-1 X-BESS-VER: 2019.1_20241004.2057 X-BESS-Apparent-Source-IP: 104.47.17.172 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVqaWBpZAVgZQ0NIsxSLFyDIx1d jELCnVLM0yKcXYyDAtLc000czE1DhFqTYWADLZcC5BAAAA X-BESS-Outbound-Spam-Score: 0.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.259566 [from cloudscan19-135.eu-central-1b.ess.aws.cudaops.com] Rule breakdown below pts rule name description ---- ---------------------- -------------------------------- 0.00 BSF_BESS_OUTBOUND META: BESS Outbound X-BESS-Outbound-Spam-Status: SCORE=0.00 using account:ESS113687 scores of KILL_LEVEL=7.0 tests=BSF_BESS_OUTBOUND X-BESS-BRTS-Status: 1 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org From: Oleksandr Kolomeiets Add high-level interfaces for the initialization of the backend. Signed-off-by: Oleksandr Kolomeiets --- v2 * Update release notes --- doc/guides/rel_notes/release_24_11.rst | 1 + drivers/net/ntnic/include/flow_api.h | 2 ++ drivers/net/ntnic/include/flow_filter.h | 14 ++++++++++ drivers/net/ntnic/meson.build | 2 ++ drivers/net/ntnic/nthw/flow_api/flow_api.c | 17 ++++++++++++ drivers/net/ntnic/nthw/flow_api/flow_filter.c | 27 +++++++++++++++++++ drivers/net/ntnic/ntnic_mod_reg.c | 15 +++++++++++ drivers/net/ntnic/ntnic_mod_reg.h | 9 +++++++ 8 files changed, 87 insertions(+) create mode 100644 drivers/net/ntnic/include/flow_filter.h create mode 100644 drivers/net/ntnic/nthw/flow_api/flow_api.c create mode 100644 drivers/net/ntnic/nthw/flow_api/flow_filter.c diff --git a/doc/guides/rel_notes/release_24_11.rst b/doc/guides/rel_notes/release_24_11.rst index ee848d5a3d..28d27366f1 100644 --- a/doc/guides/rel_notes/release_24_11.rst +++ b/doc/guides/rel_notes/release_24_11.rst @@ -105,6 +105,7 @@ New Features * Fix issues related to release 24.07 * Extended and fixed the implementation of the logging * Added NT flow filter init API + * Added NT flow backend initialization API Removed Items ------------- diff --git a/drivers/net/ntnic/include/flow_api.h b/drivers/net/ntnic/include/flow_api.h index 036e652b76..112bcabdb5 100644 --- a/drivers/net/ntnic/include/flow_api.h +++ b/drivers/net/ntnic/include/flow_api.h @@ -6,6 +6,8 @@ #ifndef _FLOW_API_H_ #define _FLOW_API_H_ +#include "ntlog.h" + /* registered NIC backends */ struct flow_nic_dev; diff --git a/drivers/net/ntnic/include/flow_filter.h b/drivers/net/ntnic/include/flow_filter.h new file mode 100644 index 0000000000..01cfce03d7 --- /dev/null +++ b/drivers/net/ntnic/include/flow_filter.h @@ -0,0 +1,14 @@ +/* + * SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2023 Napatech A/S + */ + +#ifndef __FLOW_FILTER_HPP__ +#define __FLOW_FILTER_HPP__ + +#include "flow_api.h" +#include "nthw_fpga_model.h" + +int flow_filter_init(nthw_fpga_t *p_fpga, struct flow_nic_dev **p_flow_device, int adapter_no); + +#endif /* __FLOW_FILTER_HPP__ */ diff --git a/drivers/net/ntnic/meson.build b/drivers/net/ntnic/meson.build index e9f2110b8f..00b1ae4c70 100644 --- a/drivers/net/ntnic/meson.build +++ b/drivers/net/ntnic/meson.build @@ -42,6 +42,8 @@ sources = files( 'nthw/core/nthw_pcie3.c', 'nthw/core/nthw_sdc.c', 'nthw/core/nthw_si5340.c', + 'nthw/flow_api/flow_api.c', + 'nthw/flow_api/flow_filter.c', 'nthw/model/nthw_fpga_model.c', 'nthw/nthw_platform.c', 'nthw/nthw_rac.c', diff --git a/drivers/net/ntnic/nthw/flow_api/flow_api.c b/drivers/net/ntnic/nthw/flow_api/flow_api.c new file mode 100644 index 0000000000..b4866d4bdf --- /dev/null +++ b/drivers/net/ntnic/nthw/flow_api/flow_api.c @@ -0,0 +1,17 @@ +/* + * SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2023 Napatech A/S + */ + +#include "ntnic_mod_reg.h" + +#include "flow_filter.h" + +static const struct flow_filter_ops ops = { + .flow_filter_init = flow_filter_init, +}; + +void init_flow_filter(void) +{ + register_flow_filter_ops(&ops); +} diff --git a/drivers/net/ntnic/nthw/flow_api/flow_filter.c b/drivers/net/ntnic/nthw/flow_api/flow_filter.c new file mode 100644 index 0000000000..7b6e122190 --- /dev/null +++ b/drivers/net/ntnic/nthw/flow_api/flow_filter.c @@ -0,0 +1,27 @@ +/* + * SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2023 Napatech A/S + */ + +#include "flow_filter.h" +#include "ntnic_mod_reg.h" + +int flow_filter_init(nthw_fpga_t *p_fpga, struct flow_nic_dev **p_flow_device, int adapter_no) +{ + (void)p_flow_device; + (void)adapter_no; + + void *be_dev = NULL; + + const struct flow_backend_ops *flow_backend_ops = get_flow_backend_ops(); + + if (flow_backend_ops == NULL) { + NT_LOG(ERR, FILTER, "%s: flow_backend module uninitialized\n", __func__); + return -1; + } + + NT_LOG(DBG, FILTER, "Initializing flow filter api\n"); + flow_backend_ops->bin_flow_backend_init(p_fpga, &be_dev); + + return 0; +} diff --git a/drivers/net/ntnic/ntnic_mod_reg.c b/drivers/net/ntnic/ntnic_mod_reg.c index 45cc767c90..2094e1fbb9 100644 --- a/drivers/net/ntnic/ntnic_mod_reg.c +++ b/drivers/net/ntnic/ntnic_mod_reg.c @@ -89,9 +89,24 @@ struct rst9563_ops *get_rst9563_ops(void) return rst9563_ops; } +static const struct flow_backend_ops *flow_backend_ops; + +const struct flow_backend_ops *get_flow_backend_ops(void) +{ + return flow_backend_ops; +} + static const struct flow_filter_ops *flow_filter_ops; +void register_flow_filter_ops(const struct flow_filter_ops *ops) +{ + flow_filter_ops = ops; +} + const struct flow_filter_ops *get_flow_filter_ops(void) { + if (flow_filter_ops == NULL) + init_flow_filter(); + return flow_filter_ops; } diff --git a/drivers/net/ntnic/ntnic_mod_reg.h b/drivers/net/ntnic/ntnic_mod_reg.h index fd9e595f50..3251f651be 100644 --- a/drivers/net/ntnic/ntnic_mod_reg.h +++ b/drivers/net/ntnic/ntnic_mod_reg.h @@ -118,12 +118,21 @@ void register_rst9563_ops(struct rst9563_ops *ops); struct rst9563_ops *get_rst9563_ops(void); void rst9563_ops_init(void); +struct flow_backend_ops { + const struct flow_api_backend_ops *(*bin_flow_backend_init)(nthw_fpga_t *p_fpga, + void **be_dev); +}; + +const struct flow_backend_ops *get_flow_backend_ops(void); + struct flow_filter_ops { int (*flow_filter_init)(nthw_fpga_t *p_fpga, struct flow_nic_dev **p_flow_device, int adapter_no); int (*flow_filter_done)(struct flow_nic_dev *dev); }; +void register_flow_filter_ops(const struct flow_filter_ops *ops); const struct flow_filter_ops *get_flow_filter_ops(void); +void init_flow_filter(void); #endif /* __NTNIC_MOD_REG_H__ */