This is needed for VHOST_VDPA_SET_CONFIG. Signed-off-by: Carlos Bilbao <cbilbao@xxxxxxxxxxxxxxxx> --- Â drivers/vdpa/mlx5/net/mlx5_vnet.c | 22 ++++++++++++++++++++-- Â 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.c b/drivers/vdpa/mlx5/net/mlx5_vnet.c index b56aae3f7be3..da31c743b2b9 100644 --- a/drivers/vdpa/mlx5/net/mlx5_vnet.c +++ b/drivers/vdpa/mlx5/net/mlx5_vnet.c @@ -2909,14 +2909,32 @@ static void mlx5_vdpa_get_config(struct vdpa_device *vdev, unsigned int offset, Â Â Â Â struct mlx5_vdpa_dev *mvdev = to_mvdev(vdev); Â Â Â Â struct mlx5_vdpa_net *ndev = to_mlx5_vdpa_ndev(mvdev); -Â Â Â if (offset + len <= sizeof(struct virtio_net_config)) +Â Â Â if (offset + len <= sizeof(struct virtio_net_config)) { Â Â Â Â Â Â Â Â memcpy(buf, (u8 *)&ndev->config + offset, len); +Â Â Â Â Â Â Â } +Â Â Â Â Â Â Â else +Â Â Â Â Â Â Â { +Â Â Â Â Â Â Â Â Â Â Â printk(KERN_ERR "%s: Offset and length out of bounds\n", +Â Â Â Â Â Â Â Â Â Â Â __func__); +Â Â Â Â Â Â Â } + Â } Â static void mlx5_vdpa_set_config(struct vdpa_device *vdev, unsigned int offset, const void *buf, Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â unsigned int len) Â { -Â Â Â /* not supported */ +Â Â Â struct mlx5_vdpa_dev *mvdev = to_mvdev(vdev); +Â Â Â struct mlx5_vdpa_net *ndev = to_mlx5_vdpa_ndev(mvdev); + +Â Â Â if (offset + len <= sizeof(struct virtio_net_config)) +Â Â Â { +Â Â Â Â Â Â Â memcpy((u8 *)&ndev->config + offset, buf, len); +Â Â Â } +Â Â Â else +Â Â Â { +Â Â Â Â Â Â Â printk(KERN_ERR "%s: Offset and length out of bounds\n", +Â Â Â Â Â Â Â __func__); +Â Â Â } Â } Â static u32 mlx5_vdpa_get_generation(struct vdpa_device *vdev) -- 2.34.1