Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/120372/?format=api
https://patches.dpdk.org/api/patches/120372/?format=api", "web_url": "https://patches.dpdk.org/project/dpdk/patch/20221130155639.150553-17-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": "<20221130155639.150553-17-maxime.coquelin@redhat.com>", "list_archive_url": "https://inbox.dpdk.org/dev/20221130155639.150553-17-maxime.coquelin@redhat.com", "date": "2022-11-30T15:56:34", "name": "[v1,16/21] net/virtio-user: allocate shadow control queue", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "f256cb4900f589bdcda4b788e3139484113847a3", "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/20221130155639.150553-17-maxime.coquelin@redhat.com/mbox/", "series": [ { "id": 25958, "url": "https://patches.dpdk.org/api/series/25958/?format=api", "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=25958", "date": "2022-11-30T15:56:18", "name": "Add control queue & MQ support to Virtio-user vDPA", "version": 1, "mbox": "https://patches.dpdk.org/series/25958/mbox/" } ], "comments": "https://patches.dpdk.org/api/patches/120372/comments/", "check": "success", "checks": "https://patches.dpdk.org/api/patches/120372/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 62C5DA00C2;\n\tWed, 30 Nov 2022 16:58:28 +0100 (CET)", "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id ABB9B42D6C;\n\tWed, 30 Nov 2022 16:57:15 +0100 (CET)", "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 2640742D53\n for <dev@dpdk.org>; Wed, 30 Nov 2022 16:57:14 +0100 (CET)", "from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com\n [66.187.233.73]) 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-608-Q9VQc91nOJm-EYNBk7pkgw-1; Wed, 30 Nov 2022 10:57:12 -0500", "from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com\n [10.11.54.1])\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 DFA6929DD99B;\n Wed, 30 Nov 2022 15:57:11 +0000 (UTC)", "from max-t490s.redhat.com (unknown [10.39.208.22])\n by smtp.corp.redhat.com (Postfix) with ESMTP id BDE3A40C83ED;\n Wed, 30 Nov 2022 15:57:10 +0000 (UTC)" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n s=mimecast20190719; t=1669823833;\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=V3KPmseeDxJ6fpegA1k/gn0f3UPqt1YANwrDgFY5PYI=;\n b=E9QbgjVIyz/Hsrzn7JJFNQkcFd8qSAGHzpFgrVU1po5q3q2VnvdCudsL65DTrDDx/16HqG\n zc8IVnrMCfjj0CnwVvkba0vlU/tP0nIfBWpESlifQfu6yGUG1z5PM35BvZ16mp5Kpfxc2w\n BgbMnmSB1Z/MQdCgw6c4nvwARLIu4NE=", "X-MC-Unique": "Q9VQc91nOJm-EYNBk7pkgw-1", "From": "Maxime Coquelin <maxime.coquelin@redhat.com>", "To": "dev@dpdk.org, chenbo.xia@intel.com, david.marchand@redhat.com,\n eperezma@redhat.com", "Cc": "Maxime Coquelin <maxime.coquelin@redhat.com>", "Subject": "[PATCH v1 16/21] net/virtio-user: allocate shadow control queue", "Date": "Wed, 30 Nov 2022 16:56:34 +0100", "Message-Id": "<20221130155639.150553-17-maxime.coquelin@redhat.com>", "In-Reply-To": "<20221130155639.150553-1-maxime.coquelin@redhat.com>", "References": "<20221130155639.150553-1-maxime.coquelin@redhat.com>", "MIME-Version": "1.0", "X-Scanned-By": "MIMEDefang 3.1 on 10.11.54.1", "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": "If the backends supports control virtqueue, allocate a\nshadow control virtqueue, and implement the notify callback\nthat writes into the kickfd.\n\nSigned-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>\n---\n .../net/virtio/virtio_user/virtio_user_dev.c | 47 ++++++++++++++++++-\n .../net/virtio/virtio_user/virtio_user_dev.h | 5 ++\n drivers/net/virtio/virtio_user_ethdev.c | 6 +++\n 3 files changed, 56 insertions(+), 2 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 a3584e7735..16a0e07413 100644\n--- a/drivers/net/virtio/virtio_user/virtio_user_dev.c\n+++ b/drivers/net/virtio/virtio_user/virtio_user_dev.c\n@@ -146,8 +146,9 @@ virtio_user_dev_set_features(struct virtio_user_dev *dev)\n \n \t/* Strip VIRTIO_NET_F_MAC, as MAC address is handled in vdev init */\n \tfeatures &= ~(1ull << VIRTIO_NET_F_MAC);\n-\t/* Strip VIRTIO_NET_F_CTRL_VQ, as devices do not really need to know */\n-\tfeatures &= ~(1ull << VIRTIO_NET_F_CTRL_VQ);\n+\t/* Strip VIRTIO_NET_F_CTRL_VQ if the devices does not really support control VQ */\n+\tif (!dev->hw_cvq)\n+\t\tfeatures &= ~(1ull << VIRTIO_NET_F_CTRL_VQ);\n \tfeatures &= ~(1ull << VIRTIO_NET_F_STATUS);\n \tret = dev->ops->set_features(dev, features);\n \tif (ret < 0)\n@@ -911,6 +912,48 @@ virtio_user_handle_cq(struct virtio_user_dev *dev, uint16_t queue_idx)\n \t}\n }\n \n+static void\n+virtio_user_control_queue_notify(struct virtqueue *vq, void *cookie)\n+{\n+\tstruct virtio_user_dev *dev = cookie;\n+\tuint64_t buf = 1;\n+\n+\tif (write(dev->kickfds[vq->vq_queue_index], &buf, sizeof(buf)) < 0)\n+\t\tPMD_DRV_LOG(ERR, \"failed to kick backend: %s\",\n+\t\t\t strerror(errno));\n+}\n+\n+int\n+virtio_user_dev_create_shadow_cvq(struct virtio_user_dev *dev, struct virtqueue *vq)\n+{\n+\tchar name[VIRTQUEUE_MAX_NAME_SZ];\n+\tstruct virtqueue *scvq;\n+\n+\tsnprintf(name, sizeof(name), \"port%d_shadow_cvq\", vq->hw->port_id);\n+\tscvq = virtqueue_alloc(&dev->hw, vq->vq_queue_index, vq->vq_nentries,\n+\t\t\tVTNET_CQ, SOCKET_ID_ANY, name);\n+\tif (!scvq) {\n+\t\tPMD_INIT_LOG(ERR, \"(%s) Failed to alloc shadow control vq\\n\", dev->path);\n+\t\treturn -ENOMEM;\n+\t}\n+\n+\tscvq->cq.notify_queue = &virtio_user_control_queue_notify;\n+\tscvq->cq.notify_cookie = dev;\n+\tdev->scvq = scvq;\n+\n+\treturn 0;\n+}\n+\n+void\n+virtio_user_dev_destroy_shadow_cvq(struct virtio_user_dev *dev)\n+{\n+\tif (!dev->scvq)\n+\t\treturn;\n+\n+\tvirtqueue_free(dev->scvq);\n+\tdev->scvq = NULL;\n+}\n+\n int\n virtio_user_dev_set_status(struct virtio_user_dev *dev, uint8_t status)\n {\ndiff --git a/drivers/net/virtio/virtio_user/virtio_user_dev.h b/drivers/net/virtio/virtio_user/virtio_user_dev.h\nindex 3c5453eac0..e0db4faf3f 100644\n--- a/drivers/net/virtio/virtio_user/virtio_user_dev.h\n+++ b/drivers/net/virtio/virtio_user/virtio_user_dev.h\n@@ -58,6 +58,9 @@ struct virtio_user_dev {\n \tpthread_mutex_t\tmutex;\n \tbool\t\tstarted;\n \n+\tbool\t\t\thw_cvq;\n+\tstruct virtqueue\t*scvq;\n+\n \tvoid *backend_data;\n };\n \n@@ -74,6 +77,8 @@ void virtio_user_handle_cq(struct virtio_user_dev *dev, uint16_t queue_idx);\n void virtio_user_handle_cq_packed(struct virtio_user_dev *dev,\n \t\t\t\t uint16_t queue_idx);\n uint8_t virtio_user_handle_mq(struct virtio_user_dev *dev, uint16_t q_pairs);\n+int virtio_user_dev_create_shadow_cvq(struct virtio_user_dev *dev, struct virtqueue *vq);\n+void virtio_user_dev_destroy_shadow_cvq(struct virtio_user_dev *dev);\n int virtio_user_dev_set_status(struct virtio_user_dev *dev, uint8_t status);\n int virtio_user_dev_update_status(struct virtio_user_dev *dev);\n int virtio_user_dev_update_link_state(struct virtio_user_dev *dev);\ndiff --git a/drivers/net/virtio/virtio_user_ethdev.c b/drivers/net/virtio/virtio_user_ethdev.c\nindex 6c3e875793..626bd95b62 100644\n--- a/drivers/net/virtio/virtio_user_ethdev.c\n+++ b/drivers/net/virtio/virtio_user_ethdev.c\n@@ -232,6 +232,9 @@ virtio_user_setup_queue(struct virtio_hw *hw, struct virtqueue *vq)\n \telse\n \t\tvirtio_user_setup_queue_split(vq, dev);\n \n+\tif (dev->hw_cvq && hw->cvq && (virtnet_cq_to_vq(hw->cvq) == vq))\n+\t\treturn virtio_user_dev_create_shadow_cvq(dev, vq);\n+\n \treturn 0;\n }\n \n@@ -251,6 +254,9 @@ virtio_user_del_queue(struct virtio_hw *hw, struct virtqueue *vq)\n \n \tclose(dev->callfds[vq->vq_queue_index]);\n \tclose(dev->kickfds[vq->vq_queue_index]);\n+\n+\tif (hw->cvq && (virtnet_cq_to_vq(hw->cvq) == vq) && dev->scvq)\n+\t\tvirtio_user_dev_destroy_shadow_cvq(dev);\n }\n \n static void\n", "prefixes": [ "v1", "16/21" ] }{ "id": 120372, "url": "