get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 94704,
    "url": "https://patches.dpdk.org/api/patches/94704/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/20210623044702.4240-9-ndabilpuram@marvell.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": "<20210623044702.4240-9-ndabilpuram@marvell.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20210623044702.4240-9-ndabilpuram@marvell.com",
    "date": "2021-06-23T04:46:08",
    "name": "[v4,08/62] common/cnxk: support for VLAN push and pop flow actions",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "a38af7026141469d95f0c2d73b4217b8f9a6174e",
    "submitter": {
        "id": 1202,
        "url": "https://patches.dpdk.org/api/people/1202/?format=api",
        "name": "Nithin Dabilpuram",
        "email": "ndabilpuram@marvell.com"
    },
    "delegate": {
        "id": 310,
        "url": "https://patches.dpdk.org/api/users/310/?format=api",
        "username": "jerin",
        "first_name": "Jerin",
        "last_name": "Jacob",
        "email": "jerinj@marvell.com"
    },
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/20210623044702.4240-9-ndabilpuram@marvell.com/mbox/",
    "series": [
        {
            "id": 17449,
            "url": "https://patches.dpdk.org/api/series/17449/?format=api",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=17449",
            "date": "2021-06-23T04:46:00",
            "name": "Marvell CNXK Ethdev Driver",
            "version": 4,
            "mbox": "https://patches.dpdk.org/series/17449/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/94704/comments/",
    "check": "success",
    "checks": "https://patches.dpdk.org/api/patches/94704/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 9664BA0C41;\n\tWed, 23 Jun 2021 06:48:17 +0200 (CEST)",
            "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id D5982410F1;\n\tWed, 23 Jun 2021 06:47:46 +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 A64B841121\n for <dev@dpdk.org>; Wed, 23 Jun 2021 06:47:45 +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 15N4krfM026329 for <dev@dpdk.org>; Tue, 22 Jun 2021 21:47:45 -0700",
            "from dc5-exch02.marvell.com ([199.233.59.182])\n by mx0b-0016f401.pphosted.com with ESMTP id 39bptj1ghw-1\n (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT)\n for <dev@dpdk.org>; Tue, 22 Jun 2021 21:47:44 -0700",
            "from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH02.marvell.com\n (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.18;\n Tue, 22 Jun 2021 21:47:42 -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.18 via Frontend\n Transport; Tue, 22 Jun 2021 21:47:42 -0700",
            "from hyd1588t430.marvell.com (unknown [10.29.52.204])\n by maili.marvell.com (Postfix) with ESMTP id 2FC335B6936;\n Tue, 22 Jun 2021 21:47:39 -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=lfufWSRBgrvPE8FPvIS5pJZDBpZs+k/oPgE6qx7bSXk=;\n b=WZARYiLL46dP7f5c0hNyrsrOnRtkEq3yLVtN1npjjcHbIVdacdvhbhODQtJgKHcoXsZZ\n 1Yly3/91mYFQ89SkFZK8ISIGe1PRCH3Min9nSrPZ6ocKxEdQJe2GuG3jeDwvSm1q8GaM\n dyL2DQ7tNjkBZwd9IfwnO7yLmmxdVLoEoyg+4yRQD8Dvc3qfbWa2yAFLQWpjk3rISCjN\n YoejUppq4aUkiudzjtdWoppuwyXQpS5M0jpCrFxgMgfys+cXrbb0Zssd77ItLKHS9kDP\n rqqjr/i5/pF3/lWrEGJBpKn63NH+CNlZgb6kc/tSczsk2mVSHY7CVRt4cXbQh14m159y Rg==",
        "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>, <hkalra@marvell.com>",
        "Date": "Wed, 23 Jun 2021 10:16:08 +0530",
        "Message-ID": "<20210623044702.4240-9-ndabilpuram@marvell.com>",
        "X-Mailer": "git-send-email 2.8.4",
        "In-Reply-To": "<20210623044702.4240-1-ndabilpuram@marvell.com>",
        "References": "<20210306153404.10781-1-ndabilpuram@marvell.com>\n <20210623044702.4240-1-ndabilpuram@marvell.com>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain",
        "X-Proofpoint-ORIG-GUID": "GuMw_uwDs7uPS4jYzkoatcYEBzmhNSDR",
        "X-Proofpoint-GUID": "GuMw_uwDs7uPS4jYzkoatcYEBzmhNSDR",
        "X-Proofpoint-Virus-Version": "vendor=fsecure engine=2.50.10434:6.0.391, 18.0.790\n definitions=2021-06-23_01:2021-06-22,\n 2021-06-23 signatures=0",
        "Subject": "[dpdk-dev] [PATCH v4 08/62] common/cnxk: support for VLAN push and\n pop flow actions",
        "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: Satheesh Paul <psatheesh@marvell.com>\n\nAdd roc API to configure VLAN tag addition and removal.\n\nThis patch also adds 98xx support for increased MCAM\nentries for rte flow.\n\nSigned-off-by: Satheesh Paul <psatheesh@marvell.com>\n---\n drivers/common/cnxk/roc_model.h    |   6 +\n drivers/common/cnxk/roc_npc.c      | 257 ++++++++++++++++++++++++++++++++++---\n drivers/common/cnxk/roc_npc.h      |  24 ++++\n drivers/common/cnxk/roc_npc_mcam.c |   2 +-\n drivers/common/cnxk/roc_npc_priv.h |   1 +\n drivers/common/cnxk/version.map    |   2 +\n 6 files changed, 276 insertions(+), 16 deletions(-)",
    "diff": "diff --git a/drivers/common/cnxk/roc_model.h b/drivers/common/cnxk/roc_model.h\nindex 5aaad53..c1d11b7 100644\n--- a/drivers/common/cnxk/roc_model.h\n+++ b/drivers/common/cnxk/roc_model.h\n@@ -88,6 +88,12 @@ roc_model_is_cn10k(void)\n }\n \n static inline uint64_t\n+roc_model_is_cn98xx(void)\n+{\n+\treturn (roc_model->flag & ROC_MODEL_CN98xx_A0);\n+}\n+\n+static inline uint64_t\n roc_model_is_cn96_a0(void)\n {\n \treturn roc_model->flag & ROC_MODEL_CN96xx_A0;\ndiff --git a/drivers/common/cnxk/roc_npc.c b/drivers/common/cnxk/roc_npc.c\nindex e6a5036..8a76823 100644\n--- a/drivers/common/cnxk/roc_npc.c\n+++ b/drivers/common/cnxk/roc_npc.c\n@@ -6,6 +6,23 @@\n #include \"roc_priv.h\"\n \n int\n+roc_npc_vtag_actions_get(struct roc_npc *roc_npc)\n+{\n+\tstruct npc *npc = roc_npc_to_npc_priv(roc_npc);\n+\n+\treturn npc->vtag_actions;\n+}\n+\n+int\n+roc_npc_vtag_actions_sub_return(struct roc_npc *roc_npc, uint32_t count)\n+{\n+\tstruct npc *npc = roc_npc_to_npc_priv(roc_npc);\n+\n+\tnpc->vtag_actions -= count;\n+\treturn npc->vtag_actions;\n+}\n+\n+int\n roc_npc_mcam_free_counter(struct roc_npc *roc_npc, uint16_t ctr_id)\n {\n \tstruct npc *npc = roc_npc_to_npc_priv(roc_npc);\n@@ -101,7 +118,7 @@ npc_mcam_tot_entries(void)\n \t/* FIXME: change to reading in AF from NPC_AF_CONST1/2\n \t * MCAM_BANK_DEPTH(_EXT) * MCAM_BANKS\n \t */\n-\tif (roc_model_is_cn10k())\n+\tif (roc_model_is_cn10k() || roc_model_is_cn98xx())\n \t\treturn 16 * 1024; /* MCAM_BANKS = 4, BANK_DEPTH_EXT = 4096 */\n \telse\n \t\treturn 4 * 1024; /* MCAM_BANKS = 4, BANK_DEPTH_EXT = 1024 */\n@@ -330,6 +347,7 @@ npc_parse_actions(struct npc *npc, const struct roc_npc_attr *attr,\n \tconst struct roc_npc_action_mark *act_mark;\n \tconst struct roc_npc_action_queue *act_q;\n \tconst struct roc_npc_action_vf *vf_act;\n+\tbool vlan_insert_action = false;\n \tint sel_act, req_act = 0;\n \tuint16_t pf_func, vf_id;\n \tint errcode = 0;\n@@ -417,25 +435,69 @@ npc_parse_actions(struct npc *npc, const struct roc_npc_attr *attr,\n \t\t\treq_act |= ROC_NPC_ACTION_TYPE_SEC;\n \t\t\trq = 0;\n \t\t\tbreak;\n+\t\tcase ROC_NPC_ACTION_TYPE_VLAN_STRIP:\n+\t\t\treq_act |= ROC_NPC_ACTION_TYPE_VLAN_STRIP;\n+\t\t\tbreak;\n+\t\tcase ROC_NPC_ACTION_TYPE_VLAN_INSERT:\n+\t\t\treq_act |= ROC_NPC_ACTION_TYPE_VLAN_INSERT;\n+\t\t\tbreak;\n+\t\tcase ROC_NPC_ACTION_TYPE_VLAN_ETHTYPE_INSERT:\n+\t\t\treq_act |= ROC_NPC_ACTION_TYPE_VLAN_ETHTYPE_INSERT;\n+\t\t\tbreak;\n+\t\tcase ROC_NPC_ACTION_TYPE_VLAN_PCP_INSERT:\n+\t\t\treq_act |= ROC_NPC_ACTION_TYPE_VLAN_PCP_INSERT;\n+\t\t\tbreak;\n \t\tdefault:\n \t\t\terrcode = NPC_ERR_ACTION_NOTSUP;\n \t\t\tgoto err_exit;\n \t\t}\n \t}\n \n+\tif (req_act & (ROC_NPC_ACTION_TYPE_VLAN_INSERT |\n+\t\t       ROC_NPC_ACTION_TYPE_VLAN_ETHTYPE_INSERT |\n+\t\t       ROC_NPC_ACTION_TYPE_VLAN_PCP_INSERT))\n+\t\tvlan_insert_action = true;\n+\n+\tif ((req_act & (ROC_NPC_ACTION_TYPE_VLAN_INSERT |\n+\t\t\tROC_NPC_ACTION_TYPE_VLAN_ETHTYPE_INSERT |\n+\t\t\tROC_NPC_ACTION_TYPE_VLAN_PCP_INSERT)) ==\n+\t    ROC_NPC_ACTION_TYPE_VLAN_PCP_INSERT) {\n+\t\tplt_err(\"PCP insert action can't be supported alone\");\n+\t\terrcode = NPC_ERR_ACTION_NOTSUP;\n+\t\tgoto err_exit;\n+\t}\n+\n+\t/* Both STRIP and INSERT actions are not supported */\n+\tif (vlan_insert_action && (req_act & ROC_NPC_ACTION_TYPE_VLAN_STRIP)) {\n+\t\terrcode = NPC_ERR_ACTION_NOTSUP;\n+\t\tgoto err_exit;\n+\t}\n+\n \t/* Check if actions specified are compatible */\n \tif (attr->egress) {\n-\t\t/* Only DROP/COUNT is supported */\n-\t\tif (!(req_act & ROC_NPC_ACTION_TYPE_DROP)) {\n+\t\tif (req_act & ROC_NPC_ACTION_TYPE_VLAN_STRIP) {\n+\t\t\tplt_err(\"VLAN pop action is not supported on Egress\");\n \t\t\terrcode = NPC_ERR_ACTION_NOTSUP;\n \t\t\tgoto err_exit;\n-\t\t} else if (req_act & ~(ROC_NPC_ACTION_TYPE_DROP |\n-\t\t\t\t       ROC_NPC_ACTION_TYPE_COUNT)) {\n+\t\t}\n+\n+\t\tif (req_act & ROC_NPC_ACTION_TYPE_DROP) {\n+\t\t\tflow->npc_action = NIX_TX_ACTIONOP_DROP;\n+\t\t} else if ((req_act & ROC_NPC_ACTION_TYPE_COUNT) ||\n+\t\t\t   vlan_insert_action) {\n+\t\t\tflow->npc_action = NIX_TX_ACTIONOP_UCAST_DEFAULT;\n+\t\t} else {\n+\t\t\tplt_err(\"Unsupported action for egress\");\n \t\t\terrcode = NPC_ERR_ACTION_NOTSUP;\n \t\t\tgoto err_exit;\n \t\t}\n-\t\tflow->npc_action = NIX_TX_ACTIONOP_DROP;\n+\n \t\tgoto set_pf_func;\n+\t} else {\n+\t\tif (vlan_insert_action) {\n+\t\t\terrcode = NPC_ERR_ACTION_NOTSUP;\n+\t\t\tgoto err_exit;\n+\t\t}\n \t}\n \n \t/* We have already verified the attr, this is ingress.\n@@ -463,6 +525,13 @@ npc_parse_actions(struct npc *npc, const struct roc_npc_attr *attr,\n \t\tgoto err_exit;\n \t}\n \n+\tif (req_act & ROC_NPC_ACTION_TYPE_VLAN_STRIP)\n+\t\tnpc->vtag_actions++;\n+\n+\t/* Only VLAN action is provided */\n+\tif (req_act == ROC_NPC_ACTION_TYPE_VLAN_STRIP)\n+\t\tflow->npc_action = NIX_RX_ACTIONOP_UCAST;\n+\n \t/* Set NIX_RX_ACTIONOP */\n \tif (req_act & (ROC_NPC_ACTION_TYPE_PF | ROC_NPC_ACTION_TYPE_VF)) {\n \t\tflow->npc_action = NIX_RX_ACTIONOP_UCAST;\n@@ -774,6 +843,161 @@ roc_npc_mark_actions_sub_return(struct roc_npc *roc_npc, uint32_t count)\n \treturn npc->mark_actions;\n }\n \n+static int\n+npc_vtag_cfg_delete(struct roc_npc *roc_npc, struct roc_npc_flow *flow)\n+{\n+\tstruct roc_nix *roc_nix = roc_npc->roc_nix;\n+\tstruct nix_vtag_config *vtag_cfg;\n+\tstruct nix_vtag_config_rsp *rsp;\n+\tstruct mbox *mbox;\n+\tstruct nix *nix;\n+\tint rc = 0;\n+\n+\tunion {\n+\t\tuint64_t reg;\n+\t\tstruct nix_tx_vtag_action_s act;\n+\t} tx_vtag_action;\n+\n+\tnix = roc_nix_to_nix_priv(roc_nix);\n+\tmbox = (&nix->dev)->mbox;\n+\n+\ttx_vtag_action.reg = flow->vtag_action;\n+\tvtag_cfg = mbox_alloc_msg_nix_vtag_cfg(mbox);\n+\n+\tif (vtag_cfg == NULL)\n+\t\treturn -ENOSPC;\n+\n+\tvtag_cfg->cfg_type = VTAG_TX;\n+\tvtag_cfg->vtag_size = NIX_VTAGSIZE_T4;\n+\tvtag_cfg->tx.vtag0_idx = tx_vtag_action.act.vtag0_def;\n+\tvtag_cfg->tx.free_vtag0 = true;\n+\n+\trc = mbox_process_msg(mbox, (void *)&rsp);\n+\tif (rc)\n+\t\treturn rc;\n+\n+\treturn 0;\n+}\n+\n+static int\n+npc_vtag_action_program(struct roc_npc *roc_npc,\n+\t\t\tconst struct roc_npc_action actions[],\n+\t\t\tstruct roc_npc_flow *flow)\n+{\n+\tuint16_t vlan_id = 0, vlan_ethtype = ROC_ETHER_TYPE_VLAN;\n+\tstruct npc *npc = roc_npc_to_npc_priv(roc_npc);\n+\tstruct roc_nix *roc_nix = roc_npc->roc_nix;\n+\tstruct nix_vtag_config *vtag_cfg;\n+\tstruct nix_vtag_config_rsp *rsp;\n+\tuint64_t rx_vtag_action = 0;\n+\tuint8_t vlan_pcp = 0;\n+\tstruct mbox *mbox;\n+\tstruct nix *nix;\n+\tint rc;\n+\n+\tunion {\n+\t\tuint64_t reg;\n+\t\tstruct nix_tx_vtag_action_s act;\n+\t} tx_vtag_action;\n+\n+\tnix = roc_nix_to_nix_priv(roc_nix);\n+\tmbox = (&nix->dev)->mbox;\n+\n+\tflow->vtag_insert_enabled = false;\n+\n+\tfor (; actions->type != ROC_NPC_ACTION_TYPE_END; actions++) {\n+\t\tif (actions->type == ROC_NPC_ACTION_TYPE_VLAN_STRIP) {\n+\t\t\tif (npc->vtag_actions == 1) {\n+\t\t\t\tvtag_cfg = mbox_alloc_msg_nix_vtag_cfg(mbox);\n+\n+\t\t\t\tif (vtag_cfg == NULL)\n+\t\t\t\t\treturn -ENOSPC;\n+\n+\t\t\t\tvtag_cfg->cfg_type = VTAG_RX;\n+\t\t\t\tvtag_cfg->rx.strip_vtag = 1;\n+\t\t\t\t/* Always capture */\n+\t\t\t\tvtag_cfg->rx.capture_vtag = 1;\n+\t\t\t\tvtag_cfg->vtag_size = NIX_VTAGSIZE_T4;\n+\t\t\t\tvtag_cfg->rx.vtag_type = 0;\n+\n+\t\t\t\trc = mbox_process(mbox);\n+\t\t\t\tif (rc)\n+\t\t\t\t\treturn rc;\n+\t\t\t}\n+\n+\t\t\trx_vtag_action |= (NIX_RX_VTAGACTION_VTAG_VALID << 15);\n+\t\t\trx_vtag_action |= ((uint64_t)NPC_LID_LB << 8);\n+\t\t\trx_vtag_action |= NIX_RX_VTAGACTION_VTAG0_RELPTR;\n+\t\t\tflow->vtag_action = rx_vtag_action;\n+\t\t} else if (actions->type == ROC_NPC_ACTION_TYPE_VLAN_INSERT) {\n+\t\t\tconst struct roc_npc_action_of_set_vlan_vid *vtag =\n+\t\t\t\t(const struct roc_npc_action_of_set_vlan_vid *)\n+\t\t\t\t\tactions->conf;\n+\t\t\tvlan_id = plt_be_to_cpu_16(vtag->vlan_vid);\n+\t\t\tif (vlan_id > 0xfff) {\n+\t\t\t\tplt_err(\"Invalid vlan_id for set vlan action\");\n+\t\t\t\treturn -EINVAL;\n+\t\t\t}\n+\t\t\tflow->vtag_insert_enabled = true;\n+\t\t} else if (actions->type ==\n+\t\t\t   ROC_NPC_ACTION_TYPE_VLAN_ETHTYPE_INSERT) {\n+\t\t\tconst struct roc_npc_action_of_push_vlan *ethtype =\n+\t\t\t\t(const struct roc_npc_action_of_push_vlan *)\n+\t\t\t\t\tactions->conf;\n+\t\t\tvlan_ethtype = plt_be_to_cpu_16(ethtype->ethertype);\n+\t\t\tif (vlan_ethtype != ROC_ETHER_TYPE_VLAN &&\n+\t\t\t    vlan_ethtype != ROC_ETHER_TYPE_QINQ) {\n+\t\t\t\tplt_err(\"Invalid ethtype specified for push\"\n+\t\t\t\t\t\" vlan action\");\n+\t\t\t\treturn -EINVAL;\n+\t\t\t}\n+\t\t\tflow->vtag_insert_enabled = true;\n+\t\t} else if (actions->type ==\n+\t\t\t   ROC_NPC_ACTION_TYPE_VLAN_PCP_INSERT) {\n+\t\t\tconst struct roc_npc_action_of_set_vlan_pcp *pcp =\n+\t\t\t\t(const struct roc_npc_action_of_set_vlan_pcp *)\n+\t\t\t\t\tactions->conf;\n+\t\t\tvlan_pcp = pcp->vlan_pcp;\n+\t\t\tif (vlan_pcp > 0x7) {\n+\t\t\t\tplt_err(\"Invalid PCP value for pcp action\");\n+\t\t\t\treturn -EINVAL;\n+\t\t\t}\n+\t\t\tflow->vtag_insert_enabled = true;\n+\t\t}\n+\t}\n+\n+\tif (flow->vtag_insert_enabled) {\n+\t\tvtag_cfg = mbox_alloc_msg_nix_vtag_cfg(mbox);\n+\n+\t\tif (vtag_cfg == NULL)\n+\t\t\treturn -ENOSPC;\n+\n+\t\tvtag_cfg->cfg_type = VTAG_TX;\n+\t\tvtag_cfg->vtag_size = NIX_VTAGSIZE_T4;\n+\t\tvtag_cfg->tx.vtag0 =\n+\t\t\t((vlan_ethtype << 16) | (vlan_pcp << 13) | vlan_id);\n+\n+\t\tvtag_cfg->tx.cfg_vtag0 = 1;\n+\t\trc = mbox_process_msg(mbox, (void *)&rsp);\n+\t\tif (rc)\n+\t\t\treturn rc;\n+\n+\t\tif (rsp->vtag0_idx < 0) {\n+\t\t\tplt_err(\"Failed to config TX VTAG action\");\n+\t\t\treturn -EINVAL;\n+\t\t}\n+\n+\t\ttx_vtag_action.reg = 0;\n+\t\ttx_vtag_action.act.vtag0_def = rsp->vtag0_idx;\n+\t\ttx_vtag_action.act.vtag0_lid = NPC_LID_LA;\n+\t\ttx_vtag_action.act.vtag0_op = NIX_TX_VTAGOP_INSERT;\n+\t\ttx_vtag_action.act.vtag0_relptr =\n+\t\t\tNIX_TX_VTAGACTION_VTAG0_RELPTR;\n+\t\tflow->vtag_action = tx_vtag_action.reg;\n+\t}\n+\treturn 0;\n+}\n+\n struct roc_npc_flow *\n roc_npc_flow_create(struct roc_npc *roc_npc, const struct roc_npc_attr *attr,\n \t\t    const struct roc_npc_item_info pattern[],\n@@ -798,6 +1022,12 @@ roc_npc_flow_create(struct roc_npc *roc_npc, const struct roc_npc_attr *attr,\n \t\tgoto err_exit;\n \t}\n \n+\trc = npc_vtag_action_program(roc_npc, actions, flow);\n+\tif (rc != 0) {\n+\t\t*errcode = rc;\n+\t\tgoto err_exit;\n+\t}\n+\n \tparse_state.is_vf = !roc_nix_is_pf(roc_npc->roc_nix);\n \n \trc = npc_program_mcam(npc, &parse_state, 1);\n@@ -858,23 +1088,20 @@ roc_npc_flow_destroy(struct roc_npc *roc_npc, struct roc_npc_flow *flow)\n {\n \tstruct npc *npc = roc_npc_to_npc_priv(roc_npc);\n \tstruct plt_bitmap *bmap;\n-\tuint16_t match_id;\n \tint rc;\n \n-\tmatch_id = (flow->npc_action >> NPC_RX_ACT_MATCH_OFFSET) &\n-\t\t   NPC_RX_ACT_MATCH_MASK;\n-\n-\tif (match_id && match_id < NPC_ACTION_FLAG_DEFAULT) {\n-\t\tif (npc->mark_actions == 0)\n-\t\t\treturn NPC_ERR_PARAM;\n-\t}\n-\n \trc = npc_rss_group_free(npc, flow);\n \tif (rc != 0) {\n \t\tplt_err(\"Failed to free rss action rc = %d\", rc);\n \t\treturn rc;\n \t}\n \n+\tif (flow->vtag_insert_enabled) {\n+\t\trc = npc_vtag_cfg_delete(roc_npc, flow);\n+\t\tif (rc != 0)\n+\t\t\treturn rc;\n+\t}\n+\n \trc = npc_mcam_free_entry(npc, flow->mcam_id);\n \tif (rc != 0)\n \t\treturn rc;\ndiff --git a/drivers/common/cnxk/roc_npc.h b/drivers/common/cnxk/roc_npc.h\nindex cf6f732..2c0a536 100644\n--- a/drivers/common/cnxk/roc_npc.h\n+++ b/drivers/common/cnxk/roc_npc.h\n@@ -62,6 +62,10 @@ enum roc_npc_action_type {\n \tROC_NPC_ACTION_TYPE_COUNT = (1 << 9),\n \tROC_NPC_ACTION_TYPE_PF = (1 << 10),\n \tROC_NPC_ACTION_TYPE_VF = (1 << 11),\n+\tROC_NPC_ACTION_TYPE_VLAN_STRIP = (1 << 12),\n+\tROC_NPC_ACTION_TYPE_VLAN_INSERT = (1 << 13),\n+\tROC_NPC_ACTION_TYPE_VLAN_ETHTYPE_INSERT = (1 << 14),\n+\tROC_NPC_ACTION_TYPE_VLAN_PCP_INSERT = (1 << 15),\n };\n \n struct roc_npc_action {\n@@ -83,6 +87,18 @@ struct roc_npc_action_queue {\n \tuint16_t index; /**< Queue index to use. */\n };\n \n+struct roc_npc_action_of_push_vlan {\n+\tuint16_t ethertype; /**< EtherType. */\n+};\n+\n+struct roc_npc_action_of_set_vlan_vid {\n+\tuint16_t vlan_vid; /**< VLAN id. */\n+};\n+\n+struct roc_npc_action_of_set_vlan_pcp {\n+\tuint8_t vlan_pcp; /**< VLAN priority. */\n+};\n+\n struct roc_npc_attr {\n \tuint32_t priority;\t/**< Rule priority level within group. */\n \tuint32_t ingress : 1;\t/**< Rule applies to ingress traffic. */\n@@ -107,6 +123,7 @@ struct roc_npc_flow {\n \tuint64_t mcam_mask[ROC_NPC_MAX_MCAM_WIDTH_DWORDS];\n \tuint64_t npc_action;\n \tuint64_t vtag_action;\n+\tbool vtag_insert_enabled;\n #define ROC_NPC_MAX_FLOW_PATTERNS 32\n \tstruct roc_npc_flow_dump_data dump_data[ROC_NPC_MAX_FLOW_PATTERNS];\n \tuint16_t num_patterns;\n@@ -138,6 +155,10 @@ enum roc_npc_intf {\n \tROC_NPC_INTF_MAX = 2,\n };\n \n+enum flow_vtag_cfg_dir { VTAG_TX, VTAG_RX };\n+#define ROC_ETHER_TYPE_VLAN 0x8100 /**< IEEE 802.1Q VLAN tagging. */\n+#define ROC_ETHER_TYPE_QINQ 0x88A8 /**< IEEE 802.1ad QinQ tagging. */\n+\n struct roc_npc {\n \tstruct roc_nix *roc_nix;\n \tuint8_t switch_header_type;\n@@ -199,4 +220,7 @@ void __roc_api roc_npc_flow_mcam_dump(FILE *file, struct roc_npc *roc_npc,\n int __roc_api roc_npc_mark_actions_get(struct roc_npc *roc_npc);\n int __roc_api roc_npc_mark_actions_sub_return(struct roc_npc *roc_npc,\n \t\t\t\t\t      uint32_t count);\n+int __roc_api roc_npc_vtag_actions_get(struct roc_npc *roc_npc);\n+int __roc_api roc_npc_vtag_actions_sub_return(struct roc_npc *roc_npc,\n+\t\t\t\t\t      uint32_t count);\n #endif /* _ROC_NPC_H_ */\ndiff --git a/drivers/common/cnxk/roc_npc_mcam.c b/drivers/common/cnxk/roc_npc_mcam.c\nindex ff0676d..8ccaaad 100644\n--- a/drivers/common/cnxk/roc_npc_mcam.c\n+++ b/drivers/common/cnxk/roc_npc_mcam.c\n@@ -546,7 +546,7 @@ npc_mcam_alloc_and_write(struct npc *npc, struct roc_npc_flow *flow,\n \t *\n \t * Second approach is used now.\n \t */\n-\treq->entry_data.vtag_action = 0ULL;\n+\treq->entry_data.vtag_action = flow->vtag_action;\n \n \tfor (idx = 0; idx < ROC_NPC_MAX_MCAM_WIDTH_DWORDS; idx++) {\n \t\treq->entry_data.kw[idx] = flow->mcam_data[idx];\ndiff --git a/drivers/common/cnxk/roc_npc_priv.h b/drivers/common/cnxk/roc_npc_priv.h\nindex 961583b..484c3ae 100644\n--- a/drivers/common/cnxk/roc_npc_priv.h\n+++ b/drivers/common/cnxk/roc_npc_priv.h\n@@ -350,6 +350,7 @@ struct npc {\n \tuint16_t flow_max_priority;\t\t/* Max priority for flow */\n \tuint16_t switch_header_type; /* Suppprted switch header type */\n \tuint32_t mark_actions;\t     /* Number of mark actions */\n+\tuint32_t vtag_actions;\t     /* vtag insert/strip actions */\n \tuint16_t pf_func;\t     /* pf_func of device */\n \tnpc_dxcfg_t prx_dxcfg;\t     /* intf, lid, lt, extract */\n \tnpc_fxcfg_t prx_fxcfg;\t     /* Flag extract */\ndiff --git a/drivers/common/cnxk/version.map b/drivers/common/cnxk/version.map\nindex 554459b..8a5c839 100644\n--- a/drivers/common/cnxk/version.map\n+++ b/drivers/common/cnxk/version.map\n@@ -167,6 +167,8 @@ INTERNAL {\n \troc_npc_init;\n \troc_npc_mark_actions_get;\n \troc_npc_mark_actions_sub_return;\n+\troc_npc_vtag_actions_get;\n+\troc_npc_vtag_actions_sub_return;\n \troc_npc_mcam_alloc_entries;\n \troc_npc_mcam_alloc_entry;\n \troc_npc_mcam_clear_counter;\n",
    "prefixes": [
        "v4",
        "08/62"
    ]
}