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 75C4545ACC; Sun, 6 Oct 2024 22:38:49 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A28D640A6D; Sun, 6 Oct 2024 22:37:53 +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 3717440661 for ; Sun, 6 Oct 2024 22:37:42 +0200 (CEST) Received: from EUR02-AM0-obe.outbound.protection.outlook.com (mail-am0eur02lp2239.outbound.protection.outlook.com [104.47.11.239]) by mx-outbound44-124.eu-central-1c.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Sun, 06 Oct 2024 20:37:41 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=KLVhCnEha1IpFlbuKIamNQdC1u4JVC0y0Avs6Caa2trx22ZbVlvV9mICGEvd8altaQLaAEyHnm6o2KSxDdnDjN8T2Pa3Ma3omoPrdtNN7i9rUGnv541cYquEgG+VGLykkfm9Yio2h8GfVJBiT6LAUwgqBdUGmq4ArJLPTvelixkzOsInoneb5Kx0ptYAF5AtDpU+TPcpxD6EJ7LxihX3Ds7l7ugfzCTHQQUlw4H2Yc+6wkfax5DYywkDL6nhKUPa5zOYJQKcVQshYRFbP9ktB0XVQNJs1Uevs7x+RKiTatUESRv/TiZ9LuezEKh3cD0j24AW1NxaAFXn3SBxryiRKw== 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=A9L7Qt15BND/4Xlbq0pm4tS4obQm4lz2FDTyWA7K/MUWpGla9N01r+Q0wBpK1ZFITlC6yYHynL1k3F/w3ee3gzg2MlqJC6c4SSGQ6sJdUwx+WaAWS9ebtJeYa4Qbyx3CcZ/Pw6u31gumdmUMmF5OTjloZvpS+jnGwFPAedACvcTtVtFtlrdQnwL4YAueGd2qk8dOERewJns5TrM06Ff7CNsjR5BL+QIZiIopfU0KZ8p35yMpgHlyo9kiPSA9D3NEWLLmBTS6DMFOY3n+Ftqe2gKb7lQtekjbg2Zv87T+1sWhBoauXrZblbbjtp0Ju7uaG5Cmzv6hlmHfbWDjLGokEA== 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=gl/NcPiqDMIWABvHtFafsJnYmObPRXkzy3RQpGMJFRZdH7PnwItGlUPCHFeh3LFhNR4WxchFBHjs+QXwy7OzjyMzBLlTdBA6cPGIYwVptTTYSUOdt2UczePsOKs5ihwKPWFt0K1b9GX7NSgOQ6BpZc1F8F4VsdfzNC+xycHBKbM= Received: from AM6PR04CA0005.eurprd04.prod.outlook.com (2603:10a6:20b:92::18) by DB8P190MB0636.EURP190.PROD.OUTLOOK.COM (2603:10a6:10:12e::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.22; Sun, 6 Oct 2024 20:37:37 +0000 Received: from AMS0EPF00000190.eurprd05.prod.outlook.com (2603:10a6:20b:92:cafe::45) by AM6PR04CA0005.outlook.office365.com (2603:10a6:20b:92::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.20 via Frontend Transport; Sun, 6 Oct 2024 20:37:37 +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 AMS0EPF00000190.mail.protection.outlook.com (10.167.16.213) with Microsoft SMTP Server id 15.20.7918.13 via Frontend Transport; Sun, 6 Oct 2024 20:37:37 +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 08/50] net/ntnic: add flow backend initialization API Date: Sun, 6 Oct 2024 22:36:35 +0200 Message-ID: <20241006203728.330792-9-sil-plv@napatech.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20241006203728.330792-1-sil-plv@napatech.com> References: <20241006203728.330792-1-sil-plv@napatech.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AMS0EPF00000190:EE_|DB8P190MB0636:EE_ Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: 4f00c086-ecac-454e-e0cc-08dce646b75b 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: =?us-ascii?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AnA2q99dPHcapo9?= =?us-ascii?Q?7qhn6QREunHkpGfk660FaVW4FXme3+JWCf7YYpK6heks9RG0MOIUNeELMK7i?= =?us-ascii?Q?Vf86DLClgQwFMKpfSfs3bdYxGGnqmtUy4V6QcEwdx/NTVRwc5mUhoOWo/1F7?= =?us-ascii?Q?HKR22DIe7Thjlrw1I59tg9Lc4Vuz6KkkRvAS3Eyby5Rz2kdmgIAN/ZV4gc4N?= =?us-ascii?Q?yuEYla1MN3nFXWGFc4d/ur5CF8W7AGul3NYUxBjgUvyWEVw2DgLpqKNFu26g?= =?us-ascii?Q?izkIosu0pTgRa4bnYUV+rV4TNxcJj93KcARmIVbqcU1FP0dpHEUYHUio/vDJ?= =?us-ascii?Q?d8PYwYNJx4sAy4uZux/KTXCuxthb6xihHTs2bVW9IoiNTSIRuq9alc3t125Y?= =?us-ascii?Q?/Np9LcG74ziz03qylPWjdnGyAWdbROsYy7LWlsrSsvFOup5WOwmm5IIbUWD3?= =?us-ascii?Q?B+Aw1eC+socqJzrS2tv9J0Y+RcrUUOwJ4w4/ENwhfefILh1PGdeSlslANC2m?= =?us-ascii?Q?7pp2u4GrVlFIVgISr2Cf1z/pU2EP?= 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: ZQ+JlhLVmvsyHakjwBdmw2gYHyExWG+QsYkeELzCjaoyTUwwg+pa2cySRZq88WR0ibd1Bp8Anm6ovPeXKiQGWxMLYHfnz2zf/QtX3QHHufjis5noNDlux7V5CJzaiQIbYwdvmHyHhNGjwnaLXBOk6Ki+KG8wY9qJeLY0xwL8bXYJ8Bhb/sehX11M3Atj6bNXa+SPR9DPuE8oTmHa8Wy3QsdnVxq8oBwS6y6VEnvnp4gpbsOXzrhMnC0yUaaDgsUz2VriFdkkAMQ36cTcFevTJ4mI0knmAqyhHMFLsqydakBKZmuc7anyf8v73X0vVr42764aC8DsGfpmf23UYnRFCp0vwZDWbvsC+Hhai6Aiv6ZlALKfrHzFOr/BJukQaCme8dB1xRwfShkZfLhLUICtVCwK6fDwyvAtj8UfaaEgOvYg6b0p36pu6XoIzrgy/BuPDgakGqad2i0ALydxYBgYPrtAXUGgH6yVYtcyBm7HUUZ7/a417jNcSbZSqO3nctItvW7ohr8YJLvyhfxc05z5N5SSMa4r4J6awKfpks93Hqqb4QgsFD3EwB4uauB9PQhERvWc+8rEexLXpyb1BN0uC6lH1RJq+nZmMIX9V5mG6bVTajGTpCeovW4jVFZk5sjDr4990domN20R4iJsETsyQA== X-OriginatorOrg: napatech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Oct 2024 20:37:37.6712 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4f00c086-ecac-454e-e0cc-08dce646b75b 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: AMS0EPF00000190.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8P190MB0636 X-BESS-ID: 1728247059-311388-12692-123463-2 X-BESS-VER: 2019.1_20240924.1654 X-BESS-Apparent-Source-IP: 104.47.11.239 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.259547 [from cloudscan23-175.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