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 585EE45BB5; Wed, 23 Oct 2024 20:34:29 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C86C142FB2; Wed, 23 Oct 2024 20:34:25 +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 5EA9842ECD for ; Wed, 23 Oct 2024 20:34:21 +0200 (CEST) Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05lp2177.outbound.protection.outlook.com [104.47.17.177]) by mx-outbound15-83.eu-central-1a.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 23 Oct 2024 18:34:20 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=H3svb/VEnPoRwquZnvZI1KjtZz8lAaehca+fn1w6C0b4v7CEHtc77G5T/zi2QExcxeoa2N0IpjTvT6hCSjKq48mYjphJA4YVJyJnAYfHze0W1nROXU/KsO2SowJtyzuG4CIdf8YNhl4R7To0j6WX4hF+CGfCLvO8+LJjiQCc9x/2Yj9WLs59zT/UmJ3D3tvgeEwB7laxUr7jyKox1FYlEyP4v7o/c9f+QvYG9a/OvntFIax1lpBMRCc25AzC1d76xEI/EnlL7lA/j5hJm1KIkAuy+8PYIITGb1uPe95nnyX0S8ci8iwwhR4/JjwuEX3Jv/FK/yIMgR5UO+fqR2Ep6A== 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=01HAOGYReEmELScAESe7Pim+EhVw2o5DeuodE6SsmoY=; b=Ap6kpWeFoIaWdq9xdsLEwriJ+F15KkRzdbZwRX//ZgT51omhraUX6OiyrPlsrjVMS5Wd/77hXISxQeueRxke4deMI9LrW+e5MQ3n/Qgbkm0rjoj3rVMIsUn76q8UbfztFHOUUtsd8Yp/vTFukCbuTCR6zSKttgyo8d8yPP5af20as4kbk0/XFwAi+4ObBg27teq8UXNcWkNg9qcfTqabF60SgBUPMLKfGAJDX28IbBJRGzNtNl4zAzf7ZK6Lo9fgAbVKoK5Dv4G3n+mjS6i1PpnJ2EOGfrDoTTAwYI5kr8xlZynywvngUsWWJS7QQNjb/q1cLLRe3xY8ckPai2x7zA== 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=01HAOGYReEmELScAESe7Pim+EhVw2o5DeuodE6SsmoY=; b=ljTSpVUgc2onmyxBDSlVTs5iTEDpeANeUexqwfOIUF5DngT/h2cVGxoCDo6+2LgVUFecTMyWI1+lQ96goSDWA1RuGTdteCE223JQztRNucwExQAoPgP54/TO5S141IlrdhK7DyHuUVnlXg6fl3k0iYAdX+S0F0MNSlks35WAqPc= Received: from DU7PR01CA0022.eurprd01.prod.exchangelabs.com (2603:10a6:10:50f::10) by PAXP190MB1765.EURP190.PROD.OUTLOOK.COM (2603:10a6:102:276::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.27; Wed, 23 Oct 2024 17:01:43 +0000 Received: from DB5PEPF00014B9E.eurprd02.prod.outlook.com (2603:10a6:10:50f:cafe::1c) by DU7PR01CA0022.outlook.office365.com (2603:10a6:10:50f::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.16 via Frontend Transport; Wed, 23 Oct 2024 17:01:43 +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 DB5PEPF00014B9E.mail.protection.outlook.com (10.167.8.171) with Microsoft SMTP Server id 15.20.8093.14 via Frontend Transport; Wed, 23 Oct 2024 17:01:42 +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 v3 66/73] net/ntnic: add aging API to the inline profile Date: Wed, 23 Oct 2024 19:00:14 +0200 Message-ID: <20241023170032.314155-67-sil-plv@napatech.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20241023170032.314155-1-sil-plv@napatech.com> References: <20241021210527.2075431-1-sil-plv@napatech.com> <20241023170032.314155-1-sil-plv@napatech.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DB5PEPF00014B9E:EE_|PAXP190MB1765:EE_ Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: 595887ea-74dc-482a-dfb2-08dcf3845ed8 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-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NEHgY0sP46i0LidZLX6DBCg9wxQs4/kyEPHZ6dkFBcGCs?= =?us-ascii?Q?odYSxMTRP1NaHy+3+2bOgwQtOcJxBt8VhUV13wSCh6yxPykb3QVndQ9z/4wT?= =?us-ascii?Q?MPBRETcWZhdU4tB0J7ADEhff034y7XLi43rDgS3id7gtgrR8PB3ufvvzWX2E?= =?us-ascii?Q?E6KhV6xxY5sCNn8FskMWHUApwp1YZWGL4+AKtYUKtnAJN5JmGTbeGU47/QES?= =?us-ascii?Q?82LNFNJ8gLROe/TnewouAwNZ7S59BnqMpyM2rW8DqJB29FTxtGBMHsbw2Ohf?= =?us-ascii?Q?GxopZEbR51vq2Byu5Gegiq2jHrEEVQwDsh4dePfsiyM1+q4kYGFqZ941C4/v?= =?us-ascii?Q?OJhiHaO19cJnZ9wMFjrCr7Z5K87Ab76PhFv8HJBtkpX/FwBTZ2hQqp+C/LdV?= =?us-ascii?Q?2d/o57pvmuv7iTjmCeXyKRUvpucgkFNU81PGYmh+uDr4fws5jZiaX8eWUPv5?= =?us-ascii?Q?r2i3SpzohN56zs7SRQdwORDPqZzJRzQTUe2tr+OeThwJzcO5sOvzWhUHUUXr?= =?us-ascii?Q?8ZdXLgcJqESRki2pYSLxpVqeptkC98+mq25zkS1SZrxqJx1TwA=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: N9EsEFnmuJWjGp7klTmd7K1Lb6BQCH+xkvwyBDloACYl9n+M31Thm26livoh0Z0949BwUxdSbWJx+B6LU3dO3pF/iMy6VeqZXCW+pzUuwodZxO3OW+t0sr0K5XEiNSz5vHV7SjMuuW7Skzdy+Rk8lElJ4FNS2ZiWO4EBpnAlNbZ+GFnZrLmo1nzDS7p739Mb/xIpfJCR3KWZhYSpmsS69rbrlBUzZHjLx/d2fkPbOV+yJyM+KWW7mXwJ4JkIf3ynNoBuOSz1xSb+K8PdeTHcZJcZ2JPeBdr4QKDnIwd1D2X3R5Hrqyo6+fzdNKwjHabNeSPDKq/j1Y8SBKXLIi9ZeVQnk5u89pyACNTimMZroj6bjKupdwt7BQy7HI3tbqmdfwaxx09VKlMzzZC9kY5fs0YL9q+mWcAWPfICA7jiBB8nBvsa+JxAqMsgu6G+/SC3u6ivRbcy+gx5tvdhc3//loyHA4q/uTQvKQery0LvLVsRNy8jbTB6GMpon/V66Yi9o2mYX46XDAo1zoaFQ31g5isKFJSKuJgZ7YqCGQC1IUyYm2LVDlwhj9tLtHthW13jUC+PPaxsNHnRkK3bd/C7mWRWwj6FC1Z2PXVFr9q5KXWP8sSmM02KuciRR/bei0EQycPDsSbWU62EuIY+uWY1SPH9ri7B2YBL56gpW2gPM5I= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Oct 2024 17:01:42.9303 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 595887ea-74dc-482a-dfb2-08dcf3845ed8 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: DB5PEPF00014B9E.eurprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXP190MB1765 X-OriginatorOrg: napatech.com X-BESS-ID: 1729708460-303923-12645-48112-1 X-BESS-VER: 2019.1_20241018.1852 X-BESS-Apparent-Source-IP: 104.47.17.177 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVmZmJkZAVgZQ0MQwzcggBQiMLZ OMzSxNk8xT0gyNE00szM2SgNhAqTYWAGTM0pNBAAAA X-BESS-Outbound-Spam-Score: 0.50 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.259926 [from cloudscan15-130.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 aging 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..9e1ea2a166 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, @@ -4525,6 +4575,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