get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 41644,
    "url": "http://patchwork.dpdk.org/api/patches/41644/?format=api",
    "web_url": "http://patchwork.dpdk.org/project/dpdk/patch/98cfc0f5244ddc8987e3aa42de0c08b3b161c069.1530089445.git.nelio.laranjeiro@6wind.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": "<98cfc0f5244ddc8987e3aa42de0c08b3b161c069.1530089445.git.nelio.laranjeiro@6wind.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/98cfc0f5244ddc8987e3aa42de0c08b3b161c069.1530089445.git.nelio.laranjeiro@6wind.com",
    "date": "2018-06-27T08:53:44",
    "name": "[v5,2/2] app/testpmd: add NVGRE encap/decap support",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "27d7b5c7952e09f5b9a3524c5bc24aacbbb49209",
    "submitter": {
        "id": 243,
        "url": "http://patchwork.dpdk.org/api/people/243/?format=api",
        "name": "Nélio Laranjeiro",
        "email": "nelio.laranjeiro@6wind.com"
    },
    "delegate": {
        "id": 319,
        "url": "http://patchwork.dpdk.org/api/users/319/?format=api",
        "username": "fyigit",
        "first_name": "Ferruh",
        "last_name": "Yigit",
        "email": "ferruh.yigit@amd.com"
    },
    "mbox": "http://patchwork.dpdk.org/project/dpdk/patch/98cfc0f5244ddc8987e3aa42de0c08b3b161c069.1530089445.git.nelio.laranjeiro@6wind.com/mbox/",
    "series": [
        {
            "id": 255,
            "url": "http://patchwork.dpdk.org/api/series/255/?format=api",
            "web_url": "http://patchwork.dpdk.org/project/dpdk/list/?series=255",
            "date": "2018-06-27T08:53:42",
            "name": "app/testpmd implement VXLAN/NVGRE Encap/Decap",
            "version": 5,
            "mbox": "http://patchwork.dpdk.org/series/255/mbox/"
        }
    ],
    "comments": "http://patchwork.dpdk.org/api/patches/41644/comments/",
    "check": "success",
    "checks": "http://patchwork.dpdk.org/api/patches/41644/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@dpdk.org",
        "Delivered-To": "patchwork@dpdk.org",
        "Received": [
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id CBFDD1BED6;\n\tWed, 27 Jun 2018 10:53:34 +0200 (CEST)",
            "from mail-wr0-f193.google.com (mail-wr0-f193.google.com\n\t[209.85.128.193]) by dpdk.org (Postfix) with ESMTP id 6C1B61BEC9\n\tfor <dev@dpdk.org>; Wed, 27 Jun 2018 10:53:29 +0200 (CEST)",
            "by mail-wr0-f193.google.com with SMTP id a12-v6so1178216wro.1\n\tfor <dev@dpdk.org>; Wed, 27 Jun 2018 01:53:29 -0700 (PDT)",
            "from laranjeiro-vm.dev.6wind.com\n\t(host.78.145.23.62.rev.coltfrance.com. [62.23.145.78])\n\tby smtp.gmail.com with ESMTPSA id\n\ta203-v6sm4738860wme.46.2018.06.27.01.53.27\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tWed, 27 Jun 2018 01:53:28 -0700 (PDT)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=6wind-com.20150623.gappssmtp.com; s=20150623;\n\th=from:to:cc:subject:date:message-id:in-reply-to:references;\n\tbh=XzuAG4u88evXmK6mubNaOu8sxazUPjA4gg8u0f+6x18=;\n\tb=LVXO3N9W38gF3bjHkawIYIdHHs/HwSPml44N7+UgqoGKExFX5fMj0H0o9AI127DVpg\n\t1NJlMtPujDPKNHeTLbC2wkmFnf4n+oWAPMAuqt2bgoU+j7ikuaOUfYNWFT3mrjR49mVI\n\tlpbn1WqoFtw5ap0Ma6ryCYhyDiEcjaD5u+OZ/NCwP2d3dmXs2X0K1Nx6QNBi8V/2mmKx\n\tpCwABl0mdeOBl1suXHYqnBBvRe7y3m4BQrOSCyV3WquzlameaXqtdd0j0ClTTvSH0k5G\n\tQV5bTuCh8hkh3smK5wgnbh+gM3Hh0lvHcd9PdNVXPTuKsz5rg4MmkYZwvO6CRR+QfDc3\n\tv3cA==",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references;\n\tbh=XzuAG4u88evXmK6mubNaOu8sxazUPjA4gg8u0f+6x18=;\n\tb=GkDcrC+a5EZSVeRQs6ZKORPvEE2yYqG/U+m8GdYnkD6TCL+6yV1G0Ck5grjwetMJJ5\n\tbCkTRWHzPyO3/q26zcuBXYHwWJ1Kr/sPGNxu9u9HrgaZq3JSL8Gy5oZFxLKKLgxK2Agt\n\tnF8oBlBdc9BA5z3wc/X9snVKYp8VRpnR7D1cPka+JO81zm6GgTyVExV8CEbG0IaNMFdB\n\tXtOdD/51/eeAoCQKpVqg48b7rSsiEWbwnvbPvkJyE1CXQDg1wjvtvG5tBu6Buf6gXjK6\n\titJWZZA60v0ZtqXfU8z3FRxqEFkYsgYEi5Fr7pmLcsGkaQe7b+L4DRtOYg4hteICR0D/\n\tl/mw==",
        "X-Gm-Message-State": "APt69E1e72OZXfC15RGnSaOWj9QdHW2oxKumWS+o6Uo9tlBT4n2Qcbf5\n\t90EzwYQ5G1fcLadgWjBxMl0Mc3eBCQ==",
        "X-Google-Smtp-Source": "AAOMgpfFWpNFBSzt7vU0c6HHh1FP5ps1hQvkAXaE6vXR3j9pWvI5A6qsi6ru0ND8BleDyedZ+acQYw==",
        "X-Received": "by 2002:adf:ab95:: with SMTP id\n\ts21-v6mr4506194wrc.90.1530089608702; \n\tWed, 27 Jun 2018 01:53:28 -0700 (PDT)",
        "From": "Nelio Laranjeiro <nelio.laranjeiro@6wind.com>",
        "To": "dev@dpdk.org, Adrien Mazarguil <adrien.mazarguil@6wind.com>,\n\tWenzhuo Lu <wenzhuo.lu@intel.com>, Jingjing Wu <jingjing.wu@intel.com>,\n\tBernard Iremonger <bernard.iremonger@intel.com>,\n\tMohammad Abdul Awal <mohammad.abdul.awal@intel.com>,\n\tStephen Hemminger <stephen@networkplumber.org>",
        "Cc": "Ori Kam <orika@mellanox.com>",
        "Date": "Wed, 27 Jun 2018 10:53:44 +0200",
        "Message-Id": "<98cfc0f5244ddc8987e3aa42de0c08b3b161c069.1530089445.git.nelio.laranjeiro@6wind.com>",
        "X-Mailer": "git-send-email 2.18.0",
        "In-Reply-To": "<cover.1530089445.git.nelio.laranjeiro@6wind.com>",
        "References": "<cover.1529420040.git.nelio.laranjeiro@6wind.com>\n\t<cover.1530089445.git.nelio.laranjeiro@6wind.com>",
        "Subject": "[dpdk-dev] [PATCH v5 2/2] app/testpmd: add NVGRE encap/decap support",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.15",
        "Precedence": "list",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n\t<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\t<mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "Due to the complex NVGRE_ENCAP flow action and based on the fact testpmd\ndoes not allocate memory, this patch adds a new command in testpmd to\ninitialise a global structure containing the necessary information to\nmake the outer layer of the packet.  This same global structure will\nthen be used by the flow command line in testpmd when the action\nnvgre_encap will be parsed, at this point, the conversion into such\naction becomes trivial.\n\nThis global structure is only used for the encap action.\n\nSigned-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>\nAcked-by: Ori Kam <orika@mellanox.com>\n---\n app/test-pmd/cmdline.c                      | 118 ++++++++++++++++++\n app/test-pmd/cmdline_flow.c                 | 129 ++++++++++++++++++++\n app/test-pmd/testpmd.c                      |  15 +++\n app/test-pmd/testpmd.h                      |  15 +++\n doc/guides/testpmd_app_ug/testpmd_funcs.rst |  42 +++++++\n 5 files changed, 319 insertions(+)",
    "diff": "diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c\nindex 048fff2bd..ad7f9eda5 100644\n--- a/app/test-pmd/cmdline.c\n+++ b/app/test-pmd/cmdline.c\n@@ -789,6 +789,12 @@ static void cmd_help_long_parsed(void *parsed_result,\n \t\t\t\" vlan-tci eth-src eth-dst\\n\"\n \t\t\t\"       Configure the VXLAN encapsulation for flows.\\n\\n\"\n \n+\t\t\t\"nvgre ipv4|ipv6 tni ip-src ip-dst eth-src eth-dst\\n\"\n+\t\t\t\"       Configure the NVGRE encapsulation for flows.\\n\\n\"\n+\n+\t\t\t\"nvgre-with-vlan ipv4|ipv6 tni ip-src ip-dst vlan-tci eth-src eth-dst\\n\"\n+\t\t\t\"       Configure the NVGRE encapsulation for flows.\\n\\n\"\n+\n \t\t\t, list_pkt_forwarding_modes()\n \t\t);\n \t}\n@@ -14970,6 +14976,116 @@ cmdline_parse_inst_t cmd_set_vxlan_with_vlan = {\n \t},\n };\n \n+/** Set NVGRE encapsulation details */\n+struct cmd_set_nvgre_result {\n+\tcmdline_fixed_string_t set;\n+\tcmdline_fixed_string_t nvgre;\n+\tcmdline_fixed_string_t ip_version;\n+\tuint32_t tni;\n+\tcmdline_ipaddr_t ip_src;\n+\tcmdline_ipaddr_t ip_dst;\n+\tuint16_t tci;\n+\tstruct ether_addr eth_src;\n+\tstruct ether_addr eth_dst;\n+};\n+\n+cmdline_parse_token_string_t cmd_set_nvgre_set =\n+\tTOKEN_STRING_INITIALIZER(struct cmd_set_nvgre_result, set, \"set\");\n+cmdline_parse_token_string_t cmd_set_nvgre_nvgre =\n+\tTOKEN_STRING_INITIALIZER(struct cmd_set_nvgre_result, nvgre, \"nvgre\");\n+cmdline_parse_token_string_t cmd_set_nvgre_nvgre_with_vlan =\n+\tTOKEN_STRING_INITIALIZER(struct cmd_set_nvgre_result, nvgre, \"nvgre-with-vlan\");\n+cmdline_parse_token_string_t cmd_set_nvgre_ip_version =\n+\tTOKEN_STRING_INITIALIZER(struct cmd_set_nvgre_result, ip_version,\n+\t\t\t\t \"ipv4#ipv6\");\n+cmdline_parse_token_num_t cmd_set_nvgre_tni =\n+\tTOKEN_NUM_INITIALIZER(struct cmd_set_nvgre_result, tni, UINT32);\n+cmdline_parse_token_num_t cmd_set_nvgre_ip_src =\n+\tTOKEN_IPADDR_INITIALIZER(struct cmd_set_nvgre_result, ip_src);\n+cmdline_parse_token_ipaddr_t cmd_set_nvgre_ip_dst =\n+\tTOKEN_IPADDR_INITIALIZER(struct cmd_set_nvgre_result, ip_dst);\n+cmdline_parse_token_num_t cmd_set_nvgre_vlan =\n+\tTOKEN_NUM_INITIALIZER(struct cmd_set_nvgre_result, tci, UINT16);\n+cmdline_parse_token_etheraddr_t cmd_set_nvgre_eth_src =\n+\tTOKEN_ETHERADDR_INITIALIZER(struct cmd_set_nvgre_result, eth_src);\n+cmdline_parse_token_etheraddr_t cmd_set_nvgre_eth_dst =\n+\tTOKEN_ETHERADDR_INITIALIZER(struct cmd_set_nvgre_result, eth_dst);\n+\n+static void cmd_set_nvgre_parsed(void *parsed_result,\n+\t__attribute__((unused)) struct cmdline *cl,\n+\t__attribute__((unused)) void *data)\n+{\n+\tstruct cmd_set_nvgre_result *res = parsed_result;\n+\tunion {\n+\t\tuint32_t nvgre_tni;\n+\t\tuint8_t tni[4];\n+\t} id = {\n+\t\t.nvgre_tni = rte_cpu_to_be_32(res->tni) & RTE_BE32(0x00ffffff),\n+\t};\n+\n+\tif (strcmp(res->nvgre, \"nvgre\") == 0)\n+\t\tnvgre_encap_conf.select_vlan = 0;\n+\telse if (strcmp(res->nvgre, \"nvgre-with-vlan\") == 0)\n+\t\tnvgre_encap_conf.select_vlan = 1;\n+\tif (strcmp(res->ip_version, \"ipv4\") == 0)\n+\t\tnvgre_encap_conf.select_ipv4 = 1;\n+\telse if (strcmp(res->ip_version, \"ipv6\") == 0)\n+\t\tnvgre_encap_conf.select_ipv4 = 0;\n+\telse\n+\t\treturn;\n+\trte_memcpy(nvgre_encap_conf.tni, &id.tni[1], 3);\n+\tif (nvgre_encap_conf.select_ipv4) {\n+\t\tIPV4_ADDR_TO_UINT(res->ip_src, nvgre_encap_conf.ipv4_src);\n+\t\tIPV4_ADDR_TO_UINT(res->ip_dst, nvgre_encap_conf.ipv4_dst);\n+\t} else {\n+\t\tIPV6_ADDR_TO_ARRAY(res->ip_src, nvgre_encap_conf.ipv6_src);\n+\t\tIPV6_ADDR_TO_ARRAY(res->ip_dst, nvgre_encap_conf.ipv6_dst);\n+\t}\n+\tif (nvgre_encap_conf.select_vlan)\n+\t\tnvgre_encap_conf.vlan_tci = rte_cpu_to_be_16(res->tci);\n+\trte_memcpy(nvgre_encap_conf.eth_src, res->eth_src.addr_bytes,\n+\t\t   ETHER_ADDR_LEN);\n+\trte_memcpy(nvgre_encap_conf.eth_dst, res->eth_dst.addr_bytes,\n+\t\t   ETHER_ADDR_LEN);\n+}\n+\n+cmdline_parse_inst_t cmd_set_nvgre = {\n+\t.f = cmd_set_nvgre_parsed,\n+\t.data = NULL,\n+\t.help_str = \"set nvgre ipv4|ipv6 <vni> <ip-src> <ip-dst> <eth-src>\"\n+\t\t\" <eth-dst>\",\n+\t.tokens = {\n+\t\t(void *)&cmd_set_nvgre_set,\n+\t\t(void *)&cmd_set_nvgre_nvgre,\n+\t\t(void *)&cmd_set_nvgre_ip_version,\n+\t\t(void *)&cmd_set_nvgre_tni,\n+\t\t(void *)&cmd_set_nvgre_ip_src,\n+\t\t(void *)&cmd_set_nvgre_ip_dst,\n+\t\t(void *)&cmd_set_nvgre_eth_src,\n+\t\t(void *)&cmd_set_nvgre_eth_dst,\n+\t\tNULL,\n+\t},\n+};\n+\n+cmdline_parse_inst_t cmd_set_nvgre_with_vlan = {\n+\t.f = cmd_set_nvgre_parsed,\n+\t.data = NULL,\n+\t.help_str = \"set nvgre-with-vlan ipv4|ipv6 <vni> <ip-src> <ip-dst>\"\n+\t\t\" <vlan-tci> <eth-src> <eth-dst>\",\n+\t.tokens = {\n+\t\t(void *)&cmd_set_nvgre_set,\n+\t\t(void *)&cmd_set_nvgre_nvgre_with_vlan,\n+\t\t(void *)&cmd_set_nvgre_ip_version,\n+\t\t(void *)&cmd_set_nvgre_tni,\n+\t\t(void *)&cmd_set_nvgre_ip_src,\n+\t\t(void *)&cmd_set_nvgre_ip_dst,\n+\t\t(void *)&cmd_set_nvgre_vlan,\n+\t\t(void *)&cmd_set_nvgre_eth_src,\n+\t\t(void *)&cmd_set_nvgre_eth_dst,\n+\t\tNULL,\n+\t},\n+};\n+\n /* Strict link priority scheduling mode setting */\n static void\n cmd_strict_link_prio_parsed(\n@@ -17596,6 +17712,8 @@ cmdline_parse_ctx_t main_ctx[] = {\n #endif\n \t(cmdline_parse_inst_t *)&cmd_set_vxlan,\n \t(cmdline_parse_inst_t *)&cmd_set_vxlan_with_vlan,\n+\t(cmdline_parse_inst_t *)&cmd_set_nvgre,\n+\t(cmdline_parse_inst_t *)&cmd_set_nvgre_with_vlan,\n \t(cmdline_parse_inst_t *)&cmd_ddp_add,\n \t(cmdline_parse_inst_t *)&cmd_ddp_del,\n \t(cmdline_parse_inst_t *)&cmd_ddp_get_list,\ndiff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c\nindex 7823addb7..fea9380c4 100644\n--- a/app/test-pmd/cmdline_flow.c\n+++ b/app/test-pmd/cmdline_flow.c\n@@ -241,6 +241,8 @@ enum index {\n \tACTION_OF_PUSH_MPLS_ETHERTYPE,\n \tACTION_VXLAN_ENCAP,\n \tACTION_VXLAN_DECAP,\n+\tACTION_NVGRE_ENCAP,\n+\tACTION_NVGRE_DECAP,\n };\n \n /** Maximum size for pattern in struct rte_flow_item_raw. */\n@@ -277,6 +279,22 @@ struct action_vxlan_encap_data {\n \tstruct rte_flow_item_vxlan item_vxlan;\n };\n \n+/** Maximum number of items in struct rte_flow_action_nvgre_encap. */\n+#define ACTION_NVGRE_ENCAP_ITEMS_NUM 5\n+\n+/** Storage for struct rte_flow_action_nvgre_encap including external data. */\n+struct action_nvgre_encap_data {\n+\tstruct rte_flow_action_nvgre_encap conf;\n+\tstruct rte_flow_item items[ACTION_NVGRE_ENCAP_ITEMS_NUM];\n+\tstruct rte_flow_item_eth item_eth;\n+\tstruct rte_flow_item_vlan item_vlan;\n+\tunion {\n+\t\tstruct rte_flow_item_ipv4 item_ipv4;\n+\t\tstruct rte_flow_item_ipv6 item_ipv6;\n+\t};\n+\tstruct rte_flow_item_nvgre item_nvgre;\n+};\n+\n /** Maximum number of subsequent tokens and arguments on the stack. */\n #define CTX_STACK_SIZE 16\n \n@@ -796,6 +814,8 @@ static const enum index next_action[] = {\n \tACTION_OF_PUSH_MPLS,\n \tACTION_VXLAN_ENCAP,\n \tACTION_VXLAN_DECAP,\n+\tACTION_NVGRE_ENCAP,\n+\tACTION_NVGRE_DECAP,\n \tZERO,\n };\n \n@@ -929,6 +949,9 @@ static int parse_vc_action_rss_queue(struct context *, const struct token *,\n static int parse_vc_action_vxlan_encap(struct context *, const struct token *,\n \t\t\t\t       const char *, unsigned int, void *,\n \t\t\t\t       unsigned int);\n+static int parse_vc_action_nvgre_encap(struct context *, const struct token *,\n+\t\t\t\t       const char *, unsigned int, void *,\n+\t\t\t\t       unsigned int);\n static int parse_destroy(struct context *, const struct token *,\n \t\t\t const char *, unsigned int,\n \t\t\t void *, unsigned int);\n@@ -2429,6 +2452,24 @@ static const struct token token_list[] = {\n \t\t.next = NEXT(NEXT_ENTRY(ACTION_NEXT)),\n \t\t.call = parse_vc,\n \t},\n+\t[ACTION_NVGRE_ENCAP] = {\n+\t\t.name = \"nvgre_encap\",\n+\t\t.help = \"NVGRE encapsulation, uses configuration set by \\\"set\"\n+\t\t\t\" nvgre\\\"\",\n+\t\t.priv = PRIV_ACTION(NVGRE_ENCAP,\n+\t\t\t\t    sizeof(struct action_nvgre_encap_data)),\n+\t\t.next = NEXT(NEXT_ENTRY(ACTION_NEXT)),\n+\t\t.call = parse_vc_action_nvgre_encap,\n+\t},\n+\t[ACTION_NVGRE_DECAP] = {\n+\t\t.name = \"nvgre_decap\",\n+\t\t.help = \"Performs a decapsulation action by stripping all\"\n+\t\t\t\" headers of the NVGRE tunnel network overlay from the\"\n+\t\t\t\" matched flow.\",\n+\t\t.priv = PRIV_ACTION(NVGRE_DECAP, 0),\n+\t\t.next = NEXT(NEXT_ENTRY(ACTION_NEXT)),\n+\t\t.call = parse_vc,\n+\t},\n };\n \n /** Remove and return last entry from argument stack. */\n@@ -3090,6 +3131,94 @@ parse_vc_action_vxlan_encap(struct context *ctx, const struct token *token,\n \treturn ret;\n }\n \n+/** Parse NVGRE encap action. */\n+static int\n+parse_vc_action_nvgre_encap(struct context *ctx, const struct token *token,\n+\t\t\t    const char *str, unsigned int len,\n+\t\t\t    void *buf, unsigned int size)\n+{\n+\tstruct buffer *out = buf;\n+\tstruct rte_flow_action *action;\n+\tstruct action_nvgre_encap_data *action_nvgre_encap_data;\n+\tint ret;\n+\n+\tret = parse_vc(ctx, token, str, len, buf, size);\n+\tif (ret < 0)\n+\t\treturn ret;\n+\t/* Nothing else to do if there is no buffer. */\n+\tif (!out)\n+\t\treturn ret;\n+\tif (!out->args.vc.actions_n)\n+\t\treturn -1;\n+\taction = &out->args.vc.actions[out->args.vc.actions_n - 1];\n+\t/* Point to selected object. */\n+\tctx->object = out->args.vc.data;\n+\tctx->objmask = NULL;\n+\t/* Set up default configuration. */\n+\taction_nvgre_encap_data = ctx->object;\n+\t*action_nvgre_encap_data = (struct action_nvgre_encap_data){\n+\t\t.conf = (struct rte_flow_action_nvgre_encap){\n+\t\t\t.definition = action_nvgre_encap_data->items,\n+\t\t},\n+\t\t.items = {\n+\t\t\t{\n+\t\t\t\t.type = RTE_FLOW_ITEM_TYPE_ETH,\n+\t\t\t\t.spec = &action_nvgre_encap_data->item_eth,\n+\t\t\t\t.mask = &rte_flow_item_eth_mask,\n+\t\t\t},\n+\t\t\t{\n+\t\t\t\t.type = RTE_FLOW_ITEM_TYPE_VLAN,\n+\t\t\t\t.spec = &action_nvgre_encap_data->item_vlan,\n+\t\t\t\t.mask = &rte_flow_item_vlan_mask,\n+\t\t\t},\n+\t\t\t{\n+\t\t\t\t.type = RTE_FLOW_ITEM_TYPE_IPV4,\n+\t\t\t\t.spec = &action_nvgre_encap_data->item_ipv4,\n+\t\t\t\t.mask = &rte_flow_item_ipv4_mask,\n+\t\t\t},\n+\t\t\t{\n+\t\t\t\t.type = RTE_FLOW_ITEM_TYPE_NVGRE,\n+\t\t\t\t.spec = &action_nvgre_encap_data->item_nvgre,\n+\t\t\t\t.mask = &rte_flow_item_nvgre_mask,\n+\t\t\t},\n+\t\t\t{\n+\t\t\t\t.type = RTE_FLOW_ITEM_TYPE_END,\n+\t\t\t},\n+\t\t},\n+\t\t.item_eth.type = 0,\n+\t\t.item_vlan.tci = nvgre_encap_conf.vlan_tci,\n+\t\t.item_ipv4.hdr = {\n+\t\t       .src_addr = nvgre_encap_conf.ipv4_src,\n+\t\t       .dst_addr = nvgre_encap_conf.ipv4_dst,\n+\t\t},\n+\t\t.item_nvgre.flow_id = 0,\n+\t};\n+\tmemcpy(action_nvgre_encap_data->item_eth.dst.addr_bytes,\n+\t       nvgre_encap_conf.eth_dst, ETHER_ADDR_LEN);\n+\tmemcpy(action_nvgre_encap_data->item_eth.src.addr_bytes,\n+\t       nvgre_encap_conf.eth_src, ETHER_ADDR_LEN);\n+\tif (!nvgre_encap_conf.select_ipv4) {\n+\t\tmemcpy(&action_nvgre_encap_data->item_ipv6.hdr.src_addr,\n+\t\t       &nvgre_encap_conf.ipv6_src,\n+\t\t       sizeof(nvgre_encap_conf.ipv6_src));\n+\t\tmemcpy(&action_nvgre_encap_data->item_ipv6.hdr.dst_addr,\n+\t\t       &nvgre_encap_conf.ipv6_dst,\n+\t\t       sizeof(nvgre_encap_conf.ipv6_dst));\n+\t\taction_nvgre_encap_data->items[2] = (struct rte_flow_item){\n+\t\t\t.type = RTE_FLOW_ITEM_TYPE_IPV6,\n+\t\t\t.spec = &action_nvgre_encap_data->item_ipv6,\n+\t\t\t.mask = &rte_flow_item_ipv6_mask,\n+\t\t};\n+\t}\n+\tif (!nvgre_encap_conf.select_vlan)\n+\t\taction_nvgre_encap_data->items[1].type =\n+\t\t\tRTE_FLOW_ITEM_TYPE_VOID;\n+\tmemcpy(action_nvgre_encap_data->item_nvgre.tni, nvgre_encap_conf.tni,\n+\t       RTE_DIM(nvgre_encap_conf.tni));\n+\taction->conf = &action_nvgre_encap_data->conf;\n+\treturn ret;\n+}\n+\n /** Parse tokens for destroy command. */\n static int\n parse_destroy(struct context *ctx, const struct token *token,\ndiff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c\nindex 4a18d043c..121685da3 100644\n--- a/app/test-pmd/testpmd.c\n+++ b/app/test-pmd/testpmd.c\n@@ -410,6 +410,21 @@ struct vxlan_encap_conf vxlan_encap_conf = {\n \t.eth_dst = \"\\xff\\xff\\xff\\xff\\xff\\xff\",\n };\n \n+struct nvgre_encap_conf nvgre_encap_conf = {\n+\t.select_ipv4 = 1,\n+\t.select_vlan = 0,\n+\t.tni = \"\\x00\\x00\\x00\",\n+\t.ipv4_src = IPv4(127, 0, 0, 1),\n+\t.ipv4_dst = IPv4(255, 255, 255, 255),\n+\t.ipv6_src = \"\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\"\n+\t\t\"\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x01\",\n+\t.ipv6_dst = \"\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\"\n+\t\t\"\\x00\\x00\\x00\\x00\\x00\\x00\\x11\\x11\",\n+\t.vlan_tci = 0,\n+\t.eth_src = \"\\x00\\x00\\x00\\x00\\x00\\x00\",\n+\t.eth_dst = \"\\xff\\xff\\xff\\xff\\xff\\xff\",\n+};\n+\n /* Forward function declarations */\n static void map_port_queue_stats_mapping_registers(portid_t pi,\n \t\t\t\t\t\t   struct rte_port *port);\ndiff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h\nindex 0d6618788..2b1e448b0 100644\n--- a/app/test-pmd/testpmd.h\n+++ b/app/test-pmd/testpmd.h\n@@ -496,6 +496,21 @@ struct vxlan_encap_conf {\n };\n struct vxlan_encap_conf vxlan_encap_conf;\n \n+/* NVGRE encap/decap parameters. */\n+struct nvgre_encap_conf {\n+\tuint32_t select_ipv4:1;\n+\tuint32_t select_vlan:1;\n+\tuint8_t tni[3];\n+\trte_be32_t ipv4_src;\n+\trte_be32_t ipv4_dst;\n+\tuint8_t ipv6_src[16];\n+\tuint8_t ipv6_dst[16];\n+\trte_be16_t vlan_tci;\n+\tuint8_t eth_src[ETHER_ADDR_LEN];\n+\tuint8_t eth_dst[ETHER_ADDR_LEN];\n+};\n+struct nvgre_encap_conf nvgre_encap_conf;\n+\n static inline unsigned int\n lcore_num(void)\n {\ndiff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst\nindex 698b83268..35d8b8d14 100644\n--- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst\n+++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst\n@@ -1547,6 +1547,19 @@ flow rule using the action vxlan_encap will use the last configuration set.\n To have a different encapsulation header, one of those commands must be called\n before the flow rule creation.\n \n+Config NVGRE Encap outer layers\n+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n+\n+Configure the outer layer to encapsulate a packet inside a NVGRE tunnel::\n+\n+ testpmd> set nvgre ipv4|ipv6 (tni) (ip-src) (ip-dst) (mac-src) (mac-dst)\n+ testpmd> set nvgre-with-vlan ipv4|ipv6 (tni) (ip-src) (ip-dst) (vlan-tci) (mac-src) (mac-dst)\n+\n+Those command will set an internal configuration inside testpmd, any following\n+flow rule using the action nvgre_encap will use the last configuration set.\n+To have a different encapsulation header, one of those commands must be called\n+before the flow rule creation.\n+\n Port Functions\n --------------\n \n@@ -3668,6 +3681,12 @@ This section lists supported actions and their attributes, if any.\n - ``vxlan_decap``: Performs a decapsulation action by stripping all headers of\n   the VXLAN tunnel network overlay from the matched flow.\n \n+- ``nvgre_encap``: Performs a NVGRE encapsulation, outer layer configuration\n+  is done through `Config NVGRE Encap outer layers`_.\n+\n+- ``nvgre_decap``: Performs a decapsulation action by stripping all headers of\n+  the NVGRE tunnel network overlay from the matched flow.\n+\n Destroying flow rules\n ~~~~~~~~~~~~~~~~~~~~~\n \n@@ -3955,6 +3974,29 @@ IPv6 VXLAN outer header::\n  testpmd> set vxlan-with-vlan ipv6 4 4 4 ::1 ::2222 34 11:11:11:11:11:11 22:22:22:22:22:22\n  testpmd> flow create 0 ingress pattern end actions vxlan_encap / queue index 0 / end\n \n+Sample NVGRE encapsulation rule\n+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n+\n+NVGRE encapsulation outer layer has default value pre-configured in testpmd\n+source code, those can be changed by using the following commands\n+\n+IPv4 NVGRE outer header::\n+\n+ testpmd> set nvgre ipv4 4 127.0.0.1 128.0.0.1 11:11:11:11:11:11 22:22:22:22:22:22\n+ testpmd> flow create 0 ingress pattern end actions nvgre_encap / queue index 0 / end\n+\n+ testpmd> set nvgre-with-vlan 4 127.0.0.1 128.0.0.1 34 11:11:11:11:11:11 22:22:22:22:22:22\n+ testpmd> flow create 0 ingress pattern end actions vxlan_encap / queue index 0 / end\n+\n+IPv6 NVGRE outer header::\n+\n+ testpmd> set nvgre ipv6 4 ::1 ::2222 11:11:11:11:11:11 22:22:22:22:22:22\n+ testpmd> flow create 0 ingress pattern end actions vxlan_encap / queue index 0 / end\n+\n+ testpmd> set nvgre-with-vlan ipv6 4 ::1 ::2222 34 11:11:11:11:11:11 22:22:22:22:22:22\n+ testpmd> flow create 0 ingress pattern end actions vxlan_encap / queue index 0 / end\n+\n+\n BPF Functions\n --------------\n \n",
    "prefixes": [
        "v5",
        "2/2"
    ]
}