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 AC77745BA3; Tue, 22 Oct 2024 19:30:55 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id CF64340DD3; Tue, 22 Oct 2024 19:30:32 +0200 (CEST) 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 119AB40DD2 for ; Tue, 22 Oct 2024 19:30:31 +0200 (CEST) Received: from EUR03-VI1-obe.outbound.protection.outlook.com (mail-vi1eur03lp2110.outbound.protection.outlook.com [104.47.30.110]) by mx-outbound15-54.eu-central-1a.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 22 Oct 2024 17:30:29 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=aYSYSUM+mGTm/Oxn7hVuJD4fesarU5M3RaBLbYqN9e1Ca4l7IwF3QeSKrXQMHo0wgVtGx+5R8NBBJdlM9f7JbD+qpGAfFpqw6vvyEBZ7dm/jbUprIkhMnfj15rrqQg6Ik9vBfVH0wj+PBib2bwDWQtXIYZKcA2dXquV/PF2y+EXwcAPDra4gEBbeX7FfUe7vkn5YH2ItagnHz3UjokXdTYVxxfbOF9UWhB4E7VCULG0kR8bi6e7TFgq9EoLrFdU++U8s/NoE/c+Eh/4/Z8GJLFU6g1le4z+Q8Ee1Reojo2QjgiwpV1y4HE6b/QG8KX6zYkrcwO5Bgld43o9qvjlWew== 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=/TAGqZIZE7bwMLE+pVhI5ggAgTi+ts7Vdg5wwWGBkaI=; b=YpExDwC0WO9OFkuvKBDrBb0BD55c1C136ypW2r4/01Dir6TMQeDYw9yLg9nLo2NDGVWzS7Qs7KznFDQBPmt04LMzFpFHmOuggwFwujtcjwfgVSn4FtJtgMA9PZxiTkLvOERcUir/vadm4yus1YpqM56vuoP1Wb7FuMVJL9t7+ucJa8rGG4ejaJuDZPTeMBJUZYHMgPpDYZWZ8V34mP7DGIfBgf/dhhvlF32THOxYb1+g2tcJp9lMzHCFqKkkzbAUtA2REr6MZEHd4gtqxeSZM46EucyjSPiZUeXeevN7A/tiDPeGI8MWYp8PMvYyJ+fIIoSf8TJb1yOxRZhEY5ZqzA== 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=/TAGqZIZE7bwMLE+pVhI5ggAgTi+ts7Vdg5wwWGBkaI=; b=VQfgC2i0pnFLfBq9BQeT05NkRoDhYLeL90LSjOMUqv8FI0KhBO4xnqzLX7F23EJ8S2dDUexzLykDX+un6WZoqaWZE93ZT45mFGw1lyKwxwlrskywli0Cyez2sNCm4OmCgXKIdNKqAE4+0vWSxfRNcsTrdgOhvigSAdKz25YM/VM= Received: from DB9PR06CA0009.eurprd06.prod.outlook.com (2603:10a6:10:1db::14) by AM9P190MB1060.EURP190.PROD.OUTLOOK.COM (2603:10a6:20b:26b::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.18; Tue, 22 Oct 2024 16:57:16 +0000 Received: from DU2PEPF0001E9C2.eurprd03.prod.outlook.com (2603:10a6:10:1db:cafe::a4) by DB9PR06CA0009.outlook.office365.com (2603:10a6:10:1db::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.29 via Frontend Transport; Tue, 22 Oct 2024 16:57:16 +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:15 +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 67/73] net/ntnic: add info and configure flow API Date: Tue, 22 Oct 2024 18:55:24 +0200 Message-ID: <20241022165541.3186140-68-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_|AM9P190MB1060:EE_ Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: 0a5d97ad-39c0-45b6-e2db-08dcf2ba952b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|82310400026|1800799024|376014|36860700013; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?zglNl71oH7+GivMU5P+Ke3igT6haHDOqaVZJQ8YbR+JQR3u1aWI8jA+sv+Wn?= =?us-ascii?Q?XjO5diAdAYNVLnGCIIk8fOMliTQrttbvEgItyG+M4aBTrtjnNWSw86hGqQfI?= =?us-ascii?Q?UP5QUPnvoEF7Ag8BfEw2ymUZ08i4uVpmLYc1cR0bIxC1/qNVcsFR7VuiBKeX?= =?us-ascii?Q?/E6I5tULc/Q7QiGyRgVHKGJ4JXEZkUGxy/jT/FqUqULZematH/AvEooe5Sb8?= =?us-ascii?Q?X/OyMU8QP4SMbnShemsnjb55kbaNMEsMOnWo89SeeAnjEym+RyO9/NoOZkdE?= =?us-ascii?Q?W0lcGLaWtVaenqVHHVCQPRvbLMnAluH2JJqiPwRpEjTmG825SU+gvwzD1jfI?= =?us-ascii?Q?v6XAgQwk1xsBQ2mLWH24R/yqmG+MXWswwrs45hljVDnZgl7j+8uoMmWSrcCK?= =?us-ascii?Q?Mz5t1pq9P0qI2M05nrhwW4Mbr55EjLfhv3+Qxa/QgX+QfLpmmqkBpmTB1K5g?= =?us-ascii?Q?2rVfmaxh68C7uqEd7r1SCqM5Non97kauteEzr8OB9vbD9JrpeBILVrU6fBjw?= =?us-ascii?Q?QpNhXymBFOShD6MLfx//HVSl9rUlrmqt0SbfkSHLEsUt1vEG2cBsmLLqFwvI?= =?us-ascii?Q?73qfowhzaClbfkDOxLVPbPD4LX1UJ3wUScCNO8Dcv4HkepYN5QKpmqipqOCg?= =?us-ascii?Q?BSYfkqBbWJLELngeZMr3RmJ7RC6q9b3kAPV9FT5AbHTNSoZ2t9xuEPtR5fWL?= =?us-ascii?Q?0r2iCK1QHgW+c/km20fAkfiEpDQvwPV3g7nKKwfoVybhAyz7PCjA8/ZmFW58?= =?us-ascii?Q?nUTQopoUL1sUMwiomxFvjCkQJhVI/pYl3yuvYa85BozZxF9evDiE0KYC3iY4?= =?us-ascii?Q?zgV5p4bUkqu3WKyTA62bR/ZN3rz+ORCUT6YW03QNFZxVAta/s74f5LjFhq7H?= =?us-ascii?Q?iYK1Tbbg8vfSV0jsIPHm2imOsD5mwptC2kMoD4ojTJsw2v/eUn73whna26fX?= =?us-ascii?Q?ZOR08e2uX+bN+6zN5HZFFAi1gKp96zQmYavuZrHfjTZ+1rFtAXUopOzZ7En6?= =?us-ascii?Q?gjalhtcrOpDh442k1S+gTMgYO1IQy4ngom/0wq+B2G4C2OS/fqbhiKEAQDqP?= =?us-ascii?Q?E0Bw6+TxiJRIzUPHkIXcG6xaJDDj1mR5ao12UOQdwst7lnkOxGIgz1tgXdrY?= =?us-ascii?Q?WU2bfv/4MfIUW+a6jGxttpxDOkhVEhPGD6ZD6wYw3PfCvtEeGgQi4c7hX0K3?= =?us-ascii?Q?F0HiANuMX7+QqQpvSMkEBv8L2Xq+k9boRRxgZvS4pmlq8EFt3q7Qx5CNRhQK?= =?us-ascii?Q?MeAcYsnhp1kLOiZjrtmxBaQVtn/m+hCFpinPx34LoeqYtd6xNDQRTNrjdAU8?= =?us-ascii?Q?ybb7vUUQPOqDnNGEE92g2SCyUWrc/u2RzqvA7CPOuGsWnECXqgoux4/qu88T?= =?us-ascii?Q?cVteqq47GWjoO7badTyKw9ZKGrglhNSGRyf7bC2z1+Nn8SVMPQ=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)(376014)(36860700013); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: 3zzsmnirQtzZhz4r7KgWegRZRBhxwneXge+Wi1n5oLtOrZxkatTWy7S7foaRWrSbdmitwhT197SaYkXbKQbLiqSJzAkQXaVJk6ImmTWKPdTapkFTnuyhhj5Ugw9y1TRSiZlnFnSMwdydNQDDu7kg8e5tTxKDo9n/kCcNbc68wyZSjXyyjb+HgBYhuvdzr6ayx6xEd4QUuU45MYgQ8hil6asjdZn41/Ne/J6Fj4EX6tEC5Kzhobu+sCohBZ9pkj13Zl+EazW79MQ6Iw4LRTTUyTeF+XqXxJEgmQNWtPixFnYSAYU8UzBjcMOeSGGJDaSL57IUSG62ArOOuG9ryMkh7tUm2rBHYAwyn3T+RD8Jm00xTL54u0PdMcdnc455mBMn+rUhNYAZKJ4RjlzVxn3N54cGaAneR3u/mHCCl1mIEmxIRxBjYBfMQEWP+nhEn2QTmCsLYl5DTKq7rVPuRxpN7DHENMOg+vnQ7d1yGG7NMr3yGKFvcUXkRmEFuQteFByE7BpY2JqzZURF0sVgvjiwChUlSsIOKVz/mSWR1dCRo75Y0JRoRU0hfxh2manizrXm6RRgv+6RQL6doro9VsSTNAJBa7/DyeQKac27TfFbdG/jpnkke6UZl0o68UkAvWdRSVVEYG9SGJAXzczuXDjBrh78OelE4RjeeSB887gA/QM= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Oct 2024 16:57:15.7162 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0a5d97ad-39c0-45b6-e2db-08dcf2ba952b 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: AM9P190MB1060 X-OriginatorOrg: napatech.com X-BESS-ID: 1729618229-303894-12664-14992-1 X-BESS-VER: 2019.1_20241018.1852 X-BESS-Apparent-Source-IP: 104.47.30.110 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVoYGpgZGQGYGUNTMyMg4Ldnc3D LZwiDNKCXFNNkwOSk50TTZIsXEItHYXKk2FgAjgsezQgAAAA== X-BESS-Outbound-Spam-Score: 0.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.259902 [from cloudscan21-45.eu-central-1b.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 --- v2 * Fix usage of the rte_atomic --- drivers/net/ntnic/include/flow_api.h | 3 + drivers/net/ntnic/nthw/flow_api/flow_api.c | 19 +---- .../flow_api/profile_inline/flm_age_queue.c | 79 +++++++++++++++++++ .../flow_api/profile_inline/flm_age_queue.h | 5 ++ .../profile_inline/flow_api_profile_inline.c | 59 ++++++++++++++ .../profile_inline/flow_api_profile_inline.h | 9 +++ drivers/net/ntnic/ntnic_mod_reg.h | 9 +++ 7 files changed, 168 insertions(+), 15 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/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..cdc7223d51 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,91 @@ */ #include +#include +#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_flag_clear_explicit(&age_event[port], 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_flag_clear_explicit(&age_event[port], 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 f0a8956b04..7efdb76600 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 @@ -4559,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 @@ -4580,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 a199aff61f..029b0ac4eb 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