get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 55705,
    "url": "http://patches.dpdk.org/api/patches/55705/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20190630180609.36705-37-jerinj@marvell.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": "<20190630180609.36705-37-jerinj@marvell.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20190630180609.36705-37-jerinj@marvell.com",
    "date": "2019-06-30T18:05:48",
    "name": "[v2,36/57] net/octeontx2: add flow parsing for outer layers",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "7b433551db4538f01125a9235570bdce074c17be",
    "submitter": {
        "id": 1188,
        "url": "http://patches.dpdk.org/api/people/1188/?format=api",
        "name": "Jerin Jacob Kollanukkaran",
        "email": "jerinj@marvell.com"
    },
    "delegate": {
        "id": 310,
        "url": "http://patches.dpdk.org/api/users/310/?format=api",
        "username": "jerin",
        "first_name": "Jerin",
        "last_name": "Jacob",
        "email": "jerinj@marvell.com"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/20190630180609.36705-37-jerinj@marvell.com/mbox/",
    "series": [
        {
            "id": 5236,
            "url": "http://patches.dpdk.org/api/series/5236/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=5236",
            "date": "2019-06-30T18:05:12",
            "name": "OCTEON TX2 Ethdev driver",
            "version": 2,
            "mbox": "http://patches.dpdk.org/series/5236/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/55705/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/55705/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 BD81E1B9C8;\n\tSun, 30 Jun 2019 20:10:14 +0200 (CEST)",
            "from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com\n\t[67.231.148.174]) by dpdk.org (Postfix) with ESMTP id 2E5731BA92\n\tfor <dev@dpdk.org>; Sun, 30 Jun 2019 20:08:25 +0200 (CEST)",
            "from pps.filterd (m0045849.ppops.net [127.0.0.1])\n\tby mx0a-0016f401.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id\n\tx5UI6fu9028350 for <dev@dpdk.org>; Sun, 30 Jun 2019 11:08:24 -0700",
            "from sc-exch04.marvell.com ([199.233.58.184])\n\tby mx0a-0016f401.pphosted.com with ESMTP id 2te5bn4gm8-1\n\t(version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT)\n\tfor <dev@dpdk.org>; Sun, 30 Jun 2019 11:08:24 -0700",
            "from SC-EXCH01.marvell.com (10.93.176.81) by SC-EXCH04.marvell.com\n\t(10.93.176.84) with Microsoft SMTP Server (TLS) id 15.0.1367.3;\n\tSun, 30 Jun 2019 11:08:23 -0700",
            "from maili.marvell.com (10.93.176.43) by SC-EXCH01.marvell.com\n\t(10.93.176.81) with Microsoft SMTP Server id 15.0.1367.3 via Frontend\n\tTransport; Sun, 30 Jun 2019 11:08:23 -0700",
            "from jerin-lab.marvell.com (jerin-lab.marvell.com [10.28.34.14])\n\tby maili.marvell.com (Postfix) with ESMTP id 6B7CF3F703F;\n\tSun, 30 Jun 2019 11:08:21 -0700 (PDT)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com;\n\th=from : to : cc :\n\tsubject : date : message-id : in-reply-to : references : mime-version\n\t: content-transfer-encoding : content-type; s=pfpt0818;\n\tbh=oyd2ri10+dPwYI19Y4MjxEvX4HiJiDh2Yirce9n2QhI=;\n\tb=tAQeN2hHskpfCyxYnI8gudP/k0YvO0xfrNMPCPIewi8IO5TdTzcGrAQOofQSv+IStm9l\n\tH+Y7xthF5KzCsCpb1dgrJSVcxevEnCz4fQJzGR2JDnRSAEzOC8/lH50vK2pwb4DJzfJy\n\tD2jl7ATSantk3uB+SwegZMsckbFgRomSrqJhMvm3TwTwP9Zow6PxYaAJm74349VZ/NSy\n\tPD5eH9zgsuMjcwtu4aBCoIdilTqcsiQx5E4UXD8+TgmgzBkkHlDwNOq0W6LzaNhSutMF\n\tc7rCDR7psxJNMr0MwiADf+nixQTmsOqrqR07gmpJHSDP3DizlKFhOLF3wIuP6S65L6lj\n\tpg== ",
        "From": "<jerinj@marvell.com>",
        "To": "<dev@dpdk.org>, Jerin Jacob <jerinj@marvell.com>, Nithin Dabilpuram\n\t<ndabilpuram@marvell.com>, Kiran Kumar K <kirankumark@marvell.com>",
        "CC": "Vivek Sharma <viveksharma@marvell.com>",
        "Date": "Sun, 30 Jun 2019 23:35:48 +0530",
        "Message-ID": "<20190630180609.36705-37-jerinj@marvell.com>",
        "X-Mailer": "git-send-email 2.21.0",
        "In-Reply-To": "<20190630180609.36705-1-jerinj@marvell.com>",
        "References": "<20190602152434.23996-1-jerinj@marvell.com>\n\t<20190630180609.36705-1-jerinj@marvell.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Content-Type": "text/plain",
        "X-Proofpoint-Virus-Version": "vendor=fsecure engine=2.50.10434:, ,\n\tdefinitions=2019-06-30_08:, , signatures=0",
        "Subject": "[dpdk-dev] [PATCH v2 36/57] net/octeontx2: add flow parsing for\n\touter layers",
        "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": "From: Kiran Kumar K <kirankumark@marvell.com>\n\nAdding functionality to parse outer layers from ld to lh.\nThese will be used parse outer layers L2, L3, L4 and tunnel types.\n\nSigned-off-by: Kiran Kumar K <kirankumark@marvell.com>\nSigned-off-by: Vivek Sharma <viveksharma@marvell.com>\n---\n drivers/net/octeontx2/Makefile          |   1 +\n drivers/net/octeontx2/meson.build       |   1 +\n drivers/net/octeontx2/otx2_flow_parse.c | 459 ++++++++++++++++++++++++\n 3 files changed, 461 insertions(+)\n create mode 100644 drivers/net/octeontx2/otx2_flow_parse.c",
    "diff": "diff --git a/drivers/net/octeontx2/Makefile b/drivers/net/octeontx2/Makefile\nindex 8d1aeae3f..3eb4dba53 100644\n--- a/drivers/net/octeontx2/Makefile\n+++ b/drivers/net/octeontx2/Makefile\n@@ -37,6 +37,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_OCTEONTX2_PMD) += \\\n \totx2_lookup.c\t\\\n \totx2_ethdev.c\t\\\n \totx2_flow_ctrl.c \\\n+\totx2_flow_parse.c \\\n \totx2_flow_utils.c \\\n \totx2_ethdev_irq.c \\\n \totx2_ethdev_ops.c \\\ndiff --git a/drivers/net/octeontx2/meson.build b/drivers/net/octeontx2/meson.build\nindex 75156ddbe..f608c4947 100644\n--- a/drivers/net/octeontx2/meson.build\n+++ b/drivers/net/octeontx2/meson.build\n@@ -12,6 +12,7 @@ sources = files(\n \t\t'otx2_lookup.c',\n \t\t'otx2_ethdev.c',\n \t\t'otx2_flow_ctrl.c',\n+\t\t'otx2_flow_parse.c',\n \t\t'otx2_flow_utils.c',\n \t\t'otx2_ethdev_irq.c',\n \t\t'otx2_ethdev_ops.c',\ndiff --git a/drivers/net/octeontx2/otx2_flow_parse.c b/drivers/net/octeontx2/otx2_flow_parse.c\nnew file mode 100644\nindex 000000000..d27a24833\n--- /dev/null\n+++ b/drivers/net/octeontx2/otx2_flow_parse.c\n@@ -0,0 +1,459 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright(C) 2019 Marvell International Ltd.\n+ */\n+\n+#include \"otx2_ethdev.h\"\n+#include \"otx2_flow.h\"\n+\n+const struct rte_flow_item *\n+otx2_flow_skip_void_and_any_items(const struct rte_flow_item *pattern)\n+{\n+\twhile ((pattern->type == RTE_FLOW_ITEM_TYPE_VOID) ||\n+\t       (pattern->type == RTE_FLOW_ITEM_TYPE_ANY))\n+\t\tpattern++;\n+\n+\treturn pattern;\n+}\n+\n+/*\n+ * Tunnel+ESP, Tunnel+ICMP4/6, Tunnel+TCP, Tunnel+UDP,\n+ * Tunnel+SCTP\n+ */\n+int\n+otx2_flow_parse_lh(struct otx2_parse_state *pst)\n+{\n+\tstruct otx2_flow_item_info info;\n+\tchar hw_mask[64];\n+\tint lid, lt;\n+\tint rc;\n+\n+\tif (!pst->tunnel)\n+\t\treturn 0;\n+\n+\tinfo.hw_mask = &hw_mask;\n+\tinfo.spec = NULL;\n+\tinfo.mask = NULL;\n+\tinfo.hw_hdr_len = 0;\n+\tlid = NPC_LID_LH;\n+\n+\tswitch (pst->pattern->type) {\n+\tcase RTE_FLOW_ITEM_TYPE_UDP:\n+\t\tlt = NPC_LT_LH_TU_UDP;\n+\t\tinfo.def_mask = &rte_flow_item_udp_mask;\n+\t\tinfo.len = sizeof(struct rte_flow_item_udp);\n+\t\tbreak;\n+\tcase RTE_FLOW_ITEM_TYPE_TCP:\n+\t\tlt = NPC_LT_LH_TU_TCP;\n+\t\tinfo.def_mask = &rte_flow_item_tcp_mask;\n+\t\tinfo.len = sizeof(struct rte_flow_item_tcp);\n+\t\tbreak;\n+\tcase RTE_FLOW_ITEM_TYPE_SCTP:\n+\t\tlt = NPC_LT_LH_TU_SCTP;\n+\t\tinfo.def_mask = &rte_flow_item_sctp_mask;\n+\t\tinfo.len = sizeof(struct rte_flow_item_sctp);\n+\t\tbreak;\n+\tcase RTE_FLOW_ITEM_TYPE_ESP:\n+\t\tlt = NPC_LT_LH_TU_ESP;\n+\t\tinfo.def_mask = &rte_flow_item_esp_mask;\n+\t\tinfo.len = sizeof(struct rte_flow_item_esp);\n+\t\tbreak;\n+\tdefault:\n+\t\treturn 0;\n+\t}\n+\n+\totx2_flow_get_hw_supp_mask(pst, &info, lid, lt);\n+\trc = otx2_flow_parse_item_basic(pst->pattern, &info, pst->error);\n+\tif (rc != 0)\n+\t\treturn rc;\n+\n+\treturn otx2_flow_update_parse_state(pst, &info, lid, lt, 0);\n+}\n+\n+/* Tunnel+IPv4, Tunnel+IPv6 */\n+int\n+otx2_flow_parse_lg(struct otx2_parse_state *pst)\n+{\n+\tstruct otx2_flow_item_info info;\n+\tchar hw_mask[64];\n+\tint lid, lt;\n+\tint rc;\n+\n+\tif (!pst->tunnel)\n+\t\treturn 0;\n+\n+\tinfo.hw_mask = &hw_mask;\n+\tinfo.spec = NULL;\n+\tinfo.mask = NULL;\n+\tinfo.hw_hdr_len = 0;\n+\tlid = NPC_LID_LG;\n+\n+\tif (pst->pattern->type == RTE_FLOW_ITEM_TYPE_IPV4) {\n+\t\tlt = NPC_LT_LG_TU_IP;\n+\t\tinfo.def_mask = &rte_flow_item_ipv4_mask;\n+\t\tinfo.len = sizeof(struct rte_flow_item_ipv4);\n+\t} else if (pst->pattern->type == RTE_FLOW_ITEM_TYPE_IPV6) {\n+\t\tlt = NPC_LT_LG_TU_IP6;\n+\t\tinfo.def_mask = &rte_flow_item_ipv6_mask;\n+\t\tinfo.len = sizeof(struct rte_flow_item_ipv6);\n+\t} else {\n+\t\t/* There is no tunneled IP header */\n+\t\treturn 0;\n+\t}\n+\n+\totx2_flow_get_hw_supp_mask(pst, &info, lid, lt);\n+\trc = otx2_flow_parse_item_basic(pst->pattern, &info, pst->error);\n+\tif (rc != 0)\n+\t\treturn rc;\n+\n+\treturn otx2_flow_update_parse_state(pst, &info, lid, lt, 0);\n+}\n+\n+/* Tunnel+Ether */\n+int\n+otx2_flow_parse_lf(struct otx2_parse_state *pst)\n+{\n+\tconst struct rte_flow_item *pattern, *last_pattern;\n+\tstruct rte_flow_item_eth hw_mask;\n+\tstruct otx2_flow_item_info info;\n+\tint lid, lt, lflags;\n+\tint nr_vlans = 0;\n+\tint rc;\n+\n+\t/* We hit this layer if there is a tunneling protocol */\n+\tif (!pst->tunnel)\n+\t\treturn 0;\n+\n+\tif (pst->pattern->type != RTE_FLOW_ITEM_TYPE_ETH)\n+\t\treturn 0;\n+\n+\tlid = NPC_LID_LF;\n+\tlt = NPC_LT_LF_TU_ETHER;\n+\tlflags = 0;\n+\n+\tinfo.def_mask = &rte_flow_item_vlan_mask;\n+\t/* No match support for vlan tags */\n+\tinfo.hw_mask = NULL;\n+\tinfo.len = sizeof(struct rte_flow_item_vlan);\n+\tinfo.spec = NULL;\n+\tinfo.mask = NULL;\n+\tinfo.hw_hdr_len = 0;\n+\n+\t/* Look ahead and find out any VLAN tags. These can be\n+\t * detected but no data matching is available.\n+\t */\n+\tlast_pattern = pst->pattern;\n+\tpattern = pst->pattern + 1;\n+\tpattern = otx2_flow_skip_void_and_any_items(pattern);\n+\twhile (pattern->type == RTE_FLOW_ITEM_TYPE_VLAN) {\n+\t\tnr_vlans++;\n+\t\trc = otx2_flow_parse_item_basic(pattern, &info, pst->error);\n+\t\tif (rc != 0)\n+\t\t\treturn rc;\n+\t\tlast_pattern = pattern;\n+\t\tpattern++;\n+\t\tpattern = otx2_flow_skip_void_and_any_items(pattern);\n+\t}\n+\totx2_npc_dbg(\"Nr_vlans = %d\", nr_vlans);\n+\tswitch (nr_vlans) {\n+\tcase 0:\n+\t\tbreak;\n+\tcase 1:\n+\t\tlflags = NPC_F_TU_ETHER_CTAG;\n+\t\tbreak;\n+\tcase 2:\n+\t\tlflags = NPC_F_TU_ETHER_STAG_CTAG;\n+\t\tbreak;\n+\tdefault:\n+\t\trte_flow_error_set(pst->error, ENOTSUP,\n+\t\t\t\t   RTE_FLOW_ERROR_TYPE_ITEM,\n+\t\t\t\t   last_pattern,\n+\t\t\t\t   \"more than 2 vlans with tunneled Ethernet \"\n+\t\t\t\t   \"not supported\");\n+\t\treturn -rte_errno;\n+\t}\n+\n+\tinfo.def_mask = &rte_flow_item_eth_mask;\n+\tinfo.hw_mask = &hw_mask;\n+\tinfo.len = sizeof(struct rte_flow_item_eth);\n+\tinfo.hw_hdr_len = 0;\n+\totx2_flow_get_hw_supp_mask(pst, &info, lid, lt);\n+\tinfo.spec = NULL;\n+\tinfo.mask = NULL;\n+\n+\trc = otx2_flow_parse_item_basic(pst->pattern, &info, pst->error);\n+\tif (rc != 0)\n+\t\treturn rc;\n+\n+\tpst->pattern = last_pattern;\n+\n+\treturn otx2_flow_update_parse_state(pst, &info, lid, lt, lflags);\n+}\n+\n+int\n+otx2_flow_parse_le(struct otx2_parse_state *pst)\n+{\n+\t/*\n+\t * We are positioned at UDP. Scan ahead and look for\n+\t * UDP encapsulated tunnel protocols. If available,\n+\t * parse them. In that case handle this:\n+\t *\t- RTE spec assumes we point to tunnel header.\n+\t *\t- NPC parser provides offset from UDP header.\n+\t */\n+\n+\t/*\n+\t * Note: Add support to GENEVE, VXLAN_GPE when we\n+\t * upgrade DPDK\n+\t *\n+\t * Note: Better to split flags into two nibbles:\n+\t *\t- Higher nibble can have flags\n+\t *\t- Lower nibble to further enumerate protocols\n+\t *\t  and have flags based extraction\n+\t */\n+\tconst struct rte_flow_item *pattern = pst->pattern;\n+\tstruct otx2_flow_item_info info;\n+\tint lid, lt, lflags;\n+\tchar hw_mask[64];\n+\tint rc;\n+\n+\tif (pst->tunnel)\n+\t\treturn 0;\n+\n+\tif (pst->pattern->type == RTE_FLOW_ITEM_TYPE_MPLS)\n+\t\treturn otx2_flow_parse_mpls(pst, NPC_LID_LE);\n+\n+\tinfo.spec = NULL;\n+\tinfo.mask = NULL;\n+\tinfo.hw_mask = NULL;\n+\tinfo.def_mask = NULL;\n+\tinfo.len = 0;\n+\tinfo.hw_hdr_len = 0;\n+\tlid = NPC_LID_LE;\n+\tlflags = 0;\n+\n+\t/* Ensure we are not matching anything in UDP */\n+\trc = otx2_flow_parse_item_basic(pattern, &info, pst->error);\n+\tif (rc)\n+\t\treturn rc;\n+\n+\tinfo.hw_mask = &hw_mask;\n+\tpattern = otx2_flow_skip_void_and_any_items(pattern);\n+\totx2_npc_dbg(\"Pattern->type = %d\", pattern->type);\n+\tswitch (pattern->type) {\n+\tcase RTE_FLOW_ITEM_TYPE_VXLAN:\n+\t\tlflags = NPC_F_UDP_VXLAN;\n+\t\tinfo.def_mask = &rte_flow_item_vxlan_mask;\n+\t\tinfo.len = sizeof(struct rte_flow_item_vxlan);\n+\t\tlt = NPC_LT_LE_VXLAN;\n+\t\tbreak;\n+\tcase RTE_FLOW_ITEM_TYPE_GTPC:\n+\t\tlflags = NPC_F_UDP_GTP_GTPC;\n+\t\tinfo.def_mask = &rte_flow_item_gtp_mask;\n+\t\tinfo.len = sizeof(struct rte_flow_item_gtp);\n+\t\tlt = NPC_LT_LE_GTPC;\n+\t\tbreak;\n+\tcase RTE_FLOW_ITEM_TYPE_GTPU:\n+\t\tlflags = NPC_F_UDP_GTP_GTPU_G_PDU;\n+\t\tinfo.def_mask = &rte_flow_item_gtp_mask;\n+\t\tinfo.len = sizeof(struct rte_flow_item_gtp);\n+\t\tlt = NPC_LT_LE_GTPU;\n+\t\tbreak;\n+\tdefault:\n+\t\treturn 0;\n+\t}\n+\n+\tpst->tunnel = 1;\n+\n+\totx2_flow_get_hw_supp_mask(pst, &info, lid, lt);\n+\trc = otx2_flow_parse_item_basic(pattern, &info, pst->error);\n+\tif (rc != 0)\n+\t\treturn rc;\n+\n+\treturn otx2_flow_update_parse_state(pst, &info, lid, lt, lflags);\n+}\n+\n+static int\n+flow_parse_mpls_label_stack(struct otx2_parse_state *pst, int *flag)\n+{\n+\tint nr_labels = 0;\n+\tconst struct rte_flow_item *pattern = pst->pattern;\n+\tstruct otx2_flow_item_info info;\n+\tint rc;\n+\tuint8_t flag_list[] = {0, NPC_F_MPLS_2_LABELS,\n+\t\tNPC_F_MPLS_3_LABELS, NPC_F_MPLS_4_LABELS};\n+\n+\t/*\n+\t * pst->pattern points to first MPLS label. We only check\n+\t * that subsequent labels do not have anything to match.\n+\t */\n+\tinfo.def_mask = &rte_flow_item_mpls_mask;\n+\tinfo.hw_mask = NULL;\n+\tinfo.len = sizeof(struct rte_flow_item_mpls);\n+\tinfo.spec = NULL;\n+\tinfo.mask = NULL;\n+\tinfo.hw_hdr_len = 0;\n+\n+\twhile (pattern->type == RTE_FLOW_ITEM_TYPE_MPLS) {\n+\t\tnr_labels++;\n+\n+\t\t/* Basic validation of 2nd/3rd/4th mpls item */\n+\t\tif (nr_labels > 1) {\n+\t\t\trc = otx2_flow_parse_item_basic(pattern, &info,\n+\t\t\t\t\t\t\tpst->error);\n+\t\t\tif (rc != 0)\n+\t\t\t\treturn rc;\n+\t\t}\n+\t\tpst->last_pattern = pattern;\n+\t\tpattern++;\n+\t\tpattern = otx2_flow_skip_void_and_any_items(pattern);\n+\t}\n+\n+\tif (nr_labels > 4) {\n+\t\trte_flow_error_set(pst->error, ENOTSUP,\n+\t\t\t\t   RTE_FLOW_ERROR_TYPE_ITEM,\n+\t\t\t\t   pst->last_pattern,\n+\t\t\t\t   \"more than 4 mpls labels not supported\");\n+\t\treturn -rte_errno;\n+\t}\n+\n+\t*flag = flag_list[nr_labels - 1];\n+\treturn 0;\n+}\n+\n+int\n+otx2_flow_parse_mpls(struct otx2_parse_state *pst, int lid)\n+{\n+\t/* Find number of MPLS labels */\n+\tstruct rte_flow_item_mpls hw_mask;\n+\tstruct otx2_flow_item_info info;\n+\tint lt, lflags;\n+\tint rc;\n+\n+\tlflags = 0;\n+\n+\tif (lid == NPC_LID_LC)\n+\t\tlt = NPC_LT_LC_MPLS;\n+\telse if (lid == NPC_LID_LD)\n+\t\tlt = NPC_LT_LD_TU_MPLS_IN_IP;\n+\telse\n+\t\tlt = NPC_LT_LE_TU_MPLS_IN_UDP;\n+\n+\t/* Prepare for parsing the first item */\n+\tinfo.def_mask = &rte_flow_item_mpls_mask;\n+\tinfo.hw_mask = &hw_mask;\n+\tinfo.len = sizeof(struct rte_flow_item_mpls);\n+\tinfo.spec = NULL;\n+\tinfo.mask = NULL;\n+\tinfo.hw_hdr_len = 0;\n+\n+\totx2_flow_get_hw_supp_mask(pst, &info, lid, lt);\n+\trc = otx2_flow_parse_item_basic(pst->pattern, &info, pst->error);\n+\tif (rc != 0)\n+\t\treturn rc;\n+\n+\t/*\n+\t * Parse for more labels.\n+\t * This sets lflags and pst->last_pattern correctly.\n+\t */\n+\trc = flow_parse_mpls_label_stack(pst, &lflags);\n+\tif (rc != 0)\n+\t\treturn rc;\n+\n+\tpst->tunnel = 1;\n+\tpst->pattern = pst->last_pattern;\n+\n+\treturn otx2_flow_update_parse_state(pst, &info, lid, lt, lflags);\n+}\n+\n+/*\n+ * ICMP, ICMP6, UDP, TCP, SCTP, VXLAN, GRE, NVGRE,\n+ * GTP, GTPC, GTPU, ESP\n+ *\n+ * Note: UDP tunnel protocols are identified by flags.\n+ *       LPTR for these protocol still points to UDP\n+ *       header. Need flag based extraction to support\n+ *       this.\n+ */\n+int\n+otx2_flow_parse_ld(struct otx2_parse_state *pst)\n+{\n+\tchar hw_mask[NPC_MAX_EXTRACT_DATA_LEN];\n+\tstruct otx2_flow_item_info info;\n+\tint lid, lt, lflags;\n+\tint rc;\n+\n+\tif (pst->tunnel) {\n+\t\t/* We have already parsed MPLS or IPv4/v6 followed\n+\t\t * by MPLS or IPv4/v6. Subsequent TCP/UDP etc\n+\t\t * would be parsed as tunneled versions. Skip\n+\t\t * this layer, except for tunneled MPLS. If LC is\n+\t\t * MPLS, we have anyway skipped all stacked MPLS\n+\t\t * labels.\n+\t\t */\n+\t\tif (pst->pattern->type == RTE_FLOW_ITEM_TYPE_MPLS)\n+\t\t\treturn otx2_flow_parse_mpls(pst, NPC_LID_LD);\n+\t\treturn 0;\n+\t}\n+\tinfo.hw_mask = &hw_mask;\n+\tinfo.spec = NULL;\n+\tinfo.mask = NULL;\n+\tinfo.def_mask = NULL;\n+\tinfo.len = 0;\n+\tinfo.hw_hdr_len = 0;\n+\n+\tlid = NPC_LID_LD;\n+\tlflags = 0;\n+\n+\totx2_npc_dbg(\"Pst->pattern->type = %d\", pst->pattern->type);\n+\tswitch (pst->pattern->type) {\n+\tcase RTE_FLOW_ITEM_TYPE_ICMP:\n+\t\tif (pst->lt[NPC_LID_LC] == NPC_LT_LC_IP6)\n+\t\t\tlt = NPC_LT_LD_ICMP6;\n+\t\telse\n+\t\t\tlt = NPC_LT_LD_ICMP;\n+\t\tinfo.def_mask = &rte_flow_item_icmp_mask;\n+\t\tinfo.len = sizeof(struct rte_flow_item_icmp);\n+\t\tbreak;\n+\tcase RTE_FLOW_ITEM_TYPE_UDP:\n+\t\tlt = NPC_LT_LD_UDP;\n+\t\tinfo.def_mask = &rte_flow_item_udp_mask;\n+\t\tinfo.len = sizeof(struct rte_flow_item_udp);\n+\t\tbreak;\n+\tcase RTE_FLOW_ITEM_TYPE_TCP:\n+\t\tlt = NPC_LT_LD_TCP;\n+\t\tinfo.def_mask = &rte_flow_item_tcp_mask;\n+\t\tinfo.len = sizeof(struct rte_flow_item_tcp);\n+\t\tbreak;\n+\tcase RTE_FLOW_ITEM_TYPE_SCTP:\n+\t\tlt = NPC_LT_LD_SCTP;\n+\t\tinfo.def_mask = &rte_flow_item_sctp_mask;\n+\t\tinfo.len = sizeof(struct rte_flow_item_sctp);\n+\t\tbreak;\n+\tcase RTE_FLOW_ITEM_TYPE_ESP:\n+\t\tlt = NPC_LT_LD_ESP;\n+\t\tinfo.def_mask = &rte_flow_item_esp_mask;\n+\t\tinfo.len = sizeof(struct rte_flow_item_esp);\n+\t\tbreak;\n+\tcase RTE_FLOW_ITEM_TYPE_GRE:\n+\t\tlt = NPC_LT_LD_GRE;\n+\t\tinfo.def_mask = &rte_flow_item_gre_mask;\n+\t\tinfo.len = sizeof(struct rte_flow_item_gre);\n+\t\tbreak;\n+\tcase RTE_FLOW_ITEM_TYPE_NVGRE:\n+\t\tlt = NPC_LT_LD_GRE;\n+\t\tlflags = NPC_F_GRE_NVGRE;\n+\t\tinfo.def_mask = &rte_flow_item_nvgre_mask;\n+\t\tinfo.len = sizeof(struct rte_flow_item_nvgre);\n+\t\t/* Further IP/Ethernet are parsed as tunneled */\n+\t\tpst->tunnel = 1;\n+\t\tbreak;\n+\tdefault:\n+\t\treturn 0;\n+\t}\n+\n+\totx2_flow_get_hw_supp_mask(pst, &info, lid, lt);\n+\trc = otx2_flow_parse_item_basic(pst->pattern, &info, pst->error);\n+\tif (rc != 0)\n+\t\treturn rc;\n+\n+\treturn otx2_flow_update_parse_state(pst, &info, lid, lt, lflags);\n+}\n",
    "prefixes": [
        "v2",
        "36/57"
    ]
}