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 2C3D3A0547; Fri, 29 Oct 2021 07:53:13 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1960D410E0; Fri, 29 Oct 2021 07:53:13 +0200 (CEST) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2088.outbound.protection.outlook.com [40.107.94.88]) by mails.dpdk.org (Postfix) with ESMTP id 2DBFF40688 for ; Fri, 29 Oct 2021 07:53:11 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Gqn13a1J3NhTbpvPQ1Ms4REAxguBYPYXjk8T7En8zc2Ao6EmWITCTaAVsgWLuyjWj4CFW0wstLDSQ4K0XgWJ1rs7Kxf5j1v5AXDCycrzbPg4AFOWzJ8R8pvGzlS48w5tA/oC7g8q7efintDtBPgEDhwUYpdxdExMBdkRMm9zIXgTOJGkb3qtMHwN3Q3FAu1ImpcTFgKvSSCY3LtFW2d4b7HR5URVXN4Q+IPLQzwpvoj04aawRJLB6e8l3R5+uBF5ohfkgO1PYN9KvUEDPN4dEC6hqg8Udd+2atZC+2u+cqWr8eToEX2Lcx+2nPHoIuJHcsE2XxEUHP9eHpqPg0kPJg== 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=MOo23qpVhboYs20ftVZ96QV3hy7Oed7HvYFpmFnv5dI=; b=j9afoGYQBxyr7UqAYqs6DG/CXci+xheck6nb7wxzpd25Skk2101fLFkUkJoi4+mbrRJVL1pal0JxUcarfGwibh5oPUE3HZ/jn1fj77LAr3p+QrjGDdDymJTdBfAvz9XkItNOXNBIIaQDZ9V0CtpiDO68zmfOwEZBd04WnlTTmfiKxau+9r8oO1T6PlQ9vUE1gYaH/tvOXZwDFnS2MGx5747c1M7I57vI7i0P8lI5PexYE0J9Cs2JlCIl1oH5IguFVx3aah0MT9GjVvHWIT0jeL71Q0EFXf67Dr/apwK8EaC9+eeIf4a/Lw97b8d0oAVCRm8+J13L0QRISuDF7t3rUg== 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=MOo23qpVhboYs20ftVZ96QV3hy7Oed7HvYFpmFnv5dI=; b=hgJ6GFohKlK7luEFHLw2mFPWVb67mELLK0bRmZ981jIaBKX2x0GNDp4QKGIGePrWT2f3dGq2qyUdFNplmGMJ2nGkAWsd8tWD9joH1xNuIEYXO+Roo0QHpsbgwEk9tPffTaRk2dacj9pJY2PMVORdVft3quU0etUXzCKsJDIXRm9pC536B87JUsp0HLvUurP53dyX8Sp9dpTkYj4702DcR5Mj96R6y3/sTO0Y1zO7qGhFmItMQEMC1GVsIRuFiaR4NpgnfokqCi5/e34uHIGCdW7G8yxiuUG3w1m7F2WFcrWqtPXYLpAo7uF0Y/TqRhehALbheM33CJlrYEQGeOgG2w== Received: from CO2PR04CA0091.namprd04.prod.outlook.com (2603:10b6:104:6::17) by BY5PR12MB5015.namprd12.prod.outlook.com (2603:10b6:a03:1db::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4649.13; Fri, 29 Oct 2021 05:53:09 +0000 Received: from CO1NAM11FT054.eop-nam11.prod.protection.outlook.com (2603:10b6:104:6:cafe::f7) by CO2PR04CA0091.outlook.office365.com (2603:10b6:104:6::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4649.14 via Frontend Transport; Fri, 29 Oct 2021 05:53:09 +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 CO1NAM11FT054.mail.protection.outlook.com (10.13.174.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4649.14 via Frontend Transport; Fri, 29 Oct 2021 05:53:09 +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; Fri, 29 Oct 2021 05:53:05 +0000 From: Sean Zhang To: , Wisam Jaddo CC: , Date: Fri, 29 Oct 2021 08:52:51 +0300 Message-ID: <20211029055251.666699-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: HQMAIL107.nvidia.com (172.20.187.13) To HQMAIL107.nvidia.com (172.20.187.13) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 58f813a5-076c-44d3-b463-08d99aa062eb X-MS-TrafficTypeDiagnostic: BY5PR12MB5015: 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: jRIGnpCT2EArtPVnzr2QBxJv9PbykXpxRC4FRI4HHYRaQOx1LVPQ1R9tl+WGDPTp+xbx9h9AYqwetcZ+h+Uyhv4szNiDkp1HNjSTZV/lMvxfsR2bFZREx/hbQEuo3kRjjRZq6WHwkCHh5bjMyebmqnB+pKl0njRX7bIQLxtkB7jh+UFjt25hdjAd2j+12JW2iQLJCKurPJEDvDIp3fDQQGAOXIgRiO01W0arD8VGrBI18p+UxwrkW9JYbfyXgHOqDqrotnoeZDWeyGFGcWZLqc3cso3+PxWH/Xf4bZLBsYehJUTnIu/nSe5RVJkFspmzz+M4JgmehbpvMEkm2m4vivobtv5R20cIhSrrf0Arp+9Wz6msECmZhcApXk6khFEe1AfFyCvUBsgv6dqCEVCxjNjsjrtdVRPDl4+0X8TT1NgAnwuppqSc03JZ5QdMjjtApdAOsAqQMpLQJ9Df3lIzBc7oFTgHV2htLAN+8UOT7Bx4tPS+qMN+bpIHIB3/xIgck3GlTrpgBGPZrbt+0iBGTnj4zVVxDQU8kFPzrT78wCbNVcTN6vzUmaZ5dHRCO4arhsJSc18eNWYcaE9uhqzN3sSlssBcIp3CmYY8tehMseRrxMo5kVMItd4185qDngRHPhtO9Du2y2wotNfB/te0vmSRFqoPvGhq6sfMeDAd2T/mDu5uglPV1LrIy+4R3OmBAr+tkPfaSKnC+oG3Fi3Llg== 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)(36906005)(426003)(6286002)(316002)(83380400001)(4326008)(47076005)(7696005)(36860700001)(6636002)(16526019)(186003)(7636003)(1076003)(70586007)(6666004)(336012)(110136005)(26005)(356005)(54906003)(36756003)(82310400003)(8936002)(86362001)(55016002)(107886003)(8676002)(70206006)(2906002)(508600001)(2616005)(5660300002); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Oct 2021 05:53:09.3665 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 58f813a5-076c-44d3-b463-08d99aa062eb 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: CO1NAM11FT054.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR12MB5015 Subject: [dpdk-dev] [V3] 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 | 4 ++++ 6 files changed, 37 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..e608a44c24 100644 --- a/doc/guides/tools/flow-perf.rst +++ b/doc/guides/tools/flow-perf.rst @@ -231,6 +231,10 @@ 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, The queues in RSS action will be all queues configured -- 2.33.0