get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/104113/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 104113,
    "url": "http://patchwork.dpdk.org/api/patches/104113/?format=api",
    "web_url": "http://patchwork.dpdk.org/project/dpdk/patch/20211110125725.2076706-2-rongweil@nvidia.com/",
    "project": {
        "id": 1,
        "url": "http://patchwork.dpdk.org/api/projects/1/?format=api",
        "name": "DPDK",
        "link_name": "dpdk",
        "list_id": "dev.dpdk.org",
        "list_email": "dev@dpdk.org",
        "web_url": "http://core.dpdk.org",
        "scm_url": "git://dpdk.org/dpdk",
        "webscm_url": "http://git.dpdk.org/dpdk",
        "list_archive_url": "https://inbox.dpdk.org/dev",
        "list_archive_url_format": "https://inbox.dpdk.org/dev/{}",
        "commit_url_format": ""
    },
    "msgid": "<20211110125725.2076706-2-rongweil@nvidia.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20211110125725.2076706-2-rongweil@nvidia.com",
    "date": "2021-11-10T12:57:23",
    "name": "[v8,1/3] app/flow-perf: support meter policy API",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "24c43b84547d0a2ce862a1fbd0364c2597d3611c",
    "submitter": {
        "id": 2223,
        "url": "http://patchwork.dpdk.org/api/people/2223/?format=api",
        "name": "rongwei liu",
        "email": "rongweil@nvidia.com"
    },
    "delegate": {
        "id": 1,
        "url": "http://patchwork.dpdk.org/api/users/1/?format=api",
        "username": "tmonjalo",
        "first_name": "Thomas",
        "last_name": "Monjalon",
        "email": "thomas@monjalon.net"
    },
    "mbox": "http://patchwork.dpdk.org/project/dpdk/patch/20211110125725.2076706-2-rongweil@nvidia.com/mbox/",
    "series": [
        {
            "id": 20455,
            "url": "http://patchwork.dpdk.org/api/series/20455/?format=api",
            "web_url": "http://patchwork.dpdk.org/project/dpdk/list/?series=20455",
            "date": "2021-11-10T12:57:22",
            "name": "add meter policy support in flow-perf",
            "version": 8,
            "mbox": "http://patchwork.dpdk.org/series/20455/mbox/"
        }
    ],
    "comments": "http://patchwork.dpdk.org/api/patches/104113/comments/",
    "check": "success",
    "checks": "http://patchwork.dpdk.org/api/patches/104113/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "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])\n\tby inbox.dpdk.org (Postfix) with ESMTP id D162EA034F;\n\tWed, 10 Nov 2021 13:57:58 +0100 (CET)",
            "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id E6B5841142;\n\tWed, 10 Nov 2021 13:57:50 +0100 (CET)",
            "from NAM10-MW2-obe.outbound.protection.outlook.com\n (mail-mw2nam10on2064.outbound.protection.outlook.com [40.107.94.64])\n by mails.dpdk.org (Postfix) with ESMTP id B5068410EF\n for <dev@dpdk.org>; Wed, 10 Nov 2021 13:57:48 +0100 (CET)",
            "from CO2PR04CA0196.namprd04.prod.outlook.com (2603:10b6:104:5::26)\n by BYAPR12MB2743.namprd12.prod.outlook.com (2603:10b6:a03:61::28) with\n Microsoft SMTP Server (version=TLS1_2,\n cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4669.11; Wed, 10 Nov\n 2021 12:57:45 +0000",
            "from CO1NAM11FT008.eop-nam11.prod.protection.outlook.com\n (2603:10b6:104:5:cafe::a5) by CO2PR04CA0196.outlook.office365.com\n (2603:10b6:104:5::26) with Microsoft SMTP Server (version=TLS1_2,\n cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4669.11 via Frontend\n Transport; Wed, 10 Nov 2021 12:57:45 +0000",
            "from mail.nvidia.com (216.228.112.34) by\n CO1NAM11FT008.mail.protection.outlook.com (10.13.175.191) with Microsoft SMTP\n Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id\n 15.20.4690.15 via Frontend Transport; Wed, 10 Nov 2021 12:57:45 +0000",
            "from nvidia.com (172.20.187.5) by HQMAIL107.nvidia.com\n (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Wed, 10 Nov\n 2021 12:57:40 +0000"
        ],
        "ARC-Seal": "i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none;\n b=PzLZ6RYQ0NlHQ3ChQA6m8Gw6IdlSMV7dQEq9nd9gx1b4hsFVWtKJRGNhyfbhMQD43cwiS+NrGsqKzyIovWZZ+7pGlXvM7WUjn3jDi/RiDnu3px1GzvBjkhijyHAYL00Do2GWcBDLCA8JFliiiSm8/JtmSH4TtAE618U0mJNN1HQGKG4ef+Nh4trtSis6cf0aFyIMMrjRzugwy5g7wO+GHq16S4ZjEdDL46i37YHvJRWPJLrWuOUk754NIQvBcXw1ABdnw1Wo983uNTCWvhqY8rYqJvreE9jGOiXDp6YolBOSHTYPJQVmjdGywaWH+68EM8adVacYkEfAuCtX/f7LqQ==",
        "ARC-Message-Signature": "i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com;\n s=arcselector9901;\n 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;\n bh=/lrCIsPGTnie4003xVpcH8/5ihEMnvD8PPIsBTETG+M=;\n b=aqvJwXuweYNUEkOvyZg01mateBGjnIa/PAddf4NXFo0VLaUb+Ilf/OGUDVj5hF5259iJwEfSFGb2FgVX/BiMTV81Mrc5tvYA3R6PZUBRls1dpZxdwgdc5LwniEIsA1SfddZpNI4ugBdFdKU1yMupXbmJk8vgmy0GJ9LuMhgVJCCDRcajsx9uKOrCL0VM50i4Omn6syCuPHJwS3jmiJmzE1FbltveOm4hA+Hoth02tU4a55Ap0HzVSlNSdJs4MRLehPwKYjBvGSYcDI229I2PU1k/kK5IiGmxDGzS631THlUBFWFRb7Y+nnCRRTWvCoF9NLvALa3xXmkNwF5EvAhYZw==",
        "ARC-Authentication-Results": "i=1; mx.microsoft.com 1; spf=pass (sender ip is\n 216.228.112.34) smtp.rcpttodomain=dpdk.org smtp.mailfrom=nvidia.com;\n dmarc=pass (p=quarantine sp=quarantine pct=100) action=none\n header.from=nvidia.com; dkim=none (message not signed); arc=none",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com;\n s=selector2;\n h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;\n bh=/lrCIsPGTnie4003xVpcH8/5ihEMnvD8PPIsBTETG+M=;\n b=c1cv5ULKOHsKWWPGptQVyy32PtVptDCEWxKLXBVH+rHzySIbVH4aRmf82TpNp3RivnpYZHemJ7Gmf0YKz9rRtfo+UEU7bBDGCBVpVPro0R80q2br7WjJRw9Nfb1LYsYPrl0IWKRbblw2zDroRtx5aoBOasSvF5MiPuba03LWSFT9wYm+EBDxs8ViL13f9HfzEIdr7Ryv0cUqWakwm5GXDiBgYtZu0OtnqG5P5LZdkvjkKl0/SR4zvrKyBdH7zN2++WCCqpJMu65YpxxnJS1o1+6bCSIFxT+TDzVyTV3de1UE414AwwBsmBuj48Im/joSp8B2FBlGtYaJjwyBHcooig==",
        "X-MS-Exchange-Authentication-Results": "spf=pass (sender IP is 216.228.112.34)\n smtp.mailfrom=nvidia.com; dpdk.org; dkim=none (message not signed)\n header.d=none;dpdk.org; dmarc=pass action=none header.from=nvidia.com;",
        "Received-SPF": "Pass (protection.outlook.com: domain of nvidia.com designates\n 216.228.112.34 as permitted sender) receiver=protection.outlook.com;\n client-ip=216.228.112.34; helo=mail.nvidia.com;",
        "From": "Rongwei Liu <rongweil@nvidia.com>",
        "To": "<matan@nvidia.com>, <viacheslavo@nvidia.com>, <orika@nvidia.com>,\n <thomas@monjalon.net>, Wisam Jaddo <wisamm@nvidia.com>",
        "CC": "<dev@dpdk.org>, <rasland@nvidia.com>, Haifei Luo <haifeil@nvidia.com>,\n Jiawei Wang <jiaweiw@nvidia.com>",
        "Date": "Wed, 10 Nov 2021 14:57:23 +0200",
        "Message-ID": "<20211110125725.2076706-2-rongweil@nvidia.com>",
        "X-Mailer": "git-send-email 2.27.0",
        "In-Reply-To": "<20211110125725.2076706-1-rongweil@nvidia.com>",
        "References": "<6177033.fEpqbVaury@thomas>\n <20211110125725.2076706-1-rongweil@nvidia.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Content-Type": "text/plain",
        "X-Originating-IP": "[172.20.187.5]",
        "X-ClientProxiedBy": "HQMAIL105.nvidia.com (172.20.187.12) To\n HQMAIL107.nvidia.com (172.20.187.13)",
        "X-EOPAttributedMessage": "0",
        "X-MS-PublicTrafficType": "Email",
        "X-MS-Office365-Filtering-Correlation-Id": "7e6d44c5-ccf1-4417-1b27-08d9a449b0a1",
        "X-MS-TrafficTypeDiagnostic": "BYAPR12MB2743:",
        "X-LD-Processed": "43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr",
        "X-Microsoft-Antispam-PRVS": "\n <BYAPR12MB27434852356F0DF1520303FDAB939@BYAPR12MB2743.namprd12.prod.outlook.com>",
        "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": "\n 9Yb9cRytojr4ntbnD6UhJgWg2YaelinrxNsdSxvMTiBvNAlekjCYWpCpj802W7TcRm0kY4TcZiVYMJa0RmiBh+NKEquMejJLtARDXxo2qWm/AMIo1GsghV3/cVrGelCts7uQ70eAiH33lbJ97HOKCPU26iqE3P5OJrB/VUhaT2w035EVRtqiE64KmSd+/hhw3vqfPLg2KVJTO2xgUe1A7usYZmgXNwAfhiNFT7bmyETDC9m4U2pWEM0QicLf3M39zzAoAidz8v1YbxyAS5Ky9lHj2/oMAP/gMoonsstMqJstCCEBDQiPM/DjsQXv5iYa/jDHqRFFp7B+/6/F1Hc/ujP1c97NBXNKh3NYlVHVs3o/NxgfsZHCkbRXzfOd5SM9xPWpeziP7CWy21CKh01aGu2pq0Bep4XJRwsoZUCE5qhvZmGIdTano1ra2xjiNG19xPF6NnOxuba88CBZ2BnXc43pTgOPKi+iEiK8ps7z7JxYxM5g9Wb7W6MapO9g7ciL6L4Kn9Q/zlZY+90VZ2n59HRJ1m/Vldchywg8yHahZHgTLgBoaPLF2qNAO9T7i5hm0PemMC1gDSd9Sr0z/giDcmz4nUWRQbfaBt+pPmIPlSQGXMKYEkS5RxW77avMQx8SW/c5TbEiuFfCILmHB7TO73wh/DZFK4a/0gS4sl6GUrXoI4oPGNLWso50ALaBxVtmFFi3o5ghSwjeMnvvS+V8/g==",
        "X-Forefront-Antispam-Report": "CIP:216.228.112.34; CTRY:US; LANG:en; SCL:1;\n SRV:;\n IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:schybrid03.nvidia.com; CAT:NONE;\n SFS:(4636009)(36840700001)(46966006)(36860700001)(83380400001)(86362001)(4326008)(5660300002)(30864003)(6286002)(8676002)(26005)(16526019)(186003)(7696005)(82310400003)(6636002)(47076005)(6666004)(36756003)(356005)(1076003)(508600001)(70586007)(70206006)(8936002)(55016002)(54906003)(2616005)(107886003)(316002)(2906002)(426003)(336012)(110136005)(7636003);\n DIR:OUT; SFP:1101;",
        "X-OriginatorOrg": "Nvidia.com",
        "X-MS-Exchange-CrossTenant-OriginalArrivalTime": "10 Nov 2021 12:57:45.1532 (UTC)",
        "X-MS-Exchange-CrossTenant-Network-Message-Id": "\n 7e6d44c5-ccf1-4417-1b27-08d9a449b0a1",
        "X-MS-Exchange-CrossTenant-Id": "43083d15-7273-40c1-b7db-39efd9ccc17a",
        "X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp": "\n TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.112.34];\n Helo=[mail.nvidia.com]",
        "X-MS-Exchange-CrossTenant-AuthSource": "\n CO1NAM11FT008.eop-nam11.prod.protection.outlook.com",
        "X-MS-Exchange-CrossTenant-AuthAs": "Anonymous",
        "X-MS-Exchange-CrossTenant-FromEntityHeader": "HybridOnPrem",
        "X-MS-Exchange-Transport-CrossTenantHeadersStamped": "BYAPR12MB2743",
        "Subject": "[dpdk-dev] [PATCH v8 1/3] app/flow-perf: support meter policy API",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.29",
        "Precedence": "list",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n <mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "List-Archive": "<http://mails.dpdk.org/archives/dev/>",
        "List-Post": "<mailto:dev@dpdk.org>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "List-Subscribe": "<https://mails.dpdk.org/listinfo/dev>,\n <mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "Add option \"policy-mtr\" to indicate if meter creation will include policy\nor not. Meter creation will keep unchanged without it.\n\nWith \"policy-mtr\", the policy is introduced. API create_meter_policy\nis to create a policy. API create_meter_rule will use it to create\na meter. The value of it is used to specify meter policy actions.\n\nSigned-off-by: Haifei Luo <haifeil@nvidia.com>\nSigned-off-by: Jiawei Wang <jiaweiw@nvidia.com>\nSigned-off-by: Rongwei Liu <rongweil@nvidia.com>\nAcked-by: Wisam Monther <wisamm@nvidia.com>\n---\n app/test-flow-perf/main.c      | 804 +++++++++++++++++++--------------\n doc/guides/tools/flow-perf.rst |  10 +-\n 2 files changed, 468 insertions(+), 346 deletions(-)",
    "diff": "diff --git a/app/test-flow-perf/main.c b/app/test-flow-perf/main.c\nindex c1477b14a1..89596eb3f6 100644\n--- a/app/test-flow-perf/main.c\n+++ b/app/test-flow-perf/main.c\n@@ -37,6 +37,7 @@\n #include <rte_mtr.h>\n \n #include \"config.h\"\n+#include \"actions_gen.h\"\n #include \"flow_gen.h\"\n \n #define MAX_BATCHES_COUNT          100\n@@ -49,10 +50,13 @@ static uint8_t flow_group;\n \n static uint64_t encap_data;\n static uint64_t decap_data;\n+static uint64_t all_actions[RTE_COLORS][MAX_ACTIONS_NUM];\n+static char *actions_str[RTE_COLORS];\n \n static uint64_t flow_items[MAX_ITEMS_NUM];\n static uint64_t flow_actions[MAX_ACTIONS_NUM];\n static uint64_t flow_attrs[MAX_ATTRS_NUM];\n+static uint32_t policy_id[MAX_PORTS];\n static uint8_t items_idx, actions_idx, attrs_idx;\n \n static uint64_t ports_mask;\n@@ -63,6 +67,7 @@ static bool delete_flag;\n static bool dump_socket_mem_flag;\n static bool enable_fwd;\n static bool unique_data;\n+static bool policy_mtr;\n \n static uint8_t rx_queues_count;\n static uint8_t tx_queues_count;\n@@ -126,6 +131,337 @@ static struct multi_cores_pool mc_pool = {\n \t.cores_count = 1,\n };\n \n+static const struct option_dict {\n+\tconst char *str;\n+\tconst uint64_t mask;\n+\tuint64_t *map;\n+\tuint8_t *map_idx;\n+\n+} flow_options[] = {\n+\t{\n+\t\t.str = \"ether\",\n+\t\t.mask = FLOW_ITEM_MASK(RTE_FLOW_ITEM_TYPE_ETH),\n+\t\t.map = &flow_items[0],\n+\t\t.map_idx = &items_idx\n+\t},\n+\t{\n+\t\t.str = \"ipv4\",\n+\t\t.mask = FLOW_ITEM_MASK(RTE_FLOW_ITEM_TYPE_IPV4),\n+\t\t.map = &flow_items[0],\n+\t\t.map_idx = &items_idx\n+\t},\n+\t{\n+\t\t.str = \"ipv6\",\n+\t\t.mask = FLOW_ITEM_MASK(RTE_FLOW_ITEM_TYPE_IPV6),\n+\t\t.map = &flow_items[0],\n+\t\t.map_idx = &items_idx\n+\t},\n+\t{\n+\t\t.str = \"vlan\",\n+\t\t.mask = FLOW_ITEM_MASK(RTE_FLOW_ITEM_TYPE_VLAN),\n+\t\t.map = &flow_items[0],\n+\t\t.map_idx = &items_idx\n+\t},\n+\t{\n+\t\t.str = \"tcp\",\n+\t\t.mask = FLOW_ITEM_MASK(RTE_FLOW_ITEM_TYPE_TCP),\n+\t\t.map = &flow_items[0],\n+\t\t.map_idx = &items_idx\n+\t},\n+\t{\n+\t\t.str = \"udp\",\n+\t\t.mask = FLOW_ITEM_MASK(RTE_FLOW_ITEM_TYPE_UDP),\n+\t\t.map = &flow_items[0],\n+\t\t.map_idx = &items_idx\n+\t},\n+\t{\n+\t\t.str = \"vxlan\",\n+\t\t.mask = FLOW_ITEM_MASK(RTE_FLOW_ITEM_TYPE_VXLAN),\n+\t\t.map = &flow_items[0],\n+\t\t.map_idx = &items_idx\n+\t},\n+\t{\n+\t\t.str = \"vxlan-gpe\",\n+\t\t.mask = FLOW_ITEM_MASK(RTE_FLOW_ITEM_TYPE_VXLAN_GPE),\n+\t\t.map = &flow_items[0],\n+\t\t.map_idx = &items_idx\n+\t},\n+\t{\n+\t\t.str = \"gre\",\n+\t\t.mask = FLOW_ITEM_MASK(RTE_FLOW_ITEM_TYPE_GRE),\n+\t\t.map = &flow_items[0],\n+\t\t.map_idx = &items_idx\n+\t},\n+\t{\n+\t\t.str = \"geneve\",\n+\t\t.mask = FLOW_ITEM_MASK(RTE_FLOW_ITEM_TYPE_GENEVE),\n+\t\t.map = &flow_items[0],\n+\t\t.map_idx = &items_idx\n+\t},\n+\t{\n+\t\t.str = \"gtp\",\n+\t\t.mask = FLOW_ITEM_MASK(RTE_FLOW_ITEM_TYPE_GTP),\n+\t\t.map = &flow_items[0],\n+\t\t.map_idx = &items_idx\n+\t},\n+\t{\n+\t\t.str = \"meta\",\n+\t\t.mask = FLOW_ITEM_MASK(RTE_FLOW_ITEM_TYPE_META),\n+\t\t.map = &flow_items[0],\n+\t\t.map_idx = &items_idx\n+\t},\n+\t{\n+\t\t.str = \"tag\",\n+\t\t.mask = FLOW_ITEM_MASK(RTE_FLOW_ITEM_TYPE_TAG),\n+\t\t.map = &flow_items[0],\n+\t\t.map_idx = &items_idx\n+\t},\n+\t{\n+\t\t.str = \"icmpv4\",\n+\t\t.mask = FLOW_ITEM_MASK(RTE_FLOW_ITEM_TYPE_ICMP),\n+\t\t.map = &flow_items[0],\n+\t\t.map_idx = &items_idx\n+\t},\n+\t{\n+\t\t.str = \"icmpv6\",\n+\t\t.mask = FLOW_ITEM_MASK(RTE_FLOW_ITEM_TYPE_ICMP6),\n+\t\t.map = &flow_items[0],\n+\t\t.map_idx = &items_idx\n+\t},\n+\t{\n+\t\t.str = \"ingress\",\n+\t\t.mask = INGRESS,\n+\t\t.map = &flow_attrs[0],\n+\t\t.map_idx = &attrs_idx\n+\t},\n+\t{\n+\t\t.str = \"egress\",\n+\t\t.mask = EGRESS,\n+\t\t.map = &flow_attrs[0],\n+\t\t.map_idx = &attrs_idx\n+\t},\n+\t{\n+\t\t.str = \"transfer\",\n+\t\t.mask = TRANSFER,\n+\t\t.map = &flow_attrs[0],\n+\t\t.map_idx = &attrs_idx\n+\t},\n+\t{\n+\t\t.str = \"port-id\",\n+\t\t.mask = FLOW_ACTION_MASK(RTE_FLOW_ACTION_TYPE_PORT_ID),\n+\t\t.map = &flow_actions[0],\n+\t\t.map_idx = &actions_idx\n+\t},\n+\t{\n+\t\t.str = \"rss\",\n+\t\t.mask = FLOW_ACTION_MASK(RTE_FLOW_ACTION_TYPE_RSS),\n+\t\t.map = &flow_actions[0],\n+\t\t.map_idx = &actions_idx\n+\t},\n+\t{\n+\t\t.str = \"queue\",\n+\t\t.mask = FLOW_ACTION_MASK(RTE_FLOW_ACTION_TYPE_QUEUE),\n+\t\t.map = &flow_actions[0],\n+\t\t.map_idx = &actions_idx\n+\t},\n+\t{\n+\t\t.str = \"jump\",\n+\t\t.mask = FLOW_ACTION_MASK(RTE_FLOW_ACTION_TYPE_JUMP),\n+\t\t.map = &flow_actions[0],\n+\t\t.map_idx = &actions_idx\n+\t},\n+\t{\n+\t\t.str = \"mark\",\n+\t\t.mask = FLOW_ACTION_MASK(RTE_FLOW_ACTION_TYPE_MARK),\n+\t\t.map = &flow_actions[0],\n+\t\t.map_idx = &actions_idx\n+\t},\n+\t{\n+\t\t.str = \"count\",\n+\t\t.mask = FLOW_ACTION_MASK(RTE_FLOW_ACTION_TYPE_COUNT),\n+\t\t.map = &flow_actions[0],\n+\t\t.map_idx = &actions_idx\n+\t},\n+\t{\n+\t\t.str = \"set-meta\",\n+\t\t.mask = FLOW_ACTION_MASK(RTE_FLOW_ACTION_TYPE_SET_META),\n+\t\t.map = &flow_actions[0],\n+\t\t.map_idx = &actions_idx\n+\t},\n+\t{\n+\t\t.str = \"set-tag\",\n+\t\t.mask = FLOW_ACTION_MASK(RTE_FLOW_ACTION_TYPE_SET_TAG),\n+\t\t.map = &flow_actions[0],\n+\t\t.map_idx = &actions_idx\n+\t},\n+\t{\n+\t\t.str = \"drop\",\n+\t\t.mask = FLOW_ACTION_MASK(RTE_FLOW_ACTION_TYPE_DROP),\n+\t\t.map = &flow_actions[0],\n+\t\t.map_idx = &actions_idx\n+\t},\n+\t{\n+\t\t.str = \"set-src-mac\",\n+\t\t.mask = FLOW_ACTION_MASK(\n+\t\t\tRTE_FLOW_ACTION_TYPE_SET_MAC_SRC\n+\t\t),\n+\t\t.map = &flow_actions[0],\n+\t\t.map_idx = &actions_idx\n+\t},\n+\t{\n+\t\t.str = \"set-dst-mac\",\n+\t\t.mask = FLOW_ACTION_MASK(\n+\t\t\tRTE_FLOW_ACTION_TYPE_SET_MAC_DST\n+\t\t),\n+\t\t.map = &flow_actions[0],\n+\t\t.map_idx = &actions_idx\n+\t},\n+\t{\n+\t\t.str = \"set-src-ipv4\",\n+\t\t.mask = FLOW_ACTION_MASK(\n+\t\t\tRTE_FLOW_ACTION_TYPE_SET_IPV4_SRC\n+\t\t),\n+\t\t.map = &flow_actions[0],\n+\t\t.map_idx = &actions_idx\n+\t},\n+\t{\n+\t\t.str = \"set-dst-ipv4\",\n+\t\t.mask = FLOW_ACTION_MASK(\n+\t\t\tRTE_FLOW_ACTION_TYPE_SET_IPV4_DST\n+\t\t),\n+\t\t.map = &flow_actions[0],\n+\t\t.map_idx = &actions_idx\n+\t},\n+\t{\n+\t\t.str = \"set-src-ipv6\",\n+\t\t.mask = FLOW_ACTION_MASK(\n+\t\t\tRTE_FLOW_ACTION_TYPE_SET_IPV6_SRC\n+\t\t),\n+\t\t.map = &flow_actions[0],\n+\t\t.map_idx = &actions_idx\n+\t},\n+\t{\n+\t\t.str = \"set-dst-ipv6\",\n+\t\t.mask = FLOW_ACTION_MASK(\n+\t\t\tRTE_FLOW_ACTION_TYPE_SET_IPV6_DST\n+\t\t),\n+\t\t.map = &flow_actions[0],\n+\t\t.map_idx = &actions_idx\n+\t},\n+\t{\n+\t\t.str = \"set-src-tp\",\n+\t\t.mask = FLOW_ACTION_MASK(\n+\t\t\tRTE_FLOW_ACTION_TYPE_SET_TP_SRC\n+\t\t),\n+\t\t.map = &flow_actions[0],\n+\t\t.map_idx = &actions_idx\n+\t},\n+\t{\n+\t\t.str = \"set-dst-tp\",\n+\t\t.mask = FLOW_ACTION_MASK(\n+\t\t\tRTE_FLOW_ACTION_TYPE_SET_TP_DST\n+\t\t),\n+\t\t.map = &flow_actions[0],\n+\t\t.map_idx = &actions_idx\n+\t},\n+\t{\n+\t\t.str = \"inc-tcp-ack\",\n+\t\t.mask = FLOW_ACTION_MASK(\n+\t\t\tRTE_FLOW_ACTION_TYPE_INC_TCP_ACK\n+\t\t),\n+\t\t.map = &flow_actions[0],\n+\t\t.map_idx = &actions_idx\n+\t},\n+\t{\n+\t\t.str = \"dec-tcp-ack\",\n+\t\t.mask = FLOW_ACTION_MASK(\n+\t\t\tRTE_FLOW_ACTION_TYPE_DEC_TCP_ACK\n+\t\t),\n+\t\t.map = &flow_actions[0],\n+\t\t.map_idx = &actions_idx\n+\t},\n+\t{\n+\t\t.str = \"inc-tcp-seq\",\n+\t\t.mask = FLOW_ACTION_MASK(\n+\t\t\tRTE_FLOW_ACTION_TYPE_INC_TCP_SEQ\n+\t\t),\n+\t\t.map = &flow_actions[0],\n+\t\t.map_idx = &actions_idx\n+\t},\n+\t{\n+\t\t.str = \"dec-tcp-seq\",\n+\t\t.mask = FLOW_ACTION_MASK(\n+\t\t\tRTE_FLOW_ACTION_TYPE_DEC_TCP_SEQ\n+\t\t),\n+\t\t.map = &flow_actions[0],\n+\t\t.map_idx = &actions_idx\n+\t},\n+\t{\n+\t\t.str = \"set-ttl\",\n+\t\t.mask = FLOW_ACTION_MASK(\n+\t\t\tRTE_FLOW_ACTION_TYPE_SET_TTL\n+\t\t),\n+\t\t.map = &flow_actions[0],\n+\t\t.map_idx = &actions_idx\n+\t},\n+\t{\n+\t\t.str = \"dec-ttl\",\n+\t\t.mask = FLOW_ACTION_MASK(\n+\t\t\tRTE_FLOW_ACTION_TYPE_DEC_TTL\n+\t\t),\n+\t\t.map = &flow_actions[0],\n+\t\t.map_idx = &actions_idx\n+\t},\n+\t{\n+\t\t.str = \"set-ipv4-dscp\",\n+\t\t.mask = FLOW_ACTION_MASK(\n+\t\t\tRTE_FLOW_ACTION_TYPE_SET_IPV4_DSCP\n+\t\t),\n+\t\t.map = &flow_actions[0],\n+\t\t.map_idx = &actions_idx\n+\t},\n+\t{\n+\t\t.str = \"set-ipv6-dscp\",\n+\t\t.mask = FLOW_ACTION_MASK(\n+\t\t\tRTE_FLOW_ACTION_TYPE_SET_IPV6_DSCP\n+\t\t),\n+\t\t.map = &flow_actions[0],\n+\t\t.map_idx = &actions_idx\n+\t},\n+\t{\n+\t\t.str = \"flag\",\n+\t\t.mask = FLOW_ACTION_MASK(\n+\t\t\tRTE_FLOW_ACTION_TYPE_FLAG\n+\t\t),\n+\t\t.map = &flow_actions[0],\n+\t\t.map_idx = &actions_idx\n+\t},\n+\t{\n+\t\t.str = \"meter\",\n+\t\t.mask = FLOW_ACTION_MASK(\n+\t\t\tRTE_FLOW_ACTION_TYPE_METER\n+\t\t),\n+\t\t.map = &flow_actions[0],\n+\t\t.map_idx = &actions_idx\n+\t},\n+\t{\n+\t\t.str = \"vxlan-encap\",\n+\t\t.mask = FLOW_ACTION_MASK(\n+\t\t\tRTE_FLOW_ACTION_TYPE_VXLAN_ENCAP\n+\t\t),\n+\t\t.map = &flow_actions[0],\n+\t\t.map_idx = &actions_idx\n+\t},\n+\t{\n+\t\t.str = \"vxlan-decap\",\n+\t\t.mask = FLOW_ACTION_MASK(\n+\t\t\tRTE_FLOW_ACTION_TYPE_VXLAN_DECAP\n+\t\t),\n+\t\t.map = &flow_actions[0],\n+\t\t.map_idx = &actions_idx\n+\t},\n+};\n+\n static void\n usage(char *progname)\n {\n@@ -229,6 +565,8 @@ usage(char *progname)\n \t\t\"ipv6 dscp value to be set is random each flow\\n\");\n \tprintf(\"  --flag: add flag action to flow actions\\n\");\n \tprintf(\"  --meter: add meter action to flow actions\\n\");\n+\tprintf(\"  --policy-mtr=\\\"g1,g2:y1:r1\\\": to create meter with specified \"\n+\t\t\"colored actions\\n\");\n \tprintf(\"  --raw-encap=<data>: add raw encap action to flow actions\\n\"\n \t\t\"Data is the data needed to be encaped\\n\"\n \t\t\"Example: raw-encap=ether,ipv4,udp,vxlan\\n\");\n@@ -241,6 +579,45 @@ usage(char *progname)\n \tprintf(\"  --vxlan-decap: add vxlan_decap action to flow actions\\n\");\n }\n \n+static void\n+read_meter_policy(char *prog, char *arg)\n+{\n+\tchar *token;\n+\tsize_t i, j, k;\n+\n+\tj = 0;\n+\tk = 0;\n+\tpolicy_mtr = true;\n+\ttoken = strsep(&arg, \":\\0\");\n+\twhile (token != NULL && j < RTE_COLORS) {\n+\t\tactions_str[j++] = token;\n+\t\ttoken = strsep(&arg, \":\\0\");\n+\t}\n+\tj = 0;\n+\ttoken = strtok(actions_str[0], \",\\0\");\n+\twhile (token == NULL && j < RTE_COLORS - 1)\n+\t\ttoken = strtok(actions_str[++j], \",\\0\");\n+\twhile (j < RTE_COLORS && token != NULL) {\n+\t\tfor (i = 0; i < RTE_DIM(flow_options); i++) {\n+\t\t\tif (!strcmp(token, flow_options[i].str)) {\n+\t\t\t\tall_actions[j][k++] = flow_options[i].mask;\n+\t\t\t\tbreak;\n+\t\t\t}\n+\t\t}\n+\t\t/* Reached last action with no match */\n+\t\tif (i >= RTE_DIM(flow_options)) {\n+\t\t\tfprintf(stderr, \"Invalid colored actions: %s\\n\", token);\n+\t\t\tusage(prog);\n+\t\t\trte_exit(EXIT_SUCCESS, \"Invalid colored actions\\n\");\n+\t\t}\n+\t\ttoken = strtok(NULL, \",\\0\");\n+\t\twhile (!token && j < RTE_COLORS - 1) {\n+\t\t\ttoken = strtok(actions_str[++j], \",\\0\");\n+\t\t\tk = 0;\n+\t\t}\n+\t}\n+}\n+\n static void\n args_parse(int argc, char **argv)\n {\n@@ -253,337 +630,6 @@ args_parse(int argc, char **argv)\n \tint opt_idx;\n \tsize_t i;\n \n-\tstatic const struct option_dict {\n-\t\tconst char *str;\n-\t\tconst uint64_t mask;\n-\t\tuint64_t *map;\n-\t\tuint8_t *map_idx;\n-\n-\t} flow_options[] = {\n-\t\t{\n-\t\t\t.str = \"ether\",\n-\t\t\t.mask = FLOW_ITEM_MASK(RTE_FLOW_ITEM_TYPE_ETH),\n-\t\t\t.map = &flow_items[0],\n-\t\t\t.map_idx = &items_idx\n-\t\t},\n-\t\t{\n-\t\t\t.str = \"ipv4\",\n-\t\t\t.mask = FLOW_ITEM_MASK(RTE_FLOW_ITEM_TYPE_IPV4),\n-\t\t\t.map = &flow_items[0],\n-\t\t\t.map_idx = &items_idx\n-\t\t},\n-\t\t{\n-\t\t\t.str = \"ipv6\",\n-\t\t\t.mask = FLOW_ITEM_MASK(RTE_FLOW_ITEM_TYPE_IPV6),\n-\t\t\t.map = &flow_items[0],\n-\t\t\t.map_idx = &items_idx\n-\t\t},\n-\t\t{\n-\t\t\t.str = \"vlan\",\n-\t\t\t.mask = FLOW_ITEM_MASK(RTE_FLOW_ITEM_TYPE_VLAN),\n-\t\t\t.map = &flow_items[0],\n-\t\t\t.map_idx = &items_idx\n-\t\t},\n-\t\t{\n-\t\t\t.str = \"tcp\",\n-\t\t\t.mask = FLOW_ITEM_MASK(RTE_FLOW_ITEM_TYPE_TCP),\n-\t\t\t.map = &flow_items[0],\n-\t\t\t.map_idx = &items_idx\n-\t\t},\n-\t\t{\n-\t\t\t.str = \"udp\",\n-\t\t\t.mask = FLOW_ITEM_MASK(RTE_FLOW_ITEM_TYPE_UDP),\n-\t\t\t.map = &flow_items[0],\n-\t\t\t.map_idx = &items_idx\n-\t\t},\n-\t\t{\n-\t\t\t.str = \"vxlan\",\n-\t\t\t.mask = FLOW_ITEM_MASK(RTE_FLOW_ITEM_TYPE_VXLAN),\n-\t\t\t.map = &flow_items[0],\n-\t\t\t.map_idx = &items_idx\n-\t\t},\n-\t\t{\n-\t\t\t.str = \"vxlan-gpe\",\n-\t\t\t.mask = FLOW_ITEM_MASK(RTE_FLOW_ITEM_TYPE_VXLAN_GPE),\n-\t\t\t.map = &flow_items[0],\n-\t\t\t.map_idx = &items_idx\n-\t\t},\n-\t\t{\n-\t\t\t.str = \"gre\",\n-\t\t\t.mask = FLOW_ITEM_MASK(RTE_FLOW_ITEM_TYPE_GRE),\n-\t\t\t.map = &flow_items[0],\n-\t\t\t.map_idx = &items_idx\n-\t\t},\n-\t\t{\n-\t\t\t.str = \"geneve\",\n-\t\t\t.mask = FLOW_ITEM_MASK(RTE_FLOW_ITEM_TYPE_GENEVE),\n-\t\t\t.map = &flow_items[0],\n-\t\t\t.map_idx = &items_idx\n-\t\t},\n-\t\t{\n-\t\t\t.str = \"gtp\",\n-\t\t\t.mask = FLOW_ITEM_MASK(RTE_FLOW_ITEM_TYPE_GTP),\n-\t\t\t.map = &flow_items[0],\n-\t\t\t.map_idx = &items_idx\n-\t\t},\n-\t\t{\n-\t\t\t.str = \"meta\",\n-\t\t\t.mask = FLOW_ITEM_MASK(RTE_FLOW_ITEM_TYPE_META),\n-\t\t\t.map = &flow_items[0],\n-\t\t\t.map_idx = &items_idx\n-\t\t},\n-\t\t{\n-\t\t\t.str = \"tag\",\n-\t\t\t.mask = FLOW_ITEM_MASK(RTE_FLOW_ITEM_TYPE_TAG),\n-\t\t\t.map = &flow_items[0],\n-\t\t\t.map_idx = &items_idx\n-\t\t},\n-\t\t{\n-\t\t\t.str = \"icmpv4\",\n-\t\t\t.mask = FLOW_ITEM_MASK(RTE_FLOW_ITEM_TYPE_ICMP),\n-\t\t\t.map = &flow_items[0],\n-\t\t\t.map_idx = &items_idx\n-\t\t},\n-\t\t{\n-\t\t\t.str = \"icmpv6\",\n-\t\t\t.mask = FLOW_ITEM_MASK(RTE_FLOW_ITEM_TYPE_ICMP6),\n-\t\t\t.map = &flow_items[0],\n-\t\t\t.map_idx = &items_idx\n-\t\t},\n-\t\t{\n-\t\t\t.str = \"ingress\",\n-\t\t\t.mask = INGRESS,\n-\t\t\t.map = &flow_attrs[0],\n-\t\t\t.map_idx = &attrs_idx\n-\t\t},\n-\t\t{\n-\t\t\t.str = \"egress\",\n-\t\t\t.mask = EGRESS,\n-\t\t\t.map = &flow_attrs[0],\n-\t\t\t.map_idx = &attrs_idx\n-\t\t},\n-\t\t{\n-\t\t\t.str = \"transfer\",\n-\t\t\t.mask = TRANSFER,\n-\t\t\t.map = &flow_attrs[0],\n-\t\t\t.map_idx = &attrs_idx\n-\t\t},\n-\t\t{\n-\t\t\t.str = \"port-id\",\n-\t\t\t.mask = FLOW_ACTION_MASK(RTE_FLOW_ACTION_TYPE_PORT_ID),\n-\t\t\t.map = &flow_actions[0],\n-\t\t\t.map_idx = &actions_idx\n-\t\t},\n-\t\t{\n-\t\t\t.str = \"rss\",\n-\t\t\t.mask = FLOW_ACTION_MASK(RTE_FLOW_ACTION_TYPE_RSS),\n-\t\t\t.map = &flow_actions[0],\n-\t\t\t.map_idx = &actions_idx\n-\t\t},\n-\t\t{\n-\t\t\t.str = \"queue\",\n-\t\t\t.mask = FLOW_ACTION_MASK(RTE_FLOW_ACTION_TYPE_QUEUE),\n-\t\t\t.map = &flow_actions[0],\n-\t\t\t.map_idx = &actions_idx\n-\t\t},\n-\t\t{\n-\t\t\t.str = \"jump\",\n-\t\t\t.mask = FLOW_ACTION_MASK(RTE_FLOW_ACTION_TYPE_JUMP),\n-\t\t\t.map = &flow_actions[0],\n-\t\t\t.map_idx = &actions_idx\n-\t\t},\n-\t\t{\n-\t\t\t.str = \"mark\",\n-\t\t\t.mask = FLOW_ACTION_MASK(RTE_FLOW_ACTION_TYPE_MARK),\n-\t\t\t.map = &flow_actions[0],\n-\t\t\t.map_idx = &actions_idx\n-\t\t},\n-\t\t{\n-\t\t\t.str = \"count\",\n-\t\t\t.mask = FLOW_ACTION_MASK(RTE_FLOW_ACTION_TYPE_COUNT),\n-\t\t\t.map = &flow_actions[0],\n-\t\t\t.map_idx = &actions_idx\n-\t\t},\n-\t\t{\n-\t\t\t.str = \"set-meta\",\n-\t\t\t.mask = FLOW_ACTION_MASK(RTE_FLOW_ACTION_TYPE_SET_META),\n-\t\t\t.map = &flow_actions[0],\n-\t\t\t.map_idx = &actions_idx\n-\t\t},\n-\t\t{\n-\t\t\t.str = \"set-tag\",\n-\t\t\t.mask = FLOW_ACTION_MASK(RTE_FLOW_ACTION_TYPE_SET_TAG),\n-\t\t\t.map = &flow_actions[0],\n-\t\t\t.map_idx = &actions_idx\n-\t\t},\n-\t\t{\n-\t\t\t.str = \"drop\",\n-\t\t\t.mask = FLOW_ACTION_MASK(RTE_FLOW_ACTION_TYPE_DROP),\n-\t\t\t.map = &flow_actions[0],\n-\t\t\t.map_idx = &actions_idx\n-\t\t},\n-\t\t{\n-\t\t\t.str = \"set-src-mac\",\n-\t\t\t.mask = FLOW_ACTION_MASK(\n-\t\t\t\tRTE_FLOW_ACTION_TYPE_SET_MAC_SRC\n-\t\t\t),\n-\t\t\t.map = &flow_actions[0],\n-\t\t\t.map_idx = &actions_idx\n-\t\t},\n-\t\t{\n-\t\t\t.str = \"set-dst-mac\",\n-\t\t\t.mask = FLOW_ACTION_MASK(\n-\t\t\t\tRTE_FLOW_ACTION_TYPE_SET_MAC_DST\n-\t\t\t),\n-\t\t\t.map = &flow_actions[0],\n-\t\t\t.map_idx = &actions_idx\n-\t\t},\n-\t\t{\n-\t\t\t.str = \"set-src-ipv4\",\n-\t\t\t.mask = FLOW_ACTION_MASK(\n-\t\t\t\tRTE_FLOW_ACTION_TYPE_SET_IPV4_SRC\n-\t\t\t),\n-\t\t\t.map = &flow_actions[0],\n-\t\t\t.map_idx = &actions_idx\n-\t\t},\n-\t\t{\n-\t\t\t.str = \"set-dst-ipv4\",\n-\t\t\t.mask = FLOW_ACTION_MASK(\n-\t\t\t\tRTE_FLOW_ACTION_TYPE_SET_IPV4_DST\n-\t\t\t),\n-\t\t\t.map = &flow_actions[0],\n-\t\t\t.map_idx = &actions_idx\n-\t\t},\n-\t\t{\n-\t\t\t.str = \"set-src-ipv6\",\n-\t\t\t.mask = FLOW_ACTION_MASK(\n-\t\t\t\tRTE_FLOW_ACTION_TYPE_SET_IPV6_SRC\n-\t\t\t),\n-\t\t\t.map = &flow_actions[0],\n-\t\t\t.map_idx = &actions_idx\n-\t\t},\n-\t\t{\n-\t\t\t.str = \"set-dst-ipv6\",\n-\t\t\t.mask = FLOW_ACTION_MASK(\n-\t\t\t\tRTE_FLOW_ACTION_TYPE_SET_IPV6_DST\n-\t\t\t),\n-\t\t\t.map = &flow_actions[0],\n-\t\t\t.map_idx = &actions_idx\n-\t\t},\n-\t\t{\n-\t\t\t.str = \"set-src-tp\",\n-\t\t\t.mask = FLOW_ACTION_MASK(\n-\t\t\t\tRTE_FLOW_ACTION_TYPE_SET_TP_SRC\n-\t\t\t),\n-\t\t\t.map = &flow_actions[0],\n-\t\t\t.map_idx = &actions_idx\n-\t\t},\n-\t\t{\n-\t\t\t.str = \"set-dst-tp\",\n-\t\t\t.mask = FLOW_ACTION_MASK(\n-\t\t\t\tRTE_FLOW_ACTION_TYPE_SET_TP_DST\n-\t\t\t),\n-\t\t\t.map = &flow_actions[0],\n-\t\t\t.map_idx = &actions_idx\n-\t\t},\n-\t\t{\n-\t\t\t.str = \"inc-tcp-ack\",\n-\t\t\t.mask = FLOW_ACTION_MASK(\n-\t\t\t\tRTE_FLOW_ACTION_TYPE_INC_TCP_ACK\n-\t\t\t),\n-\t\t\t.map = &flow_actions[0],\n-\t\t\t.map_idx = &actions_idx\n-\t\t},\n-\t\t{\n-\t\t\t.str = \"dec-tcp-ack\",\n-\t\t\t.mask = FLOW_ACTION_MASK(\n-\t\t\t\tRTE_FLOW_ACTION_TYPE_DEC_TCP_ACK\n-\t\t\t),\n-\t\t\t.map = &flow_actions[0],\n-\t\t\t.map_idx = &actions_idx\n-\t\t},\n-\t\t{\n-\t\t\t.str = \"inc-tcp-seq\",\n-\t\t\t.mask = FLOW_ACTION_MASK(\n-\t\t\t\tRTE_FLOW_ACTION_TYPE_INC_TCP_SEQ\n-\t\t\t),\n-\t\t\t.map = &flow_actions[0],\n-\t\t\t.map_idx = &actions_idx\n-\t\t},\n-\t\t{\n-\t\t\t.str = \"dec-tcp-seq\",\n-\t\t\t.mask = FLOW_ACTION_MASK(\n-\t\t\t\tRTE_FLOW_ACTION_TYPE_DEC_TCP_SEQ\n-\t\t\t),\n-\t\t\t.map = &flow_actions[0],\n-\t\t\t.map_idx = &actions_idx\n-\t\t},\n-\t\t{\n-\t\t\t.str = \"set-ttl\",\n-\t\t\t.mask = FLOW_ACTION_MASK(\n-\t\t\t\tRTE_FLOW_ACTION_TYPE_SET_TTL\n-\t\t\t),\n-\t\t\t.map = &flow_actions[0],\n-\t\t\t.map_idx = &actions_idx\n-\t\t},\n-\t\t{\n-\t\t\t.str = \"dec-ttl\",\n-\t\t\t.mask = FLOW_ACTION_MASK(\n-\t\t\t\tRTE_FLOW_ACTION_TYPE_DEC_TTL\n-\t\t\t),\n-\t\t\t.map = &flow_actions[0],\n-\t\t\t.map_idx = &actions_idx\n-\t\t},\n-\t\t{\n-\t\t\t.str = \"set-ipv4-dscp\",\n-\t\t\t.mask = FLOW_ACTION_MASK(\n-\t\t\t\tRTE_FLOW_ACTION_TYPE_SET_IPV4_DSCP\n-\t\t\t),\n-\t\t\t.map = &flow_actions[0],\n-\t\t\t.map_idx = &actions_idx\n-\t\t},\n-\t\t{\n-\t\t\t.str = \"set-ipv6-dscp\",\n-\t\t\t.mask = FLOW_ACTION_MASK(\n-\t\t\t\tRTE_FLOW_ACTION_TYPE_SET_IPV6_DSCP\n-\t\t\t),\n-\t\t\t.map = &flow_actions[0],\n-\t\t\t.map_idx = &actions_idx\n-\t\t},\n-\t\t{\n-\t\t\t.str = \"flag\",\n-\t\t\t.mask = FLOW_ACTION_MASK(\n-\t\t\t\tRTE_FLOW_ACTION_TYPE_FLAG\n-\t\t\t),\n-\t\t\t.map = &flow_actions[0],\n-\t\t\t.map_idx = &actions_idx\n-\t\t},\n-\t\t{\n-\t\t\t.str = \"meter\",\n-\t\t\t.mask = FLOW_ACTION_MASK(\n-\t\t\t\tRTE_FLOW_ACTION_TYPE_METER\n-\t\t\t),\n-\t\t\t.map = &flow_actions[0],\n-\t\t\t.map_idx = &actions_idx\n-\t\t},\n-\t\t{\n-\t\t\t.str = \"vxlan-encap\",\n-\t\t\t.mask = FLOW_ACTION_MASK(\n-\t\t\t\tRTE_FLOW_ACTION_TYPE_VXLAN_ENCAP\n-\t\t\t),\n-\t\t\t.map = &flow_actions[0],\n-\t\t\t.map_idx = &actions_idx\n-\t\t},\n-\t\t{\n-\t\t\t.str = \"vxlan-decap\",\n-\t\t\t.mask = FLOW_ACTION_MASK(\n-\t\t\t\tRTE_FLOW_ACTION_TYPE_VXLAN_DECAP\n-\t\t\t),\n-\t\t\t.map = &flow_actions[0],\n-\t\t\t.map_idx = &actions_idx\n-\t\t},\n-\t};\n-\n \tstatic const struct option lgopts[] = {\n \t\t/* Control */\n \t\t{ \"help\",                       0, 0, 0 },\n@@ -660,6 +706,7 @@ args_parse(int argc, char **argv)\n \t\t{ \"raw-decap\",                  1, 0, 0 },\n \t\t{ \"vxlan-encap\",                0, 0, 0 },\n \t\t{ \"vxlan-decap\",                0, 0, 0 },\n+\t\t{ \"policy-mtr\",                 1, 0, 0 },\n \t};\n \n \tRTE_ETH_FOREACH_DEV(i)\n@@ -877,6 +924,8 @@ args_parse(int argc, char **argv)\n \t\t\t\t\t\tRTE_MAX_LCORE);\n \t\t\t\t}\n \t\t\t}\n+\t\t\tif (strcmp(lgopts[opt_idx].name, \"policy-mtr\") == 0)\n+\t\t\t\tread_meter_policy(argv[0], optarg);\n \t\t\tbreak;\n \t\tdefault:\n \t\t\tusage(argv[0]);\n@@ -981,7 +1030,6 @@ print_rules_batches(double *cpu_time_per_batch)\n \t}\n }\n \n-\n static inline int\n has_meter(void)\n {\n@@ -997,12 +1045,66 @@ has_meter(void)\n \treturn 0;\n }\n \n+static void\n+create_meter_policy(void)\n+{\n+\tstruct rte_mtr_error error;\n+\tint ret, port_id;\n+\tstruct rte_mtr_meter_policy_params policy;\n+\tuint16_t nr_ports;\n+\tstruct rte_flow_action actions[RTE_COLORS][MAX_ACTIONS_NUM];\n+\tint i;\n+\n+\tmemset(actions, 0, sizeof(actions));\n+\tmemset(&policy, 0, sizeof(policy));\n+\tnr_ports = rte_eth_dev_count_avail();\n+\tfor (port_id = 0; port_id < nr_ports; port_id++) {\n+\t\tfor (i = 0; i < RTE_COLORS; i++)\n+\t\t\tfill_actions(actions[i], all_actions[i], 0, 0, 0,\n+\t\t\t\t     0, 0, 0, unique_data, rx_queues_count,\n+\t\t\t\t     dst_ports[port_id]);\n+\t\tpolicy.actions[RTE_COLOR_GREEN] = actions[RTE_COLOR_GREEN];\n+\t\tpolicy.actions[RTE_COLOR_YELLOW] = actions[RTE_COLOR_YELLOW];\n+\t\tpolicy.actions[RTE_COLOR_RED] = actions[RTE_COLOR_RED];\n+\t\tpolicy_id[port_id] = port_id + 10;\n+\t\tret = rte_mtr_meter_policy_add(port_id, policy_id[port_id],\n+\t\t\t\t\t       &policy, &error);\n+\t\tif (ret) {\n+\t\t\tfprintf(stderr, \"port %d: failed to create meter policy\\n\",\n+\t\t\t\tport_id);\n+\t\t\tpolicy_id[port_id] = UINT32_MAX;\n+\t\t}\n+\t\tmemset(actions, 0, sizeof(actions));\n+\t}\n+}\n+\n+static void\n+destroy_meter_policy(void)\n+{\n+\tstruct rte_mtr_error error;\n+\tuint16_t nr_ports;\n+\tint port_id;\n+\n+\tnr_ports = rte_eth_dev_count_avail();\n+\tfor (port_id = 0; port_id < nr_ports; port_id++) {\n+\t\t/* If port outside portmask */\n+\t\tif (!((ports_mask >> port_id) & 0x1))\n+\t\t\tcontinue;\n+\n+\t\tif (rte_mtr_meter_policy_delete\n+\t\t\t(port_id, policy_id[port_id], &error)) {\n+\t\t\tfprintf(stderr, \"port %u:  failed to  delete meter policy\\n\",\n+\t\t\t\tport_id);\n+\t\t\trte_exit(EXIT_FAILURE, \"Error: Failed to delete meter policy.\\n\");\n+\t\t}\n+\t}\n+}\n+\n static void\n create_meter_rule(int port_id, uint32_t counter)\n {\n \tint ret;\n \tstruct rte_mtr_params params;\n-\tuint32_t default_prof_id = 100;\n \tstruct rte_mtr_error error;\n \n \tmemset(&params, 0, sizeof(struct rte_mtr_params));\n@@ -1012,8 +1114,15 @@ create_meter_rule(int port_id, uint32_t counter)\n \tparams.dscp_table = NULL;\n \n \t/*create meter*/\n-\tparams.meter_profile_id = default_prof_id;\n-\tret = rte_mtr_create(port_id, counter, &params, 1, &error);\n+\tparams.meter_profile_id = DEFAULT_METER_PROF_ID;\n+\n+\tif (!policy_mtr) {\n+\t\tret = rte_mtr_create(port_id, counter, &params, 1, &error);\n+\t} else {\n+\t\tparams.meter_policy_id = policy_id[port_id];\n+\t\tret = rte_mtr_create(port_id, counter, &params, 0, &error);\n+\t}\n+\n \tif (ret != 0) {\n \t\tprintf(\"Port %u create meter idx(%d) error(%d) message: %s\\n\",\n \t\t\tport_id, counter, error.type,\n@@ -1027,11 +1136,16 @@ destroy_meter_rule(int port_id, uint32_t counter)\n {\n \tstruct rte_mtr_error error;\n \n+\tif (policy_mtr && policy_id[port_id] != UINT32_MAX) {\n+\t\tif (rte_mtr_meter_policy_delete(port_id, policy_id[port_id],\n+\t\t\t\t\t&error))\n+\t\t\tfprintf(stderr, \"Error: Failed to delete meter policy\\n\");\n+\t\tpolicy_id[port_id] = UINT32_MAX;\n+\t}\n \tif (rte_mtr_destroy(port_id, counter, &error)) {\n-\t\tprintf(\"Port %u destroy meter(%d) error(%d) message: %s\\n\",\n-\t\t\tport_id, counter, error.type,\n-\t\t\terror.message ? error.message : \"(no stated reason)\");\n-\t\trte_exit(EXIT_FAILURE, \"Error in deleting meter rule\\n\");\n+\t\tfprintf(stderr, \"Port %d: Failed to delete meter.\\n\",\n+\t\t\t\tport_id);\n+\t\trte_exit(EXIT_FAILURE, \"Error in deleting meter rule\");\n \t}\n }\n \n@@ -1136,12 +1250,10 @@ create_meter_profile(void)\n \t\t/* If port outside portmask */\n \t\tif (!((ports_mask >> port_id) & 0x1))\n \t\t\tcontinue;\n-\n \t\tmp.alg = RTE_MTR_SRTCM_RFC2697;\n \t\tmp.srtcm_rfc2697.cir = METER_CIR;\n \t\tmp.srtcm_rfc2697.cbs = METER_CIR / 8;\n \t\tmp.srtcm_rfc2697.ebs = 0;\n-\n \t\tret = rte_mtr_meter_profile_add\n \t\t\t(port_id, DEFAULT_METER_PROF_ID, &mp, &error);\n \t\tif (ret != 0) {\n@@ -2012,16 +2124,22 @@ main(int argc, char **argv)\n \n \trte_srand(rand_seed);\n \n-\tif (has_meter())\n+\tif (has_meter()) {\n \t\tcreate_meter_profile();\n+\t\tif (policy_mtr)\n+\t\t\tcreate_meter_policy();\n+\t}\n \trte_eal_mp_remote_launch(run_rte_flow_handler_cores, NULL, CALL_MAIN);\n \n \tif (enable_fwd) {\n \t\tinit_lcore_info();\n \t\trte_eal_mp_remote_launch(start_forwarding, NULL, CALL_MAIN);\n \t}\n-\tif (has_meter() && delete_flag)\n+\tif (has_meter() && delete_flag) {\n \t\tdestroy_meter_profile();\n+\t\tif (policy_mtr)\n+\t\t\tdestroy_meter_policy();\n+\t}\n \n \tRTE_ETH_FOREACH_DEV(port) {\n \t\trte_flow_flush(port, &error);\ndiff --git a/doc/guides/tools/flow-perf.rst b/doc/guides/tools/flow-perf.rst\nindex 7d986f0158..ec6994e412 100644\n--- a/doc/guides/tools/flow-perf.rst\n+++ b/doc/guides/tools/flow-perf.rst\n@@ -384,6 +384,10 @@ Actions:\n *\t``--vxlan-decap``\n \tAdd vxlan decap action to all flows actions.\n \n-*       ``--meter``\n-        Add meter action to all flows actions.\n-        Currently, 1 meter profile -> N meter rules -> N rte flows.\n+*\t``--policy-mtr=<str>``\n+\tAdd policy-mtr to create meter with policy and specify policy actions.\n+\tExample: policy-mtr=rss,mark::drop\n+\n+*\t``--meter``\n+\tAdd meter action to all flows actions.\n+\tCurrently, 1 meter profile -> N meter rules -> N rte flows.\n",
    "prefixes": [
        "v8",
        "1/3"
    ]
}