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 AD56D45A68; Tue, 22 Oct 2024 20:30:22 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6440440A73; Tue, 22 Oct 2024 20:30:19 +0200 (CEST) Received: from egress-ip11b.ess.de.barracuda.com (egress-ip11b.ess.de.barracuda.com [18.185.115.215]) by mails.dpdk.org (Postfix) with ESMTP id 535EB406B6 for ; Tue, 22 Oct 2024 20:30:16 +0200 (CEST) Received: from EUR03-DBA-obe.outbound.protection.outlook.com (mail-dbaeur03lp2173.outbound.protection.outlook.com [104.47.51.173]) by mx-outbound19-119.eu-central-1b.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 22 Oct 2024 18:30:15 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=mfWD0xhWKnZ4bxCmL2xu9UplkwLCJl/MTL0hfWTqkva3R80yy9i6q5VnjxeDl1MXVc1KyXEjqWtyS6dNqAV5VdRJMox1zdDV8rq2Qo4eSH26uG8mcp6MkHhxQP6vN52PR2FRaIvsyh5sg8YcnWZDe0lVUHik9aFrHvkZ7TH7P0ls81A9/dK6BX0IH3U3/v2uLbSfNvg46a+BfoNovPSu9tgo8dAVhyj+w1kcfiFkVeXWwxya29VFszhhZvn4xf0biQ/VT4YZ0DPTicchZYdocpAg/xeJr6lRwskaP6QyN6eXjaRrp4OM4cfdbHF+MlOzFKqO+zSoPwyhsP/yOy+YEQ== 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=Ucyj9XGBB7h/Bewbe2htL9K8QKV9s9dGHKrHolOLZto=; b=smITXH1Cx9BBGvuFJITsKbAB0st5tvGU6zbwM/30TQyd9YhAI1YazpeWGUSrTglHOXz2AB3IWhtB2nShwSvgwErGxBDYNE9TWu2flWmQ41Anks0HGC1sqJfn3oiCsbhXKVSGGhwVxVqxe9QT4pRkIezrXaMg3LEEtUvMHXYRNYuVYj7ZBYDpFCRje42384WRAKj45EtxG7rpHbM8VoOrbHwBFxYi6UNubNiS4Uw/GNpIrAH0gzHJ2Wf2d5N87xLKYxY7XLB8tejtU1nuOeQKWzgExHLGTYFxSTtMvzwsNOBFruR824q5rSj6ptuZ4LieBSfz1XEJwzR+xEqUGTeh1w== 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=Ucyj9XGBB7h/Bewbe2htL9K8QKV9s9dGHKrHolOLZto=; b=g/vorYZKAUoRetXLAe5MYpcDee2G01Rl7nhUYbkTeFtbgPSgSYag/Bxi18ZyfhF5Gg7Pptog9O4YiED4jC/zQ6MEisRe92N7mnR94//ulsA51EWykPDoO6k2dZpdhRr0cVHSxK6dPKI65onelX/EYT9Iedi3v8qekaijrZa8ZPk= Received: from DB9PR06CA0011.eurprd06.prod.outlook.com (2603:10a6:10:1db::16) by AS8P190MB1912.EURP190.PROD.OUTLOOK.COM (2603:10a6:20b:508::22) 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:57:15 +0000 Received: from DU2PEPF0001E9C2.eurprd03.prod.outlook.com (2603:10a6:10:1db:cafe::95) by DB9PR06CA0011.outlook.office365.com (2603:10a6:10:1db::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.16 via Frontend Transport; Tue, 22 Oct 2024 16:57:15 +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:57:14 +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, Danylo Vodopianov Subject: [PATCH v2 66/73] net/ntnic: add aged API to the inline profile Date: Tue, 22 Oct 2024 18:55:23 +0200 Message-ID: <20241022165541.3186140-67-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_|AS8P190MB1912:EE_ Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: 1f32ad40-b095-4686-10f4-08dcf2ba9498 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|36860700013|1800799024|82310400026; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?ml8x0xOzvA91QHQo9VQIWolSqChJG2WXFpvAlsaphzygiA4cDnf9LRvu2sfQ?= =?us-ascii?Q?Cr+gbI1F/nY1vsm4+yCa+XQKtBm+BaNvbHraJEltvvMoRutdeU74sqzjDIki?= =?us-ascii?Q?NGmwiEZ219R+9ags3GBFSMp4GXGvORPpFHm4rPd2T5oV8RlpOE6VBOz/Libs?= =?us-ascii?Q?RwDOuvSiCGUhaP0SJFUnUi+1PyMP9SUnSMtgwtMq1vM5gFE1e3sAPKb3175u?= =?us-ascii?Q?95vpOKzyPxeOZI7rcfPGhhxoXUMFVHVfl0RYY71Xfe5yrWbqtFAR7GpPmK72?= =?us-ascii?Q?u08lnsDQuUX9t3AwrGkhiZmYk6185HqYFS7Kdb6n4or8kcjjxBCofoxOQKWK?= =?us-ascii?Q?2tHfQ2gQ0Gfy8eMl1gVtLoV3StTh7Ii2jROYa4fXyPSdCZt57O6xARq6lUs1?= =?us-ascii?Q?hntMgHm/t2uTSCB3lfhSRUpzdarhXUyqNy2yb6H6CyEAI6roPkpidMR3S3ex?= =?us-ascii?Q?M6Csa4jt98d00WjwwnQbjQluR959KE0idogtjs9BkYk98613XEKqhNqiio80?= =?us-ascii?Q?tIwV0iapelnJnV8D3JSOPsVjo8gZEAwNtVNuBDbX04iPs6QdHKpAYGt8TH1r?= =?us-ascii?Q?8kDqQ8t9HLaBrQnFOeu3uI4gXsjDnK3aPZp5mnp53P6y9HlljceiSis2yd+W?= =?us-ascii?Q?av9+XXTCFKJaEibbllBsVsU5c0mK+4Oiig/YYmBZ+biYb/tV3PzcXmKZYLAX?= =?us-ascii?Q?2GsOO12JH34bkRtAK/ic60w2Lj5Mzv8B1FIezYxi5mOxJIitZFd5pDZYm9+8?= =?us-ascii?Q?kj8d8ztXpSsVxSRFvHEbapUnHf4omhVRI3HPinPJD7q6fK7mZ960XHG/zXNe?= =?us-ascii?Q?Sfmy+OXKVvsmIqG57drp66XQeUFjXPdwaANwXq2Olv0cnJw3OLjO2w/6WZBM?= =?us-ascii?Q?1vA1KiE1XlzmOH7/43nCPXiCNq6DX4h9zdEae5rc/ZQV4T2oXe3TvEjuOYkD?= =?us-ascii?Q?aTkGQvW0vzjS/WpnDDUO0Of6D3iTALarzL1Qnh5MZ0t4Dr2rQyW2qOPhmZzL?= =?us-ascii?Q?hL5LQzaAhTn1kKaw+k9ogrNDYd7rBNVwAfGNs+WQ1CThBw2gAOC1Yc3XjQ0I?= =?us-ascii?Q?Bs8LLZDwBvDe69qQjD6L+8sOls0E5itRewu7cXVazRF8W/msmtK8JGLA5HEo?= =?us-ascii?Q?IckzSNpW+/NUI2cAbKs3blIJz3ove3/Cz1K/4eXMUHjrDi5GBNSBNJpndCiC?= =?us-ascii?Q?+WE42YGVd6rzu7ElAPDBmUYtgWAaBKGes2H5GqflWJrN1UFm1igPViLZj8N9?= =?us-ascii?Q?riLsKM3+ujbLGcq94KyjT++/VCQQSELJBMCCWddMF/SygOZ6qZ2HdGeh3fBU?= =?us-ascii?Q?YPZ+6656lMIZYGbKERuXSztP0O6WfJIL9eM0UgAIlu9wDWcabyORm1aVssb4?= =?us-ascii?Q?BEnnQzADtyriRsKhl+eyqeu+O/dIhugeaD+bTxB56pCe7jv4lg=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)(1800799024)(82310400026); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: UTKoBXcvw8QeD+OfMpILts2ZAO9u8iwGPGJ3+yROQbkZ12qloIN6gZER2JsmBhkRGW200y4T2UE73aciLWNN3Ud39gQXzIEiSALEcoybXB+1B+nVHDG30wim34sbPFjA67pZQe4Re6QCp6RURdsowcSiVsfjma6wetMzG6biM34s5TUOa1iwscggJk1Ktg5srTL56wbhUikAhpLfYfS4QxlQLk6Nf7CbIpFMr8QMnKLpuSP4eoCyJzCHnaKjdfcTGBOewLX7RvoKjZ//WW0EHRnBz37rDJM2d5iAnJztV2lrBR2vLp+xczkoZtI1lLoyiT80HnCyh0HochWfYXfwRdBw7buGLCB7jNBsKhlvXSpPF+rTb0qPx00YTVrMZgrENiuEWS7LPEzv12hUmZV09uOl4k2NFIOGNZq5GHaId1Ob2w5ur0WZ2IV8qNIOROmI95QM/IiZOQ1E+cafoJ/p7uZagnl3pKPI/YGUakzdLwPoCx89Lcqmfov6+ZSOllvRFejxzkBEpr+2OmODb0qC7u38u0jO0sTQ8sBREBN8pNwcBdQEmgQwhtPezO8xIY6Xgqzz+NbzCgBKsceegQLEAZnmcQ10kRilNnIG4Sr1g74MgaUlZ8Rk1mKuY9cPbqrGcS4W3N9ZA7XQDoC1uvhzImp/dvqhFLJfzo9UVrKXOY8= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Oct 2024 16:57:14.7631 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1f32ad40-b095-4686-10f4-08dcf2ba9498 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: AS8P190MB1912 X-OriginatorOrg: napatech.com X-BESS-ID: 1729621815-304983-12653-18903-1 X-BESS-VER: 2019.1_20241018.1852 X-BESS-Apparent-Source-IP: 104.47.51.173 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVmbmZgZAVgZQ0NDELNk8MTnRPD nJMNkoLTHF1MzM0tAkMTHZwjjVMs1MqTYWAMNluadBAAAA X-BESS-Outbound-Spam-Score: 0.50 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.259903 [from cloudscan10-0.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 a1cba7f4c7..f0a8956b04 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" @@ -4395,6 +4396,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, @@ -4523,6 +4573,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