From patchwork Mon Oct 7 19:33:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Serhii Iliushyk X-Patchwork-Id: 145319 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 A51B245AD8; Mon, 7 Oct 2024 21:35:40 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9292340651; Mon, 7 Oct 2024 21:35:14 +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 9765D4060F for ; Mon, 7 Oct 2024 21:35:10 +0200 (CEST) Received: from EUR03-VI1-obe.outbound.protection.outlook.com (mail-vi1eur03lp2110.outbound.protection.outlook.com [104.47.30.110]) by mx-outbound9-155.eu-central-1a.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Mon, 07 Oct 2024 19:35:09 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=kve2xejKmwH+AUfm6HWXQi3IeiYeqstPWCUr909Tf61UxCcnW3YgUUW/+2M8Q2hrJlUzf3HXz0HEZPDQDiZp8YPwyP5LwBlNtP5YlIuYyeyUnQH04KWj45kDyet5DFswHaswyH0iSyPADD/kP60fX0GWY5ggs2AAbYyRGHxZVZZwmyc4u/7aEGfXQHYjQc02DCc18ikNYx/ri9/8xTNoGXDP6CQRpzM1H86Lu4f8+60jZOMVpJCdxP+DM3DkSxn/Kt55hrFKTIjR3UOq/Mas990u+Ydta3Xc6ZD9H5/1jD/OMqFuoshMGBDGSrHIRL3Uhs+3hVNemPYoz/AcuKWX4Q== 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=QKsisb7pufQiWlC+I2foxhgMDL9PPP6GEUcG/j16lkU=; b=wUUIeOVzyfvUoT6urQNT2IgV8NRi+WmSJxEAbK2J/q7gqaY7Wsf5TvJgzUGEwv3RR/RQWrmJFCW7XIdjtrT543RhfWHq0l+wWx9lMHSyVvvWLqex1/9qASl+dVojlOhDUEm/EFie/QWfuXqFoMoq2cpTAbkp62FZjKdpKZ45TBXf8Y8S2N+jJ6VG65LFhz++Mkl+ZnH2VqhAIV+v4nnoPcX98PZBcKX10STsg8DEoadrEaT+vVRJ0APb0gGYFL93KDJfVOhM+9zWWKNLVJ4yiFN3h00DQeLQxp2hRySD4ha2B0u03bEo73zpUGO+PGqi02jzxqKJ+WNqncCzRi+8og== 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=QKsisb7pufQiWlC+I2foxhgMDL9PPP6GEUcG/j16lkU=; b=eAjdq665ZNIZPm9h+GZbNV+itSOV5UXbXu5yK8gqA9oTVguqUq9ZKYRPzYg48IhslYQ7ap6KQdBO8/SxxOWWSaMQNRV6VREbPBUYYRtSfNgh5zkWdfVKghl/4L+/vnqx1ML8081L8UeKwaFfknV3Q4eu3P5wRJzVNaaEnEIR7Uw= Received: from DB9PR05CA0006.eurprd05.prod.outlook.com (2603:10a6:10:1da::11) by PA1P190MB2144.EURP190.PROD.OUTLOOK.COM (2603:10a6:102:44c::7) 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:07 +0000 Received: from DB1PEPF000509EC.eurprd03.prod.outlook.com (2603:10a6:10:1da:cafe::aa) by DB9PR05CA0006.outlook.office365.com (2603:10a6:10:1da::11) 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: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 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:07 +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 06/50] net/ntnic: add flow filter init API Date: Mon, 7 Oct 2024 21:33:42 +0200 Message-ID: <20241007193436.675785-7-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_|PA1P190MB2144:EE_ X-MS-Office365-Filtering-Correlation-Id: e37a9d72-7ccb-432d-d02c-08dce707266c 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: Yl0egLFv/kDPv0gqSdlb1Vi8My2UPLr5KvYyJTzz2WLgHVVFWdUBwfXBf+Qt7c09XMDOu6RpYuXB/FV2ehI25KLcTz//lhGefW6nj9pi5gyer2zeInTaWNRO15jEmSNXOkyIuBtgtX4sC87sNHoCSkKqpi21tBhy06hXJP93hE+pNXwbNE0t8NtgiwjNqMPRmVObAVSDSDMC/b3bgm+8elzdE+7QtQkpCn2WcGTmRPIvs2n4Sbb7/DfQlnEth5WnRyIJ1EpLKJr35BKqA1uLzOMjr1aPiAaW0Kv15I+26DHj4+6L2JIFoAIPxdw/7xlBLyQXgZyGWFsO4fFoIEKkUhdXZwaJUaip+LoxGXGe1Ec7iRxZVrjUzi8m2mvV+1p1AVGZfFZ9with4Hi/kP0v+7DsC7bw4huVzEx9KQlHo5WeUnapLgxik/WqtzdesSZnYhpMlmGBDckRSR2osvT/KHgSkQIoPz4qRRoAxUW49uU6eqFOGMgTHElO5jgoIGwIzHXxqZrt7heZUyzpoPBBx+c/g7hjzamReb2K+6/dVMSZaam2OQtJxh017sC3+S6l7M+l/67D0fM4PAgymWLFP4oSY8lU/et7z1pSNsfzXjrmSusQQBA/QlR0QrVk40tsQL6XOHRaH2OMHd+6rLBI4C/KxRKyVosqZyn8zmA3ljUfnlP6bWhbGZqkydS7VmS/NAwEJ/QM3YOYz4YQd64En8QTmIoBAUQJm/kao7VSf6jYuisBg4D7LCEai7C4tZS4u6+WiXwIOfLe8Zz0nehGvGIEP1VznV3sRzif5H9eKB7IkAIaaipL8XYl3i0zFSws/JAjW06gYEWgCZPy0opDDRCoPivx8N7/zoP3IMCA9PZnYbhQcT5L+hON26fx/DEgVUA+6g+JMEN65MkzWP/7+Dc6gTfJzUSzBONvNHpcR53RcBomHklv4JxdN5Ph5r/e5iGigMTulM5ZGtSoy+AgeNBY0LJWCMTYCP5C37vjOGu1PNMPcYIz9wJHLR3u1TVYgr/YtHHcHqHatSUP8+/Rd5CIGldrEV8meMC0NIeoN5mM+98SY1Hy9MrjE8iN7aRGRh0tKNpcnY38eEnKO+XoMWk0Kjy7JmXd24sEv/JR03N+TwX6QfVaYUGPk8LSX01KYuSPSFx6EmwuKFlyiVc9IJd/JAXah1DIdDCCd9lNoyHwFi/8KXO2QW8EGA8L48EwkLhpJtz2uRqAXhPsmd5wRG1Bc+VIsZyDM0N6mveax1qaaJ2Ezt2t1lCe5UpmrJa2fedoKhQUWsgcSEaR/Domv3K8qJOtXhubZjZF5PBjiaObHs3Q0nskc3MgxsfITuKzkHg/R3moqH/HyKoehheY3rLR3nkt+D6f5IIkhGJmiHo= 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: UUOYytACXzncYEtfHuiZJk2rFwzTzO3jyp+kykK3tOc8CT9H9LfCRw+B683gFtm2dA24O92C//dMI+mfLYNbgx297tanMqzPGquY5nrW2Bi2jFVDYZvmPVqZ8T3RdiQhJYAG591TkqYdnr4Ggq0Ad0/WHWbMsb+5iSqRC9XU1ZugIyM9aq34b91bAzj19+JozOjQl91Q6Oh/Ca1HMRVomm4VZo3TIEoFCEBPp3JdxcAHP8AKTXY6W1BMsVivvO21xuuMTaqbVOCoGeQJsb9ZXm1Nb0pWqbO4eMKQ/NLK3CA89EIrFn8vzmdcsuta3IHoFcktq1u2iXwmemrG8/4+hSSlqeFQuqdsiZOlN2SybA4/MpX6mR7mEXL657jfqtd+gZBb00iNLjzExIU0JyMw2k1kQKRijNMZN/ReZETW+4mg655RUI3ZaLcwGQr7rbXOoGO+AwWI6GhaF4qoF0sqB52j3BMUqUEM8UwikVo8Hw19nHjp5iRUzgSwVlXI+6a7wGd/cRzfZAy7mAxTyfl8c58GM1b7+95zMfTY1HBnJbnp0JpJObhIi0kIOiurQCQ9i9LhDH37caxl+0mbaIfYMrKSyT/5jFnsZ4PgAn1rzv2OvBtvaGUqpbX5t1yWisUaFAw9vrjREbsGmk/ERG+kUw== X-OriginatorOrg: napatech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Oct 2024 19:35:07.2564 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e37a9d72-7ccb-432d-d02c-08dce707266c 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: PA1P190MB2144 X-BESS-ID: 1728329709-302459-3373-3600-1 X-BESS-VER: 2019.1_20241004.2057 X-BESS-Apparent-Source-IP: 104.47.30.110 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVqaGZpZAVgZQ0NLUNMnEPNnCMt ky2SwlzSzVxMLcNC3FMsUwMSnR3ChRqTYWAMx5xgVBAAAA X-BESS-Outbound-Spam-Score: 0.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.259566 [from cloudscan22-232.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 flow filter. Signed-off-by: Oleksandr Kolomeiets --- v2 * Update release notes --- doc/guides/rel_notes/release_24_11.rst | 1 + drivers/net/ntnic/adapter/nt4ga_adapter.c | 18 ++++++++++++++++++ drivers/net/ntnic/include/flow_api.h | 12 ++++++++++++ drivers/net/ntnic/include/nt4ga_adapter.h | 6 ++++++ drivers/net/ntnic/include/nt4ga_filter.h | 13 +++++++++++++ drivers/net/ntnic/ntnic_mod_reg.c | 7 +++++++ drivers/net/ntnic/ntnic_mod_reg.h | 8 ++++++++ 7 files changed, 65 insertions(+) create mode 100644 drivers/net/ntnic/include/flow_api.h create mode 100644 drivers/net/ntnic/include/nt4ga_filter.h diff --git a/doc/guides/rel_notes/release_24_11.rst b/doc/guides/rel_notes/release_24_11.rst index a126dcfcb9..ee848d5a3d 100644 --- a/doc/guides/rel_notes/release_24_11.rst +++ b/doc/guides/rel_notes/release_24_11.rst @@ -104,6 +104,7 @@ New Features * Fix Coverity issues * Fix issues related to release 24.07 * Extended and fixed the implementation of the logging + * Added NT flow filter init API Removed Items ------------- diff --git a/drivers/net/ntnic/adapter/nt4ga_adapter.c b/drivers/net/ntnic/adapter/nt4ga_adapter.c index b704a256c6..4105a6eb5a 100644 --- a/drivers/net/ntnic/adapter/nt4ga_adapter.c +++ b/drivers/net/ntnic/adapter/nt4ga_adapter.c @@ -75,6 +75,11 @@ static int nt4ga_adapter_show_info(struct adapter_info_s *p_adapter_info, FILE * static int nt4ga_adapter_init(struct adapter_info_s *p_adapter_info) { + const struct flow_filter_ops *flow_filter_ops = get_flow_filter_ops(); + + if (flow_filter_ops == NULL) + NT_LOG(ERR, NTNIC, "%s: flow_filter module uninitialized\n", __func__); + char *const p_dev_name = malloc(24); char *const p_adapter_id_str = malloc(24); fpga_info_t *fpga_info = &p_adapter_info->fpga_info; @@ -155,6 +160,19 @@ static int nt4ga_adapter_init(struct adapter_info_s *p_adapter_info) n_nim_ports = fpga_info->n_nims; assert(n_nim_ports >= 1); + /* Nt4ga Init Filter */ + nt4ga_filter_t *p_filter = &p_adapter_info->nt4ga_filter; + + if (flow_filter_ops != NULL) { + res = flow_filter_ops->flow_filter_init(p_fpga, &p_filter->mp_flow_device, + p_adapter_info->adapter_no); + + if (res != 0) { + NT_LOG(ERR, NTNIC, "%s: Cannot initialize filter\n", p_adapter_id_str); + return res; + } + } + { int i; const struct link_ops_s *link_ops = NULL; diff --git a/drivers/net/ntnic/include/flow_api.h b/drivers/net/ntnic/include/flow_api.h new file mode 100644 index 0000000000..036e652b76 --- /dev/null +++ b/drivers/net/ntnic/include/flow_api.h @@ -0,0 +1,12 @@ +/* + * SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2023 Napatech A/S + */ + +#ifndef _FLOW_API_H_ +#define _FLOW_API_H_ + +/* registered NIC backends */ +struct flow_nic_dev; + +#endif diff --git a/drivers/net/ntnic/include/nt4ga_adapter.h b/drivers/net/ntnic/include/nt4ga_adapter.h index 4b204742a2..93218fd45b 100644 --- a/drivers/net/ntnic/include/nt4ga_adapter.h +++ b/drivers/net/ntnic/include/nt4ga_adapter.h @@ -23,7 +23,13 @@ typedef struct hw_info_s { int hw_reserved1; } hw_info_t; +/* + * Services provided by the adapter module + */ +#include "nt4ga_filter.h" + typedef struct adapter_info_s { + struct nt4ga_filter_s nt4ga_filter; struct nt4ga_link_s nt4ga_link; struct hw_info_s hw_info; diff --git a/drivers/net/ntnic/include/nt4ga_filter.h b/drivers/net/ntnic/include/nt4ga_filter.h new file mode 100644 index 0000000000..2024b500f3 --- /dev/null +++ b/drivers/net/ntnic/include/nt4ga_filter.h @@ -0,0 +1,13 @@ +/* + * SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2023 Napatech A/S + */ + +#ifndef NT4GA_FILTER_H_ +#define NT4GA_FILTER_H_ + +typedef struct nt4ga_filter_s { + struct flow_nic_dev *mp_flow_device; +} nt4ga_filter_t; + +#endif /* NT4GA_FILTER_H_ */ diff --git a/drivers/net/ntnic/ntnic_mod_reg.c b/drivers/net/ntnic/ntnic_mod_reg.c index 40e22c60fa..45cc767c90 100644 --- a/drivers/net/ntnic/ntnic_mod_reg.c +++ b/drivers/net/ntnic/ntnic_mod_reg.c @@ -88,3 +88,10 @@ struct rst9563_ops *get_rst9563_ops(void) rst9563_ops_init(); return rst9563_ops; } + +static const struct flow_filter_ops *flow_filter_ops; + +const struct flow_filter_ops *get_flow_filter_ops(void) +{ + return flow_filter_ops; +} diff --git a/drivers/net/ntnic/ntnic_mod_reg.h b/drivers/net/ntnic/ntnic_mod_reg.h index 3189b04f33..6dd6240c6f 100644 --- a/drivers/net/ntnic/ntnic_mod_reg.h +++ b/drivers/net/ntnic/ntnic_mod_reg.h @@ -7,6 +7,7 @@ #define __NTNIC_MOD_REG_H__ #include +#include "flow_api.h" #include "nthw_fpga_model.h" #include "nthw_platform_drv.h" #include "nthw_drv.h" @@ -117,4 +118,11 @@ void register_rst9563_ops(struct rst9563_ops *ops); struct rst9563_ops *get_rst9563_ops(void); void rst9563_ops_init(void); +struct flow_filter_ops { + int (*flow_filter_init)(nthw_fpga_t *p_fpga, struct flow_nic_dev **p_flow_device, + int adapter_no); +}; + +const struct flow_filter_ops *get_flow_filter_ops(void); + #endif /* __NTNIC_MOD_REG_H__ */