From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 3622FA00C5; Thu, 30 Apr 2020 11:33:25 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 700F51DABD; Thu, 30 Apr 2020 11:33:05 +0200 (CEST) Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-eopbgr60077.outbound.protection.outlook.com [40.107.6.77]) by dpdk.org (Postfix) with ESMTP id 9940D1DAA1 for ; Thu, 30 Apr 2020 11:32:58 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dEjJmyUbfeiaqbRCRQusCuLjTktIJflW783fTUeqF7ooYZ57m5vFEZviNaXEPPwlUw0RY8oFHDtGEnRXNWCMMPzSAY6AO/xAmPCBIJU31kcY/Z3uj3PXTfDJHga6lW9Jz4ErGA2p37KzzHldyxidbEkEFT5dz6ZJszn7ZiH/8pLdg8o3k6sh+EIupijZ3iT7xyYSD2bF54vVb6H/0QMm3ZKNZH+nmJ7+TjWgYWbXHDWHSBWevHOuwj1waB7Yx2Zq+NRhAf+azWRWsk4QO+Lf0TIMLJBtjsWKNcgJZ06f9uYr8nJ5N1LZACP5bGdQJAbfkm9TNOcwnKWLzyVsarVlOg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=/JPS9nBFecP3i7j+LBVqNPEi4Zw5EzfYImU+GN1vMzg=; b=KYfNH7NYB3YvXktNM0SGZhfOxrzUF1KCJO9blihyvtkDJHbMzj3FtiiR27DCcpp+8ENq43GP0dVJ9Vcbd9cpAEHdkl4mMyWPlQobafKzyPTO0skoJO18rzXtisY/ZZ9OfJPxbT39xcu09+4q3tKNwfcI6WzWa2zigMjW153AmNvME7GvBMx4ElG3t4hCEDpnfxKuxuPHVg4MH0zrCDj9N3FbXpvX7tLy6AVLDc+UlTG5I1E7lO5xjMdQpXUy0V8InQstayXXvyEXFi9zdKsOdQBtMqx+T5UTxN9Muq5XNNXkmA1b4sy2Wjhlk0QZcpX12lVCtf8pbtS2wnAfBnsjmg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=mellanox.com; dmarc=pass action=none header.from=mellanox.com; dkim=pass header.d=mellanox.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=/JPS9nBFecP3i7j+LBVqNPEi4Zw5EzfYImU+GN1vMzg=; b=VAWSrWuJazf9EgcF8NFvWFi4HIsez/o5JN2rR8oac/Q6LzuXuc5FHgtNUpbSnRDPAfM0OYXXA1dn2+HUYbBNwihYO/ULlv2Tzke0jcwuU0S3paFvp50pKz+WvSG+HZhaF6Kq+bsARmGZxbT/vX0tvTTLaUnhisO1Q2yRrw8HDiw= Authentication-Results: mellanox.com; dkim=none (message not signed) header.d=none;mellanox.com; dmarc=none action=none header.from=mellanox.com; Received: from AM0PR05MB6610.eurprd05.prod.outlook.com (2603:10a6:208:12f::18) by AM0PR05MB6419.eurprd05.prod.outlook.com (2603:10a6:208:142::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2937.13; Thu, 30 Apr 2020 09:32:56 +0000 Received: from AM0PR05MB6610.eurprd05.prod.outlook.com ([fe80::900:c0ac:78bd:18fc]) by AM0PR05MB6610.eurprd05.prod.outlook.com ([fe80::900:c0ac:78bd:18fc%6]) with mapi id 15.20.2937.028; Thu, 30 Apr 2020 09:32:56 +0000 From: Wisam Jaddo To: jackmin@mellanox.com, thomas@monjalon.net, jerinjacobk@gmail.com, gerlitz.or@gmail.com, l.yan@epfl.ch, dev@dpdk.org Date: Thu, 30 Apr 2020 09:32:47 +0000 Message-Id: <20200430093249.6772-4-wisamm@mellanox.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200430093249.6772-1-wisamm@mellanox.com> References: <20200430070823.24046-2-wisamm@mellanox.com> <20200430093249.6772-1-wisamm@mellanox.com> Content-Type: text/plain X-ClientProxiedBy: PR0P264CA0107.FRAP264.PROD.OUTLOOK.COM (2603:10a6:100:19::23) To AM0PR05MB6610.eurprd05.prod.outlook.com (2603:10a6:208:12f::18) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from mellanox.com (37.142.13.130) by PR0P264CA0107.FRAP264.PROD.OUTLOOK.COM (2603:10a6:100:19::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2958.20 via Frontend Transport; Thu, 30 Apr 2020 09:32:55 +0000 X-Mailer: git-send-email 2.17.1 X-Originating-IP: [37.142.13.130] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: b5d79593-5998-4a04-947d-08d7ece976c2 X-MS-TrafficTypeDiagnostic: AM0PR05MB6419:|AM0PR05MB6419: X-LD-Processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2000; X-Forefront-PRVS: 0389EDA07F X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM0PR05MB6610.eurprd05.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(4636009)(366004)(396003)(376002)(346002)(39860400002)(136003)(2616005)(956004)(7696005)(52116002)(2906002)(16526019)(186003)(26005)(5660300002)(316002)(1076003)(8936002)(86362001)(36756003)(8676002)(478600001)(66946007)(66556008)(66476007)(55016002)(6666004)(8886007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uU44vwua4Uz/l96Ne22B5qEYmT7y6U0jR/V3DLObu+V3reVJB9BAwK+Vd3vKr83nk9IYNCZb7eRlZv2ruEOhTPpNlt8rCxVCQiYGKrjKfvG7xP+v+m3JO8k2/gYoIc7/s4UIYCFhRImbtWVoO2rOmdRCyGCyXhCuAB3dNNq5qgDBAzjFDBhrAy26oVoq3+GmbCNx9tPckpP2Ug1aL8cMFe+9Msw2LE2VmvF/GWiF1oiFWRT3a9zcCFBn5qlyf3y2CB4t0H3+29oWoOa2DVR6PEmHlpA46t3ds= X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: b5d79593-5998-4a04-947d-08d7ece976c2 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Apr 2020 09:32:56.2651 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: JB6BOvo3jOnlX6QfLNBScIWg7xPo4N3NAjbCf71XhvsTxHCz2n6v0GEDc/1LuPrWo4cLwF8bfsTgVQ3kfWIheA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR05MB6419 Subject: [dpdk-dev] [PATCH v3 3/5] app/test-flow-perf: add deletion rate calculation X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Add the ability to test deletion rate for flow performance application. This feature is disabled by default, and can be enabled by add "--deletion-rate" in the application command line options. Signed-off-by: Wisam Jaddo --- app/test-flow-perf/main.c | 86 ++++++++++++++++++++++++++++++++++ doc/guides/tools/flow-perf.rst | 4 ++ 2 files changed, 90 insertions(+) diff --git a/app/test-flow-perf/main.c b/app/test-flow-perf/main.c index 115af4f302..7c11c0b577 100644 --- a/app/test-flow-perf/main.c +++ b/app/test-flow-perf/main.c @@ -62,6 +62,7 @@ static uint16_t flow_actions; static uint8_t flow_attrs; static volatile bool force_quit; static volatile bool dump_iterations; +static volatile bool delete_flag; static struct rte_mempool *mbuf_mp; static uint32_t nb_lcores; static uint32_t flows_count; @@ -75,6 +76,8 @@ static void usage(char *progname) " flows to insert, default is 4,000,000\n"); printf(" --dump-iterations: To print rates for each" " iteration\n"); + printf(" --deletion-rate: Enable deletion rate" + " calculations\n"); printf("To set flow attributes:\n"); printf(" --ingress: set ingress attribute in flows\n"); @@ -123,6 +126,7 @@ args_parse(int argc, char **argv) { "help", 0, 0, 0 }, { "flows-count", 1, 0, 0 }, { "dump-iterations", 0, 0, 0 }, + { "deletion-rate", 0, 0, 0 }, /* Attributes */ { "ingress", 0, 0, 0 }, { "egress", 0, 0, 0 }, @@ -304,6 +308,8 @@ args_parse(int argc, char **argv) } if (!strcmp(lgopts[opt_idx].name, "dump-iterations")) dump_iterations = true; + if (!strcmp(lgopts[opt_idx].name, "deletion-rate")) + delete_flag = true; break; default: usage(argv[0]); @@ -323,9 +329,75 @@ print_flow_error(struct rte_flow_error error) error.message ? error.message : "(no stated reason)"); } +static inline void +destroy_flows(int port_id, struct rte_flow **flow_list) +{ + struct rte_flow_error error; + clock_t start_iter, end_iter; + double cpu_time_used = 0; + double flows_rate; + double cpu_time_per_iter[MAX_ITERATIONS]; + double delta; + uint32_t i; + int iter_id; + + for (i = 0; i < MAX_ITERATIONS; i++) + cpu_time_per_iter[i] = -1; + + if (iterations_number > flows_count) + iterations_number = flows_count; + + /* Deletion Rate */ + printf("Flows Deletion on port = %d\n", port_id); + start_iter = clock(); + for (i = 0; i < flows_count; i++) { + if (!flow_list[i]) + break; + + memset(&error, 0x33, sizeof(error)); + if (rte_flow_destroy(port_id, flow_list[i], &error)) { + print_flow_error(error); + rte_exit(EXIT_FAILURE, "Error in deleting flow"); + } + + if (i && !((i + 1) % iterations_number)) { + /* Save the deletion rate of each iter */ + end_iter = clock(); + delta = (double) (end_iter - start_iter); + iter_id = ((i + 1) / iterations_number) - 1; + cpu_time_per_iter[iter_id] = + delta / CLOCKS_PER_SEC; + cpu_time_used += cpu_time_per_iter[iter_id]; + start_iter = clock(); + } + } + + /* Deletion rate per iteration */ + if (dump_iterations) + for (i = 0; i < MAX_ITERATIONS; i++) { + if (cpu_time_per_iter[i] == -1) + continue; + delta = (double)(iterations_number / + cpu_time_per_iter[i]); + flows_rate = delta / 1000; + printf(":: Iteration #%d: %d flows " + "in %f sec[ Rate = %f K/Sec ]\n", + i, iterations_number, + cpu_time_per_iter[i], flows_rate); + } + + /* Deletion rate for all flows */ + flows_rate = ((double) (flows_count / cpu_time_used) / 1000); + printf("\n:: Total flow deletion rate -> %f K/Sec\n", + flows_rate); + printf(":: The time for deleting %d in flows %f seconds\n", + flows_count, cpu_time_used); +} + static inline void flows_handler(void) { + struct rte_flow **flow_list; struct rte_flow_error error; clock_t start_iter, end_iter; double cpu_time_used; @@ -337,6 +409,7 @@ flows_handler(void) int port_id; int iter_id; uint32_t eagain_counter = 0; + uint32_t flow_index; nr_ports = rte_eth_dev_count_avail(); @@ -348,8 +421,14 @@ flows_handler(void) printf(":: Flows Count per port: %d\n", flows_count); + flow_list = rte_zmalloc("flow_list", + (sizeof(struct rte_flow *) * flows_count) + 1, 0); + if (flow_list == NULL) + rte_exit(EXIT_FAILURE, "No Memory available!"); + for (port_id = 0; port_id < nr_ports; port_id++) { cpu_time_used = 0; + flow_index = 0; if (flow_group > 0) { /* * Create global rule to jumo into flow_group @@ -366,6 +445,7 @@ flows_handler(void) print_flow_error(error); rte_exit(EXIT_FAILURE, "error in creating flow"); } + flow_list[flow_index++] = flow; } /* Insertion Rate */ @@ -389,6 +469,8 @@ flows_handler(void) rte_exit(EXIT_FAILURE, "error in creating flow"); } + flow_list[flow_index++] = flow; + if (i && !((i + 1) % iterations_number)) { /* Save the insertion rate of each iter */ end_iter = clock(); @@ -422,6 +504,9 @@ flows_handler(void) printf(":: The time for creating %d in flows %f seconds\n", flows_count, cpu_time_used); printf(":: EAGAIN counter = %d\n", eagain_counter); + + if (delete_flag) + destroy_flows(port_id, flow_list); } } @@ -580,6 +665,7 @@ main(int argc, char **argv) force_quit = false; dump_iterations = false; + delete_flag = false; flows_count = 4000000; iterations_number = 100000; flow_group = 0; diff --git a/doc/guides/tools/flow-perf.rst b/doc/guides/tools/flow-perf.rst index 62e038c430..e07e659df5 100644 --- a/doc/guides/tools/flow-perf.rst +++ b/doc/guides/tools/flow-perf.rst @@ -18,6 +18,8 @@ give different flow each time, and all other items will have open masks. The current design have single core insertion rate. In the future we may have a multi core insertion rate measurement support in the app. +The application also provide the ability to measure rte flow deletion rate. + Compiling the Application ========================= @@ -89,6 +91,8 @@ The command line options are: Print rates for each iteration of flows. Default iteration is 1,00,000. +* ``--deletion-rate`` + Enable deletion rate calculations. Attributes: -- 2.17.1