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 ED3F6A0C45; Thu, 28 Oct 2021 05:58:19 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 742204067B; Thu, 28 Oct 2021 05:58:19 +0200 (CEST) Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2053.outbound.protection.outlook.com [40.107.244.53]) by mails.dpdk.org (Postfix) with ESMTP id 051CB4003F for ; Thu, 28 Oct 2021 05:58:17 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=at59JMwxhFOulkrRcqGkxdgWnXgG7L+qkhl72MZJpP3w8ZOUlN7kC4HkUJ6AZ8pUBpX4kiGbllE9/6I6RNK8XHbaoREXrvShVA/2YrJzqRJ01aeTqf6dbHkBCw9yjamiWx+fQ3iqGsxNjVcLmcJIQCZFYOVnRQSh8xSNy8jO7/jCkpv7GiD1+/cpae9JmAgzTEFtOLjvpG3t1KNqhgx6TR7ax4RYMTZYL3us8unyfIFo/jGMH3wbTEAZQvG1ENLRdebDJ+i61/T/OlmMoAjzXN5t0DMV1avFBq4MujNZXT0ktpI9WLwDaho/B9kucIy/XwsrlUOjKMc/K5aOALWeHw== 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=trls6hgTltrLGn0m/CImx1j5IWj8xxG5AnysjBnz8gU=; b=d3CkuklJDeQzHJf0aBVdzENfYlxS3CkCuUK1RfY4zImxJbbAtfewwjDYRxVKeT2OSIzKTUkjILbodMocB5Z6msiEDOOfox4aGofpU7+PNlclfBi01wHx0vUr3cVwlyKHgAbH1dj6X0KIy8dyxyoheJRMF/6Au3NLf9vxApfrYV6tVLgnxnD+In3R88bvpA0GOldYEH8WHuNfr6+zb7Qy1kUtcAdx1c8fRm4/k3f3Ze9zEoIwvWR1JCiCFKkn12vRQYZoOBEj3Wa8M0ceUEZfIZ6slCR6F/rkIk3mex7JM+GRzkU8BwyCHHq/PqaYZEaMa+T8wL1rgpO5wjhniNTPQQ== 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=trls6hgTltrLGn0m/CImx1j5IWj8xxG5AnysjBnz8gU=; b=hQUK3FN/ysY5x66017ZB3V12V/AfQaYp0fNtKLHL6MVXqE8NE+LxglG5RLsljjvNwL+oU8I/haQSOD7VIzjeeNNrc8VMnStA6wdveAwPQ2denyU1Kis1qsUP5JNPtSIrK59Pw6EkJOxCAx1ha7TUDKOUT+t38Wz3d+eBlytWK/f4YUUi02L6DNmO+KP04a+qVmEbOqzBQyQkWebA6AOo49UqykKjRVzNyipzJMCuzOGWm6FS4CU6PSC15NvG1CXAtmhwonnUr9p0RKrUbYGbZIb522O3t2rrB2ntNvq7pEECzvEOmHI2KwZwn4/AsysyqZu8OkNUXgAYylDVcL4rEg== Received: from BN1PR10CA0028.namprd10.prod.outlook.com (2603:10b6:408:e0::33) by BL0PR12MB5554.namprd12.prod.outlook.com (2603:10b6:208:1cd::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4628.16; Thu, 28 Oct 2021 03:58:16 +0000 Received: from BN8NAM11FT059.eop-nam11.prod.protection.outlook.com (2603:10b6:408:e0:cafe::ae) by BN1PR10CA0028.outlook.office365.com (2603:10b6:408:e0::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4628.18 via Frontend Transport; Thu, 28 Oct 2021 03:58:16 +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 BN8NAM11FT059.mail.protection.outlook.com (10.13.177.120) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4649.14 via Frontend Transport; Thu, 28 Oct 2021 03:58:14 +0000 Received: from nvidia.com (172.20.187.5) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Thu, 28 Oct 2021 03:58:10 +0000 From: Sean Zhang To: , Wisam Jaddo CC: , Date: Thu, 28 Oct 2021 06:57:55 +0300 Message-ID: <20211028035755.601708-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.5] X-ClientProxiedBy: HQMAIL105.nvidia.com (172.20.187.12) To HQMAIL107.nvidia.com (172.20.187.13) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 4c9fe1ed-9968-481c-7695-08d999c72b7b X-MS-TrafficTypeDiagnostic: BL0PR12MB5554: 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: hT8pwBtnQJbsetvpX0xBn6rywHMOgM7rw9O+3LoX9avpjLdFleQGuLSEps5DkX4tV5DRvWsT1XJJFBdjLTjQSVw2WA/GFDwuFDWBrb4FvzNkLGkoj0wUvTBJPSbGRhDIb4xNUavSHnH2s9hQKWZGQIRKCxX6I5pHQmEEFnVdpo52RH8G1omdtZJrVSIDoPKBhg/ZguDXfQeAdewgM1HfRfoxMcck7ipyXm+O8Wn/BK1HzTB+OvzV0/jhYqmQjfgpaSsBFseSzS3wZbpLYK1nV+M3szI5M9WnFhTUqtTN38hJXRmE7EpflpN2NOQ7aJ0DkvJcmZB0JF4RawjmP+Go3ulcz9c1ja11t9h9EvA9gebAOH66W7R00UWXpvJ5ZVswjltO7883Z8G9npsYIUzR0Cn+vSJ2w4a93EaQE9JSqQoAL3lRnzu6ALOty94ePmeymXJXXsNthhX/UG130yqNRAHeHZt1w9VvZWrv7IwF5N0tow5ROUc6ziGMxN8teCgZte4uqLItJxG8SLtuMjmeiC6thYkd2fXZmQuw/Vm5jTrIgEY6tyjTl58/MpjSBo/whLOhfqnlDks/ihLYWLLQvdcY6ixNOXMfxR33ARa1N4TtdZFJrDcWTReMbVw/M3pgoK1/koipxpVUHg2rDa19n1uzwbzucWq43j0Xs9Fn3jBi5/ayA7nSVP/GapXQ0HeuVFga1MTVYW+j3uAIfvMt9g== 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)(46966006)(36840700001)(8936002)(8676002)(36756003)(4326008)(55016002)(5660300002)(2616005)(83380400001)(6286002)(426003)(6636002)(2906002)(356005)(7636003)(336012)(6666004)(7696005)(186003)(1076003)(82310400003)(70586007)(110136005)(47076005)(54906003)(508600001)(70206006)(26005)(86362001)(36860700001)(316002)(107886003)(16526019); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Oct 2021 03:58:14.9293 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4c9fe1ed-9968-481c-7695-08d999c72b7b 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: BN8NAM11FT059.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL0PR12MB5554 Subject: [dpdk-dev] [PATCH] 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 --- v3: resolve merging conflict 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 | 31 ++++++++++++++++++++++++------- doc/guides/tools/flow-perf.rst | 3 +++ 6 files changed, 36 insertions(+), 11 deletions(-) diff --git a/app/test-flow-perf/actions_gen.c b/app/test-flow-perf/actions_gen.c index 7c209f7266..13e1b82389 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, uint8_t rx_queues_count) + bool unique_data, uint8_t rx_queues_count, 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 8990686269..9e13b164f9 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, uint8_t rx_queues_count); + bool unique_data, uint8_t rx_queues_count, 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 51871dbfdc..c7b7652c02 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, uint8_t rx_queues_count, bool unique_data, @@ -64,7 +65,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, rx_queues_count); + unique_data, rx_queues_count, 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 1118a9fc14..46ce575ff8 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, uint8_t rx_queues_count, bool unique_data, diff --git a/app/test-flow-perf/main.c b/app/test-flow-perf/main.c index 3ebc025fb2..c1ad9bb0a3 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; @@ -619,7 +620,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 }, @@ -657,6 +658,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; @@ -811,6 +815,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, "rxq") == 0) { n = atoi(optarg); rx_queues_count = (uint8_t) n; @@ -1180,7 +1195,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; @@ -1226,8 +1241,8 @@ 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); + flow_group, 0, 0, 0, 0, dst_port_id, core_id, + rx_queues_count, unique_data, &error); if (flow == NULL) { print_flow_error(error); @@ -1241,8 +1256,8 @@ insert_flows(int port_id, uint8_t core_id) flow = generate_flow(port_id, flow_group, flow_attrs, flow_items, flow_actions, JUMP_ACTION_TABLE, counter, - hairpin_queues_num, - encap_data, decap_data, + hairpin_queues_num, encap_data, + decap_data, dst_port_id, core_id, rx_queues_count, unique_data, &error); @@ -1304,6 +1319,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; @@ -1323,7 +1339,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 0855f88689..9812b43a74 100644 --- a/doc/guides/tools/flow-perf.rst +++ b/doc/guides/tools/flow-perf.rst @@ -230,6 +230,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