From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id DADD845AAF; Fri, 4 Oct 2024 17:09:43 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 02A19427AC; Fri, 4 Oct 2024 17:08:20 +0200 (CEST) Received: from egress-ip42a.ess.de.barracuda.com (egress-ip42a.ess.de.barracuda.com [18.185.115.201]) by mails.dpdk.org (Postfix) with ESMTP id 10965427A1 for ; Fri, 4 Oct 2024 17:08:12 +0200 (CEST) Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05lp2105.outbound.protection.outlook.com [104.47.17.105]) by mx-outbound8-201.eu-central-1a.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Fri, 04 Oct 2024 15:08:11 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=FxTvwcX41wIBXz0pBWFisaR1QRc3qcywiJrAqufI7R+1t4PAppocY8Q+BkA657Y25ZLUDiMqGCBX0Rsj3dPipZO1gIok1ga99c732quHV6CRwiH35cw1UY38I95xfxhXCET1k6mEuPh7BppcX9byzCvmM15j4rllxROK4IOPRmdl8GBRjTC90y8lQJvjhhRx2QcQUYi+N8jYy/376DLtYS76jAg6pdSyFd0CXFbH1fkCHyCLH7fzw+2rjk/VHqL9OmUX7lsJk/8AL41s8d3uFigOEyu7BuH8dFFpNmeRiIl4dpz7nPp/vDUN8Yah5DDAYjGVVVWs66Wso+hp+MTCag== 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=p+r6SIB2SiZBCRX84Z2rFS4RWHDtgQSR/twevB9r5B8=; b=Ui1FehnWc8HhgOyr/Lrtfoeez4mVdgqtzAE2nBWpGC/5bck56KwGRONHWMI5JIDrd6ld5AoGGvxumxkJVuD4MloMr4dChnCXxsUGyjjGPRcE6icPkPGEWTlIJEOHZAbcbsHnxgAkmDx3cHDuZFvyx1a/F5ZC1hYvh3EnsSxGpZPRZAC6D0PU7xM8nf62znlXvx0AjNHw8jOvWWmbdrW0BdvBF67lvR5WbTYfLxOJwo+OtXymxl8eBzyJLsc7hMLn0f35hsdC+uAr1QkVqLwtFFnMmOFR1aZua+a8kOo1NHVsPKvuhoNkWXKOQe0PEVhSuWfr+ZMo3AVw4RuiVsB/vg== 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=p+r6SIB2SiZBCRX84Z2rFS4RWHDtgQSR/twevB9r5B8=; b=o6qoR4M33ZKyETL2K0cvRCgeDyInrsXS/DdCrQG3XY0t6cvBSiMxWBfY3GrnsCmFCQB8aD8tYTQFZvS8tymy2XsW/XCi3IvBqATAoXdxvRGWsxkcHACUo8yYnvuwE69mhpqKDzUQyH9BMyj9sY9o2mIEWitzLK5LO4s8S7D8V38= Received: from AM0PR02CA0017.eurprd02.prod.outlook.com (2603:10a6:208:3e::30) by AM9P190MB1266.EURP190.PROD.OUTLOOK.COM (2603:10a6:20b:269::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8005.27; Fri, 4 Oct 2024 15:08:07 +0000 Received: from AMS0EPF000001AC.eurprd05.prod.outlook.com (2603:10a6:208:3e:cafe::50) by AM0PR02CA0017.outlook.office365.com (2603:10a6:208:3e::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.18 via Frontend Transport; Fri, 4 Oct 2024 15:08:07 +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 AMS0EPF000001AC.mail.protection.outlook.com (10.167.16.152) with Microsoft SMTP Server id 15.20.7918.13 via Frontend Transport; Fri, 4 Oct 2024 15:08:06 +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 v1 03/31] net/ntnic: add flow backend initialization API Date: Fri, 4 Oct 2024 17:06:56 +0200 Message-ID: <20241004150749.261020-10-sil-plv@napatech.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20241004150749.261020-1-sil-plv@napatech.com> References: <20241004150749.261020-1-sil-plv@napatech.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AMS0EPF000001AC:EE_|AM9P190MB1266:EE_ Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: 93e0d24c-e4d5-4796-e5ef-08dce4865a3a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|82310400026|1800799024|36860700013; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?hojOO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ai6s+3G70q?= =?us-ascii?Q?nbDw+BDPqxxmIjk0rjuwknAiBtPJ5BHGB8Hy0u+BvTy7Fo8CcXjGA44xTeeK?= =?us-ascii?Q?jdt+wrutw/wUEt1LTzZVcv3WeCIbYLgF6bNGeSGDk025dP0F2cK3ljOQVBaC?= =?us-ascii?Q?G+FLGyr8WjJ8xj1yHcwUshTaG8tBBlB2KZC5Uf9vm7Y0KMoB6TyTx4+iYbOe?= =?us-ascii?Q?uFKKv8rR8dlCNHmWGdR4TktbsR2Kh9saH9u3aM9QxMA5xwH4XCgbdWT4mf5j?= =?us-ascii?Q?7BmIKHhJKQckhtEvXYaWDxr2Lv+srXoYZ8ZhDld+wZfxcrtHiYXx/JOAdyEx?= =?us-ascii?Q?Noj52lBktnSEulyAQ+UgK/bS7hvB3sI/kS8QCQDgqOnQKCiyVDo4AKywosT4?= =?us-ascii?Q?aPrayw6WnwTXDNXeBEzjdDaJNIU4aDUmh16I3tHoLfSFCp3DAFIFDBnWOwNO?= =?us-ascii?Q?1hHW8LHn96BP6jQN0+AnIcy8R+/5CG+aGO7xnQ8HulHuUzINQsFvgxNosEtM?= =?us-ascii?Q?AYXbt50M71LaOlJEqdw6zT7EsB+W?= 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)(82310400026)(1800799024)(36860700013); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: CeIBd5snAxntDcsHxb6ym6Cck7OgSGCDSOtjrs5aWxTiwCN5xldULLvP1ESgI9vPo1S+ZO4qGCDA+2GqBmXCWgT0S8z/YsncDuhF1nBQhkd2kG3jtLV7Zz3myLO9yubLh9JgELbRqu9BJTxNtQBQnFyEr7p/Y8GbWcQretNhwnJPQ3fE97kozaUKrmxlS6xF54hSsxSOcRi4QmaP6wBrtki49boMo6MwDNGMkLNIzNKY3r4SbDTiRPT/ebn32j8Mt2GOp44FJv/Qay2TBR3xr+cNxmbDEVJv80eVgxA0or1/fIRlTFVGC1EU1YQ4humRr+K2+vES7HdSYF5mXUBmXHYE0IyBR4tadY78fdiVNpA4hfdtpgN6jU09xDlCSkQUS7xYqjpJbZE8OvkqrqMZOpeJfIkf75BTYiwFF31Puy1h0LguV4Jq9Lcf+kYkYkHnBLSRoPq5sSH6LyUCjF2/moCfLd80vHOK/KEujErcPrappmCYyDmPyyofZSoT7upijISRXMAt0Aj6a6r+PC9S8nlWotimzeGkC4+rXYVh9rDp1Rx7Xvu1jIOScGO0OpDIqonqhExZThJEGngYlW9LgpdDCU0/1kaFduvUIGQKklcCV72z4Kb2IzWcfwAyldh4HcjP4Dh7/F7F8z0tOJQQ2Q== X-OriginatorOrg: napatech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Oct 2024 15:08:06.8609 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 93e0d24c-e4d5-4796-e5ef-08dce4865a3a 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: AMS0EPF000001AC.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9P190MB1266 X-BESS-ID: 1728054489-302249-12638-31662-2 X-BESS-VER: 2019.1_20240924.1654 X-BESS-Apparent-Source-IP: 104.47.17.105 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVqbGZoZAVgZQMM0izTIlKdXQIs ncLNkw1SjJ2Cw5KdHAzDjRPDkxLTFFqTYWAD2SBEVBAAAA X-BESS-Outbound-Spam-Score: 0.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.259494 [from cloudscan16-55.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 --- 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 +++++++ 7 files changed, 86 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/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__ */ -- 2.45.0