get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 137389,
    "url": "http://patches.dpdk.org/api/patches/137389/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20240227191550.137687-19-hkalra@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": "<20240227191550.137687-19-hkalra@marvell.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20240227191550.137687-19-hkalra@marvell.com",
    "date": "2024-02-27T19:15:45",
    "name": "[v4,18/23] common/cnxk: support port representor and represented port",
    "commit_ref": null,
    "pull_url": null,
    "state": "changes-requested",
    "archived": true,
    "hash": "c4a8fc8e4145a4376ad20154e98d5a3c64dbeeb3",
    "submitter": {
        "id": 1182,
        "url": "http://patches.dpdk.org/api/people/1182/?format=api",
        "name": "Harman Kalra",
        "email": "hkalra@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/20240227191550.137687-19-hkalra@marvell.com/mbox/",
    "series": [
        {
            "id": 31259,
            "url": "http://patches.dpdk.org/api/series/31259/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=31259",
            "date": "2024-02-27T19:15:27",
            "name": "net/cnxk: support for port representors",
            "version": 4,
            "mbox": "http://patches.dpdk.org/series/31259/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/137389/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/137389/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 D12B743C06;\n\tTue, 27 Feb 2024 20:18:13 +0100 (CET)",
            "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 49A7E42EF0;\n\tTue, 27 Feb 2024 20:17:18 +0100 (CET)",
            "from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com\n [67.231.156.173])\n by mails.dpdk.org (Postfix) with ESMTP id EFBA742F8D\n for <dev@dpdk.org>; Tue, 27 Feb 2024 20:16:59 +0100 (CET)",
            "from pps.filterd (m0045851.ppops.net [127.0.0.1])\n by mx0b-0016f401.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id\n 41RFgmZ7005633 for <dev@dpdk.org>; Tue, 27 Feb 2024 11:16:59 -0800",
            "from dc6wp-exch02.marvell.com ([4.21.29.225])\n by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3whjm694qa-1\n (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT)\n for <dev@dpdk.org>; Tue, 27 Feb 2024 11:16:59 -0800 (PST)",
            "from DC6WP-EXCH02.marvell.com (10.76.176.209) by\n DC6WP-EXCH02.marvell.com (10.76.176.209) with Microsoft SMTP Server\n (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id\n 15.2.1258.12; Tue, 27 Feb 2024 11:16:58 -0800",
            "from maili.marvell.com (10.69.176.80) by DC6WP-EXCH02.marvell.com\n (10.76.176.209) with Microsoft SMTP Server id 15.2.1258.12 via Frontend\n Transport; Tue, 27 Feb 2024 11:16:58 -0800",
            "from localhost.localdomain (unknown [10.29.52.211])\n by maili.marvell.com (Postfix) with ESMTP id C78073F719D;\n Tue, 27 Feb 2024 11:16:55 -0800 (PST)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=\n from:to:cc:subject:date:message-id:in-reply-to:references\n :mime-version:content-type; s=pfpt0220; bh=YmgeU4BMCyBUpNGDVaqqN\n nOGyQiFAqMpGAPdnVU6K+k=; b=KKK2xUnKT9bswA61IgxZrv2LSxsqA8ynPU+SJ\n GhFijUHW9aEIBXO8BRh1DvxlNmpams7dE+3MJGSqUhfLLBt0UNklRW4bi15t4lqz\n qTBBvaapyBs5icFeDLfwEpSka/JVQv1NODrvVcR/ymXjOw4o0tfWcmYadF8hsk8u\n +Q9FV65SmAeUVJSUiUJcghmACbCU1ubAUKtiLJoSyQSc2v0MatU1AVQE7H/bMzHS\n ehltV8NTw3QwiCNuzxFQ7s5+5KeOJfr5ssqoe+HUizTcdgaySUfd4kAYAB8vz+j5\n Hh2h5VFGp8QG7VO4EE1IIRkJqYltW6X4XYLk8eDI1hbX7Vc3A==",
        "From": "Harman Kalra <hkalra@marvell.com>",
        "To": "Nithin Dabilpuram <ndabilpuram@marvell.com>, Kiran Kumar K\n <kirankumark@marvell.com>, Sunil Kumar Kori <skori@marvell.com>, Satha Rao\n <skoteshwar@marvell.com>, Harman Kalra <hkalra@marvell.com>",
        "CC": "<dev@dpdk.org>, Satheesh Paul <psatheesh@marvell.com>",
        "Subject": "[PATCH v4 18/23] common/cnxk: support port representor and\n represented port",
        "Date": "Wed, 28 Feb 2024 00:45:45 +0530",
        "Message-ID": "<20240227191550.137687-19-hkalra@marvell.com>",
        "X-Mailer": "git-send-email 2.18.0",
        "In-Reply-To": "<20240227191550.137687-1-hkalra@marvell.com>",
        "References": "<20230811163419.165790-1-hkalra@marvell.com>\n <20240227191550.137687-1-hkalra@marvell.com>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain",
        "X-Proofpoint-ORIG-GUID": "KpYYgAkMJLBysBm11FlWQZ2Z4Njp-bIY",
        "X-Proofpoint-GUID": "KpYYgAkMJLBysBm11FlWQZ2Z4Njp-bIY",
        "X-Proofpoint-Virus-Version": "vendor=baseguard\n engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26\n definitions=2024-02-27_06,2024-02-27_01,2023-05-22_02",
        "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"
    },
    "content": "From: Kiran Kumar K <kirankumark@marvell.com>\n\nImplementing the common infrastructural changes for supporting port\nrepresentors and represented ports used as action and pattern in net\nlayer.\n\nSigned-off-by: Kiran Kumar K <kirankumark@marvell.com>\nSigned-off-by: Satheesh Paul <psatheesh@marvell.com>\nSigned-off-by: Harman Kalra <hkalra@marvell.com>\n---\n drivers/common/cnxk/roc_npc.c       | 84 +++++++++++++++++++++++------\n drivers/common/cnxk/roc_npc.h       | 19 ++++++-\n drivers/common/cnxk/roc_npc_mcam.c  | 65 +++++++++++-----------\n drivers/common/cnxk/roc_npc_parse.c | 28 +++++++++-\n drivers/common/cnxk/roc_npc_priv.h  |  2 +\n drivers/net/cnxk/cnxk_flow.c        |  2 +-\n 6 files changed, 150 insertions(+), 50 deletions(-)",
    "diff": "diff --git a/drivers/common/cnxk/roc_npc.c b/drivers/common/cnxk/roc_npc.c\nindex 67a660a2bc..d6ad3756bb 100644\n--- a/drivers/common/cnxk/roc_npc.c\n+++ b/drivers/common/cnxk/roc_npc.c\n@@ -570,6 +570,8 @@ npc_parse_actions(struct roc_npc *roc_npc, const struct roc_npc_attr *attr,\n \tflow->ctr_id = NPC_COUNTER_NONE;\n \tflow->mtr_id = ROC_NIX_MTR_ID_INVALID;\n \tpf_func = npc->pf_func;\n+\tif (flow->has_rep)\n+\t\tpf_func = flow->rep_pf_func;\n \n \tfor (; actions->type != ROC_NPC_ACTION_TYPE_END; actions++) {\n \t\tswitch (actions->type) {\n@@ -788,9 +790,12 @@ npc_parse_actions(struct roc_npc *roc_npc, const struct roc_npc_attr *attr,\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} else if ((req_act & ROC_NPC_ACTION_TYPE_COUNT) || vlan_insert_action) {\n \t\t\tflow->npc_action = NIX_TX_ACTIONOP_UCAST_DEFAULT;\n+\t\t\tif (flow->rep_act_rep) {\n+\t\t\t\tflow->npc_action = NIX_TX_ACTIONOP_UCAST_CHAN;\n+\t\t\t\tflow->npc_action |= (uint64_t)0x3f << 12;\n+\t\t\t}\n \t\t} else {\n \t\t\tplt_err(\"Unsupported action for egress\");\n \t\t\terrcode = NPC_ERR_ACTION_NOTSUP;\n@@ -802,7 +807,9 @@ npc_parse_actions(struct roc_npc *roc_npc, const struct roc_npc_attr *attr,\n \t\t\tflow->mcast_channels[1] = npc->channel;\n \t\t}\n \n-\t\tgoto set_pf_func;\n+\t\t/* PF func who is sending the packet */\n+\t\tflow->tx_pf_func = pf_func;\n+\t\tgoto done;\n \t} else {\n \t\tif (vlan_insert_action) {\n \t\t\terrcode = NPC_ERR_ACTION_NOTSUP;\n@@ -881,10 +888,10 @@ npc_parse_actions(struct roc_npc *roc_npc, const struct roc_npc_attr *attr,\n \tif (mark)\n \t\tflow->npc_action |= (uint64_t)mark << 40;\n \n-set_pf_func:\n \t/* Ideally AF must ensure that correct pf_func is set */\n \tflow->npc_action |= (uint64_t)pf_func << 4;\n \n+done:\n \treturn 0;\n \n err_exit:\n@@ -898,10 +905,14 @@ npc_parse_pattern(struct npc *npc, const struct roc_npc_item_info pattern[],\n \t\t  struct roc_npc_flow *flow, struct npc_parse_state *pst)\n {\n \tnpc_parse_stage_func_t parse_stage_funcs[] = {\n-\t\tnpc_parse_meta_items, npc_parse_mark_item, npc_parse_pre_l2, npc_parse_cpt_hdr,\n-\t\tnpc_parse_higig2_hdr, npc_parse_tx_queue,  npc_parse_la,     npc_parse_lb,\n-\t\tnpc_parse_lc,\t      npc_parse_ld,\t   npc_parse_le,     npc_parse_lf,\n-\t\tnpc_parse_lg,\t      npc_parse_lh,\n+\t\tnpc_parse_meta_items, npc_parse_port_representor_id,\n+\t\tnpc_parse_mark_item,  npc_parse_pre_l2,\n+\t\tnpc_parse_cpt_hdr,    npc_parse_higig2_hdr,\n+\t\tnpc_parse_tx_queue,   npc_parse_la,\n+\t\tnpc_parse_lb,\t      npc_parse_lc,\n+\t\tnpc_parse_ld,\t      npc_parse_le,\n+\t\tnpc_parse_lf,\t      npc_parse_lg,\n+\t\tnpc_parse_lh,\n \t};\n \tuint8_t layer = 0;\n \tint key_offset;\n@@ -1140,15 +1151,20 @@ npc_rss_action_program(struct roc_npc *roc_npc,\n \t\t       struct roc_npc_flow *flow)\n {\n \tconst struct roc_npc_action_rss *rss;\n+\tstruct roc_npc *npc = roc_npc;\n \tuint32_t rss_grp;\n \tuint8_t alg_idx;\n \tint rc;\n \n+\tif (flow->has_rep) {\n+\t\tnpc = roc_npc->rep_npc;\n+\t\tnpc->flowkey_cfg_state = roc_npc->flowkey_cfg_state;\n+\t}\n+\n \tfor (; actions->type != ROC_NPC_ACTION_TYPE_END; actions++) {\n \t\tif (actions->type == ROC_NPC_ACTION_TYPE_RSS) {\n \t\t\trss = (const struct roc_npc_action_rss *)actions->conf;\n-\t\t\trc = npc_rss_action_configure(roc_npc, rss, &alg_idx,\n-\t\t\t\t\t\t      &rss_grp, flow->mcam_id);\n+\t\t\trc = npc_rss_action_configure(npc, rss, &alg_idx, &rss_grp, flow->mcam_id);\n \t\t\tif (rc)\n \t\t\t\treturn rc;\n \n@@ -1171,7 +1187,7 @@ npc_vtag_cfg_delete(struct roc_npc *roc_npc, struct roc_npc_flow *flow)\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 mbox *mbox, *ombox;\n \tstruct nix *nix;\n \tint rc = 0;\n \n@@ -1181,7 +1197,10 @@ npc_vtag_cfg_delete(struct roc_npc *roc_npc, struct roc_npc_flow *flow)\n \t} tx_vtag_action;\n \n \tnix = roc_nix_to_nix_priv(roc_nix);\n-\tmbox = mbox_get((&nix->dev)->mbox);\n+\tombox = (&nix->dev)->mbox;\n+\tif (flow->has_rep)\n+\t\tombox = flow->rep_mbox;\n+\tmbox = mbox_get(ombox);\n \n \ttx_vtag_action.reg = flow->vtag_action;\n \tvtag_cfg = mbox_alloc_msg_nix_vtag_cfg(mbox);\n@@ -1400,6 +1419,7 @@ npc_vtag_strip_action_configure(struct mbox *mbox,\n \n \trx_vtag_action |= (NIX_RX_VTAGACTION_VTAG_VALID << 15);\n \trx_vtag_action |= ((uint64_t)NPC_LID_LB << 8);\n+\trx_vtag_action |= ((uint64_t)NIX_RX_VTAG_TYPE6 << 12);\n \trx_vtag_action |= NIX_RX_VTAGACTION_VTAG0_RELPTR;\n \n \tif (*strip_cnt == 2) {\n@@ -1432,6 +1452,8 @@ npc_vtag_action_program(struct roc_npc *roc_npc,\n \n \tnix = roc_nix_to_nix_priv(roc_nix);\n \tmbox = (&nix->dev)->mbox;\n+\tif (flow->has_rep)\n+\t\tmbox = flow->rep_mbox;\n \n \tmemset(vlan_info, 0, sizeof(vlan_info));\n \n@@ -1448,6 +1470,7 @@ npc_vtag_action_program(struct roc_npc *roc_npc,\n \t\t\tif (rc)\n \t\t\t\treturn rc;\n \n+\t\t\tplt_npc_dbg(\"VLAN strip action, strip_cnt %d\", strip_cnt);\n \t\t\tif (strip_cnt == 2)\n \t\t\t\tactions++;\n \n@@ -1587,6 +1610,25 @@ roc_npc_flow_create(struct roc_npc *roc_npc, const struct roc_npc_attr *attr,\n \tmemset(flow, 0, sizeof(*flow));\n \tmemset(&parse_state, 0, sizeof(parse_state));\n \n+\tflow->port_id = -1;\n+\tif (roc_npc->rep_npc) {\n+\t\tflow->rep_channel =\n+\t\t\t(roc_npc->rep_rx_channel == 0) ?\n+\t\t\t\troc_nix_to_nix_priv(roc_npc->rep_npc->roc_nix)->rx_chan_base :\n+\t\t\t\troc_npc->rep_rx_channel;\n+\t\tflow->rep_pf_func = roc_npc->rep_pf_func;\n+\t\tflow->rep_act_pf_func = roc_npc->rep_act_pf_func;\n+\t\tflow->rep_act_rep = roc_npc->rep_act_rep;\n+\t\tflow->rep_mbox = roc_npc_to_npc_priv(roc_npc->rep_npc)->mbox;\n+\t\tflow->has_rep = true;\n+\t\tflow->is_rep_vf = !roc_nix_is_pf(roc_npc->rep_npc->roc_nix);\n+\t\tflow->port_id = roc_npc->rep_port_id;\n+\t\tflow->rep_npc = roc_npc_to_npc_priv(roc_npc->rep_npc);\n+\t\troc_npc->rep_act_rep = false;\n+\t\troc_npc->rep_act_pf_func = 0;\n+\t\troc_npc->rep_rx_channel = 0;\n+\t}\n+\n \tparse_state.dst_pf_func = dst_pf_func;\n \n \trc = npc_parse_rule(roc_npc, attr, pattern, actions, flow, &parse_state);\n@@ -1629,6 +1671,7 @@ roc_npc_flow_create(struct roc_npc *roc_npc, const struct roc_npc_attr *attr,\n \t\t*errcode = rc;\n \t\tgoto set_rss_failed;\n \t}\n+\troc_npc->rep_npc = NULL;\n \n \tif (flow->has_age_action)\n \t\tnpc_age_flow_list_entry_add(roc_npc, flow);\n@@ -1641,6 +1684,7 @@ roc_npc_flow_create(struct roc_npc *roc_npc, const struct roc_npc_attr *attr,\n \tTAILQ_FOREACH(flow_iter, list, next) {\n \t\tif (flow_iter->mcam_id > flow->mcam_id) {\n \t\t\tTAILQ_INSERT_BEFORE(flow_iter, flow, next);\n+\t\t\troc_npc->rep_npc = NULL;\n \t\t\treturn flow;\n \t\t}\n \t}\n@@ -1649,6 +1693,7 @@ roc_npc_flow_create(struct roc_npc *roc_npc, const struct roc_npc_attr *attr,\n \treturn flow;\n \n set_rss_failed:\n+\troc_npc->rep_npc = NULL;\n \tif (flow->use_pre_alloc == 0) {\n \t\trc = roc_npc_mcam_free_entry(roc_npc, flow->mcam_id);\n \t\tif (rc != 0) {\n@@ -1660,6 +1705,7 @@ roc_npc_flow_create(struct roc_npc *roc_npc, const struct roc_npc_attr *attr,\n \t\tnpc_inline_dev_ipsec_action_free(npc, flow);\n \t}\n err_exit:\n+\troc_npc->rep_npc = NULL;\n \tplt_free(flow);\n \treturn NULL;\n }\n@@ -1667,15 +1713,19 @@ roc_npc_flow_create(struct roc_npc *roc_npc, const struct roc_npc_attr *attr,\n int\n npc_rss_group_free(struct npc *npc, struct roc_npc_flow *flow)\n {\n+\tstruct npc *lnpc = npc;\n \tuint32_t rss_grp;\n \n+\tif (flow->has_rep)\n+\t\tlnpc = flow->rep_npc;\n+\n \tif ((flow->npc_action & 0xF) == NIX_RX_ACTIONOP_RSS) {\n \t\trss_grp = (flow->npc_action >> NPC_RSS_ACT_GRP_OFFSET) &\n \t\t\t  NPC_RSS_ACT_GRP_MASK;\n \t\tif (rss_grp == 0 || rss_grp >= npc->rss_grps)\n \t\t\treturn -EINVAL;\n \n-\t\tplt_bitmap_clear(npc->rss_grp_entries, rss_grp);\n+\t\tplt_bitmap_clear(lnpc->rss_grp_entries, rss_grp);\n \t}\n \n \treturn 0;\n@@ -1770,7 +1820,7 @@ roc_npc_flow_destroy(struct roc_npc *roc_npc, struct roc_npc_flow *flow)\n }\n \n void\n-roc_npc_flow_dump(FILE *file, struct roc_npc *roc_npc)\n+roc_npc_flow_dump(FILE *file, struct roc_npc *roc_npc, int rep_port_id)\n {\n \tstruct npc *npc = roc_npc_to_npc_priv(roc_npc);\n \tstruct roc_npc_flow *flow_iter;\n@@ -1784,12 +1834,14 @@ roc_npc_flow_dump(FILE *file, struct roc_npc *roc_npc)\n \n \t\t/* List in ascending order of mcam entries */\n \t\tTAILQ_FOREACH(flow_iter, list, next) {\n-\t\t\troc_npc_flow_mcam_dump(file, roc_npc, flow_iter);\n+\t\t\tif (rep_port_id == -1 || rep_port_id == flow_iter->port_id)\n+\t\t\t\troc_npc_flow_mcam_dump(file, roc_npc, flow_iter);\n \t\t}\n \t}\n \n \tTAILQ_FOREACH(flow_iter, &npc->ipsec_list, next) {\n-\t\troc_npc_flow_mcam_dump(file, roc_npc, flow_iter);\n+\t\tif (rep_port_id == -1 || rep_port_id == flow_iter->port_id)\n+\t\t\troc_npc_flow_mcam_dump(file, roc_npc, flow_iter);\n \t}\n }\n \ndiff --git a/drivers/common/cnxk/roc_npc.h b/drivers/common/cnxk/roc_npc.h\nindex 349c7f9d22..72aada84a1 100644\n--- a/drivers/common/cnxk/roc_npc.h\n+++ b/drivers/common/cnxk/roc_npc.h\n@@ -42,6 +42,7 @@ enum roc_npc_item_type {\n \tROC_NPC_ITEM_TYPE_MARK,\n \tROC_NPC_ITEM_TYPE_TX_QUEUE,\n \tROC_NPC_ITEM_TYPE_IPV6_ROUTING_EXT,\n+\tROC_NPC_ITEM_TYPE_REPRESENTED_PORT,\n \tROC_NPC_ITEM_TYPE_END,\n };\n \n@@ -324,6 +325,7 @@ struct roc_npc_flow {\n \tstruct roc_npc_flow_dump_data dump_data[ROC_NPC_MAX_FLOW_PATTERNS];\n \tuint16_t num_patterns;\n \tstruct roc_npc_spi_to_sa_action_info spi_to_sa_info;\n+\tuint16_t tx_pf_func;\n \tbool is_validate;\n \tuint16_t match_id;\n \tuint8_t is_inline_dev;\n@@ -332,6 +334,15 @@ struct roc_npc_flow {\n \tvoid *age_context;\n \tuint32_t timeout;\n \tbool has_age_action;\n+\tuint16_t rep_pf_func;\n+\tuint16_t rep_act_pf_func;\n+\tbool rep_act_rep;\n+\tuint16_t rep_channel;\n+\tstruct mbox *rep_mbox;\n+\tbool has_rep;\n+\tbool is_rep_vf;\n+\tstruct npc *rep_npc;\n+\tint port_id;\n \tbool is_sampling_rule;\n \tuint32_t recv_queue;\n \tuint32_t mcast_grp_index;\n@@ -407,6 +418,12 @@ struct roc_npc {\n \tuint16_t sdp_channel;\n \tuint16_t sdp_channel_mask;\n \tstruct roc_npc_flow_age flow_age;\n+\tstruct roc_npc *rep_npc;\n+\tuint16_t rep_pf_func;\n+\tuint16_t rep_rx_channel;\n+\tuint16_t rep_act_pf_func;\n+\tbool rep_act_rep;\n+\tint rep_port_id;\n \n #define ROC_NPC_MEM_SZ (6 * 1024)\n \tuint8_t reserved[ROC_NPC_MEM_SZ];\n@@ -448,7 +465,7 @@ int __roc_api roc_npc_get_free_mcam_entry(struct roc_npc *roc_npc, struct roc_np\n int __roc_api roc_npc_inl_mcam_read_counter(uint32_t ctr_id, uint64_t *count);\n int __roc_api roc_npc_inl_mcam_clear_counter(uint32_t ctr_id);\n int __roc_api roc_npc_mcam_free_all_resources(struct roc_npc *roc_npc);\n-void __roc_api roc_npc_flow_dump(FILE *file, struct roc_npc *roc_npc);\n+void __roc_api roc_npc_flow_dump(FILE *file, struct roc_npc *roc_npc, int rep_port_id);\n void __roc_api roc_npc_flow_mcam_dump(FILE *file, struct roc_npc *roc_npc,\n \t\t\t\t      struct roc_npc_flow *mcam);\n int __roc_api roc_npc_mark_actions_get(struct roc_npc *roc_npc);\ndiff --git a/drivers/common/cnxk/roc_npc_mcam.c b/drivers/common/cnxk/roc_npc_mcam.c\nindex 2de988a44b..cdb9db1383 100644\n--- a/drivers/common/cnxk/roc_npc_mcam.c\n+++ b/drivers/common/cnxk/roc_npc_mcam.c\n@@ -143,8 +143,8 @@ npc_lid_lt_in_kex(struct npc *npc, uint8_t lid, uint8_t lt)\n }\n \n static void\n-npc_construct_ldata_mask(struct npc *npc, struct plt_bitmap *bmap, uint8_t lid,\n-\t\t\t uint8_t lt, uint8_t ld)\n+npc_construct_ldata_mask(struct npc *npc, struct plt_bitmap *bmap, uint8_t lid, uint8_t lt,\n+\t\t\t uint8_t ld)\n {\n \tstruct npc_xtract_info *x_info, *infoflag;\n \tint hdr_off, keylen;\n@@ -197,8 +197,7 @@ npc_construct_ldata_mask(struct npc *npc, struct plt_bitmap *bmap, uint8_t lid,\n  * @param len length of the match\n  */\n static bool\n-npc_is_kex_enabled(struct npc *npc, uint8_t lid, uint8_t lt, int offset,\n-\t\t   int len)\n+npc_is_kex_enabled(struct npc *npc, uint8_t lid, uint8_t lt, int offset, int len)\n {\n \tstruct plt_bitmap *bmap;\n \tuint32_t bmap_sz;\n@@ -349,8 +348,8 @@ npc_mcam_alloc_entries(struct mbox *mbox, int ref_mcam, int *alloc_entry, int re\n }\n \n int\n-npc_mcam_alloc_entry(struct npc *npc, struct roc_npc_flow *mcam,\n-\t\t     struct roc_npc_flow *ref_mcam, int prio, int *resp_count)\n+npc_mcam_alloc_entry(struct npc *npc, struct roc_npc_flow *mcam, struct roc_npc_flow *ref_mcam,\n+\t\t     int prio, int *resp_count)\n {\n \tstruct npc_mcam_alloc_entry_req *req;\n \tstruct npc_mcam_alloc_entry_rsp *rsp;\n@@ -450,22 +449,17 @@ npc_mcam_write_entry(struct mbox *mbox, struct roc_npc_flow *mcam)\n static void\n npc_mcam_process_mkex_cfg(struct npc *npc, struct npc_get_kex_cfg_rsp *kex_rsp)\n {\n-\tvolatile uint64_t(\n-\t\t*q)[NPC_MAX_INTF][NPC_MAX_LID][NPC_MAX_LT][NPC_MAX_LD];\n+\tvolatile uint64_t(*q)[NPC_MAX_INTF][NPC_MAX_LID][NPC_MAX_LT][NPC_MAX_LD];\n \tstruct npc_xtract_info *x_info = NULL;\n \tint lid, lt, ld, fl, ix;\n \tnpc_dxcfg_t *p;\n \tuint64_t keyw;\n \tuint64_t val;\n \n-\tnpc->keyx_supp_nmask[NPC_MCAM_RX] =\n-\t\tkex_rsp->rx_keyx_cfg & 0x7fffffffULL;\n-\tnpc->keyx_supp_nmask[NPC_MCAM_TX] =\n-\t\tkex_rsp->tx_keyx_cfg & 0x7fffffffULL;\n-\tnpc->keyx_len[NPC_MCAM_RX] =\n-\t\tnpc_supp_key_len(npc->keyx_supp_nmask[NPC_MCAM_RX]);\n-\tnpc->keyx_len[NPC_MCAM_TX] =\n-\t\tnpc_supp_key_len(npc->keyx_supp_nmask[NPC_MCAM_TX]);\n+\tnpc->keyx_supp_nmask[NPC_MCAM_RX] = kex_rsp->rx_keyx_cfg & 0x7fffffffULL;\n+\tnpc->keyx_supp_nmask[NPC_MCAM_TX] = kex_rsp->tx_keyx_cfg & 0x7fffffffULL;\n+\tnpc->keyx_len[NPC_MCAM_RX] = npc_supp_key_len(npc->keyx_supp_nmask[NPC_MCAM_RX]);\n+\tnpc->keyx_len[NPC_MCAM_TX] = npc_supp_key_len(npc->keyx_supp_nmask[NPC_MCAM_TX]);\n \n \tkeyw = (kex_rsp->rx_keyx_cfg >> 32) & 0x7ULL;\n \tnpc->keyw[NPC_MCAM_RX] = keyw;\n@@ -485,8 +479,7 @@ npc_mcam_process_mkex_cfg(struct npc *npc, struct npc_get_kex_cfg_rsp *kex_rsp)\n \n \t/* Update LID, LT and LDATA cfg */\n \tp = &npc->prx_dxcfg;\n-\tq = (volatile uint64_t(*)[][NPC_MAX_LID][NPC_MAX_LT][NPC_MAX_LD])(\n-\t\t&kex_rsp->intf_lid_lt_ld);\n+\tq = (volatile uint64_t(*)[][NPC_MAX_LID][NPC_MAX_LT][NPC_MAX_LD])(&kex_rsp->intf_lid_lt_ld);\n \tfor (ix = 0; ix < NPC_MAX_INTF; ix++) {\n \t\tfor (lid = 0; lid < NPC_MAX_LID; lid++) {\n \t\t\tfor (lt = 0; lt < NPC_MAX_LT; lt++) {\n@@ -539,8 +532,7 @@ npc_mcam_fetch_kex_cfg(struct npc *npc)\n \t\tgoto done;\n \t}\n \n-\tmbox_memcpy((char *)npc->profile_name, kex_rsp->mkex_pfl_name,\n-\t\t    MKEX_NAME_LEN);\n+\tmbox_memcpy((char *)npc->profile_name, kex_rsp->mkex_pfl_name, MKEX_NAME_LEN);\n \n \tnpc->exact_match_ena = (kex_rsp->rx_keyx_cfg >> 40) & 0xF;\n \tnpc_mcam_process_mkex_cfg(npc, kex_rsp);\n@@ -551,9 +543,8 @@ npc_mcam_fetch_kex_cfg(struct npc *npc)\n }\n \n static void\n-npc_mcam_set_channel(struct roc_npc_flow *flow,\n-\t\t     struct npc_mcam_write_entry_req *req, uint16_t channel,\n-\t\t     uint16_t chan_mask, bool is_second_pass)\n+npc_mcam_set_channel(struct roc_npc_flow *flow, struct npc_mcam_write_entry_req *req,\n+\t\t     uint16_t channel, uint16_t chan_mask, bool is_second_pass)\n {\n \tuint16_t chan = 0, mask = 0;\n \n@@ -681,7 +672,10 @@ npc_mcam_alloc_and_write(struct npc *npc, struct roc_npc_flow *flow, struct npc_\n \t}\n \n \tif (flow->nix_intf == NIX_INTF_TX) {\n-\t\tuint16_t pf_func = (flow->npc_action >> 4) & 0xffff;\n+\t\tuint16_t pf_func = flow->tx_pf_func;\n+\n+\t\tif (flow->has_rep)\n+\t\t\tpf_func = flow->rep_pf_func;\n \n \t\tpf_func = plt_cpu_to_be_16(pf_func);\n \n@@ -759,6 +753,15 @@ npc_mcam_alloc_and_write(struct npc *npc, struct roc_npc_flow *flow, struct npc_\n \n \t\t\tnpc_mcam_set_channel(flow, req, inl_dev->channel, inl_dev->chan_mask,\n \t\t\t\t\t     false);\n+\t\t} else if (flow->has_rep) {\n+\t\t\tpf_func = (flow->rep_act_pf_func == 0) ? flow->rep_pf_func :\n+\t\t\t\t\t\t\t\t flow->rep_act_pf_func;\n+\t\t\treq->entry_data.action &= ~(GENMASK(19, 4));\n+\t\t\treq->entry_data.action |= (uint64_t)pf_func << 4;\n+\t\t\tflow->npc_action &= ~(GENMASK(19, 4));\n+\t\t\tflow->npc_action |= (uint64_t)pf_func << 4;\n+\t\t\tnpc_mcam_set_channel(flow, req, flow->rep_channel, (BIT_ULL(12) - 1),\n+\t\t\t\t\t     false);\n \t\t} else if (npc->is_sdp_link) {\n \t\t\tnpc_mcam_set_channel(flow, req, npc->sdp_channel, npc->sdp_channel_mask,\n \t\t\t\t\t     pst->is_second_pass_rule);\n@@ -932,13 +935,11 @@ npc_program_mcam(struct npc *npc, struct npc_parse_state *pst, bool mcam_alloc)\n \t\t\t\t\t\tdata_off = 0;\n \t\t\t\t\t\tindex++;\n \t\t\t\t\t}\n-\t\t\t\t\tkey_data[index] |=\n-\t\t\t\t\t\t((uint64_t)data << data_off);\n+\t\t\t\t\tkey_data[index] |= ((uint64_t)data << data_off);\n \n \t\t\t\t\tif (lt == 0)\n \t\t\t\t\t\tmask = 0;\n-\t\t\t\t\tkey_mask[index] |=\n-\t\t\t\t\t\t((uint64_t)mask << data_off);\n+\t\t\t\t\tkey_mask[index] |= ((uint64_t)mask << data_off);\n \t\t\t\t\tdata_off += 4;\n \t\t\t\t}\n \t\t\t}\n@@ -963,8 +964,12 @@ npc_program_mcam(struct npc *npc, struct npc_parse_state *pst, bool mcam_alloc)\n \t    (pst->flow->npc_action & NIX_RX_ACTIONOP_UCAST_IPSEC))\n \t\tskip_base_rule = true;\n \n-\tif (pst->is_vf && pst->flow->nix_intf == NIX_INTF_RX && !skip_base_rule) {\n-\t\tmbox = mbox_get(npc->mbox);\n+\tif ((pst->is_vf || pst->flow->is_rep_vf) && pst->flow->nix_intf == NIX_INTF_RX &&\n+\t    !skip_base_rule) {\n+\t\tif (pst->flow->has_rep)\n+\t\t\tmbox = mbox_get(pst->flow->rep_mbox);\n+\t\telse\n+\t\t\tmbox = mbox_get(npc->mbox);\n \t\t(void)mbox_alloc_msg_npc_read_base_steer_rule(mbox);\n \t\trc = mbox_process_msg(mbox, (void *)&base_rule_rsp);\n \t\tif (rc) {\ndiff --git a/drivers/common/cnxk/roc_npc_parse.c b/drivers/common/cnxk/roc_npc_parse.c\nindex 571d6b8e5d..0aaf86c768 100644\n--- a/drivers/common/cnxk/roc_npc_parse.c\n+++ b/drivers/common/cnxk/roc_npc_parse.c\n@@ -35,11 +35,35 @@ npc_parse_mark_item(struct npc_parse_state *pst)\n \treturn 0;\n }\n \n+int\n+npc_parse_port_representor_id(struct npc_parse_state *pst)\n+{\n+\tif (pst->pattern->type != ROC_NPC_ITEM_TYPE_REPRESENTED_PORT)\n+\t\treturn 0;\n+\n+\tpst->pattern++;\n+\n+\treturn 0;\n+}\n+\n+int\n+npc_parse_represented_port_id(struct npc_parse_state *pst)\n+{\n+\tif (pst->pattern->type != ROC_NPC_ITEM_TYPE_REPRESENTED_PORT)\n+\t\treturn 0;\n+\n+\tif (pst->flow->nix_intf != NIX_INTF_RX)\n+\t\treturn -EINVAL;\n+\n+\tpst->pattern++;\n+\n+\treturn 0;\n+}\n+\n static int\n npc_flow_raw_item_prepare(const struct roc_npc_flow_item_raw *raw_spec,\n \t\t\t  const struct roc_npc_flow_item_raw *raw_mask,\n-\t\t\t  struct npc_parse_item_info *info, uint8_t *spec_buf,\n-\t\t\t  uint8_t *mask_buf)\n+\t\t\t  struct npc_parse_item_info *info, uint8_t *spec_buf, uint8_t *mask_buf)\n {\n \n \tmemset(spec_buf, 0, NPC_MAX_RAW_ITEM_LEN);\ndiff --git a/drivers/common/cnxk/roc_npc_priv.h b/drivers/common/cnxk/roc_npc_priv.h\nindex 50b62b1244..069c625911 100644\n--- a/drivers/common/cnxk/roc_npc_priv.h\n+++ b/drivers/common/cnxk/roc_npc_priv.h\n@@ -457,6 +457,8 @@ int npc_mask_is_supported(const char *mask, const char *hw_mask, int len);\n int npc_parse_item_basic(const struct roc_npc_item_info *item, struct npc_parse_item_info *info);\n int npc_parse_meta_items(struct npc_parse_state *pst);\n int npc_parse_mark_item(struct npc_parse_state *pst);\n+int npc_parse_port_representor_id(struct npc_parse_state *pst);\n+int npc_parse_represented_port_id(struct npc_parse_state *pst);\n int npc_parse_pre_l2(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);\ndiff --git a/drivers/net/cnxk/cnxk_flow.c b/drivers/net/cnxk/cnxk_flow.c\nindex 4deccd1a67..b7e6ebc2e1 100644\n--- a/drivers/net/cnxk/cnxk_flow.c\n+++ b/drivers/net/cnxk/cnxk_flow.c\n@@ -594,7 +594,7 @@ cnxk_flow_dev_dump(struct rte_eth_dev *eth_dev, struct rte_flow *flow,\n \t\treturn -EINVAL;\n \t}\n \n-\troc_npc_flow_dump(file, npc);\n+\troc_npc_flow_dump(file, npc, -1);\n \n \treturn 0;\n }\n",
    "prefixes": [
        "v4",
        "18/23"
    ]
}