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 BB0FB45B97; Tue, 22 Oct 2024 00:38:16 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A9D954027E; Tue, 22 Oct 2024 00:38:16 +0200 (CEST) Received: from egress-ip11b.ess.de.barracuda.com (egress-ip11b.ess.de.barracuda.com [18.185.115.215]) by mails.dpdk.org (Postfix) with ESMTP id 02CB04021F for ; Tue, 22 Oct 2024 00:38:13 +0200 (CEST) Received: from EUR02-DB5-obe.outbound.protection.outlook.com (mail-db5eur02lp2111.outbound.protection.outlook.com [104.47.11.111]) by mx-outbound19-70.eu-central-1b.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Mon, 21 Oct 2024 22:38:12 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=korYqB1bwg0qzRS0bwQrpMTonWUsFZhlhWEOiDRzcuT2fyX2ueeFQ6ff4RVrHCaf3fQxyOBEje6ACX0tuLNDlryaBEbi4ETF3j8xRlqE1PsPAiL1FayzbIz/KlJgPe85OF4hwEH5d0ih21du4YL3e7bTlosd7Qox4F2LIpRT80bs5OVfvRwzjw9C8qhQN42BdgtR/V67X3zr9yT81xXVd6c0So7wx5uJtFZTkK1dohSTX62brxeRkS5Hp0rVaVQaPWKlbONQwOHOEdsqrTMfVLeJ6G5cjRbWqVcLFUzkD+D9E5n/2axhnMRUXLyMR/tAvyhJkw6X9SWwb/2lhus4Nw== 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=wbH9p7XvVypXoYsz5/DUyZjv3hbXvSQW6d4JMn9MN7s=; b=gZkNSgzBNjNK0zkq1T7kPoN8f5/CyEnbpLKDOGaQ9EUpTK9ZH0tKi4oK1Omsem5k30jfqU/StbMRCa05OomeOHIqiPghfN1Aag2hL2Zpn3yymXWaOZjniI8se7r9CHhFirqMtceEo+XN0zKEJy85vcI/2Ew0QpDZpCmFfQtdy6KHcTu4j+dpOti1k8gzKVsj+DhbZkX16L31ELVSeJ3Od7gywWBrjIi5Bj4rIpbR275/E0hwLm2C91C7pseWYwAVY3IFIpPerbJLUZljxrVUA/y8KPvYhLDPrbkS/oknDHqkLzWsDnYGhLwk+EuewC6x3pt9sWS01g41KqHiIFM3aQ== 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=wbH9p7XvVypXoYsz5/DUyZjv3hbXvSQW6d4JMn9MN7s=; b=eJ0xleSSKJQxXGvfqXnBD8StW/nMJU13VeMrIsiFKm5TwcVs+Fy9zcTgtgzrE5Dc+fHpM0DMNdTKhxBGonPbPloTpQPWP+ubWRNeoGp2V8p9hQqDUaHPj61NPm0gEmHSvAIoKniz0KUN8KVN3zW5kBkFbYhV9Y8wpOOEhxU3gKE= Received: from AS9PR04CA0143.eurprd04.prod.outlook.com (2603:10a6:20b:48a::24) by DBAP190MB0821.EURP190.PROD.OUTLOOK.COM (2603:10a6:10:1b3::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.28; Mon, 21 Oct 2024 21:06:18 +0000 Received: from AMS0EPF000001A8.eurprd05.prod.outlook.com (2603:10a6:20b:48a:cafe::35) by AS9PR04CA0143.outlook.office365.com (2603:10a6:20b:48a::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.29 via Frontend Transport; Mon, 21 Oct 2024 21:06:18 +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 AMS0EPF000001A8.mail.protection.outlook.com (10.167.16.148) with Microsoft SMTP Server id 15.20.8093.14 via Frontend Transport; Mon, 21 Oct 2024 21:06:18 +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 v1 67/73] net/ntnic: add info and configure flow API Date: Mon, 21 Oct 2024 23:05:09 +0200 Message-ID: <20241021210527.2075431-68-sil-plv@napatech.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20241021210527.2075431-1-sil-plv@napatech.com> References: <20241021210527.2075431-1-sil-plv@napatech.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AMS0EPF000001A8:EE_|DBAP190MB0821:EE_ Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: 5cc54adf-25b4-4a75-f238-08dcf2143523 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|36860700013|1800799024|376014|82310400026; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?jbHIqQUXCKBwch24wuMQBFVrSZFYxwAMNnfJtDRGB13prMfwzX6IK/i/Viz1?= =?us-ascii?Q?/hFOhvGB9xWAJ5IJgqRXRAiYs7B9tcTauT3FkBVpScqXG1bqEgxFM1uqNyky?= =?us-ascii?Q?alGUiQ7lNYibI+F19t0FVFFEr73+F5qM5YrVbKLYyZUXUiUDOWPGA3FBmC0i?= =?us-ascii?Q?zoSbolma0M0el3fC1aCdGiJpbCARbatUINwzc8bqQkJogBRdxYo59742u+v3?= =?us-ascii?Q?VCEAPK0PosvKZc0VsZ3XXIWpuehQRtRQa5qvm+SQqopl8qyIMsTeLsQOT6kA?= =?us-ascii?Q?sDtaSROkg9N1cC4bWEI+GYhu/YG0huEdxPYXrwGvfVwQPdIvZSk7Ta/wn2NN?= =?us-ascii?Q?xxcb7LOpm4YQH0fIEmo2OQMQ+3Upq21t64s5kVyz2l5N2UZdQClKG57Y21kw?= =?us-ascii?Q?ccqhWoHT+p4nDLYh49Vxnfr+EKAnqbHsgqF6l3trRMHWoInefvpWbNBhmn3d?= =?us-ascii?Q?o4GXxhjSwysncQ0MUavnDTZ0wsCqPCFxOmDzEQnP/QffVv1sa2qqMpsBSN+1?= =?us-ascii?Q?Y1ee1/9MejkcGVE1UYQ5EQTkulwbJU9uUjynTEp5J0QTqW3CNLcx5z2PwSOL?= =?us-ascii?Q?7tcePtgsbwhtfUUWbKezPycYKbuYVwyx8covP8ExSiZnyrJRwOquSJNYAcDg?= =?us-ascii?Q?k+E6OV7pvUvPRrzJQl5pIucfphsWQs8GtqUm5lo9s7N6EeXT34VzgXJ39o7k?= =?us-ascii?Q?ETc2lJy6Q0jkYdp5qkOF2y6dNGCMNweL05Pua2bTzt7VNVHI+XW8OLiN83Sp?= =?us-ascii?Q?ynsytheWUk6wN0kYAa5N89xN3nhWCxW2od0YXcIvbUQddwLajF03mzAkhvGC?= =?us-ascii?Q?AKvzp+uLoVkgSIo/3fXpciISxkgiUFipy+eAyT2QvsJWftQlru8CzpEsNgeZ?= =?us-ascii?Q?KZblJMtHn5BTBv1tisr9lBpiMfvQzrQ/FTzwfw8NwxILKb+ilrV1FWrw5EOP?= =?us-ascii?Q?KFaSzacuPyt3Li/nnvryIPVnyM7aQUf8SRviElkHHmwuzki582UokL3oW1rC?= =?us-ascii?Q?nkPliHO1w/FCB8KcXSfJneQjXH0XRb6g4aU+lfrV17R11fz7j0IJbc5xFR+4?= =?us-ascii?Q?zWrbPukaMyil0mCKOnQz6SLsUZz3ApzsrxwjRf5sJQjRHsd/FtV+0G1l1NBb?= =?us-ascii?Q?adjjrrYz7fX+/QrfCaVqP0VUWl3X8GaVjDfXt8vitTjsR2/fvOpoPSWOfU23?= =?us-ascii?Q?nKn1HJmyq/h704VSVWy/a6uBWjya6juUF8oP+tj2eatowuMKFDQDXu/6Mtkp?= =?us-ascii?Q?o0sYQAxLq4X2SBIZi2cjvpZqCQp9si7XO2nvhCugAMADItQC8vAhmfmlCLNR?= =?us-ascii?Q?1Oo5+U2xXm+zVBUDWEdKxTTnlsc34FAI+9rBvAjC+mr18sJTKcstVlbufmoQ?= =?us-ascii?Q?batI9+Tv3Hhse7UUKMK6ggp0G0o5HKig8IxlTCiatxrk4QhclQ=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)(36860700013)(1800799024)(376014)(82310400026); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: y0LgP/aNci1R0cpZ83LeAWO0GKaMaLPxTueq8zXMIncWsqM+hAgKxxMTrc1Yq6kJESgxzt2kznuX1aywA77hGGIZhFf3tEo+B/UGEobFYwCieHyZgpv7Tdlm3+3nGbLpl6PR3KY88vGneTne8e697Vs2rKp+o2iE67AkbFMvDkZC/pGT4y8V8pqIQdeq0SsxPCmJ/hNZJDHo26/IRaOaPY0ZJi1y9ORBuI+qR0w+j3/kJ3jz0MbA2BAPoksyRqTrmO7dS1VQCHSkMaWkPRggc/xhhCaerdNTNhGKuOtUC1r4ZuB0Uq7w88SDqVJYEoZpWdOGmJ0AgRMDkB9Y8FVh7qOelFJOVqQRXW2mZ4aIYv+KjrTx0RJb89FUHbxmtkGD9v8ZZKmaGRhZGDQa7KjLDv9gCuIRyHM9p1Vtzjdcw1+YdV4Qpr0uwDWCF9/9MNZmDyxuN5Gj4EEwOju9pUPSc80zAJmMyvoSkniYzT7nS2xgQ89+dtgeOj6osOrPQZDER40R0tFtGApFC5z/izqBk92Dn8AP5BeGWY051BJn049BLK0OrLD6P6bw7HUHvypBNKibsjWyah61NrURSborCS8olhTbd7I8uwQfas67BpSHyzb9Mgdop4UfZW1xsMGcb04LSWdvuY+0JWdBeg4oMWtI2a3vMRjQYw4/fhv3GbE= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Oct 2024 21:06:18.2864 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 5cc54adf-25b4-4a75-f238-08dcf2143523 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: AMS0EPF000001A8.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBAP190MB0821 X-OriginatorOrg: napatech.com X-BESS-ID: 1729550292-304934-12650-49124-1 X-BESS-VER: 2019.1_20241018.1852 X-BESS-Apparent-Source-IP: 104.47.11.111 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVoYGJqbGQGYGUNQgNTUpJdXQwN TMNMUkydzUxNIwLSXRJCnJwNQkMdXUUKk2FgDmmvl9QgAAAA== X-BESS-Outbound-Spam-Score: 0.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.259884 [from cloudscan10-204.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/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 d30f7ee2da..009b56c258 100644 --- a/drivers/net/ntnic/nthw/flow_api/flow_api.c +++ b/drivers/net/ntnic/nthw/flow_api/flow_api.c @@ -1085,12 +1085,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) { @@ -1098,20 +1092,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) { @@ -1119,7 +1107,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..1022583c4f 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 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 bcc61821ab..f4308ff3de 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 @@ -4563,6 +4563,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 @@ -4584,6 +4641,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