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 9554AA00C4; Thu, 4 Jun 2020 15:35:58 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 32C101D5F7; Thu, 4 Jun 2020 15:35:29 +0200 (CEST) Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2080.outbound.protection.outlook.com [40.107.20.80]) by dpdk.org (Postfix) with ESMTP id EA9D81D5F5 for ; Thu, 4 Jun 2020 15:35:26 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Uqis970+IV88J0RqItUteKTaI3vdfMN/WrGFF8frpndP+ioWpwMUFwszwT44AaOKEtDjsDsapu4H8K+LaQ0ubiE5T6mPW6FWcnZpKHpE8St+IW2T7GmBpyjzjSg/OaFg76f23E0XSLW+wXOI7B6TKdn3DS4sxTBb3siwQY27BzqM0gt2cKGygkr+K6bH5GWZxDDc+TQ8792O/IY0M7jfnkHl6odXtSuMSsr6eSGoBGiebJvSptzDVWAgTQE1mNSFPivfcAGvYCG50ruMwCS0zMcvYpaCsBULHsOzCMU/XLOTH/J25ZzNxJ8kwK7aUx1BZ+7c2Mdd6K6nLf+RgQN19g== 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=QqhkntZPGrb+/1hPLH7jvGgmBvh72PJDBBDAB2B2DGs=; b=EuqYsM+2wZKW+YvmddKbhDWkYmW+pjhB1bDWgz+BOxioI7bg4sVEp2N4b+y2bd5kBMzaz2AYkIZhmRUT0rccFELX1KU3aPjBpz9qnIS7VsuGefHcNV34gUIv5ObTCFSLY6RkiQPUnplBFVBOvQLQRkTNUfOOgDPQTU1DaKIcR0mR95dz5lt6cys7eYWLGMEK51ucyCTnLjvRvS2k7QQbIQ81/9wRO2utVw8L8SnHJqA82ribpmE2FknCBHQUw2md1+6AS2XxMPu6g6LSIkPwO1zn5XKiDI3mMyTNqrsiTj0Ack2O5DMDWX3yEbLvgTNtmKoUBqS3mOA0VnwQBLIJEg== 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=QqhkntZPGrb+/1hPLH7jvGgmBvh72PJDBBDAB2B2DGs=; b=qVhYOKsV2DR/39eRfwh8V6oVCIN2ocxAa8PJ4/4k3azKS/vBJlh2w1wzUZPmZEQxh8K7tZecAustvz/kTchY1FvnAj3Q3e5oihA6kwS2mmVVe1fB0sAllgcmPY24JVeFRRD0c/SSTD3D9U4AxkZLH1OVTzEqa5y8951loF94SwU= Authentication-Results: solarflare.com; dkim=none (message not signed) header.d=none;solarflare.com; dmarc=none action=none header.from=mellanox.com; Received: from AM0PR05MB6610.eurprd05.prod.outlook.com (2603:10a6:208:12f::18) by AM0PR05MB4577.eurprd05.prod.outlook.com (2603:10a6:208:b7::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3045.25; Thu, 4 Jun 2020 13:35:25 +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.3045.024; Thu, 4 Jun 2020 13:35:25 +0000 From: Wisam Jaddo To: arybchenko@solarflare.com, jackmin@mellanox.com, thomas@monjalon.net, jerinjacobk@gmail.com, ajit.khaparde@broadcom.com Cc: dev@dpdk.org Date: Thu, 4 Jun 2020 13:35:00 +0000 Message-Id: <20200604133502.28491-4-wisamm@mellanox.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200604133502.28491-1-wisamm@mellanox.com> References: <20200511110811.11474-2-wisamm@mellanox.com> <20200604133502.28491-1-wisamm@mellanox.com> Content-Type: text/plain X-ClientProxiedBy: AM0PR01CA0117.eurprd01.prod.exchangelabs.com (2603:10a6:208:168::22) 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 AM0PR01CA0117.eurprd01.prod.exchangelabs.com (2603:10a6:208:168::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3066.18 via Frontend Transport; Thu, 4 Jun 2020 13:35:23 +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: e57393b7-c312-4234-ec40-08d8088c22c5 X-MS-TrafficTypeDiagnostic: AM0PR05MB4577: 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:1388; X-Forefront-PRVS: 04244E0DC5 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Ym1Z9swESnWECAJy+NeVUmKSsxfhi34w9PH9zLdBR6Rw21N0Uhlp2fUR3VYrdrtUUK0ZOk3VLAj3kYsnd5Z1Pt6p5VxI9FVJLA6nIhaGZpJHjIh1nfTTu1DUndyVHZ+QwGgXPrsM2G12UFk73+WipkuozHLSBrmQlou8Yvk79EtgIH6I1HIen86irVhvXrV7NeungwwOM7wLXoV4f497g5SmNJUjl/2wgdIS7UXuv5dtNtZtPCAeNQdUQ7nQVXnnNT0qD8N9ULkoudUshXidha8xTYYdy7ThqN2BVvn52/NW2hkIJVuyBsNB+LfKZ3eta+QinhpXTmXv9Gts95nvPw== 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)(136003)(396003)(376002)(346002)(366004)(39860400002)(1076003)(316002)(4326008)(2906002)(26005)(956004)(52116002)(2616005)(66556008)(55016002)(66946007)(86362001)(36756003)(8936002)(7696005)(83380400001)(6666004)(8886007)(186003)(5660300002)(8676002)(478600001)(16526019)(66476007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: Ht1u/yX15EaYPTEw9TZyhYHPxu2yis074FrNnNpOA4I5bYarUYfecgZzv+vXXkCw+d8PKT2ZjeH0NHD9YyJUdxkXtXonbjxpe+rGLh3Ei6yC7r12dAYMwX6VrT+J6Gn/D0w43hndubAsNttbt5LBmjIwsN2m0pwQ6SUAXjYUoPQarsewc4zJOPzYOdpNCNJcFchtUxKGzOFAGTxgaUMg3hvZD5LN+lphqnuXnUg5zB1KWy2B9A8mJzJ9CE1OjVXc72OWe+R2yIWH6lPgG3xLYV0qXXVMnjZil5MpzmDiw/lmK2YLbPHkSFjisjp7QpEhSA9txjB5OpYEMxqdUu30ABv0GNlx3eg7Rtvg/m3rn/9ga7ny3VKW1ZePtJvmuGq6/k3khAhGz9WtYzmsLf3b/dF30FoNyUpAOnIVYXarxJy6g0mPBIhq8PljfGP9+QFTaCeJe8zpNAt5XFmYX+1FDTy5V3F0eQSsGE+sEg3DsTA= X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: e57393b7-c312-4234-ec40-08d8088c22c5 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Jun 2020 13:35:25.0382 (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: QTO4YF1ts6+jxR6K5w8wa8szsUtJhCh3hniYi2tOVkix6oNxeRo41zzpZKUaGe6WJ0OxFXLhn96WkMFW6XHV9Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR05MB4577 Subject: [dpdk-dev] [PATCH v7 3/5] app/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 Acked-by: Xiaoyu Min --- app/test-flow-perf/main.c | 87 ++++++++++++++++++++++++++ doc/guides/rel_notes/release_20_08.rst | 1 + doc/guides/tools/flow-perf.rst | 4 ++ 3 files changed, 92 insertions(+) diff --git a/app/test-flow-perf/main.c b/app/test-flow-perf/main.c index 5bff48d32..bb7c3f6b5 100644 --- a/app/test-flow-perf/main.c +++ b/app/test-flow-perf/main.c @@ -49,6 +49,7 @@ static uint64_t flow_actions; static uint64_t flow_attrs; static volatile bool force_quit; static bool dump_iterations; +static bool delete_flag; static struct rte_mempool *mbuf_mp; static uint32_t nb_lcores; static uint32_t flows_count; @@ -64,6 +65,8 @@ 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"); @@ -246,6 +249,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 }, @@ -353,6 +357,9 @@ args_parse(int argc, char **argv) if (strcmp(lgopts[opt_idx].name, "dump-iterations") == 0) dump_iterations = true; + if (strcmp(lgopts[opt_idx].name, + "deletion-rate") == 0) + delete_flag = true; break; default: fprintf(stderr, "Invalid option: %s\n", argv[optind]); @@ -372,9 +379,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] == 0) + 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; @@ -385,6 +458,7 @@ flows_handler(void) uint32_t i; int port_id; int iter_id; + uint32_t flow_index; nr_ports = rte_eth_dev_count_avail(); @@ -396,8 +470,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 jump into flow_group, @@ -416,6 +496,7 @@ flows_handler(void) print_flow_error(error); rte_exit(EXIT_FAILURE, "error in creating flow"); } + flow_list[flow_index++] = flow; } /* Insertion Rate */ @@ -434,6 +515,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(); @@ -466,6 +549,9 @@ flows_handler(void) flows_rate); printf(":: The time for creating %d in flows %f seconds\n", flows_count, cpu_time_used); + + if (delete_flag) + destroy_flows(port_id, flow_list); } } @@ -624,6 +710,7 @@ main(int argc, char **argv) dump_iterations = false; flows_count = DEFAULT_RULES_COUNT; iterations_number = DEFAULT_ITERATION; + delete_flag = false; flow_group = 0; signal(SIGINT, signal_handler); diff --git a/doc/guides/rel_notes/release_20_08.rst b/doc/guides/rel_notes/release_20_08.rst index 22dfc6806..05bef91c3 100644 --- a/doc/guides/rel_notes/release_20_08.rst +++ b/doc/guides/rel_notes/release_20_08.rst @@ -62,6 +62,7 @@ New Features Application features: * Measure rte_flow insertion rate. + * Measure rte_flow deletion rate. Removed Items diff --git a/doc/guides/tools/flow-perf.rst b/doc/guides/tools/flow-perf.rst index 6634c3454..79a3013d5 100644 --- a/doc/guides/tools/flow-perf.rst +++ b/doc/guides/tools/flow-perf.rst @@ -26,6 +26,8 @@ The current version has limitations which can be removed in future: * Single core insertion only. * Only one instance of same action can be added in one rule. +The application also provide the ability to measure rte flow deletion rate. + Compiling the Application ========================= @@ -72,6 +74,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