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 0C32F45BCC; Wed, 30 Oct 2024 22:40:05 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D59674334A; Wed, 30 Oct 2024 22:40: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 4F58F4326E for ; Wed, 30 Oct 2024 22:39:59 +0100 (CET) Received: from EUR03-AM7-obe.outbound.protection.outlook.com (mail-am7eur03lp2236.outbound.protection.outlook.com [104.47.51.236]) by mx-outbound17-81.eu-central-1b.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 30 Oct 2024 21:39:56 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=uINTgsUDXu+C8KytHJURCzPYnDSrDzNxA2iNgv4pt8tx/uSN8g5B7+7wZAhEno8UQt7ufkC4aifmctIHjYcKIdGWt9ADgwghhLkzie37camjIo1L/oeAeDZGUbldpByRpjHJvrh0qvJRfUKzSYIUw4ytha85kLQ85wsC+aS1T6wKsgrU+FzsqLm39aUCJ7FZZ7SN/8wFdKssKqlGnDKr8DAhPcTKT/NhQxB9Z2tNCXCJNkX1fIWMMahvaqZu04vnceystJUTY/4OC78qeQ7kHr4jSydfbqgUd2z/Enk0ndUYnTbwiKH6MfKj/z0bpGp2lsv3HrefvohgjbstUvarTA== 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=KrsfdNpEp7beJqBwojElqzgmOmG7o9y9Xu2xzpuhcAA=; b=bm4q/PPz9jBPFGPXcOr/5g2RgvkExWlUkrQpuZXeKtQD3zXklrJ0sab9nUXBHm7twBLatEMrEyg3AX1XNC4f+A4H4LFO2VZ9OFFkR+eJFZHiQvoz3drybHmatZJX2vEli+te4DSS0QL2Ur9rNHuawY361ri/sLnG/vQJH+vS49LXDqFFj2iBPwIxlFhCvFQuX2wNQ5jx+5xZOPdTIJIhRQBesuvX4k7wIl+qzUn0tcUh3Sqhd1fXfnzP9nkuGjMKkqone8JrfC+DXy/AyeJ2YJuArUmFrY2AfFxd+L1FfmEUIGVR2NQpogPBKiwae01WQYR+7ocE0Bwi0U0FW5t1WA== 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=KrsfdNpEp7beJqBwojElqzgmOmG7o9y9Xu2xzpuhcAA=; b=BJ2jWcwtJQ5eAEwnJIE6UXZ5aC5aQQ/KlsdMq9Czo5KKlEn9xsf2mZcaqp5BREMszZoBmr4j9i0/C4EuHs8UROEvalpVTkbd1XNvBGczyGWwOe+/o90AqTp3AF9k4+ikEqUU3Wfog0q/nK8o/KX/cmvdEybRzUnr9cTPh9ecwu4= Received: from DUZPR01CA0008.eurprd01.prod.exchangelabs.com (2603:10a6:10:3c3::17) by AS8P190MB1237.EURP190.PROD.OUTLOOK.COM (2603:10a6:20b:2e7::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.21; Wed, 30 Oct 2024 21:39:54 +0000 Received: from DU2PEPF00028D13.eurprd03.prod.outlook.com (2603:10a6:10:3c3:cafe::64) by DUZPR01CA0008.outlook.office365.com (2603:10a6:10:3c3::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.22 via Frontend Transport; Wed, 30 Oct 2024 21:39:54 +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 DU2PEPF00028D13.mail.protection.outlook.com (10.167.242.27) with Microsoft SMTP Server id 15.20.8114.16 via Frontend Transport; Wed, 30 Oct 2024 21:39:53 +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 v5 02/80] net/ntnic: add flow filter support Date: Wed, 30 Oct 2024 22:38:09 +0100 Message-ID: <20241030213940.3470062-3-sil-plv@napatech.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20241030213940.3470062-1-sil-plv@napatech.com> References: <20241021210527.2075431-1-sil-plv@napatech.com> <20241030213940.3470062-1-sil-plv@napatech.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU2PEPF00028D13:EE_|AS8P190MB1237:EE_ Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: 0f941c85-1637-495a-ea8a-08dcf92b6451 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|36860700013|82310400026|1800799024; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?tT/LkWespnKY86NWpdx9Ey9JgK09r8AtK1kI5hI1/J9vFVV5xEjAecNlc/Ua?= =?us-ascii?Q?V4Y75+W6n/svvMJvSUUoqi7RVBNUAIh734/WOxR4+dFQY1ISPRIyfX0rTwEU?= =?us-ascii?Q?R86TLW+CJ9E3Ci8yuu6K9OMKQ0LgJsKz56fGumz2/sk49t6znUwCvInZzju9?= =?us-ascii?Q?IK720hkZNdBRpcEyIuuu8lxu/QdSkMVh8sdres+RTNbSDNt6z96PWu82GSMa?= =?us-ascii?Q?hbEp8E/s4TlghkfSj87r2c8aE/F3VsvqrTKjIWAs6d9tb6SExlU4BWiUccmp?= =?us-ascii?Q?JT8rK6ORRrbS7BknyDIvJIhGgZ+uYce2BqlVtxaJzuzFkRwYgoLNV00EerOO?= =?us-ascii?Q?6w9FsR4n1B9MbVkbhTLhLTuyLx525i2qCZQBYj4uPSeBnXQQBMc9MC2Er91u?= =?us-ascii?Q?No7FCHvlejfn530bbjuW4ltG+DL+Mmhy0TrWo+JdcCBmD8IoUyUKMjfg8im4?= =?us-ascii?Q?Wrv5KffIw0H4FIzL/I6qzsdj4VVHj+kbqW5SkJzmXNlkmPJmhwAczrllg+W4?= =?us-ascii?Q?yArmNMEoMslCfuNoKsFawvSebxzTVrOW500jZuobiLd+l0AluHRltWn3S7p6?= =?us-ascii?Q?PcPsDQy9q5yYFb+lEg3Y9LaPKFDeR54ytPI3H3Y2Ww4ztCzJUINhncZptUsL?= =?us-ascii?Q?3parlSJg7vw2IpxiQgL8ZqZ8Dpkacy9lmPbZSuzplw4oEiF5jCe0MQHDkHnw?= =?us-ascii?Q?S0X9Ttr6F48fIhuuajw2HiOdm78voXD65yirKtwPAIf7sumEK+CNVdlDTo/c?= =?us-ascii?Q?aUr+5UkW0OI5g+k7V1PXlyb1bVdAzBZxI98NbMn0AMiKKZ+dG3IByq6NcrNn?= =?us-ascii?Q?Tdi1qah/vKK9NODDRTRTE64MZbWADVW6FeINDUsqzAGKMs9SPd0yJhOYtDqX?= =?us-ascii?Q?kLU1sc53sE9zmtv8av1mzPBGhINslgatYR8gupSBbgwoaVW0ttnsNkjzv6Jq?= =?us-ascii?Q?ouQmuGibToNYz4DI9zvUEWj4ZetqAQNQ1nKI+y80SjPuuCf64lmjzpRUq2u7?= =?us-ascii?Q?B/KJQexzh4BAKrpgAactjKxLZl/Kk3vNLBJ27yeDUVwbzOR8xrdHEKvKJnt2?= =?us-ascii?Q?ZSgq1HcK+i4QuGHBTsqLRjsofrFCZYOf1pyoKoMxaWd/B3rpfDj9mWnNJAUi?= =?us-ascii?Q?XNGOcuYMGM0wnprw/nRBNK+YDhlhwLfamr0zBjQiJsXFPU6P2Rb+RXZQWFQr?= =?us-ascii?Q?EBAVA59lXI1k7cEs2piOhRluElGJ82gg6B6PD9KQYDxDsxwjG972rLWo0HkR?= =?us-ascii?Q?Diu2OXQc1BvbRPGFpHS3fj4451AWTJu/I2k53JKVgXT5n0Xu1Dqu1t3x0B0o?= =?us-ascii?Q?uPSOMG+7qM5Mln8cvKtgChq88UW0Y5Z6cEAVTCl4I2c9rv+JZHnVcJEjVGil?= =?us-ascii?Q?xUZinfDO0+ZDgSMH4H7sEZxDHmGMKWOsD6X2o76zO6h8AAJD7g=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)(376014)(36860700013)(82310400026)(1800799024); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: PVywU2aUuVHdcpnzKPOCIcwdFi5wVKrd7kOJWkb5Tc8Y4/+cE7X6vjN6IxhOFpQcC6jGZ5RL653mTzgj4llNSjP7AUnh+cIzup8JXL9Hf1S4qK91L2DgnqL5All2GE8WfiQ4i4/PAqxVxRmetIiKr5S3gj/erPNkdTarxoJplkSFaJgrSMMkZr+2m82nt7xTyQRJBL/9yT1Zu8+warfibPHjhsUNK8Lu3g6lsE/W168TnfilLoQWnU06zBLHIjdZjha2vbpuRw9+L2iY7nIskf6A789hrPtEyjXSpYG8CawF1Ehf8g+lKzX9Gntr3V0Sfo+q9si9wxWaMRp2+7mtHf99EqLlLLFjoSqFxq9dQ44eSeOhLe9PiY094jzVhUD+pmaAcNL4IB7tgdRhSfI0k0JuqM8xmxvXFn4r2xlQlBzt28OtCHeGlpaIUKLfzFlQtKqHlRDDyYJLV7yl/NYiILQSGHyVDz4zeT1RXrahUYGcyDmRXZRL/mjL1Jj2mD+JFVDxI/v0uFIDwQub5lzFnLCly9CPw0TEg5Q0B0h1m8D5FzhDppNHJexeZjYaRll7bWOPXN6p3jEWLhnHEXbsEi3oLLV9MAcTa7MtF3j4VocyNTCoJY7KHzKw5Ixyec22uO3xqP+HViOxdYm/xXPuA1QTqJFqsOmnsF7u1MngdoM= X-OriginatorOrg: napatech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Oct 2024 21:39:53.9111 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0f941c85-1637-495a-ea8a-08dcf92b6451 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: DU2PEPF00028D13.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8P190MB1237 X-BESS-ID: 1730324396-304433-12637-44603-1 X-BESS-VER: 2019.1_20241018.1852 X-BESS-Apparent-Source-IP: 104.47.51.236 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVqbG5kZAVgZQMNHCODHVKNHE3C AxKdkkxcA8zdTYKNnc0tDCLMk01cxSqTYWAHjO+/9BAAAA X-BESS-Outbound-Spam-Score: 0.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.260091 [from cloudscan15-95.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