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 C0A5545BC0; Tue, 29 Oct 2024 18:19:11 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id EBDAE432E4; Tue, 29 Oct 2024 18:17:38 +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 ECFE743293 for ; Tue, 29 Oct 2024 18:17:28 +0100 (CET) Received: from EUR02-DB5-obe.outbound.protection.outlook.com (mail-db5eur02lp2112.outbound.protection.outlook.com [104.47.11.112]) by mx-outbound17-86.eu-central-1b.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 29 Oct 2024 17:17:25 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=kcH4Tl1bQKNWyiwh5pxYb/ivTCnHqbAN9QQXVVUx+/66y5T7CIBDZAMEnd3U+jaNVo/PCH7KKa+VYE97VCCqAtQ7yMcosVypw1NjQULEohgORdK7PmpBiq7JSemt/O2SxINQl/m+ADkV8vEzfIDb8T6q7uWKkgzOyIZgh9hJuoIFb8/Tl0smrABR4OMa5u9QUgHYWMAuZWaStz4rR3fwpl+z7NR5tZIA4sbyUJfQxMaY7XRYYl7OuWN9JJgZuaNLWAYUIsb2L9ZH6h1QdHTzT3ti02Bj/ppukPOMvYxx4e0GlBMzgN53OCRPjdRQGv7GBjhmXMbael/Hc9cBO+saBg== 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=au2sPZbeywE90qCx7AdYfRXZXNaLrinwVWlahQ7w22Q=; b=HchDjGmHzpQphNi70kaGcQFbp6MS74SAFrrxHvQIK8kMW5SsgIV/Vwqxk2/XY4GghyENAJFcFRR/UY89ym7oMt2IFVLTGUDTn0wf0F+YYECGWJxzqU7bdMkRjKYlUJGurJuSIcH0bV3VwItqTKxQOGt64WaOxBmNlHEBdpgCDbVeEz9d7IyBHhlCBQhaIoflUj6M9k6ORah4wQjtlk2Lf6JLVU03cJKTwYyssi4VYAS/i4BwHTg+d4Z7BV/sHrnZb5+a7iMOm4ytRpAarZEpwYdihofJVkAOOGRopGb7K2wdVOfK2jD6YlebDhMlmtj471qWuUi62rZpThTny1HaNA== 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=au2sPZbeywE90qCx7AdYfRXZXNaLrinwVWlahQ7w22Q=; b=R5WK23ZIb6gXGRGwExDYiksuAdP7xx/aFHytTY3kCKBggQBp7rJZ6PGAeI24abp3Ht4S1SdWCnDntKciDrUvMGixkE57oiW/u7K3ocei3vuKO09js3eD2tGmHweEk7SdNeIw4ZTzD7sDwnghTEMnD4eu4lmKD6tXdme+KGFBPAo= Received: from DUZPR01CA0199.eurprd01.prod.exchangelabs.com (2603:10a6:10:4b6::28) by DBAP190MB0935.EURP190.PROD.OUTLOOK.COM (2603:10a6:10:1a1::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.20; Tue, 29 Oct 2024 16:43:59 +0000 Received: from DU2PEPF00028D06.eurprd03.prod.outlook.com (2603:10a6:10:4b6:cafe::49) by DUZPR01CA0199.outlook.office365.com (2603:10a6:10:4b6::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.29 via Frontend Transport; Tue, 29 Oct 2024 16:43:59 +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 DU2PEPF00028D06.mail.protection.outlook.com (10.167.242.166) with Microsoft SMTP Server id 15.20.8114.16 via Frontend Transport; Tue, 29 Oct 2024 16:43:59 +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 v4 67/86] net/ntnic: add flow info and flow configure APIs Date: Tue, 29 Oct 2024 17:42:11 +0100 Message-ID: <20241029164243.1648775-68-sil-plv@napatech.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20241029164243.1648775-1-sil-plv@napatech.com> References: <20241021210527.2075431-1-sil-plv@napatech.com> <20241029164243.1648775-1-sil-plv@napatech.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU2PEPF00028D06:EE_|DBAP190MB0935:EE_ Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: df36af27-e8df-481c-52b8-08dcf838e360 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|376014|36860700013|82310400026; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?O3xg9v+COKwejxavNJh7NRnpoJsg47fEjRE5dPT4CDG1ITQ3hFXC0RYShTLR?= =?us-ascii?Q?mMmAfo4xiXxL2SWFsinE4Yjs3lN1JfDYG7zaihoXq44eOPjO0rQLJIHXm8A2?= =?us-ascii?Q?P196n42BuI2zJUzdo0/gXAQUL5TzAyp1rZv2NBhNbWop9GwIDEhEaCLJen0y?= =?us-ascii?Q?OkzZNdXbmtmYlGWtP74dkdSu8aSBRfaFtT+zz3zUql8gMqW/6kHi11eO76j/?= =?us-ascii?Q?Bc0kHuq3F9W6bc/PJuIcNzbc0oGFrGFl2lO0qpTy1n+bt4weY4r9fPZg4Wi0?= =?us-ascii?Q?InW/i2n5/qztQm6lsRaHiov9WHl6QpJTjXIpQK3kUGrgkew8BqtJo3LtWhOj?= =?us-ascii?Q?8m+ch0N8x5Bn7COmjnIvrOuIuN8DFVxm3yjIWeqBSLkhT9IRegyWvrQGzo9S?= =?us-ascii?Q?lQO9Wn26XsVhEiKI6P3JXEkLQJrCTAP18zGvvY5hadIxh6Mm/eI9JkIMHLhQ?= =?us-ascii?Q?EFOU/bQ0x/sjcc27J5c1NPuakdUVvfhoYbVbCOrccwUJWXSao3I3mtU4voIs?= =?us-ascii?Q?AvFWX/kasIScqxIVfaXFe/VkrpT98qNLsDTW3J2aRxj8+UYMTv+R6oAGlLEk?= =?us-ascii?Q?Nfs7qOnfIM98/HcHGsM9eLX17oHRM7rZmXztgGcUIWe6oYKHs3Zj58SbCWtV?= =?us-ascii?Q?3a9boRsRbqcS3yLclcMf42I+MH8JImYhLkWSSFFJhRtQuOAd/l51swpWvlBK?= =?us-ascii?Q?DPJBR9JBtTB0/oqSFRHzol33jBEc8qzku4PLHEE7dBwRP9Ff3NPEIBAsLt7r?= =?us-ascii?Q?86ugahsppzKcZB5XNbtS6crz3P5tp8ePgyXMBMxY5WVHf/OD74raCRI7eJ2D?= =?us-ascii?Q?uUVShXV3pB1p6Y+BYGA6JOvn/tmeHlDhycLB8Hti/t/bjegXtPhPDbR1M13F?= =?us-ascii?Q?rGXMgEqbzG+YYhevu20LQlPNl22p0aPuD108kuhUf6fRMFliaHYalVIWEvfi?= =?us-ascii?Q?dcqOYd/l2fgu3XIMzHRqfDH69lJdRZw+PtrQvolT2QIMguoRgXQDNcNzIxTj?= =?us-ascii?Q?QJzY074iTfEaEwPfonhmBkB/bsz+cfoZp8MnFamlZayK7ONJn38w1QDEX5uS?= =?us-ascii?Q?L/mdjzogh6YukSGP654QKTg00RO/2u+0VmoBeQo9m/5rJjKF6yIW3tqGSLjV?= =?us-ascii?Q?Te1a9MIGo34Nt0TGCDWL2F1MPBFMOOBXw1dM5eTTU/DR6ub4qd4RoeHB8aFD?= =?us-ascii?Q?DPATkXEilFirDVhhcLFmjKg5jWNYuj8kB9v4//HJut4EUv5puxy7ATH44pM+?= =?us-ascii?Q?ZKqKMxlFYx3AHL9NeDanslF4xCjc72MHbyTcAq3onORTI494hKAQeeTMsaDK?= =?us-ascii?Q?QGWNlLzBGMu1TYGyspII1c18upwxq8Qa9uuTMN3qVDZU6Ke/X9fLU8uWJHIB?= =?us-ascii?Q?XvHjiGEwomxsBT/ZZY9IL1yhZjmGd7OHnVJK9R1iNICQDlvp3Q=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)(376014)(36860700013)(82310400026); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: yvO+d6y285Qmpgpo3habtNrvHIAAlmvdTbeJut4a42IFEfSRKkQOYZ8fopNfe7Es3qNFwZb4ZTZcqt2vhWj2dJNliU/P8obGNTH57LYlgDMzP7SD+K1EME8aFXSJQ5WfMmarZ6nfcoFQrxoJH9Z1xTDH83g/axuqNv4OkxciBd4MJSh/63m0K/XjxovzRxrIvwlOgAbrX97Hfr7C8li6n3XnxxBrM9VdKalWut2w2fWbP/3gET3p84Zx2uX3EQUcsBFJLIUstPSWs1MOADnFMKlSLmkENKNCkOEBS1pBmP0aRZm9TvvJ9KDIUP8OW23KbGyYUH2AR2xfLgNsSRiEGjOgWGWx80sZ42OaS+xjAjrAcsu2xew2I/qscv9xov5+flUkqpLjDvDPgCKC8Ew0sOJ0Fj3R/tKTOEQaghhoMT93Q4VyE8NB0SmLNjXiIs+Gmss8c7QqKYKsJX+EJfXDiDTIFjAznDo+mCAhVp6OuoL/RagbMzHqsUcUpSPMKmZBT0w/WDs6eIpuTswqXwW0Ij/ZBgccC71ufKhzKRNS0reqZeLdIFC240TizgsUEPHuF0seigXNT3xRdUiCkaY65f2o8uKlPyzWv+po+nHIvKG1EHSoqbr8u6p/zRPX2/WwKWiFFD2gX/JXJdY2nHyzm6Tn4FRNCYZVTdqb6np9p5E= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Oct 2024 16:43:59.3396 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: df36af27-e8df-481c-52b8-08dcf838e360 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: DU2PEPF00028D06.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBAP190MB0935 X-OriginatorOrg: napatech.com X-BESS-ID: 1730222245-304438-12707-32045-1 X-BESS-VER: 2019.1_20241018.1852 X-BESS-Apparent-Source-IP: 104.47.11.112 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVoaGpiYWQGYGUNTYxNLS3DQpxT QtxTLR1DglxcjANNHC2DwxzSjR1MQwTak2FgDKoQB4QgAAAA== X-BESS-Outbound-Spam-Score: 0.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.260064 [from cloudscan14-53.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 From: Danylo Vodopianov Inline profile was extended with flow info and create APIS. Module which operate with age queue was extended with create and free operations. Signed-off-by: Danylo Vodopianov --- drivers/net/ntnic/include/flow_api.h | 3 + drivers/net/ntnic/include/flow_api_engine.h | 1 + drivers/net/ntnic/nthw/flow_api/flow_api.c | 19 +---- .../flow_api/profile_inline/flm_age_queue.c | 77 +++++++++++++++++++ .../flow_api/profile_inline/flm_age_queue.h | 5 ++ .../profile_inline/flow_api_profile_inline.c | 62 ++++++++++++++- .../profile_inline/flow_api_profile_inline.h | 9 +++ drivers/net/ntnic/ntnic_mod_reg.h | 9 +++ 8 files changed, 169 insertions(+), 16 deletions(-) diff --git a/drivers/net/ntnic/include/flow_api.h b/drivers/net/ntnic/include/flow_api.h index ed96f77bc0..89f071d982 100644 --- a/drivers/net/ntnic/include/flow_api.h +++ b/drivers/net/ntnic/include/flow_api.h @@ -77,6 +77,9 @@ struct flow_eth_dev { /* QSL_HSH index if RSS needed QSL v6+ */ int rss_target_id; + /* The size of buffer for aged out flow list */ + uint32_t nb_aging_objects; + struct flow_eth_dev *next; }; diff --git a/drivers/net/ntnic/include/flow_api_engine.h b/drivers/net/ntnic/include/flow_api_engine.h index 155a9e1fd6..604a896717 100644 --- a/drivers/net/ntnic/include/flow_api_engine.h +++ b/drivers/net/ntnic/include/flow_api_engine.h @@ -320,6 +320,7 @@ struct flow_handle { uint32_t flm_teid; uint8_t flm_rqi; uint8_t flm_qfi; + uint8_t flm_scrub_prof; }; }; }; diff --git a/drivers/net/ntnic/nthw/flow_api/flow_api.c b/drivers/net/ntnic/nthw/flow_api/flow_api.c index b101a9462e..5349dc84ab 100644 --- a/drivers/net/ntnic/nthw/flow_api/flow_api.c +++ b/drivers/net/ntnic/nthw/flow_api/flow_api.c @@ -1075,12 +1075,6 @@ static int flow_info_get(struct flow_eth_dev *dev, uint8_t caller_id, struct rte_flow_port_info *port_info, struct rte_flow_queue_info *queue_info, struct rte_flow_error *error) { - (void)dev; - (void)caller_id; - (void)port_info; - (void)queue_info; - (void)error; - const struct profile_inline_ops *profile_inline_ops = get_profile_inline_ops(); if (profile_inline_ops == NULL) { @@ -1088,20 +1082,14 @@ static int flow_info_get(struct flow_eth_dev *dev, uint8_t caller_id, return -1; } - return 0; + return profile_inline_ops->flow_info_get_profile_inline(dev, caller_id, port_info, + queue_info, error); } static int flow_configure(struct flow_eth_dev *dev, uint8_t caller_id, const struct rte_flow_port_attr *port_attr, uint16_t nb_queue, const struct rte_flow_queue_attr *queue_attr[], struct rte_flow_error *error) { - (void)dev; - (void)caller_id; - (void)port_attr; - (void)queue_attr; - (void)nb_queue; - (void)error; - const struct profile_inline_ops *profile_inline_ops = get_profile_inline_ops(); if (profile_inline_ops == NULL) { @@ -1109,7 +1097,8 @@ static int flow_configure(struct flow_eth_dev *dev, uint8_t caller_id, return -1; } - return 0; + return profile_inline_ops->flow_configure_profile_inline(dev, caller_id, port_attr, + nb_queue, queue_attr, error); } int flow_get_flm_stats(struct flow_nic_dev *ndev, uint64_t *data, uint64_t size) 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 index f6f04009fe..fbc947ee1d 100644 --- 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 @@ -4,12 +4,89 @@ */ #include +#include #include "ntlog.h" #include "flm_age_queue.h" /* Queues for flm aged events */ static struct rte_ring *age_queue[MAX_EVT_AGE_QUEUES]; +static RTE_ATOMIC(uint16_t) age_event[MAX_EVT_AGE_PORTS]; + +void flm_age_queue_free(uint8_t port, uint16_t caller_id) +{ + struct rte_ring *q = NULL; + + if (port < MAX_EVT_AGE_PORTS) + rte_atomic_store_explicit(&age_event[port], 0, rte_memory_order_seq_cst); + + if (caller_id < MAX_EVT_AGE_QUEUES && age_queue[caller_id] != NULL) { + q = age_queue[caller_id]; + age_queue[caller_id] = NULL; + } + + if (q != NULL) + rte_ring_free(q); +} + +struct rte_ring *flm_age_queue_create(uint8_t port, uint16_t caller_id, unsigned int count) +{ + char name[20]; + struct rte_ring *q = NULL; + + if (rte_is_power_of_2(count) == false || count > RTE_RING_SZ_MASK) { + NT_LOG(WRN, + FILTER, + "FLM aged event queue number of elements (%u) is invalid, must be power of 2, and not exceed %u", + count, + RTE_RING_SZ_MASK); + return NULL; + } + + if (port >= MAX_EVT_AGE_PORTS) { + NT_LOG(WRN, + FILTER, + "FLM aged event queue cannot be created for port %u. Max supported port is %u", + port, + MAX_EVT_AGE_PORTS - 1); + return NULL; + } + + rte_atomic_store_explicit(&age_event[port], 0, rte_memory_order_seq_cst); + + if (caller_id >= MAX_EVT_AGE_QUEUES) { + NT_LOG(WRN, + FILTER, + "FLM aged event queue cannot be created for caller_id %u. Max supported caller_id is %u", + caller_id, + MAX_EVT_AGE_QUEUES - 1); + return NULL; + } + + if (age_queue[caller_id] != NULL) { + NT_LOG(DBG, FILTER, "FLM aged event queue %u already created", caller_id); + return age_queue[caller_id]; + } + + snprintf(name, 20, "AGE_EVENT%u", caller_id); + q = rte_ring_create_elem(name, + FLM_AGE_ELEM_SIZE, + count, + SOCKET_ID_ANY, + RING_F_SP_ENQ | RING_F_SC_DEQ); + + if (q == NULL) { + NT_LOG(WRN, + FILTER, + "FLM aged event queue cannot be created due to error %02X", + rte_errno); + return NULL; + } + + age_queue[caller_id] = q; + + return q; +} int flm_age_queue_get(uint16_t caller_id, struct flm_age_event_s *obj) { 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 index d61609cc01..9ff6ef6de0 100644 --- 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 @@ -15,8 +15,13 @@ struct flm_age_event_s { /* Max number of event queues */ #define MAX_EVT_AGE_QUEUES 256 +/* Max number of event ports */ +#define MAX_EVT_AGE_PORTS 128 + #define FLM_AGE_ELEM_SIZE sizeof(struct flm_age_event_s) +void flm_age_queue_free(uint8_t port, uint16_t caller_id); +struct rte_ring *flm_age_queue_create(uint8_t port, uint16_t caller_id, unsigned int count); 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); 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 cdec414144..1824c931fe 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 @@ -490,7 +490,7 @@ static int flm_flow_programming(struct flow_handle *fh, uint32_t flm_op) learn_record->ft = fh->flm_ft; learn_record->kid = fh->flm_kid; learn_record->eor = 1; - learn_record->scrub_prof = 0; + learn_record->scrub_prof = fh->flm_scrub_prof; flm_lrn_queue_release_write_buffer(flm_lrn_queue_arr); return 0; @@ -2438,6 +2438,7 @@ static void copy_fd_to_fh_flm(struct flow_handle *fh, const struct nic_flow_def fh->flm_rpl_ext_ptr = rpl_ext_ptr; fh->flm_prio = (uint8_t)priority; fh->flm_ft = (uint8_t)flm_ft; + fh->flm_scrub_prof = (uint8_t)flm_scrub; for (unsigned int i = 0; i < fd->modify_field_count; ++i) { switch (fd->modify_field[i].select) { @@ -4558,6 +4559,63 @@ int flow_get_flm_stats_profile_inline(struct flow_nic_dev *ndev, uint64_t *data, return 0; } +int flow_info_get_profile_inline(struct flow_eth_dev *dev, uint8_t caller_id, + struct rte_flow_port_info *port_info, + struct rte_flow_queue_info *queue_info, struct rte_flow_error *error) +{ + (void)queue_info; + (void)caller_id; + int res = 0; + + flow_nic_set_error(ERR_SUCCESS, error); + memset(port_info, 0, sizeof(struct rte_flow_port_info)); + + port_info->max_nb_aging_objects = dev->nb_aging_objects; + + return res; +} + +int flow_configure_profile_inline(struct flow_eth_dev *dev, uint8_t caller_id, + const struct rte_flow_port_attr *port_attr, uint16_t nb_queue, + const struct rte_flow_queue_attr *queue_attr[], + struct rte_flow_error *error) +{ + (void)nb_queue; + (void)queue_attr; + int res = 0; + + flow_nic_set_error(ERR_SUCCESS, error); + + if (port_attr->nb_aging_objects > 0) { + if (dev->nb_aging_objects > 0) { + flm_age_queue_free(dev->port_id, caller_id); + dev->nb_aging_objects = 0; + } + + struct rte_ring *age_queue = + flm_age_queue_create(dev->port_id, caller_id, port_attr->nb_aging_objects); + + if (age_queue == NULL) { + error->message = "Failed to allocate aging objects"; + goto error_out; + } + + dev->nb_aging_objects = port_attr->nb_aging_objects; + } + + return res; + +error_out: + error->type = RTE_FLOW_ERROR_TYPE_UNSPECIFIED; + + if (port_attr->nb_aging_objects > 0) { + flm_age_queue_free(dev->port_id, caller_id); + dev->nb_aging_objects = 0; + } + + return -1; +} + static const struct profile_inline_ops ops = { /* * Management @@ -4579,6 +4637,8 @@ static const struct profile_inline_ops ops = { * Stats */ .flow_get_flm_stats_profile_inline = flow_get_flm_stats_profile_inline, + .flow_info_get_profile_inline = flow_info_get_profile_inline, + .flow_configure_profile_inline = flow_configure_profile_inline, /* * NT Flow FLM Meter API */ 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 e1934bc6a6..ea1d9c31b2 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 @@ -64,4 +64,13 @@ int flow_nic_set_hasher_fields_inline(struct flow_nic_dev *ndev, int flow_get_flm_stats_profile_inline(struct flow_nic_dev *ndev, uint64_t *data, uint64_t size); +int flow_info_get_profile_inline(struct flow_eth_dev *dev, uint8_t caller_id, + struct rte_flow_port_info *port_info, + struct rte_flow_queue_info *queue_info, struct rte_flow_error *error); + +int flow_configure_profile_inline(struct flow_eth_dev *dev, uint8_t caller_id, + const struct rte_flow_port_attr *port_attr, uint16_t nb_queue, + const struct rte_flow_queue_attr *queue_attr[], + struct rte_flow_error *error); + #endif /* _FLOW_API_PROFILE_INLINE_H_ */ diff --git a/drivers/net/ntnic/ntnic_mod_reg.h b/drivers/net/ntnic/ntnic_mod_reg.h index 52f197e873..15da911ca7 100644 --- a/drivers/net/ntnic/ntnic_mod_reg.h +++ b/drivers/net/ntnic/ntnic_mod_reg.h @@ -309,6 +309,15 @@ struct profile_inline_ops { void (*flm_setup_queues)(void); void (*flm_free_queues)(void); uint32_t (*flm_update)(struct flow_eth_dev *dev); + + int (*flow_info_get_profile_inline)(struct flow_eth_dev *dev, uint8_t caller_id, + struct rte_flow_port_info *port_info, struct rte_flow_queue_info *queue_info, + struct rte_flow_error *error); + + int (*flow_configure_profile_inline)(struct flow_eth_dev *dev, uint8_t caller_id, + const struct rte_flow_port_attr *port_attr, uint16_t nb_queue, + const struct rte_flow_queue_attr *queue_attr[], + struct rte_flow_error *error); }; void register_profile_inline_ops(const struct profile_inline_ops *ops); -- 2.45.0