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 24A3045B96; Mon, 21 Oct 2024 23:05:49 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 07C304065A; Mon, 21 Oct 2024 23:05:41 +0200 (CEST) Received: from egress-ip11a.ess.de.barracuda.com (egress-ip11a.ess.de.barracuda.com [18.184.203.234]) by mails.dpdk.org (Postfix) with ESMTP id A4D80402D7 for ; Mon, 21 Oct 2024 23:05:35 +0200 (CEST) Received: from EUR02-VI1-obe.outbound.protection.outlook.com (mail-vi1eur02lp2046.outbound.protection.outlook.com [104.47.11.46]) by mx-outbound8-87.eu-central-1a.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Mon, 21 Oct 2024 21:05:34 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=TVDYBJIWsiSiDI+3HHoWINh3wYh2n204C2AAaJlKW3t9kvX7U4Bx0YQkXRN/pA4T/B+99UVyENOBkS4ECVUSej6hStIHXUpVisf0WRbVMivsm7mPDjzjpsH62FzWqjBjX3h37uTaAPnyFO3NBrEfzukpNJoerBaHrUBWyvO4sDUCf13AE9ksSXRzb8bpubptaj/m5PjdBKBvo6mnpNsrWr048M0BDA0IF4hrHaPyVBF6EJlkRagxOKb+tsQxRLDuVkFtu7yIffDcxdH/Q9NA0t77xCW9UqulUAG3+OU2yJO1iOrYwg6zkjxHeIz4x9U1Xz9XubSLQoA2D2LNZYSnRg== 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=5PJrxHRaJQL0LWqkciC/4BbcEsNnZ+M6RDIoa44jt4A=; b=os20UBpFYprpCMAWPUupQWEdodiiOQBc2GcWiM6uR+T9Kv5oT8VIFZ6ZuqjwbWSukPHhzIALRSSjT12tKLCPHtkEm38PP98WdGAHDRijNq8IM3Lu78kgZ1Gy+05EjwXsV0uVWJjBTPdD5tdBUHHooGvycrfVUfRvjBWcXyPRuhzEuGt/Xn7dHOgyfQlYVfkwIsL/twYITOTYlwX5kgWPifQ2CBITLGc2JfmZ4Vgi+wWSamjRRWuh4JQyAqDA5kAyR+9Wjss6vux1Nnv1oiz+EdZHxfplwLnly8s5FXoKBUL1pXNNWLWvPtTL1LJuo4qRR9g/0GbY6thk82Bi6ZrMrw== 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=5PJrxHRaJQL0LWqkciC/4BbcEsNnZ+M6RDIoa44jt4A=; b=Dg2UKAOCqodqNIL7yhl9q84V4nIqkdyJzgSAymjil8eSfxm+P2xOUwpNbHBj6DnJsRE1DlAHqOCDR03KCBKB5E9uNB7UoLVTeZ83eMxIhJrcVTj+kU/7/HaYg7uXOFVql7WudtNKos7eed8s2gC6atBYag4OMxNnkIpkUlfcNiI= Received: from AS9PR04CA0143.eurprd04.prod.outlook.com (2603:10a6:20b:48a::24) by PA1P190MB2248.EURP190.PROD.OUTLOOK.COM (2603:10a6:102:482::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.28; Mon, 21 Oct 2024 21:05:32 +0000 Received: from AMS0EPF000001A8.eurprd05.prod.outlook.com (2603:10a6:20b:48a:cafe::1f) by AS9PR04CA0143.outlook.office365.com (2603:10a6:20b:48a::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.29 via Frontend Transport; Mon, 21 Oct 2024 21:05:32 +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 AMS0EPF000001A8.mail.protection.outlook.com (10.167.16.148) with Microsoft SMTP Server id 15.20.8093.14 via Frontend Transport; Mon, 21 Oct 2024 21:05:32 +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 Subject: [PATCH v1 02/73] net/ntnic: add flow filter API Date: Mon, 21 Oct 2024 23:04:04 +0200 Message-ID: <20241021210527.2075431-3-sil-plv@napatech.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20241021210527.2075431-1-sil-plv@napatech.com> References: <20241021210527.2075431-1-sil-plv@napatech.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AMS0EPF000001A8:EE_|PA1P190MB2248:EE_ Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: bd06205a-ccce-4fca-3ed0-08dcf21419da X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|36860700013|376014|82310400026; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?Le/SZjIUNh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z?= =?us-ascii?Q?AGNxm/CJR+3/NOZeqpw1N1N0LxL/agE308SY3GwI5hkWt0YMFqnVkeRMb75P?= =?us-ascii?Q?u71HL9S8n+HXTYOyxGpRaxhI8TgtfqbatnzPRrEOjL9IGZnGhZobszaMczrO?= =?us-ascii?Q?oXZdaPVs+yRfCM0HP2H9+SEHgGn0acFb9+/nbs4ZQFwM4VdS0dR+kRvJt+2m?= =?us-ascii?Q?DiW65uonN1YF1VCCg9U2ZJfBehpTRe+A5WvvzgaiibSBc8A/NF9nU0A1sMxx?= =?us-ascii?Q?GPIW7ok4kYp5tZ0Q+rai//fsmeUw6EQ95nJNheD9Qer7imKT3VDRDFU5al1B?= =?us-ascii?Q?n+LHGx9nkFdLpXHYIxGGj9asSdHlBl4lBaA1AjE2hJCWjKGaMoEoZj3Cfdo2?= =?us-ascii?Q?zQpxCHqa16Ba7kfJS3gU617xhGDGdZUo6PfGZf8fv7PA7412+GN8kXkS1q/9?= =?us-ascii?Q?ZZxVq+IM173bRjizKlcNt+XhsMQMyLNiI1NpAtJhZiZxb8PP27Y1acOxxU1F?= =?us-ascii?Q?XTycu23gy/8Lg24tbVwPmoXhQy4aJ17lWyBdmha8RlhKmpfCFg=3D=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)(1800799024)(36860700013)(376014)(82310400026); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: xAqws4zmL7mYVvKbOD/1zyl8eog+Hf/+tOrecBiwX0ek9lMGPfElD/L3QMPSPp29FnMSUgKWWJw1aET06QElzRLXky6YN28MCT8PmuXpCg1ae7phVqz0hnasdPP+cF4MFv3QOC76dbeoy1rzbNCeFOUmEeJHrWQa7Q1mYCvBlwQW1M8YXYxdKmxmH5B4p+tsHxlI6GEUUu527GLEb/uxlLnpZSyr3e0bSl+yIO5dzK4uSrPxefVCJDk6HrHUeF/SySitsDEPrntIr6LjmQMdU2aC83cgHzXaD7HF/FsP1M7EqHiE/XWUtceM5mFOzNMc1qbtROrVOuGeETyTxn0hy/dGwdLiF5L1CePx4ImhJpI2gJfyphlY2CX8UDDqko6coWnakjq4KPxxIo9dgk+0CUZfuPREORbWXrynAcxqROMRmFsg+BOmkNjNyQcHv8RMPHhYpDd6fYYjsIVZDrGMs3JXnRUm9IwbVS/L63k8bHlJtkcmu8M8pc3H99ACSSAZQS71K9zxJw1gperi9TCN7uHVfZApElGiT4MkGpKh+MDnzHOH3ozeis3X3OB1jZjUcy3qpDxVNJxCvwCvQGOZ/rP/eXWR3UDTrEMuAvEyrUyDwbTWTLFl6bvbZVP38undbNFOGyXXoKc1VmLUwlbkAmUKzwW3d5QgquLHmVbVer0= X-OriginatorOrg: napatech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Oct 2024 21:05:32.5362 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: bd06205a-ccce-4fca-3ed0-08dcf21419da 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: AMS0EPF000001A8.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA1P190MB2248 X-BESS-ID: 1729544734-302135-12937-43189-1 X-BESS-VER: 2019.1_20241018.1852 X-BESS-Apparent-Source-IP: 104.47.11.46 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVqbGJoZAVgZQMM0i2SjZLMU4yd QgOc3Q1MDMwtLIwDIlycTY2MzcxCRZqTYWAO0o5lVBAAAA X-BESS-Outbound-Spam-Score: 0.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.259883 [from cloudscan8-241.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 Enable flow ops getter Signed-off-by: Serhii Iliushyk --- drivers/net/ntnic/include/create_elements.h | 13 ++++++ .../ntnic/include/stream_binary_flow_api.h | 2 + drivers/net/ntnic/meson.build | 1 + drivers/net/ntnic/ntnic_ethdev.c | 7 +++ drivers/net/ntnic/ntnic_filter/ntnic_filter.c | 46 +++++++++++++++++++ drivers/net/ntnic/ntnic_mod_reg.c | 15 ++++++ drivers/net/ntnic/ntnic_mod_reg.h | 5 ++ 7 files changed, 89 insertions(+) create mode 100644 drivers/net/ntnic/include/create_elements.h create mode 100644 drivers/net/ntnic/ntnic_filter/ntnic_filter.c diff --git a/drivers/net/ntnic/include/create_elements.h b/drivers/net/ntnic/include/create_elements.h new file mode 100644 index 0000000000..802e6dcbe1 --- /dev/null +++ b/drivers/net/ntnic/include/create_elements.h @@ -0,0 +1,13 @@ +/* + * SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2023 Napatech A/S + */ + +#ifndef __CREATE_ELEMENTS_H__ +#define __CREATE_ELEMENTS_H__ + + +#include "stream_binary_flow_api.h" +#include + +#endif /* __CREATE_ELEMENTS_H__ */ diff --git a/drivers/net/ntnic/include/stream_binary_flow_api.h b/drivers/net/ntnic/include/stream_binary_flow_api.h index 47e5353344..a6244d4082 100644 --- a/drivers/net/ntnic/include/stream_binary_flow_api.h +++ b/drivers/net/ntnic/include/stream_binary_flow_api.h @@ -6,6 +6,8 @@ #ifndef _STREAM_BINARY_FLOW_API_H_ #define _STREAM_BINARY_FLOW_API_H_ +#include "rte_flow.h" +#include "rte_flow_driver.h" /* * Flow frontend for binary programming interface */ diff --git a/drivers/net/ntnic/meson.build b/drivers/net/ntnic/meson.build index 3d9566a52e..d272c73c62 100644 --- a/drivers/net/ntnic/meson.build +++ b/drivers/net/ntnic/meson.build @@ -79,6 +79,7 @@ sources = files( 'nthw/nthw_platform.c', 'nthw/nthw_rac.c', 'ntlog/ntlog.c', + 'ntnic_filter/ntnic_filter.c', 'ntutil/nt_util.c', 'ntnic_mod_reg.c', 'ntnic_vfio.c', diff --git a/drivers/net/ntnic/ntnic_ethdev.c b/drivers/net/ntnic/ntnic_ethdev.c index 510c0e5d23..a509a8eb51 100644 --- a/drivers/net/ntnic/ntnic_ethdev.c +++ b/drivers/net/ntnic/ntnic_ethdev.c @@ -1321,6 +1321,12 @@ eth_fw_version_get(struct rte_eth_dev *eth_dev, char *fw_version, size_t fw_size } } +static int dev_flow_ops_get(struct rte_eth_dev *dev __rte_unused, const struct rte_flow_ops **ops) +{ + *ops = get_dev_flow_ops(); + return 0; +} + static int promiscuous_enable(struct rte_eth_dev __rte_unused(*dev)) { @@ -1349,6 +1355,7 @@ static const struct eth_dev_ops nthw_eth_dev_ops = { .mac_addr_add = eth_mac_addr_add, .mac_addr_set = eth_mac_addr_set, .set_mc_addr_list = eth_set_mc_addr_list, + .flow_ops_get = dev_flow_ops_get, .promiscuous_enable = promiscuous_enable, }; diff --git a/drivers/net/ntnic/ntnic_filter/ntnic_filter.c b/drivers/net/ntnic/ntnic_filter/ntnic_filter.c new file mode 100644 index 0000000000..99eb993a4b --- /dev/null +++ b/drivers/net/ntnic/ntnic_filter/ntnic_filter.c @@ -0,0 +1,46 @@ +/* + * SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2023 Napatech A/S + */ + +#include +#include "ntnic_mod_reg.h" + +static int +eth_flow_destroy(struct rte_eth_dev *eth_dev, struct rte_flow *flow, struct rte_flow_error *error) +{ + (void)eth_dev; + (void)flow; + (void)error; + + int res = 0; + + return res; +} + +static struct rte_flow *eth_flow_create(struct rte_eth_dev *eth_dev, + const struct rte_flow_attr *attr, + const struct rte_flow_item items[], + const struct rte_flow_action actions[], + struct rte_flow_error *error) +{ + (void)eth_dev; + (void)attr; + (void)items; + (void)actions; + (void)error; + + struct rte_flow *flow = NULL; + + return flow; +} + +static const struct rte_flow_ops dev_flow_ops = { + .create = eth_flow_create, + .destroy = eth_flow_destroy, +}; + +void dev_flow_init(void) +{ + register_dev_flow_ops(&dev_flow_ops); +} diff --git a/drivers/net/ntnic/ntnic_mod_reg.c b/drivers/net/ntnic/ntnic_mod_reg.c index ac8afdef6a..ad2266116f 100644 --- a/drivers/net/ntnic/ntnic_mod_reg.c +++ b/drivers/net/ntnic/ntnic_mod_reg.c @@ -137,3 +137,18 @@ const struct flow_filter_ops *get_flow_filter_ops(void) return flow_filter_ops; } + +static const struct rte_flow_ops *dev_flow_ops; + +void register_dev_flow_ops(const struct rte_flow_ops *ops) +{ + dev_flow_ops = ops; +} + +const struct rte_flow_ops *get_dev_flow_ops(void) +{ + if (dev_flow_ops == NULL) + dev_flow_init(); + + return dev_flow_ops; +} diff --git a/drivers/net/ntnic/ntnic_mod_reg.h b/drivers/net/ntnic/ntnic_mod_reg.h index 017d15d7bc..457dc58794 100644 --- a/drivers/net/ntnic/ntnic_mod_reg.h +++ b/drivers/net/ntnic/ntnic_mod_reg.h @@ -15,6 +15,7 @@ #include "nt4ga_adapter.h" #include "ntnic_nthw_fpga_rst_nt200a0x.h" #include "ntnic_virt_queue.h" +#include "create_elements.h" /* sg ops section */ struct sg_ops_s { @@ -243,6 +244,10 @@ struct flow_filter_ops { uint32_t exception_path); }; +void register_dev_flow_ops(const struct rte_flow_ops *ops); +const struct rte_flow_ops *get_dev_flow_ops(void); +void dev_flow_init(void); + 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); -- 2.45.0