get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 135783,
    "url": "http://patchwork.dpdk.org/api/patches/135783/?format=api",
    "web_url": "http://patchwork.dpdk.org/project/dpdk/patch/20240107153454.3909-6-syalavarthi@marvell.com/",
    "project": {
        "id": 1,
        "url": "http://patchwork.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": "<20240107153454.3909-6-syalavarthi@marvell.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20240107153454.3909-6-syalavarthi@marvell.com",
    "date": "2024-01-07T15:34:44",
    "name": "[05/11] event/ml: add adapter queue pair add and delete",
    "commit_ref": null,
    "pull_url": null,
    "state": "changes-requested",
    "archived": true,
    "hash": "961138cb92f0a1c64119f015b3d48a08ed114a1f",
    "submitter": {
        "id": 2480,
        "url": "http://patchwork.dpdk.org/api/people/2480/?format=api",
        "name": "Srikanth Yalavarthi",
        "email": "syalavarthi@marvell.com"
    },
    "delegate": {
        "id": 310,
        "url": "http://patchwork.dpdk.org/api/users/310/?format=api",
        "username": "jerin",
        "first_name": "Jerin",
        "last_name": "Jacob",
        "email": "jerinj@marvell.com"
    },
    "mbox": "http://patchwork.dpdk.org/project/dpdk/patch/20240107153454.3909-6-syalavarthi@marvell.com/mbox/",
    "series": [
        {
            "id": 30752,
            "url": "http://patchwork.dpdk.org/api/series/30752/?format=api",
            "web_url": "http://patchwork.dpdk.org/project/dpdk/list/?series=30752",
            "date": "2024-01-07T15:34:39",
            "name": "Introduce Event ML Adapter",
            "version": 1,
            "mbox": "http://patchwork.dpdk.org/series/30752/mbox/"
        }
    ],
    "comments": "http://patchwork.dpdk.org/api/patches/135783/comments/",
    "check": "success",
    "checks": "http://patchwork.dpdk.org/api/patches/135783/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 D430C43857;\n\tSun,  7 Jan 2024 16:35:49 +0100 (CET)",
            "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id DA5ED40A6E;\n\tSun,  7 Jan 2024 16:35:24 +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 E9785406B6\n for <dev@dpdk.org>; Sun,  7 Jan 2024 16:35:21 +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 407EUkDp010955 for <dev@dpdk.org>; Sun, 7 Jan 2024 07:35:21 -0800",
            "from dc5-exch02.marvell.com ([199.233.59.182])\n by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3vf78n2a1k-1\n (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT)\n for <dev@dpdk.org>; Sun, 07 Jan 2024 07:35:21 -0800 (PST)",
            "from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH02.marvell.com\n (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.48;\n Sun, 7 Jan 2024 07:35:19 -0800",
            "from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com\n (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.48 via Frontend\n Transport; Sun, 7 Jan 2024 07:35:19 -0800",
            "from ml-host-33.caveonetworks.com (unknown [10.110.143.233])\n by maili.marvell.com (Postfix) with ESMTP id D74273F7093;\n Sun,  7 Jan 2024 07:35:18 -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-transfer-encoding:content-type; s=\n pfpt0220; bh=EN8zo3otmbL55reV4TM9B26/UxRPcesvofljJJrI72E=; b=Lvm\n EiKCTSl/Tl2Y2QdwFvTA+05ZaVbRKLT6DFnTCtFz4HWeemLkriWJ6/Gb9jp+dn10\n 8gh+ItSK3yiWEYL2qjBAqHsoLH74H0dfmH9rBmtacyIKzIjcfAcSPUBMHEl+pbds\n QdDBnDsnJYF6vj/jZ4DLkSP4uwRyb15GyN39PP9neHHTKNz7M/mJh0sTpdFrwQoz\n 0fvC28R1VhVR9fycSE6N3CgAeJJ9tbYn/CT/tqvQYgvhPtWuewTlv4q3MNuZj0fH\n RjWrRmPLWlRF0tD99eucTBxOZBFPA5/GUFOsKUahsUwNSGRFXWp3dSu6GV8fSAhF\n 9vL4woP8WCC/5hkBw3Q==",
        "From": "Srikanth Yalavarthi <syalavarthi@marvell.com>",
        "To": "Jerin Jacob <jerinj@marvell.com>, Srikanth Yalavarthi\n <syalavarthi@marvell.com>",
        "CC": "<dev@dpdk.org>, <aprabhu@marvell.com>, <sshankarnara@marvell.com>,\n <ptakkar@marvell.com>",
        "Subject": "[PATCH 05/11] event/ml: add adapter queue pair add and delete",
        "Date": "Sun, 7 Jan 2024 07:34:44 -0800",
        "Message-ID": "<20240107153454.3909-6-syalavarthi@marvell.com>",
        "X-Mailer": "git-send-email 2.42.0",
        "In-Reply-To": "<20240107153454.3909-1-syalavarthi@marvell.com>",
        "References": "<20240107153454.3909-1-syalavarthi@marvell.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Content-Type": "text/plain",
        "X-Proofpoint-ORIG-GUID": "BB7JTLllKzM-4kQpIMvA_7JmMIC8iPHN",
        "X-Proofpoint-GUID": "BB7JTLllKzM-4kQpIMvA_7JmMIC8iPHN",
        "X-Proofpoint-Virus-Version": "vendor=baseguard\n engine=ICAP:2.0.272,Aquarius:18.0.997,Hydra:6.0.619,FMLib:17.11.176.26\n definitions=2023-12-09_02,2023-12-07_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": "Added ML adapter queue-pair add and delete functions\n\nSigned-off-by: Srikanth Yalavarthi <syalavarthi@marvell.com>\n---\n lib/eventdev/eventdev_pmd.h         |  54 ++++++++\n lib/eventdev/rte_event_ml_adapter.c | 193 ++++++++++++++++++++++++++++\n 2 files changed, 247 insertions(+)",
    "diff": "diff --git a/lib/eventdev/eventdev_pmd.h b/lib/eventdev/eventdev_pmd.h\nindex 94d505753dc..48e970a5097 100644\n--- a/lib/eventdev/eventdev_pmd.h\n+++ b/lib/eventdev/eventdev_pmd.h\n@@ -1549,6 +1549,56 @@ struct rte_ml_dev;\n typedef int (*eventdev_ml_adapter_caps_get_t)(const struct rte_eventdev *dev,\n \t\t\t\t\t      const struct rte_ml_dev *mldev, uint32_t *caps);\n \n+/**\n+ * This API may change without prior notice\n+ *\n+ * Add ML queue pair to event device. This callback is invoked if\n+ * the caps returned from rte_event_ml_adapter_caps_get(, mldev_id)\n+ * has RTE_EVENT_ML_ADAPTER_CAP_INTERNAL_PORT_* set.\n+ *\n+ * @param dev\n+ *   Event device pointer\n+ *\n+ * @param mldev\n+ *   MLDEV pointer\n+ *\n+ * @param queue_pair_id\n+ *   MLDEV queue pair identifier.\n+ *\n+ * @param event\n+ *  Event information required for binding mldev queue pair to event queue.\n+ * This structure will have a valid value for only those HW PMDs supporting\n+ * @see RTE_EVENT_ML_ADAPTER_CAP_INTERNAL_PORT_QP_EV_BIND capability.\n+ *\n+ * @return\n+ *   - 0: Success, mldev queue pair added successfully.\n+ *   - <0: Error code returned by the driver function.\n+ *\n+ */\n+typedef int (*eventdev_ml_adapter_queue_pair_add_t)(const struct rte_eventdev *dev,\n+\t\t\t\t\t\t    const struct rte_ml_dev *mldev,\n+\t\t\t\t\t\t    int32_t queue_pair_id,\n+\t\t\t\t\t\t    const struct rte_event *event);\n+\n+/**\n+ * This API may change without prior notice\n+ *\n+ * Delete ML queue pair to event device. This callback is invoked if\n+ * the caps returned from rte_event_ml_adapter_caps_get(, mldev_id)\n+ * has RTE_EVENT_ML_ADAPTER_CAP_INTERNAL_PORT_* set.\n+ *\n+ * @param queue_pair_id\n+ *   mldev queue pair identifier.\n+ *\n+ * @return\n+ *   - 0: Success, mldev queue pair deleted successfully.\n+ *   - <0: Error code returned by the driver function.\n+ *\n+ */\n+typedef int (*eventdev_ml_adapter_queue_pair_del_t)(const struct rte_eventdev *dev,\n+\t\t\t\t\t\t    const struct rte_ml_dev *cdev,\n+\t\t\t\t\t\t    int32_t queue_pair_id);\n+\n /** Event device operations function pointer table */\n struct eventdev_ops {\n \teventdev_info_get_t dev_infos_get;\t/**< Get device info. */\n@@ -1690,6 +1740,10 @@ struct eventdev_ops {\n \n \teventdev_ml_adapter_caps_get_t ml_adapter_caps_get;\n \t/**< Get ML adapter capabilities */\n+\teventdev_ml_adapter_queue_pair_add_t ml_adapter_queue_pair_add;\n+\t/**< Add queue pair to ML adapter */\n+\teventdev_ml_adapter_queue_pair_del_t ml_adapter_queue_pair_del;\n+\t/**< Delete queue pair from ML adapter */\n \n \teventdev_selftest dev_selftest;\n \t/**< Start eventdev Selftest */\ndiff --git a/lib/eventdev/rte_event_ml_adapter.c b/lib/eventdev/rte_event_ml_adapter.c\nindex 93ba58b3e9e..9d441c5d967 100644\n--- a/lib/eventdev/rte_event_ml_adapter.c\n+++ b/lib/eventdev/rte_event_ml_adapter.c\n@@ -33,10 +33,27 @@ struct ml_ops_circular_buffer {\n \tstruct rte_ml_op **op_buffer;\n } __rte_cache_aligned;\n \n+/* Queue pair information */\n+struct ml_queue_pair_info {\n+\t/* Set to indicate queue pair is enabled */\n+\tbool qp_enabled;\n+\n+\t/* Circular buffer for batching ML ops to mldev */\n+\tstruct ml_ops_circular_buffer mlbuf;\n+} __rte_cache_aligned;\n+\n /* ML device information */\n struct ml_device_info {\n \t/* Pointer to mldev */\n \tstruct rte_ml_dev *dev;\n+\n+\t/* Pointer to queue pair info */\n+\tstruct ml_queue_pair_info *qpairs;\n+\n+\t/* If num_qpairs > 0, the start callback will\n+\t * be invoked if not already invoked\n+\t */\n+\tuint16_t num_qpairs;\n } __rte_cache_aligned;\n \n struct event_ml_adapter {\n@@ -72,6 +89,9 @@ struct event_ml_adapter {\n \n \t/* Set if  default_cb is being used */\n \tint default_cb_arg;\n+\n+\t/* No. of queue pairs configured */\n+\tuint16_t nb_qps;\n } __rte_cache_aligned;\n \n static struct event_ml_adapter **event_ml_adapter;\n@@ -340,3 +360,176 @@ rte_event_ml_adapter_event_port_get(uint8_t id, uint8_t *event_port_id)\n \n \treturn 0;\n }\n+\n+static void\n+emla_update_qp_info(struct event_ml_adapter *adapter, struct ml_device_info *dev_info,\n+\t\t    int32_t queue_pair_id, uint8_t add)\n+{\n+\tstruct ml_queue_pair_info *qp_info;\n+\tint enabled;\n+\tuint16_t i;\n+\n+\tif (dev_info->qpairs == NULL)\n+\t\treturn;\n+\n+\tif (queue_pair_id == -1) {\n+\t\tfor (i = 0; i < dev_info->dev->data->nb_queue_pairs; i++)\n+\t\t\temla_update_qp_info(adapter, dev_info, i, add);\n+\t} else {\n+\t\tqp_info = &dev_info->qpairs[queue_pair_id];\n+\t\tenabled = qp_info->qp_enabled;\n+\t\tif (add) {\n+\t\t\tadapter->nb_qps += !enabled;\n+\t\t\tdev_info->num_qpairs += !enabled;\n+\t\t} else {\n+\t\t\tadapter->nb_qps -= enabled;\n+\t\t\tdev_info->num_qpairs -= enabled;\n+\t\t}\n+\t\tqp_info->qp_enabled = !!add;\n+\t}\n+}\n+\n+int\n+rte_event_ml_adapter_queue_pair_add(uint8_t id, int16_t mldev_id, int32_t queue_pair_id,\n+\t\t\t\t    const struct rte_event *event)\n+{\n+\tstruct event_ml_adapter *adapter;\n+\tstruct ml_device_info *dev_info;\n+\tstruct rte_eventdev *dev;\n+\tuint32_t cap;\n+\tint ret;\n+\n+\tif (!emla_valid_id(id)) {\n+\t\tRTE_EDEV_LOG_ERR(\"Invalid ML adapter id = %d\", id);\n+\t\treturn -EINVAL;\n+\t}\n+\n+\tif (!rte_ml_dev_is_valid_dev(mldev_id)) {\n+\t\tRTE_EDEV_LOG_ERR(\"Invalid mldev_id = %\" PRIu8, mldev_id);\n+\t\treturn -EINVAL;\n+\t}\n+\n+\tadapter = emla_id_to_adapter(id);\n+\tif (adapter == NULL)\n+\t\treturn -EINVAL;\n+\n+\tdev = &rte_eventdevs[adapter->eventdev_id];\n+\tret = rte_event_ml_adapter_caps_get(adapter->eventdev_id, mldev_id, &cap);\n+\tif (ret) {\n+\t\tRTE_EDEV_LOG_ERR(\"Failed to get adapter caps dev %u mldev %u\", id, mldev_id);\n+\t\treturn ret;\n+\t}\n+\n+\tif ((cap & RTE_EVENT_ML_ADAPTER_CAP_INTERNAL_PORT_QP_EV_BIND) && (event == NULL)) {\n+\t\tRTE_EDEV_LOG_ERR(\"Event can not be NULL for mldev_id = %u\", mldev_id);\n+\t\treturn -EINVAL;\n+\t}\n+\n+\tdev_info = &adapter->mldevs[mldev_id];\n+\tif (queue_pair_id != -1 && (uint16_t)queue_pair_id >= dev_info->dev->data->nb_queue_pairs) {\n+\t\tRTE_EDEV_LOG_ERR(\"Invalid queue_pair_id %u\", (uint16_t)queue_pair_id);\n+\t\treturn -EINVAL;\n+\t}\n+\n+\t/* In case HW cap is RTE_EVENT_ML_ADAPTER_CAP_INTERNAL_PORT_OP_FWD, no\n+\t * need of service core as HW supports event forward capability.\n+\t */\n+\tif ((cap & RTE_EVENT_ML_ADAPTER_CAP_INTERNAL_PORT_OP_FWD) ||\n+\t    (cap & RTE_EVENT_ML_ADAPTER_CAP_INTERNAL_PORT_QP_EV_BIND &&\n+\t     adapter->mode == RTE_EVENT_ML_ADAPTER_OP_NEW) ||\n+\t    (cap & RTE_EVENT_ML_ADAPTER_CAP_INTERNAL_PORT_OP_NEW &&\n+\t     adapter->mode == RTE_EVENT_ML_ADAPTER_OP_NEW)) {\n+\t\tif (*dev->dev_ops->ml_adapter_queue_pair_add == NULL)\n+\t\t\treturn -ENOTSUP;\n+\n+\t\tif (dev_info->qpairs == NULL) {\n+\t\t\tdev_info->qpairs =\n+\t\t\t\trte_zmalloc_socket(adapter->mem_name,\n+\t\t\t\t\t\t   dev_info->dev->data->nb_queue_pairs *\n+\t\t\t\t\t\t\t   sizeof(struct ml_queue_pair_info),\n+\t\t\t\t\t\t   0, adapter->socket_id);\n+\t\t\tif (dev_info->qpairs == NULL)\n+\t\t\t\treturn -ENOMEM;\n+\t\t}\n+\n+\t\tret = (*dev->dev_ops->ml_adapter_queue_pair_add)(dev, dev_info->dev, queue_pair_id,\n+\t\t\t\t\t\t\t\t event);\n+\t\tif (ret == 0)\n+\t\t\temla_update_qp_info(adapter, &adapter->mldevs[mldev_id], queue_pair_id, 1);\n+\t}\n+\n+\treturn ret;\n+}\n+\n+int\n+rte_event_ml_adapter_queue_pair_del(uint8_t id, int16_t mldev_id, int32_t queue_pair_id)\n+{\n+\tstruct event_ml_adapter *adapter;\n+\tstruct ml_device_info *dev_info;\n+\tstruct rte_eventdev *dev;\n+\tint ret;\n+\tuint32_t cap;\n+\tuint16_t i;\n+\n+\tif (!emla_valid_id(id)) {\n+\t\tRTE_EDEV_LOG_ERR(\"Invalid ML adapter id = %d\", id);\n+\t\treturn -EINVAL;\n+\t}\n+\n+\tif (!rte_ml_dev_is_valid_dev(mldev_id)) {\n+\t\tRTE_EDEV_LOG_ERR(\"Invalid mldev_id = %\" PRIu8, mldev_id);\n+\t\treturn -EINVAL;\n+\t}\n+\n+\tadapter = emla_id_to_adapter(id);\n+\tif (adapter == NULL)\n+\t\treturn -EINVAL;\n+\n+\tdev = &rte_eventdevs[adapter->eventdev_id];\n+\tret = rte_event_ml_adapter_caps_get(adapter->eventdev_id, mldev_id, &cap);\n+\tif (ret)\n+\t\treturn ret;\n+\n+\tdev_info = &adapter->mldevs[mldev_id];\n+\n+\tif (queue_pair_id != -1 && (uint16_t)queue_pair_id >= dev_info->dev->data->nb_queue_pairs) {\n+\t\tRTE_EDEV_LOG_ERR(\"Invalid queue_pair_id %\" PRIu16, (uint16_t)queue_pair_id);\n+\t\treturn -EINVAL;\n+\t}\n+\n+\tif ((cap & RTE_EVENT_ML_ADAPTER_CAP_INTERNAL_PORT_OP_FWD) ||\n+\t    (cap & RTE_EVENT_ML_ADAPTER_CAP_INTERNAL_PORT_OP_NEW &&\n+\t     adapter->mode == RTE_EVENT_ML_ADAPTER_OP_NEW)) {\n+\t\tif (*dev->dev_ops->ml_adapter_queue_pair_del == NULL)\n+\t\t\treturn -ENOTSUP;\n+\n+\t\tret = (*dev->dev_ops->ml_adapter_queue_pair_del)(dev, dev_info->dev, queue_pair_id);\n+\t\tif (ret == 0) {\n+\t\t\temla_update_qp_info(adapter, &adapter->mldevs[mldev_id], queue_pair_id, 0);\n+\t\t\tif (dev_info->num_qpairs == 0) {\n+\t\t\t\trte_free(dev_info->qpairs);\n+\t\t\t\tdev_info->qpairs = NULL;\n+\t\t\t}\n+\t\t}\n+\t} else {\n+\t\tif (adapter->nb_qps == 0)\n+\t\t\treturn 0;\n+\n+\t\trte_spinlock_lock(&adapter->lock);\n+\t\tif (queue_pair_id == -1) {\n+\t\t\tfor (i = 0; i < dev_info->dev->data->nb_queue_pairs; i++)\n+\t\t\t\temla_update_qp_info(adapter, dev_info, queue_pair_id, 0);\n+\t\t} else {\n+\t\t\temla_update_qp_info(adapter, dev_info, (uint16_t)queue_pair_id, 0);\n+\t\t}\n+\n+\t\tif (dev_info->num_qpairs == 0) {\n+\t\t\trte_free(dev_info->qpairs);\n+\t\t\tdev_info->qpairs = NULL;\n+\t\t}\n+\n+\t\trte_spinlock_unlock(&adapter->lock);\n+\t}\n+\n+\treturn ret;\n+}\n",
    "prefixes": [
        "05/11"
    ]
}