On 29.08.24 18:16, Carlos Bilbao wrote: > From: Carlos Bilbao <cbilbao@xxxxxxxxxxxxxxxx> > > Initialize the speed and duplex fields in virtio_net_config to UNKNOWN. > This is needed because mlx5_vdpa vDPA devicess currently do not support the > VIRTIO_NET_F_SPEED_DUPLEX feature which reports speed and duplex. Add > needed helper cpu_to_mlx5vdpa32() to convert endianness of speed. > > Signed-off-by: Carlos Bilbao <cbilbao@xxxxxxxxxxxxxxxx> Nit: prefix is vdpa/mlx5. Once that is fixed, for this patch: Reviewed-by: Dragos Tatulea <dtatulea@xxxxxxxxxx> > --- > drivers/vdpa/mlx5/net/mlx5_vnet.c | 12 ++++++++++++ > 1 file changed, 12 insertions(+) > > diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.c b/drivers/vdpa/mlx5/net/mlx5_vnet.c > index fa78e8288ebb..c47009a8b472 100644 > --- a/drivers/vdpa/mlx5/net/mlx5_vnet.c > +++ b/drivers/vdpa/mlx5/net/mlx5_vnet.c > @@ -193,6 +193,11 @@ static __virtio16 cpu_to_mlx5vdpa16(struct mlx5_vdpa_dev *mvdev, u16 val) > return __cpu_to_virtio16(mlx5_vdpa_is_little_endian(mvdev), val); > } > > +static __virtio32 cpu_to_mlx5vdpa32(struct mlx5_vdpa_dev *mvdev, u32 val) > +{ > + return __cpu_to_virtio32(mlx5_vdpa_is_little_endian(mvdev), val); > +} > + > static u16 ctrl_vq_idx(struct mlx5_vdpa_dev *mvdev) > { > if (!(mvdev->actual_features & BIT_ULL(VIRTIO_NET_F_MQ))) > @@ -3795,6 +3800,13 @@ static int mlx5_vdpa_dev_add(struct vdpa_mgmt_dev *v_mdev, const char *name, > init_rwsem(&ndev->reslock); > config = &ndev->config; > > + /* > + * mlx5_vdpa vDPA devices currently don't support reporting or > + * setting the speed or duplex. > + */ > + config->speed = cpu_to_mlx5vdpa32(mvdev, SPEED_UNKNOWN); > + config->duplex = DUPLEX_UNKNOWN; > + > if (add_config->mask & BIT_ULL(VDPA_ATTR_DEV_NET_CFG_MTU)) { > err = config_func_mtu(mdev, add_config->net.mtu); > if (err)