@@ -443,7 +443,7 @@ static int vdpa_nl_cmd_dev_add_set_doit(struct sk_buff *skb, struct genl_info *i
goto err;
}
- vdev = pdev->ops->dev_add(pdev, name, device_id);
+ vdev = pdev->ops->dev_add(pdev, name, device_id, info->attrs);
if (IS_ERR(vdev))
goto err;
@@ -728,7 +728,8 @@ static const struct vdpa_config_ops vdpasim_net_batch_config_ops = {
};
static struct vdpa_device *
-vdpa_dev_add(struct vdpa_parent_dev *pdev, const char *name, u32 device_id)
+vdpa_dev_add(struct vdpa_parent_dev *pdev, const char *name,
+ u32 device_id, struct nlattr **attrs)
{
struct vdpasim *simdev;
@@ -6,6 +6,7 @@
#include <linux/device.h>
#include <linux/interrupt.h>
#include <linux/vhost_iotlb.h>
+#include <net/genetlink.h>
/**
* vDPA callback definition.
@@ -354,6 +355,7 @@ static inline void vdpa_get_config(struct vdpa_device *vdev, unsigned offset,
* @pdev: parent device to use for device addition
* @name: name of the new vdpa device
* @device_id: device id of the new vdpa device
+ * @attrs: device specific attributes
* Driver need to add a new device using vdpa_register_device() after
* fully initializing the vdpa device. On successful addition driver
* must return a valid pointer of vdpa device or ERR_PTR for the error.
@@ -364,7 +366,7 @@ static inline void vdpa_get_config(struct vdpa_device *vdev, unsigned offset,
*/
struct vdpa_dev_ops {
struct vdpa_device* (*dev_add)(struct vdpa_parent_dev *pdev, const char *name,
- u32 device_id);
+ u32 device_id, struct nlattr **attrs);
void (*dev_del)(struct vdpa_parent_dev *pdev, struct vdpa_device *dev);
};
Pass the netlink attributes to ops.dev_add() so that we could get some device specific attributes when creating a vdpa device. Signed-off-by: Xie Yongji <xieyongji@bytedance.com> --- drivers/vdpa/vdpa.c | 2 +- drivers/vdpa/vdpa_sim/vdpa_sim.c | 3 ++- include/linux/vdpa.h | 4 +++- 3 files changed, 6 insertions(+), 3 deletions(-)