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 27AF345ACC; Sun, 6 Oct 2024 22:38:02 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9244840676; Sun, 6 Oct 2024 22:37:43 +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 32CC640655 for ; Sun, 6 Oct 2024 22:37:39 +0200 (CEST) Received: from EUR02-VI1-obe.outbound.protection.outlook.com (mail-vi1eur02lp2049.outbound.protection.outlook.com [104.47.11.49]) 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:38 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=oPi1XXdzPrB4EoQAQ0qGBPO75EK/p/pzgRlM4q6zXOuUFMN5bCaFh9nVECrXCAqrewA7zvSUYnbz648IgvYhrRRnbnbGRO578/QwT39kzvOhufpdF5Xzw+Mz0ygnogeczKrt99+AYPplBJ6PaQ/Z5PAYQCI+oGGvLjqHDBk8wL4QBIIaFITGcUr6FYILFEOYuhWfMpOLx6mZDAsN71PECYhulAEdt1b4RPu+9xyQ+CTVP52JVfq8fHZ9e+dmvHQrIqZwIXN/xfLhcxBXO3HC+FYE/09z/G7+FRH9Y+d8C0MvkfrE4qyMUiUSXQSNobc4Mu4CCSIGh+smQqifd19jiw== 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=ymnCzHUXbBRZMviakyhG3k1Pg5kIIqQyVh+K/W1WSCI=; b=m/GoZJyTS+TTjlZZ9bDMPfOSlIMakEV47NhPu8yc7oKsUmSczK19W5m9TmXJrYlME4l2ujnIr22XVShp/oqJh4KW6c8wmZFlfRqPH8vMxaHkpBCSrXN3tQAylMWmxjc9AvvSLNpoWxuWhzuaJSy270TXIyUDBvwevM+XWGMFQb4djQ6yHw6QgOaww7G7KEgXG/Wz4Ig81EX3IwoG4lwClJUQuYJb8E0cr1WKMXlVl1etfkOcFXbdlzNhySKScJBMv4NWIKAczFtZLaKA8YByDUgEfsD3BXLs9kHBy2+5xV96YX8FSpmyGzS8RvOf7iFncmih717mUNkiwa8zHL28GA== 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=ymnCzHUXbBRZMviakyhG3k1Pg5kIIqQyVh+K/W1WSCI=; b=FptadcY/en6rEFTHGkg2wkI/1UqJgu2yRKLfOozp4mgm5TrNQPTivEPxMJqadh6G3d57c4q9QsaGT47UnBm6A5HA1nW24BhV4mePio+UZsG01eUIiQxGbwib5bkjZ4vk7U/tYQl87LVqEuVYccNFsxY0yMOnd2+RuxNMPhgYKK8= Received: from AM6PR04CA0026.eurprd04.prod.outlook.com (2603:10a6:20b:92::39) by DU0P190MB2028.EURP190.PROD.OUTLOOK.COM (2603:10a6:10:3b3::9) 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:36 +0000 Received: from AMS0EPF00000190.eurprd05.prod.outlook.com (2603:10a6:20b:92:cafe::e9) by AM6PR04CA0026.outlook.office365.com (2603:10a6:20b:92::39) 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:36 +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:36 +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 06/50] net/ntnic: add flow filter init API Date: Sun, 6 Oct 2024 22:36:33 +0200 Message-ID: <20241006203728.330792-7-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_|DU0P190MB2028:EE_ Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: 97e8069d-4c6f-43a2-73e5-08dce646b68c 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?Q?ACquu6Qo/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?= =?us-ascii?Q?D9OPYvQPfDWgaUDwKVWSqhxzPYcKNFxbFqD3T01ulvn13h48wTc45bdDckBq?= =?us-ascii?Q?pvcYqedjevdy7LFCbRACmS1C5QwYjL+deksMT+DwBOqBM9nz9SN0oEeZBZNQ?= =?us-ascii?Q?+qJRdFM3Gj/vLtKf5rduqCyN554HZEASK5d6SUG/y+WF0sNZoku1OdnNpROO?= =?us-ascii?Q?iPeFWDVgPA/VfedowIWOb1dHH0aK3v8LY5rsb93T27ETyODyi3NU5nTpUeoi?= =?us-ascii?Q?0OoNRSPcAYDj0Wm2PgfWZUO0qDe97Q7zo8/g4Asx89Sy6+LlQLwcPYEWxRja?= =?us-ascii?Q?cFPaRVU3zHv7UH2Wleu0Enk+Szyg8WviwZ/n6bzeu9tEYcJOP4O0hVZFjzp+?= =?us-ascii?Q?q7J1bDh9gr+KeoppbkerDxcuMiYBNk27tJ5TJh78NbiGh/MHglJB8rtL8f4X?= =?us-ascii?Q?zutmFM37FUYZexX+q9W5of7woYNFcAfoMt3mTz7Olze3ecbnlSpWUOTkCLaS?= =?us-ascii?Q?KcxM2KI=3D?= 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: MhlCjIk7yac1zZxYzolPmsbEZAswI3REeSOISMtN1c5G50dqcN0YCQp99h8Gg9l3dellqATvQSUkhGhdqDsP0GZr7O5UPD04uG49qbsZpZAzGv1Ts6YVuKSv+h6ziEBNA7/G5Tt48sj30eYnPRRdbHTeer+19z/JnzOp+PxI9cjhHAMdrdeqkmO478QlhqaUme184Gatf3dW5cCUUqHbrPPWA8tkmG48uB/0dhZuSZwo5NXQviTBbyGdqp6wrgNawn5GVYi4vGHMGeqem1c3DSCDYIk3L2xwnVwbhgNyPc0v1JZMskVeeFNOg9VQq6PTg6oO1hr8f/eVzNC2n1kfXDIFi+zWh5Kf8UJuRWdGNMrT4LuEx0bKolbcoJ4lWKFdKOnHAkha2q3ofcTeV8fO9T+Fnej90x0LYUCjHOnonBJ0OM0luySCiNyorw8JY1GaqkOXEi7O4NV9DOzVB223oYsNULqlX6ddq27nIrP90rlHbelORmoA/VH2MEi78T/PVtuWaYtZ/r5kUpiRdcMuVYOq9Zj5ILHZaCsd24MK3riG3CvHC62Q4Eb2BIdZMVS3TeldOmR8EofOE3GxRuO4ZqbVebUUt9eKxWMw1dNw4CX5ehzKbZ6sHVqvAW5zeArI9MI9hR7pZyiBQpNP43e9TA== X-OriginatorOrg: napatech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Oct 2024 20:37:36.3118 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 97e8069d-4c6f-43a2-73e5-08dce646b68c 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: DU0P190MB2028 X-BESS-ID: 1728247058-311388-12692-123462-1 X-BESS-VER: 2019.1_20240924.1654 X-BESS-Apparent-Source-IP: 104.47.11.49 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKViZmJmZAVgZQ0MQs1TzNKDktJd XCKMnM1NQ0NdHC0jItxdTM3MLCIM1SqTYWAC3p0TdBAAAA X-BESS-Outbound-Spam-Score: 0.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.259547 [from cloudscan15-206.eu-central-1a.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 --- 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 ++++++++ 6 files changed, 64 insertions(+) create mode 100644 drivers/net/ntnic/include/flow_api.h create mode 100644 drivers/net/ntnic/include/nt4ga_filter.h 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__ */ -- 2.45.0