Commit a13b5918 authored by Stefano Garzarella's avatar Stefano Garzarella Committed by Michael S. Tsirkin

vdpa_sim: add work_fn in vdpasim_dev_attr

Rename vdpasim_work() in vdpasim_net_work() and add it to
the vdpasim_dev_attr structure.
Co-developed-by: default avatarMax Gurtovoy <mgurtovoy@nvidia.com>
Signed-off-by: default avatarMax Gurtovoy <mgurtovoy@nvidia.com>
Acked-by: default avatarJason Wang <jasowang@redhat.com>
Signed-off-by: default avatarStefano Garzarella <sgarzare@redhat.com>
Link: https://lore.kernel.org/r/20201215144256.155342-10-sgarzare@redhat.comSigned-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
parent 011c35ba
...@@ -70,6 +70,8 @@ struct vdpasim_dev_attr { ...@@ -70,6 +70,8 @@ struct vdpasim_dev_attr {
u64 supported_features; u64 supported_features;
int nvqs; int nvqs;
u32 id; u32 id;
work_func_t work_fn;
}; };
/* State of each vdpasim device */ /* State of each vdpasim device */
...@@ -163,7 +165,7 @@ static void vdpasim_reset(struct vdpasim *vdpasim) ...@@ -163,7 +165,7 @@ static void vdpasim_reset(struct vdpasim *vdpasim)
++vdpasim->generation; ++vdpasim->generation;
} }
static void vdpasim_work(struct work_struct *work) static void vdpasim_net_work(struct work_struct *work)
{ {
struct vdpasim *vdpasim = container_of(work, struct struct vdpasim *vdpasim = container_of(work, struct
vdpasim, work); vdpasim, work);
...@@ -370,7 +372,7 @@ static struct vdpasim *vdpasim_create(struct vdpasim_dev_attr *dev_attr) ...@@ -370,7 +372,7 @@ static struct vdpasim *vdpasim_create(struct vdpasim_dev_attr *dev_attr)
goto err_alloc; goto err_alloc;
vdpasim->dev_attr = *dev_attr; vdpasim->dev_attr = *dev_attr;
INIT_WORK(&vdpasim->work, vdpasim_work); INIT_WORK(&vdpasim->work, dev_attr->work_fn);
spin_lock_init(&vdpasim->lock); spin_lock_init(&vdpasim->lock);
spin_lock_init(&vdpasim->iommu_lock); spin_lock_init(&vdpasim->iommu_lock);
...@@ -740,6 +742,7 @@ static int __init vdpasim_dev_init(void) ...@@ -740,6 +742,7 @@ static int __init vdpasim_dev_init(void)
dev_attr.id = VIRTIO_ID_NET; dev_attr.id = VIRTIO_ID_NET;
dev_attr.supported_features = VDPASIM_NET_FEATURES; dev_attr.supported_features = VDPASIM_NET_FEATURES;
dev_attr.nvqs = VDPASIM_VQ_NUM; dev_attr.nvqs = VDPASIM_VQ_NUM;
dev_attr.work_fn = vdpasim_net_work;
vdpasim_dev = vdpasim_create(&dev_attr); vdpasim_dev = vdpasim_create(&dev_attr);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment