get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 123293,
    "url": "https://patches.dpdk.org/api/patches/123293/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/20230207151747.245808-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": "<20230207151747.245808-16-maxime.coquelin@redhat.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20230207151747.245808-16-maxime.coquelin@redhat.com",
    "date": "2023-02-07T15:17:41",
    "name": "[v2,15/21] net/virtio-user: get max number of queue pairs from device",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "85400db9eb052ea10bb4142a048c0ac0897278dd",
    "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/20230207151747.245808-16-maxime.coquelin@redhat.com/mbox/",
    "series": [
        {
            "id": 26854,
            "url": "https://patches.dpdk.org/api/series/26854/?format=api",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=26854",
            "date": "2023-02-07T15:17:33",
            "name": "Add control queue & MQ support to Virtio-user vDPA",
            "version": 2,
            "mbox": "https://patches.dpdk.org/series/26854/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/123293/comments/",
    "check": "success",
    "checks": "https://patches.dpdk.org/api/patches/123293/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 170F041C30;\n\tTue,  7 Feb 2023 16:20:32 +0100 (CET)",
            "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 4B0AB42FC0;\n\tTue,  7 Feb 2023 16:19:01 +0100 (CET)",
            "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 64FC342DC6\n for <dev@dpdk.org>; Tue,  7 Feb 2023 16:18:57 +0100 (CET)",
            "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-351-DXLw4xRBNAKFS4MR2MQOAg-1; Tue, 07 Feb 2023 10:18:50 -0500",
            "from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com\n [10.11.54.7])\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 B590182402A;\n Tue,  7 Feb 2023 15:18:18 +0000 (UTC)",
            "from max-t490s.redhat.com (unknown [10.39.208.26])\n by smtp.corp.redhat.com (Postfix) with ESMTP id 69BEB140EBF4;\n Tue,  7 Feb 2023 15:18:17 +0000 (UTC)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n s=mimecast20190719; t=1675783136;\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=inc0Gq+0xtpY6cld4VG1xw0a+xvFzl3wGKQGCbx8DCQ=;\n b=CWyGsqPAayvGEbrodcv2ECREv1RAQFzK+mdvqN7RXINgocB6TGVVAMwdVtGQ+4ZTIu/7kn\n PYXCgII/LSoun//fbA4XXTwoqaqW6cSk17Yxl2FJ5OrMkFvtIkE4o1+THyB0Cg4eM4yiDY\n kutAsTBgR7LOSlIRgFTHzbnFOZ6kcEQ=",
        "X-MC-Unique": "DXLw4xRBNAKFS4MR2MQOAg-1",
        "From": "Maxime Coquelin <maxime.coquelin@redhat.com>",
        "To": "dev@dpdk.org, chenbo.xia@intel.com, david.marchand@redhat.com,\n eperezma@redhat.com, stephen@networkplumber.org",
        "Cc": "Maxime Coquelin <maxime.coquelin@redhat.com>",
        "Subject": "[PATCH v2 15/21] net/virtio-user: get max number of queue pairs from\n device",
        "Date": "Tue,  7 Feb 2023 16:17:41 +0100",
        "Message-Id": "<20230207151747.245808-16-maxime.coquelin@redhat.com>",
        "In-Reply-To": "<20230207151747.245808-1-maxime.coquelin@redhat.com>",
        "References": "<20230207151747.245808-1-maxime.coquelin@redhat.com>",
        "MIME-Version": "1.0",
        "X-Scanned-By": "MIMEDefang 3.1 on 10.11.54.7",
        "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": "When supported by the backend (only vDPA for now), this\npatch gets the maximum number of queue pairs supported by\nthe device by querying it in its config space.\n\nThis is required for adding backend control queue support,\nas is index equals the maximum number of queues supported\nby the device as described by the Virtio specification.\n\nSigned-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>\nReviewed-by: Chenbo Xia <chenbo.xia@intel.com>\n---\n .../net/virtio/virtio_user/virtio_user_dev.c  | 93 ++++++++++++++-----\n drivers/net/virtio/virtio_user_ethdev.c       |  7 --\n 2 files changed, 71 insertions(+), 29 deletions(-)",
    "diff": "diff --git a/drivers/net/virtio/virtio_user/virtio_user_dev.c b/drivers/net/virtio/virtio_user/virtio_user_dev.c\nindex 809c9ef442..a3584e7735 100644\n--- a/drivers/net/virtio/virtio_user/virtio_user_dev.c\n+++ b/drivers/net/virtio/virtio_user/virtio_user_dev.c\n@@ -253,6 +253,50 @@ int virtio_user_stop_device(struct virtio_user_dev *dev)\n \treturn -1;\n }\n \n+static int\n+virtio_user_dev_init_max_queue_pairs(struct virtio_user_dev *dev, uint32_t user_max_qp)\n+{\n+\tint ret;\n+\n+\tif (!(dev->device_features & (1ULL << VIRTIO_NET_F_MQ))) {\n+\t\tdev->max_queue_pairs = 1;\n+\t\treturn 0;\n+\t}\n+\n+\tif (!dev->ops->get_config) {\n+\t\tdev->max_queue_pairs = user_max_qp;\n+\t\treturn 0;\n+\t}\n+\n+\tret = dev->ops->get_config(dev, (uint8_t *)&dev->max_queue_pairs,\n+\t\t\toffsetof(struct virtio_net_config, max_virtqueue_pairs),\n+\t\t\tsizeof(uint16_t));\n+\tif (ret) {\n+\t\t/*\n+\t\t * We need to know the max queue pair from the device so that\n+\t\t * the control queue gets the right index.\n+\t\t */\n+\t\tdev->max_queue_pairs = 1;\n+\t\tPMD_DRV_LOG(ERR, \"(%s) Failed to get max queue pairs from device\", dev->path);\n+\n+\t\treturn ret;\n+\t}\n+\n+\tif (dev->max_queue_pairs > VIRTIO_MAX_VIRTQUEUE_PAIRS) {\n+\t\t/*\n+\t\t * If the device supports control queue, the control queue\n+\t\t * index is max_virtqueue_pairs * 2. Disable MQ if it happens.\n+\t\t */\n+\t\tPMD_DRV_LOG(ERR, \"(%s) Device advertises too many queues (%u, max supported %u)\",\n+\t\t\t\tdev->path, dev->max_queue_pairs, VIRTIO_MAX_VIRTQUEUE_PAIRS);\n+\t\tdev->max_queue_pairs = 1;\n+\n+\t\treturn -1;\n+\t}\n+\n+\treturn 0;\n+}\n+\n int\n virtio_user_dev_set_mac(struct virtio_user_dev *dev)\n {\n@@ -511,24 +555,7 @@ virtio_user_dev_setup(struct virtio_user_dev *dev)\n \t\treturn -1;\n \t}\n \n-\tif (virtio_user_dev_init_notify(dev) < 0) {\n-\t\tPMD_INIT_LOG(ERR, \"(%s) Failed to init notifiers\", dev->path);\n-\t\tgoto destroy;\n-\t}\n-\n-\tif (virtio_user_fill_intr_handle(dev) < 0) {\n-\t\tPMD_INIT_LOG(ERR, \"(%s) Failed to init interrupt handler\", dev->path);\n-\t\tgoto uninit;\n-\t}\n-\n \treturn 0;\n-\n-uninit:\n-\tvirtio_user_dev_uninit_notify(dev);\n-destroy:\n-\tdev->ops->destroy(dev);\n-\n-\treturn -1;\n }\n \n /* Use below macro to filter features from vhost backend */\n@@ -570,7 +597,6 @@ virtio_user_dev_init(struct virtio_user_dev *dev, char *path, uint16_t queues,\n \t}\n \n \tdev->started = 0;\n-\tdev->max_queue_pairs = queues;\n \tdev->queue_pairs = 1; /* mq disabled by default */\n \tdev->queue_size = queue_size;\n \tdev->is_server = server;\n@@ -591,23 +617,39 @@ virtio_user_dev_init(struct virtio_user_dev *dev, char *path, uint16_t queues,\n \n \tif (dev->ops->set_owner(dev) < 0) {\n \t\tPMD_INIT_LOG(ERR, \"(%s) Failed to set backend owner\", dev->path);\n-\t\treturn -1;\n+\t\tgoto destroy;\n \t}\n \n \tif (dev->ops->get_backend_features(&backend_features) < 0) {\n \t\tPMD_INIT_LOG(ERR, \"(%s) Failed to get backend features\", dev->path);\n-\t\treturn -1;\n+\t\tgoto destroy;\n \t}\n \n \tdev->unsupported_features = ~(VIRTIO_USER_SUPPORTED_FEATURES | backend_features);\n \n \tif (dev->ops->get_features(dev, &dev->device_features) < 0) {\n \t\tPMD_INIT_LOG(ERR, \"(%s) Failed to get device features\", dev->path);\n-\t\treturn -1;\n+\t\tgoto destroy;\n \t}\n \n \tvirtio_user_dev_init_mac(dev, mac);\n \n+\tif (virtio_user_dev_init_max_queue_pairs(dev, queues))\n+\t\tdev->unsupported_features |= (1ull << VIRTIO_NET_F_MQ);\n+\n+\tif (dev->max_queue_pairs > 1)\n+\t\tcq = 1;\n+\n+\tif (virtio_user_dev_init_notify(dev) < 0) {\n+\t\tPMD_INIT_LOG(ERR, \"(%s) Failed to init notifiers\", dev->path);\n+\t\tgoto destroy;\n+\t}\n+\n+\tif (virtio_user_fill_intr_handle(dev) < 0) {\n+\t\tPMD_INIT_LOG(ERR, \"(%s) Failed to init interrupt handler\", dev->path);\n+\t\tgoto notify_uninit;\n+\t}\n+\n \tif (!mrg_rxbuf)\n \t\tdev->unsupported_features |= (1ull << VIRTIO_NET_F_MRG_RXBUF);\n \n@@ -651,11 +693,18 @@ virtio_user_dev_init(struct virtio_user_dev *dev, char *path, uint16_t queues,\n \t\tif (rte_errno != ENOTSUP) {\n \t\t\tPMD_INIT_LOG(ERR, \"(%s) Failed to register mem event callback\",\n \t\t\t\t\tdev->path);\n-\t\t\treturn -1;\n+\t\t\tgoto notify_uninit;\n \t\t}\n \t}\n \n \treturn 0;\n+\n+notify_uninit:\n+\tvirtio_user_dev_uninit_notify(dev);\n+destroy:\n+\tdev->ops->destroy(dev);\n+\n+\treturn -1;\n }\n \n void\ndiff --git a/drivers/net/virtio/virtio_user_ethdev.c b/drivers/net/virtio/virtio_user_ethdev.c\nindex 6ad5896378..6c3e875793 100644\n--- a/drivers/net/virtio/virtio_user_ethdev.c\n+++ b/drivers/net/virtio/virtio_user_ethdev.c\n@@ -595,8 +595,6 @@ virtio_user_pmd_probe(struct rte_vdev_device *vdev)\n \t\t\t\t     VIRTIO_USER_ARG_CQ_NUM);\n \t\t\tgoto end;\n \t\t}\n-\t} else if (queues > 1) {\n-\t\tcq = 1;\n \t}\n \n \tif (rte_kvargs_count(kvlist, VIRTIO_USER_ARG_PACKED_VQ) == 1) {\n@@ -617,11 +615,6 @@ virtio_user_pmd_probe(struct rte_vdev_device *vdev)\n \t\t}\n \t}\n \n-\tif (queues > 1 && cq == 0) {\n-\t\tPMD_INIT_LOG(ERR, \"multi-q requires ctrl-q\");\n-\t\tgoto end;\n-\t}\n-\n \tif (queues > VIRTIO_MAX_VIRTQUEUE_PAIRS) {\n \t\tPMD_INIT_LOG(ERR, \"arg %s %\" PRIu64 \" exceeds the limit %u\",\n \t\t\tVIRTIO_USER_ARG_QUEUES_NUM, queues,\n",
    "prefixes": [
        "v2",
        "15/21"
    ]
}