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 F0ED5A0C4E; Tue, 2 Nov 2021 11:39:19 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id DF31E40689; Tue, 2 Nov 2021 11:39:19 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id 842A24003F for ; Tue, 2 Nov 2021 11:39:18 +0100 (CET) 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 ESMTP id 1A23CBUe011690; Tue, 2 Nov 2021 03:39:17 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=pfpt0220; bh=uqeNKoH5HFbyc47bdlDF6N+P937X8zuFjog8TswNBmw=; b=Ieyq1nJBoeS7YYTZT67rDreAEGEJC03dBXvgc+pkJIz21IjZEAf4HZRY+qnKfS9MNsOf E6jLJC9LsBuPftxYOxeXkmd2BGegcWdk8b7QUq7VhEtycNv/tqsdXr+WAWTB6Exn2SMS dUtkm4mQw7A3791zfVmsTt9g0UbFDVl4c7edjidmRrnjezZDGjWMjsBG9DbQVnhpnD+0 d23oJr7suBlZzZSrisR+oN1WDWMgLqzRvQJM5GS07oNzyhmNcpXqShZq7ob5lg+sMx90 AHUFsB25XyOtdEZbDAHv1IK9CUSxE9rjzVCDR8lvJyIlWnJwfFGAmZRMep9MS2aSq//7 Lg== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3c2w7bhuym-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Tue, 02 Nov 2021 03:39:17 -0700 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Tue, 2 Nov 2021 03:39:16 -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; Tue, 2 Nov 2021 03:39:16 -0700 Received: from satheeshpaullabpc.marvell.com (unknown [10.28.34.33]) by maili.marvell.com (Postfix) with ESMTP id 6BB695B6954; Tue, 2 Nov 2021 03:39:14 -0700 (PDT) From: To: Wisam Jaddo CC: , Satheesh Paul Date: Tue, 2 Nov 2021 16:09:09 +0530 Message-ID: <20211102103909.2207302-1-psatheesh@marvell.com> X-Mailer: git-send-email 2.25.4 In-Reply-To: <20211029040847.2176787-1-psatheesh@marvell.com> References: <20211029040847.2176787-1-psatheesh@marvell.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-ORIG-GUID: 6-DhS9Ps7qVPrrRHo6ynb6cSh_12T_-T X-Proofpoint-GUID: 6-DhS9Ps7qVPrrRHo6ynb6cSh_12T_-T 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-11-02_06,2021-11-02_01,2020-04-07_01 Subject: [dpdk-dev] [PATCH v2] 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 create flows with priority attribute set randomly between 0 and a user supplied maximum value. 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 --- v2: * Changed "--max-priority" to "--random-priority". * Added support to take seed for pseudo-random number generator. * Updated documentation for the above. app/test-flow-perf/flow_gen.c | 6 ++-- app/test-flow-perf/flow_gen.h | 1 + app/test-flow-perf/main.c | 56 +++++++++++++++++++++++----------- doc/guides/tools/flow-perf.rst | 4 +++ 4 files changed, 47 insertions(+), 20 deletions(-) diff --git a/app/test-flow-perf/flow_gen.c b/app/test-flow-perf/flow_gen.c index 51871dbfdc..4eea8fb7c5 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,7 @@ fill_attributes(struct rte_flow_attr *attr, attr->transfer = 1; } attr->group = group; + attr->priority = rte_rand_max(max_priority); } struct rte_flow * @@ -48,6 +49,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 +61,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..c49c5e44e6 100644 --- a/app/test-flow-perf/main.c +++ b/app/test-flow-perf/main.c @@ -77,6 +77,8 @@ 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; +static uint32_t rand_seed; #define MAX_PKT_BURST 32 #define LCORE_MODE_PKT 1 @@ -140,6 +142,8 @@ usage(char *progname) printf(" --enable-fwd: To enable packets forwarding" " after insertion\n"); printf(" --portmask=N: hexadecimal bitmask of ports used\n"); + printf( " --random-priority=N,S: Use random priority levels from 0 to" + "(N - 1) for flows and S as seed for pseudo-random number generator\n"); printf(" --unique-data: flag to set using unique data for all" " actions that support data, such as header modify and encap actions\n"); @@ -238,8 +242,9 @@ usage(char *progname) static void args_parse(int argc, char **argv) { - uint64_t pm; + uint64_t pm, seed; char **argvopt; + uint32_t prio; char *token; char *end; int n, opt; @@ -589,6 +594,7 @@ args_parse(int argc, char **argv) { "unique-data", 0, 0, 0 }, { "portmask", 1, 0, 0 }, { "cores", 1, 0, 0 }, + { "random-priority", 1, 0, 0 }, { "meter-profile-alg", 1, 0, 0 }, { "rxq", 1, 0, 0 }, { "txq", 1, 0, 0 }, @@ -767,25 +773,27 @@ 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 { + rules_count = atoi(optarg); + } + if (strcmp(lgopts[opt_idx].name, "random-priority") == 0) { + end = NULL; + prio = strtol(optarg, &end, 10); + if ((optarg[0] == '\0') || (end == NULL)) rte_exit(EXIT_FAILURE, - "rules_count should be >= %d\n", - rules_batch); - } + "Invalid value for " + "random-priority\n"); + max_priority = prio; + token = end + 1; + seed = strtoll(token, &end, 10); + if ((token[0] == '\0') || (*end != '\0')) + rte_exit(EXIT_FAILURE, + "Invalid value for " + "random-priority\n"); + rand_seed = seed; } if (strcmp(lgopts[opt_idx].name, "dump-iterations") == 0) @@ -862,6 +870,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 +1245,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 +1262,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 +1993,8 @@ main(int argc, char **argv) printf(":: Flows Count per port: %d\n\n", rules_count); + rte_srand(rand_seed); + 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..b57452662f 100644 --- a/doc/guides/tools/flow-perf.rst +++ b/doc/guides/tools/flow-perf.rst @@ -100,6 +100,10 @@ The command line options are: Set the number of needed cores to insert/delete rte_flow rules. Default cores count is 1. +* ``--random-priority=N,S`` + Create flows with the priority attribute set randomly between 0 to N - 1 + and use S as seed for the pseudo-random number generator. + * ``--meter-profile-alg`` Set the traffic metering algorithm. Example: meter-profile-alg=srtcmp, default algorithm is srtcm_rfc2697 -- 2.25.4