get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 41342,
    "url": "https://patches.dpdk.org/api/patches/41342/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/cfb060b8bbbabd7c89f473b7546f80359f9796c8.1529420040.git.nelio.laranjeiro@6wind.com/",
    "project": {
        "id": 1,
        "url": "https://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": "<cfb060b8bbbabd7c89f473b7546f80359f9796c8.1529420040.git.nelio.laranjeiro@6wind.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/cfb060b8bbbabd7c89f473b7546f80359f9796c8.1529420040.git.nelio.laranjeiro@6wind.com",
    "date": "2018-06-21T07:13:40",
    "name": "[v4,2/2] app/testpmd: add NVGRE encap/decap support",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "06afe9ed74a19ad3620d47e5d47d7f29eb7171fe",
    "submitter": {
        "id": 243,
        "url": "https://patches.dpdk.org/api/people/243/?format=api",
        "name": "Nélio Laranjeiro",
        "email": "nelio.laranjeiro@6wind.com"
    },
    "delegate": {
        "id": 319,
        "url": "https://patches.dpdk.org/api/users/319/?format=api",
        "username": "fyigit",
        "first_name": "Ferruh",
        "last_name": "Yigit",
        "email": "ferruh.yigit@amd.com"
    },
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/cfb060b8bbbabd7c89f473b7546f80359f9796c8.1529420040.git.nelio.laranjeiro@6wind.com/mbox/",
    "series": [
        {
            "id": 185,
            "url": "https://patches.dpdk.org/api/series/185/?format=api",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=185",
            "date": "2018-06-21T07:13:38",
            "name": "app/testpmd implement VXLAN/NVGRE Encap/Decap",
            "version": 4,
            "mbox": "https://patches.dpdk.org/series/185/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/41342/comments/",
    "check": "success",
    "checks": "https://patches.dpdk.org/api/patches/41342/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 3289D1BB32;\n\tThu, 21 Jun 2018 09:13:42 +0200 (CEST)",
            "from mail-wm0-f65.google.com (mail-wm0-f65.google.com\n\t[74.125.82.65]) by dpdk.org (Postfix) with ESMTP id 9C9131BB1C\n\tfor <dev@dpdk.org>; Thu, 21 Jun 2018 09:13:38 +0200 (CEST)",
            "by mail-wm0-f65.google.com with SMTP id p126-v6so3319080wmb.2\n\tfor <dev@dpdk.org>; Thu, 21 Jun 2018 00:13:38 -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\tn7-v6sm5187998wrr.39.2018.06.21.00.13.36\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tThu, 21 Jun 2018 00:13:37 -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:subject:date:message-id:in-reply-to:references;\n\tbh=UiWKvdrKQ9oG0KpQcxA+bezLZFfo+hiUCJJ0vPMTb5k=;\n\tb=O1Mi+Ay7DlWeJ9by6xnzubBVBQ/1Vu3yiEGR09W9SdiDTafMfBm2xBmsgXsgTZbGln\n\t8q7M6Da3yjuPLxI3n4IXApUXetigC5rhQbkFoi+o1Ks1WG5stRl4PVC8hirFxR7l+rlj\n\tYd88dcV4zsylkEbwiS5sWWu/02VpQjV169bG5RyIQKjEZlz9tZaaQRaYj1d9D5h4wV7h\n\tq9eGsAiccG8bkXNRxlaYjAfe9Mvb14fNPmh3DGVYs0E8T9RbOa5lxSnorL32sFEa5DfQ\n\tZQIXv7iCXSj6e3mRHJ+xRwL1VOUwVwwFFItJuWPYa+hUJgW54rOgGLKBtSY0gFpZDULi\n\tQkMw==",
        "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:subject:date:message-id:in-reply-to\n\t:references;\n\tbh=UiWKvdrKQ9oG0KpQcxA+bezLZFfo+hiUCJJ0vPMTb5k=;\n\tb=ThZyqPLB/jpzGUNB5mXUoSCDmy/N72B6Fqbem4Q/u9aO9eD7xVI9YqXAvDy8D2gc8x\n\tY8fkzoVRcuwRFkcz+z4144g7rTgNr7eK8tPb2tlWWG+y1BzwjmQBDhtMPglPb6t3mlV5\n\tTnERCu/FXpjliW2t02iHUKxh8+LSQomskRyGjc2U1CP2cNXp10EbaGtsYgu5dhco4sgG\n\t0lMIKIYjN2cwxVTpvRYom5wQPe5y7DbOVlwB9SpR54uwfp8AaAFt4YNG94IyXM3XtBEr\n\tS1N/jBUkRzaDl4R9/Bp6bNETENRRAqjB6Vrzm4DuBYORCIME80sx5Jw7uSWAHyditZqU\n\tEKlQ==",
        "X-Gm-Message-State": "APt69E0CF49nVw5yQQFndZfrOMNH7B79e5+qZkJLUjWtjA8o5iQLUcDz\n\taBk59ue14oa/1ZGZ3m1qZBGorf8VUQ==",
        "X-Google-Smtp-Source": "ADUXVKJunndrsdSsbXVaqLWzBXqW9nsiUK9T3LFamyDta+8W7neQJqrxGs/IskprAfLmYNem6zOfmQ==",
        "X-Received": "by 2002:a1c:6c0f:: with SMTP id\n\th15-v6mr3741446wmc.30.1529565217761; \n\tThu, 21 Jun 2018 00:13:37 -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\tOri Kam <orika@mellanox.com>,\n\tStephen Hemminger <stephen@networkplumber.org>",
        "Date": "Thu, 21 Jun 2018 09:13:40 +0200",
        "Message-Id": "<cfb060b8bbbabd7c89f473b7546f80359f9796c8.1529420040.git.nelio.laranjeiro@6wind.com>",
        "X-Mailer": "git-send-email 2.18.0.rc2",
        "In-Reply-To": "<cover.1529420040.git.nelio.laranjeiro@6wind.com>",
        "References": "<cover.1529332365.git.nelio.laranjeiro@6wind.com>\n\t<cover.1529420040.git.nelio.laranjeiro@6wind.com>",
        "Subject": "[dpdk-dev] [PATCH v4 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>\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 |  37 ++++++\n 5 files changed, 314 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 5f581c360..c60b507a0 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 2743043d3..17e0fef63 100644\n--- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst\n+++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst\n@@ -1542,6 +1542,14 @@ Configure the outer layer to encapsulate a packet inside a VXLAN tunnel::\n  testpmd> set vxlan ipv4|ipv6 (vni) (udp-src) (udp-dst) (ip-src) (ip-dst) (mac-src) (mac-dst)\n  testpmd> set vxlan-with-vlan ipv4|ipv6 (vni) (udp-src) (udp-dst) (ip-src) (ip-dst) (vlan-tci) (mac-src) (mac-dst)\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 Port Functions\n --------------\n \n@@ -3663,6 +3671,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@@ -3950,6 +3964,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": [
        "v4",
        "2/2"
    ]
}