get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 127920,
    "url": "http://patches.dpdk.org/api/patches/127920/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20230601200812.672233-14-maxime.coquelin@redhat.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": "<20230601200812.672233-14-maxime.coquelin@redhat.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20230601200812.672233-14-maxime.coquelin@redhat.com",
    "date": "2023-06-01T20:07:59",
    "name": "[v4,13/26] vhost: add API to set max queue pairs",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "04eefc8925a7c184a7c12a3da0262036e1e31521",
    "submitter": {
        "id": 512,
        "url": "http://patches.dpdk.org/api/people/512/?format=api",
        "name": "Maxime Coquelin",
        "email": "maxime.coquelin@redhat.com"
    },
    "delegate": {
        "id": 2642,
        "url": "http://patches.dpdk.org/api/users/2642/?format=api",
        "username": "mcoquelin",
        "first_name": "Maxime",
        "last_name": "Coquelin",
        "email": "maxime.coquelin@redhat.com"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/20230601200812.672233-14-maxime.coquelin@redhat.com/mbox/",
    "series": [
        {
            "id": 28308,
            "url": "http://patches.dpdk.org/api/series/28308/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=28308",
            "date": "2023-06-01T20:07:46",
            "name": "Add VDUSE support to Vhost library",
            "version": 4,
            "mbox": "http://patches.dpdk.org/series/28308/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/127920/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/127920/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 A968F42C08;\n\tThu,  1 Jun 2023 22:09:44 +0200 (CEST)",
            "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id E68E142D35;\n\tThu,  1 Jun 2023 22:09:02 +0200 (CEST)",
            "from us-smtp-delivery-124.mimecast.com\n (us-smtp-delivery-124.mimecast.com [170.10.129.124])\n by mails.dpdk.org (Postfix) with ESMTP id 7C50D42D13\n for <dev@dpdk.org>; Thu,  1 Jun 2023 22:09:01 +0200 (CEST)",
            "from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com\n [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS\n (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id\n us-mta-523-tWF5Msa6ORm2MdSWcMyZDg-1; Thu, 01 Jun 2023 16:08:58 -0400",
            "from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com\n [10.11.54.4])\n (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n (No client certificate requested)\n by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A74CA85A5AA;\n Thu,  1 Jun 2023 20:08:57 +0000 (UTC)",
            "from max-t490s.redhat.com (unknown [10.39.208.25])\n by smtp.corp.redhat.com (Postfix) with ESMTP id 1A9D0200AE6F;\n Thu,  1 Jun 2023 20:08:54 +0000 (UTC)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n s=mimecast20190719; t=1685650141;\n h=from:from:reply-to:subject:subject:date:date:message-id:message-id:\n to:to:cc:cc:mime-version:mime-version:content-type:content-type:\n content-transfer-encoding:content-transfer-encoding:\n in-reply-to:in-reply-to:references:references;\n bh=efX2tscuvNWnUeV8epCwn18SwAwA5eHT1MXkbWj5H6c=;\n b=jL5FkhreU93uFuvR2VO13eEI18ZGtVFnkrHL0ZukqCEDgC9or/w9OyWtAUQu5XaOkSzTKm\n 0T1RZVnDy3DdSjOEY2O//yBCYTYlDNyuCp2cDPZroNMx7uxtSgMubZS7yGuolZDvjuIk9f\n 9Pro6Y4Y3Sor7xZCoZwhO/poOF2qYpU=",
        "X-MC-Unique": "tWF5Msa6ORm2MdSWcMyZDg-1",
        "From": "Maxime Coquelin <maxime.coquelin@redhat.com>",
        "To": "dev@dpdk.org, chenbo.xia@intel.com, david.marchand@redhat.com,\n mkp@redhat.com, fbl@redhat.com, jasowang@redhat.com,\n cunming.liang@intel.com, xieyongji@bytedance.com, echaudro@redhat.com,\n eperezma@redhat.com, amorenoz@redhat.com, lulu@redhat.com",
        "Cc": "Maxime Coquelin <maxime.coquelin@redhat.com>",
        "Subject": "[PATCH v4 13/26] vhost: add API to set max queue pairs",
        "Date": "Thu,  1 Jun 2023 22:07:59 +0200",
        "Message-Id": "<20230601200812.672233-14-maxime.coquelin@redhat.com>",
        "In-Reply-To": "<20230601200812.672233-1-maxime.coquelin@redhat.com>",
        "References": "<20230601200812.672233-1-maxime.coquelin@redhat.com>",
        "MIME-Version": "1.0",
        "X-Scanned-By": "MIMEDefang 3.1 on 10.11.54.4",
        "X-Mimecast-Spam-Score": "0",
        "X-Mimecast-Originator": "redhat.com",
        "Content-Transfer-Encoding": "8bit",
        "Content-Type": "text/plain; charset=\"US-ASCII\"; x-default=true",
        "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": "This patch introduces a new rte_vhost_driver_set_max_queues\nAPI as preliminary work for multiqueue support with VDUSE.\n\nIndeed, with VDUSE we need to pre-allocate the vrings at\ndevice creation time, so we need such API not to allocate\nthe 128 queue pairs supported by the Vhost library.\n\nCalling the API is optional, 128 queue pairs remaining the\ndefault.\n\nSigned-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>\n---\n doc/guides/prog_guide/vhost_lib.rst    |  4 +++\n doc/guides/rel_notes/release_23_07.rst |  5 ++++\n lib/vhost/rte_vhost.h                  | 17 ++++++++++++\n lib/vhost/socket.c                     | 36 ++++++++++++++++++++++++--\n lib/vhost/version.map                  |  1 +\n 5 files changed, 61 insertions(+), 2 deletions(-)",
    "diff": "diff --git a/doc/guides/prog_guide/vhost_lib.rst b/doc/guides/prog_guide/vhost_lib.rst\nindex 0f964d7a4a..0c2b4d020a 100644\n--- a/doc/guides/prog_guide/vhost_lib.rst\n+++ b/doc/guides/prog_guide/vhost_lib.rst\n@@ -339,6 +339,10 @@ The following is an overview of some key Vhost API functions:\n   Inject the offloaded interrupt received by the 'guest_notify' callback,\n   into the vhost device's queue.\n \n+* ``rte_vhost_driver_set_max_queue_num(const char *path, uint32_t max_queue_pairs)``\n+\n+  Set the maximum number of queue pairs supported by the device.\n+\n Vhost-user Implementations\n --------------------------\n \ndiff --git a/doc/guides/rel_notes/release_23_07.rst b/doc/guides/rel_notes/release_23_07.rst\nindex 3eed8ac561..7034fb664c 100644\n--- a/doc/guides/rel_notes/release_23_07.rst\n+++ b/doc/guides/rel_notes/release_23_07.rst\n@@ -62,6 +62,11 @@ New Features\n   rte_vhost_notify_guest(), is added to raise the interrupt outside of the\n   fast path.\n \n+* **Added Vhost API to set maximum queue pairs supported.**\n+\n+  Introduced ``rte_vhost_driver_set_max_queue_num()`` to be able to limit the\n+  maximum number of supported queue pairs, required for VDUSE support.\n+\n \n Removed Items\n -------------\ndiff --git a/lib/vhost/rte_vhost.h b/lib/vhost/rte_vhost.h\nindex 7a10bc36cf..7844c9f142 100644\n--- a/lib/vhost/rte_vhost.h\n+++ b/lib/vhost/rte_vhost.h\n@@ -609,6 +609,23 @@ rte_vhost_driver_get_protocol_features(const char *path,\n int\n rte_vhost_driver_get_queue_num(const char *path, uint32_t *queue_num);\n \n+/**\n+ * @warning\n+ * @b EXPERIMENTAL: this API may change, or be removed, without prior notice.\n+ *\n+ * Set the maximum number of queue pairs supported by the device.\n+ *\n+ * @param path\n+ *  The vhost-user socket file path\n+ * @param max_queue_pairs\n+ *  The maximum number of queue pairs\n+ * @return\n+ *  0 on success, -1 on failure\n+ */\n+__rte_experimental\n+int\n+rte_vhost_driver_set_max_queue_num(const char *path, uint32_t max_queue_pairs);\n+\n /**\n  * Get the feature bits after negotiation\n  *\ndiff --git a/lib/vhost/socket.c b/lib/vhost/socket.c\nindex 407d0011c3..29f7a8cece 100644\n--- a/lib/vhost/socket.c\n+++ b/lib/vhost/socket.c\n@@ -57,6 +57,8 @@ struct vhost_user_socket {\n \n \tuint64_t protocol_features;\n \n+\tuint32_t max_queue_pairs;\n+\n \tstruct rte_vdpa_device *vdpa_dev;\n \n \tstruct rte_vhost_device_ops const *notify_ops;\n@@ -823,7 +825,7 @@ rte_vhost_driver_get_queue_num(const char *path, uint32_t *queue_num)\n \n \tvdpa_dev = vsocket->vdpa_dev;\n \tif (!vdpa_dev) {\n-\t\t*queue_num = VHOST_MAX_QUEUE_PAIRS;\n+\t\t*queue_num = vsocket->max_queue_pairs;\n \t\tgoto unlock_exit;\n \t}\n \n@@ -833,7 +835,36 @@ rte_vhost_driver_get_queue_num(const char *path, uint32_t *queue_num)\n \t\tgoto unlock_exit;\n \t}\n \n-\t*queue_num = RTE_MIN((uint32_t)VHOST_MAX_QUEUE_PAIRS, vdpa_queue_num);\n+\t*queue_num = RTE_MIN(vsocket->max_queue_pairs, vdpa_queue_num);\n+\n+unlock_exit:\n+\tpthread_mutex_unlock(&vhost_user.mutex);\n+\treturn ret;\n+}\n+\n+int\n+rte_vhost_driver_set_max_queue_num(const char *path, uint32_t max_queue_pairs)\n+{\n+\tstruct vhost_user_socket *vsocket;\n+\tint ret = 0;\n+\n+\tVHOST_LOG_CONFIG(path, INFO, \"Setting max queue pairs to %u\\n\", max_queue_pairs);\n+\n+\tif (max_queue_pairs > VHOST_MAX_QUEUE_PAIRS) {\n+\t\tVHOST_LOG_CONFIG(path, ERR, \"Library only supports up to %u queue pairs\\n\",\n+\t\t\t\tVHOST_MAX_QUEUE_PAIRS);\n+\t\treturn -1;\n+\t}\n+\n+\tpthread_mutex_lock(&vhost_user.mutex);\n+\tvsocket = find_vhost_user_socket(path);\n+\tif (!vsocket) {\n+\t\tVHOST_LOG_CONFIG(path, ERR, \"socket file is not registered yet.\\n\");\n+\t\tret = -1;\n+\t\tgoto unlock_exit;\n+\t}\n+\n+\tvsocket->max_queue_pairs = max_queue_pairs;\n \n unlock_exit:\n \tpthread_mutex_unlock(&vhost_user.mutex);\n@@ -889,6 +920,7 @@ rte_vhost_driver_register(const char *path, uint64_t flags)\n \t\tgoto out_free;\n \t}\n \tvsocket->vdpa_dev = NULL;\n+\tvsocket->max_queue_pairs = VHOST_MAX_QUEUE_PAIRS;\n \tvsocket->extbuf = flags & RTE_VHOST_USER_EXTBUF_SUPPORT;\n \tvsocket->linearbuf = flags & RTE_VHOST_USER_LINEARBUF_SUPPORT;\n \tvsocket->async_copy = flags & RTE_VHOST_USER_ASYNC_COPY;\ndiff --git a/lib/vhost/version.map b/lib/vhost/version.map\nindex 7bcbfd12cf..5051c29022 100644\n--- a/lib/vhost/version.map\n+++ b/lib/vhost/version.map\n@@ -107,6 +107,7 @@ EXPERIMENTAL {\n \n         # added in 23.07\n \trte_vhost_notify_guest;\n+\trte_vhost_driver_set_max_queue_num;\n };\n \n INTERNAL {\n",
    "prefixes": [
        "v4",
        "13/26"
    ]
}