[dpdk-dev] [PATCH 28/40] net/virtio: add Virtio-user vring setting ops
Xia, Chenbo
chenbo.xia at intel.com
Wed Jan 6 13:03:42 CET 2021
Hi Maxime,
> -----Original Message-----
> From: Maxime Coquelin <maxime.coquelin at redhat.com>
> Sent: Monday, December 21, 2020 5:14 AM
> To: dev at dpdk.org; Xia, Chenbo <chenbo.xia at intel.com>; olivier.matz at 6wind.com;
> amorenoz at redhat.com; david.marchand at redhat.com
> Cc: Maxime Coquelin <maxime.coquelin at redhat.com>
> Subject: [PATCH 28/40] net/virtio: add Virtio-user vring setting ops
>
> This patch introduces new callbacks for setting
> and getting vring state.
>
> Signed-off-by: Maxime Coquelin <maxime.coquelin at redhat.com>
<snip>
>
> @@ -327,6 +343,10 @@ struct virtio_user_backend_ops virtio_ops_vdpa = {
> .get_features = vhost_vdpa_get_features,
> .set_features = vhost_vdpa_set_features,
> .set_memory_table = vhost_vdpa_set_memory_table,
> + .set_vring_enable = vhost_vdpa_set_vring_enable,
Sorry, miss one comment in last email...
Do we still need to keep set_vring_enable in struct virtio_user_backend_ops? Because
as I notice, it's called only in another callback (enable_qp).
Thanks,
Chenbo
> + .set_vring_num = vhost_vdpa_set_vring_num,
> + .set_vring_base = vhost_vdpa_set_vring_base,
> + .get_vring_base = vhost_vdpa_get_vring_base,
> .send_request = vhost_vdpa_send_request,
> .enable_qp = vhost_vdpa_enable_queue_pair,
> .dma_map = vhost_vdpa_dma_map,
> diff --git a/drivers/net/virtio/virtio_user/virtio_user_dev.c
> b/drivers/net/virtio/virtio_user/virtio_user_dev.c
> index ae976be158..496a48ee51 100644
> --- a/drivers/net/virtio/virtio_user/virtio_user_dev.c
> +++ b/drivers/net/virtio/virtio_user/virtio_user_dev.c
> @@ -73,13 +73,13 @@ virtio_user_kick_queue(struct virtio_user_dev *dev,
> uint32_t queue_sel)
>
> state.index = queue_sel;
> state.num = vring->num;
> - dev->ops->send_request(dev, VHOST_USER_SET_VRING_NUM, &state);
> + dev->ops->set_vring_num(dev, &state);
>
> state.index = queue_sel;
> state.num = 0; /* no reservation */
> if (dev->features & (1ULL << VIRTIO_F_RING_PACKED))
> state.num |= (1 << 15);
> - dev->ops->send_request(dev, VHOST_USER_SET_VRING_BASE, &state);
> + dev->ops->set_vring_base(dev, &state);
>
> dev->ops->send_request(dev, VHOST_USER_SET_VRING_ADDR, &addr);
>
> @@ -218,9 +218,8 @@ int virtio_user_stop_device(struct virtio_user_dev *dev)
> /* Stop the backend. */
> for (i = 0; i < dev->max_queue_pairs * 2; ++i) {
> state.index = i;
> - if (dev->ops->send_request(dev, VHOST_USER_GET_VRING_BASE,
> - &state) < 0) {
> - PMD_DRV_LOG(ERR, "get_vring_base failed, index=%u\n",
> + if (dev->ops->get_vring_base(dev, &state) < 0) {
> + PMD_DRV_LOG(ERR, "get_vring_base failed, index=%u",
> i);
> error = -1;
> goto out;
> --
> 2.29.2
More information about the dev
mailing list