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 C907645F1E; Mon, 23 Dec 2024 09:48:10 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A46A14064A; Mon, 23 Dec 2024 09:48:10 +0100 (CET) Received: from HK3PR03CU002.outbound.protection.outlook.com (mail-eastasiaazon11021112.outbound.protection.outlook.com [52.101.129.112]) by mails.dpdk.org (Postfix) with ESMTP id 89947402DC for ; Mon, 23 Dec 2024 09:48:08 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=ShGIunyXcPxss7+9PBNmKOGa2XliLfbvSx66HKxC2JNMsvVjZyEA5u44nO+Ieyo7l/Yvejo9NcDQyIza0jWYGGH7+Qdx2HadO35oQmIaprzcO85/nehnteomnmEqJGeyTpOTALnIpz384h8RFs6jxeBVb9qan6Lk+G5gfVAJ04wATvSLzS7MdTnELrFto2F1BDoUkfa30EHFGDnsAKtEyoST8Q9+BeQsBQjHk0YglDbaGMSj0rbiy1a7/qnujU3zkj9BtGJi+wkfVwXH2rRlc73I3kS4714DKp+JkyANsR+1G1xGt4p5WnZJv+gJ/RTJERnQ5FapvQzMBFo6ydnfVA== 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=f2C8acvyy4MCK/p6Bnt1kugxGn/++2Y+Dc5USL75XbA=; b=S4VPNb+Su9hgAQEU6TYIZh5GkTnYcigjyVsR699j+rVrSwBICZnPedblzqPOebvylpmTWsLN67Sz6YXVBR3iru5eOXg+GvVQRUaSAsPfhi7y5+AVmapqJ/oM97bMe5buyw6IehGeA7jnuh52oAlTu87kPE7w6IEmQTv4/orTe0GB4/Cy9GELf9pU9pm46WANrkrn2rC9/SKl8bmWo4FOdoG5+I7inCc0CCszMiX12snQv2slKFuxqEpQs7GN/pwz6KNgtMON5XHERUfmNPX6FVevdZ0DGgd29VSGCjjF8tpv7S0IWd1jKQmvtppRTd9I/6TyKkiMYlxinIj+lCQkUg== 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=f2C8acvyy4MCK/p6Bnt1kugxGn/++2Y+Dc5USL75XbA=; b=SDxVCRfWcUDnTWEqMIFn1WFUCAK9qJp7YzyZGSQYQM6MPBnCeqD3Q5oBgKJebSASk/VJs7pQOUkZit0LF7crh+/JLIeDhZjKokJUdw06eJvrMd+W0K54Kte/ZQkYFoMuz3wQg8OEvDUTMFkgjJpWyRUKze2WdZ0JNoQ1d2AVXtUljN5j9RQHUUuk3PSVH/qnOUJv58n61cPrKv5dzklm3rbBkg1W0kfJVX/QuWnqFkhtoRIfFogozMk9DaCZFAnsW9DZoj9Smu9f0s9WEsWiuaiLNB2ADl43TF/pVr4V1sXSrLzKW8rY88XI3IlU9vifsYfdM6eUZMnHLquN1XGq+w== 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 SI2PR06MB5140.apcprd06.prod.outlook.com (2603:1096:4:1af::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8293.7; Mon, 23 Dec 2024 08:48:05 +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:48:05 +0000 From: Sunyang Wu To: dev@dpdk.org Cc: wisamm@nvidia.com Subject: [PATCH v2] app/test-flow-perf: support testing the flow tables query rate Date: Mon, 23 Dec 2024 16:47:52 +0800 Message-Id: <20241223084752.38200-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: TY2PR01CA0005.jpnprd01.prod.outlook.com (2603:1096:404:a::17) To KL1PR0601MB5567.apcprd06.prod.outlook.com (2603:1096:820:c5::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: KL1PR0601MB5567:EE_|SI2PR06MB5140:EE_ X-MS-Office365-Filtering-Correlation-Id: 5aa04f80-80a0-4724-78b5-08dd232e8474 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|366016|52116014|376014|1800799024|38350700014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?pgNrxd0A1pZuzvNuSqE2NbgmN83C4+6Eyter2rvhfDfqWL9EJV72UWI5wwWq?= =?us-ascii?Q?0Kwc/IAsLAxIAVm6D+IPiaro6P1zh5OmPEShAbzlTLoZgb83exB9C+CC+Hei?= =?us-ascii?Q?sFi7nSQDMv9wgfooVcySyBJpbfFgtGLjO580Rhc5XdPdGluHWCRgxtBLTbSz?= =?us-ascii?Q?pQAbBL3UoEnVmzNCq5KGLUQMaIYIxWcsFpm6Xy/5TNYOyqSaAg1EkcRGqLDI?= =?us-ascii?Q?cq5MD3lBOG5B5TtG/p3FDeelgBeob6xl8j3FlaXNULNXqVnWLMEefo7VKFgQ?= =?us-ascii?Q?JXjWaVUZ4IuwplV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0az0UTk?= =?us-ascii?Q?hAu5tC9WTWW1o/GSqdkNa0NgMqfrkGg3IdKZw6iV+FjtQLzVME/gxLqJjnhu?= =?us-ascii?Q?fKez/m+ihCPL2Nxpb0OHI2pdD9QgklcK8jnKkfiKg5QTiV4xFN4Mg/eHSe95?= =?us-ascii?Q?x6e4fidSdgmWFm1Cs9BNLdTQBZN+1VV2iSYMtLpS8MbxrwTBmjkywke/U3c9?= =?us-ascii?Q?3MATenZOwx2V6pVCESr0WRqDKNu1QH0J0QY76JMojoJe2wkXxPOJBkWr6Yu3?= =?us-ascii?Q?3vmcaA5R2m7XwT6u+NiBh1/i76wRzF4C?= 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)(366016)(52116014)(376014)(1800799024)(38350700014); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?ViuasJAJKDO8ZElVyCgw/HnZhJq9c2O5n2rvqXW5Ti1bakw0B6U8ldsSugNX?= =?us-ascii?Q?3qrVpxC5S6tF2Sbpb5ovpg/s+z3hC0RyrjsA7RXKPodnIzOu2NcT0wn/MiUT?= =?us-ascii?Q?UVJ61/R7akgM6Hbfak13Bu70YKXXV1s4DoRmV4a71Wsf1ZfjzC++yPtDxDnw?= =?us-ascii?Q?MNruyrHkFWlUfVEl28SBHN7bhJ1LlZyLDKXBSgq7G5bkCWabicGBS3CYAyw6?= =?us-ascii?Q?4QhJLvG9kPjYsNDIxlwlY+R1dd5pzAkI73BOjVY8h+wQhwL1SbFpEHgWlSmn?= =?us-ascii?Q?DcHkHyEK2Pdnq8UifLfv0ZO7YD07GKZcGmQ826lsaeZJXzLhioD3mKBUhbbd?= =?us-ascii?Q?CkE+HSygPkuGGIYfjn6vr7OQu6RMcFgvqD5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osPEliZpRE5xopk5q5nyeSHQC6JcPwuuccb/O8T0CdKTJ9ZeXJOqFGcER?= =?us-ascii?Q?g5EAH14wfDBGe7CI6X/ZX2bsddd85cJxlOhB/xstV4kwUCS23lKZoSFtVDw1?= =?us-ascii?Q?OlIBOSl/9Ya/e3sgE7dEylrvn1WohKIJwvhab5cILHHV2ZfHHMTMnELNJkPt?= =?us-ascii?Q?YfLloxI7yZsqAFduH5A1fS2pAV02X8ulINrj09zYAJkN7b3l22tnEArmd+jr?= =?us-ascii?Q?bg/g9Nkovmcf+tR6/4oH0/wxSNvjavBOMVCdyWlnrHCmx8V4jy379FeZkvjw?= =?us-ascii?Q?+prhUeOQgIdt5fuTujnXVfuodsWVa5w5gT8iboT1JrGE27GG+KmJL9lcARLB?= =?us-ascii?Q?kg=3D=3D?= X-OriginatorOrg: jaguarmicro.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5aa04f80-80a0-4724-78b5-08dd232e8474 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:48:05.6012 (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: ojCMHdkL/wjNnSf7NTjAPDnfOjcFtKECmLyAylNS3uzH7yAy+TteCKrp0aPU293Id40E6kqGDpo6ux6NXNgW2kAFOpiy4atTgqiSp/qFL7k= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SI2PR06MB5140 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..f0a6ba7f8a 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