get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 123300,
    "url": "https://patches.dpdk.org/api/patches/123300/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/20230207154943.18779-4-syalavarthi@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": "<20230207154943.18779-4-syalavarthi@marvell.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20230207154943.18779-4-syalavarthi@marvell.com",
    "date": "2023-02-07T15:49:34",
    "name": "[v4,03/12] app/mldev: add test case to validate device ops",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "fca499a329a01853eb18486864501858ae45cdad",
    "submitter": {
        "id": 2480,
        "url": "https://patches.dpdk.org/api/people/2480/?format=api",
        "name": "Srikanth Yalavarthi",
        "email": "syalavarthi@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/20230207154943.18779-4-syalavarthi@marvell.com/mbox/",
    "series": [
        {
            "id": 26858,
            "url": "https://patches.dpdk.org/api/series/26858/?format=api",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=26858",
            "date": "2023-02-07T15:49:31",
            "name": "Implementation of mldev test application",
            "version": 4,
            "mbox": "https://patches.dpdk.org/series/26858/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/123300/comments/",
    "check": "warning",
    "checks": "https://patches.dpdk.org/api/patches/123300/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 D845B41C30;\n\tTue,  7 Feb 2023 16:49:55 +0100 (CET)",
            "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 866E2427F2;\n\tTue,  7 Feb 2023 16:49:51 +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 5A3524021F\n for <dev@dpdk.org>; Tue,  7 Feb 2023 16:49:50 +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 317EYvZw001487 for <dev@dpdk.org>; Tue, 7 Feb 2023 07:49:49 -0800",
            "from dc5-exch01.marvell.com ([199.233.59.181])\n by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3nkdyrspn2-2\n (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT)\n for <dev@dpdk.org>; Tue, 07 Feb 2023 07:49:49 -0800",
            "from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH01.marvell.com\n (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.42;\n Tue, 7 Feb 2023 07:49:47 -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:49:47 -0800",
            "from ml-host-33.caveonetworks.com (unknown [10.110.143.233])\n by maili.marvell.com (Postfix) with ESMTP id 905A53F7088;\n Tue,  7 Feb 2023 07:49:47 -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=VLU/jx88aRsx2wJVwepH69XuLYfiqPBXpVI1MJgDKew=;\n b=GBaJCe2k/Ss2pYKdGISpG4UjRa3eHz1re5xnBFnO1x76+U74QL3FJPYDBL7dRWuFEeYC\n HU2xHS87VF6jsQKXe1RQqq6zEC7PSqDDhoEoUO+OSgCRBWsrM28Be2HURDqdHqiLHOEp\n 2Vf1hH6IA6fXyGe053CIiLTNTkJ+YVplWkkRDUVmJP/xRXL+xr5psYqHGPb9FoNYB1uB\n U3hJwaRwkzWhxEFfizxzqVks/lmWFlV5iN2CO+a3o1/S21RDRUdVIOF8mcZErE4yGzs1\n a5QPCCb6d85mUZUXYuxpR9dA9TspBJujbkKz5rV701MU9wb9hd4GK1yDhLi1wK78NSTE vQ==",
        "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>, <ptakkar@marvell.com>, <pshukla@marvell.com>",
        "Subject": "[PATCH v4 03/12] app/mldev: add test case to validate device ops",
        "Date": "Tue, 7 Feb 2023 07:49:34 -0800",
        "Message-ID": "<20230207154943.18779-4-syalavarthi@marvell.com>",
        "X-Mailer": "git-send-email 2.17.1",
        "In-Reply-To": "<20230207154943.18779-1-syalavarthi@marvell.com>",
        "References": "<20221129070746.20396-1-syalavarthi@marvell.com>\n <20230207154943.18779-1-syalavarthi@marvell.com>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain",
        "X-Proofpoint-ORIG-GUID": "CbD-RLvKSzUXn1mBYPdafebRjOWyTrT9",
        "X-Proofpoint-GUID": "CbD-RLvKSzUXn1mBYPdafebRjOWyTrT9",
        "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": "Added test case to validate device handling operations. Device ops\ntest is a collection of multiple sub-tests. Enabled sub-test to\nvalidate device reconfiguration. Set device_ops as the default test.\n\nSigned-off-by: Srikanth Yalavarthi <syalavarthi@marvell.com>\n---\n app/test-mldev/meson.build       |   1 +\n app/test-mldev/ml_options.c      |   5 +-\n app/test-mldev/test_device_ops.c | 234 +++++++++++++++++++++++++++++++\n app/test-mldev/test_device_ops.h |  17 +++\n 4 files changed, 255 insertions(+), 2 deletions(-)\n create mode 100644 app/test-mldev/test_device_ops.c\n create mode 100644 app/test-mldev/test_device_ops.h",
    "diff": "diff --git a/app/test-mldev/meson.build b/app/test-mldev/meson.build\nindex 964bb9ddc4..60ea23d142 100644\n--- a/app/test-mldev/meson.build\n+++ b/app/test-mldev/meson.build\n@@ -13,6 +13,7 @@ sources = files(\n         'ml_test.c',\n         'parser.c',\n         'test_common.c',\n+        'test_device_ops.c',\n )\n \n deps += ['mldev']\ndiff --git a/app/test-mldev/ml_options.c b/app/test-mldev/ml_options.c\nindex 8fd7760e36..2e5f11bca2 100644\n--- a/app/test-mldev/ml_options.c\n+++ b/app/test-mldev/ml_options.c\n@@ -24,7 +24,7 @@ void\n ml_options_default(struct ml_options *opt)\n {\n \tmemset(opt, 0, sizeof(*opt));\n-\tstrlcpy(opt->test_name, \"ml_test\", ML_TEST_NAME_MAX_LEN);\n+\tstrlcpy(opt->test_name, \"device_ops\", ML_TEST_NAME_MAX_LEN);\n \topt->dev_id = 0;\n \topt->socket_id = SOCKET_ID_ANY;\n \topt->debug = false;\n@@ -66,7 +66,8 @@ ml_parse_socket_id(struct ml_options *opt, const char *arg)\n static void\n ml_dump_test_options(const char *testname)\n {\n-\tRTE_SET_USED(testname);\n+\tif (strcmp(testname, \"device_ops\") == 0)\n+\t\tprintf(\"\\n\");\n }\n \n static void\ndiff --git a/app/test-mldev/test_device_ops.c b/app/test-mldev/test_device_ops.c\nnew file mode 100644\nindex 0000000000..4cafcf41a6\n--- /dev/null\n+++ b/app/test-mldev/test_device_ops.c\n@@ -0,0 +1,234 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright (c) 2022 Marvell.\n+ */\n+\n+#include <errno.h>\n+#include <stdbool.h>\n+#include <stdint.h>\n+#include <stdio.h>\n+#include <stdlib.h>\n+\n+#include <rte_common.h>\n+#include <rte_malloc.h>\n+#include <rte_mldev.h>\n+\n+#include \"ml_common.h\"\n+#include \"ml_options.h\"\n+#include \"test_device_ops.h\"\n+\n+static bool\n+test_device_cap_check(struct ml_options *opt)\n+{\n+\tif (!ml_test_cap_check(opt))\n+\t\treturn false;\n+\n+\treturn true;\n+}\n+\n+static int\n+test_device_opt_check(struct ml_options *opt)\n+{\n+\tint ret;\n+\n+\t/* check common opts */\n+\tret = ml_test_opt_check(opt);\n+\tif (ret != 0)\n+\t\treturn ret;\n+\n+\treturn 0;\n+}\n+\n+static void\n+test_device_opt_dump(struct ml_options *opt)\n+{\n+\t/* dump common opts */\n+\tml_test_opt_dump(opt);\n+}\n+\n+static int\n+test_device_setup(struct ml_test *test, struct ml_options *opt)\n+{\n+\tstruct test_device *t;\n+\tvoid *test_device;\n+\tint ret = 0;\n+\n+\t/* allocate for test structure */\n+\ttest_device = rte_zmalloc_socket(test->name, sizeof(struct test_device),\n+\t\t\t\t\t RTE_CACHE_LINE_SIZE, opt->socket_id);\n+\tif (test_device == NULL) {\n+\t\tml_err(\"failed to allocate memory for test_model\");\n+\t\tret = -ENOMEM;\n+\t\tgoto error;\n+\t}\n+\ttest->test_priv = test_device;\n+\tt = ml_test_priv(test);\n+\n+\tt->cmn.result = ML_TEST_FAILED;\n+\tt->cmn.opt = opt;\n+\n+\t/* get device info */\n+\tret = rte_ml_dev_info_get(opt->dev_id, &t->cmn.dev_info);\n+\tif (ret < 0) {\n+\t\tml_err(\"failed to get device info\");\n+\t\tgoto error;\n+\t}\n+\n+\treturn 0;\n+\n+error:\n+\tif (test_device != NULL)\n+\t\trte_free(test_device);\n+\n+\treturn ret;\n+}\n+\n+static void\n+test_device_destroy(struct ml_test *test, struct ml_options *opt)\n+{\n+\tstruct test_device *t;\n+\n+\tRTE_SET_USED(opt);\n+\n+\tt = ml_test_priv(test);\n+\tif (t != NULL)\n+\t\trte_free(t);\n+}\n+\n+static int\n+test_device_reconfigure(struct ml_test *test, struct ml_options *opt)\n+{\n+\tstruct rte_ml_dev_config dev_config;\n+\tstruct rte_ml_dev_qp_conf qp_conf;\n+\tstruct test_device *t;\n+\tuint16_t qp_id = 0;\n+\tint ret = 0;\n+\n+\tt = ml_test_priv(test);\n+\n+\t/* configure with default options */\n+\tret = ml_test_device_configure(test, opt);\n+\tif (ret != 0)\n+\t\treturn ret;\n+\n+\t/* setup one queue pair with nb_desc = 1 */\n+\tqp_conf.nb_desc = 1;\n+\tqp_conf.cb = NULL;\n+\n+\tret = rte_ml_dev_queue_pair_setup(opt->dev_id, qp_id, &qp_conf, opt->socket_id);\n+\tif (ret != 0) {\n+\t\tml_err(\"Failed to setup ML device queue-pair, dev_id = %d, qp_id = %u\\n\",\n+\t\t       opt->dev_id, qp_id);\n+\t\tgoto error;\n+\t}\n+\n+\t/* start device */\n+\tret = ml_test_device_start(test, opt);\n+\tif (ret != 0)\n+\t\tgoto error;\n+\n+\t/* stop device */\n+\tret = ml_test_device_stop(test, opt);\n+\tif (ret != 0) {\n+\t\tml_err(\"Failed to stop device\");\n+\t\tgoto error;\n+\t}\n+\n+\t/* reconfigure device based on dev_info */\n+\tdev_config.socket_id = opt->socket_id;\n+\tdev_config.nb_models = t->cmn.dev_info.max_models;\n+\tdev_config.nb_queue_pairs = t->cmn.dev_info.max_queue_pairs;\n+\tret = rte_ml_dev_configure(opt->dev_id, &dev_config);\n+\tif (ret != 0) {\n+\t\tml_err(\"Failed to reconfigure ML device, dev_id = %d\\n\", opt->dev_id);\n+\t\treturn ret;\n+\t}\n+\n+\t/* setup queue pairs */\n+\tfor (qp_id = 0; qp_id < t->cmn.dev_info.max_queue_pairs; qp_id++) {\n+\t\tqp_conf.nb_desc = t->cmn.dev_info.max_desc;\n+\t\tqp_conf.cb = NULL;\n+\n+\t\tret = rte_ml_dev_queue_pair_setup(opt->dev_id, qp_id, &qp_conf, opt->socket_id);\n+\t\tif (ret != 0) {\n+\t\t\tml_err(\"Failed to setup ML device queue-pair, dev_id = %d, qp_id = %u\\n\",\n+\t\t\t       opt->dev_id, qp_id);\n+\t\t\tgoto error;\n+\t\t}\n+\t}\n+\n+\t/* start device */\n+\tret = ml_test_device_start(test, opt);\n+\tif (ret != 0)\n+\t\tgoto error;\n+\n+\t/* stop device */\n+\tret = ml_test_device_stop(test, opt);\n+\tif (ret != 0)\n+\t\tgoto error;\n+\n+\t/* close device */\n+\tret = ml_test_device_close(test, opt);\n+\tif (ret != 0)\n+\t\treturn ret;\n+\n+\treturn 0;\n+\n+error:\n+\tml_test_device_close(test, opt);\n+\n+\treturn ret;\n+}\n+\n+static int\n+test_device_driver(struct ml_test *test, struct ml_options *opt)\n+{\n+\tstruct test_device *t;\n+\tint ret = 0;\n+\n+\tt = ml_test_priv(test);\n+\n+\t/* sub-test: device reconfigure */\n+\tret = test_device_reconfigure(test, opt);\n+\tif (ret != 0) {\n+\t\tprintf(\"\\n\");\n+\t\tprintf(\"Model Device Reconfigure Test: \" CLRED \"%s\" CLNRM \"\\n\", \"Failed\");\n+\t\tgoto error;\n+\t} else {\n+\t\tprintf(\"\\n\");\n+\t\tprintf(\"Model Device Reconfigure Test: \" CLYEL \"%s\" CLNRM \"\\n\", \"Passed\");\n+\t}\n+\n+\tprintf(\"\\n\");\n+\n+\tt->cmn.result = ML_TEST_SUCCESS;\n+\n+\treturn 0;\n+\n+error:\n+\tt->cmn.result = ML_TEST_FAILED;\n+\treturn -1;\n+}\n+\n+static int\n+test_device_result(struct ml_test *test, struct ml_options *opt)\n+{\n+\tstruct test_device *t;\n+\n+\tRTE_SET_USED(opt);\n+\n+\tt = ml_test_priv(test);\n+\n+\treturn t->cmn.result;\n+}\n+\n+static const struct ml_test_ops device_ops = {\n+\t.cap_check = test_device_cap_check,\n+\t.opt_check = test_device_opt_check,\n+\t.opt_dump = test_device_opt_dump,\n+\t.test_setup = test_device_setup,\n+\t.test_destroy = test_device_destroy,\n+\t.test_driver = test_device_driver,\n+\t.test_result = test_device_result,\n+};\n+\n+ML_TEST_REGISTER(device_ops);\ndiff --git a/app/test-mldev/test_device_ops.h b/app/test-mldev/test_device_ops.h\nnew file mode 100644\nindex 0000000000..115b1072a2\n--- /dev/null\n+++ b/app/test-mldev/test_device_ops.h\n@@ -0,0 +1,17 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright (c) 2022 Marvell.\n+ */\n+\n+#ifndef _ML_TEST_DEVICE_OPS_\n+#define _ML_TEST_DEVICE_OPS_\n+\n+#include <rte_common.h>\n+\n+#include \"test_common.h\"\n+\n+struct test_device {\n+\t/* common data */\n+\tstruct test_common cmn;\n+} __rte_cache_aligned;\n+\n+#endif /* _ML_TEST_DEVICE_OPS_ */\n",
    "prefixes": [
        "v4",
        "03/12"
    ]
}