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 D389D45BB5; Wed, 23 Oct 2024 20:33:34 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C31F842F45; Wed, 23 Oct 2024 20:33:34 +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 103D942ECD for ; Wed, 23 Oct 2024 20:33:32 +0200 (CEST) Received: from EUR02-VI1-obe.outbound.protection.outlook.com (mail-vi1eur02lp2040.outbound.protection.outlook.com [104.47.11.40]) 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:33:30 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Cd/nvR/WCol9+Eae5Ybzc0FwQbqtUbwA48BEINK0mMewnqGC7ussYzsfv5hncml+LUSZxnRsfLbTasNIZZrCgp4pDftcbS+mse693fW4EVDmrktt9rCLCMPoJXfYsovJ9t4iE59207hTlZlebJCStFRvpU7iUN27BKPgYWHHVBhLD6ZchS/nYpR3rCEucsOx1Qr9MTUGL6r/9P0CsDMwqLUtEJNGxLHKZ3Fo5KYsfCfZDTa0FgEwnyo/a4FaBI3BBiBYmLc9Tl4QpJyCaylCqVaqNvGQcYd+l2qWZU3EgECsOQqWQGNaEIeowRYao62hZuBpSvqJhj/v56+kDPeK+A== 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=oDyLwzdvrlORpi5eednr0caeG3BhYuYearxGo32xOcw=; b=MHq2Cd58cohWOqjajYgrXW2+Apjl5T/xfrix/ngudIpl2pQqC44a76rUXQTlUhcHC4qfpLyRD5/MXRMqHeOr8HC2eMjYDLbBgY5UpeI2L0ken+ABNRBj1SARLaImFnOYncMOgVDMl8p8mC59+TIdlikuTX6krkcE8q2/MEkjdPVouDJRoFPG+EYt76n9ogXQvvdbVZTPhkgBXr4wM2lwaAY4jkvkBCXXkGL/nuzhXiHZGArnIcUP5OTP1RzFTGO+74g3QrHDfTzy+UhfelMzt7PBnB2G6W7tPWACUekV0W844l8yw2iXGHlRihfFkMOcRli27G2PGxhiKhEUW+L+ag== 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=oDyLwzdvrlORpi5eednr0caeG3BhYuYearxGo32xOcw=; b=lYXJHDerIlPIi+FBntFn93MzMZycigCykFclV/ZTmhqTOaGNAEdKy5EpGXEzIkXcDPkQtm61RmuFtVmd1SRIJ/Ym2Kf6TdkElHUWm1YzF4uWQwG+g2mHptbnvhzOOJvxAgj6gKvJoNCNrypKILydkgfbJOazxdbXQfYcc3bkWQc= Received: from DU7PR01CA0002.eurprd01.prod.exchangelabs.com (2603:10a6:10:50f::24) by AS8P190MB1911.EURP190.PROD.OUTLOOK.COM (2603:10a6:20b:524::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.28; Wed, 23 Oct 2024 17:01:44 +0000 Received: from DB5PEPF00014B9E.eurprd02.prod.outlook.com (2603:10a6:10:50f:cafe::a8) by DU7PR01CA0002.outlook.office365.com (2603:10a6:10:50f::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.17 via Frontend Transport; Wed, 23 Oct 2024 17:01:44 +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:43 +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 67/73] net/ntnic: add flow info and flow configure APIs Date: Wed, 23 Oct 2024 19:00:15 +0200 Message-ID: <20241023170032.314155-68-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_|AS8P190MB1911:EE_ Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: e5e9b51a-f43f-4e97-ebb9-08dcf3845f86 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-Message-Info: =?us-ascii?Q?WdB4MWhZgNN4ZOnSUT+ZGlxCuCxTFvsLCGYYuwFVDiyoVvLDuQL7TpLO6JsY?= =?us-ascii?Q?rbZ0L6c6wSKD2AmcL2EO5Ir+xSIcq9QCM1FwozfmaGb6zmyqg1HD1sj8dVEZ?= =?us-ascii?Q?7YlXk6bmWRzuk++MLEHbisFAbWx4vYoW5hkidsf/wojsgfO6xb2gmUfTpSkj?= =?us-ascii?Q?AyJtuWmaep1doJAr9z/seNg9jG6/7JDJQFxQrW5EX+KYDlVzGq/cItQCQYJv?= =?us-ascii?Q?IWqNRq08wAnURA3qwo0mzBCoR3lisiz8xt5QOiJ/ScGmiKwP74Pm8Up5xRW4?= =?us-ascii?Q?CRaXq3XOsGp4t5rCYdZgJf0r9iaNHmBPpNkHPVd2Fi4VDTpiT+JnM4iYCzT/?= =?us-ascii?Q?MJ6ctQk+p+vUT4YU47RmPveJwchmjdqDorLcpNeZl75WpjPds8TFKtovlfWZ?= =?us-ascii?Q?rDRjVBvu0Ar5sruEszmC9wyjwL6buTEy3JsztG6cNGYYo0Ge8JNJIENJcho5?= =?us-ascii?Q?Jad7b3m1ZD8Adn/Q3DwDe6KmhoaXyr8X+tYbphvGmu7wWJqZnLVjwTjfJQNW?= =?us-ascii?Q?Jd5rNP9sLpIIhJ2ni9VqPS18XFA+cX3Xl678HLHiEIVWe1gbJzQwsSVPJzOt?= =?us-ascii?Q?D9seRVwNuXa4MN2Q/SeMQJcg1vNil4zr5x7RJxZRmqvAA7obgERJkag9cJaS?= =?us-ascii?Q?VNsrn4Cpu2GQBwhfQkXPLhrw4gdKzXIaVr5zFShWSTQqBKd7XjXDEQUoTM0H?= =?us-ascii?Q?jEX3fOFs+Gj9TWBV+SSyqG7f2DaG1H0w4Eo/HEEtGqPhft3WARP4kMUmja57?= =?us-ascii?Q?6s1sv/GE3Tm4JuFTeyRzoMq/Z8JuQbmZuSxUOe4yTr+rt9hZVDh143HNHoCI?= =?us-ascii?Q?t0sTrk00yNeuVe7eeC3aYpPsHZVTH6gj5tWc2aLl7C1WkWJ8Y0LdTWqEXX+X?= =?us-ascii?Q?F6f485h1asSPtKBYJ/2zgePZtCJQ3eXFQvzo73arQIkTBkh+F71eZ5lqQYnI?= =?us-ascii?Q?7z8q0qOMwbxJTlCEA6D+dZNBEO3EygDdHJSZveBuWrIDaTUN5EeulwrtvsIp?= =?us-ascii?Q?atSxwaAkQNMqUAemrqbhoWeNI+371RhebW3khG0ivMtpLE6aZhJH02pPWU3L?= =?us-ascii?Q?sReWljnBYVEjasSwoFKNCriQoaXzNahDMr/Wq4jipk/RPNFRyOMRyYA6RON+?= =?us-ascii?Q?QXfFU8sxXj5uINsJaPjtMo8IasxBqY1fexQ+lVBmfc5VUyVllWyUfrpaY5oc?= =?us-ascii?Q?yKYQ3SryomhuVJXNdPgw+5+QRUUaIhqbOoLDKYtZ8ZcexQEYAaPKgeO1uOde?= =?us-ascii?Q?LR8k79ri3LDhKrpTs1bwnrXqka1g2SVZm2dC6rfKM3bt7b5dTblL1ZH1GCrB?= =?us-ascii?Q?M/jiUlXe0+dGRVJiHEAuKHnWCX5WWkWWHTau7J0KkfUR8Oij0PaKaOW/rgM3?= =?us-ascii?Q?cSbGAbsKOUxWViaj0yPoOPUiCLefaXSLXoNxdJbr4l+fZ9pliw=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: VC9HvtSc9c1QznRT55x4sEL+aCTHkd+OVp9A0NfV6wFES/vAaoJnD/HtNhD9zAUS338IIM/IJg42FKXPoSWGPT4lwCxk7Y7X2DhINsvNEAsPOqbf6DYjLbcqa9F9AkUQ5tqoAbfElc9IyLYOr4bTcPtePqCDYXUfELGcfLuRstjnmQeu/Nhgehw5lOG9Hw3ijnoaSGiSmsDeI/osJV803DVYO9dfcuN+EhCd81doYFxpkCDvBFfb8497pqIdaqVHh+zTU5cZ+yoBSQZgLSPA/tfOO4hG8Ea1UrvqNeqU8EEQsZV72QLW5jsczMA3H3sK4w4G9Is8cyd7AgQvOQnSowfwXUKU0iSIVwYBRm8c+d2StyLOW8LcEYdmzF6wufUWa5HHcqp6mT5fCTGrKObbgHHxO00Os+ZH3DFs7R2dtVeOykdYO8Y9E4Bbe0KqOO8ZLmBXjqZ73ETOBeu1mVCTbvDfs9484T12/TKUxVoKMo+qso6bX4wQ6zc7plS1jxqgGNOrKWp/FVwffGLTXuCSgy2gY8vnAfaHIOgaAb0L6cvPFAGGYSpzXCgHeVeicZkHrHk32rpqd2R7Yy3pPQRJ3jJnS9waiY5vEw2qvmzOopztJSjbWwqOHpKqNGhb2QE+9WzMERociOdhftXRJTbzutUwIhVO4cV5mAs9c6bU5gg= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Oct 2024 17:01:43.9771 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e5e9b51a-f43f-4e97-ebb9-08dcf3845f86 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: AS8P190MB1911 X-OriginatorOrg: napatech.com X-BESS-ID: 1729708410-303923-12641-48074-1 X-BESS-VER: 2019.1_20241018.1852 X-BESS-Apparent-Source-IP: 104.47.11.40 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVoaGpiYWQGYGUNQs2cg00dTE3C wlMSnNNCnFMjE5MdnYxMzQ2Ngo0cDMQqk2FgDC4J9UQgAAAA== X-BESS-Outbound-Spam-Score: 0.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.259926 [from cloudscan19-206.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 --- 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 9e1ea2a166..300d6712aa 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; @@ -2439,6 +2439,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) { @@ -4559,6 +4560,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 +4638,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