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 50D1745BB4; Wed, 23 Oct 2024 19:00:52 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9502F42ECD; Wed, 23 Oct 2024 19:00:48 +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 DAA08409FA for ; Wed, 23 Oct 2024 19:00:44 +0200 (CEST) Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05lp2109.outbound.protection.outlook.com [104.47.17.109]) by mx-outbound42-14.eu-central-1c.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 23 Oct 2024 17:00:43 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=eHUfMRPFMk+QEtYAmD4MrWv246Xbyulm4RhiSzCyFknDx1MtcajDitu5bPjceJN3z1B4iZ8Hb/rYmmoDy3SHCMtVrWScCTwqRYn9bbNf1JZnCcIo3d54IiJiSDhuCskSpa7e0Lkuf9+kYPsh4IbxEXfuvrVOVpfcq62zb8qod4Uq204yuzH5JIqhSclCHUeaNuTfh+SQwW4WD1/juFX6zlETxRsGRZkYC9CwL0TLAX32B/WHeaOdhnSXrYD1qTTHKZpsa/QrBM3MKXe4iqxqJDToUs/qhfkRB/E5aLNpB6b9TcLJ5lynWf8GBR7Gv5rC3Rass/QC7oU4SQzAScfv5Q== 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=LsBlGj62fOMsIIXEknkCpltVIOtBmVkYGG/5OxAKr24=; b=kGgY6Hi4ENiYvKEqe+ZkwjvtFYB8/GNbIll9JMaFQXY4axWez2jx24/o447x2hhDG55vAK+qgjhIs6A9EknJrKVLyWgG2rWD7zXEjGdwUvsnulkHFTpZr/IsZKlfyVfmMKg7L4B0mMWVdqF4N24Ju9DWNCEx638jz2mB7d0FnFEOCo8YTy6gKwkBtOj9foZOIfXBX7HwOI8X7Nj445zZCF5hLe0shoX4LgQB9ESIZBBPyyrcvdyMtMs1E/REiKTdFuOs2uZenSOrM0+ge5GkUZhvOpUCK+F3aYNMdjv/uSQJRhUnS1cXt2onIiSg69nCHDDs07FadL1Yl9PUmfQGOQ== 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=LsBlGj62fOMsIIXEknkCpltVIOtBmVkYGG/5OxAKr24=; b=hnikxfCtTL+j5Pp00kyGy+n4ip9rCTVDba7akKtUM5c/LvW1Gt67SgcV+15CY4bgQYgLKpNWYUpiT9paF2pd9BI7BT2hM9mtRCyk/apb2pDmsRfzywlle8iC0J1bnQOhhNWxhEXsxkHrhOePxFO/WcwzZrviUGZ/IseFSSlGolI= Received: from DU7PR01CA0017.eurprd01.prod.exchangelabs.com (2603:10a6:10:50f::19) by PAXP190MB1792.EURP190.PROD.OUTLOOK.COM (2603:10a6:102:28e::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.17; Wed, 23 Oct 2024 17:00:42 +0000 Received: from DB5PEPF00014B9E.eurprd02.prod.outlook.com (2603:10a6:10:50f:cafe::f4) by DU7PR01CA0017.outlook.office365.com (2603:10a6:10:50f::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.17 via Frontend Transport; Wed, 23 Oct 2024 17:00:42 +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 DB5PEPF00014B9E.mail.protection.outlook.com (10.167.8.171) with Microsoft SMTP Server id 15.20.8093.14 via Frontend Transport; Wed, 23 Oct 2024 17:00:41 +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 v3 02/73] net/ntnic: add flow filter API Date: Wed, 23 Oct 2024 18:59:10 +0200 Message-ID: <20241023170032.314155-3-sil-plv@napatech.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20241023170032.314155-1-sil-plv@napatech.com> References: <20241021210527.2075431-1-sil-plv@napatech.com> <20241023170032.314155-1-sil-plv@napatech.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DB5PEPF00014B9E:EE_|PAXP190MB1792:EE_ Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: cd1d37c5-1a50-4ccd-cc72-08dcf3843a56 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|82310400026|36860700013|376014; X-Microsoft-Antispam-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dirF+9vr2ufNRVSOYFRINnCOrjs?= =?us-ascii?Q?jKw1guFOO8HJ+Z6ktWOFpMmTqd+GS0uncyEfpjRjc0+zt78B+RyqllLNNr1O?= =?us-ascii?Q?7kFHl8Ci0iqjDpGkdCejVN6RRtnxlKadRgCWUA/asKJQ5RkKDeXRnpFDHaJl?= =?us-ascii?Q?iOYBvi5W5CuXLwuvorkHkZcfmV7VGB5pbPSlQ+Ef+RHOD+1F68Dr8GG5qG/h?= =?us-ascii?Q?jlKHEeWkHdDtTQkVzn7azJxg/NWbG0MBQF7kgbqR72yKQgcrRZuLJhm02FEd?= =?us-ascii?Q?DJg+ruPXc/FP+2QcUxATygJ+yX1NNOgms9CMye3epv1jVUAZdhGiP1JO9eXO?= =?us-ascii?Q?MnOlfQ+mtKaJxB8ltnUrXzXDUT7sUBkluPdTAIRg6+oIpLYVM2ghy9FEFJiN?= =?us-ascii?Q?/G8/wiA5fLUdDTWNCqw6kq2mBLDHfQKlXi8vBtwCGI/JGJEReGeOlh3273xV?= =?us-ascii?Q?fzUHYRxMk7YZWXGNRsZshupdD8seHzf3ZS8BF6DJDxJSt2mRluk/wnnOrTRG?= =?us-ascii?Q?AW+0OlzGlGQNlBa7O4qbng2etPG4jiaCHq71/gIBpP0ufMBdwg=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)(82310400026)(36860700013)(376014); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: 41Ztcn6Z+yyl5H2NroVHM5gSA+DKky5nDOvkXe6tMmjxGB1y9wh4h4DAVJxXAMz4oeQDBNBeSUUKmAGZL8/4WewY3Pql1AxbKIzRBJAgjWZwZEyimL/7F9I6DnGd9TDE3seA2vi7G2dT+us2ITF22qR+rx02P5QJHRZ+McgKvMBi7GQr2dsY4FfD/dkT1wLSzywLdixaqAvnp/NCSUrs4QjhwTAwCGHWo83JOZQRIC2+T3rf/5fVIi50/vLFMFRCVcOtIlneYE5nbNGKnFaHAXTXXgf4tY0JgMhhn/biQyVsKzLVQKUl7TVPzOnHwqt5qyyAgaiUcm7gN8YnYNymbBNsT1wMKlxuh2oU2M0Bq5SudY6shZuJ1ghgyLvSkULw/CB0BXxUCElZIGZjfkKHZUbh/9Sw3GURbfP/USIvfdYC40GNPL8yBm+DZA0TejBCiCdWvTovqdI11US8LK1ThqKNwC9OrVMx8OnAxykUFSAC7PM7Hr/M5bGHdSAQPLfFxbg98ZzugAh1d1yjS7gn/r6epXLaPpHWU9YJn4duzfVSJfuaefLQw9++5DTuxkYC1Nv9BsM6MvSVPTanWdTFuIMeSEBvL5V/4X3PhoseYcr0TMo18mEmN9i7ZR9ppWbIpJm+DZzeQ5TPq9mRZTZ5HgOp1q91xGZx/JcyIf/90p0= X-OriginatorOrg: napatech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Oct 2024 17:00:41.7423 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: cd1d37c5-1a50-4ccd-cc72-08dcf3843a56 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: DB5PEPF00014B9E.eurprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXP190MB1792 X-BESS-ID: 1729702843-310766-12816-42050-1 X-BESS-VER: 2019.1_20241018.1852 X-BESS-Apparent-Source-IP: 104.47.17.109 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVqbG5oZAVgZQ0NAsKSkpNdnMwj DRMtksycwixcDMxMzSItXAPNHUxNhQqTYWALfMOKZBAAAA X-BESS-Outbound-Spam-Score: 0.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.259925 [from cloudscan8-201.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 --- v2 * Change cast to void with __rte_unused --- 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 | 37 +++++++++++++++++++ drivers/net/ntnic/ntnic_mod_reg.c | 15 ++++++++ drivers/net/ntnic/ntnic_mod_reg.h | 5 +++ 7 files changed, 80 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..445139abc9 --- /dev/null +++ b/drivers/net/ntnic/ntnic_filter/ntnic_filter.c @@ -0,0 +1,37 @@ +/* + * 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 __rte_unused, struct rte_flow *flow __rte_unused, + struct rte_flow_error *error __rte_unused) +{ + int res = 0; + + return res; +} + +static struct rte_flow *eth_flow_create(struct rte_eth_dev *eth_dev __rte_unused, + const struct rte_flow_attr *attr __rte_unused, + const struct rte_flow_item items[] __rte_unused, + const struct rte_flow_action actions[] __rte_unused, + struct rte_flow_error *error __rte_unused) +{ + 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