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 3D93545BA3; Tue, 22 Oct 2024 18:56:45 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id DB2FF40A7A; Tue, 22 Oct 2024 18:56:16 +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 7741440696 for ; Tue, 22 Oct 2024 18:56:10 +0200 (CEST) Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05lp2106.outbound.protection.outlook.com [104.47.17.106]) by mx-outbound15-54.eu-central-1a.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 22 Oct 2024 16:56:09 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=jOG3ShEPemyYXmxd+lr1Feh2TVFuoKW782QRbQ2kvv229hCzv+V03h8IMsBhEXBziNbNO8wolvbw9sh4h3YC8NVjrNMNW+nSYRlqHdGcKd3LeB06c1MhCCkr2JAcK7mANRlwyKRxpXi/bDjQ+RBldKoOujCEU/3kr+VHAawRbwMJ3ctsRH7NLgzNNMxJc01uNnu0NKWxPtgGfbb9akDdRlyU78RX5qlSkniQiBUYb77ZBFV6hC3SHeZhryvAi1dDfMwWDk1Fi+6j0QAnHtpq7LRIjFNRyS0UM2cou6e4rCusp1IhIaw42MC6R4NFwOhCo012CDowd0rBYFR3B4oiTg== 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=CcTqK03GcaUbq5NRw2ySotqiD//e8BfaAdDcwjWggp5lCQnAjybAKUW6PKJEYY6TOnK+tTyDQYLhr4ixPQbYGtQkiCcPNdHWmB0b9ESFgtXYaljtP7r7z9KhmLkwamWTSMblbPT/3d81KcxmgFguQOKLfDF8zgeIK5+YM0SVjgp6jcBagis6BU+3rGKr/PefhT7wx0pBPf4EAljAezRU5B2w59N1etd0f/j14xYJ6apOpHjF1ym33L9TCc1OoJA8QDch7n79omSElZDFKaYgymACn7k54pDGpwc/nQAWvFTSChRxxXYXR9Dwm/VtGZF+K/tqT/ykCjgicNXQ4fiwMA== 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=AeARsKjWYkAaRWZZWZiskKMzCljHI1q/z4JMWCkk6SEB6OFJQM6zRffZcd+6ke0/0oS2dryteXunzPQsxPj4/LmraO3FzbIq2uq+MLYrcIaW+yyDQKWhINSueUwv8Su6RPhPN+jJJ5OHxmy11Wrvw5YEKBU4Q3Pt4P3V6XGEyJA= Received: from DB9PR06CA0006.eurprd06.prod.outlook.com (2603:10a6:10:1db::11) by DB9P190MB1274.EURP190.PROD.OUTLOOK.COM (2603:10a6:10:228::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.28; Tue, 22 Oct 2024 16:56:00 +0000 Received: from DU2PEPF0001E9C2.eurprd03.prod.outlook.com (2603:10a6:10:1db:cafe::fe) by DB9PR06CA0006.outlook.office365.com (2603:10a6:10:1db::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.29 via Frontend Transport; Tue, 22 Oct 2024 16:56:00 +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 DU2PEPF0001E9C2.mail.protection.outlook.com (10.167.8.71) with Microsoft SMTP Server id 15.20.8093.14 via Frontend Transport; Tue, 22 Oct 2024 16:55:59 +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 v2 02/73] net/ntnic: add flow filter API Date: Tue, 22 Oct 2024 18:54:19 +0200 Message-ID: <20241022165541.3186140-3-sil-plv@napatech.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20241022165541.3186140-1-sil-plv@napatech.com> References: <20241021210527.2075431-1-sil-plv@napatech.com> <20241022165541.3186140-1-sil-plv@napatech.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU2PEPF0001E9C2:EE_|DB9P190MB1274:EE_ Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: d506b46b-e0cd-479a-eeba-08dcf2ba67f6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|376014|36860700013|82310400026; X-Microsoft-Antispam-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6Qz2JGP5lYUmukWLHDYPErwN1kuzxnVg61AS1w5SRvQFrTFA?= =?us-ascii?Q?VmvknTVRwgV6nuIRe7urThZeQQRQmrkqHdJHQqxIYQ1u5cF1aGsn3KmokQa3?= =?us-ascii?Q?JbPvREBC8YP/aweQIDT1gRWkMs5T9XNDDs8fGqLsg8cvixa9GsDb+ZrEvopO?= =?us-ascii?Q?gqh8474CgZD8TnpYO2blSQ6cHTeZacmuBraL5H7YIodVnqMujY4zubhtPbCp?= =?us-ascii?Q?rpiGEDJf7Vuwawi2bUuQl4Q8jAj29SYjQHVeF8PPvMtYSAVfduKHEkgtx0Cs?= =?us-ascii?Q?hwjZmJuDU6lOL4AqP89c/XSnJhbxKO76kY1JsLp+SykFOopUhr9zk87HZQCk?= =?us-ascii?Q?5/iCLY1s0GIJfiqEVlTU9kYmHj6QwIlQ6eVBsJjzjpJKEY9exgXLZvzfRtPY?= =?us-ascii?Q?xpzJSOKm0M5Ia2FFVLzBJqI/FuxojDwiE7Pw1iyUP3d1/X4HvdT3h3dZl5wV?= =?us-ascii?Q?49MtgJiBYxt2QB1zhOXe0MaM5iG8PERbg3Mrjx1j0Rj3OtIGOKf9mQi3RBX1?= =?us-ascii?Q?pWPkmrPbgpRlo7WJdpEeAW7L4UQMiD+x6pgzVw865l5gJ8NEsA=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)(376014)(36860700013)(82310400026); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: qx7qrtqGv5U7SsmLYaVqTNgCQuIzp3N8o9d4psF4gPcr5jiyVrixv34jfzYmZIOHIMGO0sehNWzUPt7oRO6tPNJZ2R0/0R/m/BnZ9eHEnQSTv4IOndxD2sjJIWgitpNSqe6Fc/XF5ezW2E1b+FadmvlXFE6JqVkGCyr/zHLXyJ5aLgFcibJmLfUnXav3D52fChKJID4vmVQk3U14hva2H2WRj3/0gvaiJuR5cVAhBA0HIhMhKDYKNVCtiFw6CTRW3k/XIreuv2LbjF6/hsmFZS4MRs8DFDiRNVH91rP3wa9/pYU2A0hTdUUG8K47iFLmsyGA7mr3vripCwol79thWWGtxezkouxnR2DVRRbqYKCYa7yhWNvF2awYAjEG1S/rCabljornef7ozu1Ug9if+t3uoeLrNQ37P2SJooGkCOr6ZjdDa1Mn5fjqanbCjE3g7EAMLsBZAsWo2WdTvKGrn6CfgGmVwi1QDdh0nbst1xMey89p81o1Ev5+jM45posWXJVqpF7c3oGhI6wC9GLLCGzFA8V/w3TXaKTOVEiIJiUmK6RZkWMrFHMvs6Uj6PLoSZ0l0Dlga4inubgy4T6jPFBH/sR8QIHjY2JyEBhcJB67AYNEEmI46Xkd0KiXixH2HQ2Q3TlElCM4afLlMH9CYHpcfNmi5XfWbjOv5wWSoRo= X-OriginatorOrg: napatech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Oct 2024 16:55:59.9030 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d506b46b-e0cd-479a-eeba-08dcf2ba67f6 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: DU2PEPF0001E9C2.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9P190MB1274 X-BESS-ID: 1729616167-303894-12663-13503-2 X-BESS-VER: 2019.1_20241018.1852 X-BESS-Apparent-Source-IP: 104.47.17.106 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.259902 [from cloudscan15-77.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