get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 137394,
    "url": "http://patches.dpdk.org/api/patches/137394/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20240227191550.137687-22-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-22-hkalra@marvell.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20240227191550.137687-22-hkalra@marvell.com",
    "date": "2024-02-27T19:15:48",
    "name": "[v4,21/23] net/cnxk: generalise flow operation APIs",
    "commit_ref": null,
    "pull_url": null,
    "state": "changes-requested",
    "archived": true,
    "hash": "a6fcfdde5330a7a86b7632a294575bfd1f971e2b",
    "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-22-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/137394/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/137394/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 156F243C06;\n\tTue, 27 Feb 2024 20:18:47 +0100 (CET)",
            "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 141E642FB9;\n\tTue, 27 Feb 2024 20:17:32 +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 45ECD42F04\n for <dev@dpdk.org>; Tue, 27 Feb 2024 20:17:09 +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 41RFhNwU005875 for <dev@dpdk.org>; Tue, 27 Feb 2024 11:17:08 -0800",
            "from dc6wp-exch02.marvell.com ([4.21.29.225])\n by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3whjm694qx-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:17:08 -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:17:07 -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:17:07 -0800",
            "from localhost.localdomain (unknown [10.29.52.211])\n by maili.marvell.com (Postfix) with ESMTP id 323EE3F719D;\n Tue, 27 Feb 2024 11:17:04 -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=QZEroBS2Jl/eXY3zAG68r\n jLcTVUNXeAleoFtGXMtejI=; b=YknyGeNwcl5fi/dlGKMnjUGzbDAp7xp1dtB2I\n MTx85j1tDGeSBN1pnxQduYPNCLro9FJezFXFmgT1aoKNyVYKhS6q6mEGkUC/EeZV\n D/2ABBqalurfWihJhnR71ToPHsicz4ZSDqEl2+FxUcflkxGPvENO7yP/3ngMQiPs\n LkIIDmSZuOjwcjVHSXRUyqXXXzFajHK0y+2Hg58160BKABvi61yIevKmlO3NsDb4\n ndklgcFXSu3a7BKsWHQm80x+W/x3A0L2bKaonJEhKybF6IImKXuD0W0n6qJy5OoZ\n 6JFhzBK/yB2knMWPEdYJuLHDUp5G6PpRGwAKxMy3VKADyC0Iw==",
        "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>",
        "Subject": "[PATCH v4 21/23] net/cnxk: generalise flow operation APIs",
        "Date": "Wed, 28 Feb 2024 00:45:48 +0530",
        "Message-ID": "<20240227191550.137687-22-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": "CMXkSgqvYOK6czf9gEa1NJgEieA-kswj",
        "X-Proofpoint-GUID": "CMXkSgqvYOK6czf9gEa1NJgEieA-kswj",
        "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": "Flow operations can be performed on cnxk ports as well as representor\nports. Since representor ports are not cnxk ports but have eswitch as\nbase device underneath, special handling is required to align with base\ninfra. Introducing a flag to generic flow APIs to discriminate if the\noperation request made on normal or representor ports.\n\nSigned-off-by: Harman Kalra <hkalra@marvell.com>\n---\n drivers/net/cnxk/cnxk_flow.c | 556 +++++++++++++++++++++++++++++------\n drivers/net/cnxk/cnxk_flow.h |  18 ++\n 2 files changed, 489 insertions(+), 85 deletions(-)",
    "diff": "diff --git a/drivers/net/cnxk/cnxk_flow.c b/drivers/net/cnxk/cnxk_flow.c\nindex 2cd88f0334..d3c20e8315 100644\n--- a/drivers/net/cnxk/cnxk_flow.c\n+++ b/drivers/net/cnxk/cnxk_flow.c\n@@ -4,6 +4,7 @@\n #include <cnxk_flow.h>\n #include <cnxk_rep.h>\n \n+#define IS_REP_BIT 7\n const struct cnxk_rte_flow_term_info term[] = {\n \t[RTE_FLOW_ITEM_TYPE_ETH] = {ROC_NPC_ITEM_TYPE_ETH, sizeof(struct rte_flow_item_eth)},\n \t[RTE_FLOW_ITEM_TYPE_VLAN] = {ROC_NPC_ITEM_TYPE_VLAN, sizeof(struct rte_flow_item_vlan)},\n@@ -186,17 +187,162 @@ roc_npc_parse_sample_subaction(struct rte_eth_dev *eth_dev, const struct rte_flo\n \treturn 0;\n }\n \n+static int\n+representor_rep_portid_action(struct roc_npc_action *in_actions, struct rte_eth_dev *eth_dev,\n+\t\t\t      struct rte_eth_dev *portid_eth_dev,\n+\t\t\t      enum rte_flow_action_type act_type, uint8_t rep_pattern,\n+\t\t\t      uint16_t *dst_pf_func, bool is_rep, uint64_t *free_allocs,\n+\t\t\t      int *act_cnt)\n+{\n+\tstruct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);\n+\tstruct rte_eth_dev *rep_eth_dev = portid_eth_dev;\n+\tstruct rte_flow_action_of_set_vlan_vid *vlan_vid;\n+\tstruct rte_flow_action_of_set_vlan_pcp *vlan_pcp;\n+\tstruct rte_flow_action_of_push_vlan *push_vlan;\n+\tstruct rte_flow_action_queue *act_q = NULL;\n+\tstruct cnxk_rep_dev *rep_dev;\n+\tstruct roc_npc *npc;\n+\tuint16_t vlan_tci;\n+\tint j = 0;\n+\n+\t/* For inserting an action in the list */\n+\tint i = *act_cnt;\n+\n+\trep_dev = cnxk_rep_pmd_priv(rep_eth_dev);\n+\tif (!is_rep) {\n+\t\tdev = cnxk_eth_pmd_priv(eth_dev);\n+\t\tnpc = &dev->npc;\n+\t} else {\n+\t\tnpc = &rep_dev->parent_dev->npc;\n+\t}\n+\tif (rep_pattern >> IS_REP_BIT) { /* Check for normal/representor port as action */\n+\t\tif ((rep_pattern & 0x7f) == RTE_FLOW_ITEM_TYPE_PORT_REPRESENTOR) {\n+\t\t\t/* Case: Repr port pattern -> Default TX rule -> LBK ->\n+\t\t\t *  Pattern RX LBK rule hit -> Action: send to new pf_func\n+\t\t\t */\n+\t\t\tif (act_type == RTE_FLOW_ACTION_TYPE_PORT_REPRESENTOR) {\n+\t\t\t\t/* New pf_func corresponds to ESW + queue corresponding to rep_id */\n+\t\t\t\tact_q = plt_zmalloc(sizeof(struct rte_flow_action_queue), 0);\n+\t\t\t\tif (!act_q) {\n+\t\t\t\t\tplt_err(\"Error allocation memory\");\n+\t\t\t\t\treturn -ENOMEM;\n+\t\t\t\t}\n+\t\t\t\tact_q->index = rep_dev->rep_id;\n+\n+\t\t\t\twhile (free_allocs[j] != 0)\n+\t\t\t\t\tj++;\n+\t\t\t\tfree_allocs[j] = (uint64_t)act_q;\n+\t\t\t\tin_actions[i].type = ROC_NPC_ACTION_TYPE_QUEUE;\n+\t\t\t\tin_actions[i].conf = (struct rte_flow_action_queue *)act_q;\n+\t\t\t\tnpc->rep_act_pf_func = rep_dev->parent_dev->npc.pf_func;\n+\t\t\t} else {\n+\t\t\t\t/* New pf_func corresponds to hw_func of representee */\n+\t\t\t\tin_actions[i].type = ROC_NPC_ACTION_TYPE_PORT_ID;\n+\t\t\t\tnpc->rep_act_pf_func = rep_dev->hw_func;\n+\t\t\t\t*dst_pf_func = rep_dev->hw_func;\n+\t\t\t}\n+\t\t\t/* Additional action to strip the VLAN from packets received by LBK */\n+\t\t\ti++;\n+\t\t\tin_actions[i].type = ROC_NPC_ACTION_TYPE_VLAN_STRIP;\n+\t\t\tgoto done;\n+\t\t}\n+\t\t/* Case: Repd port pattern -> TX Rule with VLAN -> LBK -> Default RX LBK rule hit\n+\t\t * base on vlan, if packet goes to ESW or actual pf_func -> Action :\n+\t\t *    act port_representor: send to ESW respective using 1<<8 | rep_id as tci value\n+\t\t *    act represented_port: send to actual port using rep_id as tci value.\n+\t\t */\n+\t\t/* Add RTE_FLOW_ACTION_TYPE_OF_PUSH_VLAN action */\n+\t\tpush_vlan = plt_zmalloc(sizeof(struct rte_flow_action_of_push_vlan), 0);\n+\t\tif (!push_vlan) {\n+\t\t\tplt_err(\"Error allocation memory\");\n+\t\t\treturn -ENOMEM;\n+\t\t}\n+\n+\t\twhile (free_allocs[j] != 0)\n+\t\t\tj++;\n+\t\tfree_allocs[j] = (uint64_t)push_vlan;\n+\t\tpush_vlan->ethertype = ntohs(ROC_ESWITCH_VLAN_TPID);\n+\t\tin_actions[i].type = ROC_NPC_ACTION_TYPE_VLAN_ETHTYPE_INSERT;\n+\t\tin_actions[i].conf = (struct rte_flow_action_of_push_vlan *)push_vlan;\n+\t\ti++;\n+\n+\t\t/* Add RTE_FLOW_ACTION_TYPE_OF_SET_VLAN_PCP action */\n+\t\tvlan_pcp = plt_zmalloc(sizeof(struct rte_flow_action_of_set_vlan_pcp), 0);\n+\t\tif (!vlan_pcp) {\n+\t\t\tplt_err(\"Error allocation memory\");\n+\t\t\treturn -ENOMEM;\n+\t\t}\n+\n+\t\tfree_allocs[j + 1] = (uint64_t)vlan_pcp;\n+\t\tvlan_pcp->vlan_pcp = 0;\n+\t\tin_actions[i].type = ROC_NPC_ACTION_TYPE_VLAN_PCP_INSERT;\n+\t\tin_actions[i].conf = (struct rte_flow_action_of_set_vlan_pcp *)vlan_pcp;\n+\t\ti++;\n+\n+\t\t/* Add RTE_FLOW_ACTION_TYPE_OF_SET_VLAN_VID action */\n+\t\tvlan_vid = plt_zmalloc(sizeof(struct rte_flow_action_of_set_vlan_vid), 0);\n+\t\tif (!vlan_vid) {\n+\t\t\tplt_err(\"Error allocation memory\");\n+\t\t\treturn -ENOMEM;\n+\t\t}\n+\n+\t\tfree_allocs[j + 2] = (uint64_t)vlan_vid;\n+\t\tif (act_type == RTE_FLOW_ACTION_TYPE_PORT_REPRESENTOR)\n+\t\t\tvlan_tci = rep_dev->rep_id | (1ULL << CNXK_ESWITCH_VFPF_SHIFT);\n+\t\telse\n+\t\t\tvlan_tci = rep_dev->rep_id;\n+\t\tvlan_vid->vlan_vid = ntohs(vlan_tci);\n+\t\tin_actions[i].type = ROC_NPC_ACTION_TYPE_VLAN_INSERT;\n+\t\tin_actions[i].conf = (struct rte_flow_action_of_set_vlan_vid *)vlan_vid;\n+\n+\t\t/* Change default channel to UCAST_CHAN (63) while sending */\n+\t\tnpc->rep_act_rep = true;\n+\t} else {\n+\t\tif (act_type == RTE_FLOW_ACTION_TYPE_PORT_REPRESENTOR) {\n+\t\t\t/* Case: Pattern wire port ->  Pattern RX rule->\n+\t\t\t * Action: pf_func = ESW. queue = rep_id\n+\t\t\t */\n+\t\t\tact_q = plt_zmalloc(sizeof(struct rte_flow_action_queue), 0);\n+\t\t\tif (!act_q) {\n+\t\t\t\tplt_err(\"Error allocation memory\");\n+\t\t\t\treturn -ENOMEM;\n+\t\t\t}\n+\t\t\twhile (free_allocs[j] != 0)\n+\t\t\t\tj++;\n+\t\t\tfree_allocs[j] = (uint64_t)act_q;\n+\t\t\tact_q->index = rep_dev->rep_id;\n+\n+\t\t\tin_actions[i].type = ROC_NPC_ACTION_TYPE_QUEUE;\n+\t\t\tin_actions[i].conf = (struct rte_flow_action_queue *)act_q;\n+\t\t\tnpc->rep_act_pf_func = rep_dev->parent_dev->npc.pf_func;\n+\t\t} else {\n+\t\t\t/* Case: Pattern wire port -> Pattern RX rule->\n+\t\t\t * Action: Receive at actual hw_func\n+\t\t\t */\n+\t\t\tin_actions[i].type = ROC_NPC_ACTION_TYPE_PORT_ID;\n+\t\t\tnpc->rep_act_pf_func = rep_dev->hw_func;\n+\t\t\t*dst_pf_func = rep_dev->hw_func;\n+\t\t}\n+\t}\n+done:\n+\t*act_cnt = i;\n+\n+\treturn 0;\n+}\n+\n static int\n representor_portid_action(struct roc_npc_action *in_actions, struct rte_eth_dev *portid_eth_dev,\n-\t\t\t  uint16_t *dst_pf_func, uint8_t has_tunnel_pattern, int *act_cnt)\n+\t\t\t  uint16_t *dst_pf_func, uint8_t has_tunnel_pattern, uint64_t *free_allocs,\n+\t\t\t  int *act_cnt)\n {\n \tstruct rte_eth_dev *rep_eth_dev = portid_eth_dev;\n \tstruct rte_flow_action_mark *act_mark;\n \tstruct cnxk_rep_dev *rep_dev;\n \t/* For inserting an action in the list */\n-\tint i = *act_cnt;\n+\tint i = *act_cnt, j = 0;\n \n \trep_dev = cnxk_rep_pmd_priv(rep_eth_dev);\n+\n \t*dst_pf_func = rep_dev->hw_func;\n \n \t/* Add Mark action */\n@@ -207,6 +353,9 @@ representor_portid_action(struct roc_npc_action *in_actions, struct rte_eth_dev\n \t\treturn -ENOMEM;\n \t}\n \n+\twhile (free_allocs[j] != 0)\n+\t\tj++;\n+\tfree_allocs[j] = (uint64_t)act_mark;\n \t/* Mark ID format: (tunnel type - VxLAN, Geneve << 6) | Tunnel decap */\n \tact_mark->id = has_tunnel_pattern ? ((has_tunnel_pattern << 6) | 5) : 1;\n \tin_actions[i].type = ROC_NPC_ACTION_TYPE_MARK;\n@@ -223,7 +372,8 @@ static int\n cnxk_map_actions(struct rte_eth_dev *eth_dev, const struct rte_flow_attr *attr,\n \t\t const struct rte_flow_action actions[], struct roc_npc_action in_actions[],\n \t\t struct roc_npc_action_sample *in_sample_actions, uint32_t *flowkey_cfg,\n-\t\t uint16_t *dst_pf_func, uint8_t has_tunnel_pattern)\n+\t\t uint16_t *dst_pf_func, uint8_t has_tunnel_pattern, bool is_rep,\n+\t\t uint8_t rep_pattern, uint64_t *free_allocs)\n {\n \tstruct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);\n \tconst struct rte_flow_action_queue *act_q = NULL;\n@@ -273,16 +423,48 @@ cnxk_map_actions(struct rte_eth_dev *eth_dev, const struct rte_flow_attr *attr,\n \n \t\tcase RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT:\n \t\tcase RTE_FLOW_ACTION_TYPE_PORT_REPRESENTOR:\n+\t\t\tin_actions[i].conf = actions->conf;\n+\t\t\tact_ethdev = (const struct rte_flow_action_ethdev *)actions->conf;\n+\t\t\tif (rte_eth_dev_get_name_by_port(act_ethdev->port_id, if_name)) {\n+\t\t\t\tplt_err(\"Name not found for output port id\");\n+\t\t\t\tgoto err_exit;\n+\t\t\t}\n+\t\t\tportid_eth_dev = rte_eth_dev_allocated(if_name);\n+\t\t\tif (!portid_eth_dev) {\n+\t\t\t\tplt_err(\"eth_dev not found for output port id\");\n+\t\t\t\tgoto err_exit;\n+\t\t\t}\n+\n+\t\t\tplt_rep_dbg(\"Rule installed by port %d if_name %s act_ethdev->port_id %d\",\n+\t\t\t\t    eth_dev->data->port_id, if_name, act_ethdev->port_id);\n+\t\t\tif (cnxk_ethdev_is_representor(if_name)) {\n+\t\t\t\tif (representor_rep_portid_action(in_actions, eth_dev,\n+\t\t\t\t\t\t\t\t  portid_eth_dev, actions->type,\n+\t\t\t\t\t\t\t\t  rep_pattern, dst_pf_func, is_rep,\n+\t\t\t\t\t\t\t\t  free_allocs, &i)) {\n+\t\t\t\t\tplt_err(\"Representor port action set failed\");\n+\t\t\t\t\tgoto err_exit;\n+\t\t\t\t}\n+\t\t\t} else {\n+\t\t\t\tif (actions->type == RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT)\n+\t\t\t\t\tcontinue;\n+\t\t\t\t/* Normal port as represented_port as action not supported*/\n+\t\t\t\treturn -ENOTSUP;\n+\t\t\t}\n+\t\t\tbreak;\n \t\tcase RTE_FLOW_ACTION_TYPE_PORT_ID:\n+\t\t\t/* No port ID action on representor ethdevs */\n+\t\t\tif (is_rep)\n+\t\t\t\tcontinue;\n \t\t\tin_actions[i].type = ROC_NPC_ACTION_TYPE_PORT_ID;\n \t\t\tin_actions[i].conf = actions->conf;\n-\t\t\tact_ethdev = (const struct rte_flow_action_ethdev *)\n-\t\t\t\t\t   actions->conf;\n-\t\t\tport_act = (const struct rte_flow_action_port_id *)\n-\t\t\t\t\t   actions->conf;\n+\t\t\tact_ethdev = (const struct rte_flow_action_ethdev *)actions->conf;\n+\t\t\tport_act = (const struct rte_flow_action_port_id *)actions->conf;\n \t\t\tif (rte_eth_dev_get_name_by_port(\n-\t\t\t    actions->type != RTE_FLOW_ACTION_TYPE_PORT_ID ?\n-\t\t\t    act_ethdev->port_id : port_act->id, if_name)) {\n+\t\t\t\t    actions->type != RTE_FLOW_ACTION_TYPE_PORT_ID ?\n+\t\t\t\t\t    act_ethdev->port_id :\n+\t\t\t\t\t    port_act->id,\n+\t\t\t\t    if_name)) {\n \t\t\t\tplt_err(\"Name not found for output port id\");\n \t\t\t\tgoto err_exit;\n \t\t\t}\n@@ -297,7 +479,7 @@ cnxk_map_actions(struct rte_eth_dev *eth_dev, const struct rte_flow_attr *attr,\n \t\t\t\t\t    act_ethdev->port_id);\n \t\t\t\tif (representor_portid_action(in_actions, portid_eth_dev,\n \t\t\t\t\t\t\t      dst_pf_func, has_tunnel_pattern,\n-\t\t\t\t\t\t\t      &i)) {\n+\t\t\t\t\t\t\t      free_allocs, &i)) {\n \t\t\t\t\tplt_err(\"Representor port action set failed\");\n \t\t\t\t\tgoto err_exit;\n \t\t\t\t}\n@@ -321,6 +503,9 @@ cnxk_map_actions(struct rte_eth_dev *eth_dev, const struct rte_flow_attr *attr,\n \t\t\tbreak;\n \n \t\tcase RTE_FLOW_ACTION_TYPE_RSS:\n+\t\t\t/* No RSS action on representor ethdevs */\n+\t\t\tif (is_rep)\n+\t\t\t\tcontinue;\n \t\t\trc = npc_rss_action_validate(eth_dev, attr, actions);\n \t\t\tif (rc)\n \t\t\t\tgoto err_exit;\n@@ -397,14 +582,29 @@ cnxk_map_actions(struct rte_eth_dev *eth_dev, const struct rte_flow_attr *attr,\n \n static int\n cnxk_map_pattern(struct rte_eth_dev *eth_dev, const struct rte_flow_item pattern[],\n-\t\t struct roc_npc_item_info in_pattern[], uint8_t *has_tunnel_pattern)\n+\t\t struct roc_npc_item_info in_pattern[], uint8_t *has_tunnel_pattern, bool is_rep,\n+\t\t uint8_t *rep_pattern, uint64_t *free_allocs)\n {\n-\tstruct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);\n \tconst struct rte_flow_item_ethdev *rep_eth_dev;\n \tstruct rte_eth_dev *portid_eth_dev;\n \tchar if_name[RTE_ETH_NAME_MAX_LEN];\n \tstruct cnxk_eth_dev *hw_dst;\n-\tint i = 0;\n+\tstruct cnxk_rep_dev *rdev;\n+\tstruct cnxk_eth_dev *dev;\n+\tstruct roc_npc *npc;\n+\tint i = 0, j = 0;\n+\n+\tif (!is_rep) {\n+\t\tdev = cnxk_eth_pmd_priv(eth_dev);\n+\t\tnpc = &dev->npc;\n+\t} else {\n+\t\trdev = cnxk_rep_pmd_priv(eth_dev);\n+\t\tnpc = &rdev->parent_dev->npc;\n+\n+\t\tnpc->rep_npc = npc;\n+\t\tnpc->rep_port_id = rdev->port_id;\n+\t\tnpc->rep_pf_func = rdev->hw_func;\n+\t}\n \n \twhile (pattern->type != RTE_FLOW_ITEM_TYPE_END) {\n \t\tin_pattern[i].spec = pattern->spec;\n@@ -412,7 +612,8 @@ cnxk_map_pattern(struct rte_eth_dev *eth_dev, const struct rte_flow_item pattern\n \t\tin_pattern[i].mask = pattern->mask;\n \t\tin_pattern[i].type = term[pattern->type].item_type;\n \t\tin_pattern[i].size = term[pattern->type].item_size;\n-\t\tif (pattern->type == RTE_FLOW_ITEM_TYPE_REPRESENTED_PORT) {\n+\t\tif (pattern->type == RTE_FLOW_ITEM_TYPE_REPRESENTED_PORT ||\n+\t\t    pattern->type == RTE_FLOW_ITEM_TYPE_PORT_REPRESENTOR) {\n \t\t\trep_eth_dev = (const struct rte_flow_item_ethdev *)pattern->spec;\n \t\t\tif (rte_eth_dev_get_name_by_port(rep_eth_dev->port_id, if_name)) {\n \t\t\t\tplt_err(\"Name not found for output port id\");\n@@ -423,11 +624,7 @@ cnxk_map_pattern(struct rte_eth_dev *eth_dev, const struct rte_flow_item pattern\n \t\t\t\tplt_err(\"eth_dev not found for output port id\");\n \t\t\t\tgoto fail;\n \t\t\t}\n-\t\t\tif (strcmp(portid_eth_dev->device->driver->name,\n-\t\t\t\t   eth_dev->device->driver->name) != 0) {\n-\t\t\t\tplt_err(\"Output port not under same driver\");\n-\t\t\t\tgoto fail;\n-\t\t\t}\n+\t\t\t*rep_pattern = pattern->type;\n \t\t\tif (cnxk_ethdev_is_representor(if_name)) {\n \t\t\t\t/* Case where represented port not part of same\n \t\t\t\t * app and represented by a representor port.\n@@ -437,20 +634,56 @@ cnxk_map_pattern(struct rte_eth_dev *eth_dev, const struct rte_flow_item pattern\n \n \t\t\t\trep_dev = cnxk_rep_pmd_priv(portid_eth_dev);\n \t\t\t\teswitch_dev = rep_dev->parent_dev;\n-\t\t\t\tdev->npc.rep_npc = &eswitch_dev->npc;\n-\t\t\t\tdev->npc.rep_port_id = rep_eth_dev->port_id;\n-\t\t\t\tdev->npc.rep_pf_func = rep_dev->hw_func;\n+\t\t\t\tnpc->rep_npc = &eswitch_dev->npc;\n+\t\t\t\tnpc->rep_port_id = rep_eth_dev->port_id;\n+\t\t\t\tnpc->rep_pf_func = rep_dev->hw_func;\n+\n+\t\t\t\tif (pattern->type == RTE_FLOW_ITEM_TYPE_PORT_REPRESENTOR) {\n+\t\t\t\t\tstruct rte_flow_item_vlan *vlan;\n+\n+\t\t\t\t\tnpc->rep_pf_func = eswitch_dev->npc.pf_func;\n+\t\t\t\t\t/* Add VLAN pattern corresponding to rep_id */\n+\t\t\t\t\ti++;\n+\t\t\t\t\tvlan = plt_zmalloc(sizeof(struct rte_flow_item_vlan), 0);\n+\t\t\t\t\tif (!vlan) {\n+\t\t\t\t\t\tplt_err(\"error allocation memory\");\n+\t\t\t\t\t\treturn -ENOMEM;\n+\t\t\t\t\t}\n+\n+\t\t\t\t\twhile (free_allocs[j] != 0)\n+\t\t\t\t\t\tj++;\n+\t\t\t\t\tfree_allocs[j] = (uint64_t)vlan;\n+\n+\t\t\t\t\tnpc->rep_rx_channel = ROC_ESWITCH_LBK_CHAN;\n+\t\t\t\t\tvlan->hdr.vlan_tci = RTE_BE16(rep_dev->rep_id);\n+\t\t\t\t\tin_pattern[i].spec = (struct rte_flow_item_vlan *)vlan;\n+\t\t\t\t\tin_pattern[i].last = NULL;\n+\t\t\t\t\tin_pattern[i].mask = &rte_flow_item_vlan_mask;\n+\t\t\t\t\tin_pattern[i].type =\n+\t\t\t\t\t\tterm[RTE_FLOW_ITEM_TYPE_VLAN].item_type;\n+\t\t\t\t\tin_pattern[i].size =\n+\t\t\t\t\t\tterm[RTE_FLOW_ITEM_TYPE_VLAN].item_size;\n+\t\t\t\t}\n+\t\t\t\t*rep_pattern |= 1 << IS_REP_BIT;\n \t\t\t\tplt_rep_dbg(\"Represented port %d act port %d rep_dev->hw_func 0x%x\",\n \t\t\t\t\t    rep_eth_dev->port_id, eth_dev->data->port_id,\n \t\t\t\t\t    rep_dev->hw_func);\n \t\t\t} else {\n+\t\t\t\tif (strcmp(portid_eth_dev->device->driver->name,\n+\t\t\t\t\t   eth_dev->device->driver->name) != 0) {\n+\t\t\t\t\tplt_err(\"Output port not under same driver\");\n+\t\t\t\t\tgoto fail;\n+\t\t\t\t}\n+\t\t\t\t/* Normal port as port_representor pattern can't be supported */\n+\t\t\t\tif (pattern->type == RTE_FLOW_ITEM_TYPE_PORT_REPRESENTOR)\n+\t\t\t\t\treturn -ENOTSUP;\n \t\t\t\t/* Case where represented port part of same app\n \t\t\t\t * as PF.\n \t\t\t\t */\n \t\t\t\thw_dst = portid_eth_dev->data->dev_private;\n-\t\t\t\tdev->npc.rep_npc = &hw_dst->npc;\n-\t\t\t\tdev->npc.rep_port_id = rep_eth_dev->port_id;\n-\t\t\t\tdev->npc.rep_pf_func = hw_dst->npc.pf_func;\n+\t\t\t\tnpc->rep_npc = &hw_dst->npc;\n+\t\t\t\tnpc->rep_port_id = rep_eth_dev->port_id;\n+\t\t\t\tnpc->rep_pf_func = hw_dst->npc.pf_func;\n \t\t\t}\n \t\t}\n \n@@ -474,56 +707,96 @@ cnxk_map_flow_data(struct rte_eth_dev *eth_dev, const struct rte_flow_attr *attr\n \t\t   struct roc_npc_attr *in_attr, struct roc_npc_item_info in_pattern[],\n \t\t   struct roc_npc_action in_actions[],\n \t\t   struct roc_npc_action_sample *in_sample_actions, uint32_t *flowkey_cfg,\n-\t\t   uint16_t *dst_pf_func)\n+\t\t   uint16_t *dst_pf_func, bool is_rep, uint64_t *free_allocs)\n {\n-\tuint8_t has_tunnel_pattern = 0;\n+\tuint8_t has_tunnel_pattern = 0, rep_pattern = 0;\n \tint rc;\n \n \tin_attr->priority = attr->priority;\n \tin_attr->ingress = attr->ingress;\n \tin_attr->egress = attr->egress;\n \n-\trc = cnxk_map_pattern(eth_dev, pattern, in_pattern, &has_tunnel_pattern);\n+\trc = cnxk_map_pattern(eth_dev, pattern, in_pattern, &has_tunnel_pattern, is_rep,\n+\t\t\t      &rep_pattern, free_allocs);\n \tif (rc) {\n \t\tplt_err(\"Failed to map pattern list\");\n \t\treturn rc;\n \t}\n \n+\tif (attr->transfer) {\n+\t\t/* rep_pattern is used to identify if RTE_FLOW_ITEM_TYPE_REPRESENTED_PORT\n+\t\t * OR RTE_FLOW_ITEM_TYPE_PORT_REPRESENTOR is defined + if pattern's portid is\n+\t\t * normal port or representor port.\n+\t\t * For normal port_id, rep_pattern = pattern-> type\n+\t\t * For representor port, rep_pattern = pattern-> type | 1 << IS_REP_BIT\n+\t\t */\n+\t\tif (is_rep || rep_pattern) {\n+\t\t\tif (rep_pattern == RTE_FLOW_ITEM_TYPE_REPRESENTED_PORT ||\n+\t\t\t    ((rep_pattern & 0x7f) == RTE_FLOW_ITEM_TYPE_PORT_REPRESENTOR))\n+\t\t\t\t/* If pattern is port_representor or pattern has normal port as\n+\t\t\t\t * represented port, install ingress rule.\n+\t\t\t\t */\n+\t\t\t\tin_attr->ingress = attr->transfer;\n+\t\t\telse\n+\t\t\t\tin_attr->egress = attr->transfer;\n+\t\t} else {\n+\t\t\tin_attr->ingress = attr->transfer;\n+\t\t}\n+\t}\n+\n \treturn cnxk_map_actions(eth_dev, attr, actions, in_actions, in_sample_actions, flowkey_cfg,\n-\t\t\t\tdst_pf_func, has_tunnel_pattern);\n+\t\t\t\tdst_pf_func, has_tunnel_pattern, is_rep, rep_pattern, free_allocs);\n }\n \n-static int\n-cnxk_flow_validate(struct rte_eth_dev *eth_dev, const struct rte_flow_attr *attr,\n-\t\t   const struct rte_flow_item pattern[], const struct rte_flow_action actions[],\n-\t\t   struct rte_flow_error *error)\n+int\n+cnxk_flow_validate_common(struct rte_eth_dev *eth_dev, const struct rte_flow_attr *attr,\n+\t\t\t  const struct rte_flow_item pattern[],\n+\t\t\t  const struct rte_flow_action actions[], struct rte_flow_error *error,\n+\t\t\t  bool is_rep)\n {\n \tstruct roc_npc_item_info in_pattern[ROC_NPC_ITEM_TYPE_END + 1];\n \tstruct roc_npc_action in_actions[ROC_NPC_MAX_ACTION_COUNT];\n-\tstruct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);\n \tstruct roc_npc_action_sample in_sample_action;\n-\tstruct roc_npc *npc = &dev->npc;\n+\tstruct cnxk_rep_dev *rep_dev;\n \tstruct roc_npc_attr in_attr;\n+\tuint64_t *free_allocs, sz;\n+\tstruct cnxk_eth_dev *dev;\n \tstruct roc_npc_flow flow;\n \tuint32_t flowkey_cfg = 0;\n \tuint16_t dst_pf_func = 0;\n-\tint rc;\n-\n-\t/* Skip flow validation for MACsec. */\n-\tif (actions[0].type == RTE_FLOW_ACTION_TYPE_SECURITY &&\n-\t    cnxk_eth_macsec_sess_get_by_sess(dev, actions[0].conf) != NULL)\n-\t\treturn 0;\n+\tstruct roc_npc *npc;\n+\tint rc, j;\n+\n+\t/* is_rep set for operation performed via representor ports */\n+\tif (!is_rep) {\n+\t\tdev = cnxk_eth_pmd_priv(eth_dev);\n+\t\tnpc = &dev->npc;\n+\t\t/* Skip flow validation for MACsec. */\n+\t\tif (actions[0].type == RTE_FLOW_ACTION_TYPE_SECURITY &&\n+\t\t    cnxk_eth_macsec_sess_get_by_sess(dev, actions[0].conf) != NULL)\n+\t\t\treturn 0;\n+\t} else {\n+\t\trep_dev = cnxk_rep_pmd_priv(eth_dev);\n+\t\tnpc = &rep_dev->parent_dev->npc;\n+\t}\n \n \tmemset(&flow, 0, sizeof(flow));\n \tmemset(&in_sample_action, 0, sizeof(in_sample_action));\n \tflow.is_validate = true;\n \n+\tsz = ROC_NPC_MAX_ACTION_COUNT + ROC_NPC_ITEM_TYPE_END + 1;\n+\tfree_allocs = plt_zmalloc(sz * sizeof(uint64_t), 0);\n+\tif (!free_allocs) {\n+\t\trte_flow_error_set(error, -ENOMEM, RTE_FLOW_ERROR_TYPE_ACTION_NUM, NULL,\n+\t\t\t\t   \"Failed to map flow data\");\n+\t\treturn -ENOMEM;\n+\t}\n \trc = cnxk_map_flow_data(eth_dev, attr, pattern, actions, &in_attr, in_pattern, in_actions,\n-\t\t\t\t&in_sample_action, &flowkey_cfg, &dst_pf_func);\n+\t\t\t\t&in_sample_action, &flowkey_cfg, &dst_pf_func, is_rep, free_allocs);\n \tif (rc) {\n \t\trte_flow_error_set(error, 0, RTE_FLOW_ERROR_TYPE_ACTION_NUM, NULL,\n \t\t\t\t   \"Failed to map flow data\");\n-\t\treturn rc;\n+\t\tgoto clean;\n \t}\n \n \trc = roc_npc_flow_parse(npc, &in_attr, in_pattern, in_actions, &flow);\n@@ -531,73 +804,147 @@ cnxk_flow_validate(struct rte_eth_dev *eth_dev, const struct rte_flow_attr *attr\n \tif (rc) {\n \t\trte_flow_error_set(error, 0, rc, NULL,\n \t\t\t\t   \"Flow validation failed\");\n-\t\treturn rc;\n+\t\tgoto clean;\n \t}\n-\treturn 0;\n+clean:\n+\t/* Freeing the allocations done for additional patterns/actions */\n+\tfor (j = 0; (j < (int)sz) && free_allocs[j]; j++)\n+\t\tplt_free((void *)free_allocs[j]);\n+\tplt_free(free_allocs);\n+\n+\treturn rc;\n+}\n+\n+static int\n+cnxk_flow_validate(struct rte_eth_dev *eth_dev, const struct rte_flow_attr *attr,\n+\t\t   const struct rte_flow_item pattern[], const struct rte_flow_action actions[],\n+\t\t   struct rte_flow_error *error)\n+{\n+\treturn cnxk_flow_validate_common(eth_dev, attr, pattern, actions, error, false);\n }\n \n struct roc_npc_flow *\n-cnxk_flow_create(struct rte_eth_dev *eth_dev, const struct rte_flow_attr *attr,\n-\t\t const struct rte_flow_item pattern[],\n-\t\t const struct rte_flow_action actions[],\n-\t\t struct rte_flow_error *error)\n+cnxk_flow_create_common(struct rte_eth_dev *eth_dev, const struct rte_flow_attr *attr,\n+\t\t\tconst struct rte_flow_item pattern[],\n+\t\t\tconst struct rte_flow_action actions[], struct rte_flow_error *error,\n+\t\t\tbool is_rep)\n {\n-\tstruct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);\n \tstruct roc_npc_item_info in_pattern[ROC_NPC_ITEM_TYPE_END + 1];\n \tstruct roc_npc_action in_actions[ROC_NPC_MAX_ACTION_COUNT];\n \tstruct roc_npc_action_sample in_sample_action;\n-\tstruct roc_npc *npc = &dev->npc;\n+\tstruct cnxk_rep_dev *rep_dev = NULL;\n+\tstruct roc_npc_flow *flow = NULL;\n+\tstruct cnxk_eth_dev *dev = NULL;\n \tstruct roc_npc_attr in_attr;\n-\tstruct roc_npc_flow *flow;\n+\tuint64_t *free_allocs, sz;\n \tuint16_t dst_pf_func = 0;\n+\tstruct roc_npc *npc;\n \tint errcode = 0;\n-\tint rc;\n+\tint rc, j;\n+\n+\t/* is_rep set for operation performed via representor ports */\n+\tif (!is_rep) {\n+\t\tdev = cnxk_eth_pmd_priv(eth_dev);\n+\t\tnpc = &dev->npc;\n+\t} else {\n+\t\trep_dev = cnxk_rep_pmd_priv(eth_dev);\n+\t\tnpc = &rep_dev->parent_dev->npc;\n+\t}\n \n+\tsz = ROC_NPC_MAX_ACTION_COUNT + ROC_NPC_ITEM_TYPE_END + 1;\n+\tfree_allocs = plt_zmalloc(sz * sizeof(uint64_t), 0);\n+\tif (!free_allocs) {\n+\t\trte_flow_error_set(error, -ENOMEM, RTE_FLOW_ERROR_TYPE_ACTION_NUM, NULL,\n+\t\t\t\t   \"Failed to map flow data\");\n+\t\treturn NULL;\n+\t}\n \tmemset(&in_sample_action, 0, sizeof(in_sample_action));\n \tmemset(&in_attr, 0, sizeof(struct roc_npc_attr));\n \trc = cnxk_map_flow_data(eth_dev, attr, pattern, actions, &in_attr, in_pattern, in_actions,\n-\t\t\t\t&in_sample_action, &npc->flowkey_cfg_state, &dst_pf_func);\n+\t\t\t\t&in_sample_action, &npc->flowkey_cfg_state, &dst_pf_func, is_rep,\n+\t\t\t\tfree_allocs);\n \tif (rc) {\n-\t\trte_flow_error_set(error, 0, RTE_FLOW_ERROR_TYPE_ACTION_NUM, NULL,\n+\t\trte_flow_error_set(error, rc, RTE_FLOW_ERROR_TYPE_ACTION_NUM, NULL,\n \t\t\t\t   \"Failed to map flow data\");\n-\t\treturn NULL;\n+\t\tgoto clean;\n \t}\n \n \tflow = roc_npc_flow_create(npc, &in_attr, in_pattern, in_actions, dst_pf_func, &errcode);\n \tif (errcode != 0) {\n \t\trte_flow_error_set(error, errcode, errcode, NULL, roc_error_msg_get(errcode));\n-\t\treturn NULL;\n+\t\tgoto clean;\n \t}\n \n+clean:\n+\t/* Freeing the allocations done for additional patterns/actions */\n+\tfor (j = 0; (j < (int)sz) && free_allocs[j]; j++)\n+\t\tplt_free((void *)free_allocs[j]);\n+\tplt_free(free_allocs);\n+\n \treturn flow;\n }\n \n+struct roc_npc_flow *\n+cnxk_flow_create(struct rte_eth_dev *eth_dev, const struct rte_flow_attr *attr,\n+\t\t const struct rte_flow_item pattern[], const struct rte_flow_action actions[],\n+\t\t struct rte_flow_error *error)\n+{\n+\treturn cnxk_flow_create_common(eth_dev, attr, pattern, actions, error, false);\n+}\n+\n int\n-cnxk_flow_destroy(struct rte_eth_dev *eth_dev, struct roc_npc_flow *flow,\n-\t\t  struct rte_flow_error *error)\n+cnxk_flow_destroy_common(struct rte_eth_dev *eth_dev, struct roc_npc_flow *flow,\n+\t\t\t struct rte_flow_error *error, bool is_rep)\n {\n-\tstruct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);\n-\tstruct roc_npc *npc = &dev->npc;\n+\tstruct cnxk_rep_dev *rep_dev;\n+\tstruct cnxk_eth_dev *dev;\n+\tstruct roc_npc *npc;\n \tint rc;\n \n+\t/* is_rep set for operation performed via representor ports */\n+\tif (!is_rep) {\n+\t\tdev = cnxk_eth_pmd_priv(eth_dev);\n+\t\tnpc = &dev->npc;\n+\t} else {\n+\t\trep_dev = cnxk_rep_pmd_priv(eth_dev);\n+\t\tnpc = &rep_dev->parent_dev->npc;\n+\t}\n+\n \trc = roc_npc_flow_destroy(npc, flow);\n \tif (rc)\n-\t\trte_flow_error_set(error, rc, RTE_FLOW_ERROR_TYPE_UNSPECIFIED,\n-\t\t\t\t   NULL, \"Flow Destroy failed\");\n+\t\trte_flow_error_set(error, rc, RTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL,\n+\t\t\t\t   \"Flow Destroy failed\");\n \treturn rc;\n }\n \n-static int\n-cnxk_flow_flush(struct rte_eth_dev *eth_dev, struct rte_flow_error *error)\n+int\n+cnxk_flow_destroy(struct rte_eth_dev *eth_dev, struct roc_npc_flow *flow,\n+\t\t  struct rte_flow_error *error)\n {\n-\tstruct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);\n-\tstruct roc_npc *npc = &dev->npc;\n+\treturn cnxk_flow_destroy_common(eth_dev, flow, error, false);\n+}\n+\n+int\n+cnxk_flow_flush_common(struct rte_eth_dev *eth_dev, struct rte_flow_error *error, bool is_rep)\n+{\n+\tstruct cnxk_rep_dev *rep_dev;\n+\tstruct cnxk_eth_dev *dev;\n+\tstruct roc_npc *npc;\n \tint rc;\n \n+\t/* is_rep set for operation performed via representor ports */\n+\tif (!is_rep) {\n+\t\tdev = cnxk_eth_pmd_priv(eth_dev);\n+\t\tnpc = &dev->npc;\n+\t} else {\n+\t\trep_dev = cnxk_rep_pmd_priv(eth_dev);\n+\t\tnpc = &rep_dev->parent_dev->npc;\n+\t}\n+\n \trc = roc_npc_mcam_free_all_resources(npc);\n \tif (rc) {\n-\t\trte_flow_error_set(error, EIO, RTE_FLOW_ERROR_TYPE_UNSPECIFIED,\n-\t\t\t\t   NULL, \"Failed to flush filter\");\n+\t\trte_flow_error_set(error, EIO, RTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL,\n+\t\t\t\t   \"Failed to flush filter\");\n \t\treturn -rte_errno;\n \t}\n \n@@ -605,14 +952,21 @@ cnxk_flow_flush(struct rte_eth_dev *eth_dev, struct rte_flow_error *error)\n }\n \n static int\n-cnxk_flow_query(struct rte_eth_dev *eth_dev, struct rte_flow *flow,\n-\t\tconst struct rte_flow_action *action, void *data,\n-\t\tstruct rte_flow_error *error)\n+cnxk_flow_flush(struct rte_eth_dev *eth_dev, struct rte_flow_error *error)\n+{\n+\treturn cnxk_flow_flush_common(eth_dev, error, false);\n+}\n+\n+int\n+cnxk_flow_query_common(struct rte_eth_dev *eth_dev, struct rte_flow *flow,\n+\t\t       const struct rte_flow_action *action, void *data,\n+\t\t       struct rte_flow_error *error, bool is_rep)\n {\n \tstruct roc_npc_flow *in_flow = (struct roc_npc_flow *)flow;\n-\tstruct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);\n-\tstruct roc_npc *npc = &dev->npc;\n \tstruct rte_flow_query_count *query = data;\n+\tstruct cnxk_rep_dev *rep_dev;\n+\tstruct cnxk_eth_dev *dev;\n+\tstruct roc_npc *npc;\n \tconst char *errmsg = NULL;\n \tint errcode = ENOTSUP;\n \tint rc;\n@@ -627,6 +981,15 @@ cnxk_flow_query(struct rte_eth_dev *eth_dev, struct rte_flow *flow,\n \t\tgoto err_exit;\n \t}\n \n+\t/* is_rep set for operation performed via representor ports */\n+\tif (!is_rep) {\n+\t\tdev = cnxk_eth_pmd_priv(eth_dev);\n+\t\tnpc = &dev->npc;\n+\t} else {\n+\t\trep_dev = cnxk_rep_pmd_priv(eth_dev);\n+\t\tnpc = &rep_dev->parent_dev->npc;\n+\t}\n+\n \tif (in_flow->use_pre_alloc)\n \t\trc = roc_npc_inl_mcam_read_counter(in_flow->ctr_id, &query->hits);\n \telse\n@@ -660,8 +1023,15 @@ cnxk_flow_query(struct rte_eth_dev *eth_dev, struct rte_flow *flow,\n }\n \n static int\n-cnxk_flow_isolate(struct rte_eth_dev *eth_dev __rte_unused,\n-\t\t  int enable __rte_unused, struct rte_flow_error *error)\n+cnxk_flow_query(struct rte_eth_dev *eth_dev, struct rte_flow *flow,\n+\t\tconst struct rte_flow_action *action, void *data, struct rte_flow_error *error)\n+{\n+\treturn cnxk_flow_query_common(eth_dev, flow, action, data, error, false);\n+}\n+\n+static int\n+cnxk_flow_isolate(struct rte_eth_dev *eth_dev __rte_unused, int enable __rte_unused,\n+\t\t  struct rte_flow_error *error)\n {\n \t/* If we support, we need to un-install the default mcam\n \t * entry for this port.\n@@ -673,16 +1043,25 @@ cnxk_flow_isolate(struct rte_eth_dev *eth_dev __rte_unused,\n \treturn -rte_errno;\n }\n \n-static int\n-cnxk_flow_dev_dump(struct rte_eth_dev *eth_dev, struct rte_flow *flow,\n-\t\t   FILE *file, struct rte_flow_error *error)\n+int\n+cnxk_flow_dev_dump_common(struct rte_eth_dev *eth_dev, struct rte_flow *flow, FILE *file,\n+\t\t\t  struct rte_flow_error *error, bool is_rep)\n {\n-\tstruct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);\n-\tstruct roc_npc *npc = &dev->npc;\n+\tstruct cnxk_rep_dev *rep_dev;\n+\tstruct cnxk_eth_dev *dev;\n+\tstruct roc_npc *npc;\n+\n+\t/* is_rep set for operation performed via representor ports */\n+\tif (!is_rep) {\n+\t\tdev = cnxk_eth_pmd_priv(eth_dev);\n+\t\tnpc = &dev->npc;\n+\t} else {\n+\t\trep_dev = cnxk_rep_pmd_priv(eth_dev);\n+\t\tnpc = &rep_dev->parent_dev->npc;\n+\t}\n \n \tif (file == NULL) {\n-\t\trte_flow_error_set(error, EINVAL,\n-\t\t\t\t   RTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL,\n+\t\trte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL,\n \t\t\t\t   \"Invalid file\");\n \t\treturn -rte_errno;\n \t}\n@@ -701,8 +1080,15 @@ cnxk_flow_dev_dump(struct rte_eth_dev *eth_dev, struct rte_flow *flow,\n }\n \n static int\n-cnxk_flow_get_aged_flows(struct rte_eth_dev *eth_dev, void **context,\n-\t\t\t uint32_t nb_contexts, struct rte_flow_error *err)\n+cnxk_flow_dev_dump(struct rte_eth_dev *eth_dev, struct rte_flow *flow, FILE *file,\n+\t\t   struct rte_flow_error *error)\n+{\n+\treturn cnxk_flow_dev_dump_common(eth_dev, flow, file, error, false);\n+}\n+\n+static int\n+cnxk_flow_get_aged_flows(struct rte_eth_dev *eth_dev, void **context, uint32_t nb_contexts,\n+\t\t\t struct rte_flow_error *err)\n {\n \tstruct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);\n \tstruct roc_npc *roc_npc = &dev->npc;\ndiff --git a/drivers/net/cnxk/cnxk_flow.h b/drivers/net/cnxk/cnxk_flow.h\nindex bb23629819..226694fbed 100644\n--- a/drivers/net/cnxk/cnxk_flow.h\n+++ b/drivers/net/cnxk/cnxk_flow.h\n@@ -24,4 +24,22 @@ struct roc_npc_flow *cnxk_flow_create(struct rte_eth_dev *dev,\n int cnxk_flow_destroy(struct rte_eth_dev *dev, struct roc_npc_flow *flow,\n \t\t      struct rte_flow_error *error);\n \n+struct roc_npc_flow *cnxk_flow_create_common(struct rte_eth_dev *eth_dev,\n+\t\t\t\t\t     const struct rte_flow_attr *attr,\n+\t\t\t\t\t     const struct rte_flow_item pattern[],\n+\t\t\t\t\t     const struct rte_flow_action actions[],\n+\t\t\t\t\t     struct rte_flow_error *error, bool is_rep);\n+int cnxk_flow_validate_common(struct rte_eth_dev *eth_dev, const struct rte_flow_attr *attr,\n+\t\t\t      const struct rte_flow_item pattern[],\n+\t\t\t      const struct rte_flow_action actions[], struct rte_flow_error *error,\n+\t\t\t      bool is_rep);\n+int cnxk_flow_destroy_common(struct rte_eth_dev *eth_dev, struct roc_npc_flow *flow,\n+\t\t\t     struct rte_flow_error *error, bool is_rep);\n+int cnxk_flow_flush_common(struct rte_eth_dev *eth_dev, struct rte_flow_error *error, bool is_rep);\n+int cnxk_flow_query_common(struct rte_eth_dev *eth_dev, struct rte_flow *flow,\n+\t\t\t   const struct rte_flow_action *action, void *data,\n+\t\t\t   struct rte_flow_error *error, bool is_rep);\n+int cnxk_flow_dev_dump_common(struct rte_eth_dev *eth_dev, struct rte_flow *flow, FILE *file,\n+\t\t\t      struct rte_flow_error *error, bool is_rep);\n+\n #endif /* __CNXK_RTE_FLOW_H__ */\n",
    "prefixes": [
        "v4",
        "21/23"
    ]
}