get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 90656,
    "url": "http://patches.dpdk.org/api/patches/90656/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20210406114131.25874-44-ndabilpuram@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": "<20210406114131.25874-44-ndabilpuram@marvell.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20210406114131.25874-44-ndabilpuram@marvell.com",
    "date": "2021-04-06T11:41:22",
    "name": "[v4,43/52] common/cnxk: add npc parsing API",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "02d68f7622712c923cd1a667d0477b5c900e9e5b",
    "submitter": {
        "id": 1202,
        "url": "http://patches.dpdk.org/api/people/1202/?format=api",
        "name": "Nithin Dabilpuram",
        "email": "ndabilpuram@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/20210406114131.25874-44-ndabilpuram@marvell.com/mbox/",
    "series": [
        {
            "id": 16128,
            "url": "http://patches.dpdk.org/api/series/16128/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=16128",
            "date": "2021-04-06T11:40:39",
            "name": "Add Marvell CNXK common driver",
            "version": 4,
            "mbox": "http://patches.dpdk.org/series/16128/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/90656/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/90656/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 E5863A0546;\n\tTue,  6 Apr 2021 13:48:22 +0200 (CEST)",
            "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id CD3FE14102F;\n\tTue,  6 Apr 2021 13:43:54 +0200 (CEST)",
            "from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com\n [67.231.156.173])\n by mails.dpdk.org (Postfix) with ESMTP id BA1BD14109E\n for <dev@dpdk.org>; Tue,  6 Apr 2021 13:43:52 +0200 (CEST)",
            "from pps.filterd (m0045851.ppops.net [127.0.0.1])\n by mx0b-0016f401.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id\n 136BeNS4017483 for <dev@dpdk.org>; Tue, 6 Apr 2021 04:43:52 -0700",
            "from dc5-exch01.marvell.com ([199.233.59.181])\n by mx0b-0016f401.pphosted.com with ESMTP id 37redm9bpa-1\n (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT)\n for <dev@dpdk.org>; Tue, 06 Apr 2021 04:43:51 -0700",
            "from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH01.marvell.com\n (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.2;\n Tue, 6 Apr 2021 04:43:50 -0700",
            "from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com\n (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.2 via Frontend\n Transport; Tue, 6 Apr 2021 04:43:50 -0700",
            "from hyd1588t430.marvell.com (unknown [10.29.52.204])\n by maili.marvell.com (Postfix) with ESMTP id 5710E3F703F;\n Tue,  6 Apr 2021 04:43:47 -0700 (PDT)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com;\n h=from : to : cc :\n subject : date : message-id : in-reply-to : references : mime-version :\n content-type; s=pfpt0220; bh=dmmaZWVUSDayGwvoYN8LIFgWfwZjTID8C0CFFK4DbtY=;\n b=WJt71EnvA+gbuLlNiBa+OmcYtQuf7cKQn6pbDbstsBWc9OZPbSgmPvCUsEXAp1/4GZrd\n bLejWUkwzTQB3cFWdH5jF7P8fwjfBPqPioEU/JEPXxeha5yfXBMbcnjphS9Mm7K9yCPr\n mPv2VvebrCUrJ/iGWKrIlKKEiS4ZT66zEvsOtb31/tgW0QVAeA1SejZVBd9QNzQa7zoS\n QuYYcrpfpKKhVasGA5PRQV8gJNCU1c7e8dq66hr6XCki7T2flffBV+s3f7p9DDWi3ORL\n voRPZI9XNaN6BDCxC23ZqplAOzVkhT5RoBVDzmhgeXrTI48l6NuWIiqnG/AiWU/ezIlA EQ==",
        "From": "Nithin Dabilpuram <ndabilpuram@marvell.com>",
        "To": "<dev@dpdk.org>",
        "CC": "<jerinj@marvell.com>, <skori@marvell.com>, <skoteshwar@marvell.com>,\n <pbhagavatula@marvell.com>, <kirankumark@marvell.com>,\n <psatheesh@marvell.com>, <asekhar@marvell.com>",
        "Date": "Tue, 6 Apr 2021 17:11:22 +0530",
        "Message-ID": "<20210406114131.25874-44-ndabilpuram@marvell.com>",
        "X-Mailer": "git-send-email 2.8.4",
        "In-Reply-To": "<20210406114131.25874-1-ndabilpuram@marvell.com>",
        "References": "<20210305133918.8005-1-ndabilpuram@marvell.com>\n <20210406114131.25874-1-ndabilpuram@marvell.com>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain",
        "X-Proofpoint-GUID": "vdfe_AQrQOfYknCw5F13aHaryM7lG93B",
        "X-Proofpoint-ORIG-GUID": "vdfe_AQrQOfYknCw5F13aHaryM7lG93B",
        "X-Proofpoint-Virus-Version": "vendor=fsecure engine=2.50.10434:6.0.369, 18.0.761\n definitions=2021-04-06_02:2021-04-01,\n 2021-04-06 signatures=0",
        "Subject": "[dpdk-dev] [PATCH v4 43/52] common/cnxk: add npc parsing API",
        "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",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "From: Kiran Kumar K <kirankumark@marvell.com>\n\nAdding npc parsing API support to parse different patterns and actions.\nBased on the pattern and actions ltype values will be chosen and\nmcam data will be configured at perticular offsets.\n\nSigned-off-by: Kiran Kumar K <kirankumark@marvell.com>\n---\n drivers/common/cnxk/meson.build     |   1 +\n drivers/common/cnxk/roc_npc_parse.c | 703 ++++++++++++++++++++++++++++++++++++\n drivers/common/cnxk/roc_npc_priv.h  |  13 +\n 3 files changed, 717 insertions(+)\n create mode 100644 drivers/common/cnxk/roc_npc_parse.c",
    "diff": "diff --git a/drivers/common/cnxk/meson.build b/drivers/common/cnxk/meson.build\nindex 7c83050..9dd4c23 100644\n--- a/drivers/common/cnxk/meson.build\n+++ b/drivers/common/cnxk/meson.build\n@@ -35,6 +35,7 @@ sources = files('roc_dev.c',\n \t\t'roc_npa_debug.c',\n \t\t'roc_npa_irq.c',\n \t\t'roc_npc_mcam.c',\n+\t\t'roc_npc_parse.c',\n \t\t'roc_npc_utils.c',\n \t\t'roc_platform.c',\n \t\t'roc_utils.c')\ndiff --git a/drivers/common/cnxk/roc_npc_parse.c b/drivers/common/cnxk/roc_npc_parse.c\nnew file mode 100644\nindex 0000000..d07f91d\n--- /dev/null\n+++ b/drivers/common/cnxk/roc_npc_parse.c\n@@ -0,0 +1,703 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright(C) 2021 Marvell.\n+ */\n+#include \"roc_api.h\"\n+#include \"roc_priv.h\"\n+\n+const struct roc_npc_item_info *\n+npc_parse_skip_void_and_any_items(const struct roc_npc_item_info *pattern)\n+{\n+\twhile ((pattern->type == ROC_NPC_ITEM_TYPE_VOID) ||\n+\t       (pattern->type == ROC_NPC_ITEM_TYPE_ANY))\n+\t\tpattern++;\n+\n+\treturn pattern;\n+}\n+\n+int\n+npc_parse_meta_items(struct npc_parse_state *pst)\n+{\n+\tPLT_SET_USED(pst);\n+\treturn 0;\n+}\n+\n+int\n+npc_parse_cpt_hdr(struct npc_parse_state *pst)\n+{\n+\tuint8_t hw_mask[NPC_MAX_EXTRACT_HW_LEN];\n+\tstruct npc_parse_item_info info;\n+\tint lid, lt;\n+\tint rc;\n+\n+\t/* Identify the pattern type into lid, lt */\n+\tif (pst->pattern->type != ROC_NPC_ITEM_TYPE_CPT_HDR)\n+\t\treturn 0;\n+\n+\tlid = NPC_LID_LA;\n+\tlt = NPC_LT_LA_CPT_HDR;\n+\tinfo.hw_hdr_len = 0;\n+\n+\t/* Prepare for parsing the item */\n+\tinfo.hw_mask = &hw_mask;\n+\tinfo.len = pst->pattern->size;\n+\tnpc_get_hw_supp_mask(pst, &info, lid, lt);\n+\tinfo.spec = NULL;\n+\tinfo.mask = NULL;\n+\n+\t/* Basic validation of item parameters */\n+\trc = npc_parse_item_basic(pst->pattern, &info);\n+\tif (rc)\n+\t\treturn rc;\n+\n+\t/* Update pst if not validate only? clash check? */\n+\treturn npc_update_parse_state(pst, &info, lid, lt, 0);\n+}\n+\n+int\n+npc_parse_higig2_hdr(struct npc_parse_state *pst)\n+{\n+\tuint8_t hw_mask[NPC_MAX_EXTRACT_HW_LEN];\n+\tstruct npc_parse_item_info info;\n+\tint lid, lt;\n+\tint rc;\n+\n+\t/* Identify the pattern type into lid, lt */\n+\tif (pst->pattern->type != ROC_NPC_ITEM_TYPE_HIGIG2)\n+\t\treturn 0;\n+\n+\tlid = NPC_LID_LA;\n+\tlt = NPC_LT_LA_HIGIG2_ETHER;\n+\tinfo.hw_hdr_len = 0;\n+\n+\tif (pst->flow->nix_intf == NIX_INTF_TX) {\n+\t\tlt = NPC_LT_LA_IH_NIX_HIGIG2_ETHER;\n+\t\tinfo.hw_hdr_len = NPC_IH_LENGTH;\n+\t}\n+\n+\t/* Prepare for parsing the item */\n+\tinfo.hw_mask = &hw_mask;\n+\tinfo.len = pst->pattern->size;\n+\tnpc_get_hw_supp_mask(pst, &info, lid, lt);\n+\tinfo.spec = NULL;\n+\tinfo.mask = NULL;\n+\n+\t/* Basic validation of item parameters */\n+\trc = npc_parse_item_basic(pst->pattern, &info);\n+\tif (rc)\n+\t\treturn rc;\n+\n+\t/* Update pst if not validate only? clash check? */\n+\treturn npc_update_parse_state(pst, &info, lid, lt, 0);\n+}\n+\n+int\n+npc_parse_la(struct npc_parse_state *pst)\n+{\n+\tuint8_t hw_mask[NPC_MAX_EXTRACT_HW_LEN];\n+\tstruct npc_parse_item_info info;\n+\tint lid, lt;\n+\tint rc;\n+\n+\t/* Identify the pattern type into lid, lt */\n+\tif (pst->pattern->type != ROC_NPC_ITEM_TYPE_ETH)\n+\t\treturn 0;\n+\n+\tlid = NPC_LID_LA;\n+\tlt = NPC_LT_LA_ETHER;\n+\tinfo.hw_hdr_len = 0;\n+\n+\tif (pst->flow->nix_intf == NIX_INTF_TX) {\n+\t\tlt = NPC_LT_LA_IH_NIX_ETHER;\n+\t\tinfo.hw_hdr_len = NPC_IH_LENGTH;\n+\t\tif (pst->npc->switch_header_type == ROC_PRIV_FLAGS_HIGIG) {\n+\t\t\tlt = NPC_LT_LA_IH_NIX_HIGIG2_ETHER;\n+\t\t\tinfo.hw_hdr_len += NPC_HIGIG2_LENGTH;\n+\t\t}\n+\t} else {\n+\t\tif (pst->npc->switch_header_type == ROC_PRIV_FLAGS_HIGIG) {\n+\t\t\tlt = NPC_LT_LA_HIGIG2_ETHER;\n+\t\t\tinfo.hw_hdr_len = NPC_HIGIG2_LENGTH;\n+\t\t}\n+\t}\n+\n+\t/* Prepare for parsing the item */\n+\tinfo.hw_mask = &hw_mask;\n+\tinfo.len = pst->pattern->size;\n+\tnpc_get_hw_supp_mask(pst, &info, lid, lt);\n+\tinfo.spec = NULL;\n+\tinfo.mask = NULL;\n+\n+\t/* Basic validation of item parameters */\n+\trc = npc_parse_item_basic(pst->pattern, &info);\n+\tif (rc)\n+\t\treturn rc;\n+\n+\t/* Update pst if not validate only? clash check? */\n+\treturn npc_update_parse_state(pst, &info, lid, lt, 0);\n+}\n+\n+int\n+npc_parse_lb(struct npc_parse_state *pst)\n+{\n+\tconst struct roc_npc_item_info *pattern = pst->pattern;\n+\tconst struct roc_npc_item_info *last_pattern;\n+\tchar hw_mask[NPC_MAX_EXTRACT_HW_LEN];\n+\tstruct npc_parse_item_info info;\n+\tint lid, lt, lflags;\n+\tint nr_vlans = 0;\n+\tint rc;\n+\n+\tinfo.spec = NULL;\n+\tinfo.mask = NULL;\n+\tinfo.def_mask = NULL;\n+\tinfo.hw_hdr_len = NPC_TPID_LENGTH;\n+\n+\tlid = NPC_LID_LB;\n+\tlflags = 0;\n+\tlast_pattern = pattern;\n+\n+\tif (pst->pattern->type == ROC_NPC_ITEM_TYPE_VLAN) {\n+\t\t/* RTE vlan is either 802.1q or 802.1ad,\n+\t\t * this maps to either CTAG/STAG. We need to decide\n+\t\t * based on number of VLANS present. Matching is\n+\t\t * supported on first tag only.\n+\t\t */\n+\t\tinfo.hw_mask = NULL;\n+\t\tinfo.len = pst->pattern->size;\n+\n+\t\tpattern = pst->pattern;\n+\t\twhile (pattern->type == ROC_NPC_ITEM_TYPE_VLAN) {\n+\t\t\tnr_vlans++;\n+\n+\t\t\t/* Basic validation of Second/Third vlan item */\n+\t\t\tif (nr_vlans > 1) {\n+\t\t\t\trc = npc_parse_item_basic(pattern, &info);\n+\t\t\t\tif (rc != 0)\n+\t\t\t\t\treturn rc;\n+\t\t\t}\n+\t\t\tlast_pattern = pattern;\n+\t\t\tpattern++;\n+\t\t\tpattern = npc_parse_skip_void_and_any_items(pattern);\n+\t\t}\n+\n+\t\tswitch (nr_vlans) {\n+\t\tcase 1:\n+\t\t\tlt = NPC_LT_LB_CTAG;\n+\t\t\tbreak;\n+\t\tcase 2:\n+\t\t\tlt = NPC_LT_LB_STAG_QINQ;\n+\t\t\tlflags = NPC_F_STAG_CTAG;\n+\t\t\tbreak;\n+\t\tcase 3:\n+\t\t\tlt = NPC_LT_LB_STAG_QINQ;\n+\t\t\tlflags = NPC_F_STAG_STAG_CTAG;\n+\t\t\tbreak;\n+\t\tdefault:\n+\t\t\treturn NPC_ERR_PATTERN_NOTSUP;\n+\t\t}\n+\t} else if (pst->pattern->type == ROC_NPC_ITEM_TYPE_E_TAG) {\n+\t\t/* we can support ETAG and match a subsequent CTAG\n+\t\t * without any matching support.\n+\t\t */\n+\t\tlt = NPC_LT_LB_ETAG;\n+\t\tlflags = 0;\n+\n+\t\tlast_pattern = pst->pattern;\n+\t\tpattern = npc_parse_skip_void_and_any_items(pst->pattern + 1);\n+\t\tif (pattern->type == ROC_NPC_ITEM_TYPE_VLAN) {\n+\t\t\t/* set supported mask to NULL for vlan tag */\n+\t\t\tinfo.hw_mask = NULL;\n+\t\t\tinfo.len = pattern->size;\n+\t\t\trc = npc_parse_item_basic(pattern, &info);\n+\t\t\tif (rc != 0)\n+\t\t\t\treturn rc;\n+\n+\t\t\tlflags = NPC_F_ETAG_CTAG;\n+\t\t\tlast_pattern = pattern;\n+\t\t}\n+\t\tinfo.len = pattern->size;\n+\t} else if (pst->pattern->type == ROC_NPC_ITEM_TYPE_QINQ) {\n+\t\tinfo.hw_mask = NULL;\n+\t\tinfo.len = pst->pattern->size;\n+\t\tlt = NPC_LT_LB_STAG_QINQ;\n+\t\tlflags = NPC_F_STAG_CTAG;\n+\t} else {\n+\t\treturn 0;\n+\t}\n+\n+\tinfo.hw_mask = &hw_mask;\n+\tinfo.spec = NULL;\n+\tinfo.mask = NULL;\n+\tnpc_get_hw_supp_mask(pst, &info, lid, lt);\n+\n+\trc = npc_parse_item_basic(pst->pattern, &info);\n+\tif (rc != 0)\n+\t\treturn rc;\n+\n+\t/* Point pattern to last item consumed */\n+\tpst->pattern = last_pattern;\n+\treturn npc_update_parse_state(pst, &info, lid, lt, lflags);\n+}\n+\n+static int\n+npc_parse_mpls_label_stack(struct npc_parse_state *pst, int *flag)\n+{\n+\tuint8_t flag_list[] = {0, NPC_F_MPLS_2_LABELS, NPC_F_MPLS_3_LABELS,\n+\t\t\t       NPC_F_MPLS_4_LABELS};\n+\tconst struct roc_npc_item_info *pattern = pst->pattern;\n+\tstruct npc_parse_item_info info;\n+\tint nr_labels = 0;\n+\tint rc;\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.hw_mask = NULL;\n+\tinfo.len = pattern->size;\n+\tinfo.spec = NULL;\n+\tinfo.mask = NULL;\n+\tinfo.hw_hdr_len = 0;\n+\tinfo.def_mask = NULL;\n+\n+\twhile (pattern->type == ROC_NPC_ITEM_TYPE_MPLS) {\n+\t\tnr_labels++;\n+\n+\t\t/* Basic validation of Second/Third/Fourth mpls item */\n+\t\tif (nr_labels > 1) {\n+\t\t\trc = npc_parse_item_basic(pattern, &info);\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 = npc_parse_skip_void_and_any_items(pattern);\n+\t}\n+\n+\tif (nr_labels < 1 || nr_labels > 4)\n+\t\treturn NPC_ERR_PATTERN_NOTSUP;\n+\n+\t*flag = flag_list[nr_labels - 1];\n+\treturn 0;\n+}\n+\n+static int\n+npc_parse_mpls(struct npc_parse_state *pst, int lid)\n+{\n+\t/* Find number of MPLS labels */\n+\tuint8_t hw_mask[NPC_MAX_EXTRACT_HW_LEN];\n+\tstruct npc_parse_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.hw_mask = &hw_mask;\n+\tinfo.len = pst->pattern->size;\n+\tinfo.spec = NULL;\n+\tinfo.mask = NULL;\n+\tinfo.hw_hdr_len = 0;\n+\n+\tnpc_get_hw_supp_mask(pst, &info, lid, lt);\n+\trc = npc_parse_item_basic(pst->pattern, &info);\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 = npc_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 npc_update_parse_state(pst, &info, lid, lt, lflags);\n+}\n+\n+static inline void\n+npc_check_lc_ip_tunnel(struct npc_parse_state *pst)\n+{\n+\tconst struct roc_npc_item_info *pattern = pst->pattern + 1;\n+\n+\tpattern = npc_parse_skip_void_and_any_items(pattern);\n+\tif (pattern->type == ROC_NPC_ITEM_TYPE_MPLS ||\n+\t    pattern->type == ROC_NPC_ITEM_TYPE_IPV4 ||\n+\t    pattern->type == ROC_NPC_ITEM_TYPE_IPV6)\n+\t\tpst->tunnel = 1;\n+}\n+\n+int\n+npc_parse_lc(struct npc_parse_state *pst)\n+{\n+\tuint8_t hw_mask[NPC_MAX_EXTRACT_HW_LEN];\n+\tstruct npc_parse_item_info info;\n+\tint lid, lt;\n+\tint rc;\n+\n+\tif (pst->pattern->type == ROC_NPC_ITEM_TYPE_MPLS)\n+\t\treturn npc_parse_mpls(pst, NPC_LID_LC);\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_LC;\n+\n+\tswitch (pst->pattern->type) {\n+\tcase ROC_NPC_ITEM_TYPE_IPV4:\n+\t\tlt = NPC_LT_LC_IP;\n+\t\tinfo.len = pst->pattern->size;\n+\t\tbreak;\n+\tcase ROC_NPC_ITEM_TYPE_IPV6:\n+\t\tlid = NPC_LID_LC;\n+\t\tlt = NPC_LT_LC_IP6;\n+\t\tinfo.len = pst->pattern->size;\n+\t\tbreak;\n+\tcase ROC_NPC_ITEM_TYPE_ARP_ETH_IPV4:\n+\t\tlt = NPC_LT_LC_ARP;\n+\t\tinfo.len = pst->pattern->size;\n+\t\tbreak;\n+\tcase ROC_NPC_ITEM_TYPE_IPV6_EXT:\n+\t\tlid = NPC_LID_LC;\n+\t\tlt = NPC_LT_LC_IP6_EXT;\n+\t\tinfo.len = pst->pattern->size;\n+\t\tinfo.hw_hdr_len = 40;\n+\t\tbreak;\n+\tcase ROC_NPC_ITEM_TYPE_L3_CUSTOM:\n+\t\tlt = NPC_LT_LC_CUSTOM0;\n+\t\tinfo.len = pst->pattern->size;\n+\t\tbreak;\n+\tdefault:\n+\t\t/* No match at this layer */\n+\t\treturn 0;\n+\t}\n+\n+\t/* Identify if IP tunnels MPLS or IPv4/v6 */\n+\tnpc_check_lc_ip_tunnel(pst);\n+\n+\tnpc_get_hw_supp_mask(pst, &info, lid, lt);\n+\trc = npc_parse_item_basic(pst->pattern, &info);\n+\tif (rc != 0)\n+\t\treturn rc;\n+\n+\treturn npc_update_parse_state(pst, &info, lid, lt, 0);\n+}\n+\n+int\n+npc_parse_ld(struct npc_parse_state *pst)\n+{\n+\tchar hw_mask[NPC_MAX_EXTRACT_HW_LEN];\n+\tstruct npc_parse_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 == ROC_NPC_ITEM_TYPE_MPLS)\n+\t\t\treturn npc_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+\tswitch (pst->pattern->type) {\n+\tcase ROC_NPC_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.len = pst->pattern->size;\n+\t\tbreak;\n+\tcase ROC_NPC_ITEM_TYPE_UDP:\n+\t\tlt = NPC_LT_LD_UDP;\n+\t\tinfo.len = pst->pattern->size;\n+\t\tbreak;\n+\tcase ROC_NPC_ITEM_TYPE_IGMP:\n+\t\tlt = NPC_LT_LD_IGMP;\n+\t\tinfo.len = pst->pattern->size;\n+\t\tbreak;\n+\tcase ROC_NPC_ITEM_TYPE_TCP:\n+\t\tlt = NPC_LT_LD_TCP;\n+\t\tinfo.len = pst->pattern->size;\n+\t\tbreak;\n+\tcase ROC_NPC_ITEM_TYPE_SCTP:\n+\t\tlt = NPC_LT_LD_SCTP;\n+\t\tinfo.len = pst->pattern->size;\n+\t\tbreak;\n+\tcase ROC_NPC_ITEM_TYPE_GRE:\n+\t\tlt = NPC_LT_LD_GRE;\n+\t\tinfo.len = pst->pattern->size;\n+\t\tbreak;\n+\tcase ROC_NPC_ITEM_TYPE_GRE_KEY:\n+\t\tlt = NPC_LT_LD_GRE;\n+\t\tinfo.len = pst->pattern->size;\n+\t\tinfo.hw_hdr_len = 4;\n+\t\tbreak;\n+\tcase ROC_NPC_ITEM_TYPE_NVGRE:\n+\t\tlt = NPC_LT_LD_NVGRE;\n+\t\tlflags = NPC_F_GRE_NVGRE;\n+\t\tinfo.len = pst->pattern->size;\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+\tnpc_get_hw_supp_mask(pst, &info, lid, lt);\n+\trc = npc_parse_item_basic(pst->pattern, &info);\n+\tif (rc != 0)\n+\t\treturn rc;\n+\n+\treturn npc_update_parse_state(pst, &info, lid, lt, lflags);\n+}\n+\n+int\n+npc_parse_le(struct npc_parse_state *pst)\n+{\n+\tconst struct roc_npc_item_info *pattern = pst->pattern;\n+\tchar hw_mask[NPC_MAX_EXTRACT_HW_LEN];\n+\tstruct npc_parse_item_info info;\n+\tint lid, lt, lflags;\n+\tint rc;\n+\n+\tif (pst->tunnel)\n+\t\treturn 0;\n+\n+\tif (pst->pattern->type == ROC_NPC_ITEM_TYPE_MPLS)\n+\t\treturn npc_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 = npc_parse_item_basic(pattern, &info);\n+\tif (rc)\n+\t\treturn rc;\n+\n+\tinfo.hw_mask = &hw_mask;\n+\tpattern = npc_parse_skip_void_and_any_items(pattern);\n+\tswitch (pattern->type) {\n+\tcase ROC_NPC_ITEM_TYPE_VXLAN:\n+\t\tlflags = NPC_F_UDP_VXLAN;\n+\t\tinfo.len = pattern->size;\n+\t\tlt = NPC_LT_LE_VXLAN;\n+\t\tbreak;\n+\tcase ROC_NPC_ITEM_TYPE_GTPC:\n+\t\tlflags = NPC_F_UDP_GTP_GTPC;\n+\t\tinfo.len = pattern->size;\n+\t\tlt = NPC_LT_LE_GTPC;\n+\t\tbreak;\n+\tcase ROC_NPC_ITEM_TYPE_GTPU:\n+\t\tlflags = NPC_F_UDP_GTP_GTPU_G_PDU;\n+\t\tinfo.len = pattern->size;\n+\t\tlt = NPC_LT_LE_GTPU;\n+\t\tbreak;\n+\tcase ROC_NPC_ITEM_TYPE_GENEVE:\n+\t\tlflags = NPC_F_UDP_GENEVE;\n+\t\tinfo.len = pattern->size;\n+\t\tlt = NPC_LT_LE_GENEVE;\n+\t\tbreak;\n+\tcase ROC_NPC_ITEM_TYPE_VXLAN_GPE:\n+\t\tlflags = NPC_F_UDP_VXLANGPE;\n+\t\tinfo.len = pattern->size;\n+\t\tlt = NPC_LT_LE_VXLANGPE;\n+\t\tbreak;\n+\tcase ROC_NPC_ITEM_TYPE_ESP:\n+\t\tlt = NPC_LT_LE_ESP;\n+\t\tinfo.len = pst->pattern->size;\n+\t\tbreak;\n+\tdefault:\n+\t\treturn 0;\n+\t}\n+\n+\tpst->tunnel = 1;\n+\n+\tnpc_get_hw_supp_mask(pst, &info, lid, lt);\n+\trc = npc_parse_item_basic(pattern, &info);\n+\tif (rc != 0)\n+\t\treturn rc;\n+\n+\treturn npc_update_parse_state(pst, &info, lid, lt, lflags);\n+}\n+\n+int\n+npc_parse_lf(struct npc_parse_state *pst)\n+{\n+\tconst struct roc_npc_item_info *pattern, *last_pattern;\n+\tchar hw_mask[NPC_MAX_EXTRACT_HW_LEN];\n+\tstruct npc_parse_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 != ROC_NPC_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+\t/* No match support for vlan tags */\n+\tinfo.hw_mask = NULL;\n+\tinfo.len = pst->pattern->size;\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 = npc_parse_skip_void_and_any_items(pattern);\n+\twhile (pattern->type == ROC_NPC_ITEM_TYPE_VLAN) {\n+\t\tnr_vlans++;\n+\t\tlast_pattern = pattern;\n+\t\tpattern++;\n+\t\tpattern = npc_parse_skip_void_and_any_items(pattern);\n+\t}\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\treturn NPC_ERR_PATTERN_NOTSUP;\n+\t}\n+\n+\tinfo.hw_mask = &hw_mask;\n+\tinfo.len = pst->pattern->size;\n+\tinfo.hw_hdr_len = 0;\n+\tnpc_get_hw_supp_mask(pst, &info, lid, lt);\n+\tinfo.spec = NULL;\n+\tinfo.mask = NULL;\n+\n+\trc = npc_parse_item_basic(pst->pattern, &info);\n+\tif (rc != 0)\n+\t\treturn rc;\n+\n+\tpst->pattern = last_pattern;\n+\n+\treturn npc_update_parse_state(pst, &info, lid, lt, lflags);\n+}\n+\n+int\n+npc_parse_lg(struct npc_parse_state *pst)\n+{\n+\tchar hw_mask[NPC_MAX_EXTRACT_HW_LEN];\n+\tstruct npc_parse_item_info info;\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 == ROC_NPC_ITEM_TYPE_IPV4) {\n+\t\tlt = NPC_LT_LG_TU_IP;\n+\t\tinfo.len = pst->pattern->size;\n+\t} else if (pst->pattern->type == ROC_NPC_ITEM_TYPE_IPV6) {\n+\t\tlt = NPC_LT_LG_TU_IP6;\n+\t\tinfo.len = pst->pattern->size;\n+\t} else {\n+\t\t/* There is no tunneled IP header */\n+\t\treturn 0;\n+\t}\n+\n+\tnpc_get_hw_supp_mask(pst, &info, lid, lt);\n+\trc = npc_parse_item_basic(pst->pattern, &info);\n+\tif (rc != 0)\n+\t\treturn rc;\n+\n+\treturn npc_update_parse_state(pst, &info, lid, lt, 0);\n+}\n+\n+int\n+npc_parse_lh(struct npc_parse_state *pst)\n+{\n+\tchar hw_mask[NPC_MAX_EXTRACT_HW_LEN];\n+\tstruct npc_parse_item_info info;\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 ROC_NPC_ITEM_TYPE_UDP:\n+\t\tlt = NPC_LT_LH_TU_UDP;\n+\t\tinfo.len = pst->pattern->size;\n+\t\tbreak;\n+\tcase ROC_NPC_ITEM_TYPE_TCP:\n+\t\tlt = NPC_LT_LH_TU_TCP;\n+\t\tinfo.len = pst->pattern->size;\n+\t\tbreak;\n+\tcase ROC_NPC_ITEM_TYPE_SCTP:\n+\t\tlt = NPC_LT_LH_TU_SCTP;\n+\t\tinfo.len = pst->pattern->size;\n+\t\tbreak;\n+\tcase ROC_NPC_ITEM_TYPE_ESP:\n+\t\tlt = NPC_LT_LH_TU_ESP;\n+\t\tinfo.len = pst->pattern->size;\n+\t\tbreak;\n+\tdefault:\n+\t\treturn 0;\n+\t}\n+\n+\tnpc_get_hw_supp_mask(pst, &info, lid, lt);\n+\trc = npc_parse_item_basic(pst->pattern, &info);\n+\tif (rc != 0)\n+\t\treturn rc;\n+\n+\treturn npc_update_parse_state(pst, &info, lid, lt, 0);\n+}\ndiff --git a/drivers/common/cnxk/roc_npc_priv.h b/drivers/common/cnxk/roc_npc_priv.h\nindex 13768f9..dcf26c0 100644\n--- a/drivers/common/cnxk/roc_npc_priv.h\n+++ b/drivers/common/cnxk/roc_npc_priv.h\n@@ -402,11 +402,24 @@ void npc_get_hw_supp_mask(struct npc_parse_state *pst,\n \t\t\t  struct npc_parse_item_info *info, int lid, int lt);\n int npc_parse_item_basic(const struct roc_npc_item_info *item,\n \t\t\t struct npc_parse_item_info *info);\n+int npc_parse_meta_items(struct npc_parse_state *pst);\n+int npc_parse_higig2_hdr(struct npc_parse_state *pst);\n+int npc_parse_cpt_hdr(struct npc_parse_state *pst);\n+int npc_parse_la(struct npc_parse_state *pst);\n+int npc_parse_lb(struct npc_parse_state *pst);\n+int npc_parse_lc(struct npc_parse_state *pst);\n+int npc_parse_ld(struct npc_parse_state *pst);\n+int npc_parse_le(struct npc_parse_state *pst);\n+int npc_parse_lf(struct npc_parse_state *pst);\n+int npc_parse_lg(struct npc_parse_state *pst);\n+int npc_parse_lh(struct npc_parse_state *pst);\n int npc_mcam_fetch_kex_cfg(struct npc *npc);\n int npc_check_preallocated_entry_cache(struct mbox *mbox,\n \t\t\t\t       struct roc_npc_flow *flow,\n \t\t\t\t       struct npc *npc);\n int npc_flow_free_all_resources(struct npc *npc);\n+const struct roc_npc_item_info *\n+npc_parse_skip_void_and_any_items(const struct roc_npc_item_info *pattern);\n int npc_program_mcam(struct npc *npc, struct npc_parse_state *pst,\n \t\t     bool mcam_alloc);\n uint64_t npc_get_kex_capability(struct npc *npc);\n",
    "prefixes": [
        "v4",
        "43/52"
    ]
}