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 1A42345BC0; Tue, 29 Oct 2024 17:43:11 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7FDE242EC5; Tue, 29 Oct 2024 17:43:02 +0100 (CET) Received: from egress-ip42b.ess.de.barracuda.com (egress-ip42b.ess.de.barracuda.com [18.185.115.246]) by mails.dpdk.org (Postfix) with ESMTP id D7D4D42EB4 for ; Tue, 29 Oct 2024 17:42:55 +0100 (CET) Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05lp2173.outbound.protection.outlook.com [104.47.17.173]) by mx-outbound43-199.eu-central-1c.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 29 Oct 2024 16:42:53 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=nD86jgcaSEJ3Os1EnGRZVzTPnmS5Ee8I5ufn17mRBhes7s5MH9V63ahD/Cw//lzbyTD3ouvMkC2biPLAmmqR9WnKBJBv0uQ5L1eVfN/9ocYuud6ibuPeaKTDnRL5Wt0xkusFy+MjfxUSHQLeHJNnH13UvLU5i9mUaYn9bpDkvDAYZfjo2QeyfL3Evf5cDNGcup4lUjS00Ik4+XKJ4+d75iGFk2M+iM603tfoX7GnLV9aUz+1h0GSIjeWeiymMlIz4hw9VBw+kUZo2dFKUWrBTDZgy9kLJBBpmHDczEhx7vzHZ4b/M9CHlIeLdgqHHRfl+FngmZrVwD3aoSbKEVY8Sg== 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=rMEyph1aNWZDxiigZQiXFMhNErjEVQ1lI1iq1Il886iI6fk+cq3cblXKWy81vJrFoeu6bY448lQyAw3rqDyWJ5gaSkL8R0YsY/OpczgkwJHtKZ4J96Fpb/jPT6jDGBNiTRvAGHKveNl09ioEtGfPiMrnPmn3FHtfUwtcsSb3MVdIbuqbyKHYOIYbEaHaCwBrTE3dEVWDwlBUProB089G09t9gWQ7T245ICewFpdzh3SDDnyjYkxxZGV0YMoKJ/+WXwo1ZcTmR4/ch4bUW8f8OO32p2mVIYsNuAOofHLwJYE1wFyxOjkoiWbSM7+nM6ZF+evQmCTB35pkwp8z9PuDNA== 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=NTEuo0SSm1+gKip7zcxbTXA1cM8+wlBGnrqIuF286QiFKYocWA2Eym4aIQyW/HUsmUyeO0mxj04N6Y2/jQJNLlK0xh0DLrVjEedv2dfqoh3+jYMz5TvgVbAsAmVUsBUlSo9vqj7gLHCbgPZhSEacKrGR0mclsRW0pw/gJg8YPIc= Received: from DUZPR01CA0191.eurprd01.prod.exchangelabs.com (2603:10a6:10:4b6::20) by DB9P190MB1068.EURP190.PROD.OUTLOOK.COM (2603:10a6:10:224::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.32; Tue, 29 Oct 2024 16:42:49 +0000 Received: from DU2PEPF00028D06.eurprd03.prod.outlook.com (2603:10a6:10:4b6:cafe::8) by DUZPR01CA0191.outlook.office365.com (2603:10a6:10:4b6::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.29 via Frontend Transport; Tue, 29 Oct 2024 16:42:49 +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 DU2PEPF00028D06.mail.protection.outlook.com (10.167.242.166) with Microsoft SMTP Server id 15.20.8114.16 via Frontend Transport; Tue, 29 Oct 2024 16:42:49 +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, stephen@networkplumber.org Subject: [PATCH v4 02/86] net/ntnic: add flow filter API Date: Tue, 29 Oct 2024 17:41:06 +0100 Message-ID: <20241029164243.1648775-3-sil-plv@napatech.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20241029164243.1648775-1-sil-plv@napatech.com> References: <20241021210527.2075431-1-sil-plv@napatech.com> <20241029164243.1648775-1-sil-plv@napatech.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU2PEPF00028D06:EE_|DB9P190MB1068:EE_ Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: b4656643-e2d7-4e2c-27b2-08dcf838b9c6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|82310400026|376014|36860700013|1800799024; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?GS1nvl5Q0apNepsOAylNG276KJnObwEqr92M2fXjygKlEWTEB58scagzrkWa?= =?us-ascii?Q?9znGmonfGb9ptTeQuVbrovFXl2mM1/mp1FztNAF6xyX+ZfuU5iE9TX18MI1X?= =?us-ascii?Q?+7jpX+EWRQ7yeePQeojWJqpKM2oZ9prXh1vs2w/8EIaXsjAFkdjxsYg6IPhp?= =?us-ascii?Q?KcIIvKgwyzhuFrISWoJYZZqXBdPZLpohrbUtryd2vyIe2JOalez94CvvEVAf?= =?us-ascii?Q?Ij5ain9LfDONWCjxqkdutVH0Q67xTHdMkQ7cg852a4a+VdbmwK9b5zM1Eq1B?= =?us-ascii?Q?AnHCGHasCi3gnlkbnifV57jOw4t6yQmEzzo1RbGoYpvF1Npa1hVsyAD1ystM?= =?us-ascii?Q?YCQJGrhPyMCJTofvyeWZIK2S34mzKTCRptY47b9qjlU9yJreWHbLitzKJE/t?= =?us-ascii?Q?WIKJb/aG42WcOusd48824wztTRcRiyVoaxNllRqlL4m9sbAjJOIynVBDdA51?= =?us-ascii?Q?0n73LV1IXLQf/O8xU20wt1WhvgyGV8bYIkHIafu2MqToAJz1AkobWLf/AsLw?= =?us-ascii?Q?w01bUIjj0gJ1VvZ0TQJ5hsV5bR22EjEdRBYpIt+x4WkgjwEkT3Ucpu5Uz+sq?= =?us-ascii?Q?Zl6JGRarPZwM++AEfzeUtn/or2GlmHk7HA8EEeQ8TGvI0JOQxsiWx9Ix8bFj?= =?us-ascii?Q?eE1pcN/enMMjNKKEZ5OXRv9HFNAf5NHt2CWnTuSd4fHPb5Y8kgFfOOEe8jvw?= =?us-ascii?Q?HCwaDJVTk7tRlYm+xat/WktidFtuKnkj86S/LV00x5y+Gw3zTMl5gB5F4CN4?= =?us-ascii?Q?uBW4fhXJwonURYtIuD/DGLh3esUDV+xINMmn9jvPg+mbOZpK3Cs6rH8Xrabt?= =?us-ascii?Q?Mcpv0QwBtb6rJqdbw6oikJjubxL084zJRnzf308V+QHyCPSsVGwmkOOcwzMv?= =?us-ascii?Q?pILG3SprMci8vcyHBqxm6uAA1hFX6kQudE799eNKqiOmTZmSYbpFQoovAE1c?= =?us-ascii?Q?z44COuJ1il4/ZZF69GhqCsEn7VK0QRc68LJxgEoC/fypMs98sgUUwvm7epSW?= =?us-ascii?Q?FhPqMaLx9tyli4uihuu4i1nHdGqOnELXkUKELJlgk6Gu4A9UGtgRVBLnXCJl?= =?us-ascii?Q?plq74cHg8AqWRdBHaCBufBwzE4e07kYMGkIcJRUmW6NQ+eG7g3KuUMOtEDF7?= =?us-ascii?Q?XgUsEKWt+/9mDSSl1YieHMMsMgxRkwE5nTi6qjO655KYs8r6Lb41OsrnpJY8?= =?us-ascii?Q?uiPKSBSIx6LiMOknIyM3pewRp2vAIjD/dPdvx2bAH48onvn2jADd7B8Z8CaJ?= =?us-ascii?Q?wcCtpioxHWkwbTdQF/LBAPlIc7X1BP2RbSUmGfmHgHiw7xcKMYF2ICZBOIPB?= =?us-ascii?Q?DVAgo9APJghGql4QjBVysdLLTL6FqMSyO6fH1zmT4zDnBOLbg18FROApIJba?= =?us-ascii?Q?P/4G3u6yVkr+SMJY3w/El2OOhsdkldzLZWX+n9q6QfuHmY7TAA=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)(82310400026)(376014)(36860700013)(1800799024); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: fv3xvTCeIXTXAt2k+kSmU+o3hnxOE4jUFrk8+Zno1QOel5/FiGZdh35WCH+m/xgI1kO+v78aqGvE6Ru8zDqUdKDBJcpDeBSvqtuaUoM3bZjejVSVQ4Yj1MheITzqdLNNwmg/GnOPhp56EOHyGPXDGLknvAVevTDDC7fAXlYlmCnCZ9d0IPf7V0SQkMVwGwhzLFZ+g04KAKyMHhJL1fjTcVAX4CGf/5OHMAVjOgBfRaF8dVdbG9aIZEN5x7IxbKJAm8uE2rsGDw1HruCV02UyTMDYpcxqGtCXL8unwKFbKwNUzvGPIK+VMsMv1qsS77nHEfWhMqXN/0V7jfxbVWqiq8XGhIo+gCfdjwHo03DAtKnMZcJvt44pR4ytla8BK6U06aIiFDlV4B95NBkZwQAWlgC3cUKA1MBCc2rXm0PmxO453Tm4hUuez8+1r2f4LvspeaZB/MxAvDiRRJE3ML9eqESvns6G9WAlbYkYp8Vhl2so3DPInfaA9VZmPLeBkTZwD25l07TvtutMpn2nC4dSiSVxN5z/gYZd4ABX6P7fZ0qKmwqyMkSLlaj14GiNSnV6mkRNsVQgrD1S+2JsS2QRw8UIGUrArBUb0CSnF9VdERp5zt/d7esy5YTOrnDV4kphvnXECT26E77f/LuEAAHCQdOqZbhQaScNiHkciMUDxSw= X-OriginatorOrg: napatech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Oct 2024 16:42:49.5739 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b4656643-e2d7-4e2c-27b2-08dcf838b9c6 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: DU2PEPF00028D06.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9P190MB1068 X-BESS-ID: 1730220173-311207-12661-27814-1 X-BESS-VER: 2019.1_20241018.1852 X-BESS-Apparent-Source-IP: 104.47.17.173 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.260063 [from cloudscan18-215.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 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