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 BFC62A034F; Tue, 12 Oct 2021 05:43:07 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4FE9E410DC; Tue, 12 Oct 2021 05:43:07 +0200 (CEST) Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2056.outbound.protection.outlook.com [40.107.236.56]) by mails.dpdk.org (Postfix) with ESMTP id 78D8D40142 for ; Tue, 12 Oct 2021 05:43:05 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PqW5D3VeLH/jZMwno8Hh43cJZgSnJT63CqUusMFfA9lBUZY0QIxgkkAw5n51jJTncioF//tyWDqa7WzLlXZtHtuhV24N/yv0RSD9ccDD0aqH8aLbBVqYv4yrD+K1ZiwzPesM7FyiTNtZ8fEZI72SopJs+UKfADcj+LH8DF5HvKy4Ab3YZ5gtscQN9LOuVPfdrF3vOKfxZ8UhYX0TH8DFFPfmwYxuwaDi5j/BksMyAbLHrKa2D6CUHDS4o5n98Kqj/lPT3rHnWUGPnu063LvblFndg5dCLPOHrytDRYWSf7CW4NECVT2QucXi5vmZ6fXrutTHEnolhZd9x+mAP9u/dQ== 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=3ChH7g5qLl2q+Tdr3WLEQjUHShtZWvj+9idxJ7T5Jbw=; b=UHTcIhR5UzfNA9V/X1gF1rTHohUbJUeapHoSWf88fZFVxkBO1bw4urIo1O4+XRnDwfMPP5NpEvyaTGUctDtRZgkL5BcmUwOm3S7mbmSS7E+8EWFcAhz6LJL35tisacG7FkMfRDCZKBGbYdUsWTYiGb8fIid/Jg/kvwpmOWTArtl9HbMarVQ7rYhyAXELoVUCrVP+BBoe2JPG8LlewSNcQUD8RPsNqTqYJ1t1ZF2Frzjet5RBoqlbe641yyabBmxGIW6UdYXjL3Nx6HaZs6w0VYMd+jHSWEnixtSp3I1zNi+Xra0vpIb/gzmyTxtr6yJYnztoz3B5LW5sst4xLqy2Xg== 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=3ChH7g5qLl2q+Tdr3WLEQjUHShtZWvj+9idxJ7T5Jbw=; b=QV+rdEq/9c3XNUxFhkQDWNu/NgnxBrx2ro0lTlKPoBKchyBem9E/j2o+NSjcd9IO+isZAX+WGRrVzEKJb2ISKgVDlxZUl92Qu2UwR+PtqLTFOftXjsfGmJvYrOD3jUzQ69EqXeLuW2Ouh8xKUUievrEehqQwnv3Nir3rNw8fLrwnhP4yumtFqdLLSff6u4n3N5p4glpqntzPyu/OT5aXasFOxp2a1ZZCMVc7Siibf9yI5UBlZlPgy+ZUmH8M51pkBrZO/sRTGlRKbStcJsSSRqiLlH0OLzS2lxwaqXpmzF0uCXoTcCAeGv+76qZe4mkYhAD8wqrDkdnzB5mbP3v1AA== Received: from DM3PR12CA0118.namprd12.prod.outlook.com (2603:10b6:0:51::14) by MN2PR12MB3040.namprd12.prod.outlook.com (2603:10b6:208:ce::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4587.22; Tue, 12 Oct 2021 03:43:01 +0000 Received: from DM6NAM11FT016.eop-nam11.prod.protection.outlook.com (2603:10b6:0:51:cafe::e5) by DM3PR12CA0118.outlook.office365.com (2603:10b6:0:51::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4587.18 via Frontend Transport; Tue, 12 Oct 2021 03:43:01 +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 DM6NAM11FT016.mail.protection.outlook.com (10.13.173.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4587.18 via Frontend Transport; Tue, 12 Oct 2021 03:43:00 +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; Tue, 12 Oct 2021 03:42:58 +0000 From: Sean Zhang To: , Wisam Jaddo CC: , Date: Tue, 12 Oct 2021 06:42:38 +0300 Message-ID: <20211012034238.386505-1-xiazhang@nvidia.com> X-Mailer: git-send-email 2.33.0 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: f63a5925-b48d-4bff-91be-08d98d3263b2 X-MS-TrafficTypeDiagnostic: MN2PR12MB3040: 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: xsX3CDdSOT4Q/80Q9oW0H/AnCeTHuXqzETEySQ2Y1DBGT6xZUnFvtvMKsNBMmH/IE1cO6zq/PcnRvdYMCBV0oVg+ZJnl5yZQqt929C0xbhoteBNAmGqCoYQ24I3cudu1NLeSgmsvogopEmB2Q0nbW2xBujTdfLfOO3omMGw2Wuyo7N6vmKcCccQkgTdqMVIgBJ4QDEa9Yy6Qi+FplmddFVGHtongJXNxZE45E76Oz5qPyQOOJSpWeF3CYQOZoTK7LQZxmf3zWr3tQLPBBJuuZi1RW9mqeylnbtd9zGD222Jn1Xyun3j/SSu7hwgMyq+QNHZibWSOULLWYWobTBHBWCuV5xFwNprU8RoQlEccyxJe6yhB5NQjePtKbhOpxxyyrtel67aqhtLl3v2BElBRQDvyXrEIENeUWKJp7AFxVxiEdhuh8MyGIM/i5aEOX6TCyo1sKGCPuw7wE8jHEg8p7bKqF8hvzQFv1wxK+5S3BiJ1YQG7cV7smuHqAq3yfiCqX8/Y3r72hFv3pDjQihvEluWpS8SrU59kdcDcOkQWdZ5fTj186LWMuIUgMEUDOvIhfzQPxbyviwY98EtG8r+iJ64qjPGmCM1kYKFC0377eF9vq5Y/MaBZdP7tS/HpBUiyrRb3NT5JS3GYvGW7vDmTshdbOh7OtGH1pHLOtM/rbSjXjO2VeX04AiNlv98VqtCYXnuP1MYuG4ammmrlyNPSLw== 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)(8676002)(186003)(16526019)(47076005)(316002)(6636002)(4326008)(82310400003)(26005)(83380400001)(110136005)(1076003)(36756003)(426003)(54906003)(7636003)(356005)(8936002)(70206006)(70586007)(508600001)(2906002)(55016002)(2616005)(6666004)(5660300002)(6286002)(107886003)(7696005)(36860700001)(336012)(86362001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Oct 2021 03:43:00.8665 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f63a5925-b48d-4bff-91be-08d98d3263b2 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: DM6NAM11FT016.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB3040 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 destination ports(dst-ports) parameter for port-id action, the parameter is only valid for port-id action. The parameter is not Must, and the value is 1 by default as before if 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 --dst-ports=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 --dst-ports=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 --- 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 | 48 ++++++++++++++++++++++++++++---- doc/guides/tools/flow-perf.rst | 6 ++++ 6 files changed, 58 insertions(+), 9 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..3a1eed3bcc 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; @@ -163,6 +164,7 @@ usage(char *progname) printf("To set flow actions:\n"); printf(" --port-id: add port-id action in flow actions\n"); + printf(" --dst-ports=N,M: add destination ports in port-id action\n"); printf(" --rss: add rss action in flow actions\n"); printf(" --queue: add queue action in flow actions\n"); printf(" --jump: add jump action in flow actions\n"); @@ -219,6 +221,21 @@ usage(char *progname) printf(" --vxlan-decap: add vxlan_decap action to flow actions\n"); } +static inline int +has_port_id(void) +{ + int i; + + for (i = 0; i < MAX_ACTIONS_NUM; ++i) { + if (flow_actions[i] == 0) + break; + if (flow_actions[i] + & FLOW_ACTION_MASK(RTE_FLOW_ACTION_TYPE_PORT_ID)) + return 1; + } + return 0; +} + static void args_parse(int argc, char **argv) { @@ -572,6 +589,7 @@ args_parse(int argc, char **argv) { "enable-fwd", 0, 0, 0 }, { "unique-data", 0, 0, 0 }, { "portmask", 1, 0, 0 }, + { "dst-ports", 1, 0, 0 }, { "cores", 1, 0, 0 }, /* Attributes */ { "ingress", 0, 0, 0 }, @@ -633,6 +651,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 +808,22 @@ args_parse(int argc, char **argv) rte_exit(EXIT_FAILURE, "Invalid fwd port mask\n"); ports_mask = pm; } + if (strcmp(lgopts[opt_idx].name, + "dst-ports") == 0) { + uint16_t port_idx = 0; + char *token; + + if (!has_port_id()) + rte_exit(EXIT_FAILURE, + "Error: need add port-id action first\n" + "dst-ports only can be used for port-id action\n"); + + 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 +1165,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 +1210,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 +1226,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 +1287,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 +1307,7 @@ 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..23047b4bdf 100644 --- a/doc/guides/tools/flow-perf.rst +++ b/doc/guides/tools/flow-perf.rst @@ -96,6 +96,12 @@ The command line options are: * ``--portmask=N`` hexadecimal bitmask of ports to be used. +* ``--dst-ports=N,M`` + Destination ports for ports with port-id action, the number of values + must be the same with number of set bits in portmask, and the parameter + is only valid for port-id action. The parameter is not MUST, the value + is by default 1 as before if not provided. + * ``--cores=N`` Set the number of needed cores to insert/delete rte_flow rules. Default cores count is 1. -- 2.33.0