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 DFE1845BCC; Thu, 31 Oct 2024 00:12:06 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 803F4402B3; Thu, 31 Oct 2024 00:12:06 +0100 (CET) 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 2818040430 for ; Thu, 31 Oct 2024 00:12:05 +0100 (CET) Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05lp2109.outbound.protection.outlook.com [104.47.17.109]) by mx-outbound47-144.eu-central-1c.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 30 Oct 2024 23:12:01 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Ft5EX2knrBjCDlH+c9bprdtCCktZKaJM7PAOeF7LnMKns16PHm33z0VH7XSYdAWyXschoAy5GYIRd32ZN3YVbZ4tlxqlEtTG15rJ3jtc/1JF32oXHkqVtdK7qZto0vnpxzvwiYLnPl1liagtGbvad4km4rdRbLhintaaMB74xN5hxwY0x6/fma8K6bJmjYOGH0L8QkLUaN4RQ4qPIAFFOLsHXsfVSiPu2OgbKcc8OhChOLb8HXjzR4YLMHf26H88+8jeTIKSVyfClTvnOtAcAWKpe4/H9Sy5NQG7EImIh0mSMNdG147IYb0W1cUolZPZAhH0TpiqleOnQQnvTXetsQ== 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=2ZMF3QKqR27WqLD6bqEjtRmKNZxn6Ce/zzfG+IotDwU=; b=L4Tfb2IjZYl6n6P3D6mkmYU+YuD88ykJRjSVmeEE4P+9bIPj+ENk1OW8etc6eClfHrKhtv+uYuKZ2E5t4fi3sBjayD0VeLvFUpKP1hm2+DVOSCxFnX4yjPaET7DuRCkfKtu3XRjF/SGuzk+FULuZ3SWTWK55vWuaYu3PGmlTkOLmOcPuoj3I5D0a3MycgA/d/eamN+I+y4cgepPa6RAio3Te8nuhAqRciG2YLV2oYVWWlfOFMYIYbgLuxcQWiypw2CVB+3q/Kb3IKH76tG8XBILJPZiOjAJMiVmLJy1v6nw/Hv9s85567wNkqMOZ/HTSMFEly/ypvCbVRMPu9QyBgw== 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=2ZMF3QKqR27WqLD6bqEjtRmKNZxn6Ce/zzfG+IotDwU=; b=LkzbiJRx8wzhyGPZcY4nEkVLIjL6oT59y2VNPxqbyPzsJNWX5Q6kXvLJYxxMAMN5sN0ftpaByvoa0DMoGhhUuZRfjZUZj5ghIZXXhdfI99I3OM0LsqbS4EE3i2Z0dWQtxEJYGMn/PQM78AinYBqXJspEcmpW+nM+Qy5ImdcyNvk= Received: from DUZPR01CA0003.eurprd01.prod.exchangelabs.com (2603:10a6:10:3c3::15) by DU0P190MB2003.EURP190.PROD.OUTLOOK.COM (2603:10a6:10:3b5::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.32; Wed, 30 Oct 2024 21:40:56 +0000 Received: from DU2PEPF00028D13.eurprd03.prod.outlook.com (2603:10a6:10:3c3:cafe::c0) by DUZPR01CA0003.outlook.office365.com (2603:10a6:10:3c3::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.20 via Frontend Transport; Wed, 30 Oct 2024 21:40:56 +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:40:56 +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 v5 65/80] net/ntnic: add aging to the inline profile Date: Wed, 30 Oct 2024 22:39:12 +0100 Message-ID: <20241030213940.3470062-66-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_|DU0P190MB2003:EE_ Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: 536cabf1-98ef-48a9-6d20-08dcf92b8965 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|82310400026|36860700013|376014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?U4UFTTrxoe2ok920Brj5fxn6PisaSgprmTAqlKE8XCsWsV7ZAAQ9bKLunPTF?= =?us-ascii?Q?jUmXEqKrdy+e/Oc8vr+/4RkSEBpJQnjx0UTxFzsOJLjfuDqcvK8jKP9Arhuj?= =?us-ascii?Q?4kyf6ubvITFJeacaag1Hk1jSZPrvd+XxApEHJQgciWV0jd0x+zRjG3G7K39V?= =?us-ascii?Q?FDgDk5MV6jyfzHwN+roKg4ko2YmFixlcfbeZnXdyA8GIKI8MqPkrfhXmF6+Z?= =?us-ascii?Q?K0L+sQIqODTBjCoQa4Y2jw730Cwk52jl/+/he0WMsUNQuTlNRXNx1cwggSuV?= =?us-ascii?Q?XyvFRrod60qLaxLKyQ3CFFDpURcVAJNSUF+AEZzWzH7ugph7BW5D4IEoAGbE?= =?us-ascii?Q?cTJSlU6qdnP7z1BT1clZWF7hw59r/niDXz8D4o6xb6Kga483Z1I/QxkG+/1a?= =?us-ascii?Q?p9nPITcTfx9Am1PeR9oqufkvyoCf7xuyK47MA7/AFkmXJbid++jkG8C+wZTU?= =?us-ascii?Q?zIQisIZ3N4bg5NSxOvfkImyfZolei7Ws/ZlzqXXQfvBsvuGyKJVeOOCmEMBx?= =?us-ascii?Q?djLTFF+2fuyZ6jfOQI2tpfy7a95XtFIqT/iNfwnpTAFgpaxX2fxYGu/vMy1+?= =?us-ascii?Q?s0s7gqo1lgqVnulxmcDQOqc9oWdKUYyqA5fT/aXiR7lLHDsMCknDcCIs96xf?= =?us-ascii?Q?h/fS8jWnGDrwSlDvzecPb+d8+C4A+XztNHmC+WOJzn9bjo1f1xF0i6mTmVHz?= =?us-ascii?Q?MjC9uyjOCekqXhwntOOCJTsdbtN08ytlh+nbsXpF9meVRuCGYbzyZsWMVDuJ?= =?us-ascii?Q?JxEN78xzt6PCVJrYqowT9ujHCvq2JQB9YLJ6KvsEUTsZqD+MRK1h3/0NGZys?= =?us-ascii?Q?ggAs+8wuLYkhp5hSJ1j7T9omglf4SVVyQvBCvqpF0ms8gca7OPz4CrsXvPrc?= =?us-ascii?Q?6vUQBjgPeffQaSNYnOgxKD2ZsrHHSHuUP8LuvbwGwItf/drYuulkHf8ITTNQ?= =?us-ascii?Q?sJaYucU5WSdAjTAwaC88Nepw1c3Zi0dHYKBg7uRlJb5XBs9QHD0G9sjvqMjb?= =?us-ascii?Q?me14xSCNldWhA5Sn/4vQb4ww3MLzSTMbcgysQDUyvfJyBZP448gDQ2d6LysP?= =?us-ascii?Q?MGpkdWdtW7WgFS9ocA2WKRy0I4OpoD5Zz8ohH5b9mfnId82eTJ2O2jAiQgnD?= =?us-ascii?Q?hRUi4nEGrIpvyZXnStqCwPYUOrJ3aHLgILxbUVs+VgGXpgRadR+Ucpp7Da/7?= =?us-ascii?Q?nqnnaIN3fkXScBu1TZDYgyRI57x5+C4xl+wSB3+BBNf3AmsGLgjTlYz0+xj8?= =?us-ascii?Q?GfCssk2t4sGtotUIDqVB4J5kXELxXfnjfuNq8NKXDic5Gm2h+e95RoJoUaFm?= =?us-ascii?Q?qp7F1B39SgQZQO9Kv0h3TccRCs5HXi0JdIh6z/rQKu39GIayH6zx5iok18x9?= =?us-ascii?Q?tLIy6kgX6C+tVJR1Drc6hVGhMZBIKyfWhIezON263GaYkq0KKw=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)(82310400026)(36860700013)(376014); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: 8J5p5XGFY44qcRi8Y8PDQWewwkKfEWSXL4/qaovku+X3tbQ8zq5blZfXGqO9q+MJkKchy3fsiNccbaSal7V25KjF92KS34lHw/62nl2Gykali9Jh1D4bj6v377Nii0KxQvxBqsLT32IgEe/rTe58HME7UJd6mtbVODOdAAWpREYA2Jgj+AodiC9zcYlIGxDa1d1YJrr8jCfOre0xqBMMvzhrNsAhNSfcCgm9JQk/PPJrzBCfDSWE6+1Wnv5ew4CB2tu/ALa2v8k37xPmMpbBxBssVoZvlH69Jx4SchOjkUGD07pVAHMEJ69AXtQpWc76NHMYJLsNmG3bnD6tPfJaQRHF2/h40FZk/QhrxNZw2n8wTZN6yv+Q/zw/HlI02eFlmw1Nm96ip6EB3v/YvkztYmrJIvGDS2yMzfOLZnVnqIS9ohFf0fJpDxEhTtRfLpHztDKaTpaja0cbTYXj2Gj6G+F2QhXHsmc0ENIv7wFRTHPz6xZQiKOs7OFP0XRpnJyRYrUXOQlP43clOPkr4pAfiiqnBJSaXFnvQefGd+q3qhewLAQWea+alnBaAB/zfPjXAdQwMy0SHP/YAhY6HUtA5kIlI8oUF9hCgimKa5/51kdxVJtKXHlk4aEcP9CCP0OPz7HIP/XPCCnzxwxHzysnBEDcOBXdyGKzPbekg8EYNe4= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Oct 2024 21:40:56.0834 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 536cabf1-98ef-48a9-6d20-08dcf92b8965 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: DU0P190MB2003 X-OriginatorOrg: napatech.com X-BESS-ID: 1730329921-312176-19304-23498-1 X-BESS-VER: 2019.1_20241018.1852 X-BESS-Apparent-Source-IP: 104.47.17.109 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVmZmxhZAVgZQ0MDIwNAw1TTVxM Lc1NTE0sAyKSnVIjXZMs3Y1DI1NdVEqTYWAE8jKIxBAAAA X-BESS-Outbound-Spam-Score: 0.50 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.260092 [from cloudscan20-80.eu-central-1b.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 aging. 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 c676e20601..5fe09a43a5 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" @@ -4390,6 +4391,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, @@ -4520,6 +4570,7 @@ static const struct profile_inline_ops ops = { .flow_destroy_profile_inline = flow_destroy_profile_inline, .flow_flush_profile_inline = flow_flush_profile_inline, .flow_nic_set_hasher_fields_inline = flow_nic_set_hasher_fields_inline, + .flow_get_aged_flows_profile_inline = flow_get_aged_flows_profile_inline, /* * Stats */ 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