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

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

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


On 1/6/21 1:03 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 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 <redacted>
<snip>
quoted
@@ -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).
Right, it can be dropped now. I'll remove it.

Thanks,
Maxime
Thanks,
Chenbo
quoted
+	.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
  
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help