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 6F119A0C4D; Wed, 13 Oct 2021 09:44:54 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 03DA441167; Wed, 13 Oct 2021 09:44:54 +0200 (CEST) Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2076.outbound.protection.outlook.com [40.107.223.76]) by mails.dpdk.org (Postfix) with ESMTP id 429A841162 for ; Wed, 13 Oct 2021 09:44:52 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=h32dgNgHEim52m9MRMJomDqLRzr/pJtVpw8BmKiC4ffcFOi1ZAc/82spd1D+1zlVjBn/bDz8pBm3TJ4+hYhgnWQghwIQjBASaFSahabclt+JHMu9wFEorS7p1FDLagQ3WDn8o5sWuWnWUS/SmaOkX4VFR89/+I6Z595AqFiv3udMPcK2wfPlPpav7cAMmovgTfSWeDuuqKwLSqAns6bufi+4dXayALIuxK6h229r0XSNmDDXxxnHy+i4ht4fz0tCOqcKkvmfgy0vDzU/201UGIXFkV8acS8xIV2SeG6TzEA4NxiO+v57sOjmdxO8Fn/M//k/FVBq6O62E7kiV/5mtA== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=5P9xDJBWBJipxgAraAAVLL6jW/AN8w6/jntlA0q5wQA=; b=AXE94+fXeuaXW1B5/oJc2CrBOvOdj1Uv7tRz1gO0mvH+En8VjRmAYTZ8n0Xie7hZIKbAEkT7nzXGgqm20NHFFwloV+GCCkrlguiLGhAID0PglEm33yz0/+stfGlFm0b5SeRiUQ6KpFdhoWNnNIGU4u1YRDxMW9dgnf4royFZYziwNel+Y3NBvuFx1NKqeGTOhoXmDlqSTJPUChe35/qLkiYtOS/wjUvBYwFH9ZU5Uf967z6s4z4CdlDy2yFg/Y/uCNAy4sXUIFbo0VEvaAtnY0DQNM+0B/zoJ2tKhsCpMeyF4ewyt8C1jybnj4OIP91/iGHFcNcxqFol4oQP8nSM8g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.34) smtp.rcpttodomain=dpdk.org smtp.mailfrom=nvidia.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=5P9xDJBWBJipxgAraAAVLL6jW/AN8w6/jntlA0q5wQA=; b=GSqYEP9Y6zfHhQHbak5x8pbk5+S/1i14tIGfYagl/DHS9quq2FWN5XjcsLlr2kcC+MjtjzkQTF6sFX9mvSz6aM2TT8GRoFwxzSqyAmvXcj00OyUqWpk81RYaj3KeTkLb5onCV5LcMgfvYho/7WAKRZ9zF1byeu4XjhM0a+2/BVJWDP5Qrnld35GwFw/ftpwaOZwofIjWuO5mrk6OO/IxssREfDAtWOQAarTn1/E1bfwxrnFBWVwAksdzGUhFogD5o88DnMTAk0kVfavQrOgk/mnaM3hKMaM9bXOF7KY08GCmwjeNOVJYEWL739OLIQ7yCxjIerPNKpXUQZGnaynzBQ== Received: from DM6PR05CA0055.namprd05.prod.outlook.com (2603:10b6:5:335::24) by SN6PR12MB2781.namprd12.prod.outlook.com (2603:10b6:805:67::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4587.19; Wed, 13 Oct 2021 07:44:49 +0000 Received: from DM6NAM11FT009.eop-nam11.prod.protection.outlook.com (2603:10b6:5:335:cafe::ab) by DM6PR05CA0055.outlook.office365.com (2603:10b6:5:335::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.4 via Frontend Transport; Wed, 13 Oct 2021 07:44:49 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.34) smtp.mailfrom=nvidia.com; dpdk.org; dkim=none (message not signed) header.d=none;dpdk.org; dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.112.34 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.112.34; helo=mail.nvidia.com; Received: from mail.nvidia.com (216.228.112.34) by DM6NAM11FT009.mail.protection.outlook.com (10.13.173.20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4608.15 via Frontend Transport; Wed, 13 Oct 2021 07:44:49 +0000 Received: from nvidia.com (172.20.187.6) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Wed, 13 Oct 2021 07:44:40 +0000 From: Sean Zhang To: , Wisam Jaddo CC: , Date: Wed, 13 Oct 2021 10:44:25 +0300 Message-ID: <20211013074426.1099533-1-xiazhang@nvidia.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211012034238.386505-1-xiazhang@nvidia.com> References: <20211012034238.386505-1-xiazhang@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [172.20.187.6] X-ClientProxiedBy: HQMAIL101.nvidia.com (172.20.187.10) To HQMAIL107.nvidia.com (172.20.187.13) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: d59e7dc6-db1c-4a71-237c-08d98e1d55ba X-MS-TrafficTypeDiagnostic: SN6PR12MB2781: X-LD-Processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4714; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ttIhZiFuFev0vbXUMGTGIJ8M4pP85TbZlRDItnKqrVgnMpAzZ0s1EUFX8S+0FyRYeO97BNNXcUt39xHyOgZeX/vH9o95Pxcaxggd5+/MJZjqGmmYuILyt/0lvDPi79Zi12ylzfjl8l4Szr1VuoOCKmoqn9EV1JJOKBBB+rihxDr6CBBmgLdX6yrIVBfa1zXdewo2JdwNOHUgbFcILg/uKy6Fp37Wq/SfhfGwCGikCLkwrAheBS1B7M8yQSb9uyV4nBQoHzVR0FJUs5TJ7OOaDVyM1245IPTKiapd/KF9rAMBEjhEiSGxsXG7ggZm+yQVxuvIbPjsddip3R1pkWKCHQC+Y0mNM39037TZKpfOmcrRrycPxaFlgxvP92/1aeR1mEvmu6EX9Lyd5Z6AztT7z9wTVryej4okzFTGMOOSHfeRsH8psKPu5T6Htw6odytxTYGH7MEusGSCIkasYYwwuGKCZAwEX7Z9iHGrJ95t9z5kPZELTvFBR1jkmEbiEaOE/vPadtgqHOhdR8e6jdO40WNxt2V7gIDmgAXI32mJsK2LQEV8JQ17DuO6iXblGNwLhUIVY4HPtUr3aGt8VMRNgBJ6X7JtFhi7JnBKy24MR3XotPMXxvszzDvnf3fRhGV3y/naKVlboNjH/Bhx6oBrdF41voPUqQHL5izNVeU2pFbceoFCQz7BFyrLdja/6IJBQV2DVwpG9hymaBN4EorUFg== X-Forefront-Antispam-Report: CIP:216.228.112.34; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:schybrid03.nvidia.com; CAT:NONE; SFS:(4636009)(36840700001)(46966006)(7696005)(2906002)(107886003)(36906005)(8936002)(316002)(83380400001)(36860700001)(16526019)(26005)(186003)(356005)(1076003)(5660300002)(47076005)(36756003)(6286002)(508600001)(426003)(86362001)(70206006)(70586007)(54906003)(336012)(110136005)(2616005)(4326008)(55016002)(6666004)(6636002)(7636003)(8676002)(82310400003); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Oct 2021 07:44:49.1995 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d59e7dc6-db1c-4a71-237c-08d98e1d55ba X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.112.34]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT009.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR12MB2781 Subject: [dpdk-dev] [V2] app/flow-perf: add destination ports parameter 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" Add optional destination ports parameter for port-id action. The parameter is not must, and the value is 1 by default as before if the parameter not provided. For example: $ dpdk-test-flow-perf -w 08:00.0,representor=[0,1] -- --transfer \ > --ingress --transfer --ether --portmask=0x2 --vxlan-encap \ > --port-id=0 This command means the rule created on representor 0 with port 0 as destination, since the portmask is 0x2 and dst-ports is 0: $ dpdk-test-flow-perf -w 08:00.0,representor=[0,1] \ > -w 08:00.1,representor=[0,1]-- --transfer --ingress --transfer \ > --ether --portmask=0x12 --vxlan-encap --port-id=0,3 This command means the rules created on both representor 0 of PF 0 and PF 1, the destination port for the first represontor is PF 0, and the destination port for the other one it PF 1. Signed-off-by: Sean Zhang --- v2: remove new added dst-ports parameter, reuse port-id with optional parameter --- --- app/test-flow-perf/actions_gen.c | 7 +++++-- app/test-flow-perf/actions_gen.h | 2 +- app/test-flow-perf/flow_gen.c | 3 ++- app/test-flow-perf/flow_gen.h | 1 + app/test-flow-perf/main.c | 29 +++++++++++++++++++++++------ doc/guides/tools/flow-perf.rst | 3 +++ 6 files changed, 35 insertions(+), 10 deletions(-) diff --git a/app/test-flow-perf/actions_gen.c b/app/test-flow-perf/actions_gen.c index 82cddfc676..8786dc967c 100644 --- a/app/test-flow-perf/actions_gen.c +++ b/app/test-flow-perf/actions_gen.c @@ -29,6 +29,7 @@ struct additional_para { uint32_t counter; uint64_t encap_data; uint64_t decap_data; + uint16_t dst_port; uint8_t core_idx; bool unique_data; }; @@ -171,12 +172,13 @@ add_set_tag(struct rte_flow_action *actions, static void add_port_id(struct rte_flow_action *actions, uint8_t actions_counter, - __rte_unused struct additional_para para) + struct additional_para para) { static struct rte_flow_action_port_id port_id = { .id = PORT_ID_DST, }; + port_id.id = para.dst_port; actions[actions_counter].type = RTE_FLOW_ACTION_TYPE_PORT_ID; actions[actions_counter].conf = &port_id; } @@ -909,7 +911,7 @@ void fill_actions(struct rte_flow_action *actions, uint64_t *flow_actions, uint32_t counter, uint16_t next_table, uint16_t hairpinq, uint64_t encap_data, uint64_t decap_data, uint8_t core_idx, - bool unique_data) + bool unique_data, uint16_t dst_port) { struct additional_para additional_para_data; uint8_t actions_counter = 0; @@ -933,6 +935,7 @@ fill_actions(struct rte_flow_action *actions, uint64_t *flow_actions, .decap_data = decap_data, .core_idx = core_idx, .unique_data = unique_data, + .dst_port = dst_port, }; if (hairpinq != 0) { diff --git a/app/test-flow-perf/actions_gen.h b/app/test-flow-perf/actions_gen.h index 6f2f833496..f3bb6fec41 100644 --- a/app/test-flow-perf/actions_gen.h +++ b/app/test-flow-perf/actions_gen.h @@ -20,6 +20,6 @@ void fill_actions(struct rte_flow_action *actions, uint64_t *flow_actions, uint32_t counter, uint16_t next_table, uint16_t hairpinq, uint64_t encap_data, uint64_t decap_data, uint8_t core_idx, - bool unique_data); + bool unique_data, uint16_t dst_port); #endif /* FLOW_PERF_ACTION_GEN */ diff --git a/app/test-flow-perf/flow_gen.c b/app/test-flow-perf/flow_gen.c index 8f87fac5f6..890387bffa 100644 --- a/app/test-flow-perf/flow_gen.c +++ b/app/test-flow-perf/flow_gen.c @@ -45,6 +45,7 @@ generate_flow(uint16_t port_id, uint16_t hairpinq, uint64_t encap_data, uint64_t decap_data, + uint16_t dst_port, uint8_t core_idx, bool unique_data, struct rte_flow_error *error) @@ -63,7 +64,7 @@ generate_flow(uint16_t port_id, fill_actions(actions, flow_actions, outer_ip_src, next_table, hairpinq, encap_data, decap_data, core_idx, - unique_data); + unique_data, dst_port); fill_items(items, flow_items, outer_ip_src, core_idx); diff --git a/app/test-flow-perf/flow_gen.h b/app/test-flow-perf/flow_gen.h index dc887fceae..2daebbe493 100644 --- a/app/test-flow-perf/flow_gen.h +++ b/app/test-flow-perf/flow_gen.h @@ -34,6 +34,7 @@ generate_flow(uint16_t port_id, uint16_t hairpinq, uint64_t encap_data, uint64_t decap_data, + uint16_t dst_port, uint8_t core_idx, bool unique_data, struct rte_flow_error *error); diff --git a/app/test-flow-perf/main.c b/app/test-flow-perf/main.c index 9be8edc31d..5d12bfeb03 100644 --- a/app/test-flow-perf/main.c +++ b/app/test-flow-perf/main.c @@ -56,6 +56,7 @@ static uint64_t flow_attrs[MAX_ATTRS_NUM]; static uint8_t items_idx, actions_idx, attrs_idx; static uint64_t ports_mask; +static uint16_t dst_ports[RTE_MAX_ETHPORTS]; static volatile bool force_quit; static bool dump_iterations; static bool delete_flag; @@ -595,7 +596,7 @@ args_parse(int argc, char **argv) { "icmpv4", 0, 0, 0 }, { "icmpv6", 0, 0, 0 }, /* Actions */ - { "port-id", 0, 0, 0 }, + { "port-id", 2, 0, 0 }, { "rss", 0, 0, 0 }, { "queue", 0, 0, 0 }, { "jump", 0, 0, 0 }, @@ -633,6 +634,9 @@ args_parse(int argc, char **argv) RTE_ETH_FOREACH_DEV(i) ports_mask |= 1 << i; + for (i = 0; i < RTE_MAX_ETHPORTS; i++) + dst_ports[i] = PORT_ID_DST; + hairpin_queues_num = 0; argvopt = argv; @@ -787,6 +791,17 @@ args_parse(int argc, char **argv) rte_exit(EXIT_FAILURE, "Invalid fwd port mask\n"); ports_mask = pm; } + if (strcmp(lgopts[opt_idx].name, + "port-id") == 0) { + uint16_t port_idx = 0; + char *token; + + token = strtok(optarg, ","); + while (token != NULL) { + dst_ports[port_idx++] = atoi(token); + token = strtok(NULL, ","); + } + } if (strcmp(lgopts[opt_idx].name, "cores") == 0) { n = atoi(optarg); if ((int) rte_lcore_count() <= n) { @@ -1128,7 +1143,7 @@ destroy_flows(int port_id, uint8_t core_id, struct rte_flow **flows_list) } static struct rte_flow ** -insert_flows(int port_id, uint8_t core_id) +insert_flows(int port_id, uint8_t core_id, uint16_t dst_port_id) { struct rte_flow **flows_list; struct rte_flow_error error; @@ -1173,8 +1188,8 @@ insert_flows(int port_id, uint8_t core_id) * group 0 eth / end actions jump group */ flow = generate_flow(port_id, 0, flow_attrs, - global_items, global_actions, - flow_group, 0, 0, 0, 0, core_id, unique_data, &error); + global_items, global_actions, flow_group, 0, 0, 0, 0, + dst_port_id, core_id, unique_data, &error); if (flow == NULL) { print_flow_error(error); @@ -1189,7 +1204,7 @@ insert_flows(int port_id, uint8_t core_id) flow_attrs, flow_items, flow_actions, JUMP_ACTION_TABLE, counter, hairpin_queues_num, - encap_data, decap_data, + encap_data, decap_data, dst_port_id, core_id, unique_data, &error); if (!counter) { @@ -1250,6 +1265,7 @@ static void flows_handler(uint8_t core_id) { struct rte_flow **flows_list; + uint16_t port_idx = 0; uint16_t nr_ports; int port_id; @@ -1269,7 +1285,8 @@ flows_handler(uint8_t core_id) mc_pool.last_alloc[core_id] = (int64_t)dump_socket_mem(stdout); if (has_meter()) meters_handler(port_id, core_id, METER_CREATE); - flows_list = insert_flows(port_id, core_id); + flows_list = insert_flows(port_id, core_id, + dst_ports[port_idx++]); if (flows_list == NULL) rte_exit(EXIT_FAILURE, "Error: Insertion Failed!\n"); mc_pool.current_alloc[core_id] = (int64_t)dump_socket_mem(stdout); diff --git a/doc/guides/tools/flow-perf.rst b/doc/guides/tools/flow-perf.rst index 280bf7e0e0..edfd81c25f 100644 --- a/doc/guides/tools/flow-perf.rst +++ b/doc/guides/tools/flow-perf.rst @@ -205,6 +205,9 @@ Actions: Add port redirection action to all flows actions. Port redirection destination is defined in user_parameters.h under PORT_ID_DST, default value = 1. + It can also has optional parameter like --port-id=N[,M] to + specify the destination port, the number of values should be + the same with number of set bits in portmask. * ``--rss`` Add RSS action to all flows actions, -- 2.33.0