提交 9d1bf832 编写于 作者: S Stefano Garzarella 提交者: Pengyuan Zhao

vdpa_sim: add work_fn in vdpasim_dev_attr

stable inclusion
from stable-v5.11
commit a13b5918
category: feature
bugzilla: https://gitee.com/openeuler/kernel/issues/I5WXCZ
CVE: NA

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=a13b5918fdd0dd7987aa5f3c202f68ed6ad468bb

----------------------------------------------------------------------

Rename vdpasim_work() in vdpasim_net_work() and add it to
the vdpasim_dev_attr structure.
Co-developed-by: NMax Gurtovoy <mgurtovoy@nvidia.com>
Signed-off-by: NMax Gurtovoy <mgurtovoy@nvidia.com>
Acked-by: NJason Wang <jasowang@redhat.com>
Signed-off-by: NStefano Garzarella <sgarzare@redhat.com>
Link: https://lore.kernel.org/r/20201215144256.155342-10-sgarzare@redhat.comSigned-off-by: NMichael S. Tsirkin <mst@redhat.com>
Signed-off-by: NPengyuan Zhao <zhaopengyuan@hisilicon.com>
上级 775c8f93
......@@ -75,6 +75,8 @@ struct vdpasim_dev_attr {
size_t config_size;
int nvqs;
u32 id;
work_func_t work_fn;
void (*get_config)(struct vdpasim *vdpasim, void *config);
};
......@@ -169,7 +171,7 @@ static void vdpasim_reset(struct vdpasim *vdpasim)
++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
vdpasim, work);
......@@ -376,7 +378,7 @@ static struct vdpasim *vdpasim_create(struct vdpasim_dev_attr *dev_attr)
goto err_alloc;
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->iommu_lock);
......@@ -766,6 +768,7 @@ static int __init vdpasim_dev_init(void)
dev_attr.id = VIRTIO_ID_NET;
dev_attr.nvqs = VDPASIM_VQ_NUM;
dev_attr.work_fn = vdpasim_net_work;
dev_attr.config_size = sizeof(struct virtio_net_config);
dev_attr.get_config = vdpasim_net_get_config;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册