get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 125690,
    "url": "https://patches.dpdk.org/api/patches/125690/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/20230331154259.1447831-16-maxime.coquelin@redhat.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": "<20230331154259.1447831-16-maxime.coquelin@redhat.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20230331154259.1447831-16-maxime.coquelin@redhat.com",
    "date": "2023-03-31T15:42:47",
    "name": "[RFC,15/27] vhost: add API to set max queue pairs",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "1b0e0b1710e2ba9c5942d41ca3c2502d39d049e3",
    "submitter": {
        "id": 512,
        "url": "https://patches.dpdk.org/api/people/512/?format=api",
        "name": "Maxime Coquelin",
        "email": "maxime.coquelin@redhat.com"
    },
    "delegate": {
        "id": 2642,
        "url": "https://patches.dpdk.org/api/users/2642/?format=api",
        "username": "mcoquelin",
        "first_name": "Maxime",
        "last_name": "Coquelin",
        "email": "maxime.coquelin@redhat.com"
    },
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/20230331154259.1447831-16-maxime.coquelin@redhat.com/mbox/",
    "series": [
        {
            "id": 27594,
            "url": "https://patches.dpdk.org/api/series/27594/?format=api",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=27594",
            "date": "2023-03-31T15:42:32",
            "name": "Add VDUSE support to Vhost library",
            "version": 1,
            "mbox": "https://patches.dpdk.org/series/27594/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/125690/comments/",
    "check": "pending",
    "checks": "https://patches.dpdk.org/api/patches/125690/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 A6D3942887;\n\tFri, 31 Mar 2023 17:44:57 +0200 (CEST)",
            "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id F2DA742D49;\n\tFri, 31 Mar 2023 17:43:51 +0200 (CEST)",
            "from us-smtp-delivery-124.mimecast.com\n (us-smtp-delivery-124.mimecast.com [170.10.133.124])\n by mails.dpdk.org (Postfix) with ESMTP id EAB4842D3E\n for <dev@dpdk.org>; Fri, 31 Mar 2023 17:43:50 +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-398-MFhVoKgSMrajHtQQ3p2Ikg-1; Fri, 31 Mar 2023 11:43:47 -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 4335B101A531;\n Fri, 31 Mar 2023 15:43:46 +0000 (UTC)",
            "from max-t490s.redhat.com (unknown [10.39.208.6])\n by smtp.corp.redhat.com (Postfix) with ESMTP id 12BC7202701E;\n Fri, 31 Mar 2023 15:43:43 +0000 (UTC)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n s=mimecast20190719; t=1680277430;\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=Dlk/nURVg0Md1OSIcxv3lo8Of9GNwnZALhXR1S1uzW0=;\n b=PX+uzRly2y8+qmo0mhAQXOYqD/D6N8WCMaLVCP5b4CQ51wgbzOoYabTtuo4QAVcHr3ZLxP\n gy6LTuR9Y61Mm8EiRDhqYQvqjegAtkHryC2kty2YL6TfVd3S04WwFfjh0KTST+XyBK70+5\n FTRAl19ZFDGbnHVCmEsHSH4PRAQKOIU=",
        "X-MC-Unique": "MFhVoKgSMrajHtQQ3p2Ikg-1",
        "From": "Maxime Coquelin <maxime.coquelin@redhat.com>",
        "To": "dev@dpdk.org, david.marchand@redhat.com, chenbo.xia@intel.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",
        "Cc": "Maxime Coquelin <maxime.coquelin@redhat.com>",
        "Subject": "[RFC 15/27] vhost: add API to set max queue pairs",
        "Date": "Fri, 31 Mar 2023 17:42:47 +0200",
        "Message-Id": "<20230331154259.1447831-16-maxime.coquelin@redhat.com>",
        "In-Reply-To": "<20230331154259.1447831-1-maxime.coquelin@redhat.com>",
        "References": "<20230331154259.1447831-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 lib/vhost/rte_vhost.h               | 17 ++++++++++++++\n lib/vhost/socket.c                  | 36 +++++++++++++++++++++++++++--\n lib/vhost/version.map               |  3 +++\n 4 files changed, 58 insertions(+), 2 deletions(-)",
    "diff": "diff --git a/doc/guides/prog_guide/vhost_lib.rst b/doc/guides/prog_guide/vhost_lib.rst\nindex e8bb8c9b7b..cd4b109139 100644\n--- a/doc/guides/prog_guide/vhost_lib.rst\n+++ b/doc/guides/prog_guide/vhost_lib.rst\n@@ -334,6 +334,10 @@ The following is an overview of some key Vhost API functions:\n   Clean DMA vChannel finished to use. After this function is called,\n   the specified DMA vChannel should no longer be used by the Vhost library.\n \n+* ``rte_vhost_driver_set_max_queue_num(path, 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/lib/vhost/rte_vhost.h b/lib/vhost/rte_vhost.h\nindex 58a5d4be92..44cbfcb469 100644\n--- a/lib/vhost/rte_vhost.h\n+++ b/lib/vhost/rte_vhost.h\n@@ -588,6 +588,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 ba54263824..e95c3ffeac 100644\n--- a/lib/vhost/socket.c\n+++ b/lib/vhost/socket.c\n@@ -56,6 +56,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@@ -821,7 +823,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@@ -831,7 +833,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@@ -890,6 +921,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 d322a4a888..dffb126aa8 100644\n--- a/lib/vhost/version.map\n+++ b/lib/vhost/version.map\n@@ -98,6 +98,9 @@ EXPERIMENTAL {\n \t# added in 22.11\n \trte_vhost_async_dma_unconfigure;\n \trte_vhost_vring_call_nonblock;\n+\n+\t# added in 23.07\n+\trte_vhost_driver_set_max_queue_num;\n };\n \n INTERNAL {\n",
    "prefixes": [
        "RFC",
        "15/27"
    ]
}