Thread (149 messages) 149 messages, 6 authors, 2021-01-18

Re: [dpdk-dev] [PATCH 30/40] net/virtio: add Virtio-user vring address ops

From: Maxime Coquelin <hidden>
Date: 2021-01-15 10:19:55


On 1/6/21 1:06 PM, Xia, Chenbo wrote:
Hi Maxime,
quoted
-----Original Message-----
From: Maxime Coquelin <redacted>
Sent: Monday, December 21, 2020 5:14 AM
To: dev@dpdk.org; Xia, Chenbo <redacted>; olivier.matz@6wind.com;
amorenoz@redhat.com; david.marchand@redhat.com
Cc: Maxime Coquelin <redacted>
Subject: [PATCH 30/40] net/virtio: add Virtio-user vring address ops

This patch introduces a new callback for setting
vrings addresses.

Signed-off-by: Maxime Coquelin <redacted>
---
 drivers/net/virtio/virtio_user/vhost.h        |  1 +
 drivers/net/virtio/virtio_user/vhost_kernel.c | 32 +++++++++++++------
 drivers/net/virtio/virtio_user/vhost_user.c   | 29 +++++++++++++----
 drivers/net/virtio/virtio_user/vhost_vdpa.c   |  8 ++++-
 .../net/virtio/virtio_user/virtio_user_dev.c  |  2 +-
 5 files changed, 55 insertions(+), 17 deletions(-)
diff --git a/drivers/net/virtio/virtio_user/vhost.h
b/drivers/net/virtio/virtio_user/vhost.h
index b296ee215d..956eb58728 100644
--- a/drivers/net/virtio/virtio_user/vhost.h
+++ b/drivers/net/virtio/virtio_user/vhost.h
@@ -113,6 +113,7 @@ struct virtio_user_backend_ops {
 	int (*get_vring_base)(struct virtio_user_dev *dev, struct
vhost_vring_state *state);
 	int (*set_vring_call)(struct virtio_user_dev *dev, struct
vhost_vring_file *file);
 	int (*set_vring_kick)(struct virtio_user_dev *dev, struct
vhost_vring_file *file);
+	int (*set_vring_addr)(struct virtio_user_dev *dev, struct
vhost_vring_addr *addr);
 	int (*send_request)(struct virtio_user_dev *dev,
 			    enum vhost_user_request req,
 			    void *arg);
diff --git a/drivers/net/virtio/virtio_user/vhost_kernel.c
b/drivers/net/virtio/virtio_user/vhost_kernel.c
index 1805aee7f7..8cd86b72c6 100644
--- a/drivers/net/virtio/virtio_user/vhost_kernel.c
+++ b/drivers/net/virtio/virtio_user/vhost_kernel.c
@@ -294,9 +294,30 @@ vhost_kernel_set_vring_call(struct virtio_user_dev *dev,
struct vhost_vring_file
 	return vhost_kernel_set_vring_file(dev, VHOST_SET_VRING_KICK, file);
 }

+static int
+vhost_kernel_set_vring_addr(struct virtio_user_dev *dev, struct
vhost_vring_addr *addr)
+{
+	int ret, fd;
+	uint32_t index = addr->index;
Better use 'unsigned int index' here? It can hardly cause problem but I think
it's better to use the type in struct vhost_vring_addr.
Fixed, thanks.
Maxime
Thanks,
Chenbo
  
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help