From patchwork Thu Nov 11 14:23:36 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rongwei Liu X-Patchwork-Id: 104196 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id BDEBCA0548; Thu, 11 Nov 2021 15:24:03 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id EC83541159; Thu, 11 Nov 2021 15:24:01 +0100 (CET) Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2064.outbound.protection.outlook.com [40.107.220.64]) by mails.dpdk.org (Postfix) with ESMTP id DDFB141158 for ; Thu, 11 Nov 2021 15:24:00 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=i0QgzOrRsWXxZpq50G6Vs0TBU0vy9BlkG9Ermd5e6OOb+tzhh7rc9/t3esDMDJaoU9bJH90hceIzjgxi9xtnN574ChZdZ/YeSvA4E8ZaVsT1/UezMnR6eG9h3nAp6CrH7+zfDffcopWB0eK+o2Ap6Z0HurotPK3aCvPaTLXjiPPsy4QuQYXROZhfN9+N8dsEWnh+8tuOZHVaUTF4Rdqa4X98VdoXJmrC/mdEZwpZis+oLEvJEsiDSRqpT2Wbjvm5Ik64x64KGCzb1nsRDmTr6lQ1miAvFle7y24N7UPrKvFse9JuJGTtq6kmBKce1qjAb2KY07ncY+SOGR9y6LbOzA== 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=Uo2Ny4MJUcORz8sdiu7BoUkR+rsAxwMzaZNQzX/OlE0=; b=n+KB7mgh/PiP1xmb/5izty1uBw9Q1cH9ScYXBXcEwwd7uKMmwX0VPkTihHvSuF/MV+JIOBPaFSkNa75hwVbifAOHIaMzi8O+RAkgNkzS2EJhDPiGs8Z671uUG5OvvSKvhX6OlJ/FjLLpxx61TzKYhY8npwPBt2SBKPtwobJGb+CX8n3LW0PnqaUbcu6Xh3o0fPrI6mhYAcLJ4M4O5wxbFS9BqkY954I5LbeTAiumYllccdGdO9cmNAnPAMt4oyc0semDRp7V3Gf1nI9327n9aWU5UbjPC2J+bnwV7rwvhZ8uUTXgIpLDJO4ma54ahjmKYont6qftJ56/KneoD60ylw== 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=Uo2Ny4MJUcORz8sdiu7BoUkR+rsAxwMzaZNQzX/OlE0=; b=esH+m6OQtd6z5WUmBdXAaJVltd1VE8f9c2AAv61QePm10kGSmBHAgaGPPc+Ey8nxpk0Use4WXVJDqXHAfZWm4+1CU6bXmD0nV6wMPp36sXdDbXRs8p0JbN3WtJiaX6vsCQQbWug6AdKYoSrWmJviQDZGXrfphOv4lQaINWKIez7KDjdQIUTPX5hJTAkJeKexutwp0auoHHeCZpVCrAe0GfqZIaK8bfj8D+bblTCC9S6N7VpyRfCzGThEyOEoYVo/rRE6kblbuf36r3oW9/GfrwwRQrSIOa6tEL+QgOZAXdaUY22nZnwvFchajKiHnTqoMBhxvA4qyZUjgYBS1nASUA== Received: from DM5PR07CA0081.namprd07.prod.outlook.com (2603:10b6:4:ad::46) by BY5PR12MB4211.namprd12.prod.outlook.com (2603:10b6:a03:20f::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4690.16; Thu, 11 Nov 2021 14:23:58 +0000 Received: from DM6NAM11FT065.eop-nam11.prod.protection.outlook.com (2603:10b6:4:ad:cafe::2f) by DM5PR07CA0081.outlook.office365.com (2603:10b6:4:ad::46) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4669.11 via Frontend Transport; Thu, 11 Nov 2021 14:23:58 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.34) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;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 DM6NAM11FT065.mail.protection.outlook.com (10.13.172.109) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4690.15 via Frontend Transport; Thu, 11 Nov 2021 14:23:57 +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; Thu, 11 Nov 2021 14:23:55 +0000 From: Rongwei Liu To: , , , , Wisam Jaddo CC: , Subject: [PATCH v9 1/5] app/flow-perf: define flow-options as global Date: Thu, 11 Nov 2021 16:23:36 +0200 Message-ID: <20211111142340.2209292-2-rongweil@nvidia.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20211111142340.2209292-1-rongweil@nvidia.com> References: <6177033.fEpqbVaury@thomas> <20211111142340.2209292-1-rongweil@nvidia.com> MIME-Version: 1.0 X-Originating-IP: [172.20.187.6] X-ClientProxiedBy: HQMAIL111.nvidia.com (172.20.187.18) To HQMAIL107.nvidia.com (172.20.187.13) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 45ca67fd-01f1-475f-6bfc-08d9a51ee63f X-MS-TrafficTypeDiagnostic: BY5PR12MB4211: X-LD-Processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:350; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: rTRkgAhvymLYMU6LIJ+hvWqDWJtfbaS1YBYJI/i1JZpD8djc9X4RUi0Bu7G6vYBf7Oi6rjdNA7CwrQFYvMM3JlVn4iKeQxgezXOT3rn6/i/KteZvSzIA4KhH4oXVTN9Dq4sAuxa2FLvbL3ix26uugCfQCVP8P94EdRYBphwDvmp3ff0BiRr2oT5bbqEWo6IEbVM8tROHREmP4bAakMnK69zV3cRhrvmUauKgpaBpB+rcoe2URpYWVcsfjncUhIqV7ok3pXq+J3VoKwbtub4yIfd9xjJY7zv8P3+MnVrMMujxlzwgDDY/Bb3wlFV33+G+gWyW1nRN3hDcfm43WogSQbt7jenUdmHOn0RQznsjbXOIWNx/LVOfXjWgFYNdk6bBLWJ2i0Kj3ZvGPs44Dvc8GFBvMmwEaHcUPlaWvpogEmyMRvx6fdUY/ubCY3IMpcswrj+PgIlpivcfX/f2bgEQnmAFXdRPKyc7iL/cWWX6N6HjFILPSJHYePaOvJFaDiJ7LtOZuo7KM8ZjSoUEBmw23iGLc8mMz2sZ+RLC+KKIcbQE1/Mq1af2sNIkWCaDwAH2cG0q6MReehbpCGGgCRMjs5DsHw7V1/f84WM2pfmSF7+v73l7G9rOarabxuFk5C/R5twF3epgu72EZHlj2+EumTMzQtii+8HmRLLGh4zULasT8hlRooQN+up8fQguphKb2phrz7YKDkhPzRg+Io9+sw== 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)(6286002)(36906005)(26005)(82310400003)(70586007)(2616005)(316002)(6636002)(1076003)(70206006)(508600001)(6666004)(55016002)(186003)(8676002)(336012)(86362001)(426003)(83380400001)(16526019)(107886003)(2906002)(7696005)(4326008)(36860700001)(5660300002)(36756003)(7636003)(30864003)(8936002)(47076005)(54906003)(110136005)(356005); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Nov 2021 14:23:57.9144 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 45ca67fd-01f1-475f-6bfc-08d9a51ee63f 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: DM6NAM11FT065.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR12MB4211 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 With flow-options defined as global struct, it's possible to use sub-functions to handle run-time options. It's helpful to avoid too many tabs warnings. Signed-off-by: Rongwei Liu Acked-by: Wisam Jaddo --- app/test-flow-perf/main.c | 662 +++++++++++++++++++------------------- 1 file changed, 331 insertions(+), 331 deletions(-) diff --git a/app/test-flow-perf/main.c b/app/test-flow-perf/main.c index c1477b14a1..42d13ec495 100644 --- a/app/test-flow-perf/main.c +++ b/app/test-flow-perf/main.c @@ -126,6 +126,337 @@ static struct multi_cores_pool mc_pool = { .cores_count = 1, }; +static const struct option_dict { + const char *str; + const uint64_t mask; + uint64_t *map; + uint8_t *map_idx; + +} flow_options[] = { + { + .str = "ether", + .mask = FLOW_ITEM_MASK(RTE_FLOW_ITEM_TYPE_ETH), + .map = &flow_items[0], + .map_idx = &items_idx + }, + { + .str = "ipv4", + .mask = FLOW_ITEM_MASK(RTE_FLOW_ITEM_TYPE_IPV4), + .map = &flow_items[0], + .map_idx = &items_idx + }, + { + .str = "ipv6", + .mask = FLOW_ITEM_MASK(RTE_FLOW_ITEM_TYPE_IPV6), + .map = &flow_items[0], + .map_idx = &items_idx + }, + { + .str = "vlan", + .mask = FLOW_ITEM_MASK(RTE_FLOW_ITEM_TYPE_VLAN), + .map = &flow_items[0], + .map_idx = &items_idx + }, + { + .str = "tcp", + .mask = FLOW_ITEM_MASK(RTE_FLOW_ITEM_TYPE_TCP), + .map = &flow_items[0], + .map_idx = &items_idx + }, + { + .str = "udp", + .mask = FLOW_ITEM_MASK(RTE_FLOW_ITEM_TYPE_UDP), + .map = &flow_items[0], + .map_idx = &items_idx + }, + { + .str = "vxlan", + .mask = FLOW_ITEM_MASK(RTE_FLOW_ITEM_TYPE_VXLAN), + .map = &flow_items[0], + .map_idx = &items_idx + }, + { + .str = "vxlan-gpe", + .mask = FLOW_ITEM_MASK(RTE_FLOW_ITEM_TYPE_VXLAN_GPE), + .map = &flow_items[0], + .map_idx = &items_idx + }, + { + .str = "gre", + .mask = FLOW_ITEM_MASK(RTE_FLOW_ITEM_TYPE_GRE), + .map = &flow_items[0], + .map_idx = &items_idx + }, + { + .str = "geneve", + .mask = FLOW_ITEM_MASK(RTE_FLOW_ITEM_TYPE_GENEVE), + .map = &flow_items[0], + .map_idx = &items_idx + }, + { + .str = "gtp", + .mask = FLOW_ITEM_MASK(RTE_FLOW_ITEM_TYPE_GTP), + .map = &flow_items[0], + .map_idx = &items_idx + }, + { + .str = "meta", + .mask = FLOW_ITEM_MASK(RTE_FLOW_ITEM_TYPE_META), + .map = &flow_items[0], + .map_idx = &items_idx + }, + { + .str = "tag", + .mask = FLOW_ITEM_MASK(RTE_FLOW_ITEM_TYPE_TAG), + .map = &flow_items[0], + .map_idx = &items_idx + }, + { + .str = "icmpv4", + .mask = FLOW_ITEM_MASK(RTE_FLOW_ITEM_TYPE_ICMP), + .map = &flow_items[0], + .map_idx = &items_idx + }, + { + .str = "icmpv6", + .mask = FLOW_ITEM_MASK(RTE_FLOW_ITEM_TYPE_ICMP6), + .map = &flow_items[0], + .map_idx = &items_idx + }, + { + .str = "ingress", + .mask = INGRESS, + .map = &flow_attrs[0], + .map_idx = &attrs_idx + }, + { + .str = "egress", + .mask = EGRESS, + .map = &flow_attrs[0], + .map_idx = &attrs_idx + }, + { + .str = "transfer", + .mask = TRANSFER, + .map = &flow_attrs[0], + .map_idx = &attrs_idx + }, + { + .str = "port-id", + .mask = FLOW_ACTION_MASK(RTE_FLOW_ACTION_TYPE_PORT_ID), + .map = &flow_actions[0], + .map_idx = &actions_idx + }, + { + .str = "rss", + .mask = FLOW_ACTION_MASK(RTE_FLOW_ACTION_TYPE_RSS), + .map = &flow_actions[0], + .map_idx = &actions_idx + }, + { + .str = "queue", + .mask = FLOW_ACTION_MASK(RTE_FLOW_ACTION_TYPE_QUEUE), + .map = &flow_actions[0], + .map_idx = &actions_idx + }, + { + .str = "jump", + .mask = FLOW_ACTION_MASK(RTE_FLOW_ACTION_TYPE_JUMP), + .map = &flow_actions[0], + .map_idx = &actions_idx + }, + { + .str = "mark", + .mask = FLOW_ACTION_MASK(RTE_FLOW_ACTION_TYPE_MARK), + .map = &flow_actions[0], + .map_idx = &actions_idx + }, + { + .str = "count", + .mask = FLOW_ACTION_MASK(RTE_FLOW_ACTION_TYPE_COUNT), + .map = &flow_actions[0], + .map_idx = &actions_idx + }, + { + .str = "set-meta", + .mask = FLOW_ACTION_MASK(RTE_FLOW_ACTION_TYPE_SET_META), + .map = &flow_actions[0], + .map_idx = &actions_idx + }, + { + .str = "set-tag", + .mask = FLOW_ACTION_MASK(RTE_FLOW_ACTION_TYPE_SET_TAG), + .map = &flow_actions[0], + .map_idx = &actions_idx + }, + { + .str = "drop", + .mask = FLOW_ACTION_MASK(RTE_FLOW_ACTION_TYPE_DROP), + .map = &flow_actions[0], + .map_idx = &actions_idx + }, + { + .str = "set-src-mac", + .mask = FLOW_ACTION_MASK( + RTE_FLOW_ACTION_TYPE_SET_MAC_SRC + ), + .map = &flow_actions[0], + .map_idx = &actions_idx + }, + { + .str = "set-dst-mac", + .mask = FLOW_ACTION_MASK( + RTE_FLOW_ACTION_TYPE_SET_MAC_DST + ), + .map = &flow_actions[0], + .map_idx = &actions_idx + }, + { + .str = "set-src-ipv4", + .mask = FLOW_ACTION_MASK( + RTE_FLOW_ACTION_TYPE_SET_IPV4_SRC + ), + .map = &flow_actions[0], + .map_idx = &actions_idx + }, + { + .str = "set-dst-ipv4", + .mask = FLOW_ACTION_MASK( + RTE_FLOW_ACTION_TYPE_SET_IPV4_DST + ), + .map = &flow_actions[0], + .map_idx = &actions_idx + }, + { + .str = "set-src-ipv6", + .mask = FLOW_ACTION_MASK( + RTE_FLOW_ACTION_TYPE_SET_IPV6_SRC + ), + .map = &flow_actions[0], + .map_idx = &actions_idx + }, + { + .str = "set-dst-ipv6", + .mask = FLOW_ACTION_MASK( + RTE_FLOW_ACTION_TYPE_SET_IPV6_DST + ), + .map = &flow_actions[0], + .map_idx = &actions_idx + }, + { + .str = "set-src-tp", + .mask = FLOW_ACTION_MASK( + RTE_FLOW_ACTION_TYPE_SET_TP_SRC + ), + .map = &flow_actions[0], + .map_idx = &actions_idx + }, + { + .str = "set-dst-tp", + .mask = FLOW_ACTION_MASK( + RTE_FLOW_ACTION_TYPE_SET_TP_DST + ), + .map = &flow_actions[0], + .map_idx = &actions_idx + }, + { + .str = "inc-tcp-ack", + .mask = FLOW_ACTION_MASK( + RTE_FLOW_ACTION_TYPE_INC_TCP_ACK + ), + .map = &flow_actions[0], + .map_idx = &actions_idx + }, + { + .str = "dec-tcp-ack", + .mask = FLOW_ACTION_MASK( + RTE_FLOW_ACTION_TYPE_DEC_TCP_ACK + ), + .map = &flow_actions[0], + .map_idx = &actions_idx + }, + { + .str = "inc-tcp-seq", + .mask = FLOW_ACTION_MASK( + RTE_FLOW_ACTION_TYPE_INC_TCP_SEQ + ), + .map = &flow_actions[0], + .map_idx = &actions_idx + }, + { + .str = "dec-tcp-seq", + .mask = FLOW_ACTION_MASK( + RTE_FLOW_ACTION_TYPE_DEC_TCP_SEQ + ), + .map = &flow_actions[0], + .map_idx = &actions_idx + }, + { + .str = "set-ttl", + .mask = FLOW_ACTION_MASK( + RTE_FLOW_ACTION_TYPE_SET_TTL + ), + .map = &flow_actions[0], + .map_idx = &actions_idx + }, + { + .str = "dec-ttl", + .mask = FLOW_ACTION_MASK( + RTE_FLOW_ACTION_TYPE_DEC_TTL + ), + .map = &flow_actions[0], + .map_idx = &actions_idx + }, + { + .str = "set-ipv4-dscp", + .mask = FLOW_ACTION_MASK( + RTE_FLOW_ACTION_TYPE_SET_IPV4_DSCP + ), + .map = &flow_actions[0], + .map_idx = &actions_idx + }, + { + .str = "set-ipv6-dscp", + .mask = FLOW_ACTION_MASK( + RTE_FLOW_ACTION_TYPE_SET_IPV6_DSCP + ), + .map = &flow_actions[0], + .map_idx = &actions_idx + }, + { + .str = "flag", + .mask = FLOW_ACTION_MASK( + RTE_FLOW_ACTION_TYPE_FLAG + ), + .map = &flow_actions[0], + .map_idx = &actions_idx + }, + { + .str = "meter", + .mask = FLOW_ACTION_MASK( + RTE_FLOW_ACTION_TYPE_METER + ), + .map = &flow_actions[0], + .map_idx = &actions_idx + }, + { + .str = "vxlan-encap", + .mask = FLOW_ACTION_MASK( + RTE_FLOW_ACTION_TYPE_VXLAN_ENCAP + ), + .map = &flow_actions[0], + .map_idx = &actions_idx + }, + { + .str = "vxlan-decap", + .mask = FLOW_ACTION_MASK( + RTE_FLOW_ACTION_TYPE_VXLAN_DECAP + ), + .map = &flow_actions[0], + .map_idx = &actions_idx + }, +}; + static void usage(char *progname) { @@ -253,337 +584,6 @@ args_parse(int argc, char **argv) int opt_idx; size_t i; - static const struct option_dict { - const char *str; - const uint64_t mask; - uint64_t *map; - uint8_t *map_idx; - - } flow_options[] = { - { - .str = "ether", - .mask = FLOW_ITEM_MASK(RTE_FLOW_ITEM_TYPE_ETH), - .map = &flow_items[0], - .map_idx = &items_idx - }, - { - .str = "ipv4", - .mask = FLOW_ITEM_MASK(RTE_FLOW_ITEM_TYPE_IPV4), - .map = &flow_items[0], - .map_idx = &items_idx - }, - { - .str = "ipv6", - .mask = FLOW_ITEM_MASK(RTE_FLOW_ITEM_TYPE_IPV6), - .map = &flow_items[0], - .map_idx = &items_idx - }, - { - .str = "vlan", - .mask = FLOW_ITEM_MASK(RTE_FLOW_ITEM_TYPE_VLAN), - .map = &flow_items[0], - .map_idx = &items_idx - }, - { - .str = "tcp", - .mask = FLOW_ITEM_MASK(RTE_FLOW_ITEM_TYPE_TCP), - .map = &flow_items[0], - .map_idx = &items_idx - }, - { - .str = "udp", - .mask = FLOW_ITEM_MASK(RTE_FLOW_ITEM_TYPE_UDP), - .map = &flow_items[0], - .map_idx = &items_idx - }, - { - .str = "vxlan", - .mask = FLOW_ITEM_MASK(RTE_FLOW_ITEM_TYPE_VXLAN), - .map = &flow_items[0], - .map_idx = &items_idx - }, - { - .str = "vxlan-gpe", - .mask = FLOW_ITEM_MASK(RTE_FLOW_ITEM_TYPE_VXLAN_GPE), - .map = &flow_items[0], - .map_idx = &items_idx - }, - { - .str = "gre", - .mask = FLOW_ITEM_MASK(RTE_FLOW_ITEM_TYPE_GRE), - .map = &flow_items[0], - .map_idx = &items_idx - }, - { - .str = "geneve", - .mask = FLOW_ITEM_MASK(RTE_FLOW_ITEM_TYPE_GENEVE), - .map = &flow_items[0], - .map_idx = &items_idx - }, - { - .str = "gtp", - .mask = FLOW_ITEM_MASK(RTE_FLOW_ITEM_TYPE_GTP), - .map = &flow_items[0], - .map_idx = &items_idx - }, - { - .str = "meta", - .mask = FLOW_ITEM_MASK(RTE_FLOW_ITEM_TYPE_META), - .map = &flow_items[0], - .map_idx = &items_idx - }, - { - .str = "tag", - .mask = FLOW_ITEM_MASK(RTE_FLOW_ITEM_TYPE_TAG), - .map = &flow_items[0], - .map_idx = &items_idx - }, - { - .str = "icmpv4", - .mask = FLOW_ITEM_MASK(RTE_FLOW_ITEM_TYPE_ICMP), - .map = &flow_items[0], - .map_idx = &items_idx - }, - { - .str = "icmpv6", - .mask = FLOW_ITEM_MASK(RTE_FLOW_ITEM_TYPE_ICMP6), - .map = &flow_items[0], - .map_idx = &items_idx - }, - { - .str = "ingress", - .mask = INGRESS, - .map = &flow_attrs[0], - .map_idx = &attrs_idx - }, - { - .str = "egress", - .mask = EGRESS, - .map = &flow_attrs[0], - .map_idx = &attrs_idx - }, - { - .str = "transfer", - .mask = TRANSFER, - .map = &flow_attrs[0], - .map_idx = &attrs_idx - }, - { - .str = "port-id", - .mask = FLOW_ACTION_MASK(RTE_FLOW_ACTION_TYPE_PORT_ID), - .map = &flow_actions[0], - .map_idx = &actions_idx - }, - { - .str = "rss", - .mask = FLOW_ACTION_MASK(RTE_FLOW_ACTION_TYPE_RSS), - .map = &flow_actions[0], - .map_idx = &actions_idx - }, - { - .str = "queue", - .mask = FLOW_ACTION_MASK(RTE_FLOW_ACTION_TYPE_QUEUE), - .map = &flow_actions[0], - .map_idx = &actions_idx - }, - { - .str = "jump", - .mask = FLOW_ACTION_MASK(RTE_FLOW_ACTION_TYPE_JUMP), - .map = &flow_actions[0], - .map_idx = &actions_idx - }, - { - .str = "mark", - .mask = FLOW_ACTION_MASK(RTE_FLOW_ACTION_TYPE_MARK), - .map = &flow_actions[0], - .map_idx = &actions_idx - }, - { - .str = "count", - .mask = FLOW_ACTION_MASK(RTE_FLOW_ACTION_TYPE_COUNT), - .map = &flow_actions[0], - .map_idx = &actions_idx - }, - { - .str = "set-meta", - .mask = FLOW_ACTION_MASK(RTE_FLOW_ACTION_TYPE_SET_META), - .map = &flow_actions[0], - .map_idx = &actions_idx - }, - { - .str = "set-tag", - .mask = FLOW_ACTION_MASK(RTE_FLOW_ACTION_TYPE_SET_TAG), - .map = &flow_actions[0], - .map_idx = &actions_idx - }, - { - .str = "drop", - .mask = FLOW_ACTION_MASK(RTE_FLOW_ACTION_TYPE_DROP), - .map = &flow_actions[0], - .map_idx = &actions_idx - }, - { - .str = "set-src-mac", - .mask = FLOW_ACTION_MASK( - RTE_FLOW_ACTION_TYPE_SET_MAC_SRC - ), - .map = &flow_actions[0], - .map_idx = &actions_idx - }, - { - .str = "set-dst-mac", - .mask = FLOW_ACTION_MASK( - RTE_FLOW_ACTION_TYPE_SET_MAC_DST - ), - .map = &flow_actions[0], - .map_idx = &actions_idx - }, - { - .str = "set-src-ipv4", - .mask = FLOW_ACTION_MASK( - RTE_FLOW_ACTION_TYPE_SET_IPV4_SRC - ), - .map = &flow_actions[0], - .map_idx = &actions_idx - }, - { - .str = "set-dst-ipv4", - .mask = FLOW_ACTION_MASK( - RTE_FLOW_ACTION_TYPE_SET_IPV4_DST - ), - .map = &flow_actions[0], - .map_idx = &actions_idx - }, - { - .str = "set-src-ipv6", - .mask = FLOW_ACTION_MASK( - RTE_FLOW_ACTION_TYPE_SET_IPV6_SRC - ), - .map = &flow_actions[0], - .map_idx = &actions_idx - }, - { - .str = "set-dst-ipv6", - .mask = FLOW_ACTION_MASK( - RTE_FLOW_ACTION_TYPE_SET_IPV6_DST - ), - .map = &flow_actions[0], - .map_idx = &actions_idx - }, - { - .str = "set-src-tp", - .mask = FLOW_ACTION_MASK( - RTE_FLOW_ACTION_TYPE_SET_TP_SRC - ), - .map = &flow_actions[0], - .map_idx = &actions_idx - }, - { - .str = "set-dst-tp", - .mask = FLOW_ACTION_MASK( - RTE_FLOW_ACTION_TYPE_SET_TP_DST - ), - .map = &flow_actions[0], - .map_idx = &actions_idx - }, - { - .str = "inc-tcp-ack", - .mask = FLOW_ACTION_MASK( - RTE_FLOW_ACTION_TYPE_INC_TCP_ACK - ), - .map = &flow_actions[0], - .map_idx = &actions_idx - }, - { - .str = "dec-tcp-ack", - .mask = FLOW_ACTION_MASK( - RTE_FLOW_ACTION_TYPE_DEC_TCP_ACK - ), - .map = &flow_actions[0], - .map_idx = &actions_idx - }, - { - .str = "inc-tcp-seq", - .mask = FLOW_ACTION_MASK( - RTE_FLOW_ACTION_TYPE_INC_TCP_SEQ - ), - .map = &flow_actions[0], - .map_idx = &actions_idx - }, - { - .str = "dec-tcp-seq", - .mask = FLOW_ACTION_MASK( - RTE_FLOW_ACTION_TYPE_DEC_TCP_SEQ - ), - .map = &flow_actions[0], - .map_idx = &actions_idx - }, - { - .str = "set-ttl", - .mask = FLOW_ACTION_MASK( - RTE_FLOW_ACTION_TYPE_SET_TTL - ), - .map = &flow_actions[0], - .map_idx = &actions_idx - }, - { - .str = "dec-ttl", - .mask = FLOW_ACTION_MASK( - RTE_FLOW_ACTION_TYPE_DEC_TTL - ), - .map = &flow_actions[0], - .map_idx = &actions_idx - }, - { - .str = "set-ipv4-dscp", - .mask = FLOW_ACTION_MASK( - RTE_FLOW_ACTION_TYPE_SET_IPV4_DSCP - ), - .map = &flow_actions[0], - .map_idx = &actions_idx - }, - { - .str = "set-ipv6-dscp", - .mask = FLOW_ACTION_MASK( - RTE_FLOW_ACTION_TYPE_SET_IPV6_DSCP - ), - .map = &flow_actions[0], - .map_idx = &actions_idx - }, - { - .str = "flag", - .mask = FLOW_ACTION_MASK( - RTE_FLOW_ACTION_TYPE_FLAG - ), - .map = &flow_actions[0], - .map_idx = &actions_idx - }, - { - .str = "meter", - .mask = FLOW_ACTION_MASK( - RTE_FLOW_ACTION_TYPE_METER - ), - .map = &flow_actions[0], - .map_idx = &actions_idx - }, - { - .str = "vxlan-encap", - .mask = FLOW_ACTION_MASK( - RTE_FLOW_ACTION_TYPE_VXLAN_ENCAP - ), - .map = &flow_actions[0], - .map_idx = &actions_idx - }, - { - .str = "vxlan-decap", - .mask = FLOW_ACTION_MASK( - RTE_FLOW_ACTION_TYPE_VXLAN_DECAP - ), - .map = &flow_actions[0], - .map_idx = &actions_idx - }, - }; - static const struct option lgopts[] = { /* Control */ { "help", 0, 0, 0 }, From patchwork Thu Nov 11 14:23:37 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rongwei Liu X-Patchwork-Id: 104197 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id C8C2BA0548; Thu, 11 Nov 2021 15:24:10 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0790741160; Thu, 11 Nov 2021 15:24:04 +0100 (CET) Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2040.outbound.protection.outlook.com [40.107.244.40]) by mails.dpdk.org (Postfix) with ESMTP id 9AAD64115E for ; Thu, 11 Nov 2021 15:24:02 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MAF7xbUdft8yOvEphPOPv2Ar4Yb+KqpJo5Pemy+6qnQi1CJOMpf+btktvGz6PRSa5BPG4hRBViaJT1vVnEReOrX23hRtB6Z/3+TmFWCXWHR7rul0QD1cqpaLHx//SSZRa0jTmeCf1GeCjXS3FiFPlFRnR63s1LgFZPt6lsv23WyoWjAplNR62MV2KH9ox4zwb+0DFN2etJVECWv/5H58tix5Wc+wiD4MDlOlNxFdVdwSmrvrk95Ze6Lfc0KtSVu37jZTHmGGRv6yg/EOBQTMTLvtXfJoQEO+JSZ9XQpxFtA3KguN8QH9BB/TqmSR3yhFwRyWSeP1FEFEYbYTHSA5Dg== 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=6khPr0QIFNPZ8gBG8HhYx5q+6APCB44Hs/rat82WCKo=; b=alGq4yLnEovoRS7Y7QFhbBH1TarKVgJheOSzLlaVqkJJVBCkZygSEugRuVfeAyAu7UkCoNHRLM1yUlBTL577EitIAbEsu6Ycw2SW9ZDuXaRdLK4A/eN+ToJVk0MMyqulHEAvOeNkKou7sabbI4IvpKbazHJzuAE9E86v1+AK1YECmyygWCH8wPWo7jU8tmSVXQ9kkULUkvMEQ2qdAD2AkWwvXLm6dtycbFBN30qwATElDICeod1NxMTnoRLP41XB+3JNYR2HPXELdnOFWc+OldpGLxlh60gx4mS+dUqhsYJ5HRiZ01AIC16I0/zHvh6BENAse8JbqozazZbMxbCwOg== 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=6khPr0QIFNPZ8gBG8HhYx5q+6APCB44Hs/rat82WCKo=; b=lO8gSi8vhQXqWGeILTXDkke0NIWyyOuT4Y3xLS1WLmwsvrZ8HWocG3DPJ8A2XBYL3S8I6ycB+aee5KYKSUHolaXTB3IHeBxC9WnE9Wvj73DzL1v7PN0nPdxPYvY2bN7wJnN/V1G7vCUh53haNYt7MY52/NmkYl5DrNfBPpJRdT6kQo75HT0p/W6+rHMt/jq0fbYGfCeBYFtToJYjvTd81sEUTE382QqSt+k/qV6vZYHE7lDXABmHfgrWRKQaZyQBrhRF984ykoQA3kvwmKJTd2fdfWzlGk+LE6v6GGi6Jg5UrSaGqcDv3S0t7kTzJGz86vTBDdISHl0omRZSf9+iAA== Received: from DM5PR07CA0158.namprd07.prod.outlook.com (2603:10b6:3:ee::24) by SN6PR12MB2846.namprd12.prod.outlook.com (2603:10b6:805:70::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4690.16; Thu, 11 Nov 2021 14:24:00 +0000 Received: from DM6NAM11FT034.eop-nam11.prod.protection.outlook.com (2603:10b6:3:ee:cafe::37) by DM5PR07CA0158.outlook.office365.com (2603:10b6:3:ee::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4690.19 via Frontend Transport; Thu, 11 Nov 2021 14:24:00 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.34) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;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 DM6NAM11FT034.mail.protection.outlook.com (10.13.173.47) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4690.15 via Frontend Transport; Thu, 11 Nov 2021 14:24: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; Thu, 11 Nov 2021 14:23:57 +0000 From: Rongwei Liu To: , , , , Wisam Jaddo CC: , , Haifei Luo , Jiawei Wang Subject: [PATCH v9 2/5] app/flow-perf: support meter policy API Date: Thu, 11 Nov 2021 16:23:37 +0200 Message-ID: <20211111142340.2209292-3-rongweil@nvidia.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20211111142340.2209292-1-rongweil@nvidia.com> References: <6177033.fEpqbVaury@thomas> <20211111142340.2209292-1-rongweil@nvidia.com> MIME-Version: 1.0 X-Originating-IP: [172.20.187.6] X-ClientProxiedBy: HQMAIL111.nvidia.com (172.20.187.18) To HQMAIL107.nvidia.com (172.20.187.13) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 81d80bd0-5e19-498c-f520-08d9a51ee793 X-MS-TrafficTypeDiagnostic: SN6PR12MB2846: X-LD-Processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:186; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: U9UNn+CFUAKlFfHGMB1ivIRWcLNOpNYTVq1jiJQORKd2ngfVgOZAvkICEO9gsmLYWoxqrN3xoh6dWQYHHHn7e4JGtvGMTF9uTdSuNPldAH/AMbRslD0DIJps7mRFACB78EBbIFF+A0RP7dCh3+5nNHn8sY5KUBth4DIkKwOWUFbzntrjmI4jE4NXg0X/nRbbSqFBlXDUNmmIRbROSu/8vKi/Pgl5dhGZFMIkSZ/o3La+t0tUHYu6pUn6eXxLGWLet0HJRxquYRhFOJlo8i8cHDGF5X2l+QFFpwGXUFixJ4sBtef0rFU1JpS/9nB5evVAUOzL18XUoJ6orD7aYzZrVnJ5Mzd5W69jn661TRDAtVYJwDvDjQyyt+IJzLffRPzqvA3LrP2B417GQHiPJcNZOUAo1ilW7Lr99kjzJESoo5vnD5irgwE4wfMs0JUZkOMtv9B1m2JeTWOM3qZEqcgzT22fDgmcCYOKX8JU0uZk09djqIHMc7tHGNGXFlJ+xaHIpF/8UbLYJkNzST45d6YeAicfOf7zmjj+F8EHwDY4/eARaJytloCjf/20UVpZgQi6orD39QigfKrnFBcvTfUn0c0AAG/hCDCcKuwtKKpHP/8oaw/USX1yVeNERStSecf2lldwUMwYHp5zULRQhoK9EScYCxBYUgUAUqKs0tadBcqfmTOSoG9u/NJtCoOglsEE1YL+wX4iFL8qnxRkhH9ZeQ== 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)(26005)(36756003)(426003)(186003)(107886003)(16526019)(8936002)(5660300002)(1076003)(82310400003)(7636003)(6636002)(83380400001)(47076005)(356005)(7696005)(4326008)(54906003)(110136005)(36860700001)(70206006)(316002)(508600001)(55016002)(336012)(8676002)(36906005)(86362001)(2616005)(6286002)(70586007)(2906002)(6666004); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Nov 2021 14:24:00.0892 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 81d80bd0-5e19-498c-f520-08d9a51ee793 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: DM6NAM11FT034.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR12MB2846 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 Add option "policy-mtr" to indicate if meter creation will include policy or not. Meter creation will keep unchanged without it. With "policy-mtr", the policy is introduced. API create_meter_policy is to create a policy. API create_meter_rule will use it to create a meter. The value of it is used to specify meter policy actions. Signed-off-by: Haifei Luo Signed-off-by: Jiawei Wang Signed-off-by: Rongwei Liu Acked-by: Wisam Jaddo --- app/test-flow-perf/main.c | 142 ++++++++++++++++++++++++++++++--- doc/guides/tools/flow-perf.rst | 4 + 2 files changed, 134 insertions(+), 12 deletions(-) diff --git a/app/test-flow-perf/main.c b/app/test-flow-perf/main.c index 42d13ec495..89596eb3f6 100644 --- a/app/test-flow-perf/main.c +++ b/app/test-flow-perf/main.c @@ -37,6 +37,7 @@ #include #include "config.h" +#include "actions_gen.h" #include "flow_gen.h" #define MAX_BATCHES_COUNT 100 @@ -49,10 +50,13 @@ static uint8_t flow_group; static uint64_t encap_data; static uint64_t decap_data; +static uint64_t all_actions[RTE_COLORS][MAX_ACTIONS_NUM]; +static char *actions_str[RTE_COLORS]; static uint64_t flow_items[MAX_ITEMS_NUM]; static uint64_t flow_actions[MAX_ACTIONS_NUM]; static uint64_t flow_attrs[MAX_ATTRS_NUM]; +static uint32_t policy_id[MAX_PORTS]; static uint8_t items_idx, actions_idx, attrs_idx; static uint64_t ports_mask; @@ -63,6 +67,7 @@ static bool delete_flag; static bool dump_socket_mem_flag; static bool enable_fwd; static bool unique_data; +static bool policy_mtr; static uint8_t rx_queues_count; static uint8_t tx_queues_count; @@ -560,6 +565,8 @@ usage(char *progname) "ipv6 dscp value to be set is random each flow\n"); printf(" --flag: add flag action to flow actions\n"); printf(" --meter: add meter action to flow actions\n"); + printf(" --policy-mtr=\"g1,g2:y1:r1\": to create meter with specified " + "colored actions\n"); printf(" --raw-encap=: add raw encap action to flow actions\n" "Data is the data needed to be encaped\n" "Example: raw-encap=ether,ipv4,udp,vxlan\n"); @@ -572,6 +579,45 @@ usage(char *progname) printf(" --vxlan-decap: add vxlan_decap action to flow actions\n"); } +static void +read_meter_policy(char *prog, char *arg) +{ + char *token; + size_t i, j, k; + + j = 0; + k = 0; + policy_mtr = true; + token = strsep(&arg, ":\0"); + while (token != NULL && j < RTE_COLORS) { + actions_str[j++] = token; + token = strsep(&arg, ":\0"); + } + j = 0; + token = strtok(actions_str[0], ",\0"); + while (token == NULL && j < RTE_COLORS - 1) + token = strtok(actions_str[++j], ",\0"); + while (j < RTE_COLORS && token != NULL) { + for (i = 0; i < RTE_DIM(flow_options); i++) { + if (!strcmp(token, flow_options[i].str)) { + all_actions[j][k++] = flow_options[i].mask; + break; + } + } + /* Reached last action with no match */ + if (i >= RTE_DIM(flow_options)) { + fprintf(stderr, "Invalid colored actions: %s\n", token); + usage(prog); + rte_exit(EXIT_SUCCESS, "Invalid colored actions\n"); + } + token = strtok(NULL, ",\0"); + while (!token && j < RTE_COLORS - 1) { + token = strtok(actions_str[++j], ",\0"); + k = 0; + } + } +} + static void args_parse(int argc, char **argv) { @@ -660,6 +706,7 @@ args_parse(int argc, char **argv) { "raw-decap", 1, 0, 0 }, { "vxlan-encap", 0, 0, 0 }, { "vxlan-decap", 0, 0, 0 }, + { "policy-mtr", 1, 0, 0 }, }; RTE_ETH_FOREACH_DEV(i) @@ -877,6 +924,8 @@ args_parse(int argc, char **argv) RTE_MAX_LCORE); } } + if (strcmp(lgopts[opt_idx].name, "policy-mtr") == 0) + read_meter_policy(argv[0], optarg); break; default: usage(argv[0]); @@ -981,7 +1030,6 @@ print_rules_batches(double *cpu_time_per_batch) } } - static inline int has_meter(void) { @@ -997,12 +1045,66 @@ has_meter(void) return 0; } +static void +create_meter_policy(void) +{ + struct rte_mtr_error error; + int ret, port_id; + struct rte_mtr_meter_policy_params policy; + uint16_t nr_ports; + struct rte_flow_action actions[RTE_COLORS][MAX_ACTIONS_NUM]; + int i; + + memset(actions, 0, sizeof(actions)); + memset(&policy, 0, sizeof(policy)); + nr_ports = rte_eth_dev_count_avail(); + for (port_id = 0; port_id < nr_ports; port_id++) { + for (i = 0; i < RTE_COLORS; i++) + fill_actions(actions[i], all_actions[i], 0, 0, 0, + 0, 0, 0, unique_data, rx_queues_count, + dst_ports[port_id]); + policy.actions[RTE_COLOR_GREEN] = actions[RTE_COLOR_GREEN]; + policy.actions[RTE_COLOR_YELLOW] = actions[RTE_COLOR_YELLOW]; + policy.actions[RTE_COLOR_RED] = actions[RTE_COLOR_RED]; + policy_id[port_id] = port_id + 10; + ret = rte_mtr_meter_policy_add(port_id, policy_id[port_id], + &policy, &error); + if (ret) { + fprintf(stderr, "port %d: failed to create meter policy\n", + port_id); + policy_id[port_id] = UINT32_MAX; + } + memset(actions, 0, sizeof(actions)); + } +} + +static void +destroy_meter_policy(void) +{ + struct rte_mtr_error error; + uint16_t nr_ports; + int port_id; + + nr_ports = rte_eth_dev_count_avail(); + for (port_id = 0; port_id < nr_ports; port_id++) { + /* If port outside portmask */ + if (!((ports_mask >> port_id) & 0x1)) + continue; + + if (rte_mtr_meter_policy_delete + (port_id, policy_id[port_id], &error)) { + fprintf(stderr, "port %u: failed to delete meter policy\n", + port_id); + rte_exit(EXIT_FAILURE, "Error: Failed to delete meter policy.\n"); + } + } +} + static void create_meter_rule(int port_id, uint32_t counter) { int ret; struct rte_mtr_params params; - uint32_t default_prof_id = 100; struct rte_mtr_error error; memset(¶ms, 0, sizeof(struct rte_mtr_params)); @@ -1012,8 +1114,15 @@ create_meter_rule(int port_id, uint32_t counter) params.dscp_table = NULL; /*create meter*/ - params.meter_profile_id = default_prof_id; - ret = rte_mtr_create(port_id, counter, ¶ms, 1, &error); + params.meter_profile_id = DEFAULT_METER_PROF_ID; + + if (!policy_mtr) { + ret = rte_mtr_create(port_id, counter, ¶ms, 1, &error); + } else { + params.meter_policy_id = policy_id[port_id]; + ret = rte_mtr_create(port_id, counter, ¶ms, 0, &error); + } + if (ret != 0) { printf("Port %u create meter idx(%d) error(%d) message: %s\n", port_id, counter, error.type, @@ -1027,11 +1136,16 @@ destroy_meter_rule(int port_id, uint32_t counter) { struct rte_mtr_error error; + if (policy_mtr && policy_id[port_id] != UINT32_MAX) { + if (rte_mtr_meter_policy_delete(port_id, policy_id[port_id], + &error)) + fprintf(stderr, "Error: Failed to delete meter policy\n"); + policy_id[port_id] = UINT32_MAX; + } if (rte_mtr_destroy(port_id, counter, &error)) { - printf("Port %u destroy meter(%d) error(%d) message: %s\n", - port_id, counter, error.type, - error.message ? error.message : "(no stated reason)"); - rte_exit(EXIT_FAILURE, "Error in deleting meter rule\n"); + fprintf(stderr, "Port %d: Failed to delete meter.\n", + port_id); + rte_exit(EXIT_FAILURE, "Error in deleting meter rule"); } } @@ -1136,12 +1250,10 @@ create_meter_profile(void) /* If port outside portmask */ if (!((ports_mask >> port_id) & 0x1)) continue; - mp.alg = RTE_MTR_SRTCM_RFC2697; mp.srtcm_rfc2697.cir = METER_CIR; mp.srtcm_rfc2697.cbs = METER_CIR / 8; mp.srtcm_rfc2697.ebs = 0; - ret = rte_mtr_meter_profile_add (port_id, DEFAULT_METER_PROF_ID, &mp, &error); if (ret != 0) { @@ -2012,16 +2124,22 @@ main(int argc, char **argv) rte_srand(rand_seed); - if (has_meter()) + if (has_meter()) { create_meter_profile(); + if (policy_mtr) + create_meter_policy(); + } rte_eal_mp_remote_launch(run_rte_flow_handler_cores, NULL, CALL_MAIN); if (enable_fwd) { init_lcore_info(); rte_eal_mp_remote_launch(start_forwarding, NULL, CALL_MAIN); } - if (has_meter() && delete_flag) + if (has_meter() && delete_flag) { destroy_meter_profile(); + if (policy_mtr) + destroy_meter_policy(); + } RTE_ETH_FOREACH_DEV(port) { rte_flow_flush(port, &error); diff --git a/doc/guides/tools/flow-perf.rst b/doc/guides/tools/flow-perf.rst index 7d986f0158..e4083f053e 100644 --- a/doc/guides/tools/flow-perf.rst +++ b/doc/guides/tools/flow-perf.rst @@ -384,6 +384,10 @@ Actions: * ``--vxlan-decap`` Add vxlan decap action to all flows actions. +* ``--policy-mtr=`` + Add policy-mtr to create meter with policy and specify policy actions. + Example: policy-mtr=rss,mark::drop + * ``--meter`` Add meter action to all flows actions. Currently, 1 meter profile -> N meter rules -> N rte flows. From patchwork Thu Nov 11 14:23:38 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rongwei Liu X-Patchwork-Id: 104198 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id C235DA0548; Thu, 11 Nov 2021 15:24:20 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7B35740E03; Thu, 11 Nov 2021 15:24:07 +0100 (CET) Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2043.outbound.protection.outlook.com [40.107.220.43]) by mails.dpdk.org (Postfix) with ESMTP id 82C9341169 for ; Thu, 11 Nov 2021 15:24:05 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=f/VzofJ4nu3xfwr8Umzm+Zioxc3CwMm7r/vqiABJrzgnrMqcU99buGRPCK3MkrwVCyg2ysXL9OjnpI0n0RrwhdN21LAEb3XBuClILrkcKvRs5NNyX7lJ6xvOelZQ91IqHtdJ//FI8kRl0yLHQiNRjQIhDcM0Ew1aCGYVY6hFbME+4N1cI0kTVPslLqwlJt3QVhGBpB2yRcZzzqU/RR8R6syrJo5++82XROsWLRkebU+LeeHCp0WHgp61MVnJWWOJJ3vm3ZYQcHLgvkkn04RpOUVIwXclD4YuqW70CFUyU95Ow3449vktLUCF7YGSJAujXEnYwtdqLDx5nGA3eY9jxg== 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=5VKwNSfO7YyqDlpnJHnw/mFO4r1q/iPxFMcRaWyxt1c=; b=MaqrYi0OxaSiN9nIk4ZHeaq1NksBAUKoB/4/hZ1xg80sfxuEL3BYOfAyTR7KY5voB9LwiInUAF7LfcUWqyBKLZjiIovqXYydSQnNzk6V02E4QnCrdeHrFTF2pod306OMdzy9JB0FKWRDvQRMvbpUL9XNlo0RGXrYK1/vr0H3jdEGU+5AZcm65vFtysEIM60rWkePXKYV58vMfFJ6PXzoEQkQmCrwscqcIS/YBbdxE9xtQoCrVa86ZZwcCMi/793qMOiiIuEXYXz6Pi8zy+/blwHbFSP6J1wch7Oq/W3WgvvSzPycLNMTFzoGlefOLEYsUch0TGcRjcMNh6yb+zBOmw== 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=5VKwNSfO7YyqDlpnJHnw/mFO4r1q/iPxFMcRaWyxt1c=; b=tNN6Kd8u3SMCiY5gH4lB4RjQmrLqD3ZS5kkiVpDxI6n2pb+puOfkF+Cg7giEIcrit9u7j8rTa/HhraFqiwQN9AZaSD+uFMhCkdyc03k0PB55be6FSGUqHBU5VXt2bYE2UGcJ0NpyfwsWzPrmArIk1DvPXI4D6fW6ZtPo95svM9ify/Z0QoKCkEPcMDDluwmyR0TnFj8zpn8H7lk282VOsosbod/ije808QCIWjfHp3lwLVg/1fuGoTZYc3RzxNoICFHMJzd/0QPhYJGTKI0P2gRb0jeDcsj8NUxujOBvHtTvQCLNY0dI05lQ2zz2IWYlbvo3wQKphOZCwEF4AHbbqg== Received: from DM5PR05CA0017.namprd05.prod.outlook.com (2603:10b6:3:d4::27) by BY5PR12MB4211.namprd12.prod.outlook.com (2603:10b6:a03:20f::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4690.16; Thu, 11 Nov 2021 14:24:03 +0000 Received: from DM6NAM11FT064.eop-nam11.prod.protection.outlook.com (2603:10b6:3:d4:cafe::7d) by DM5PR05CA0017.outlook.office365.com (2603:10b6:3:d4::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4690.7 via Frontend Transport; Thu, 11 Nov 2021 14:24:03 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.34) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;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 DM6NAM11FT064.mail.protection.outlook.com (10.13.172.234) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4690.15 via Frontend Transport; Thu, 11 Nov 2021 14:24:02 +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; Thu, 11 Nov 2021 14:23:59 +0000 From: Rongwei Liu To: , , , , Wisam Jaddo CC: , Subject: [PATCH v9 3/5] app/flow-perf: support dynamic values for meter profile Date: Thu, 11 Nov 2021 16:23:38 +0200 Message-ID: <20211111142340.2209292-4-rongweil@nvidia.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20211111142340.2209292-1-rongweil@nvidia.com> References: <6177033.fEpqbVaury@thomas> <20211111142340.2209292-1-rongweil@nvidia.com> MIME-Version: 1.0 X-Originating-IP: [172.20.187.6] X-ClientProxiedBy: HQMAIL111.nvidia.com (172.20.187.18) To HQMAIL107.nvidia.com (172.20.187.13) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: cceba6a7-e8ad-4d84-a0bb-08d9a51ee916 X-MS-TrafficTypeDiagnostic: BY5PR12MB4211: X-LD-Processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:5516; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: x/7KY8LCVAVyb1+1N3MlXMG/CAwNnhhhx9nOkE1/2aTOqszlNp0QuHVSTfPntweX3oKWuNKuITZz4Qs7iG4CNvcZgNG89Lc0d0UWkJWOCPJzJGpnvpzGnuOL6bN9kUALUsoYvDstoUidEwBmUjSyhF+hCYwKMjuGrd7yutrD6BUY8q0B1S4OOsifnhOGLCspOpG2rgl9mdBuWy8BFRREA3VmiKQ7kEnqSM1GVLanHl1eF1bq+2PD1l5XR517G5oUn8v86CKJvmqqM8UBYXTLPm4ZxpV32iGzS/xpuCx+6+DcfmCcRtfCVTGdXqY0PAMG8WaN/aEb3lgVbBJHTimfLIoykmusQZgN+63nrGvzeeAvGuHvkk6NH5xB4CZmG08Qzyds5TC6I0rhZLOogAvu4JsdfL9RRfwAvEUJxGsZbFuOjxj0ip8zoGcZJArWDjVoLce8KBNCuZFb12PIp9K2wUi2bsAAbGpAa9UF15EOvup5KAf2Kwna2OT7AI7eWTFxALQe54ye6tjGcTgy4O6sZXSX4DNaZ09kANKiSdC6Z9bmmJzA+IENFHUgHFUkEAvpzTDjbFl6f+QARZDmRmb9bM1uJWsiz3jQezaL0kVdpjSi4WKp/OBHbqkyUkSa7B2zBuRRLU1l8bNSlUdY7rho6mOIvqzwArfePPwU2hGEu1+Ze4aCk9a5m22Drm9v2zJVEdkxZnWusYBDRAbhEykLaA== 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)(6286002)(36906005)(26005)(82310400003)(70586007)(2616005)(316002)(6636002)(1076003)(70206006)(508600001)(6666004)(55016002)(186003)(8676002)(336012)(86362001)(426003)(83380400001)(16526019)(107886003)(2906002)(7696005)(4326008)(36860700001)(5660300002)(36756003)(7636003)(8936002)(47076005)(54906003)(110136005)(356005); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Nov 2021 14:24:02.6512 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: cceba6a7-e8ad-4d84-a0bb-08d9a51ee916 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: DM6NAM11FT064.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR12MB4211 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 Change meter-cir option to meter-profile to cover user input for CIR, CBS & EBS values. The usage is as below: --meter-profile=N1,N2,N3 default value is 1250000 156250 0. Signed-off-by: Rongwei Liu Acked-by: Wisam Jaddo --- app/test-flow-perf/main.c | 24 +++++++++++++++++++++--- doc/guides/tools/flow-perf.rst | 3 +++ 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/app/test-flow-perf/main.c b/app/test-flow-perf/main.c index 89596eb3f6..01bfa20db7 100644 --- a/app/test-flow-perf/main.c +++ b/app/test-flow-perf/main.c @@ -85,6 +85,7 @@ 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; +static uint64_t meter_profile_values[3]; /* CIR CBS EBS values. */ #define MAX_PKT_BURST 32 #define LCORE_MODE_PKT 1 @@ -484,6 +485,9 @@ usage(char *progname) "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"); + printf(" --meter-profile=cir,cbs,ebs: set CIR CBS EBS parameters in meter" + " profile, default values are %d,%d,%d\n", METER_CIR, + METER_CIR / 8, 0); printf("To set flow attributes:\n"); printf(" --ingress: set ingress attribute in flows\n"); @@ -707,6 +711,7 @@ args_parse(int argc, char **argv) { "vxlan-encap", 0, 0, 0 }, { "vxlan-decap", 0, 0, 0 }, { "policy-mtr", 1, 0, 0 }, + { "meter-profile", 1, 0, 0 }, }; RTE_ETH_FOREACH_DEV(i) @@ -926,6 +931,17 @@ args_parse(int argc, char **argv) } if (strcmp(lgopts[opt_idx].name, "policy-mtr") == 0) read_meter_policy(argv[0], optarg); + if (strcmp(lgopts[opt_idx].name, + "meter-profile") == 0) { + i = 0; + token = strsep(&optarg, ",\0"); + while (token != NULL && i < sizeof( + meter_profile_values) / + sizeof(uint64_t)) { + meter_profile_values[i++] = atol(token); + token = strsep(&optarg, ",\0"); + } + } break; default: usage(argv[0]); @@ -1251,9 +1267,11 @@ create_meter_profile(void) if (!((ports_mask >> port_id) & 0x1)) continue; mp.alg = RTE_MTR_SRTCM_RFC2697; - mp.srtcm_rfc2697.cir = METER_CIR; - mp.srtcm_rfc2697.cbs = METER_CIR / 8; - mp.srtcm_rfc2697.ebs = 0; + mp.srtcm_rfc2697.cir = meter_profile_values[0] ? + meter_profile_values[0] : METER_CIR; + mp.srtcm_rfc2697.cbs = meter_profile_values[1] ? + meter_profile_values[1] : METER_CIR / 8; + mp.srtcm_rfc2697.ebs = meter_profile_values[2]; ret = rte_mtr_meter_profile_add (port_id, DEFAULT_METER_PROF_ID, &mp, &error); if (ret != 0) { diff --git a/doc/guides/tools/flow-perf.rst b/doc/guides/tools/flow-perf.rst index e4083f053e..24f0fefcd8 100644 --- a/doc/guides/tools/flow-perf.rst +++ b/doc/guides/tools/flow-perf.rst @@ -134,6 +134,9 @@ The command line options are: * ``--total-mbuf-count=N`` Set the count of total mbuf number, default count is 32000. +* ``--meter-profile=N1,N2,N3`` + Set the CIR, CBS and EBS parameters, default values are 1250000, 156250 and 0. + Attributes: * ``--ingress`` From patchwork Thu Nov 11 14:23:39 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rongwei Liu X-Patchwork-Id: 104199 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id BA365A0548; Thu, 11 Nov 2021 15:24:28 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7648741158; Thu, 11 Nov 2021 15:24:12 +0100 (CET) Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1anam02on2050.outbound.protection.outlook.com [40.107.96.50]) by mails.dpdk.org (Postfix) with ESMTP id 2D5D941152 for ; Thu, 11 Nov 2021 15:24:11 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CNxt8hiy5RM4mYmn3UBmEMSFluM6TWL701Tb/TMUktDiGdlTwuBSuE1LghKueq2nEfQ/v3m4r4s7FxkVqk9zmjAIwqz9iUnb+ozUz/wPmlcXZ6CEuqLXxKwhlNu5+iXQ0xK6ouIUFanII56Q8ArRnRiOVNkTZd6Z4Z/kcmiTw+5GOuNE9wqcEoJO+567L8aD+ZoRr5jYDtfyRg530CK2fNVKo6e3/SS9QPtmp5D8x9YUibTD/91Wdolr8S31JwMAdm95I5ymhf0xjtrptqM1zHoZ3HXlJjCNpHJ59Pi0Uc+a8GUxQXOONVrcHLN1Ap47bapwISeOZvXN+bcKaM8NZw== 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=xkRMO9tMiX//L16pHj16rkQWT4xcqFWWAdBIvy5oTT0=; b=kO4NJT6+9Zj363uYii8NnH8yWGZrbMWT4A1r5fn4uft/MurWpfiVU82vLnwmp0w/rJJ/jME70tAQHqrpc2ASss/Ud4TC1VdyQI5a5T/IarHW+fWxNFG1nSyTKbjpI9lJMPkVuue4/IOLz7miFJye9ye6S3B6o4g3al2HzbYXRPtjZJoKGewtFgfeQdkGyUrQVX3hks/EJxGisWVXHy50eYoNbUe0eeiJZLLDm2UNKBPhx3XpEyyBoKN3lYRYNwLcsPxtzZw5IQ0+9gzqckMWu6/ng2MEgXs30FZPLDHeP6Rajor4J2d8TwCipfQxGSMfUWhTH7LIE82eTKb7WXZHYg== 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=xkRMO9tMiX//L16pHj16rkQWT4xcqFWWAdBIvy5oTT0=; b=PxurHnTIFsFIuKfXVGOPkPFsWaufaQc6/20/WzlS6sFssamiVSX9BuMYDvldWOFmoOR2naV2tyJ2SGowuV2uysIH1ymvmU4tkksjWoc+WDXnEA2cwOm5jxaAaP/+/111bCWlbeZcocNyD0IMT7jtA3p9nUM/2gGo2NBtxDsfGJE1cwHaIGlg1pypAhlF/jMdHUUvmd0UJDpJK/5SCNujv/NFLLPsXz1BRm6Gh2oaIP0pIKz2lBUcPUAYQ3IejF8DxQSPLgpM5jjZm2S9n4lcVr7FImxGXV8HjSNMgCYgagsa7dgKhZGgVX9RfeknDvL092Gpvco0tP9JQ7+e8zKY5w== Received: from DM5PR05CA0015.namprd05.prod.outlook.com (2603:10b6:3:d4::25) by BY5PR12MB4856.namprd12.prod.outlook.com (2603:10b6:a03:1d5::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4690.16; Thu, 11 Nov 2021 14:24:08 +0000 Received: from DM6NAM11FT064.eop-nam11.prod.protection.outlook.com (2603:10b6:3:d4:cafe::30) by DM5PR05CA0015.outlook.office365.com (2603:10b6:3:d4::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4690.15 via Frontend Transport; Thu, 11 Nov 2021 14:24:08 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.34) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;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 DM6NAM11FT064.mail.protection.outlook.com (10.13.172.234) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4690.15 via Frontend Transport; Thu, 11 Nov 2021 14:24:05 +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; Thu, 11 Nov 2021 14:24:02 +0000 From: Rongwei Liu To: , , , , Wisam Jaddo CC: , Subject: [PATCH v9 4/5] app/flow-perf: add packet metering mode Date: Thu, 11 Nov 2021 16:23:39 +0200 Message-ID: <20211111142340.2209292-5-rongweil@nvidia.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20211111142340.2209292-1-rongweil@nvidia.com> References: <6177033.fEpqbVaury@thomas> <20211111142340.2209292-1-rongweil@nvidia.com> MIME-Version: 1.0 X-Originating-IP: [172.20.187.6] X-ClientProxiedBy: HQMAIL111.nvidia.com (172.20.187.18) To HQMAIL107.nvidia.com (172.20.187.13) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 7e1bbc32-7da5-479e-24fb-08d9a51eeab3 X-MS-TrafficTypeDiagnostic: BY5PR12MB4856: X-LD-Processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6108; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: TrpTnELvAiqLk2bPG90BDe+f6jPnWsfyZ0T9O+3qQxKdQmZlykweFFW2MRwK4GZC805sV7tUMh02w5QL0cctwuK8gQTLkGSCqaI50mTCYESpPzrwz7bAugWBFiIckfMPthfqzdx7/4WlVd0LG0XUTL2kEBLK6RMQ2EXvrSMtQG3lEopfWrZvCZcwQs+sNihCyAY9jmOAoWV/ZuCsMXyBVTHWdfZW/+vPjZncxr+sK6CuYnxd36CFuW2e9bI17vhjBxHjezHUalkXWBE9WMxS6w6AZOv6UyobDW7NOJaaoLqLUwLX7BTGFnb6lx+keVf9ruHmINfJkl5HjSSLzQduCzx+utmBUphHiV7n9pk1kTXwWeIGWVVwITvsb234ynR0uJq31UkL/rwA5kINQK/dAH8ck/lDh3eN9VwxClzbOiFWZgE103xFvATRNvTHW3fsssGbkWWETE+DSTy2voFVfB2/YAVSPkkmabG02xmqmDhsTeR7ZsuHru874niIQQTgUMJG9rvEm/Diqb0z64ewbhaXN1qms6Q8GajO1V0IS9vL+u2kIxYUC3jPRSZ7lrBPXd232QHeZFZY+fThNsjV+4RyCX+ow550n8FyxqJO9IpzV1Yd+oFFWidPvU/tfciI9+pgWdNA4M+wCM6SQ/GSR5O3mibEOIQpG2Fib5KdpJ4uOexqP2CzvuH/jtgwyvJeB9O4+MMeX9dMIU0dNomcUw== 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)(7696005)(336012)(82310400003)(1076003)(356005)(6636002)(5660300002)(7636003)(54906003)(55016002)(8676002)(70586007)(70206006)(47076005)(8936002)(508600001)(110136005)(426003)(4326008)(36756003)(2616005)(26005)(186003)(6286002)(107886003)(16526019)(2906002)(316002)(6666004)(36860700001)(86362001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Nov 2021 14:24:05.3747 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7e1bbc32-7da5-479e-24fb-08d9a51eeab3 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: DM6NAM11FT064.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR12MB4856 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 The flow perf application uses the srtcm_rfc2697 as meter profile while doing the meter testing. This patch adds new configuration parameter '--packet-mode' to generate the meter flows with packet cir instead of byte cir. Signed-off-by: Rongwei Liu Acked-by: Wisam Jaddo --- app/test-flow-perf/main.c | 6 ++++++ doc/guides/tools/flow-perf.rst | 3 +++ 2 files changed, 9 insertions(+) diff --git a/app/test-flow-perf/main.c b/app/test-flow-perf/main.c index 01bfa20db7..2b612aa32c 100644 --- a/app/test-flow-perf/main.c +++ b/app/test-flow-perf/main.c @@ -68,6 +68,7 @@ static bool dump_socket_mem_flag; static bool enable_fwd; static bool unique_data; static bool policy_mtr; +static bool packet_mode; static uint8_t rx_queues_count; static uint8_t tx_queues_count; @@ -488,6 +489,7 @@ usage(char *progname) printf(" --meter-profile=cir,cbs,ebs: set CIR CBS EBS parameters in meter" " profile, default values are %d,%d,%d\n", METER_CIR, METER_CIR / 8, 0); + printf(" --packet-mode: to enable packet mode for meter profile\n"); printf("To set flow attributes:\n"); printf(" --ingress: set ingress attribute in flows\n"); @@ -712,6 +714,7 @@ args_parse(int argc, char **argv) { "vxlan-decap", 0, 0, 0 }, { "policy-mtr", 1, 0, 0 }, { "meter-profile", 1, 0, 0 }, + { "packet-mode", 0, 0, 0 }, }; RTE_ETH_FOREACH_DEV(i) @@ -942,6 +945,8 @@ args_parse(int argc, char **argv) token = strsep(&optarg, ",\0"); } } + if (strcmp(lgopts[opt_idx].name, "packet-mode") == 0) + packet_mode = true; break; default: usage(argv[0]); @@ -1272,6 +1277,7 @@ create_meter_profile(void) mp.srtcm_rfc2697.cbs = meter_profile_values[1] ? meter_profile_values[1] : METER_CIR / 8; mp.srtcm_rfc2697.ebs = meter_profile_values[2]; + mp.packet_mode = packet_mode; ret = rte_mtr_meter_profile_add (port_id, DEFAULT_METER_PROF_ID, &mp, &error); if (ret != 0) { diff --git a/doc/guides/tools/flow-perf.rst b/doc/guides/tools/flow-perf.rst index 24f0fefcd8..0176e9c5cb 100644 --- a/doc/guides/tools/flow-perf.rst +++ b/doc/guides/tools/flow-perf.rst @@ -137,6 +137,9 @@ The command line options are: * ``--meter-profile=N1,N2,N3`` Set the CIR, CBS and EBS parameters, default values are 1250000, 156250 and 0. +* ``--packet-mode`` + Enable packet mode for meter profile. + Attributes: * ``--ingress`` From patchwork Thu Nov 11 14:23:40 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rongwei Liu X-Patchwork-Id: 104200 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id ECF3CA0548; Thu, 11 Nov 2021 15:24:35 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7227641163; Thu, 11 Nov 2021 15:24:15 +0100 (CET) Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2045.outbound.protection.outlook.com [40.107.220.45]) by mails.dpdk.org (Postfix) with ESMTP id 91BC54117A; Thu, 11 Nov 2021 15:24:13 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SXLS81714/BLjWNW1aTMA2fUMN8yG4Fk7pAElfhSLOpD/pnbqyqafP801rt8YL25rsgULgCTxb+Q0xA3LCZ9Xf+NbS3t07IM1yd1p1BRvownhiW3T47EnFRRzPPYixJyyjv8RebxFNBkpUUXwsKJGG5260sLg2jTQPdQDL40HENVI+fo56Ain+SMLrWbHlt89yHuMLMWFILeybpLsmQP475BDcxC0BxWeynfvHx07Fd4/9WWK3Y6py7rtEVMu6QNFw6bqQkInODmZwQ1dqJh2kWECrh8eyMZ5mcV+Y2uEuaXWpL69OC48I4iK2Qe0XNKywR4xrDufdMcmPEW4k2ypg== 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=H5aGKPgLFXpsUmSGnN2joCWLlPkEd0GmwqEZOpYd/Fw=; b=HjSQWNh77bkMAkrbMMAWXdvFSuGw5IjwGSpFe2F8t6qdYMfrb9LIvh/NpR77mpOA3t7GlGZ8L1BKh4pfv/yHIdKK1NijFN7PMs0k88lgjHkjcyXycx3U45vb0NaFi4BeFA+ZjLuyp8yMlf3a6Bj1cbaSQabX4n87GtFvYaf59OsiRUO54kOfZRXvP879gDje6dBqFOUWIrYTaNwvVT6OrqP/g+nwHXXY79YaY5C+kR+eaumP+YxVG1wnk/nn65JUwgALePBZWGKsAzsMcl+x8stHqow4m3x/oXxtzxma16ULqrQEiuFWxK5CcmgZLDyG0nyrudGDQ83Ni9AYtuCWEg== 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=H5aGKPgLFXpsUmSGnN2joCWLlPkEd0GmwqEZOpYd/Fw=; b=a395TzVYTsXQaOjtknoNHMlor04i7etIyomdsLQjQR1AdzPPYXyxmiqPM5ONHV8NLQbmXwhnDe2rZaZVkhoXt74sfyWSgMJQqQV0dxvGjmM22+g28QbhpwlQOTKqXSGSzRb5F6AiQYbzsqBUqKv2Zc0wUWQX1uONb0UyQet16fydlDXuhCbnoMc7efJSydyVH6aCHcBn1Lc2pHuw5va8VVGMkzLo2RndGQ1pmeIqcegq2ew1quJlkIVfI6v4tz6fxtDlt6v0hCqbpynfJXWPCiE02vd2xBA0FmGN/WXDJ1YhDbTB7CZ9lCkZUHSEXF0kQShFxbjIRgbUdbPfBFNrsw== Received: from DM5PR05CA0018.namprd05.prod.outlook.com (2603:10b6:3:d4::28) by BY5PR12MB3922.namprd12.prod.outlook.com (2603:10b6:a03:195::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4690.16; Thu, 11 Nov 2021 14:24:10 +0000 Received: from DM6NAM11FT064.eop-nam11.prod.protection.outlook.com (2603:10b6:3:d4:cafe::25) by DM5PR05CA0018.outlook.office365.com (2603:10b6:3:d4::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4690.15 via Frontend Transport; Thu, 11 Nov 2021 14:24:10 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.34) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;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 DM6NAM11FT064.mail.protection.outlook.com (10.13.172.234) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4690.15 via Frontend Transport; Thu, 11 Nov 2021 14:24: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; Thu, 11 Nov 2021 14:24:04 +0000 From: Rongwei Liu To: , , , , Wisam Jaddo , Dong Zhou , Alexander Kozyrev CC: , , Subject: [PATCH v9 5/5] app/flow-perf: fix previous wrong indentation Date: Thu, 11 Nov 2021 16:23:40 +0200 Message-ID: <20211111142340.2209292-6-rongweil@nvidia.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20211111142340.2209292-1-rongweil@nvidia.com> References: <6177033.fEpqbVaury@thomas> <20211111142340.2209292-1-rongweil@nvidia.com> MIME-Version: 1.0 X-Originating-IP: [172.20.187.6] X-ClientProxiedBy: HQMAIL111.nvidia.com (172.20.187.18) To HQMAIL107.nvidia.com (172.20.187.13) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 97dd7e86-5c68-42e6-9a2b-08d9a51eed6d X-MS-TrafficTypeDiagnostic: BY5PR12MB3922: X-LD-Processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:418; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: WMVEZpX2NnGntyi1ve1Lp/A7qniCFdqDZtRoDLGF3KXPBXxc41tQxc65BnJ60uHNNAQawn7/Uim8Ldd5ia2XG1dimF1UI5O41bWlP8z3yVBNcbo1KC177ddYkBTcm2D/6cd/Dg3GY4dP/M0yXpAnavMneRulO+8ZpdbHOj4huDfY2T4JqoOLpEpENVNUy9VBdR+PyZg6u0G+cZCe2QmvXnQsFHyN3SBIDpcjpe7UKEmvC2cT7qBabQGpkgYulcW8pHuVCRqlYPXpgkIEq+ysGfIR1D5zUGgEs/h1Wo1tuQdJi6EY7OX1MRo1b7XQGPYCIrbW0uoWZ9VQU30kh8TJ/+AufOTyp+EskUgFK+ldJV/842NBIulfgtCItKzFhqFrxXO5la6tT9XUNQsT++dP/J8qXxrt3eBOZ9HAOQhH6d8uPm/YsyVgdytNSRC0wyVl6cWoXnwAPthSPmU6cUt0oDxsKY83rxV0pA9Dj7v9zDhd2Bcqj6I54HMjiXooE6QbjqI/VwUGJP3NVbtFXUBG3nyUPEVa6A/oOUWqvz0+ajkYN20AgkgB1KRpyxK0I0Bp7p7AEEgPdTzfeYx1AuPbkTdShyJMsZCynwKESNTcoSfWC+KLP41eMN+wxrAKTsy9VzSbkTUkrS1s/TmupxO/9VWkHNc1b2NWCGZ4uuQvLR64VYMMmntpLsZ60JSVOB5jaEG2FOdALMRfouKtXbNJEQ== 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)(6666004)(6636002)(36906005)(316002)(36860700001)(508600001)(82310400003)(16526019)(186003)(26005)(7696005)(4744005)(70586007)(110136005)(8676002)(83380400001)(47076005)(2616005)(86362001)(36756003)(54906003)(5660300002)(4326008)(336012)(7636003)(8936002)(356005)(426003)(55016002)(2906002)(6286002)(70206006)(1076003); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Nov 2021 14:24:09.9191 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 97dd7e86-5c68-42e6-9a2b-08d9a51eed6d 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: DM6NAM11FT064.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR12MB3922 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 --meter section used wrong indentation previously. Fixes: 6a2cf58a045f ("app/flow-perf: support meter action") Cc: dongzhou@nvidia.com Cc: stable@dpdk.org Signed-off-by: Rongwei Liu --- doc/guides/tools/flow-perf.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/guides/tools/flow-perf.rst b/doc/guides/tools/flow-perf.rst index 0176e9c5cb..41eae15470 100644 --- a/doc/guides/tools/flow-perf.rst +++ b/doc/guides/tools/flow-perf.rst @@ -394,6 +394,6 @@ Actions: Add policy-mtr to create meter with policy and specify policy actions. Example: policy-mtr=rss,mark::drop -* ``--meter`` - Add meter action to all flows actions. - Currently, 1 meter profile -> N meter rules -> N rte flows. +* ``--meter`` + Add meter action to all flows actions. + Currently, 1 meter profile -> N meter rules -> N rte flows.