get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 107188,
    "url": "http://patches.dpdk.org/api/patches/107188/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20220209213809.1208269-6-akozyrev@nvidia.com/",
    "project": {
        "id": 1,
        "url": "http://patches.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": "<20220209213809.1208269-6-akozyrev@nvidia.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20220209213809.1208269-6-akozyrev@nvidia.com",
    "date": "2022-02-09T21:38:04",
    "name": "[v4,05/10] app/testpmd: implement rte flow template management",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "cc3d6a7c5c066a3ce0b9d64eab876718c0f871cb",
    "submitter": {
        "id": 1873,
        "url": "http://patches.dpdk.org/api/people/1873/?format=api",
        "name": "Alexander Kozyrev",
        "email": "akozyrev@nvidia.com"
    },
    "delegate": {
        "id": 319,
        "url": "http://patches.dpdk.org/api/users/319/?format=api",
        "username": "fyigit",
        "first_name": "Ferruh",
        "last_name": "Yigit",
        "email": "ferruh.yigit@amd.com"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/20220209213809.1208269-6-akozyrev@nvidia.com/mbox/",
    "series": [
        {
            "id": 21577,
            "url": "http://patches.dpdk.org/api/series/21577/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=21577",
            "date": "2022-02-09T21:37:59",
            "name": "ethdev: datapath-focused flow rules management",
            "version": 4,
            "mbox": "http://patches.dpdk.org/series/21577/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/107188/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/107188/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 B5FEAA0032;\n\tWed,  9 Feb 2022 22:39:12 +0100 (CET)",
            "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 6C7F64116A;\n\tWed,  9 Feb 2022 22:38:52 +0100 (CET)",
            "from NAM10-MW2-obe.outbound.protection.outlook.com\n (mail-mw2nam10on2045.outbound.protection.outlook.com [40.107.94.45])\n by mails.dpdk.org (Postfix) with ESMTP id D9E8441177\n for <dev@dpdk.org>; Wed,  9 Feb 2022 22:38:50 +0100 (CET)",
            "from BY5PR12MB4132.namprd12.prod.outlook.com (2603:10b6:a03:209::22)\n by MW2PR12MB4684.namprd12.prod.outlook.com (2603:10b6:302:13::29)\n with Microsoft SMTP Server (version=TLS1_2,\n cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4951.17; Wed, 9 Feb\n 2022 21:38:48 +0000",
            "from MWHPR1201CA0006.namprd12.prod.outlook.com\n (2603:10b6:301:4a::16) by BY5PR12MB4132.namprd12.prod.outlook.com\n (2603:10b6:a03:209::22) with Microsoft SMTP Server (version=TLS1_2,\n cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4951.12; Wed, 9 Feb\n 2022 21:38:47 +0000",
            "from CO1NAM11FT020.eop-nam11.prod.protection.outlook.com\n (2603:10b6:301:4a:cafe::4e) by MWHPR1201CA0006.outlook.office365.com\n (2603:10b6:301:4a::16) with Microsoft SMTP Server (version=TLS1_2,\n cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4975.11 via Frontend\n Transport; Wed, 9 Feb 2022 21:38:47 +0000",
            "from mail.nvidia.com (12.22.5.234) by\n CO1NAM11FT020.mail.protection.outlook.com (10.13.174.149) with Microsoft SMTP\n Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id\n 15.20.4975.11 via Frontend Transport; Wed, 9 Feb 2022 21:38:46 +0000",
            "from rnnvmail201.nvidia.com (10.129.68.8) by DRHQMAIL101.nvidia.com\n (10.27.9.10) with Microsoft SMTP Server (TLS) id 15.0.1497.18;\n Wed, 9 Feb 2022 21:38:46 +0000",
            "from pegasus01.mtr.labs.mlnx (10.126.231.35) by\n rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server\n (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.9;\n Wed, 9 Feb 2022 13:38:43 -0800"
        ],
        "ARC-Seal": "i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none;\n b=jWxF0Ni8kJs84nzsiLsAEnDt/1wLXv9ITHIWUxFZKzTuN/EPBbgy/wpKTtqH37WvuaeyHa2cetaVVS4b6NLdiXNciRfo87fTk5Im6+RB87Z8faoOFOBsos0BLTfyrdVOozdU3uUI9Hd4ZNIdX/nsSvNzDPQMy/kEPbii3cybV0GRgzKXpZqN7Zaw2faKaZWT2KLF0Xk0WmwIQXSvSBb3gsl4gyRol39V2hKpIuY5+iLKT0l1UYi9LaTKl5Hkgo1dwnlNkYwOAazMaMIDBM48s0g15Kcf/TD6ZgGM8UiD0FeZKFtqNKXIWF0lMD4jIPrMnjlDFPCi9PJIpyNf9/w80Q==",
        "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=lX+dE49mPw4H3osU7IQEhmpLX8bovdemmy5E5H8HZfM=;\n b=A4XSlOyrMUwLMZizMBPjvrjGu86PNvh5nPRk5O8SDohBRRuDriI2Se7hrPh+kot38f+m7ptbqJ3D5377Bmt+hqYRWoCtpJgojA6G1VOio9hFY8ZW9DhapwzxGxBfySRIenYwkheqa/8ftGxw7A3eYWTui0UV5+k0fQlEg7TKDw/cY0JPTJaMhEkDxU6rMD0q/PsByZjMv0hcawA3pDCXuNT4AWFZ50NZDRl9zPahUA+Q91GQSbcUYjDH3XBceYZ/0qDyzjBlS/nh4VkAuvdcdh4Qf3A5ZSqgdScd7hdBGGPwYF2Ju4ZTkylePRtipU5X3gkc4vgICMf/muFKj0iPtw==",
        "ARC-Authentication-Results": "i=1; mx.microsoft.com 1; spf=pass (sender ip is\n 12.22.5.234) smtp.rcpttodomain=intel.com smtp.mailfrom=nvidia.com; dmarc=pass\n (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none\n (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=lX+dE49mPw4H3osU7IQEhmpLX8bovdemmy5E5H8HZfM=;\n b=cx5mXrqrJJOox1vhQIWZG/u+QChH4bfPsBbH/7FZ3ASKAPiUqicmJmfJdVXI3sydfcPjElzrHj0Y/e+BtS2HeIuLq7EIjvHd0Q8AZeMBtK79dLTwwsO8PkY4vlgogEgOmvppG+XDVRexxXIBpOpD9FPF/7OrAz1n9hFmpZ2X8pD04vy5MBFDoi3q8fnmGqKDDQD+1oj9jSkmgUqi9DzOAHdTeFB+gTDP+yUO9VWXQf/C1X1f9OhL8FeVJjxfKadu8EOWhnYdLBvn1wBaFxehQPnInpI0TQnm2ZyDFGYnFyGnwQSp2RiF68Q+VsaXfyFmqkvIwOdpctmvhiaZ0hbxoQ==",
        "X-MS-Exchange-Authentication-Results": "spf=pass (sender IP is 12.22.5.234)\n smtp.mailfrom=nvidia.com; dkim=none (message not signed)\n header.d=none;dmarc=pass action=none header.from=nvidia.com;",
        "Received-SPF": "Pass (protection.outlook.com: domain of nvidia.com designates\n 12.22.5.234 as permitted sender) receiver=protection.outlook.com;\n client-ip=12.22.5.234; helo=mail.nvidia.com;",
        "From": "Alexander Kozyrev <akozyrev@nvidia.com>",
        "To": "<dev@dpdk.org>",
        "CC": "<orika@nvidia.com>, <thomas@monjalon.net>, <ivan.malov@oktetlabs.ru>,\n <andrew.rybchenko@oktetlabs.ru>, <ferruh.yigit@intel.com>,\n <mohammad.abdul.awal@intel.com>, <qi.z.zhang@intel.com>,\n <jerinj@marvell.com>, <ajit.khaparde@broadcom.com>,\n <bruce.richardson@intel.com>",
        "Subject": "[PATCH v4 05/10] app/testpmd: implement rte flow template management",
        "Date": "Wed, 9 Feb 2022 23:38:04 +0200",
        "Message-ID": "<20220209213809.1208269-6-akozyrev@nvidia.com>",
        "X-Mailer": "git-send-email 2.18.2",
        "In-Reply-To": "<20220209213809.1208269-1-akozyrev@nvidia.com>",
        "References": "<20220206032526.816079-1-akozyrev@nvidia.com >\n <20220209213809.1208269-1-akozyrev@nvidia.com>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain",
        "X-Originating-IP": "[10.126.231.35]",
        "X-ClientProxiedBy": "rnnvmail202.nvidia.com (10.129.68.7) To\n rnnvmail201.nvidia.com (10.129.68.8)",
        "X-EOPAttributedMessage": "0",
        "X-MS-PublicTrafficType": "Email",
        "X-MS-Office365-Filtering-Correlation-Id": "8dda8089-f72e-4aec-8e13-08d9ec148dba",
        "X-MS-TrafficTypeDiagnostic": "BY5PR12MB4132:EE_|MW2PR12MB4684:EE_",
        "X-LD-Processed": "43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr,ExtAddr",
        "X-Microsoft-Antispam-PRVS": "\n <BY5PR12MB4132CBF1C96AF5ABAC639BFDAF2E9@BY5PR12MB4132.namprd12.prod.outlook.com>",
        "X-MS-Oob-TLC-OOBClassifiers": "OLM:2331;",
        "X-MS-Exchange-SenderADCheck": "1",
        "X-MS-Exchange-AntiSpam-Relay": "0",
        "X-Microsoft-Antispam": "BCL:0;",
        "X-Microsoft-Antispam-Message-Info": "\n PwEqkf/QWeFqjRcv345xRTZB3kUPb/5DqMdkgZaf1+6vN3681xvAcpDaUhptWSaCv95eInIDCbltMypaXhVOIyvaIwt5UfRE59WhEwc979uW4YWrqJH0zAQzkKp+t4C5b71G+r9ChuLb9J5MZy5+ZGPS8Yw7+ROKl11z9tT4oZYMNZ/DCQ/H2srnz0xgl96yqZQQ5eoB0ELqxYBoHM5ffVaOxVK+5aapbz7B58Jv9iWOTIDUYdvjWFUg41WvtOUk+ZEENPoRKvFjjceq0YxTQLH43nf5jvr/6KCOL8NVdBUzJvoJ+xfPNZep2oENmSaV69bMNpdwI0ExEdszU5oWUYJTqluaN5rmictqjxGG8I6AuukqDn4fE9Rmbb5ZKe4akB0xqRYW544v/dl6hqNlWfbGp3taOEWaCHjuaScECmr/bjRWv3KhRqajMYtCzwqwh+ovkOob7WyOVQBcBGD8n+yNOXuCfx3bcs/ncXt5lIMmAQUPy4fh+oSSrCUq6Bn+71sqk3geAcwtzOF6Wl8JG32HcVTmTmOSnnOq8ieg3eCCxlN+1AynyCVkXCIO+mNmd+nXJvjnQMOik4j1su/tCGc8aMAE0BNkT3Dv2NfpM091H6C+3e/rm4qwW6kpMoL4h8x+ceQOs2+j3AYyG7VK4mQX25ktDjP2jQnBmZSmE1NMvZg9ZRsIliMLm0E47171U7ITN6QIdMoQgKBu4WLq1w==",
        "X-Forefront-Antispam-Report": "CIP:12.22.5.234; CTRY:US; LANG:en; SCL:1; SRV:;\n IPV:CAL; SFV:NSPM; H:mail.nvidia.com; PTR:InfoNoRecords; CAT:NONE;\n SFS:(13230001)(4636009)(46966006)(36840700001)(40470700004)(8676002)(316002)(8936002)(70586007)(70206006)(82310400004)(6666004)(86362001)(4326008)(356005)(508600001)(6916009)(81166007)(54906003)(40460700003)(36756003)(1076003)(16526019)(186003)(2906002)(5660300002)(426003)(336012)(47076005)(26005)(36860700001)(30864003)(7416002)(2616005)(83380400001)(36900700001);\n DIR:OUT; SFP:1101;",
        "X-OriginatorOrg": "Nvidia.com",
        "X-MS-Exchange-CrossTenant-OriginalArrivalTime": "09 Feb 2022 21:38:46.9856 (UTC)",
        "X-MS-Exchange-CrossTenant-Network-Message-Id": "\n 8dda8089-f72e-4aec-8e13-08d9ec148dba",
        "X-MS-Exchange-CrossTenant-Id": "43083d15-7273-40c1-b7db-39efd9ccc17a",
        "X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp": "\n TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[12.22.5.234];\n Helo=[mail.nvidia.com]",
        "X-MS-Exchange-CrossTenant-FromEntityHeader": "HybridOnPrem",
        "X-MS-Exchange-CrossTenant-AuthSource": "\n CO1NAM11FT020.eop-nam11.prod.protection.outlook.com",
        "X-MS-Exchange-CrossTenant-AuthAs": "Anonymous",
        "X-MS-Exchange-Transport-CrossTenantHeadersStamped": "MW2PR12MB4684",
        "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"
    },
    "content": "Add testpmd support for the rte_flow_pattern_template and\nrte_flow_actions_template APIs. Provide the command line interface\nfor the template creation/destruction. Usage example:\n  testpmd> flow pattern_template 0 create pattern_template_id 2\n           template eth dst is 00:16:3e:31:15:c3 / end\n  testpmd> flow actions_template 0 create actions_template_id 4\n           template drop / end mask drop / end\n  testpmd> flow actions_template 0 destroy actions_template 4\n  testpmd> flow pattern_template 0 destroy pattern_template 2\n\nSigned-off-by: Alexander Kozyrev <akozyrev@nvidia.com>\nAcked-by: Ori Kam <orika@nvidia.com>\n---\n app/test-pmd/cmdline_flow.c                 | 376 +++++++++++++++++++-\n app/test-pmd/config.c                       | 203 +++++++++++\n app/test-pmd/testpmd.h                      |  23 ++\n doc/guides/testpmd_app_ug/testpmd_funcs.rst |  97 +++++\n 4 files changed, 697 insertions(+), 2 deletions(-)",
    "diff": "diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c\nindex cc3003e6eb..34bc73eea3 100644\n--- a/app/test-pmd/cmdline_flow.c\n+++ b/app/test-pmd/cmdline_flow.c\n@@ -56,6 +56,8 @@ enum index {\n \tCOMMON_POLICY_ID,\n \tCOMMON_FLEX_HANDLE,\n \tCOMMON_FLEX_TOKEN,\n+\tCOMMON_PATTERN_TEMPLATE_ID,\n+\tCOMMON_ACTIONS_TEMPLATE_ID,\n \n \t/* TOP-level command. */\n \tADD,\n@@ -74,6 +76,8 @@ enum index {\n \t/* Sub-level commands. */\n \tINFO,\n \tCONFIGURE,\n+\tPATTERN_TEMPLATE,\n+\tACTIONS_TEMPLATE,\n \tINDIRECT_ACTION,\n \tVALIDATE,\n \tCREATE,\n@@ -92,6 +96,22 @@ enum index {\n \tFLEX_ITEM_CREATE,\n \tFLEX_ITEM_DESTROY,\n \n+\t/* Pattern template arguments. */\n+\tPATTERN_TEMPLATE_CREATE,\n+\tPATTERN_TEMPLATE_DESTROY,\n+\tPATTERN_TEMPLATE_CREATE_ID,\n+\tPATTERN_TEMPLATE_DESTROY_ID,\n+\tPATTERN_TEMPLATE_RELAXED_MATCHING,\n+\tPATTERN_TEMPLATE_SPEC,\n+\n+\t/* Actions template arguments. */\n+\tACTIONS_TEMPLATE_CREATE,\n+\tACTIONS_TEMPLATE_DESTROY,\n+\tACTIONS_TEMPLATE_CREATE_ID,\n+\tACTIONS_TEMPLATE_DESTROY_ID,\n+\tACTIONS_TEMPLATE_SPEC,\n+\tACTIONS_TEMPLATE_MASK,\n+\n \t/* Tunnel arguments. */\n \tTUNNEL_CREATE,\n \tTUNNEL_CREATE_TYPE,\n@@ -861,6 +881,10 @@ struct buffer {\n \t\t\tuint32_t nb_queue;\n \t\t\tstruct rte_flow_queue_attr queue_attr;\n \t\t} configure; /**< Configuration arguments. */\n+\t\tstruct {\n+\t\t\tuint32_t *template_id;\n+\t\t\tuint32_t template_id_n;\n+\t\t} templ_destroy; /**< Template destroy arguments. */\n \t\tstruct {\n \t\t\tuint32_t *action_id;\n \t\t\tuint32_t action_id_n;\n@@ -869,10 +893,13 @@ struct buffer {\n \t\t\tuint32_t action_id;\n \t\t} ia; /* Indirect action query arguments */\n \t\tstruct {\n+\t\t\tuint32_t pat_templ_id;\n+\t\t\tuint32_t act_templ_id;\n \t\t\tstruct rte_flow_attr attr;\n \t\t\tstruct tunnel_ops tunnel_ops;\n \t\t\tstruct rte_flow_item *pattern;\n \t\t\tstruct rte_flow_action *actions;\n+\t\t\tstruct rte_flow_action *masks;\n \t\t\tuint32_t pattern_n;\n \t\t\tuint32_t actions_n;\n \t\t\tuint8_t *data;\n@@ -952,6 +979,43 @@ static const enum index next_config_attr[] = {\n \tZERO,\n };\n \n+static const enum index next_pt_subcmd[] = {\n+\tPATTERN_TEMPLATE_CREATE,\n+\tPATTERN_TEMPLATE_DESTROY,\n+\tZERO,\n+};\n+\n+static const enum index next_pt_attr[] = {\n+\tPATTERN_TEMPLATE_CREATE_ID,\n+\tPATTERN_TEMPLATE_RELAXED_MATCHING,\n+\tPATTERN_TEMPLATE_SPEC,\n+\tZERO,\n+};\n+\n+static const enum index next_pt_destroy_attr[] = {\n+\tPATTERN_TEMPLATE_DESTROY_ID,\n+\tEND,\n+\tZERO,\n+};\n+\n+static const enum index next_at_subcmd[] = {\n+\tACTIONS_TEMPLATE_CREATE,\n+\tACTIONS_TEMPLATE_DESTROY,\n+\tZERO,\n+};\n+\n+static const enum index next_at_attr[] = {\n+\tACTIONS_TEMPLATE_CREATE_ID,\n+\tACTIONS_TEMPLATE_SPEC,\n+\tZERO,\n+};\n+\n+static const enum index next_at_destroy_attr[] = {\n+\tACTIONS_TEMPLATE_DESTROY_ID,\n+\tEND,\n+\tZERO,\n+};\n+\n static const enum index next_ia_create_attr[] = {\n \tINDIRECT_ACTION_CREATE_ID,\n \tINDIRECT_ACTION_INGRESS,\n@@ -1991,6 +2055,12 @@ static int parse_isolate(struct context *, const struct token *,\n static int parse_configure(struct context *, const struct token *,\n \t\t\t   const char *, unsigned int,\n \t\t\t   void *, unsigned int);\n+static int parse_template(struct context *, const struct token *,\n+\t\t\t  const char *, unsigned int,\n+\t\t\t  void *, unsigned int);\n+static int parse_template_destroy(struct context *, const struct token *,\n+\t\t\t\t  const char *, unsigned int,\n+\t\t\t\t  void *, unsigned int);\n static int parse_tunnel(struct context *, const struct token *,\n \t\t\tconst char *, unsigned int,\n \t\t\tvoid *, unsigned int);\n@@ -2060,6 +2130,10 @@ static int comp_set_modify_field_op(struct context *, const struct token *,\n \t\t\t      unsigned int, char *, unsigned int);\n static int comp_set_modify_field_id(struct context *, const struct token *,\n \t\t\t      unsigned int, char *, unsigned int);\n+static int comp_pattern_template_id(struct context *, const struct token *,\n+\t\t\t\t    unsigned int, char *, unsigned int);\n+static int comp_actions_template_id(struct context *, const struct token *,\n+\t\t\t\t    unsigned int, char *, unsigned int);\n \n /** Token definitions. */\n static const struct token token_list[] = {\n@@ -2210,6 +2284,20 @@ static const struct token token_list[] = {\n \t\t.call = parse_flex_handle,\n \t\t.comp = comp_none,\n \t},\n+\t[COMMON_PATTERN_TEMPLATE_ID] = {\n+\t\t.name = \"{pattern_template_id}\",\n+\t\t.type = \"PATTERN_TEMPLATE_ID\",\n+\t\t.help = \"pattern template id\",\n+\t\t.call = parse_int,\n+\t\t.comp = comp_pattern_template_id,\n+\t},\n+\t[COMMON_ACTIONS_TEMPLATE_ID] = {\n+\t\t.name = \"{actions_template_id}\",\n+\t\t.type = \"ACTIONS_TEMPLATE_ID\",\n+\t\t.help = \"actions template id\",\n+\t\t.call = parse_int,\n+\t\t.comp = comp_actions_template_id,\n+\t},\n \t/* Top-level command. */\n \t[FLOW] = {\n \t\t.name = \"flow\",\n@@ -2218,6 +2306,8 @@ static const struct token token_list[] = {\n \t\t.next = NEXT(NEXT_ENTRY\n \t\t\t     (INFO,\n \t\t\t      CONFIGURE,\n+\t\t\t      PATTERN_TEMPLATE,\n+\t\t\t      ACTIONS_TEMPLATE,\n \t\t\t      INDIRECT_ACTION,\n \t\t\t      VALIDATE,\n \t\t\t      CREATE,\n@@ -2292,6 +2382,112 @@ static const struct token token_list[] = {\n \t\t\t\t\targs.configure.port_attr.nb_meters)),\n \t},\n \t/* Top-level command. */\n+\t[PATTERN_TEMPLATE] = {\n+\t\t.name = \"pattern_template\",\n+\t\t.type = \"{command} {port_id} [{arg} [...]]\",\n+\t\t.help = \"manage pattern templates\",\n+\t\t.next = NEXT(next_pt_subcmd, NEXT_ENTRY(COMMON_PORT_ID)),\n+\t\t.args = ARGS(ARGS_ENTRY(struct buffer, port)),\n+\t\t.call = parse_template,\n+\t},\n+\t/* Sub-level commands. */\n+\t[PATTERN_TEMPLATE_CREATE] = {\n+\t\t.name = \"create\",\n+\t\t.help = \"create pattern template\",\n+\t\t.next = NEXT(next_pt_attr),\n+\t\t.call = parse_template,\n+\t},\n+\t[PATTERN_TEMPLATE_DESTROY] = {\n+\t\t.name = \"destroy\",\n+\t\t.help = \"destroy pattern template\",\n+\t\t.next = NEXT(NEXT_ENTRY(PATTERN_TEMPLATE_DESTROY_ID)),\n+\t\t.args = ARGS(ARGS_ENTRY(struct buffer, port)),\n+\t\t.call = parse_template_destroy,\n+\t},\n+\t/* Pattern template arguments. */\n+\t[PATTERN_TEMPLATE_CREATE_ID] = {\n+\t\t.name = \"pattern_template_id\",\n+\t\t.help = \"specify a pattern template id to create\",\n+\t\t.next = NEXT(next_pt_attr,\n+\t\t\t     NEXT_ENTRY(COMMON_PATTERN_TEMPLATE_ID)),\n+\t\t.args = ARGS(ARGS_ENTRY(struct buffer, args.vc.pat_templ_id)),\n+\t},\n+\t[PATTERN_TEMPLATE_DESTROY_ID] = {\n+\t\t.name = \"pattern_template\",\n+\t\t.help = \"specify a pattern template id to destroy\",\n+\t\t.next = NEXT(next_pt_destroy_attr,\n+\t\t\t     NEXT_ENTRY(COMMON_PATTERN_TEMPLATE_ID)),\n+\t\t.args = ARGS(ARGS_ENTRY_PTR(struct buffer,\n+\t\t\t\t\t    args.templ_destroy.template_id)),\n+\t\t.call = parse_template_destroy,\n+\t},\n+\t[PATTERN_TEMPLATE_RELAXED_MATCHING] = {\n+\t\t.name = \"relaxed\",\n+\t\t.help = \"is matching relaxed\",\n+\t\t.next = NEXT(next_pt_attr,\n+\t\t\t     NEXT_ENTRY(COMMON_BOOLEAN)),\n+\t\t.args = ARGS(ARGS_ENTRY_BF(struct buffer,\n+\t\t\t     args.vc.attr.reserved, 1)),\n+\t},\n+\t[PATTERN_TEMPLATE_SPEC] = {\n+\t\t.name = \"template\",\n+\t\t.help = \"specify item to create pattern template\",\n+\t\t.next = NEXT(next_item),\n+\t},\n+\t/* Top-level command. */\n+\t[ACTIONS_TEMPLATE] = {\n+\t\t.name = \"actions_template\",\n+\t\t.type = \"{command} {port_id} [{arg} [...]]\",\n+\t\t.help = \"manage actions templates\",\n+\t\t.next = NEXT(next_at_subcmd, NEXT_ENTRY(COMMON_PORT_ID)),\n+\t\t.args = ARGS(ARGS_ENTRY(struct buffer, port)),\n+\t\t.call = parse_template,\n+\t},\n+\t/* Sub-level commands. */\n+\t[ACTIONS_TEMPLATE_CREATE] = {\n+\t\t.name = \"create\",\n+\t\t.help = \"create actions template\",\n+\t\t.next = NEXT(next_at_attr),\n+\t\t.call = parse_template,\n+\t},\n+\t[ACTIONS_TEMPLATE_DESTROY] = {\n+\t\t.name = \"destroy\",\n+\t\t.help = \"destroy actions template\",\n+\t\t.next = NEXT(NEXT_ENTRY(ACTIONS_TEMPLATE_DESTROY_ID)),\n+\t\t.args = ARGS(ARGS_ENTRY(struct buffer, port)),\n+\t\t.call = parse_template_destroy,\n+\t},\n+\t/* Actions template arguments. */\n+\t[ACTIONS_TEMPLATE_CREATE_ID] = {\n+\t\t.name = \"actions_template_id\",\n+\t\t.help = \"specify an actions template id to create\",\n+\t\t.next = NEXT(NEXT_ENTRY(ACTIONS_TEMPLATE_MASK),\n+\t\t\t     NEXT_ENTRY(ACTIONS_TEMPLATE_SPEC),\n+\t\t\t     NEXT_ENTRY(COMMON_ACTIONS_TEMPLATE_ID)),\n+\t\t.args = ARGS(ARGS_ENTRY(struct buffer, args.vc.act_templ_id)),\n+\t},\n+\t[ACTIONS_TEMPLATE_DESTROY_ID] = {\n+\t\t.name = \"actions_template\",\n+\t\t.help = \"specify an actions template id to destroy\",\n+\t\t.next = NEXT(next_at_destroy_attr,\n+\t\t\t     NEXT_ENTRY(COMMON_ACTIONS_TEMPLATE_ID)),\n+\t\t.args = ARGS(ARGS_ENTRY_PTR(struct buffer,\n+\t\t\t\t\t    args.templ_destroy.template_id)),\n+\t\t.call = parse_template_destroy,\n+\t},\n+\t[ACTIONS_TEMPLATE_SPEC] = {\n+\t\t.name = \"template\",\n+\t\t.help = \"specify action to create actions template\",\n+\t\t.next = NEXT(next_action),\n+\t\t.call = parse_template,\n+\t},\n+\t[ACTIONS_TEMPLATE_MASK] = {\n+\t\t.name = \"mask\",\n+\t\t.help = \"specify action mask to create actions template\",\n+\t\t.next = NEXT(next_action),\n+\t\t.call = parse_template,\n+\t},\n+\t/* Top-level command. */\n \t[INDIRECT_ACTION] = {\n \t\t.name = \"indirect_action\",\n \t\t.type = \"{command} {port_id} [{arg} [...]]\",\n@@ -2614,7 +2810,7 @@ static const struct token token_list[] = {\n \t\t.name = \"end\",\n \t\t.help = \"end list of pattern items\",\n \t\t.priv = PRIV_ITEM(END, 0),\n-\t\t.next = NEXT(NEXT_ENTRY(ACTIONS)),\n+\t\t.next = NEXT(NEXT_ENTRY(ACTIONS, END)),\n \t\t.call = parse_vc,\n \t},\n \t[ITEM_VOID] = {\n@@ -5731,7 +5927,9 @@ parse_vc(struct context *ctx, const struct token *token,\n \tif (!out)\n \t\treturn len;\n \tif (!out->command) {\n-\t\tif (ctx->curr != VALIDATE && ctx->curr != CREATE)\n+\t\tif (ctx->curr != VALIDATE && ctx->curr != CREATE &&\n+\t\t    ctx->curr != PATTERN_TEMPLATE_CREATE &&\n+\t\t    ctx->curr != ACTIONS_TEMPLATE_CREATE)\n \t\t\treturn -1;\n \t\tif (sizeof(*out) > size)\n \t\t\treturn -1;\n@@ -7595,6 +7793,114 @@ parse_configure(struct context *ctx, const struct token *token,\n \treturn len;\n }\n \n+/** Parse tokens for template create command. */\n+static int\n+parse_template(struct context *ctx, const struct token *token,\n+\t       const char *str, unsigned int len,\n+\t       void *buf, unsigned int size)\n+{\n+\tstruct buffer *out = buf;\n+\n+\t/* Token name must match. */\n+\tif (parse_default(ctx, token, str, len, NULL, 0) < 0)\n+\t\treturn -1;\n+\t/* Nothing else to do if there is no buffer. */\n+\tif (!out)\n+\t\treturn len;\n+\tif (!out->command) {\n+\t\tif (ctx->curr != PATTERN_TEMPLATE &&\n+\t\t    ctx->curr != ACTIONS_TEMPLATE)\n+\t\t\treturn -1;\n+\t\tif (sizeof(*out) > size)\n+\t\t\treturn -1;\n+\t\tout->command = ctx->curr;\n+\t\tctx->objdata = 0;\n+\t\tctx->object = out;\n+\t\tctx->objmask = NULL;\n+\t\tout->args.vc.data = (uint8_t *)out + size;\n+\t\treturn len;\n+\t}\n+\tswitch (ctx->curr) {\n+\tcase PATTERN_TEMPLATE_CREATE:\n+\t\tout->args.vc.pattern =\n+\t\t\t(void *)RTE_ALIGN_CEIL((uintptr_t)(out + 1),\n+\t\t\t\t\t       sizeof(double));\n+\t\tout->args.vc.pat_templ_id = UINT32_MAX;\n+\t\tout->command = ctx->curr;\n+\t\tctx->objdata = 0;\n+\t\tctx->object = out;\n+\t\tctx->objmask = NULL;\n+\t\treturn len;\n+\tcase ACTIONS_TEMPLATE_CREATE:\n+\t\tout->args.vc.act_templ_id = UINT32_MAX;\n+\t\tout->command = ctx->curr;\n+\t\tctx->objdata = 0;\n+\t\tctx->object = out;\n+\t\tctx->objmask = NULL;\n+\t\treturn len;\n+\tcase ACTIONS_TEMPLATE_SPEC:\n+\t\tout->args.vc.actions =\n+\t\t\t(void *)RTE_ALIGN_CEIL((uintptr_t)(out + 1),\n+\t\t\t\t\t       sizeof(double));\n+\t\tctx->object = out->args.vc.actions;\n+\t\tctx->objmask = NULL;\n+\t\treturn len;\n+\tcase ACTIONS_TEMPLATE_MASK:\n+\t\tout->args.vc.masks =\n+\t\t\t(void *)RTE_ALIGN_CEIL((uintptr_t)\n+\t\t\t\t\t       (out->args.vc.actions +\n+\t\t\t\t\t\tout->args.vc.actions_n),\n+\t\t\t\t\t       sizeof(double));\n+\t\tctx->object = out->args.vc.masks;\n+\t\tctx->objmask = NULL;\n+\t\treturn len;\n+\tdefault:\n+\t\treturn -1;\n+\t}\n+}\n+\n+/** Parse tokens for template destroy command. */\n+static int\n+parse_template_destroy(struct context *ctx, const struct token *token,\n+\t\t       const char *str, unsigned int len,\n+\t\t       void *buf, unsigned int size)\n+{\n+\tstruct buffer *out = buf;\n+\tuint32_t *template_id;\n+\n+\t/* Token name must match. */\n+\tif (parse_default(ctx, token, str, len, NULL, 0) < 0)\n+\t\treturn -1;\n+\t/* Nothing else to do if there is no buffer. */\n+\tif (!out)\n+\t\treturn len;\n+\tif (!out->command ||\n+\t\tout->command == PATTERN_TEMPLATE ||\n+\t\tout->command == ACTIONS_TEMPLATE) {\n+\t\tif (ctx->curr != PATTERN_TEMPLATE_DESTROY &&\n+\t\t\tctx->curr != ACTIONS_TEMPLATE_DESTROY)\n+\t\t\treturn -1;\n+\t\tif (sizeof(*out) > size)\n+\t\t\treturn -1;\n+\t\tout->command = ctx->curr;\n+\t\tctx->objdata = 0;\n+\t\tctx->object = out;\n+\t\tctx->objmask = NULL;\n+\t\tout->args.templ_destroy.template_id =\n+\t\t\t(void *)RTE_ALIGN_CEIL((uintptr_t)(out + 1),\n+\t\t\t\t\t       sizeof(double));\n+\t\treturn len;\n+\t}\n+\ttemplate_id = out->args.templ_destroy.template_id\n+\t\t    + out->args.templ_destroy.template_id_n++;\n+\tif ((uint8_t *)template_id > (uint8_t *)out + size)\n+\t\treturn -1;\n+\tctx->objdata = 0;\n+\tctx->object = template_id;\n+\tctx->objmask = NULL;\n+\treturn len;\n+}\n+\n static int\n parse_flex(struct context *ctx, const struct token *token,\n \t     const char *str, unsigned int len,\n@@ -8564,6 +8870,54 @@ comp_set_modify_field_id(struct context *ctx, const struct token *token,\n \treturn -1;\n }\n \n+/** Complete available pattern template IDs. */\n+static int\n+comp_pattern_template_id(struct context *ctx, const struct token *token,\n+\t\t\t unsigned int ent, char *buf, unsigned int size)\n+{\n+\tunsigned int i = 0;\n+\tstruct rte_port *port;\n+\tstruct port_template *pt;\n+\n+\t(void)token;\n+\tif (port_id_is_invalid(ctx->port, DISABLED_WARN) ||\n+\t    ctx->port == (portid_t)RTE_PORT_ALL)\n+\t\treturn -1;\n+\tport = &ports[ctx->port];\n+\tfor (pt = port->pattern_templ_list; pt != NULL; pt = pt->next) {\n+\t\tif (buf && i == ent)\n+\t\t\treturn snprintf(buf, size, \"%u\", pt->id);\n+\t\t++i;\n+\t}\n+\tif (buf)\n+\t\treturn -1;\n+\treturn i;\n+}\n+\n+/** Complete available actions template IDs. */\n+static int\n+comp_actions_template_id(struct context *ctx, const struct token *token,\n+\t\t\t unsigned int ent, char *buf, unsigned int size)\n+{\n+\tunsigned int i = 0;\n+\tstruct rte_port *port;\n+\tstruct port_template *pt;\n+\n+\t(void)token;\n+\tif (port_id_is_invalid(ctx->port, DISABLED_WARN) ||\n+\t    ctx->port == (portid_t)RTE_PORT_ALL)\n+\t\treturn -1;\n+\tport = &ports[ctx->port];\n+\tfor (pt = port->actions_templ_list; pt != NULL; pt = pt->next) {\n+\t\tif (buf && i == ent)\n+\t\t\treturn snprintf(buf, size, \"%u\", pt->id);\n+\t\t++i;\n+\t}\n+\tif (buf)\n+\t\treturn -1;\n+\treturn i;\n+}\n+\n /** Internal context. */\n static struct context cmd_flow_context;\n \n@@ -8832,6 +9186,24 @@ cmd_flow_parsed(const struct buffer *in)\n \t\t\t\t    in->args.configure.nb_queue,\n \t\t\t\t    &in->args.configure.queue_attr);\n \t\tbreak;\n+\tcase PATTERN_TEMPLATE_CREATE:\n+\t\tport_flow_pattern_template_create(in->port, in->args.vc.pat_templ_id,\n+\t\t\t\tin->args.vc.attr.reserved, in->args.vc.pattern);\n+\t\tbreak;\n+\tcase PATTERN_TEMPLATE_DESTROY:\n+\t\tport_flow_pattern_template_destroy(in->port,\n+\t\t\t\tin->args.templ_destroy.template_id_n,\n+\t\t\t\tin->args.templ_destroy.template_id);\n+\t\tbreak;\n+\tcase ACTIONS_TEMPLATE_CREATE:\n+\t\tport_flow_actions_template_create(in->port, in->args.vc.act_templ_id,\n+\t\t\t\tin->args.vc.actions, in->args.vc.masks);\n+\t\tbreak;\n+\tcase ACTIONS_TEMPLATE_DESTROY:\n+\t\tport_flow_actions_template_destroy(in->port,\n+\t\t\t\tin->args.templ_destroy.template_id_n,\n+\t\t\t\tin->args.templ_destroy.template_id);\n+\t\tbreak;\n \tcase INDIRECT_ACTION_CREATE:\n \t\tport_action_handle_create(\n \t\t\t\tin->port, in->args.vc.attr.group,\ndiff --git a/app/test-pmd/config.c b/app/test-pmd/config.c\nindex df83f8dbdd..2ef7c3e07a 100644\n--- a/app/test-pmd/config.c\n+++ b/app/test-pmd/config.c\n@@ -1609,6 +1609,49 @@ action_alloc(portid_t port_id, uint32_t id,\n \treturn 0;\n }\n \n+static int\n+template_alloc(uint32_t id, struct port_template **template,\n+\t       struct port_template **list)\n+{\n+\tstruct port_template *lst = *list;\n+\tstruct port_template **ppt;\n+\tstruct port_template *pt = NULL;\n+\n+\t*template = NULL;\n+\tif (id == UINT32_MAX) {\n+\t\t/* taking first available ID */\n+\t\tif (lst) {\n+\t\t\tif (lst->id == UINT32_MAX - 1) {\n+\t\t\t\tprintf(\"Highest template ID is already\"\n+\t\t\t\t\" assigned, delete it first\\n\");\n+\t\t\t\treturn -ENOMEM;\n+\t\t\t}\n+\t\t\tid = lst->id + 1;\n+\t\t} else {\n+\t\t\tid = 0;\n+\t\t}\n+\t}\n+\tpt = calloc(1, sizeof(*pt));\n+\tif (!pt) {\n+\t\tprintf(\"Allocation of port template failed\\n\");\n+\t\treturn -ENOMEM;\n+\t}\n+\tppt = list;\n+\twhile (*ppt && (*ppt)->id > id)\n+\t\tppt = &(*ppt)->next;\n+\tif (*ppt && (*ppt)->id == id) {\n+\t\tprintf(\"Template #%u is already assigned,\"\n+\t\t\t\" delete it first\\n\", id);\n+\t\tfree(pt);\n+\t\treturn -EINVAL;\n+\t}\n+\tpt->next = *ppt;\n+\tpt->id = id;\n+\t*ppt = pt;\n+\t*template = pt;\n+\treturn 0;\n+}\n+\n /** Get info about flow management resources. */\n int\n port_flow_get_info(portid_t port_id)\n@@ -2078,6 +2121,166 @@ age_action_get(const struct rte_flow_action *actions)\n \treturn NULL;\n }\n \n+/** Create pattern template */\n+int\n+port_flow_pattern_template_create(portid_t port_id, uint32_t id, bool relaxed,\n+\t\t\t\t  const struct rte_flow_item *pattern)\n+{\n+\tstruct rte_port *port;\n+\tstruct port_template *pit;\n+\tint ret;\n+\tstruct rte_flow_pattern_template_attr attr = {\n+\t\t\t\t\t.relaxed_matching = relaxed };\n+\tstruct rte_flow_error error;\n+\n+\tif (port_id_is_invalid(port_id, ENABLED_WARN) ||\n+\t    port_id == (portid_t)RTE_PORT_ALL)\n+\t\treturn -EINVAL;\n+\tport = &ports[port_id];\n+\tret = template_alloc(id, &pit, &port->pattern_templ_list);\n+\tif (ret)\n+\t\treturn ret;\n+\t/* Poisoning to make sure PMDs update it in case of error. */\n+\tmemset(&error, 0x22, sizeof(error));\n+\tpit->template.pattern_template = rte_flow_pattern_template_create(port_id,\n+\t\t\t\t\t\t&attr, pattern, &error);\n+\tif (!pit->template.pattern_template) {\n+\t\tuint32_t destroy_id = pit->id;\n+\t\tport_flow_pattern_template_destroy(port_id, 1, &destroy_id);\n+\t\treturn port_flow_complain(&error);\n+\t}\n+\tprintf(\"Pattern template #%u created\\n\", pit->id);\n+\treturn 0;\n+}\n+\n+/** Destroy pattern template */\n+int\n+port_flow_pattern_template_destroy(portid_t port_id, uint32_t n,\n+\t\t\t\t   const uint32_t *template)\n+{\n+\tstruct rte_port *port;\n+\tstruct port_template **tmp;\n+\tuint32_t c = 0;\n+\tint ret = 0;\n+\n+\tif (port_id_is_invalid(port_id, ENABLED_WARN) ||\n+\t    port_id == (portid_t)RTE_PORT_ALL)\n+\t\treturn -EINVAL;\n+\tport = &ports[port_id];\n+\ttmp = &port->pattern_templ_list;\n+\twhile (*tmp) {\n+\t\tuint32_t i;\n+\n+\t\tfor (i = 0; i != n; ++i) {\n+\t\t\tstruct rte_flow_error error;\n+\t\t\tstruct port_template *pit = *tmp;\n+\n+\t\t\tif (template[i] != pit->id)\n+\t\t\t\tcontinue;\n+\t\t\t/*\n+\t\t\t * Poisoning to make sure PMDs update it in case\n+\t\t\t * of error.\n+\t\t\t */\n+\t\t\tmemset(&error, 0x33, sizeof(error));\n+\n+\t\t\tif (pit->template.pattern_template &&\n+\t\t\t    rte_flow_pattern_template_destroy(port_id,\n+\t\t\t\t\t\t\t   pit->template.pattern_template,\n+\t\t\t\t\t\t\t   &error)) {\n+\t\t\t\tret = port_flow_complain(&error);\n+\t\t\t\tcontinue;\n+\t\t\t}\n+\t\t\t*tmp = pit->next;\n+\t\t\tprintf(\"Pattern template #%u destroyed\\n\", pit->id);\n+\t\t\tfree(pit);\n+\t\t\tbreak;\n+\t\t}\n+\t\tif (i == n)\n+\t\t\ttmp = &(*tmp)->next;\n+\t\t++c;\n+\t}\n+\treturn ret;\n+}\n+\n+/** Create actions template */\n+int\n+port_flow_actions_template_create(portid_t port_id, uint32_t id,\n+\t\t\t\t  const struct rte_flow_action *actions,\n+\t\t\t\t  const struct rte_flow_action *masks)\n+{\n+\tstruct rte_port *port;\n+\tstruct port_template *pat;\n+\tint ret;\n+\tstruct rte_flow_error error;\n+\n+\tif (port_id_is_invalid(port_id, ENABLED_WARN) ||\n+\t    port_id == (portid_t)RTE_PORT_ALL)\n+\t\treturn -EINVAL;\n+\tport = &ports[port_id];\n+\tret = template_alloc(id, &pat, &port->actions_templ_list);\n+\tif (ret)\n+\t\treturn ret;\n+\t/* Poisoning to make sure PMDs update it in case of error. */\n+\tmemset(&error, 0x22, sizeof(error));\n+\tpat->template.actions_template = rte_flow_actions_template_create(port_id,\n+\t\t\t\t\t\tNULL, actions, masks, &error);\n+\tif (!pat->template.actions_template) {\n+\t\tuint32_t destroy_id = pat->id;\n+\t\tport_flow_actions_template_destroy(port_id, 1, &destroy_id);\n+\t\treturn port_flow_complain(&error);\n+\t}\n+\tprintf(\"Actions template #%u created\\n\", pat->id);\n+\treturn 0;\n+}\n+\n+/** Destroy actions template */\n+int\n+port_flow_actions_template_destroy(portid_t port_id, uint32_t n,\n+\t\t\t\t   const uint32_t *template)\n+{\n+\tstruct rte_port *port;\n+\tstruct port_template **tmp;\n+\tuint32_t c = 0;\n+\tint ret = 0;\n+\n+\tif (port_id_is_invalid(port_id, ENABLED_WARN) ||\n+\t    port_id == (portid_t)RTE_PORT_ALL)\n+\t\treturn -EINVAL;\n+\tport = &ports[port_id];\n+\ttmp = &port->actions_templ_list;\n+\twhile (*tmp) {\n+\t\tuint32_t i;\n+\n+\t\tfor (i = 0; i != n; ++i) {\n+\t\t\tstruct rte_flow_error error;\n+\t\t\tstruct port_template *pat = *tmp;\n+\n+\t\t\tif (template[i] != pat->id)\n+\t\t\t\tcontinue;\n+\t\t\t/*\n+\t\t\t * Poisoning to make sure PMDs update it in case\n+\t\t\t * of error.\n+\t\t\t */\n+\t\t\tmemset(&error, 0x33, sizeof(error));\n+\n+\t\t\tif (pat->template.actions_template &&\n+\t\t\t    rte_flow_actions_template_destroy(port_id,\n+\t\t\t\t\tpat->template.actions_template, &error)) {\n+\t\t\t\tret = port_flow_complain(&error);\n+\t\t\t\tcontinue;\n+\t\t\t}\n+\t\t\t*tmp = pat->next;\n+\t\t\tprintf(\"Actions template #%u destroyed\\n\", pat->id);\n+\t\t\tfree(pat);\n+\t\t\tbreak;\n+\t\t}\n+\t\tif (i == n)\n+\t\t\ttmp = &(*tmp)->next;\n+\t\t++c;\n+\t}\n+\treturn ret;\n+}\n+\n /** Create flow rule. */\n int\n port_flow_create(portid_t port_id,\ndiff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h\nindex 096b6825eb..c70b1fa4e8 100644\n--- a/app/test-pmd/testpmd.h\n+++ b/app/test-pmd/testpmd.h\n@@ -166,6 +166,17 @@ enum age_action_context_type {\n \tACTION_AGE_CONTEXT_TYPE_INDIRECT_ACTION,\n };\n \n+/** Descriptor for a template. */\n+struct port_template {\n+\tstruct port_template *next; /**< Next template in list. */\n+\tstruct port_template *tmp; /**< Temporary linking. */\n+\tuint32_t id; /**< Template ID. */\n+\tunion {\n+\t\tstruct rte_flow_pattern_template *pattern_template;\n+\t\tstruct rte_flow_actions_template *actions_template;\n+\t} template; /**< PMD opaque template object */\n+};\n+\n /** Descriptor for a single flow. */\n struct port_flow {\n \tstruct port_flow *next; /**< Next flow in list. */\n@@ -246,6 +257,8 @@ struct rte_port {\n \tqueueid_t               queue_nb; /**< nb. of queues for flow rules */\n \tuint32_t                queue_sz; /**< size of a queue for flow rules */\n \tuint8_t                 slave_flag; /**< bonding slave port */\n+\tstruct port_template    *pattern_templ_list; /**< Pattern templates. */\n+\tstruct port_template    *actions_templ_list; /**< Actions templates. */\n \tstruct port_flow        *flow_list; /**< Associated flows. */\n \tstruct port_indirect_action *actions_list;\n \t/**< Associated indirect actions. */\n@@ -892,6 +905,16 @@ int port_flow_configure(portid_t port_id,\n \t\t\tconst struct rte_flow_port_attr *port_attr,\n \t\t\tuint16_t nb_queue,\n \t\t\tconst struct rte_flow_queue_attr *queue_attr);\n+int port_flow_pattern_template_create(portid_t port_id, uint32_t id,\n+\t\t\t\t      bool relaxed,\n+\t\t\t\t      const struct rte_flow_item *pattern);\n+int port_flow_pattern_template_destroy(portid_t port_id, uint32_t n,\n+\t\t\t\t       const uint32_t *template);\n+int port_flow_actions_template_create(portid_t port_id, uint32_t id,\n+\t\t\t\t      const struct rte_flow_action *actions,\n+\t\t\t\t      const struct rte_flow_action *masks);\n+int port_flow_actions_template_destroy(portid_t port_id, uint32_t n,\n+\t\t\t\t       const uint32_t *template);\n int port_flow_validate(portid_t port_id,\n \t\t       const struct rte_flow_attr *attr,\n \t\t       const struct rte_flow_item *pattern,\ndiff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst\nindex cfdda5005c..acb763bdf0 100644\n--- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst\n+++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst\n@@ -3344,6 +3344,24 @@ following sections.\n        [aging_counters_number {number}]\n        [meters_number {number}]\n \n+- Create a pattern template::\n+   flow pattern_template {port_id} create [pattern_template_id {id}]\n+       [relaxed {boolean}] template {item} [/ {item} [...]] / end\n+\n+- Destroy a pattern template::\n+\n+   flow pattern_template {port_id} destroy pattern_template {id} [...]\n+\n+- Create an actions template::\n+\n+   flow actions_template {port_id} create [actions_template_id {id}]\n+       template {action} [/ {action} [...]] / end\n+       mask {action} [/ {action} [...]] / end\n+\n+- Destroy an actions template::\n+\n+   flow actions_template {port_id} destroy actions_template {id} [...]\n+\n - Check whether a flow rule can be created::\n \n    flow validate {port_id}\n@@ -3447,6 +3465,85 @@ Otherwise it will show an error message of the form::\n \n    Caught error type [...] ([...]): [...]\n \n+Creating pattern templates\n+~~~~~~~~~~~~~~~~~~~~~~~~~~\n+\n+``flow pattern_template create`` creates the specified pattern template.\n+It is bound to ``rte_flow_pattern_template_create()``::\n+\n+   flow pattern_template {port_id} create [pattern_template_id {id}]\n+       [relaxed {boolean}] template {item} [/ {item} [...]] / end\n+\n+If successful, it will show::\n+\n+   Pattern template #[...] created\n+\n+Otherwise it will show an error message of the form::\n+\n+   Caught error type [...] ([...]): [...]\n+\n+This command uses the same pattern items as ``flow create``,\n+their format is described in `Creating flow rules`_.\n+\n+Destroying pattern templates\n+~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n+\n+``flow pattern_template destroy`` destroys one or more pattern templates\n+from their template ID (as returned by ``flow pattern_template create``),\n+this command calls ``rte_flow_pattern_template_destroy()`` as many\n+times as necessary::\n+\n+   flow pattern_template {port_id} destroy pattern_template {id} [...]\n+\n+If successful, it will show::\n+\n+   Pattern template #[...] destroyed\n+\n+It does not report anything for pattern template IDs that do not exist.\n+The usual error message is shown when a pattern template cannot be destroyed::\n+\n+   Caught error type [...] ([...]): [...]\n+\n+Creating actions templates\n+~~~~~~~~~~~~~~~~~~~~~~~~~~\n+\n+``flow actions_template create`` creates the specified actions template.\n+It is bound to ``rte_flow_actions_template_create()``::\n+\n+   flow actions_template {port_id} create [actions_template_id {id}]\n+       template {action} [/ {action} [...]] / end\n+       mask {action} [/ {action} [...]] / end\n+\n+If successful, it will show::\n+\n+   Actions template #[...] created\n+\n+Otherwise it will show an error message of the form::\n+\n+   Caught error type [...] ([...]): [...]\n+\n+This command uses the same actions as ``flow create``,\n+their format is described in `Creating flow rules`_.\n+\n+Destroying actions templates\n+~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n+\n+``flow actions_template destroy`` destroys one or more actions templates\n+from their template ID (as returned by ``flow actions_template create``),\n+this command calls ``rte_flow_actions_template_destroy()`` as many\n+times as necessary::\n+\n+   flow actions_template {port_id} destroy actions_template {id} [...]\n+\n+If successful, it will show::\n+\n+   Actions template #[...] destroyed\n+\n+It does not report anything for actions template IDs that do not exist.\n+The usual error message is shown when an actions template cannot be destroyed::\n+\n+   Caught error type [...] ([...]): [...]\n+\n Creating a tunnel stub for offload\n ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n \n",
    "prefixes": [
        "v4",
        "05/10"
    ]
}