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 3A15D45AAF; Fri, 4 Oct 2024 17:54:55 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0A02642EDC; Fri, 4 Oct 2024 17:51:37 +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 C496A427C7 for ; Fri, 4 Oct 2024 17:51:33 +0200 (CEST) Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05lp2168.outbound.protection.outlook.com [104.47.17.168]) 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:51:30 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=HABF7SqngrF4XS+wKlrVxXBpS9/Xsd4DbxkQ0HPPF+iUKi52Siy8yoD/wrJe5RkZ0ZKVACcDZT1Kg1oZafWotllNDfzqKQ+uDYdKXUMwSNqTA3cAd+E2P2Vjijzm/pKYoB/PBKT0meXlKebmkZRTciG8/1gw6sNXYMECF1Hdy7rAM+MNjYfGufuzRzbvnEh1ufZ6q6EPn9kYQVMB5a9MuKUeSmgKm6aUHkt05p5OTX9nTpfyTqsx0n1IaLOR74dVyK0H+3huOUNojhO+I8lgdBwh7rKDwmbFYRWkacYFeBvdc3CRZ8annIblbycxOvciQjzkgXjg1WKsY/CVhaVBeQ== 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=abt4+VFiFQReVRlhKJ8hguzIGFbHhHzJFHiA/ieUELYw9SlnbFkiOPBTHjymVLKEKP82YPhhbvhNnKFxMpQOHpU+/a/5c+mkot5hpYs0ehgTFYAuPMsPj+HciczSPmsBf58fKvlHxTM9OVaGck41d7833W5ctAKJKcobE/xsP1Qde5Jrmvt1a1YuyyrkLvp9hhSes6aoL+t/uMfQUwYoGutCFBnI3u3kK54aseh8Pcixlmd0tOCHBFinzGhDcB7fy+5rAIlFxh6T/DfTlRXreuvN0RZ7pvPn25gGNM9RtAHRzhJqxBwDKCU8SZvM7Tfj6lEeSQ2JZtrjO774jvRb8Q== 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=otG95MuPFOlN/hNclIRcNpQwSkjn3MuT2eHiX4+a5cJ8v7Zd2n5iN3TShq4cXaWh316dbifaXFok//0fAehlSH5GLMLNUzXZylpWc9RwDZJu5Gp2J2653jDCLwETMxIHK7byAeeNk1GuNgg1jTK5SAp90nb8UrkaZ3nbCXF5n7s= Received: from AM0PR10CA0104.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:e6::21) by DBAP190MB0837.EURP190.PROD.OUTLOOK.COM (2603:10a6:10:1a1::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7962.17; Fri, 4 Oct 2024 15:36:06 +0000 Received: from AM2PEPF0001C715.eurprd05.prod.outlook.com (2603:10a6:208:e6:cafe::af) by AM0PR10CA0104.outlook.office365.com (2603:10a6:208:e6::21) 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:36:06 +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 AM2PEPF0001C715.mail.protection.outlook.com (10.167.16.185) with Microsoft SMTP Server id 15.20.7918.13 via Frontend Transport; Fri, 4 Oct 2024 15:36: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:34:26 +0200 Message-ID: <20241004153551.267935-9-sil-plv@napatech.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20241004153551.267935-1-sil-plv@napatech.com> References: <20241004153551.267935-1-sil-plv@napatech.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM2PEPF0001C715:EE_|DBAP190MB0837:EE_ Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: 63759332-1c0a-493b-468a-08dce48a4375 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|82310400026|1800799024|376014|36860700013; X-Microsoft-Antispam-Message-Info: =?us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grQQRxdg1YafIB?= =?us-ascii?Q?eekIv+54+sZQ8Z8Z0v5tYCk3CxcJnLkfos/lly+oy0huwUPIegCgnBVp3X3p?= =?us-ascii?Q?7gkZaLPQCHVOLSfupwEWlsd+n/mNSeFtJ94pfETEmkw60Hi3YQs7l2TIBjcp?= =?us-ascii?Q?XTAJfoEQPOsEz97X6OYpge02hkSh0Mm1r7i5mLzPpjXXXaXNhpfn6CtRodGC?= =?us-ascii?Q?cw/HdFMclNnnYB/J7tlW30ARLWp6oqWts3dHYvX2GUCXIotWCO4kZa9Y8Qbx?= =?us-ascii?Q?EpcawPOjiU8zju4+YZxekTPRzrYaAOaSX5dTjPyCQ0cV32Pp4WQJMnbWUMB7?= =?us-ascii?Q?48KKwWJ1Y93Z+DDz/3k+sdI7Mfu9qd6FE0V7LB+gQUKWaWWCGeh58InRDnyW?= =?us-ascii?Q?HJ2Cr7EWYifY8CTAeTZSj9E9xZl97djhOfDqPma0QCnjYnQ3GQrHThpv1vhs?= =?us-ascii?Q?AgNWRtRqgN35Q/maRm4VnSSrMvgJxphtcm6x0RXkQMIHZNHwV9/VR3RmxJYS?= =?us-ascii?Q?QOC+jMaUXbdty5gPQqotccBcPN8U?= 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)(82310400026)(1800799024)(376014)(36860700013); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: TC60s8DOC4xtaoCtl7Hl+k30IX/Gh1DCZS5tEmZsdCT6+kmijXyVGEUjTc3nU7cYAL1MBexTcYZvlQz/es9J8sVS4x/73jHff99VlNO3zEbbkEvcHUhdtJ70AmHaQS1sMVGpP2U7hNgAbk+ouU5XuuVmD8qe2Ss1ai947T0eWtFmYC/bGxEw3eZBkIgzlBJJootBg/YqcrnzBj+XHNKFeWMrEr7ndoEnCSEpWJ6KiBXBdcf+cncZ+2dFgZ7O5B/QrnY348CG9UewJvmlvOLj7GB1kQPSkzjt3uKvMcvSHtt/nKsAAGNG3dpdwnQLT1oUysJ0A+hKEcLUt+r0yy/CPfMz7xs024d79HGmpwehgwxDx75Fe/z+u7TrMTvozptz9DiRXpoZr3qSLDgQvtdKniH2t1WwehZAV84Ias6/yHxeDBHys8N/LhZU5Cd0Y8G7MmYKC1VdYfNBFCgoL5ZDk2BxNudPA/a1fL5WEM3//ymD/KzTV0W4bLTSs/+YJRDPQ42oBm2rmMVZgQGhkyQy/SU0xWq8diWzUeDpVpnkiBz7PeOB2qx8u5P2YmIIKl1PupwCHEjYkK3+OW13gwwAGAKy0Xco6Zzc4T6jVshL2JQ1psv2gBzfW+yC1gKtP7gLNZlWSPfHdnpdgwmlKKQ55w== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Oct 2024 15:36:06.6428 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 63759332-1c0a-493b-468a-08dce48a4375 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: AM2PEPF0001C715.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBAP190MB0837 X-OriginatorOrg: napatech.com X-BESS-ID: 1728057090-302249-12638-33892-1 X-BESS-VER: 2019.1_20240924.1654 X-BESS-Apparent-Source-IP: 104.47.17.168 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 cloudscan20-205.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