get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 137826,
    "url": "https://patches.dpdk.org/api/patches/137826/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/20240303173833.100039-13-hkalra@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": "<20240303173833.100039-13-hkalra@marvell.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20240303173833.100039-13-hkalra@marvell.com",
    "date": "2024-03-03T17:38:22",
    "name": "[v6,12/23] net/cnxk: handling representee notification",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "d16da098026262d9b76ece5b1386207cb349225b",
    "submitter": {
        "id": 1182,
        "url": "https://patches.dpdk.org/api/people/1182/?format=api",
        "name": "Harman Kalra",
        "email": "hkalra@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/20240303173833.100039-13-hkalra@marvell.com/mbox/",
    "series": [
        {
            "id": 31353,
            "url": "https://patches.dpdk.org/api/series/31353/?format=api",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=31353",
            "date": "2024-03-03T17:38:10",
            "name": "net/cnxk: support for port representors",
            "version": 6,
            "mbox": "https://patches.dpdk.org/series/31353/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/137826/comments/",
    "check": "success",
    "checks": "https://patches.dpdk.org/api/patches/137826/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 8D01543C3E;\n\tSun,  3 Mar 2024 18:40:17 +0100 (CET)",
            "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 324B943678;\n\tSun,  3 Mar 2024 18:39:20 +0100 (CET)",
            "from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com\n [67.231.148.174])\n by mails.dpdk.org (Postfix) with ESMTP id 4615543681\n for <dev@dpdk.org>; Sun,  3 Mar 2024 18:39:18 +0100 (CET)",
            "from pps.filterd (m0045849.ppops.net [127.0.0.1])\n by mx0a-0016f401.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id\n 423DmDEJ014917 for <dev@dpdk.org>; Sun, 3 Mar 2024 09:39:17 -0800",
            "from dc5-exch05.marvell.com ([199.233.59.128])\n by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3wm2bptru2-1\n (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT)\n for <dev@dpdk.org>; Sun, 03 Mar 2024 09:39:17 -0800 (PST)",
            "from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH05.marvell.com\n (10.69.176.209) with Microsoft SMTP Server (version=TLS1_2,\n cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.2.1258.12; Sun, 3 Mar\n 2024 09:39:16 -0800",
            "from DC5-EXCH05.marvell.com (10.69.176.209) by\n DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id\n 15.0.1497.48; Sun, 3 Mar 2024 09:39:14 -0800",
            "from maili.marvell.com (10.69.176.80) by DC5-EXCH05.marvell.com\n (10.69.176.209) with Microsoft SMTP Server id 15.2.1258.12 via Frontend\n Transport; Sun, 3 Mar 2024 09:39:14 -0800",
            "from localhost.localdomain (unknown [10.29.52.211])\n by maili.marvell.com (Postfix) with ESMTP id DC9DA3F71A2;\n Sun,  3 Mar 2024 09:39:11 -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=99BwmvIT1zjt/9wAQ+O4i\n Ur5siezBA9p3iBJYQDC32g=; b=NCcmaUCNVdR5j/7prIRAlOpF+HBCW9LKQLTod\n BPvOtU8FdKp+7wOP6zkCzz7wd9Ul33hTy5ley/BJ8vb2ZWbdhDY4e6Fh7WLvtaaE\n 5+zG3FT26qDWgy8eYW/Fu7kBhgS7pQhKDvWHXs5VEJz8bzlLOGbLT6X65YfPoKkk\n VjarMBnJMUAhPVijTmylyS66uCjZqsgc9iemw+JQjNzEzuLCFHUmkf5X8fTEmLM+\n TLQ7WDHiEWrLOpXOX0IKLCO3vaRiUyIEqyHf8C0sOoVNfVLrdkSAKoVVTd6NiCGE\n RGTtyVpQfsDEnQbeAYK9hshCaR2w6gYsh8gWTcYxN6JMN0Qyg==",
        "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 v6 12/23] net/cnxk: handling representee notification",
        "Date": "Sun, 3 Mar 2024 23:08:22 +0530",
        "Message-ID": "<20240303173833.100039-13-hkalra@marvell.com>",
        "X-Mailer": "git-send-email 2.18.0",
        "In-Reply-To": "<20240303173833.100039-1-hkalra@marvell.com>",
        "References": "<20230811163419.165790-1-hkalra@marvell.com>\n <20240303173833.100039-1-hkalra@marvell.com>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain",
        "X-Proofpoint-GUID": "spKArhu7o-tcwYHnTXNkWFQqUqtl9Xwn",
        "X-Proofpoint-ORIG-GUID": "spKArhu7o-tcwYHnTXNkWFQqUqtl9Xwn",
        "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-03-03_08,2024-03-01_03,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": "In case of any representee coming up or going down, kernel sends a\nmbox up call which signals a thread to process these messages and\nenable/disable HW resources accordingly.\n\nSigned-off-by: Harman Kalra <hkalra@marvell.com>\n---\n drivers/net/cnxk/cnxk_eswitch.c |   8 +\n drivers/net/cnxk/cnxk_eswitch.h |  19 ++\n drivers/net/cnxk/cnxk_rep.c     | 326 ++++++++++++++++++++++++++++++++\n drivers/net/cnxk/cnxk_rep.h     |  37 ++++\n 4 files changed, 390 insertions(+)",
    "diff": "diff --git a/drivers/net/cnxk/cnxk_eswitch.c b/drivers/net/cnxk/cnxk_eswitch.c\nindex 14d0df8791..f420d01ef8 100644\n--- a/drivers/net/cnxk/cnxk_eswitch.c\n+++ b/drivers/net/cnxk/cnxk_eswitch.c\n@@ -139,6 +139,14 @@ cnxk_eswitch_dev_remove(struct rte_pci_device *pci_dev)\n \t\t\t\tclose(sock_fd);\n \t\t}\n \n+\t\tif (eswitch_dev->repte_msg_proc.start_thread) {\n+\t\t\teswitch_dev->repte_msg_proc.start_thread = false;\n+\t\t\tpthread_cond_signal(&eswitch_dev->repte_msg_proc.repte_msg_cond);\n+\t\t\trte_thread_join(eswitch_dev->repte_msg_proc.repte_msg_thread, NULL);\n+\t\t\tpthread_mutex_destroy(&eswitch_dev->repte_msg_proc.mutex);\n+\t\t\tpthread_cond_destroy(&eswitch_dev->repte_msg_proc.repte_msg_cond);\n+\t\t}\n+\n \t\t/* Remove representor devices associated with PF */\n \t\tcnxk_rep_dev_remove(eswitch_dev);\n \t}\ndiff --git a/drivers/net/cnxk/cnxk_eswitch.h b/drivers/net/cnxk/cnxk_eswitch.h\nindex ecf10a8e08..0275e760fb 100644\n--- a/drivers/net/cnxk/cnxk_eswitch.h\n+++ b/drivers/net/cnxk/cnxk_eswitch.h\n@@ -30,6 +30,22 @@ enum cnxk_esw_da_pattern_type {\n \tCNXK_ESW_DA_TYPE_PFVF,\n };\n \n+struct cnxk_esw_repte_msg {\n+\tstruct roc_eswitch_repte_notify_msg *notify_msg;\n+\n+\tTAILQ_ENTRY(cnxk_esw_repte_msg) next;\n+};\n+\n+struct cnxk_esw_repte_msg_proc {\n+\tbool start_thread;\n+\tuint8_t msg_avail;\n+\trte_thread_t repte_msg_thread;\n+\tpthread_cond_t repte_msg_cond;\n+\tpthread_mutex_t mutex;\n+\n+\tTAILQ_HEAD(esw_repte_msg_list, cnxk_esw_repte_msg) msg_list;\n+};\n+\n struct cnxk_esw_repr_hw_info {\n \t/* Representee pcifunc value */\n \tuint16_t hw_func;\n@@ -139,6 +155,9 @@ struct cnxk_eswitch_dev {\n \tbool client_connected;\n \tint sock_fd;\n \n+\t/* Representee notification */\n+\tstruct cnxk_esw_repte_msg_proc repte_msg_proc;\n+\n \t/* Port representor fields */\n \trte_spinlock_t rep_lock;\n \tuint16_t nb_switch_domain;\ndiff --git a/drivers/net/cnxk/cnxk_rep.c b/drivers/net/cnxk/cnxk_rep.c\nindex 5b619ebb9e..dc00cdecc1 100644\n--- a/drivers/net/cnxk/cnxk_rep.c\n+++ b/drivers/net/cnxk/cnxk_rep.c\n@@ -4,6 +4,8 @@\n #include <cnxk_rep.h>\n #include <cnxk_rep_msg.h>\n \n+#define REPTE_MSG_PROC_THRD_NAME_MAX_LEN 30\n+\n #define PF_SHIFT 10\n #define PF_MASK\t 0x3F\n \n@@ -86,6 +88,7 @@ cnxk_rep_dev_remove(struct cnxk_eswitch_dev *eswitch_dev)\n {\n \tint i, rc = 0;\n \n+\troc_eswitch_nix_process_repte_notify_cb_unregister(&eswitch_dev->nix);\n \tfor (i = 0; i < eswitch_dev->nb_switch_domain; i++) {\n \t\trc = rte_eth_switch_domain_free(eswitch_dev->sw_dom[i].switch_domain_id);\n \t\tif (rc)\n@@ -95,6 +98,299 @@ cnxk_rep_dev_remove(struct cnxk_eswitch_dev *eswitch_dev)\n \treturn rc;\n }\n \n+static int\n+cnxk_representee_release(struct cnxk_eswitch_dev *eswitch_dev, uint16_t hw_func)\n+{\n+\tstruct cnxk_rep_dev *rep_dev = NULL;\n+\tstruct rte_eth_dev *rep_eth_dev;\n+\tint i, rc = 0;\n+\n+\tfor (i = 0; i < eswitch_dev->repr_cnt.nb_repr_probed; i++) {\n+\t\trep_eth_dev = eswitch_dev->rep_info[i].rep_eth_dev;\n+\t\tif (!rep_eth_dev) {\n+\t\t\tplt_err(\"Failed to get rep ethdev handle\");\n+\t\t\trc = -EINVAL;\n+\t\t\tgoto done;\n+\t\t}\n+\n+\t\trep_dev = cnxk_rep_pmd_priv(rep_eth_dev);\n+\t\tif (rep_dev->hw_func == hw_func &&\n+\t\t    (!rep_dev->native_repte || rep_dev->is_vf_active)) {\n+\t\t\trep_dev->is_vf_active = false;\n+\t\t\trc = cnxk_rep_dev_stop(rep_eth_dev);\n+\t\t\tif (rc) {\n+\t\t\t\tplt_err(\"Failed to stop repr port %d, rep id %d\", rep_dev->port_id,\n+\t\t\t\t\trep_dev->rep_id);\n+\t\t\t\tgoto done;\n+\t\t\t}\n+\n+\t\t\tcnxk_rep_rx_queue_release(rep_eth_dev, 0);\n+\t\t\tcnxk_rep_tx_queue_release(rep_eth_dev, 0);\n+\t\t\tplt_rep_dbg(\"Released representor ID %d representing %x\", rep_dev->rep_id,\n+\t\t\t\t    hw_func);\n+\t\t\tbreak;\n+\t\t}\n+\t}\n+done:\n+\treturn rc;\n+}\n+\n+static int\n+cnxk_representee_setup(struct cnxk_eswitch_dev *eswitch_dev, uint16_t hw_func, uint16_t rep_id)\n+{\n+\tstruct cnxk_rep_dev *rep_dev = NULL;\n+\tstruct rte_eth_dev *rep_eth_dev;\n+\tint i, rc = 0;\n+\n+\tfor (i = 0; i < eswitch_dev->repr_cnt.nb_repr_probed; i++) {\n+\t\trep_eth_dev = eswitch_dev->rep_info[i].rep_eth_dev;\n+\t\tif (!rep_eth_dev) {\n+\t\t\tplt_err(\"Failed to get rep ethdev handle\");\n+\t\t\trc = -EINVAL;\n+\t\t\tgoto done;\n+\t\t}\n+\n+\t\trep_dev = cnxk_rep_pmd_priv(rep_eth_dev);\n+\t\tif (rep_dev->hw_func == hw_func && !rep_dev->is_vf_active) {\n+\t\t\trep_dev->is_vf_active = true;\n+\t\t\trep_dev->native_repte = true;\n+\t\t\tif (rep_dev->rep_id != rep_id) {\n+\t\t\t\tplt_err(\"Rep ID assigned during init %d does not match %d\",\n+\t\t\t\t\trep_dev->rep_id, rep_id);\n+\t\t\t\trc = -EINVAL;\n+\t\t\t\tgoto done;\n+\t\t\t}\n+\n+\t\t\trc = cnxk_rep_rx_queue_setup(rep_eth_dev, rep_dev->rxq->qid,\n+\t\t\t\t\t\t     rep_dev->rxq->nb_desc, 0,\n+\t\t\t\t\t\t     rep_dev->rxq->rx_conf, rep_dev->rxq->mpool);\n+\t\t\tif (rc) {\n+\t\t\t\tplt_err(\"Failed to setup rxq repr port %d, rep id %d\",\n+\t\t\t\t\trep_dev->port_id, rep_dev->rep_id);\n+\t\t\t\tgoto done;\n+\t\t\t}\n+\n+\t\t\trc = cnxk_rep_tx_queue_setup(rep_eth_dev, rep_dev->txq->qid,\n+\t\t\t\t\t\t     rep_dev->txq->nb_desc, 0,\n+\t\t\t\t\t\t     rep_dev->txq->tx_conf);\n+\t\t\tif (rc) {\n+\t\t\t\tplt_err(\"Failed to setup txq repr port %d, rep id %d\",\n+\t\t\t\t\trep_dev->port_id, rep_dev->rep_id);\n+\t\t\t\tgoto done;\n+\t\t\t}\n+\n+\t\t\trc = cnxk_rep_dev_start(rep_eth_dev);\n+\t\t\tif (rc) {\n+\t\t\t\tplt_err(\"Failed to start repr port %d, rep id %d\", rep_dev->port_id,\n+\t\t\t\t\trep_dev->rep_id);\n+\t\t\t\tgoto done;\n+\t\t\t}\n+\t\t\tbreak;\n+\t\t}\n+\t}\n+done:\n+\treturn rc;\n+}\n+\n+static int\n+cnxk_representee_state_msg_process(struct cnxk_eswitch_dev *eswitch_dev, uint16_t hw_func,\n+\t\t\t\t   bool enable)\n+{\n+\tstruct cnxk_eswitch_devargs *esw_da;\n+\tuint16_t rep_id = UINT16_MAX;\n+\tint rc = 0, i, j;\n+\n+\t/* Traversing the initialized represented list */\n+\tfor (i = 0; i < eswitch_dev->nb_esw_da; i++) {\n+\t\tesw_da = &eswitch_dev->esw_da[i];\n+\t\tfor (j = 0; j < esw_da->nb_repr_ports; j++) {\n+\t\t\tif (esw_da->repr_hw_info[j].hw_func == hw_func) {\n+\t\t\t\trep_id = esw_da->repr_hw_info[j].rep_id;\n+\t\t\t\tbreak;\n+\t\t\t}\n+\t\t}\n+\t\tif (rep_id != UINT16_MAX)\n+\t\t\tbreak;\n+\t}\n+\t/* No action on PF func for which representor has not been created */\n+\tif (rep_id == UINT16_MAX)\n+\t\tgoto done;\n+\n+\tif (enable) {\n+\t\trc = cnxk_representee_setup(eswitch_dev, hw_func, rep_id);\n+\t\tif (rc) {\n+\t\t\tplt_err(\"Failed to setup representee, err %d\", rc);\n+\t\t\tgoto fail;\n+\t\t}\n+\t\tplt_rep_dbg(\"\t\tRepresentor ID %d representing %x\", rep_id, hw_func);\n+\t\trc = cnxk_eswitch_flow_rules_install(eswitch_dev, hw_func);\n+\t\tif (rc) {\n+\t\t\tplt_err(\"Failed to install rxtx flow rules for %x\", hw_func);\n+\t\t\tgoto fail;\n+\t\t}\n+\t} else {\n+\t\trc = cnxk_eswitch_flow_rules_delete(eswitch_dev, hw_func);\n+\t\tif (rc) {\n+\t\t\tplt_err(\"Failed to delete flow rules for %x\", hw_func);\n+\t\t\tgoto fail;\n+\t\t}\n+\t\trc = cnxk_representee_release(eswitch_dev, hw_func);\n+\t\tif (rc) {\n+\t\t\tplt_err(\"Failed to release representee, err %d\", rc);\n+\t\t\tgoto fail;\n+\t\t}\n+\t}\n+\n+done:\n+\treturn 0;\n+fail:\n+\treturn rc;\n+}\n+\n+static int\n+cnxk_representee_mtu_msg_process(struct cnxk_eswitch_dev *eswitch_dev, uint16_t hw_func,\n+\t\t\t\t uint16_t rep_id, uint16_t mtu)\n+{\n+\tstruct cnxk_rep_dev *rep_dev = NULL;\n+\tstruct rte_eth_dev *rep_eth_dev;\n+\tint rc = 0;\n+\tint i;\n+\n+\tfor (i = 0; i < eswitch_dev->repr_cnt.nb_repr_probed; i++) {\n+\t\trep_eth_dev = eswitch_dev->rep_info[i].rep_eth_dev;\n+\t\tif (!rep_eth_dev) {\n+\t\t\tplt_err(\"Failed to get rep ethdev handle\");\n+\t\t\trc = -EINVAL;\n+\t\t\tgoto done;\n+\t\t}\n+\n+\t\trep_dev = cnxk_rep_pmd_priv(rep_eth_dev);\n+\t\tif (rep_dev->rep_id == rep_id) {\n+\t\t\tplt_rep_dbg(\"Setting MTU as %d for hw_func %x rep_id %d\\n\", mtu, hw_func,\n+\t\t\t\t    rep_id);\n+\t\t\trep_dev->repte_mtu = mtu;\n+\t\t\tbreak;\n+\t\t}\n+\t}\n+\n+done:\n+\treturn rc;\n+}\n+\n+static int\n+cnxk_representee_msg_process(struct cnxk_eswitch_dev *eswitch_dev,\n+\t\t\t     struct roc_eswitch_repte_notify_msg *notify_msg)\n+{\n+\tint rc = 0;\n+\n+\tswitch (notify_msg->type) {\n+\tcase ROC_ESWITCH_REPTE_STATE:\n+\t\tplt_rep_dbg(\"\t   type %d: hw_func %x action %s\", notify_msg->type,\n+\t\t\t    notify_msg->state.hw_func,\n+\t\t\t    notify_msg->state.enable ? \"enable\" : \"disable\");\n+\t\trc = cnxk_representee_state_msg_process(eswitch_dev, notify_msg->state.hw_func,\n+\t\t\t\t\t\t\tnotify_msg->state.enable);\n+\t\tbreak;\n+\tcase ROC_ESWITCH_REPTE_MTU:\n+\t\tplt_rep_dbg(\"\t   type %d: hw_func %x rep_id %d mtu %d\", notify_msg->type,\n+\t\t\t    notify_msg->mtu.hw_func, notify_msg->mtu.rep_id, notify_msg->mtu.mtu);\n+\t\trc = cnxk_representee_mtu_msg_process(eswitch_dev, notify_msg->mtu.hw_func,\n+\t\t\t\t\t\t      notify_msg->mtu.rep_id, notify_msg->mtu.mtu);\n+\t\tbreak;\n+\tdefault:\n+\t\tplt_err(\"Invalid notification msg received %d\", notify_msg->type);\n+\t\tbreak;\n+\t};\n+\n+\treturn rc;\n+}\n+\n+static uint32_t\n+cnxk_representee_msg_thread_main(void *arg)\n+{\n+\tstruct cnxk_eswitch_dev *eswitch_dev = (struct cnxk_eswitch_dev *)arg;\n+\tstruct cnxk_esw_repte_msg_proc *repte_msg_proc;\n+\tstruct cnxk_esw_repte_msg *msg, *next_msg;\n+\tint count, rc;\n+\n+\trepte_msg_proc = &eswitch_dev->repte_msg_proc;\n+\tpthread_mutex_lock(&eswitch_dev->repte_msg_proc.mutex);\n+\twhile (eswitch_dev->repte_msg_proc.start_thread) {\n+\t\tdo {\n+\t\t\trc = pthread_cond_wait(&eswitch_dev->repte_msg_proc.repte_msg_cond,\n+\t\t\t\t\t       &eswitch_dev->repte_msg_proc.mutex);\n+\t\t} while (rc != 0);\n+\n+\t\t/* Go through list pushed from interrupt context and process each message */\n+\t\tnext_msg = TAILQ_FIRST(&repte_msg_proc->msg_list);\n+\t\tcount = 0;\n+\t\twhile (next_msg) {\n+\t\t\tmsg = next_msg;\n+\t\t\tcount++;\n+\t\t\tplt_rep_dbg(\"\tProcessing msg %d: \", count);\n+\t\t\t/* Unlocking for interrupt thread to grab lock\n+\t\t\t * while thread process the message.\n+\t\t\t */\n+\t\t\tpthread_mutex_unlock(&eswitch_dev->repte_msg_proc.mutex);\n+\t\t\t/* Processing the message */\n+\t\t\tcnxk_representee_msg_process(eswitch_dev, msg->notify_msg);\n+\t\t\t/* Locking as cond wait will unlock before wait */\n+\t\t\tpthread_mutex_lock(&eswitch_dev->repte_msg_proc.mutex);\n+\t\t\tnext_msg = TAILQ_NEXT(msg, next);\n+\t\t\tTAILQ_REMOVE(&repte_msg_proc->msg_list, msg, next);\n+\t\t\trte_free(msg->notify_msg);\n+\t\t\trte_free(msg);\n+\t\t}\n+\t}\n+\n+\tpthread_mutex_unlock(&eswitch_dev->repte_msg_proc.mutex);\n+\n+\treturn 0;\n+}\n+\n+static int\n+cnxk_representee_notification(void *roc_nix, struct roc_eswitch_repte_notify_msg *notify_msg)\n+{\n+\tstruct cnxk_esw_repte_msg_proc *repte_msg_proc;\n+\tstruct cnxk_eswitch_dev *eswitch_dev;\n+\tstruct cnxk_esw_repte_msg *msg;\n+\tint rc = 0;\n+\n+\tRTE_SET_USED(roc_nix);\n+\teswitch_dev = cnxk_eswitch_pmd_priv();\n+\tif (!eswitch_dev) {\n+\t\tplt_err(\"Failed to get PF ethdev handle\");\n+\t\trc = -EINVAL;\n+\t\tgoto done;\n+\t}\n+\n+\trepte_msg_proc = &eswitch_dev->repte_msg_proc;\n+\tmsg = rte_zmalloc(\"msg\", sizeof(struct cnxk_esw_repte_msg), 0);\n+\tif (!msg) {\n+\t\tplt_err(\"Failed to allocate memory for repte msg\");\n+\t\trc = -ENOMEM;\n+\t\tgoto done;\n+\t}\n+\n+\tmsg->notify_msg = plt_zmalloc(sizeof(struct roc_eswitch_repte_notify_msg), 0);\n+\tif (!msg->notify_msg) {\n+\t\tplt_err(\"Failed to allocate memory\");\n+\t\trc = -ENOMEM;\n+\t\tgoto done;\n+\t}\n+\n+\trte_memcpy(msg->notify_msg, notify_msg, sizeof(struct roc_eswitch_repte_notify_msg));\n+\tplt_rep_dbg(\"Pushing new notification : msg type %d\", msg->notify_msg->type);\n+\tpthread_mutex_lock(&eswitch_dev->repte_msg_proc.mutex);\n+\tTAILQ_INSERT_TAIL(&repte_msg_proc->msg_list, msg, next);\n+\t/* Signal vf message handler thread */\n+\tpthread_cond_signal(&eswitch_dev->repte_msg_proc.repte_msg_cond);\n+\tpthread_mutex_unlock(&eswitch_dev->repte_msg_proc.mutex);\n+\n+done:\n+\treturn rc;\n+}\n+\n static int\n cnxk_rep_parent_setup(struct cnxk_eswitch_dev *eswitch_dev)\n {\n@@ -263,6 +559,7 @@ create_representor_ethdev(struct rte_pci_device *pci_dev, struct cnxk_eswitch_de\n int\n cnxk_rep_dev_probe(struct rte_pci_device *pci_dev, struct cnxk_eswitch_dev *eswitch_dev)\n {\n+\tchar name[REPTE_MSG_PROC_THRD_NAME_MAX_LEN];\n \tstruct cnxk_eswitch_devargs *esw_da;\n \tuint16_t num_rep;\n \tint i, j, rc;\n@@ -302,7 +599,36 @@ cnxk_rep_dev_probe(struct rte_pci_device *pci_dev, struct cnxk_eswitch_dev *eswi\n \t\t}\n \t}\n \n+\tif (!eswitch_dev->repte_msg_proc.start_thread) {\n+\t\t/* Register callback for representee notification */\n+\t\tif (roc_eswitch_nix_process_repte_notify_cb_register(&eswitch_dev->nix,\n+\t\t\t\t\t\t\t     cnxk_representee_notification)) {\n+\t\t\tplt_err(\"Failed to register callback for representee notification\");\n+\t\t\trc = -EINVAL;\n+\t\t\tgoto fail;\n+\t\t}\n+\n+\t\t/* Create a thread for handling msgs from VFs */\n+\t\tTAILQ_INIT(&eswitch_dev->repte_msg_proc.msg_list);\n+\t\tpthread_cond_init(&eswitch_dev->repte_msg_proc.repte_msg_cond, NULL);\n+\t\tpthread_mutex_init(&eswitch_dev->repte_msg_proc.mutex, NULL);\n+\n+\t\trte_strscpy(name, \"repte_msg_proc_thrd\", REPTE_MSG_PROC_THRD_NAME_MAX_LEN);\n+\t\teswitch_dev->repte_msg_proc.start_thread = true;\n+\t\trc =\n+\t\trte_thread_create_internal_control(&eswitch_dev->repte_msg_proc.repte_msg_thread,\n+\t\t\t\t\t\t   name, cnxk_representee_msg_thread_main,\n+\t\t\t\t\t\t   eswitch_dev);\n+\t\tif (rc != 0) {\n+\t\t\tplt_err(\"Failed to create thread for VF mbox handling\\n\");\n+\t\t\tgoto thread_fail;\n+\t\t}\n+\t}\n+\n \treturn 0;\n+thread_fail:\n+\tpthread_mutex_destroy(&eswitch_dev->repte_msg_proc.mutex);\n+\tpthread_cond_destroy(&eswitch_dev->repte_msg_proc.repte_msg_cond);\n fail:\n \treturn rc;\n }\ndiff --git a/drivers/net/cnxk/cnxk_rep.h b/drivers/net/cnxk/cnxk_rep.h\nindex da298823a7..5a85d4376e 100644\n--- a/drivers/net/cnxk/cnxk_rep.h\n+++ b/drivers/net/cnxk/cnxk_rep.h\n@@ -10,6 +10,40 @@\n /* Common ethdev ops */\n extern struct eth_dev_ops cnxk_rep_dev_ops;\n \n+struct cnxk_rep_queue_stats {\n+\tuint64_t pkts;\n+\tuint64_t bytes;\n+};\n+\n+struct cnxk_rep_rxq {\n+\t/* Parent rep device */\n+\tstruct cnxk_rep_dev *rep_dev;\n+\t/* Queue ID */\n+\tuint16_t qid;\n+\t/* No of desc */\n+\tuint16_t nb_desc;\n+\t/* mempool handle */\n+\tstruct rte_mempool *mpool;\n+\t/* RX config parameters */\n+\tconst struct rte_eth_rxconf *rx_conf;\n+\t/* Per queue TX statistics */\n+\tstruct cnxk_rep_queue_stats stats;\n+};\n+\n+struct cnxk_rep_txq {\n+\t/* Parent rep device */\n+\tstruct cnxk_rep_dev *rep_dev;\n+\t/* Queue ID */\n+\tuint16_t qid;\n+\t/* No of desc */\n+\tuint16_t nb_desc;\n+\t/* TX config parameters */\n+\tconst struct rte_eth_txconf *tx_conf;\n+\t/* Per queue TX statistics */\n+\tstruct cnxk_rep_queue_stats stats;\n+};\n+\n+/* Representor port configurations */\n struct cnxk_rep_dev {\n \tuint16_t port_id;\n \tuint16_t rep_id;\n@@ -18,7 +52,10 @@ struct cnxk_rep_dev {\n \tuint16_t hw_func;\n \tbool is_vf_active;\n \tbool native_repte;\n+\tstruct cnxk_rep_rxq *rxq;\n+\tstruct cnxk_rep_txq *txq;\n \tuint8_t mac_addr[RTE_ETHER_ADDR_LEN];\n+\tuint16_t repte_mtu;\n };\n \n static inline struct cnxk_rep_dev *\n",
    "prefixes": [
        "v6",
        "12/23"
    ]
}