mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/chenhuacai/linux-loongson
synced 2025-08-28 09:22:08 +00:00
vdpa/mlx5: make MTU/STATUS presence conditional on feature bits
The spec says: mtu only exists if VIRTIO_NET_F_MTU is set status only exists if VIRTIO_NET_F_STATUS is set We should only present MTU and STATUS conditionally depending on the feature bits. Signed-off-by: Si-Wei Liu <si-wei.liu@oracle.com> Reviewed-by: Eli Cohen <elic@nvidia.com> Message-Id: <1675725124-7375-6-git-send-email-si-wei.liu@oracle.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
This commit is contained in:
parent
dbb6f1c42a
commit
033779a708
@ -3046,6 +3046,8 @@ static int event_handler(struct notifier_block *nb, unsigned long event, void *p
|
|||||||
struct mlx5_vdpa_wq_ent *wqent;
|
struct mlx5_vdpa_wq_ent *wqent;
|
||||||
|
|
||||||
if (event == MLX5_EVENT_TYPE_PORT_CHANGE) {
|
if (event == MLX5_EVENT_TYPE_PORT_CHANGE) {
|
||||||
|
if (!(ndev->mvdev.actual_features & BIT_ULL(VIRTIO_NET_F_STATUS)))
|
||||||
|
return NOTIFY_DONE;
|
||||||
switch (eqe->sub_type) {
|
switch (eqe->sub_type) {
|
||||||
case MLX5_PORT_CHANGE_SUBTYPE_DOWN:
|
case MLX5_PORT_CHANGE_SUBTYPE_DOWN:
|
||||||
case MLX5_PORT_CHANGE_SUBTYPE_ACTIVE:
|
case MLX5_PORT_CHANGE_SUBTYPE_ACTIVE:
|
||||||
@ -3155,16 +3157,20 @@ static int mlx5_vdpa_dev_add(struct vdpa_mgmt_dev *v_mdev, const char *name,
|
|||||||
goto err_alloc;
|
goto err_alloc;
|
||||||
}
|
}
|
||||||
|
|
||||||
err = query_mtu(mdev, &mtu);
|
if (ndev->mvdev.mlx_features & BIT_ULL(VIRTIO_NET_F_MTU)) {
|
||||||
if (err)
|
err = query_mtu(mdev, &mtu);
|
||||||
goto err_alloc;
|
if (err)
|
||||||
|
goto err_alloc;
|
||||||
|
|
||||||
ndev->config.mtu = cpu_to_mlx5vdpa16(mvdev, mtu);
|
ndev->config.mtu = cpu_to_mlx5vdpa16(mvdev, mtu);
|
||||||
|
}
|
||||||
|
|
||||||
if (get_link_state(mvdev))
|
if (ndev->mvdev.mlx_features & BIT_ULL(VIRTIO_NET_F_STATUS)) {
|
||||||
ndev->config.status |= cpu_to_mlx5vdpa16(mvdev, VIRTIO_NET_S_LINK_UP);
|
if (get_link_state(mvdev))
|
||||||
else
|
ndev->config.status |= cpu_to_mlx5vdpa16(mvdev, VIRTIO_NET_S_LINK_UP);
|
||||||
ndev->config.status &= cpu_to_mlx5vdpa16(mvdev, ~VIRTIO_NET_S_LINK_UP);
|
else
|
||||||
|
ndev->config.status &= cpu_to_mlx5vdpa16(mvdev, ~VIRTIO_NET_S_LINK_UP);
|
||||||
|
}
|
||||||
|
|
||||||
if (add_config->mask & (1 << VDPA_ATTR_DEV_NET_CFG_MACADDR)) {
|
if (add_config->mask & (1 << VDPA_ATTR_DEV_NET_CFG_MACADDR)) {
|
||||||
memcpy(ndev->config.mac, add_config->net.mac, ETH_ALEN);
|
memcpy(ndev->config.mac, add_config->net.mac, ETH_ALEN);
|
||||||
|
Loading…
Reference in New Issue
Block a user