Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

vdpa_sim: add device id field in vdpasim_dev_attr

Remove VDPASIM_DEVICE_ID macro and add 'id' field in vdpasim_dev_attr,
that will be returned by vdpasim_get_device_id().

Use VIRTIO_ID_NET for vDPA-net simulator device id.

Co-developed-by: Max Gurtovoy <mgurtovoy@nvidia.com>
Signed-off-by: Max Gurtovoy <mgurtovoy@nvidia.com>
Acked-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
Link: https://lore.kernel.org/r/20201215144256.155342-8-sgarzare@redhat.com
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>

authored by

Stefano Garzarella and committed by
Michael S. Tsirkin
2f8f4618 6c6e28fe

+5 -2
+5 -2
drivers/vdpa/vdpa_sim/vdpa_sim.c
··· 55 55 56 56 #define VDPASIM_QUEUE_ALIGN PAGE_SIZE 57 57 #define VDPASIM_QUEUE_MAX 256 58 - #define VDPASIM_DEVICE_ID 0x1 59 58 #define VDPASIM_VENDOR_ID 0 60 59 #define VDPASIM_VQ_NUM 0x2 61 60 #define VDPASIM_NAME "vdpasim-netdev" ··· 66 67 67 68 struct vdpasim_dev_attr { 68 69 int nvqs; 70 + u32 id; 69 71 }; 70 72 71 73 /* State of each vdpasim device */ ··· 546 546 547 547 static u32 vdpasim_get_device_id(struct vdpa_device *vdpa) 548 548 { 549 - return VDPASIM_DEVICE_ID; 549 + struct vdpasim *vdpasim = vdpa_to_sim(vdpa); 550 + 551 + return vdpasim->dev_attr.id; 550 552 } 551 553 552 554 static u32 vdpasim_get_vendor_id(struct vdpa_device *vdpa) ··· 731 729 { 732 730 struct vdpasim_dev_attr dev_attr = {}; 733 731 732 + dev_attr.id = VIRTIO_ID_NET; 734 733 dev_attr.nvqs = VDPASIM_VQ_NUM; 735 734 736 735 vdpasim_dev = vdpasim_create(&dev_attr);