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 9131845F20; Mon, 23 Dec 2024 10:16:17 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5ED9B4068E; Mon, 23 Dec 2024 10:16:17 +0100 (CET) Received: from APC01-SG2-obe.outbound.protection.outlook.com (mail-sg2apc01on2133.outbound.protection.outlook.com [40.107.215.133]) by mails.dpdk.org (Postfix) with ESMTP id A9C51402DC for ; Mon, 23 Dec 2024 10:16:16 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=fQ7wXnzzlT0c+DG3ZCM4Tt/8qu95/l0RvXMndXnjzjw9T5nU3M69fgEMFvbb7Qwxh0QngHpU0evQ5f/SX1mdFynxexVkjR3lPx8btD/anwQr0frERm7MJm+z5IQ5N9iYUoyc/27VPsn4UBxMfQ0bLG6eMIcgSV4uxtRHdNUamqrBgcDxCAxJGuHo8L5NjJv+ZZghYWFscMg9WauToIV1QAy+ucX9vg7znG4ialAN8twQfT6Flalk2D+mpFwHm+AssIzgEZvnY9bDsNRd1kLLqgjA26ndfraJ3B49ZMHtZzQnIidry5CZwR7kGAVCOBEpzLopZ2g1qKjYh7udfJSt2A== 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=bn6tj9CraGHibXKuKb3cPu19H4GYlscEG9d7Ah5xY0c=; b=U9ZeqOCcn1/ZEdYdT3A5yTJS1rZPGviHHiXt2CkXrn2nfmhcIoJpVZB+4+7hwqxlWHPjLMKV8YOmqiGbAzKCF7FGGzGgJoXpt/USjiDwe8/pXayaINVjN6w/4ZSjFwc9JChFyYLTMu4H16JN6LcECGlwwnhbKmB1xcrYbgmIDc1oRTiLbPFfPeE18JJOieJUclVrKMZjhW0hgqMnFirkWoiHwXw8r0xyGM/vtWs4PuAa6hRPooQI0+thyjGNukuladjhrqlwfHo2kIda26Ena1PXPukqILjbLLP8LXC+fojh4awFKI96MjWImu2c76Rlzj3AoaJIRrnTy5vDB0jkdA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=jaguarmicro.com; dmarc=pass action=none header.from=jaguarmicro.com; dkim=pass header.d=jaguarmicro.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jaguarmicro.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=bn6tj9CraGHibXKuKb3cPu19H4GYlscEG9d7Ah5xY0c=; b=NdiWNhrnjvuBXaI9ZZ7G6TEp6yEHcoAiSoAZcdQVkSnmZ+MjY59y9TcKuYkUlbCJ3hFhNU1p7BrSuZRcma14iwLOClNPt5gXrZ2g44AQfUM9GiYlkXG/jISQ9s9bAqP1BFwemOp3DXKmH3uQZjo4DZZcYmDK3Mz2QrIx+dWjAyeXbORhgaTBNUTzDuYzTOzk2XQ83YlrX/7mEE6hnlE/eKcLVCsJ7+ECJTJ+LSqjZbxHmBgHFruePp0ef86MyWp6ivS3QIpe7bM75p62P9uV471M3R1Q9I9vf8XmxHuN0wQ2PfHglRvmB35SyP0s3efpgKJfXRbGHXx/KCwGRibVKA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=jaguarmicro.com; Received: from KL1PR0601MB5567.apcprd06.prod.outlook.com (2603:1096:820:c5::14) by SEYPR06MB6107.apcprd06.prod.outlook.com (2603:1096:101:c4::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8293.8; Mon, 23 Dec 2024 09:16:10 +0000 Received: from KL1PR0601MB5567.apcprd06.prod.outlook.com ([fe80::3ad3:b4d9:7e69:85cb]) by KL1PR0601MB5567.apcprd06.prod.outlook.com ([fe80::3ad3:b4d9:7e69:85cb%7]) with mapi id 15.20.8293.000; Mon, 23 Dec 2024 09:16:10 +0000 From: Sunyang Wu To: dev@dpdk.org Cc: wisamm@nvidia.com Subject: [PATCH v3] app/test-flow-perf: support testing the flow tables query rate Date: Mon, 23 Dec 2024 17:16:00 +0800 Message-Id: <20241223091600.53160-1-sunyang.wu@jaguarmicro.com> X-Mailer: git-send-email 2.19.0.rc0.windows.1 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SI2PR04CA0007.apcprd04.prod.outlook.com (2603:1096:4:197::19) To KL1PR0601MB5567.apcprd06.prod.outlook.com (2603:1096:820:c5::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: KL1PR0601MB5567:EE_|SEYPR06MB6107:EE_ X-MS-Office365-Filtering-Correlation-Id: 11b9f51d-c133-4a0b-ccca-08dd233270c7 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|52116014|366016|1800799024|38350700014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?dhK67YfxKGDD5JSObmv6p7w7kuyNY0TqadMx59101mSflycCB7rPXk+EFO/m?= =?us-ascii?Q?aKKi3jycG0HBQWDSpVqGCvr3iL7C43d/j1BLMg5BO/z11WBIK2gKIVtvvyNF?= =?us-ascii?Q?dbTfBB4V2R8TOeTmbrAICejKLWe6WRGhC5pTOnabEnNozgFPaaiFs2hjoc1y?= =?us-ascii?Q?2u0enzd4Yb3cNo3EBeghnenWaFWAUohfvEX6nEt3htHsVgNRzYDkO8usWV16?= =?us-ascii?Q?yFMu1zapllD/yTwp6MNF1AQcPlnKbkJFL0vve/VcERnRXJg9Vrbz5vqQ1w3E?= =?us-ascii?Q?B40RwFZ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tNKZILI6IlHBwm01Y6El?= =?us-ascii?Q?TiU1QvCLMkdIA+KegM/Pa8hudGxoUGC4vZu1sv5G4giM5lMXRThJsJ0JYyq8?= =?us-ascii?Q?md7FRsfRTt8U3Ok1z/GyQXiGQMYA3MFosgPVxfQo/bVJWCFA1B2Gis1514hM?= =?us-ascii?Q?260tr1PhYqvjC6HZgqgLk4LEkmq7UEkPCciRUxaHbzhHzeZ82wNBqfHCGEod?= =?us-ascii?Q?KCE24yAiE/35Ipvw3rcC9F5IVX5vC7890UmueeUMizdAhSwsDj5ttEWJIxDf?= =?us-ascii?Q?BIEZ+6/W/teyUruB81k78dd0YUCN3E6j?= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:KL1PR0601MB5567.apcprd06.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(376014)(52116014)(366016)(1800799024)(38350700014); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?8THBU7EE+zoPDq70RMXbKIKnZiypcaie1I3ohaxzN4Kp7zppvilgS8LXmrcx?= =?us-ascii?Q?KVC8ogQVSWqweEN5OhA1WCMGZFqfzLZpBDx6k7sp/yUeGQiiE/q4dpDD/xLv?= =?us-ascii?Q?lVP2OvyvKOTjB9QzZdPRrFYYzEt2adSY4CtGqKshM6QGsZmA2yaPNTgKDzqR?= =?us-ascii?Q?fvbY+7gm1TBGMVd5ew3td6cQ6FI7V/bGJ8zdSFRvR4Cjql/SHU/pAFz46u2F?= =?us-ascii?Q?bx8H0KPeseIDW1dzbdDdhQUyWny5TPCg5YEj3YYcuDPyeyKd5fw4YIiDXoZM?= =?us-ascii?Q?B2PEl5XCMH0G4EWjmCZ2kKOuNSux8c8p7dLT1MI6FIardCcGIBCsYsdeXSls?= =?us-ascii?Q?EL8zjldpHCsfRAS4i6wCUlLxrlRTbXTpoqU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WAfj8EHffTPIpFcZnB5d2pkdYvymx9uyp7QSOcXvdXJUUfBoQeHmw?= =?us-ascii?Q?ytQlG/6PEdvRAdITtufKmuOmKY9A64mqIKQSMj7TM8wXUTOasZJu+4V+fdrX?= =?us-ascii?Q?Wu0bco7hslT882opNEO9ISBuRBRbwgYKELDDQ4HCj0EyFpzECEBg+chMDqNz?= =?us-ascii?Q?jw4hQd3w2KpVAAla1A07U7wUwOvy0peYs4c8azUD8vnkKqIH2z3jnu8Ry09z?= =?us-ascii?Q?ri8LxBj7bZ9sIcgGmkSW6jhmWegmrs1sKWHlQGJjGAFori0oKhlQiOU1t7Cv?= =?us-ascii?Q?8J/972/ev98+M6ElMrSs3Qvoc80sEeYNCNh0Z4/XZdaxJcelvgLmPCVy4E7p?= =?us-ascii?Q?1Q=3D=3D?= X-OriginatorOrg: jaguarmicro.com X-MS-Exchange-CrossTenant-Network-Message-Id: 11b9f51d-c133-4a0b-ccca-08dd233270c7 X-MS-Exchange-CrossTenant-AuthSource: KL1PR0601MB5567.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Dec 2024 09:16:10.5692 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 1e45a5c2-d3e1-46b3-a0e6-c5ebf6d8ba7b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Gp2PwUtH6EYzAtGAS2eDU7ltRsORhNo7Ri0XHEGT2fME6KavEkloETQWUUJ13RBmevCyE01Xlvv2XenbqhlGGmHX6BGho6azX9dF3mXMe24= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SEYPR06MB6107 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 Support testing the flow tables query rate. Signed-off-by: Sunyang Wu --- :: [Latency | query] All Cores :: Port 0 :: Total query rate -> 951.138132 K Rules/Sec :: [Latency | query] All Cores :: Port 0 :: The time for query 10000 rules is 0.010514 seconds :: [Throughput | query] All Cores :: Port 0 :: Total query rate -> 951.138132 K Rules/Sec :: [Throughput | query] All Cores :: Port 0 :: The average time for query 10000 rules is 0.010514 seconds --- app/test-flow-perf/main.c | 119 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 119 insertions(+) diff --git a/app/test-flow-perf/main.c b/app/test-flow-perf/main.c index 07ddfe0e46..ff9f7b1eaa 100644 --- a/app/test-flow-perf/main.c +++ b/app/test-flow-perf/main.c @@ -75,6 +75,7 @@ static uint16_t dst_ports[RTE_MAX_ETHPORTS]; static volatile bool force_quit; static bool dump_iterations; static bool delete_flag; +static bool query_flag; static bool dump_socket_mem_flag; static bool enable_fwd; static bool unique_data; @@ -129,6 +130,7 @@ static struct lcore_info lcore_infos[RTE_MAX_LCORE]; struct used_cpu_time { double insertion[MAX_PORTS][RTE_MAX_LCORE]; double deletion[MAX_PORTS][RTE_MAX_LCORE]; + double query[MAX_PORTS][RTE_MAX_LCORE]; }; struct __rte_cache_aligned multi_cores_pool { @@ -488,6 +490,7 @@ usage(char *progname) " iteration\n"); printf(" --deletion-rate: Enable deletion rate" " calculations\n"); + printf(" --query-rate: Enable query rate calculations\n"); printf(" --dump-socket-mem: To dump all socket memory\n"); printf(" --enable-fwd: To enable packets forwarding" " after insertion\n"); @@ -656,6 +659,7 @@ args_parse(int argc, char **argv) { "rules-batch", 1, 0, 0 }, { "dump-iterations", 0, 0, 0 }, { "deletion-rate", 0, 0, 0 }, + { "query-rate", 0, 0, 0 }, { "dump-socket-mem", 0, 0, 0 }, { "enable-fwd", 0, 0, 0 }, { "unique-data", 0, 0, 0 }, @@ -883,6 +887,9 @@ args_parse(int argc, char **argv) if (strcmp(lgopts[opt_idx].name, "deletion-rate") == 0) delete_flag = true; + if (strcmp(lgopts[opt_idx].name, + "query-rate") == 0) + query_flag = true; if (strcmp(lgopts[opt_idx].name, "dump-socket-mem") == 0) dump_socket_mem_flag = true; @@ -1375,6 +1382,81 @@ destroy_flows(int port_id, uint8_t core_id, struct rte_flow **flows_list) mc_pool.flows_record.deletion[port_id][core_id] = cpu_time_used; } +static inline void +query_flows(int port_id, uint8_t core_id, struct rte_flow **flows_list) +{ + struct rte_flow_error error; + clock_t start_batch, end_batch; + double cpu_time_used = 0; + double query_rate; + double cpu_time_per_batch[MAX_BATCHES_COUNT] = { 0 }; + double delta; + uint32_t i; + int rules_batch_idx; + int rules_count_per_core; + union { + struct rte_flow_query_count count; + struct rte_flow_action_rss rss_conf; + struct rte_flow_query_age age; + } query; + struct rte_flow_action count_action[] = { + { + .type = RTE_FLOW_ACTION_TYPE_COUNT, + .conf = NULL, + }, + { + .type = RTE_FLOW_ACTION_TYPE_END, + }, + }; + + rules_count_per_core = rules_count / mc_pool.cores_count; + /* If group > 0 , should add 1 flow which created in group 0 */ + if (flow_group > 0 && core_id == 0) + rules_count_per_core++; + + memset(&query, 0, sizeof(query)); + start_batch = rte_get_timer_cycles(); + for (i = 0; i < (uint32_t)rules_count_per_core; i++) { + if (flows_list[i] == 0) + break; + + memset(&error, 0x33, sizeof(error)); + if (rte_flow_query(port_id, flows_list[i], + count_action, &query, &error)) { + print_flow_error(error); + rte_exit(EXIT_FAILURE, "Error in deleting flow\n"); + } + + /* + * Save the query rate for rules batch. + * Check if the query reached the rules + * patch counter, then save the query rate + * for this batch. + */ + if (!((i + 1) % rules_batch)) { + end_batch = rte_get_timer_cycles(); + delta = (double)(end_batch - start_batch); + rules_batch_idx = ((i + 1) / rules_batch) - 1; + cpu_time_per_batch[rules_batch_idx] = delta / rte_get_timer_hz(); + cpu_time_used += cpu_time_per_batch[rules_batch_idx]; + start_batch = rte_get_timer_cycles(); + } + } + + /* Print query rates for all batches */ + if (dump_iterations) + print_rules_batches(cpu_time_per_batch); + + /* query rate for all rules */ + query_rate = ((double)(rules_count_per_core / cpu_time_used) / 1000); + printf(":: Port %d :: Core %d :: Rules query rate -> %f K Rule/Sec\n", + port_id, core_id, query_rate); + printf(":: Port %d :: Core %d :: The time for query %d rules is %f seconds\n", + port_id, core_id, rules_count_per_core, cpu_time_used); + + mc_pool.flows_record.query[port_id][core_id] = cpu_time_used; +} + static struct rte_flow ** insert_flows(int port_id, uint8_t core_id, uint16_t dst_port_id) { @@ -1526,6 +1608,9 @@ flows_handler(uint8_t core_id) rte_exit(EXIT_FAILURE, "Error: Insertion Failed!\n"); mc_pool.current_alloc[core_id] = (int64_t)dump_socket_mem(stdout); + if (query_flag) + query_flows(port_id, core_id, flows_list); + /* Deletion part. */ if (delete_flag) { destroy_flows(port_id, core_id, flows_list); @@ -1552,8 +1637,11 @@ dump_used_cpu_time(const char *item, double insertion_throughput_time; double deletion_latency_time; double deletion_throughput_time; + double query_latency_time; + double query_throughput_time; double insertion_latency, insertion_throughput; double deletion_latency, deletion_throughput; + double query_latency, query_throughput; /* Save first insertion/deletion rates from first thread. * Start comparing with all threads, if any thread used @@ -1569,30 +1657,40 @@ dump_used_cpu_time(const char *item, insertion_latency_time = used_time->insertion[port][0]; deletion_latency_time = used_time->deletion[port][0]; + query_latency_time = used_time->query[port][0]; insertion_throughput_time = used_time->insertion[port][0]; deletion_throughput_time = used_time->deletion[port][0]; + query_throughput_time = used_time->query[port][0]; i = mc_pool.cores_count; while (i-- > 1) { insertion_throughput_time += used_time->insertion[port][i]; deletion_throughput_time += used_time->deletion[port][i]; + query_throughput_time += used_time->query[port][i]; if (insertion_latency_time < used_time->insertion[port][i]) insertion_latency_time = used_time->insertion[port][i]; if (deletion_latency_time < used_time->deletion[port][i]) deletion_latency_time = used_time->deletion[port][i]; + if (query_throughput_time < used_time->query[port][i]) + query_throughput_time = used_time->query[port][i]; } insertion_latency = ((double) (mc_pool.rules_count / insertion_latency_time) / 1000); deletion_latency = ((double) (mc_pool.rules_count / deletion_latency_time) / 1000); + query_latency = ((double)(mc_pool.rules_count + / query_latency_time) / 1000); insertion_throughput_time /= mc_pool.cores_count; deletion_throughput_time /= mc_pool.cores_count; + query_throughput_time /= mc_pool.cores_count; insertion_throughput = ((double) (mc_pool.rules_count / insertion_throughput_time) / 1000); deletion_throughput = ((double) (mc_pool.rules_count / deletion_throughput_time) / 1000); + query_throughput = ((double)(mc_pool.rules_count + / query_throughput_time) / 1000); /* Latency stats */ printf("\n%s\n:: [Latency | Insertion] All Cores :: Port %d :: ", @@ -1630,6 +1728,26 @@ dump_used_cpu_time(const char *item, printf("The average time for deleting %d rules is %f seconds\n", mc_pool.rules_count, deletion_throughput_time); } + + if (query_flag) { + /* Latency stats */ + printf(":: [Latency | query] All Cores :: Port %d :: Total " + "query rate -> %f K Rules/Sec\n", + port, query_latency); + printf(":: [Latency | query] All Cores :: Port %d :: ", + port); + printf("The time for querying %d rules is %f seconds\n", + mc_pool.rules_count, query_latency_time); + + /* Throughput stats */ + printf(":: [Throughput | query] All Cores :: Port %d :: Total " + "query rate -> %f K Rules/Sec\n", + port, query_throughput); + printf(":: [Throughput | query] All Cores :: Port %d :: ", + port); + printf("The average time for querying %d rules is %f seconds\n", + mc_pool.rules_count, query_throughput_time); + } } static void @@ -2120,6 +2238,7 @@ main(int argc, char **argv) rules_count = DEFAULT_RULES_COUNT; rules_batch = DEFAULT_RULES_BATCH; delete_flag = false; + query_flag = false; dump_socket_mem_flag = false; flow_group = DEFAULT_GROUP; unique_data = false; -- 2.19.0.rc0.windows.1