Re: [PATCH RFC 07/12] vdpa_sim: move config management outside of the core

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Nov 16, 2020 at 12:18:19PM +0800, Jason Wang wrote:

On 2020/11/13 下午9:47, Stefano Garzarella wrote:
In order to simplify the code of the vdpa_sim core, we move the
config management in each device simulator.

The device must provide the size of config structure and a callback
to update this structure called during the vdpasim_set_features().


Similarly, I suggest to do this before patch 2, then there's no need for the conversion of blk device.


I'll do.



Signed-off-by: Stefano Garzarella <sgarzare@xxxxxxxxxx>
---
 drivers/vdpa/vdpa_sim/vdpa_sim.h     |  5 +++--
 drivers/vdpa/vdpa_sim/vdpa_sim.c     | 29 +++++-----------------------
 drivers/vdpa/vdpa_sim/vdpa_sim_blk.c | 27 ++++++++++++++++----------
 drivers/vdpa/vdpa_sim/vdpa_sim_net.c | 12 ++++++++++++
 4 files changed, 37 insertions(+), 36 deletions(-)

diff --git a/drivers/vdpa/vdpa_sim/vdpa_sim.h b/drivers/vdpa/vdpa_sim/vdpa_sim.h
index 76e642042eb0..f7e1fe0a88d3 100644
--- a/drivers/vdpa/vdpa_sim/vdpa_sim.h
+++ b/drivers/vdpa/vdpa_sim/vdpa_sim.h
@@ -10,8 +10,6 @@
 #include <linux/vdpa.h>
 #include <linux/vhost_iotlb.h>
 #include <uapi/linux/virtio_config.h>
-#include <uapi/linux/virtio_net.h>
-#include <uapi/linux/virtio_blk.h>
 #define DRV_VERSION  "0.1"
 #define DRV_AUTHOR   "Jason Wang <jasowang@xxxxxxxxxx>"
@@ -42,8 +40,11 @@ struct vdpasim_virtqueue {
 struct vdpasim_device {
 	u64 supported_features;
+	size_t config_size;
 	u32 id;
 	int nvqs;
+
+	void (*update_config)(struct vdpasim *vdpasim);


Let's use set_config/get_config to align with virtio/vhost.

Yes, it's better,


Other looks good.

Thanks,
Stefano

_______________________________________________
Virtualization mailing list
Virtualization@xxxxxxxxxxxxxxxxxxxxxxxxxx
https://lists.linuxfoundation.org/mailman/listinfo/virtualization




[Index of Archives]     [KVM Development]     [Libvirt Development]     [Libvirt Users]     [CentOS Virtualization]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux