From: Eugenio Perez Martin <eperezma@redhat.com>
To: Maxime Coquelin <maxime.coquelin@redhat.com>
Cc: dev@dpdk.org, chenbo.xia@intel.com, david.marchand@redhat.com,
stephen@networkplumber.org
Subject: Re: [PATCH v2 18/21] net/virtio-user: add new callback to enable control queue
Date: Tue, 7 Feb 2023 19:10:34 +0100 [thread overview]
Message-ID: <CAJaqyWeRie7a1BHnYghyYUP+xEkre+2a_X+YRhAcLM4M4v6YKw@mail.gmail.com> (raw)
In-Reply-To: <20230207151747.245808-19-maxime.coquelin@redhat.com>
On Tue, Feb 7, 2023 at 4:18 PM Maxime Coquelin
<maxime.coquelin@redhat.com> wrote:
>
> This patch introduces a new callback that is to be called
> when the backend supports control virtqueue.
>
> Implementation for Vhost-vDPA backend is added in this patch.
>
> Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
> Reviewed-by: Chenbo Xia <chenbo.xia@intel.com>
Small nitpick but as previous one it is ok to leave as it is now.
Acked-by: Eugenio Pérez <eperezma@redhat.com>
> ---
> drivers/net/virtio/virtio_user/vhost.h | 1 +
> drivers/net/virtio/virtio_user/vhost_vdpa.c | 15 +++++++++++++++
> drivers/net/virtio/virtio_user/virtio_user_dev.c | 3 +++
> 3 files changed, 19 insertions(+)
>
> diff --git a/drivers/net/virtio/virtio_user/vhost.h b/drivers/net/virtio/virtio_user/vhost.h
> index dfbf6be033..f817cab77a 100644
> --- a/drivers/net/virtio/virtio_user/vhost.h
> +++ b/drivers/net/virtio/virtio_user/vhost.h
> @@ -82,6 +82,7 @@ struct virtio_user_backend_ops {
> int (*get_config)(struct virtio_user_dev *dev, uint8_t *data, uint32_t off, uint32_t len);
> int (*set_config)(struct virtio_user_dev *dev, const uint8_t *data, uint32_t off,
> uint32_t len);
> + int (*cvq_enable)(struct virtio_user_dev *dev, int enable);
> int (*enable_qp)(struct virtio_user_dev *dev, uint16_t pair_idx, int enable);
> int (*dma_map)(struct virtio_user_dev *dev, void *addr, uint64_t iova, size_t len);
> int (*dma_unmap)(struct virtio_user_dev *dev, void *addr, uint64_t iova, size_t len);
> diff --git a/drivers/net/virtio/virtio_user/vhost_vdpa.c b/drivers/net/virtio/virtio_user/vhost_vdpa.c
> index a0897f8dd1..3fd13d9fac 100644
> --- a/drivers/net/virtio/virtio_user/vhost_vdpa.c
> +++ b/drivers/net/virtio/virtio_user/vhost_vdpa.c
> @@ -564,6 +564,20 @@ vhost_vdpa_destroy(struct virtio_user_dev *dev)
> return 0;
> }
>
> +static int
> +vhost_vdpa_cvq_enable(struct virtio_user_dev *dev, int enable)
> +{
> + struct vhost_vring_state state = {
> + .index = dev->max_queue_pairs * 2,
> + .num = enable,
> + };
> +
> + if (vhost_vdpa_set_vring_enable(dev, &state))
> + return -1;
> +
> + return 0;
Any reason for not to "return vhost_vdpa_set_vring_enable(dev, &state));"?
Thanks!
> +}
> +
> static int
> vhost_vdpa_enable_queue_pair(struct virtio_user_dev *dev,
> uint16_t pair_idx,
> @@ -629,6 +643,7 @@ struct virtio_user_backend_ops virtio_ops_vdpa = {
> .set_status = vhost_vdpa_set_status,
> .get_config = vhost_vdpa_get_config,
> .set_config = vhost_vdpa_set_config,
> + .cvq_enable = vhost_vdpa_cvq_enable,
> .enable_qp = vhost_vdpa_enable_queue_pair,
> .dma_map = vhost_vdpa_dma_map_batch,
> .dma_unmap = vhost_vdpa_dma_unmap_batch,
> diff --git a/drivers/net/virtio/virtio_user/virtio_user_dev.c b/drivers/net/virtio/virtio_user/virtio_user_dev.c
> index 1a5386a3f6..b0d603ee12 100644
> --- a/drivers/net/virtio/virtio_user/virtio_user_dev.c
> +++ b/drivers/net/virtio/virtio_user/virtio_user_dev.c
> @@ -767,6 +767,9 @@ virtio_user_handle_mq(struct virtio_user_dev *dev, uint16_t q_pairs)
> for (i = q_pairs; i < dev->max_queue_pairs; ++i)
> ret |= dev->ops->enable_qp(dev, i, 0);
>
> + if (dev->scvq)
> + ret |= dev->ops->cvq_enable(dev, 1);
> +
> dev->queue_pairs = q_pairs;
>
> return ret;
> --
> 2.39.1
>
next prev parent reply other threads:[~2023-02-07 18:11 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-07 15:17 [PATCH v2 00/21] Add control queue & MQ support to Virtio-user vDPA Maxime Coquelin
2023-02-07 15:17 ` [PATCH v2 01/21] net/virtio: move CVQ code into a dedicated file Maxime Coquelin
2023-02-07 15:17 ` [PATCH v2 02/21] net/virtio: introduce notify callback for control queue Maxime Coquelin
2023-02-07 15:17 ` [PATCH v2 03/21] net/virtio: virtqueue headers alloc refactoring Maxime Coquelin
2023-02-07 15:17 ` [PATCH v2 04/21] net/virtio: remove port ID info from Rx queue Maxime Coquelin
2023-02-07 15:17 ` [PATCH v2 05/21] net/virtio: remove unused fields in Tx queue struct Maxime Coquelin
2023-02-07 15:17 ` [PATCH v2 06/21] net/virtio: remove unused queue ID field in Rx queue Maxime Coquelin
2023-02-07 15:17 ` [PATCH v2 07/21] net/virtio: remove unused Port ID in control queue Maxime Coquelin
2023-02-07 15:17 ` [PATCH v2 08/21] net/virtio: move vring memzone to virtqueue struct Maxime Coquelin
2023-02-07 15:17 ` [PATCH v2 09/21] net/virtio: refactor indirect desc headers init Maxime Coquelin
2023-02-07 15:17 ` [PATCH v2 10/21] net/virtio: alloc Rx SW ring only if vectorized path Maxime Coquelin
2023-02-08 1:05 ` Xia, Chenbo
2023-02-07 15:17 ` [PATCH v2 11/21] net/virtio: extract virtqueue init from virtio queue init Maxime Coquelin
2023-02-07 15:17 ` [PATCH v2 12/21] net/virtio-user: fix device starting failure handling Maxime Coquelin
2023-02-07 15:17 ` [PATCH v2 13/21] net/virtio-user: simplify queues setup Maxime Coquelin
2023-02-07 15:17 ` [PATCH v2 14/21] net/virtio-user: use proper type for number of queue pairs Maxime Coquelin
2023-02-07 15:17 ` [PATCH v2 15/21] net/virtio-user: get max number of queue pairs from device Maxime Coquelin
2023-02-07 18:02 ` Eugenio Perez Martin
2023-02-07 15:17 ` [PATCH v2 16/21] net/virtio-user: allocate shadow control queue Maxime Coquelin
2023-02-07 18:06 ` Eugenio Perez Martin
2023-02-09 8:48 ` Maxime Coquelin
2023-02-07 15:17 ` [PATCH v2 17/21] net/virtio-user: send shadow virtqueue info to the backend Maxime Coquelin
2023-02-07 18:08 ` Eugenio Perez Martin
2023-02-07 15:17 ` [PATCH v2 18/21] net/virtio-user: add new callback to enable control queue Maxime Coquelin
2023-02-07 18:10 ` Eugenio Perez Martin [this message]
2023-02-09 8:50 ` Maxime Coquelin
2023-02-07 15:17 ` [PATCH v2 19/21] net/virtio-user: forward control messages to shadow queue Maxime Coquelin
2023-02-07 18:30 ` Eugenio Perez Martin
2023-02-08 1:06 ` Xia, Chenbo
2023-02-07 15:17 ` [PATCH v2 20/21] net/virtio-user: advertize control VQ support with vDPA Maxime Coquelin
2023-02-07 18:17 ` Eugenio Perez Martin
2023-02-07 15:17 ` [PATCH v2 21/21] net/virtio-user: remove max queues limitation Maxime Coquelin
2023-02-08 1:06 ` Xia, Chenbo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAJaqyWeRie7a1BHnYghyYUP+xEkre+2a_X+YRhAcLM4M4v6YKw@mail.gmail.com \
--to=eperezma@redhat.com \
--cc=chenbo.xia@intel.com \
--cc=david.marchand@redhat.com \
--cc=dev@dpdk.org \
--cc=maxime.coquelin@redhat.com \
--cc=stephen@networkplumber.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).