Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/41145/?format=api
http://patches.dpdk.org/api/patches/41145/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/patch/a5f0df2146a2ab4052688b887232401fba77342f.1528988347.git.nelio.laranjeiro@6wind.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": "<a5f0df2146a2ab4052688b887232401fba77342f.1528988347.git.nelio.laranjeiro@6wind.com>", "list_archive_url": "https://inbox.dpdk.org/dev/a5f0df2146a2ab4052688b887232401fba77342f.1528988347.git.nelio.laranjeiro@6wind.com", "date": "2018-06-14T15:09:00", "name": "[2/2] app/testpmd: add NVGRE encap/decap support", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "33766ac26f69021a88d48d9e24b81b6928ce6173", "submitter": { "id": 243, "url": "http://patches.dpdk.org/api/people/243/?format=api", "name": "Nélio Laranjeiro", "email": "nelio.laranjeiro@6wind.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/a5f0df2146a2ab4052688b887232401fba77342f.1528988347.git.nelio.laranjeiro@6wind.com/mbox/", "series": [ { "id": 130, "url": "http://patches.dpdk.org/api/series/130/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=130", "date": "2018-06-14T15:08:58", "name": "implement VXLAN/NVGRE Encap/Decap in testpmd", "version": 1, "mbox": "http://patches.dpdk.org/series/130/mbox/" } ], "comments": "http://patches.dpdk.org/api/patches/41145/comments/", "check": "success", "checks": "http://patches.dpdk.org/api/patches/41145/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 180B01DDE1;\n\tThu, 14 Jun 2018 17:09:20 +0200 (CEST)", "from mail-wr0-f195.google.com (mail-wr0-f195.google.com\n\t[209.85.128.195]) by dpdk.org (Postfix) with ESMTP id AF7521DCB2\n\tfor <dev@dpdk.org>; Thu, 14 Jun 2018 17:09:16 +0200 (CEST)", "by mail-wr0-f195.google.com with SMTP id w10-v6so6822153wrk.9\n\tfor <dev@dpdk.org>; Thu, 14 Jun 2018 08:09:16 -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\tj131-v6sm10353378wmg.24.2018.06.14.08.09.15\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tThu, 14 Jun 2018 08:09:15 -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\t:in-reply-to:references;\n\tbh=XLLnH3ymQeBKr58VFc4DvKRDpTwI/zPB3Fw2O0N2eJM=;\n\tb=d+krmj6fdQozSBYYzXn6kxUNdHjtB7mo09A+XdiyXuRDHJPejee8TVPJ4UwqlCJVCR\n\txvlIpTeN/rynNUI1s/9Rp622/tTaX+C0yUfNE4y8vJVws4TY9Lmc24pw0g0FNMOvOcrM\n\t5EK8kscpHgmr6TsKXpEG68530+wZwe8XJdc9G/sgUjEDcd2RAryIJ37z97S7W2wBr5EO\n\tRKEnmnat4+Sn+EweMq9tcxsTvMONmeL+BQieCIJcNYmGvVMz1gaAOCkLXAFaueZ5KpE6\n\tEEkkCsIvWeQMBPQ2gT6VzJQh1KDcVvvRZcmr2v4+m6ySpDtoArrNs8fsCl9H4Gv6b4pg\n\tFtgw==", "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:in-reply-to:references;\n\tbh=XLLnH3ymQeBKr58VFc4DvKRDpTwI/zPB3Fw2O0N2eJM=;\n\tb=M+QydFf7Ja5VscZJVey/Ex4Uz+UOMOb+3FfkXcVlPiJXAMUoeeQcTdmYx6/2yllLl4\n\t8C5egB/+s6TBF6MM2FU2WSIga3kFVfdhbKQf/WGDkif+VofZcIy8oAw5K2YC6nKnTQXN\n\t7h/yJrcAfmgFvh8WLuyyHzW2oahRDIgrNAiP8SED0je5aGkhpJL0/3XDHRrbeZK5sXQm\n\tYgdhsMiEOD4LzRKnybzyX0wVvSR8svVMDEgd1VMKySxuiemojMbz6Zi0VEF1+icdSkr3\n\tKEPkBBForezLASjXnpH+Crwf/VZhLyi+g6J2EVUn/6b84gwg7q2Qbr1Iz9skA8bJEy0b\n\t5ZBw==", "X-Gm-Message-State": "APt69E3dXB6RjmPP7ZydPTC73FcQwRUa6Y3wyWUP5uvZIcVUWdQEnZvo\n\tYxpFeReQ18vW8dvip+JnwlL5i/ZgJA==", "X-Google-Smtp-Source": "ADUXVKLWExYZ0VOmGI3af0iGel+GDJm7x/o95Dlm1H+FZqtphUUfkZO6UuR1Dxv9Vl36J08Xm9b5eg==", "X-Received": "by 2002:adf:824e:: with SMTP id\n\t72-v6mr2771260wrb.127.1528988956145; \n\tThu, 14 Jun 2018 08:09:16 -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>", "Cc": "Mohammad Abdul Awal <mohammad.abdul.awal@intel.com>", "Date": "Thu, 14 Jun 2018 17:09:00 +0200", "Message-Id": "<a5f0df2146a2ab4052688b887232401fba77342f.1528988347.git.nelio.laranjeiro@6wind.com>", "X-Mailer": "git-send-email 2.17.1", "In-Reply-To": [ "<cover.1528988346.git.nelio.laranjeiro@6wind.com>", "<cover.1528988346.git.nelio.laranjeiro@6wind.com>" ], "References": [ "<cover.1528988346.git.nelio.laranjeiro@6wind.com>", "<cover.1528988346.git.nelio.laranjeiro@6wind.com>" ], "Subject": "[dpdk-dev] [PATCH 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://dpdk.org/ml/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>", "List-Archive": "<http://dpdk.org/ml/archives/dev/>", "List-Post": "<mailto:dev@dpdk.org>", "List-Help": "<mailto:dev-request@dpdk.org?subject=help>", "List-Subscribe": "<https://dpdk.org/ml/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 | 79 +++++++++++++\n app/test-pmd/cmdline_flow.c | 119 ++++++++++++++++++++\n app/test-pmd/testpmd.c | 9 ++\n app/test-pmd/testpmd.h | 13 +++\n doc/guides/testpmd_app_ug/testpmd_funcs.rst | 13 +++\n 5 files changed, 233 insertions(+)", "diff": "diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c\nindex a3b98b2f2..588696d5c 100644\n--- a/app/test-pmd/cmdline.c\n+++ b/app/test-pmd/cmdline.c\n@@ -785,6 +785,9 @@ static void cmd_help_long_parsed(void *parsed_result,\n \t\t\t\" 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, list_pkt_forwarding_modes()\n \t\t);\n \t}\n@@ -14927,6 +14930,81 @@ cmdline_parse_inst_t cmd_set_vxlan = {\n \t},\n };\n \n+/** Set VXLAN 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+\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_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_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+\tuint32_t tni = rte_cpu_to_be_32(res->tni) >> 8;\n+\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+\tmemcpy(nvgre_encap_conf.tni, &tni, 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+\tmemcpy(nvgre_encap_conf.eth_src, res->eth_src.addr_bytes,\n+\t ETHER_ADDR_LEN);\n+\tmemcpy(nvgre_encap_conf.eth_dst, res->eth_dst.addr_bytes,\n+\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 /* Strict link priority scheduling mode setting */\n static void\n cmd_strict_link_prio_parsed(\n@@ -17552,6 +17630,7 @@ cmdline_parse_ctx_t main_ctx[] = {\n \t(cmdline_parse_inst_t *)&cmd_set_port_tm_hierarchy_default,\n #endif\n \t(cmdline_parse_inst_t *)&cmd_set_vxlan,\n+\t(cmdline_parse_inst_t *)&cmd_set_nvgre,\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 9f609b7db..dd55056fd 100644\n--- a/app/test-pmd/cmdline_flow.c\n+++ b/app/test-pmd/cmdline_flow.c\n@@ -239,6 +239,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@@ -274,6 +276,21 @@ 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 4\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+\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@@ -793,6 +810,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@@ -919,6 +938,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@@ -2403,6 +2425,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@@ -3055,6 +3095,85 @@ 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 = &action_nvgre_encap_data->item_eth,\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 = &action_nvgre_encap_data->item_ipv4,\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 = &action_nvgre_encap_data->item_nvgre,\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_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[1] = (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 = &action_nvgre_encap_data->item_ipv6,\n+\t\t};\n+\t}\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 1c68c9d30..f54205949 100644\n--- a/app/test-pmd/testpmd.c\n+++ b/app/test-pmd/testpmd.c\n@@ -408,6 +408,15 @@ 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.tni = \"\\x00\\x00\\x00\",\n+\t.ipv4_src = IPv4(127, 0, 0, 1),\n+\t.ipv4_dst = IPv4(255, 255, 255, 255),\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 72c4e8d54..7871b93e1 100644\n--- a/app/test-pmd/testpmd.h\n+++ b/app/test-pmd/testpmd.h\n@@ -494,6 +494,19 @@ 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+\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+\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 162d1c535..0ee497f11 100644\n--- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst\n+++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst\n@@ -1541,6 +1541,13 @@ Configure the outer layer to encapsulate a packet inside a VXLAN tunnel::\n \n testpmd> set vxlan ipv4|ipv6 (udp-src) (udp-dst) (ip-src) (ip-dst) (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 (ip-src) (ip-dst) (mac-src) (mac-dst)\n+\n Port Functions\n --------------\n \n@@ -3662,6 +3669,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 VXLAN tunnel network overlay from the matched flow.\n+\n Destroying flow rules\n ~~~~~~~~~~~~~~~~~~~~~\n \n", "prefixes": [ "2/2" ] }{ "id": 41145, "url": "