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 204BE45B96; Tue, 22 Oct 2024 00:38:47 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0F0A8402E4; Tue, 22 Oct 2024 00:38:47 +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 DC61640696 for ; Tue, 22 Oct 2024 00:38:44 +0200 (CEST) Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05lp2112.outbound.protection.outlook.com [104.47.18.112]) 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 22:38:44 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=f9YOe3Nzhcd0sRu4pFNpx1GIc2A6FZqsTVr3mmLCjobYgSVqJEv3wlYOA3VH3At629Eqr1eFkcXoJ0tUYDkRyxv3Osgvvhswxf0TqBa7ww6dJWhd86u9hQfNTAd3TrryktbxHY51xvFfZGvKHPZZPzBDB/MODK9+ciqDhdqyOJ+cnEA6C6QU9HD4NRi0xJTwXcj5jU8C/yBpxZYf3caWfWQipesVDJ2k0SOMa19Pg7spm8hs8l9rKI2HB36JecfKRq/A2lMC87ua9HxdjFnparO9nh99h3sRLrmpHCObcwjGl/LAxyzncTIbJJEX38XO7KooOUMcdyBEVdVqvBSjJg== 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=ofP9ZvSktRJh5letdq8nd7kaXkMQ5pK5CmeXFwsi6JQ=; b=GyYM3z25D4GLONrYzmNarWnxdQilXEgQi8ADHISrvKPH6rUnBN/Ri+llPp7z33qKQFAtKG4zFzA0rO+XjlCm1bg18k+OqbsBKPlZtuY7cLaEwR+hNJhZG7CO6aJkwI0sdaVlmTvkfxNCfsZZYF+c8rFbbZePW+QHWh83N/PgpsB06mgKWUf/IYmbIH99N9cEqF/wsTe5719CTJtLQJwjd/NrHa6GmYuG6XvGS+D1DAAu2wapstrrnkPVXZZIbMVDRmwvR4qkBTc/AoL64V9qV9lIQZzVMMPQDp++ZTvRD9+6knCE9Zn62t+p1BoKZonMv2j/75Hm4pcd85QwhvEnzg== 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=ofP9ZvSktRJh5letdq8nd7kaXkMQ5pK5CmeXFwsi6JQ=; b=XZ7f80pUuX7Ae84znWQMOwuYxZzqT90qz/4k/D7yJ35Cn5wWUufUh9xbfJ9pxnZvXbRBjXxZIwWyhNW5WBDJmo1YmOQyMUN+cOZkGOKL2SdM2hhtc6cw3g3QCxoV0xcokXPcx2WMeGYH5DHr0d1whQb8i+mL+vyTApfg4ijpez0= Received: from AS9PR04CA0134.eurprd04.prod.outlook.com (2603:10a6:20b:48a::9) by DB9P190MB1700.EURP190.PROD.OUTLOOK.COM (2603:10a6:10:327::17) 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:06:17 +0000 Received: from AMS0EPF000001A8.eurprd05.prod.outlook.com (2603:10a6:20b:48a:cafe::e7) by AS9PR04CA0134.outlook.office365.com (2603:10a6:20b:48a::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.28 via Frontend Transport; Mon, 21 Oct 2024 21:06:17 +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:06:17 +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, Danylo Vodopianov Subject: [PATCH v1 66/73] net/ntnic: add aged API to the inline profile Date: Mon, 21 Oct 2024 23:05:08 +0200 Message-ID: <20241021210527.2075431-67-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_|DB9P190MB1700:EE_ Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: 3e79245f-dbdc-4fe2-e367-08dcf21434b3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|82310400026|1800799024|36860700013|376014; X-Microsoft-Antispam-Message-Info: =?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5FXt2SE/DBZCR5H/eLsPypc2eFOspL?= =?us-ascii?Q?7ACYZpbUSGjWRWGYg3b18NdJbh8GD27ykKu4kFf/QmHV0Iwss3oGFR6xdANg?= =?us-ascii?Q?Fmi79ZE3TqM+keHTTavW8a7rU4OQQrlTbtKIRZUc/HAIpYBuvLR2zvWm2cAX?= =?us-ascii?Q?fNsaohTtpnVqQQM/NjMDWvaU+vnoMLBQiCsfRhPIS06+20677tgniqAWF3LT?= =?us-ascii?Q?JiqcXMbvkGwLL1+lxMOLjzmk/lhZk3ruBfe7/lFAjpGP1xfLSMAzjy/Hqbnj?= =?us-ascii?Q?jDPSqXzUL7c7NRJ5j/AiytVThxxTFlUApaNap1XXZ0eIZgyJXAF41SUTFFu4?= =?us-ascii?Q?NnkRuIegn4SplQkMrcn9gZd2cOoqn9X3iIbjqpfXoBAdoI1UReyQok3Uze3g?= =?us-ascii?Q?41/3AwgqWM0ghp5Gy+/1I8chPyDqEsqvePAFMm1tyMKEM2eAbBidUzAg2LY2?= =?us-ascii?Q?RvfOf8FLfKM17xHCPMl7sJEH1WHUOX8/HOVP9Uzl8FhLOHq64/1ygI/It3/F?= =?us-ascii?Q?uY29nd8jVdz5XGHcCSrpthyj7QnJeHbxl5nkpc8SeHhR+sWLZg=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)(1800799024)(36860700013)(376014); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: g5TrYKp2K5nwZZ6oiDyUTNQPK64G00swtZ0FgM9Yq00qylMDh0V3JDhEKdwjydYWPQk1aOOji2wCXXDR9q1ZFpeI34jH6BoWxPWMi1/skWpbTgUuZQKqT0KkZ8qpws3ocSDrx6kAvb/rEwEEuUGNAW7DbrmuY2yanvnarzByCMj9aARdSJf+PbbPi5/q2ZNbh5K9GIg9e8DvoDLciNTNTxkHmVYN8MogXc+VZ480t5TyDp20YpxsZa6nLQnCSKvYg17Frfpv5xV7mLYwnTqhdWZB80YuaWuVslCzWuluIzfTXeVmqb0bLj/tNgRqjL6y7das0M5eRVWQB3WFzzC8GoeYeA7GlUitHrIMWvCfr3/BKM9eAiZmLnREt71QpCmAwON51sZ2dUxGT2jgfrA34CUbWgDf/3+IdXJ9hP9zKddUykzxNUexNKcRfcl7jMhrwhE7VK43taw9i67EvYEOQbbWFwQPZD4XEC0Dnvzeicujpu9AvPdhrjku3uNPYaprGOXUJHiQIJtVo2KdlEBjGXCbc5PN9vvmwt5TvE7JTynRhske4o2Pjg6FKyhyqKrTLaig6+VsBhwJFOstUI81OfFe0bilxi1HKahLXB/nqdkbL7/54ywMbg+OoV61CjbrK/iPw90xzmYTDt8t/QHh2qt1gkRSafgLtj0wnlEU+bg= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Oct 2024 21:06:17.5677 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3e79245f-dbdc-4fe2-e367-08dcf21434b3 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: DB9P190MB1700 X-OriginatorOrg: napatech.com X-BESS-ID: 1729550323-302135-12912-45653-1 X-BESS-VER: 2019.1_20241018.1852 X-BESS-Apparent-Source-IP: 104.47.18.112 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVmbmZgZAVgZQMMXY1MTQIsnC0t TI1MLCJMXEINXE1Ng4NdXQ2Mgy1dBIqTYWAGBwaXtBAAAA X-BESS-Outbound-Spam-Score: 0.50 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.259884 [from cloudscan8-241.eu-central-1a.ess.aws.cudaops.com] Rule breakdown below pts rule name description ---- ---------------------- -------------------------------- 0.50 BSF_RULE7568M META: Custom Rule 7568M 0.00 BSF_BESS_OUTBOUND META: BESS Outbound X-BESS-Outbound-Spam-Status: SCORE=0.50 using account:ESS113687 scores of KILL_LEVEL=7.0 tests=BSF_RULE7568M, 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 From: Danylo Vodopianov Added implementation for flow get aged API. Module which operate with age queue was extended with get, count and size operations. Signed-off-by: Danylo Vodopianov --- drivers/net/ntnic/meson.build | 1 + .../flow_api/profile_inline/flm_age_queue.c | 49 ++++++++++++++++++ .../flow_api/profile_inline/flm_age_queue.h | 24 +++++++++ .../profile_inline/flow_api_profile_inline.c | 51 +++++++++++++++++++ .../profile_inline/flow_api_profile_inline.h | 6 +++ 5 files changed, 131 insertions(+) create mode 100644 drivers/net/ntnic/nthw/flow_api/profile_inline/flm_age_queue.c create mode 100644 drivers/net/ntnic/nthw/flow_api/profile_inline/flm_age_queue.h diff --git a/drivers/net/ntnic/meson.build b/drivers/net/ntnic/meson.build index c0b7729929..8c6d02a5ec 100644 --- a/drivers/net/ntnic/meson.build +++ b/drivers/net/ntnic/meson.build @@ -58,6 +58,7 @@ sources = files( 'nthw/flow_api/flow_group.c', 'nthw/flow_api/flow_id_table.c', 'nthw/flow_api/hw_mod/hw_mod_backend.c', + 'nthw/flow_api/profile_inline/flm_age_queue.c', 'nthw/flow_api/profile_inline/flm_lrn_queue.c', 'nthw/flow_api/profile_inline/flm_evt_queue.c', 'nthw/flow_api/profile_inline/flow_api_profile_inline.c', diff --git a/drivers/net/ntnic/nthw/flow_api/profile_inline/flm_age_queue.c b/drivers/net/ntnic/nthw/flow_api/profile_inline/flm_age_queue.c new file mode 100644 index 0000000000..f6f04009fe --- /dev/null +++ b/drivers/net/ntnic/nthw/flow_api/profile_inline/flm_age_queue.c @@ -0,0 +1,49 @@ +/* + * SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2024 Napatech A/S + */ + +#include + +#include "ntlog.h" +#include "flm_age_queue.h" + +/* Queues for flm aged events */ +static struct rte_ring *age_queue[MAX_EVT_AGE_QUEUES]; + +int flm_age_queue_get(uint16_t caller_id, struct flm_age_event_s *obj) +{ + int ret; + + /* If queues is not created, then ignore and return */ + if (caller_id < MAX_EVT_AGE_QUEUES && age_queue[caller_id] != NULL) { + ret = rte_ring_sc_dequeue_elem(age_queue[caller_id], obj, FLM_AGE_ELEM_SIZE); + + if (ret != 0) + NT_LOG(DBG, FILTER, "FLM aged event queue empty"); + + return ret; + } + + return -ENOENT; +} + +unsigned int flm_age_queue_count(uint16_t caller_id) +{ + unsigned int ret = 0; + + if (caller_id < MAX_EVT_AGE_QUEUES && age_queue[caller_id] != NULL) + ret = rte_ring_count(age_queue[caller_id]); + + return ret; +} + +unsigned int flm_age_queue_get_size(uint16_t caller_id) +{ + unsigned int ret = 0; + + if (caller_id < MAX_EVT_AGE_QUEUES && age_queue[caller_id] != NULL) + ret = rte_ring_get_size(age_queue[caller_id]); + + return ret; +} diff --git a/drivers/net/ntnic/nthw/flow_api/profile_inline/flm_age_queue.h b/drivers/net/ntnic/nthw/flow_api/profile_inline/flm_age_queue.h new file mode 100644 index 0000000000..d61609cc01 --- /dev/null +++ b/drivers/net/ntnic/nthw/flow_api/profile_inline/flm_age_queue.h @@ -0,0 +1,24 @@ +/* + * SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2024 Napatech A/S + */ + +#ifndef _FLM_AGE_QUEUE_H_ +#define _FLM_AGE_QUEUE_H_ + +#include "stdint.h" + +struct flm_age_event_s { + void *context; +}; + +/* Max number of event queues */ +#define MAX_EVT_AGE_QUEUES 256 + +#define FLM_AGE_ELEM_SIZE sizeof(struct flm_age_event_s) + +int flm_age_queue_get(uint16_t caller_id, struct flm_age_event_s *obj); +unsigned int flm_age_queue_count(uint16_t caller_id); +unsigned int flm_age_queue_get_size(uint16_t caller_id); + +#endif /* _FLM_AGE_QUEUE_H_ */ diff --git a/drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.c b/drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.c index 9c401f5ec2..bcc61821ab 100644 --- a/drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.c +++ b/drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.c @@ -7,6 +7,7 @@ #include "nt_util.h" #include "hw_mod_backend.h" +#include "flm_age_queue.h" #include "flm_lrn_queue.h" #include "flow_api.h" #include "flow_api_engine.h" @@ -4399,6 +4400,55 @@ static void dump_flm_data(const uint32_t *data, FILE *file) } } +int flow_get_aged_flows_profile_inline(struct flow_eth_dev *dev, + uint16_t caller_id, + void **context, + uint32_t nb_contexts, + struct rte_flow_error *error) +{ + (void)dev; + flow_nic_set_error(ERR_SUCCESS, error); + + unsigned int queue_size = flm_age_queue_get_size(caller_id); + + if (queue_size == 0) { + error->type = RTE_FLOW_ERROR_TYPE_UNSPECIFIED; + error->message = "Aged queue size is not configured"; + return -1; + } + + unsigned int queue_count = flm_age_queue_count(caller_id); + + if (context == NULL) + return queue_count; + + if (queue_count < nb_contexts) { + error->type = RTE_FLOW_ERROR_TYPE_UNSPECIFIED; + error->message = "Aged queue size contains fewer records than the expected output"; + return -1; + } + + if (queue_size < nb_contexts) { + error->type = RTE_FLOW_ERROR_TYPE_UNSPECIFIED; + error->message = "Defined aged queue size is smaller than the expected output"; + return -1; + } + + uint32_t idx; + + for (idx = 0; idx < nb_contexts; ++idx) { + struct flm_age_event_s obj; + int ret = flm_age_queue_get(caller_id, &obj); + + if (ret != 0) + break; + + context[idx] = obj.context; + } + + return idx; +} + int flow_dev_dump_profile_inline(struct flow_eth_dev *dev, struct flow_handle *flow, uint16_t caller_id, @@ -4527,6 +4577,7 @@ static const struct profile_inline_ops ops = { .flow_destroy_locked_profile_inline = flow_destroy_locked_profile_inline, .flow_create_profile_inline = flow_create_profile_inline, .flow_destroy_profile_inline = flow_destroy_profile_inline, + .flow_get_aged_flows_profile_inline = flow_get_aged_flows_profile_inline, .flow_flush_profile_inline = flow_flush_profile_inline, .flow_nic_set_hasher_fields_inline = flow_nic_set_hasher_fields_inline, /* diff --git a/drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.h b/drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.h index b44d3a7291..e1934bc6a6 100644 --- a/drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.h +++ b/drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.h @@ -48,6 +48,12 @@ int flow_dev_dump_profile_inline(struct flow_eth_dev *dev, FILE *file, struct rte_flow_error *error); +int flow_get_aged_flows_profile_inline(struct flow_eth_dev *dev, + uint16_t caller_id, + void **context, + uint32_t nb_contexts, + struct rte_flow_error *error); + int flow_nic_set_hasher_fields_inline(struct flow_nic_dev *ndev, int hsh_idx, struct nt_eth_rss_conf rss_conf); -- 2.45.0