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 6F1E845BCC; Thu, 31 Oct 2024 00:13:54 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id CCB334350D; Thu, 31 Oct 2024 00:13:39 +0100 (CET) Received: from egress-ip11a.ess.de.barracuda.com (egress-ip11a.ess.de.barracuda.com [18.184.203.234]) by mails.dpdk.org (Postfix) with ESMTP id DD1DD43519 for ; Thu, 31 Oct 2024 00:13:24 +0100 (CET) Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05lp2109.outbound.protection.outlook.com [104.47.17.109]) by mx-outbound11-85.eu-central-1a.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 30 Oct 2024 23:13:22 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=oHaO3CUpyPOs3MkM2wt9AWHW62y5k78hicVo4mm/+rFRB1lfOeIUcCUGYbOhKlEMwvuH5yfhncZceCnjV/If+nG4vNluYCmcQYqJgh4/CnkpZY0aSoXggszXvkUeDitCZUnsl0x4TNNvErCJLh8J8SyuIq+RIc72W3mig57HsQlF6Hg7feQTmcV77mhfjbFYCSYkHw6GRInqtB4dGy1PP9ZR01TaHpsPxm64/I6b4dwMca1vAj52OJFYGUBmyGw+LtzZC7E2LjL7MbAd/bE+XjMh3zPJ9FjcJMhQFmI9dtpq4btDS1GG1x+c0IZdDXnnSu9mL5knDXs5KT3SSwrKIg== 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=hagU0/b6ZEo2DuTKbhxRewRn1ykUTqsmB6bcz7/ESpY=; b=GdQyi7D/zSgLViABwXudmSEIdMEJFrATELAiR3EH8409s0grumQ8a+LM4LYCMXsQ6iAwFiK3C7QuIH3gVIVq5P68o/MkGdS2O7FFO99+HnB/t1j2FwVYBGJ/VLzajBEaIwfO8GCg8aHKn8SsyVCK3CkCFfo6JgUZiokKeFuDx89uQgUHXOyqzXe9t1L7d+0y8ItKJELfB72bnCM/VKm9Ew5MP045qBrHGoRkoxmgGZoopzWZfFuyi4tOJ7PMHlrw33m0vJG0fRuCsmpGn2H7mrHqF3qq/JiRbYZcIbdDrYvKLvcHHYpT8UxD7MkXh7zu4qp0xuAQ2HL682jmanYCaA== 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=hagU0/b6ZEo2DuTKbhxRewRn1ykUTqsmB6bcz7/ESpY=; b=JMOEuwmJUP0BRpg0CpfukMjVQf1bWaw+m9dQbIwi/coVt0Rj0ZdGEygIJA7fIDPQxCDhmxStw/ohxGcfpmBfzXIv+2Nks3TWEL4fTV/QVMx8DWUJ5ZRzTaBFvFF1KrWm8IXL7IJhW/O2P2kFV4FQEBO2HVfoiywgZCDbraVta3c= Received: from DUZPR01CA0010.eurprd01.prod.exchangelabs.com (2603:10a6:10:3c3::12) by AS4P190MB1781.EURP190.PROD.OUTLOOK.COM (2603:10a6:20b:4b1::20) 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:57 +0000 Received: from DU2PEPF00028D13.eurprd03.prod.outlook.com (2603:10a6:10:3c3:cafe::6f) by DUZPR01CA0010.outlook.office365.com (2603:10a6:10:3c3::12) 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:57 +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 66/80] net/ntnic: add flow info and flow configure support Date: Wed, 30 Oct 2024 22:39:13 +0100 Message-ID: <20241030213940.3470062-67-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_|AS4P190MB1781:EE_ Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: 372996ea-f342-4a93-2c4f-08dcf92b89e6 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?5tEEaJ3I/1qt4/hMyk4rM9QxBwEEPMovWoZ0HGQVtMw7BlV1KySyjhMq3pXo?= =?us-ascii?Q?IFxbaWOU3bQE8CYZl01XrjPk7Lm3oNu7chm+EVDZd30q/t6fBBks+/OUBV9o?= =?us-ascii?Q?9fTcNQMTrpYpcrLgNs0OT8wuM/PnDXOEbYDbCRGrbn5zm2W7m6pz6KlbKfqe?= =?us-ascii?Q?i1qMTNYAvq5LINmgN4uC/1IDPXDJQ9yQv7Gd2/3UXB3H8rgViaMwm3etTFAL?= =?us-ascii?Q?rCLVB4rJaG/hXboJ0N7TL5g8Mqjww/0dTzpWCwA/EzF3XAbT3pjpMlEv31za?= =?us-ascii?Q?pMVEJhE3rBI5/Lb256+2htzP7xDbzNS+4Qje9EO9fzvFU/MFMpmzMfKi/STG?= =?us-ascii?Q?tAsmkDlnMjhfw2vBGhBbJanC7xCEoNea0fmFzHRi8a2ovFaXwLyzrJOAePMv?= =?us-ascii?Q?4okVLjsXATVhk2O692GvSPKFOtercImksqGDCzZbgiJR+T36pzYxXnZgmQb0?= =?us-ascii?Q?rPnMZa76HO22hPVaVG5g/0t+8DIDrB8Ww7eNJAAfka8LtHD/fp0CWK2sq10F?= =?us-ascii?Q?ybEDRU9XjoRIeck+a1gZjxsJ2+HA5C/WqNpkzx5SmcbWYE8pIg5OmsQI2kS5?= =?us-ascii?Q?ORJ6weiduedhd4blptiFo+lGyjBgRZ9nJBKYUQU1P7XQzj/gIyG7DIYijVed?= =?us-ascii?Q?1CXIBWpZnfjAiwx4iOAat28c0i6RVPQAWi5GXvLiblcsJFuZGr83rBysZ/7F?= =?us-ascii?Q?P/gDaw83YMV7C4HRt5y90X/5jRSenqikH1zQOsVrEtNr/Y2F1ym0uVOfITj5?= =?us-ascii?Q?lB0NUFeqAL8XwK6UJrPAwIwJxwTpugzAjLLrzoCkKE5IuzAFiqw1avLQUneN?= =?us-ascii?Q?+qQg/+Wky6s+bf1+piwxV3M7lJw6wWCYDlWxIa5n8kM8sadqcAJbRexvyoap?= =?us-ascii?Q?leSMHhiVTN9Uz63PMBR1aJpAZTiS8hrlIZMzkslNqj6aQBSphmpUBGg4CVju?= =?us-ascii?Q?9lhnTvOCxNXpbK07CL1sUuUkNKgknFsxwldCddZiHYdc1uUlEdjmlBJHOe9V?= =?us-ascii?Q?OmPVOu2UiIp14ZZHXp7Ld1VJlsSfqxh0Mw/GSaz5LmqyAFZxC/80l7VUUeuv?= =?us-ascii?Q?r3D4Ec8FerJnr3RfCFVQatvv6PHifoPp1Lh0+j/3pp2EkLupbjIldRwGnC3k?= =?us-ascii?Q?VVUqHtstX9H2KE9Tblwue7v8VfLeDdmWy3zh6bgsya5+e8HvviReEAVKvr6a?= =?us-ascii?Q?D8VSbWVucmCmljBnBprmc/4pNzHHze4AkNQO5cmqKQ7Mrv6Y1J2JrclOjN6A?= =?us-ascii?Q?4GyjWz8j0TH+db4taJmSfmA/Bh4Eb00TkyqBw63pESx6jWbxgdEaq16IPDYw?= =?us-ascii?Q?VfZLVxD9QikufZ8IjEKerGRbY+RVqC0ft8xKuvywaDdu76s62MmRkC95lDcN?= =?us-ascii?Q?qlWw99xKcTPrxiQFAtv6xzqO4V21BJohMoWw/6FHZJ1mmYm0tQ=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: pXR47+zWi+5lfUr6RWLuo2DqfR92Ccu+canWs6Y0NCf69aeSn7TjfKmscXhOCjEzx26j/VLi6IFQ0KTO7JEVw39M4RwvmDxpHdOVrazh9ilM3UUb5V0VwljCmaCrQOxf7cLjfnsdJiJxT88Gys0lOmoZUMEaC/m/QthgburIcViUyEDv+PBg+gs/ZIIP8PZNXTLkCCIGvhm1mJTUfJtUqwjnsDVSHyPJ2+ekmt0+weJkmp8bOXo6qv+1SEgpsGb+ireOSFH68pJ5I7nil0pKOw5VtZ+EM3wevjKMR0h15rIOoqJRQEJSZyIr13B8JzdjqKjcn3nW4tejA2Ytm3+10Pm5XNBrGWwG1OMNp2p8izYbIOTetYm8Ci7NBvwepqBsa0Pca4+KpP733snjATeZ43Byb/OLjMgRPGbH+wwBcM8S2WItwzp7ao+SFuqvUdPuHSIRXgU2MgdIyk5UUAC084nNlAqb7h2AXgW7ANkpQg1SJLciUu0IpGzLB+o2trRtQvcfHQXM8N7wq7oCoIGwmBpEn2QIqSInfG6Fpgkk48UOaxoBAc47V9ojePZ2ErN8/K25Nz9ZJKvUc4sDnylgrolQ6Eiwpz1V3nxGkpeMOAoiYfRFfNlL0XlLBC+du0tl9hf9narzEmo7u5nFpBRRGGVdy4H3K4fwVREWJxmB0bA= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Oct 2024 21:40:56.9272 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 372996ea-f342-4a93-2c4f-08dcf92b89e6 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: AS4P190MB1781 X-OriginatorOrg: napatech.com X-BESS-ID: 1730330002-302901-12791-46810-1 X-BESS-VER: 2019.1_20241018.1852 X-BESS-Apparent-Source-IP: 104.47.17.109 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVoaGpibGQGYGUDTFPM3CONncIC ktyTzNzMTEwizFIC3RIiU1OckkMTHVVKk2FgCAix9gQgAAAA== 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 Inline profile was extended with flow info and create. 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 3d65c0f3d0..76492902ad 100644 --- a/drivers/net/ntnic/nthw/flow_api/flow_api.c +++ b/drivers/net/ntnic/nthw/flow_api/flow_api.c @@ -1041,12 +1041,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) { @@ -1054,20 +1048,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) { @@ -1075,7 +1063,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 5fe09a43a5..a147dd9fd0 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) { @@ -4554,6 +4555,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 @@ -4575,6 +4633,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