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 C516245F1E; Mon, 23 Dec 2024 09:36:14 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5F80040263; Mon, 23 Dec 2024 09:36:14 +0100 (CET) Received: from SEYPR02CU001.outbound.protection.outlook.com (mail-koreacentralazon11023099.outbound.protection.outlook.com [40.107.44.99]) by mails.dpdk.org (Postfix) with ESMTP id B1C0240156 for ; Mon, 23 Dec 2024 09:36:12 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Go2bIkvTPE2YXSQfmk/Bwu3dP75CTTRrkXFKEkOeMgJ+3jZta+COZKX67ooo7DdBnKiV9fBDfxtDWE/RcfYaS5UzNJpis9jOoT7E5RYEoiK6VEhtRjA/qnsstyidfeWLUA/9Ov5r/lvdmog4VhbivGwDss3JRxA+jp1Ya4SBULZXkBVnOQui/eoHTE7lSkqVSdUDlAj34fikJ8znPIvvKu8dOn4xyZqaAeVVdz55qwxs3DNg4D/ZO1CoYfymHA0kuhmMWzRJamx8tE8GmxDxchE7pXJaChSzpNMuAS1iZW7/W+e5d81+jzRd2UxX36lQvNvf394fQCk7nbtm9Byd1Q== 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=ixTduAwYtobs3LkxiDWukZSCG14B0fQVLUdgL/aixjI=; b=hEiPV9scnwjxz/E4Zgi6VSsMZhEsdlJAMVvJybakeF06QxvxgS5E+tzqBf2KoNrzu39xWVyUSVtNWes5ynB4i2SQgnvq7Lex9fEX02hD9nS1Y9cbfgJnKwHUhaSZWBOgukMczhKhrulx4nlG3pHsuyu8wzbXJHvQketKpP5sbo8TvnDYBKEa05kvQrdzAuLAd0tH89xwVuHlKkPNYK4oOo1G29gTItQPQFFFUPFNUhrTcZw5QMOSi9fntc+bSelHYntgEm6WYTQThXwGk44HJhHuVtf/SOeWz8qsqJjIMOd5vxbbSzhDBOpPl9c59WRYC5bf1PPVNzecQKWcNvXNpA== 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=ixTduAwYtobs3LkxiDWukZSCG14B0fQVLUdgL/aixjI=; b=EGYK+VQetChKGrWnT+j+ntOrZh4+oyqF/26vSY1LA4qBos25yszHxqQubIhepD8lRuWJppWbzJMF71wQ2mSzxN6TP26MoBalfueQ0GdFsj+eympGD2YMj0aXpjZTUaY9XGWl3gEVwqLCv2/lPNwRwicteGRMW29upj+QdrTQGEib9rN7veFEza8dY0/PWWK2r3Gg9LdLxsg4/8IUty9pEPqPLJrC66m3IV2wDUewgEejSFT8j+GDUdNArO0w6Wn/uMEMrAC3beZQBrGxYO+F3cxB8x1ETxgQdjAGk42dU2B8PBwuWhchEihdndTj3V0LjFFhmtVx0Ffdj0cml1euaw== 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 JH0PR06MB6558.apcprd06.prod.outlook.com (2603:1096:990:30::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8293.12; Mon, 23 Dec 2024 08:36:09 +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 08:36:08 +0000 From: Sunyang Wu To: dev@dpdk.org Cc: wisamm@nvidia.com Subject: [PATCH] app/test-flow-perf: support testing the flow table query rate Date: Mon, 23 Dec 2024 16:35:54 +0800 Message-Id: <20241223083554.37784-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: SG2PR02CA0047.apcprd02.prod.outlook.com (2603:1096:3:18::35) To KL1PR0601MB5567.apcprd06.prod.outlook.com (2603:1096:820:c5::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: KL1PR0601MB5567:EE_|JH0PR06MB6558:EE_ X-MS-Office365-Filtering-Correlation-Id: 798faea5-7d4d-4647-afcf-08dd232cd907 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|52116014|376014|366016|38350700014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?fRpOL5eOpQsFPO4rvbSpdDqzR7uCwLn/++Kqe40JoAYQS9ki0y9DAvn/wBtj?= =?us-ascii?Q?ncjoQGcQN0Mx/AKoYktbVPs5C/x8g0j55xSa4Auq9OE16dpHVcaO4P2MKZ64?= =?us-ascii?Q?SRzfUUQRzP9TemDmFbkl8ox2il+p+lDgtYTQ7usTco0yjViGxi2fHh/vqAkd?= =?us-ascii?Q?GenGsmucesGeqqE9oFUm7vdHW8YEBbTdEGEoCIwWJrP1uY4VupsFf41iAiCt?= =?us-ascii?Q?1Z8sgEMzvPNU7Am9Acbpyknbr0+/vbC3ZCdtQHfEzMkZSPmvK9Z8If2PakUF?= =?us-ascii?Q?eT8BMKz11iT/EEh9aR7w+25ox3nwGf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q?j/Y6nOej6lWdI54HQsn/Hsl+tYQP6AtUbOP7Q/BHAKPIbRONBWdWMewtK/mk?= =?us-ascii?Q?UEf8cRdXP7vOgrsQvXEuk7H9FvHCNhn2SdIZdwkJ+9ncwUEp8dRGNcfLz22g?= =?us-ascii?Q?Qo5S0Ok9ok/ZSahw53T2xj9rkW8zKQT648AkjFnhLEq5b/8A6cVFaEYkF8VN?= =?us-ascii?Q?VrRoIzix1Y4Z4AtzuGVtzyCgqBOLm2wC9KQt2qHJ9LsEeuNq8hZTcm7x/kuq?= =?us-ascii?Q?Y/0TxrHnAE0xCz+RZ8ZoDs06lqJYS2L1?= 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)(1800799024)(52116014)(376014)(366016)(38350700014); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?AjKKT+1ym/V1Rd1Q1YqsA3fyTM4ncB3eywau393Yz5O9+dNdogMqX/yinQj1?= =?us-ascii?Q?Y8NlUPEFitD2FrHYATu/xnIw9S8J8xbByjBov19eM41gcIz6NJI4w/4rkQg1?= =?us-ascii?Q?eEK+sT88eqvCn9CrNIlFyS0xjCKxZtIiauv5XUl8pqhNwZqXuBlCmX8U34tf?= =?us-ascii?Q?a/othXt9Y2SZjdaeeWSP7QV3FAlqKUvIw0ddoPzoZ6t6GKvOy4DH73OdKKh3?= =?us-ascii?Q?sM5ZaaEtBvsPP4i6ex7ppe7NKkG+BCuOUVGIJEwc+fZOrwR1vvh0/VJqWj9J?= =?us-ascii?Q?OJVMYVPCXaqc763s4J/XHi4nZc24dzDj3Ils3gpMZXRuuZ3vv4VaRcPeb1Nc?= =?us-ascii?Q?uWvjzV77R95PuXNnaY5ZPHi0vCDlwJO6F8cbY+4z7KVZ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S6dw0wHC86WUM8DCrg6EmZnjFw27ktZTq8dakeo1J?= =?us-ascii?Q?S77dr9b8BzWDNVTQAqpDGuaudOpyiqTyCVgGsX4JEa3kfMvanyGvBFg06LgS?= =?us-ascii?Q?dv3b3U6hu55zxuxv0+9hOlMdVFOldkUWumr2GEtyOGxdi7rsWu5fJ5CxcHUU?= =?us-ascii?Q?xDRaiAvIx/NrLNvmANvEWRMDBkN7el0Tovv5MmySvWeY0MVwhFgjAoV2mWqF?= =?us-ascii?Q?C/+M479/up+jRkqfWNFv1QbYV1jyLKV7XUz5dmKWPGnqOEIIGZTcsngGngsC?= =?us-ascii?Q?ZI/isaBmPL60w836NvzY4V5JxlDePGe4aUF02OX4KbkFvDl8rtrzNrGK23fb?= =?us-ascii?Q?Ng=3D=3D?= X-OriginatorOrg: jaguarmicro.com X-MS-Exchange-CrossTenant-Network-Message-Id: 798faea5-7d4d-4647-afcf-08dd232cd907 X-MS-Exchange-CrossTenant-AuthSource: KL1PR0601MB5567.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Dec 2024 08:36:08.5512 (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: jVlxXvbzoZqg3k92iM9jgpcQE8lqRENV/Mz9whFqjJD6DRjj06Dcj8ESmKtxrpNGMm+YfSPXOG2//P2wKy8sDpDXLKWu0HguzEratIZ34L0= X-MS-Exchange-Transport-CrossTenantHeadersStamped: JH0PR06MB6558 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 | 118 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 118 insertions(+) diff --git a/app/test-flow-perf/main.c b/app/test-flow-perf/main.c index 07ddfe0e46..56dbee5ef3 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) { @@ -1532,6 +1614,8 @@ flows_handler(uint8_t core_id) if (has_meter()) meters_handler(port_id, core_id, METER_DELETE); } + if (query_flag) + query_flows(port_id, core_id, flows_list); } } @@ -1552,8 +1636,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 +1656,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 +1727,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 +2237,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