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 A6A5AA0547; Fri, 29 Oct 2021 06:08:57 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1BA2E40688; Fri, 29 Oct 2021 06:08:57 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id 8D50E40395 for ; Fri, 29 Oct 2021 06:08:55 +0200 (CEST) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 19T1jCsR024522; Thu, 28 Oct 2021 21:08:54 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : mime-version : content-transfer-encoding : content-type; s=pfpt0220; bh=AW9BKrG9dttrDI2QB7QORxetBatqIayeMbiqnOk0hy8=; b=i4IRnlVpoi3qgSSznR/08CYv0ndfoWJIYuB6FTB8kaU7iiBt9kXUBC2d8Ft3Eu3dM3sw f/jRh2Ed8912o0KQ58lnyEuEMDnnLxAgYQF9hnbf2i5cXrElSGV8bHQP1PbOVkPrFIEU XJPo/Z+19Ud3v44vmcBLux/sPdCC7yIat6BLsIbRDhMrEQWt8ZjLemNZWcf9k157lBeY tqRja8zWPpkDcoBqVYEnCmbbJEXmiVgyWeGR8GaL+8OH7cZUY4iNPqB0bNnhoFMm48sk ORMqMmFysy4SeZ07cAAYEzBj6bRm8cxL041cxXK1/40oqsrfxcFXT0LHmY6mOjFxX8vj Qw== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0a-0016f401.pphosted.com with ESMTP id 3c07jrge61-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Thu, 28 Oct 2021 21:08:53 -0700 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Thu, 28 Oct 2021 21:08:52 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.18 via Frontend Transport; Thu, 28 Oct 2021 21:08:52 -0700 Received: from satheeshpaullabpc.marvell.com (unknown [10.28.34.33]) by maili.marvell.com (Postfix) with ESMTP id 545FA3F7086; Thu, 28 Oct 2021 21:08:51 -0700 (PDT) From: To: Wisam Jaddo CC: , Satheesh Paul Date: Fri, 29 Oct 2021 09:38:47 +0530 Message-ID: <20211029040847.2176787-1-psatheesh@marvell.com> X-Mailer: git-send-email 2.25.4 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-ORIG-GUID: Va1_YT_MmTI5PWSXiAmcVkeAHfJkcCPb X-Proofpoint-GUID: Va1_YT_MmTI5PWSXiAmcVkeAHfJkcCPb X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.182.1,Aquarius:18.0.790,Hydra:6.0.425,FMLib:17.0.607.475 definitions=2021-10-28_06,2021-10-26_01,2020-04-07_01 Subject: [dpdk-dev] [PATCH] app/flow-perf: added option to support flow priority 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 Sender: "dev" From: Satheesh Paul Added support to specify maximum flow priority option. When this option is given, each flow will be created with the priority attribute and the priority will be random between 0 to max-flow-priority. This is useful to measure performance on NICs which may have to rearrange flows to honor flow priority. Removed the lower limit of 100000 flows per batch. Signed-off-by: Satheesh Paul --- app/test-flow-perf/flow_gen.c | 7 ++++-- app/test-flow-perf/flow_gen.h | 1 + app/test-flow-perf/main.c | 44 +++++++++++++++++++++------------- doc/guides/tools/flow-perf.rst | 5 ++++ 4 files changed, 38 insertions(+), 19 deletions(-) diff --git a/app/test-flow-perf/flow_gen.c b/app/test-flow-perf/flow_gen.c index 51871dbfdc..414ec0bc5e 100644 --- a/app/test-flow-perf/flow_gen.c +++ b/app/test-flow-perf/flow_gen.c @@ -18,7 +18,7 @@ static void fill_attributes(struct rte_flow_attr *attr, - uint64_t *flow_attrs, uint16_t group) + uint64_t *flow_attrs, uint16_t group, uint8_t max_priority) { uint8_t i; for (i = 0; i < MAX_ATTRS_NUM; i++) { @@ -32,6 +32,8 @@ fill_attributes(struct rte_flow_attr *attr, attr->transfer = 1; } attr->group = group; + if (max_priority) + attr->priority = rte_rand_max(max_priority); } struct rte_flow * @@ -48,6 +50,7 @@ generate_flow(uint16_t port_id, uint8_t core_idx, uint8_t rx_queues_count, bool unique_data, + uint8_t max_priority, struct rte_flow_error *error) { struct rte_flow_attr attr; @@ -59,7 +62,7 @@ generate_flow(uint16_t port_id, memset(actions, 0, sizeof(actions)); memset(&attr, 0, sizeof(struct rte_flow_attr)); - fill_attributes(&attr, flow_attrs, group); + fill_attributes(&attr, flow_attrs, group, max_priority); fill_actions(actions, flow_actions, outer_ip_src, next_table, hairpinq, diff --git a/app/test-flow-perf/flow_gen.h b/app/test-flow-perf/flow_gen.h index 1118a9fc14..40eeceae6e 100644 --- a/app/test-flow-perf/flow_gen.h +++ b/app/test-flow-perf/flow_gen.h @@ -37,6 +37,7 @@ generate_flow(uint16_t port_id, uint8_t core_idx, uint8_t rx_queues_count, bool unique_data, + uint8_t max_priority, struct rte_flow_error *error); #endif /* FLOW_PERF_FLOW_GEN */ diff --git a/app/test-flow-perf/main.c b/app/test-flow-perf/main.c index 3ebc025fb2..1d91f308fd 100644 --- a/app/test-flow-perf/main.c +++ b/app/test-flow-perf/main.c @@ -77,6 +77,7 @@ static uint32_t rules_count; static uint32_t rules_batch; static uint32_t hairpin_queues_num; /* total hairpin q number - default: 0 */ static uint32_t nb_lcores; +static uint8_t max_priority; #define MAX_PKT_BURST 32 #define LCORE_MODE_PKT 1 @@ -140,6 +141,7 @@ usage(char *progname) printf(" --enable-fwd: To enable packets forwarding" " after insertion\n"); printf(" --portmask=N: hexadecimal bitmask of ports used\n"); + printf(" --max-priority=N: Maximum priority level for flows\n"); printf(" --unique-data: flag to set using unique data for all" " actions that support data, such as header modify and encap actions\n"); @@ -589,6 +591,7 @@ args_parse(int argc, char **argv) { "unique-data", 0, 0, 0 }, { "portmask", 1, 0, 0 }, { "cores", 1, 0, 0 }, + { "max-priority", 1, 0, 0 }, { "meter-profile-alg", 1, 0, 0 }, { "rxq", 1, 0, 0 }, { "txq", 1, 0, 0 }, @@ -767,26 +770,21 @@ args_parse(int argc, char **argv) /* Control */ if (strcmp(lgopts[opt_idx].name, "rules-batch") == 0) { - n = atoi(optarg); - if (n >= DEFAULT_RULES_BATCH) - rules_batch = n; - else { - rte_exit(EXIT_FAILURE, - "rules_batch should be >= %d\n", - DEFAULT_RULES_BATCH); - } + rules_batch = atoi(optarg); } if (strcmp(lgopts[opt_idx].name, "rules-count") == 0) { - n = atoi(optarg); - if (n >= (int) rules_batch) - rules_count = n; - else { - rte_exit(EXIT_FAILURE, - "rules_count should be >= %d\n", - rules_batch); + rules_count = atoi(optarg); + } + if (strcmp(lgopts[opt_idx].name, "max-priority") == 0) { + max_priority = atoi(optarg); + if (max_priority > 32) { + rte_exit( + EXIT_FAILURE, + "max-priority cannot be > 32\n"); } } + if (strcmp(lgopts[opt_idx].name, "dump-iterations") == 0) dump_iterations = true; @@ -862,6 +860,16 @@ args_parse(int argc, char **argv) break; } } + if (rules_count % rules_batch != 0) { + rte_exit(EXIT_FAILURE, + "rules_count %% rules_batch should be 0\n"); + } + if (rules_count / rules_batch > MAX_BATCHES_COUNT) { + rte_exit(EXIT_FAILURE, + "rules_count / rules_batch should be <= %d\n", + MAX_BATCHES_COUNT); + } + printf("end_flow\n"); } @@ -1227,7 +1235,7 @@ insert_flows(int port_id, uint8_t core_id) flow = generate_flow(port_id, 0, flow_attrs, global_items, global_actions, flow_group, 0, 0, 0, 0, core_id, rx_queues_count, - unique_data, &error); + unique_data, max_priority, &error); if (flow == NULL) { print_flow_error(error); @@ -1244,7 +1252,7 @@ insert_flows(int port_id, uint8_t core_id) hairpin_queues_num, encap_data, decap_data, core_id, rx_queues_count, - unique_data, &error); + unique_data, max_priority, &error); if (!counter) { first_flow_latency = (double) (rte_get_timer_cycles() - start_batch); @@ -1975,6 +1983,8 @@ main(int argc, char **argv) printf(":: Flows Count per port: %d\n\n", rules_count); + rte_srand(rte_rdtsc()); + if (has_meter()) create_meter_profile(); rte_eal_mp_remote_launch(run_rte_flow_handler_cores, NULL, CALL_MAIN); diff --git a/doc/guides/tools/flow-perf.rst b/doc/guides/tools/flow-perf.rst index 0855f88689..0dfdeab832 100644 --- a/doc/guides/tools/flow-perf.rst +++ b/doc/guides/tools/flow-perf.rst @@ -100,6 +100,11 @@ The command line options are: Set the number of needed cores to insert/delete rte_flow rules. Default cores count is 1. +* ``--max-priority=N`` + Maximum priority level for flows. Flows will be created with the + priority attribute set randomly between 0 to N - 1. + Default is 0 and maximum is 32. + * ``--meter-profile-alg`` Set the traffic metering algorithm. Example: meter-profile-alg=srtcmp, default algorithm is srtcm_rfc2697 -- 2.25.4