get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 120613,
    "url": "http://patches.dpdk.org/api/patches/120613/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20221208200220.20267-19-syalavarthi@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": "<20221208200220.20267-19-syalavarthi@marvell.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20221208200220.20267-19-syalavarthi@marvell.com",
    "date": "2022-12-08T20:02:01",
    "name": "[v1,18/37] ml/cnxk: enable support to stop an ML models",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "87bcd4e5a860f482ece0a2ac407da0de3ae681d3",
    "submitter": {
        "id": 2480,
        "url": "http://patches.dpdk.org/api/people/2480/?format=api",
        "name": "Srikanth Yalavarthi",
        "email": "syalavarthi@marvell.com"
    },
    "delegate": {
        "id": 1,
        "url": "http://patches.dpdk.org/api/users/1/?format=api",
        "username": "tmonjalo",
        "first_name": "Thomas",
        "last_name": "Monjalon",
        "email": "thomas@monjalon.net"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/20221208200220.20267-19-syalavarthi@marvell.com/mbox/",
    "series": [
        {
            "id": 26049,
            "url": "http://patches.dpdk.org/api/series/26049/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=26049",
            "date": "2022-12-08T20:01:43",
            "name": "Implementation of ML CNXK driver",
            "version": 1,
            "mbox": "http://patches.dpdk.org/series/26049/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/120613/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/120613/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 41A55A0093;\n\tThu,  8 Dec 2022 21:03:53 +0100 (CET)",
            "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id D522F42D4E;\n\tThu,  8 Dec 2022 21:02:40 +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 9CA3742D24\n for <dev@dpdk.org>; Thu,  8 Dec 2022 21:02:30 +0100 (CET)",
            "from pps.filterd (m0045851.ppops.net [127.0.0.1])\n by mx0b-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id\n 2B8JjesI004916 for <dev@dpdk.org>; Thu, 8 Dec 2022 12:02:30 -0800",
            "from dc5-exch02.marvell.com ([199.233.59.182])\n by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3m86usnfsu-5\n (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT)\n for <dev@dpdk.org>; Thu, 08 Dec 2022 12:02:29 -0800",
            "from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH02.marvell.com\n (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.18;\n Thu, 8 Dec 2022 12:02:27 -0800",
            "from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com\n (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.2 via Frontend\n Transport; Thu, 8 Dec 2022 12:02:27 -0800",
            "from ml-host-33.caveonetworks.com (unknown [10.110.143.233])\n by maili.marvell.com (Postfix) with ESMTP id CB3DD3F705E;\n Thu,  8 Dec 2022 12:02:27 -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-type; s=pfpt0220; bh=VIUBDTaqSnIC/FDAYSc/aIKe/2xYMC8k/up5HstmUdU=;\n b=FJQteh1Mjz5SHqbCCMuLl+lJUYzC6TKYpsp6sETyM0cUVBrVpAyD8wOFf8KQMD2urXb2\n 3RohbiEAljK6LXDHYFTc3RvU5JU/kGQd7lu9v7Wu/bzCk/nbS1DiEZEjZ/5Gyc+PRDqu\n 9olYS92F4fnQZR11IAxQt2x8wNWMkdmDxXFS1UXl+cKeKpD7wBMliJj+yfxvjb6BI0QL\n 7QXBBmHDsYEBP7DcOknghSUJE3ECv57BsDCDeUQ3dCa3OfllvESgSoFMa9esUkPbx7/z\n bCHoTUbt9I056ag4+dARVWjglECe8FQ0lU65uotWBiBpfuNOjrPiYGmv+vBkOPzTIkAy kg==",
        "From": "Srikanth Yalavarthi <syalavarthi@marvell.com>",
        "To": "Srikanth Yalavarthi <syalavarthi@marvell.com>",
        "CC": "<dev@dpdk.org>, <sshankarnara@marvell.com>, <jerinj@marvell.com>,\n <aprabhu@marvell.com>",
        "Subject": "[PATCH v1 18/37] ml/cnxk: enable support to stop an ML models",
        "Date": "Thu, 8 Dec 2022 12:02:01 -0800",
        "Message-ID": "<20221208200220.20267-19-syalavarthi@marvell.com>",
        "X-Mailer": "git-send-email 2.17.1",
        "In-Reply-To": "<20221208200220.20267-1-syalavarthi@marvell.com>",
        "References": "<20221208200220.20267-1-syalavarthi@marvell.com>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain",
        "X-Proofpoint-GUID": "imLM-yv737Jg-Zy8fUZIn3Yp2D9XDetg",
        "X-Proofpoint-ORIG-GUID": "imLM-yv737Jg-Zy8fUZIn3Yp2D9XDetg",
        "X-Proofpoint-Virus-Version": "vendor=baseguard\n engine=ICAP:2.0.205,Aquarius:18.0.923,Hydra:6.0.545,FMLib:17.11.122.1\n definitions=2022-12-08_11,2022-12-08_01,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": "Implemented model stop driver function. A model stop job is\nenqueued through scratch registers and is checked for\ncompletion through polling in a synchronous mode. OCM pages\nare released after model stop completion.\n\nSigned-off-by: Srikanth Yalavarthi <syalavarthi@marvell.com>\n---\n drivers/ml/cnxk/cn10k_ml_ops.c | 115 ++++++++++++++++++++++++++++++++-\n drivers/ml/cnxk/cn10k_ml_ops.h |   1 +\n 2 files changed, 114 insertions(+), 2 deletions(-)",
    "diff": "diff --git a/drivers/ml/cnxk/cn10k_ml_ops.c b/drivers/ml/cnxk/cn10k_ml_ops.c\nindex b74092e605..a0b0fc7e1f 100644\n--- a/drivers/ml/cnxk/cn10k_ml_ops.c\n+++ b/drivers/ml/cnxk/cn10k_ml_ops.c\n@@ -295,10 +295,14 @@ cn10k_ml_dev_configure(struct rte_ml_dev *dev, const struct rte_ml_dev_config *c\n \t\t/* Re-configure */\n \t\tvoid **models;\n \n-\t\t/* Unload all models */\n+\t\t/* Stop and unload all models */\n \t\tfor (model_id = 0; model_id < dev->data->nb_models; model_id++) {\n \t\t\tmodel = dev->data->models[model_id];\n \t\t\tif (model != NULL) {\n+\t\t\t\tif (model->state == ML_CN10K_MODEL_STATE_STARTED) {\n+\t\t\t\t\tif (cn10k_ml_model_stop(dev, model_id) != 0)\n+\t\t\t\t\t\tplt_err(\"Could not stop model %d\", model_id);\n+\t\t\t\t}\n \t\t\t\tif (model->state == ML_CN10K_MODEL_STATE_LOADED) {\n \t\t\t\t\tif (cn10k_ml_model_unload(dev, model_id) != 0)\n \t\t\t\t\t\tplt_err(\"Could not unload model %d\", model_id);\n@@ -362,10 +366,14 @@ cn10k_ml_dev_close(struct rte_ml_dev *dev)\n \n \tmldev = dev->data->dev_private;\n \n-\t/* Unload all models */\n+\t/* Stop and unload all models */\n \tfor (model_id = 0; model_id < dev->data->nb_models; model_id++) {\n \t\tmodel = dev->data->models[model_id];\n \t\tif (model != NULL) {\n+\t\t\tif (model->state == ML_CN10K_MODEL_STATE_STARTED) {\n+\t\t\t\tif (cn10k_ml_model_stop(dev, model_id) != 0)\n+\t\t\t\t\tplt_err(\"Could not stop model %d\", model_id);\n+\t\t\t}\n \t\t\tif (model->state == ML_CN10K_MODEL_STATE_LOADED) {\n \t\t\t\tif (cn10k_ml_model_unload(dev, model_id) != 0)\n \t\t\t\t\tplt_err(\"Could not unload model %d\", model_id);\n@@ -767,6 +775,108 @@ cn10k_ml_model_start(struct rte_ml_dev *dev, int16_t model_id)\n \treturn ret;\n }\n \n+int\n+cn10k_ml_model_stop(struct rte_ml_dev *dev, int16_t model_id)\n+{\n+\tstruct cn10k_ml_model *model;\n+\tstruct cn10k_ml_dev *mldev;\n+\tstruct cn10k_ml_ocm *ocm;\n+\tstruct cn10k_ml_req *req;\n+\n+\tbool job_enqueued;\n+\tbool job_dequeued;\n+\tbool locked;\n+\tint ret = 0;\n+\n+\tmldev = dev->data->dev_private;\n+\tocm = &mldev->ocm;\n+\tmodel = dev->data->models[model_id];\n+\n+\tif (model == NULL) {\n+\t\tplt_err(\"Invalid model_id = %d\", model_id);\n+\t\treturn -EINVAL;\n+\t}\n+\n+\t/* Prepare JD */\n+\treq = model->req;\n+\tcn10k_ml_prep_sp_job_descriptor(mldev, model, req, ML_CN10K_JOB_TYPE_MODEL_STOP);\n+\treq->result.error_code = 0x0;\n+\treq->result.user_ptr = NULL;\n+\n+\tplt_write64(ML_CN10K_POLL_JOB_START, &req->status);\n+\tplt_wmb();\n+\n+\tlocked = false;\n+\twhile (!locked) {\n+\t\tif (plt_spinlock_trylock(&model->lock) != 0) {\n+\t\t\tif (model->state == ML_CN10K_MODEL_STATE_LOADED) {\n+\t\t\t\tplt_ml_dbg(\"Model not started, model = 0x%016lx\",\n+\t\t\t\t\t   PLT_U64_CAST(model));\n+\t\t\t\tplt_spinlock_unlock(&model->lock);\n+\t\t\t\treturn 1;\n+\t\t\t}\n+\n+\t\t\tif (model->state == ML_CN10K_MODEL_STATE_JOB_ACTIVE) {\n+\t\t\t\tplt_err(\"A slow-path job is active for the model = 0x%016lx\",\n+\t\t\t\t\tPLT_U64_CAST(model));\n+\t\t\t\tplt_spinlock_unlock(&model->lock);\n+\t\t\t\treturn -EBUSY;\n+\t\t\t}\n+\n+\t\t\tmodel->state = ML_CN10K_MODEL_STATE_JOB_ACTIVE;\n+\t\t\tplt_spinlock_unlock(&model->lock);\n+\t\t\tlocked = true;\n+\t\t}\n+\t}\n+\n+\twhile (model->model_mem_map.ocm_reserved) {\n+\t\tif (plt_spinlock_trylock(&ocm->lock) != 0) {\n+\t\t\tcn10k_ml_ocm_free_pages(dev, model->model_id);\n+\t\t\tmodel->model_mem_map.ocm_reserved = false;\n+\t\t\tmodel->model_mem_map.tilemask = 0x0;\n+\t\t\tplt_spinlock_unlock(&ocm->lock);\n+\t\t}\n+\t}\n+\n+\tjob_enqueued = false;\n+\tjob_dequeued = false;\n+\tdo {\n+\t\tif (!job_enqueued) {\n+\t\t\treq->timeout = plt_tsc_cycles() + ML_CN10K_CMD_TIMEOUT * plt_tsc_hz();\n+\t\t\tjob_enqueued = roc_ml_scratch_enqueue(&mldev->roc, &req->jd);\n+\t\t}\n+\n+\t\tif (job_enqueued && !job_dequeued)\n+\t\t\tjob_dequeued = roc_ml_scratch_dequeue(&mldev->roc, &req->jd);\n+\n+\t\tif (job_dequeued)\n+\t\t\tbreak;\n+\t} while (plt_tsc_cycles() < req->timeout);\n+\n+\tif (job_dequeued) {\n+\t\tif (plt_read64(&req->status) == ML_CN10K_POLL_JOB_FINISH) {\n+\t\t\tif (req->result.error_code == 0x0)\n+\t\t\t\tret = 0;\n+\t\t\telse\n+\t\t\t\tret = -1;\n+\t\t}\n+\t} else {\n+\t\troc_ml_scratch_queue_reset(&mldev->roc);\n+\t\tret = -ETIME;\n+\t}\n+\n+\tlocked = false;\n+\twhile (!locked) {\n+\t\tif (plt_spinlock_trylock(&model->lock) != 0) {\n+\t\t\tmodel->state = ML_CN10K_MODEL_STATE_LOADED;\n+\t\t\tplt_spinlock_unlock(&model->lock);\n+\t\t\tlocked = true;\n+\t\t}\n+\t}\n+\n+\treturn ret;\n+}\n+\n struct rte_ml_dev_ops cn10k_ml_ops = {\n \t/* Device control ops */\n \t.dev_info_get = cn10k_ml_dev_info_get,\n@@ -783,4 +893,5 @@ struct rte_ml_dev_ops cn10k_ml_ops = {\n \t.model_load = cn10k_ml_model_load,\n \t.model_unload = cn10k_ml_model_unload,\n \t.model_start = cn10k_ml_model_start,\n+\t.model_stop = cn10k_ml_model_stop,\n };\ndiff --git a/drivers/ml/cnxk/cn10k_ml_ops.h b/drivers/ml/cnxk/cn10k_ml_ops.h\nindex 3fe3872fd1..5e7e42ee88 100644\n--- a/drivers/ml/cnxk/cn10k_ml_ops.h\n+++ b/drivers/ml/cnxk/cn10k_ml_ops.h\n@@ -65,5 +65,6 @@ int cn10k_ml_model_load(struct rte_ml_dev *dev, struct rte_ml_model_params *para\n \t\t\tint16_t *model_id);\n int cn10k_ml_model_unload(struct rte_ml_dev *dev, int16_t model_id);\n int cn10k_ml_model_start(struct rte_ml_dev *dev, int16_t model_id);\n+int cn10k_ml_model_stop(struct rte_ml_dev *dev, int16_t model_id);\n \n #endif /* _CN10K_ML_OPS_H_ */\n",
    "prefixes": [
        "v1",
        "18/37"
    ]
}