get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 123258,
    "url": "https://patches.dpdk.org/api/patches/123258/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/20230207151316.835441-3-jerinj@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": "<20230207151316.835441-3-jerinj@marvell.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20230207151316.835441-3-jerinj@marvell.com",
    "date": "2023-02-07T15:13:06",
    "name": "[v3,02/12] mldev: support PMD functions for ML device",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "5bfc45ed8bfb6be8ddc7abed0375068848445197",
    "submitter": {
        "id": 1188,
        "url": "https://patches.dpdk.org/api/people/1188/?format=api",
        "name": "Jerin Jacob Kollanukkaran",
        "email": "jerinj@marvell.com"
    },
    "delegate": {
        "id": 1,
        "url": "https://patches.dpdk.org/api/users/1/?format=api",
        "username": "tmonjalo",
        "first_name": "Thomas",
        "last_name": "Monjalon",
        "email": "thomas@monjalon.net"
    },
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/20230207151316.835441-3-jerinj@marvell.com/mbox/",
    "series": [
        {
            "id": 26852,
            "url": "https://patches.dpdk.org/api/series/26852/?format=api",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=26852",
            "date": "2023-02-07T15:13:04",
            "name": "mldev: introduce machine learning device library",
            "version": 3,
            "mbox": "https://patches.dpdk.org/series/26852/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/123258/comments/",
    "check": "success",
    "checks": "https://patches.dpdk.org/api/patches/123258/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 1FB0241C30;\n\tTue,  7 Feb 2023 16:13:50 +0100 (CET)",
            "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 52D5A42C24;\n\tTue,  7 Feb 2023 16:13:42 +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 D12EE427F5\n for <dev@dpdk.org>; Tue,  7 Feb 2023 16:13:40 +0100 (CET)",
            "from pps.filterd (m0045849.ppops.net [127.0.0.1])\n by mx0a-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id\n 317ETPBB023009; Tue, 7 Feb 2023 07:13:39 -0800",
            "from dc5-exch02.marvell.com ([199.233.59.182])\n by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3nkdyrsk1b-1\n (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT);\n Tue, 07 Feb 2023 07:13:39 -0800",
            "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.42;\n Tue, 7 Feb 2023 07:13:37 -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.42 via Frontend\n Transport; Tue, 7 Feb 2023 07:13:37 -0800",
            "from jerin-lab.marvell.com (jerin-lab.marvell.com [10.28.34.14])\n by maili.marvell.com (Postfix) with ESMTP id E827B3F7083;\n Tue,  7 Feb 2023 07:13:34 -0800 (PST)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com;\n h=from : to : cc :\n subject : date : message-id : in-reply-to : references : mime-version :\n content-transfer-encoding : content-type; s=pfpt0220;\n bh=4SZdLgxCy2NOmI1tNlGTUjMlEzlUgCv1zBL7+1IMLlA=;\n b=knxF+wEYqCIK+8B+h41v2rBFyVqHNcJZwZ8rqYZ6hGNvDJBnRS9t8uZMJyNv9TGS5bpo\n JePCi9t0ojsycW8nfRj2Aj3YIhAPR9SAfeElr432XV0KD24C4Az33jLG0an3MzhlCi+G\n rzzQxeHvRwfwYSZE5BMs/+PjVZh0N7wWI4yjLIqt3kI6YUbyiT80jk6aX1nhAwJcWtLv\n 2w0geQJ5FDrbE9i2uf+3oMqvm3XKcQ1eYGli/wZ+ZsY1E/0iJ5utuKNWSiy0xGYMGCSr\n W4HqbF+NuFatU0v9p8jdPelEax/tSY1qtWdizGbmR1rLQitHUg25XNNQ/DRNFGkZBpUE kg==",
        "From": "<jerinj@marvell.com>",
        "To": "<dev@dpdk.org>, Srikanth Yalavarthi <syalavarthi@marvell.com>, \"Anatoly\n Burakov\" <anatoly.burakov@intel.com>",
        "CC": "<thomas@monjalon.net>, <ferruh.yigit@xilinx.com>,\n <stephen@networkplumber.org>, <dchickles@marvell.com>,\n <sshankarnara@marvell.com>, Jerin Jacob <jerinj@marvell.com>",
        "Subject": "[dpdk-dev] [PATCH v3 02/12] mldev: support PMD functions for ML\n device",
        "Date": "Tue, 7 Feb 2023 20:43:06 +0530",
        "Message-ID": "<20230207151316.835441-3-jerinj@marvell.com>",
        "X-Mailer": "git-send-email 2.39.1",
        "In-Reply-To": "<20230207151316.835441-1-jerinj@marvell.com>",
        "References": "<20230206202453.336280-1-jerinj@marvell.com>\n <20230207151316.835441-1-jerinj@marvell.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Content-Type": "text/plain",
        "X-Proofpoint-ORIG-GUID": "qrfwn85w6idHQpm_yBa9SPyf6RDjJkhi",
        "X-Proofpoint-GUID": "qrfwn85w6idHQpm_yBa9SPyf6RDjJkhi",
        "X-Proofpoint-Virus-Version": "vendor=baseguard\n engine=ICAP:2.0.219,Aquarius:18.0.930,Hydra:6.0.562,FMLib:17.11.122.1\n definitions=2023-02-07_07,2023-02-06_03,2022-06-22_01",
        "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: Srikanth Yalavarthi <syalavarthi@marvell.com>\n\nAdded PMD functions to handle ML devices. The rte_mldev_pmd.*\nfiles are for drivers only and should be private to DPDK, and\nare not installed for application use. Added implementation\nfor rte_ml_dev_init.\n\nSigned-off-by: Srikanth Yalavarthi <syalavarthi@marvell.com>\nSigned-off-by: Jerin Jacob <jerinj@marvell.com>\n---\n lib/mldev/meson.build      |   9 ++\n lib/mldev/rte_mldev.c      | 172 +++++++++++++++++++++++++++++++++++++\n lib/mldev/rte_mldev_core.h | 108 +++++++++++++++++++++++\n lib/mldev/rte_mldev_pmd.c  |  62 +++++++++++++\n lib/mldev/rte_mldev_pmd.h  | 149 ++++++++++++++++++++++++++++++++\n lib/mldev/version.map      |  12 +++\n 6 files changed, 512 insertions(+)\n create mode 100644 lib/mldev/rte_mldev_core.h\n create mode 100644 lib/mldev/rte_mldev_pmd.c\n create mode 100644 lib/mldev/rte_mldev_pmd.h",
    "diff": "diff --git a/lib/mldev/meson.build b/lib/mldev/meson.build\nindex e378cfca30..5c99532c1a 100644\n--- a/lib/mldev/meson.build\n+++ b/lib/mldev/meson.build\n@@ -2,6 +2,7 @@\n # Copyright (c) 2022 Marvell.\n \n sources = files(\n+        'rte_mldev_pmd.c',\n         'rte_mldev.c',\n )\n \n@@ -9,6 +10,14 @@ headers = files(\n         'rte_mldev.h',\n )\n \n+indirect_headers += files(\n+        'rte_mldev_core.h',\n+)\n+\n+driver_sdk_headers += files(\n+        'rte_mldev_pmd.h',\n+)\n+\n deps += ['mempool']\n \n if get_option('buildtype').contains('debug')\ndiff --git a/lib/mldev/rte_mldev.c b/lib/mldev/rte_mldev.c\nindex 70aad4c44b..833afcbf87 100644\n--- a/lib/mldev/rte_mldev.c\n+++ b/lib/mldev/rte_mldev.c\n@@ -2,7 +2,179 @@\n  * Copyright (c) 2022 Marvell.\n  */\n \n+#include <rte_errno.h>\n #include <rte_log.h>\n #include <rte_mldev.h>\n+#include <rte_mldev_pmd.h>\n+\n+#include <stdlib.h>\n+\n+static struct rte_ml_dev_global ml_dev_globals = {\n+\t.devs = NULL, .data = NULL, .nb_devs = 0, .max_devs = RTE_MLDEV_DEFAULT_MAX};\n+\n+struct rte_ml_dev *\n+rte_ml_dev_pmd_get_dev(int16_t dev_id)\n+{\n+\treturn &ml_dev_globals.devs[dev_id];\n+}\n+\n+struct rte_ml_dev *\n+rte_ml_dev_pmd_get_named_dev(const char *name)\n+{\n+\tstruct rte_ml_dev *dev;\n+\tint16_t dev_id;\n+\n+\tif (name == NULL)\n+\t\treturn NULL;\n+\n+\tfor (dev_id = 0; dev_id < ml_dev_globals.max_devs; dev_id++) {\n+\t\tdev = rte_ml_dev_pmd_get_dev(dev_id);\n+\t\tif ((dev->attached == ML_DEV_ATTACHED) && (strcmp(dev->data->name, name) == 0))\n+\t\t\treturn dev;\n+\t}\n+\n+\treturn NULL;\n+}\n+\n+struct rte_ml_dev *\n+rte_ml_dev_pmd_allocate(const char *name, uint8_t socket_id)\n+{\n+\tchar mz_name[RTE_MEMZONE_NAMESIZE];\n+\tconst struct rte_memzone *mz;\n+\tstruct rte_ml_dev *dev;\n+\tint16_t dev_id;\n+\n+\t/* implicit initialization of library before adding first device */\n+\tif (ml_dev_globals.devs == NULL) {\n+\t\tif (rte_ml_dev_init(RTE_MLDEV_DEFAULT_MAX) != 0)\n+\t\t\treturn NULL;\n+\t}\n+\n+\tif (rte_ml_dev_pmd_get_named_dev(name) != NULL) {\n+\t\tRTE_MLDEV_LOG(ERR, \"ML device with name %s already allocated!\", name);\n+\t\treturn NULL;\n+\t}\n+\n+\t/* Get a free device ID */\n+\tfor (dev_id = 0; dev_id < ml_dev_globals.max_devs; dev_id++) {\n+\t\tdev = rte_ml_dev_pmd_get_dev(dev_id);\n+\t\tif (dev->attached == ML_DEV_DETACHED)\n+\t\t\tbreak;\n+\t}\n+\n+\tif (dev_id == ml_dev_globals.max_devs) {\n+\t\tRTE_MLDEV_LOG(ERR, \"Reached maximum number of ML devices\");\n+\t\treturn NULL;\n+\t}\n+\n+\tif (dev->data == NULL) {\n+\t\t/* Reserve memzone name */\n+\t\tsprintf(mz_name, \"rte_ml_dev_data_%d\", dev_id);\n+\t\tif (rte_eal_process_type() == RTE_PROC_PRIMARY) {\n+\t\t\tmz = rte_memzone_reserve(mz_name, sizeof(struct rte_ml_dev_data), socket_id,\n+\t\t\t\t\t\t 0);\n+\t\t\tRTE_MLDEV_LOG(DEBUG, \"PRIMARY: reserved memzone for %s (%p)\", mz_name, mz);\n+\t\t} else {\n+\t\t\tmz = rte_memzone_lookup(mz_name);\n+\t\t\tRTE_MLDEV_LOG(DEBUG, \"SECONDARY: looked up memzone for %s (%p)\", mz_name,\n+\t\t\t\t      mz);\n+\t\t}\n+\n+\t\tif (mz == NULL)\n+\t\t\treturn NULL;\n+\n+\t\tml_dev_globals.data[dev_id] = mz->addr;\n+\t\tif (rte_eal_process_type() == RTE_PROC_PRIMARY)\n+\t\t\tmemset(ml_dev_globals.data[dev_id], 0, sizeof(struct rte_ml_dev_data));\n+\n+\t\tdev->data = ml_dev_globals.data[dev_id];\n+\t\tif (rte_eal_process_type() == RTE_PROC_PRIMARY) {\n+\t\t\tstrlcpy(dev->data->name, name, RTE_ML_STR_MAX);\n+\t\t\tdev->data->dev_id = dev_id;\n+\t\t\tdev->data->socket_id = socket_id;\n+\t\t\tdev->data->dev_started = 0;\n+\t\t\tRTE_MLDEV_LOG(DEBUG, \"PRIMARY: init mldev data\");\n+\t\t}\n+\n+\t\tRTE_MLDEV_LOG(DEBUG, \"Data for %s: dev_id %d, socket %u\", dev->data->name,\n+\t\t\t      dev->data->dev_id, dev->data->socket_id);\n+\n+\t\tdev->attached = ML_DEV_ATTACHED;\n+\t\tml_dev_globals.nb_devs++;\n+\t}\n+\n+\treturn dev;\n+}\n+\n+int\n+rte_ml_dev_pmd_release(struct rte_ml_dev *dev)\n+{\n+\tchar mz_name[RTE_MEMZONE_NAMESIZE];\n+\tconst struct rte_memzone *mz;\n+\tint16_t dev_id;\n+\tint ret = 0;\n+\n+\tif (dev == NULL)\n+\t\treturn -EINVAL;\n+\n+\tdev_id = dev->data->dev_id;\n+\n+\t/* Memzone lookup */\n+\tsprintf(mz_name, \"rte_ml_dev_data_%d\", dev_id);\n+\tmz = rte_memzone_lookup(mz_name);\n+\tif (mz == NULL)\n+\t\treturn -ENOMEM;\n+\n+\tRTE_ASSERT(ml_dev_globals.data[dev_id] == mz->addr);\n+\tml_dev_globals.data[dev_id] = NULL;\n+\n+\tif (rte_eal_process_type() == RTE_PROC_PRIMARY) {\n+\t\tRTE_MLDEV_LOG(DEBUG, \"PRIMARY: free memzone of %s (%p)\", mz_name, mz);\n+\t\tret = rte_memzone_free(mz);\n+\t} else {\n+\t\tRTE_MLDEV_LOG(DEBUG, \"SECONDARY: don't free memzone of %s (%p)\", mz_name, mz);\n+\t}\n+\n+\tdev->attached = ML_DEV_DETACHED;\n+\tml_dev_globals.nb_devs--;\n+\n+\treturn ret;\n+}\n+\n+int\n+rte_ml_dev_init(size_t dev_max)\n+{\n+\tif (dev_max == 0 || dev_max > INT16_MAX) {\n+\t\tRTE_MLDEV_LOG(ERR, \"Invalid dev_max = %zu (> %d)\\n\", dev_max, INT16_MAX);\n+\t\trte_errno = EINVAL;\n+\t\treturn -rte_errno;\n+\t}\n+\n+\t/* No lock, it must be called before or during first probing. */\n+\tif (ml_dev_globals.devs != NULL) {\n+\t\tRTE_MLDEV_LOG(ERR, \"Device array already initialized\");\n+\t\trte_errno = EBUSY;\n+\t\treturn -rte_errno;\n+\t}\n+\n+\tml_dev_globals.devs = calloc(dev_max, sizeof(struct rte_ml_dev));\n+\tif (ml_dev_globals.devs == NULL) {\n+\t\tRTE_MLDEV_LOG(ERR, \"Cannot initialize MLDEV library\");\n+\t\trte_errno = ENOMEM;\n+\t\treturn -rte_errno;\n+\t}\n+\n+\tml_dev_globals.data = calloc(dev_max, sizeof(struct rte_ml_dev_data *));\n+\tif (ml_dev_globals.data == NULL) {\n+\t\tRTE_MLDEV_LOG(ERR, \"Cannot initialize MLDEV library\");\n+\t\trte_errno = ENOMEM;\n+\t\treturn -rte_errno;\n+\t}\n+\n+\tml_dev_globals.max_devs = dev_max;\n+\tml_dev_globals.devs = ml_dev_globals.devs;\n+\n+\treturn 0;\n+}\n \n RTE_LOG_REGISTER_DEFAULT(rte_ml_dev_logtype, INFO);\ndiff --git a/lib/mldev/rte_mldev_core.h b/lib/mldev/rte_mldev_core.h\nnew file mode 100644\nindex 0000000000..1564d0fa4d\n--- /dev/null\n+++ b/lib/mldev/rte_mldev_core.h\n@@ -0,0 +1,108 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright (c) 2022 Marvell.\n+ */\n+\n+#ifndef _RTE_MLDEV_INTERNAL_H_\n+#define _RTE_MLDEV_INTERNAL_H_\n+\n+/**\n+ * @file\n+ *\n+ * MLDEV internal header\n+ *\n+ * This file contains MLDEV private data structures and macros.\n+ *\n+ * @note\n+ * These APIs are for MLDEV PMDs and library only.\n+ */\n+\n+#ifdef __cplusplus\n+extern \"C\" {\n+#endif\n+\n+#include <stdint.h>\n+\n+#include <dev_driver.h>\n+#include <rte_common.h>\n+#include <rte_log.h>\n+#include <rte_mldev.h>\n+\n+/* Device state */\n+#define ML_DEV_DETACHED (0)\n+#define ML_DEV_ATTACHED (1)\n+\n+/**\n+ * @internal\n+ *\n+ * The data part, with no function pointers, associated with each device. This structure is safe to\n+ * place in shared memory to be common among different processes in a multi-process configuration.\n+ */\n+struct rte_ml_dev_data {\n+\t/** Device ID for this instance. */\n+\tint16_t dev_id;\n+\n+\t/** Socket ID where memory is allocated. */\n+\tint16_t socket_id;\n+\n+\t/** Device state: STOPPED(0) / STARTED(1) */\n+\t__extension__ uint8_t dev_started : 1;\n+\n+\t/** Number of device queue pairs. */\n+\tuint16_t nb_queue_pairs;\n+\n+\t/** Number of ML models. */\n+\tuint16_t nb_models;\n+\n+\t/** Array of pointers to queue pairs. */\n+\tvoid **queue_pairs;\n+\n+\t/** Array of pointers to ML models. */\n+\tvoid **models;\n+\n+\t/** PMD-specific private data. */\n+\tvoid *dev_private;\n+\n+\t/** Unique identifier name. */\n+\tchar name[RTE_ML_STR_MAX];\n+};\n+\n+/**\n+ * @internal\n+ *\n+ * The data structure associated with each ML device.\n+ */\n+struct rte_ml_dev {\n+\t/** Pointer to device data. */\n+\tstruct rte_ml_dev_data *data;\n+\n+\t/** Backing RTE device. */\n+\tstruct rte_device *device;\n+\n+\t/** Flag indicating the device is attached. */\n+\t__extension__ uint8_t attached : 1;\n+} __rte_cache_aligned;\n+\n+/**\n+ * @internal\n+ *\n+ * Global structure used for maintaining state of allocated ML devices.\n+ */\n+struct rte_ml_dev_global {\n+\t/** Device information array. */\n+\tstruct rte_ml_dev *devs;\n+\n+\t/** Device private data array. */\n+\tstruct rte_ml_dev_data **data;\n+\n+\t/** Number of devices found. */\n+\tuint8_t nb_devs;\n+\n+\t/** Maximum number of devices. */\n+\tuint8_t max_devs;\n+};\n+\n+#ifdef __cplusplus\n+}\n+#endif\n+\n+#endif /* _RTE_MLDEV_INTERNAL_H_ */\ndiff --git a/lib/mldev/rte_mldev_pmd.c b/lib/mldev/rte_mldev_pmd.c\nnew file mode 100644\nindex 0000000000..3169e5d4fa\n--- /dev/null\n+++ b/lib/mldev/rte_mldev_pmd.c\n@@ -0,0 +1,62 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright (c) 2022 Marvell.\n+ */\n+\n+#include <dev_driver.h>\n+#include <rte_eal.h>\n+#include <rte_malloc.h>\n+\n+#include \"rte_mldev_pmd.h\"\n+\n+struct rte_ml_dev *\n+rte_ml_dev_pmd_create(const char *name, struct rte_device *device,\n+\t\t      struct rte_ml_dev_pmd_init_params *params)\n+{\n+\tstruct rte_ml_dev *dev;\n+\n+\tRTE_MLDEV_LOG(INFO, \"ML device initialisation - name: %s, socket_id: %u\", name,\n+\t\t      params->socket_id);\n+\n+\t/* Allocate device structure */\n+\tdev = rte_ml_dev_pmd_allocate(name, params->socket_id);\n+\tif (dev == NULL) {\n+\t\tRTE_MLDEV_LOG(ERR, \"Failed to allocate ML device for %s\", name);\n+\t\treturn NULL;\n+\t}\n+\n+\t/* Allocate private device structure */\n+\tif (rte_eal_process_type() == RTE_PROC_PRIMARY) {\n+\t\tdev->data->dev_private =\n+\t\t\trte_zmalloc_socket(\"ml_dev_private\", params->private_data_size,\n+\t\t\t\t\t   RTE_CACHE_LINE_SIZE, params->socket_id);\n+\n+\t\tif (dev->data->dev_private == NULL) {\n+\t\t\tRTE_MLDEV_LOG(ERR, \"Cannot allocate memory for mldev %s private data\",\n+\t\t\t\t      name);\n+\t\t\trte_ml_dev_pmd_release(dev);\n+\t\t\treturn NULL;\n+\t\t}\n+\t}\n+\tdev->device = device;\n+\n+\treturn dev;\n+}\n+\n+int\n+rte_ml_dev_pmd_destroy(struct rte_ml_dev *dev)\n+{\n+\tint ret;\n+\n+\tRTE_MLDEV_LOG(INFO, \"Releasing ML device - name: %s\", dev->device->name);\n+\tret = rte_ml_dev_pmd_release(dev);\n+\tif (ret)\n+\t\treturn ret;\n+\n+\tif (rte_eal_process_type() == RTE_PROC_PRIMARY)\n+\t\trte_free(dev->data->dev_private);\n+\n+\tdev->data = NULL;\n+\tdev->device = NULL;\n+\n+\treturn 0;\n+}\ndiff --git a/lib/mldev/rte_mldev_pmd.h b/lib/mldev/rte_mldev_pmd.h\nnew file mode 100644\nindex 0000000000..33544f1b80\n--- /dev/null\n+++ b/lib/mldev/rte_mldev_pmd.h\n@@ -0,0 +1,149 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright (c) 2022 Marvell.\n+ */\n+\n+#ifndef _RTE_MLDEV_PMD_H_\n+#define _RTE_MLDEV_PMD_H_\n+\n+/**\n+ * @file\n+ *\n+ * RTE MLDEV PMD APIs\n+ *\n+ * ML Device PMD interface\n+ *\n+ * @note\n+ * These APIs are for MLDEV PMDs only and user applications should not call them directly.\n+ */\n+\n+#ifdef __cplusplus\n+extern \"C\" {\n+#endif\n+\n+#include <stdint.h>\n+\n+#include <rte_common.h>\n+#include <rte_compat.h>\n+#include <rte_mldev.h>\n+#include <rte_mldev_core.h>\n+\n+/**\n+ * @internal\n+ *\n+ * Initialisation parameters for ML devices.\n+ */\n+struct rte_ml_dev_pmd_init_params {\n+\t/** Socket to use for memory allocation. */\n+\tuint8_t socket_id;\n+\n+\t/** Size of device private data. */\n+\tuint64_t private_data_size;\n+};\n+\n+/**\n+ * @internal\n+ *\n+ * Get the ML device pointer for the device. Assumes a valid device index.\n+ *\n+ * @param dev_id\n+ *\tDevice ID value to select the device structure.\n+ *\n+ * @return\n+ *\tThe rte_ml_dev pointer for the given device ID.\n+ */\n+__rte_internal\n+struct rte_ml_dev *\n+rte_ml_dev_pmd_get_dev(int16_t dev_id);\n+\n+/**\n+ * @internal\n+ *\n+ * Get the rte_ml_dev structure device pointer for the named device.\n+ *\n+ * @param name\n+ *\tDevice name to select the device structure.\n+ *\n+ * @return\n+ *\tThe rte_ml_dev pointer for the given device ID.\n+ */\n+__rte_internal\n+struct rte_ml_dev *\n+rte_ml_dev_pmd_get_named_dev(const char *name);\n+\n+/**\n+ * @internal\n+ *\n+ * Allocates a new mldev slot for an ML device and returns the pointer to that slot for use.\n+ * Function for internal use by dummy drivers.\n+ *\n+ * @param name\n+ *\tUnique identifier name for each device.\n+ * @param socket_id\n+ *\tSocket to allocate resources.\n+ *\n+ * @return\n+ *\tSlot in the rte_ml_dev_devices array for a new device.\n+ */\n+__rte_internal\n+struct rte_ml_dev *\n+rte_ml_dev_pmd_allocate(const char *name, uint8_t socket_id);\n+\n+/**\n+ * @internal\n+ *\n+ * Release the specified mldev device.\n+ *\n+ * @param dev\n+ *\tML device.\n+ * @return\n+ *\t- 0 on success.\n+ *\t- < 0, error code on failure.\n+ */\n+__rte_internal\n+int\n+rte_ml_dev_pmd_release(struct rte_ml_dev *dev);\n+\n+/**\n+ * @internal\n+ *\n+ * PMD assist function to provide boiler plate code for ML driver to create and allocate resources\n+ * for a new ML PMD device instance.\n+ *\n+ * @param name\n+ *\tML device name.\n+ * @param device\n+ *\tBase device handle.\n+ * @param params\n+ *\tPMD initialisation parameters.\n+ *\n+ * @return\n+ *\t- ML device instance on success.\n+ *\t- NULL on failure.\n+ */\n+__rte_internal\n+struct rte_ml_dev *\n+rte_ml_dev_pmd_create(const char *name, struct rte_device *device,\n+\t\t      struct rte_ml_dev_pmd_init_params *params);\n+\n+/**\n+ * @internal\n+ *\n+ * PMD assist function to provide boiler plate code for ML driver to destroy and free resources\n+ * associated with a ML PMD device instance.\n+ *\n+ * @param mldev\n+ *\tML device instance.\n+ *\n+ * @return\n+ *\t- 0 on success.\n+ *\t- < 0, error code on failure.\n+ */\n+__rte_internal\n+int\n+rte_ml_dev_pmd_destroy(struct rte_ml_dev *mldev);\n+\n+#ifdef __cplusplus\n+}\n+#endif\n+\n+#endif /* _RTE_MLDEV_PMD_H_ */\ndiff --git a/lib/mldev/version.map b/lib/mldev/version.map\nindex 3793380442..d6bf7c8ebb 100644\n--- a/lib/mldev/version.map\n+++ b/lib/mldev/version.map\n@@ -1,7 +1,19 @@\n EXPERIMENTAL {\n \tglobal:\n \n+\trte_ml_dev_init;\n \trte_ml_dev_logtype;\n \n \tlocal: *;\n };\n+\n+INTERNAL {\n+\tglobal:\n+\n+\trte_ml_dev_pmd_allocate;\n+\trte_ml_dev_pmd_create;\n+\trte_ml_dev_pmd_destroy;\n+\trte_ml_dev_pmd_get_dev;\n+\trte_ml_dev_pmd_get_named_dev;\n+\trte_ml_dev_pmd_release;\n+};\n",
    "prefixes": [
        "v3",
        "02/12"
    ]
}