vdpa/mlx5: Avoid losing link state updates
authorEli Cohen <elic@nvidia.com>
Mon, 17 Apr 2023 11:03:43 +0000 (14:03 +0300)
committerMichael S. Tsirkin <mst@redhat.com>
Fri, 21 Apr 2023 07:02:29 +0000 (03:02 -0400)
commitc384c2401eed99a2e1f84191e573f15b898babe6
tree6546699ddf3b38383c8765bc1df261de274ee31f
parent6a8f57ae2eb07ab39a6f0ccad60c760743051026
vdpa/mlx5: Avoid losing link state updates

Current code ignores link state updates if VIRTIO_NET_F_STATUS was not
negotiated. However, link state updates could be received before feature
negotiation was completed , therefore causing link state events to be
lost, possibly leaving the link state down.

Modify the code so link state notifier is registered after DRIVER_OK was
negotiated and carry the registration only if
VIRTIO_NET_F_STATUS was negotiated.  Unregister the notifier when the
device is reset.

Fixes: 033779a708f0 ("vdpa/mlx5: make MTU/STATUS presence conditional on feature bits")
Acked-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: Eli Cohen <elic@nvidia.com>
Message-Id: <20230417110343.138319-1-elic@nvidia.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
drivers/vdpa/mlx5/net/mlx5_vnet.c