]> www.infradead.org Git - users/jedix/linux-maple.git/commit
vdpa/mlx5: fix feature negotiation across device reset
authorSi-Wei Liu <si-wei.liu@oracle.com>
Thu, 29 Apr 2021 01:48:54 +0000 (21:48 -0400)
committerMichael S. Tsirkin <mst@redhat.com>
Tue, 31 Aug 2021 21:06:22 +0000 (17:06 -0400)
commit4a3a6d9fb65f72b970265d6aa0d7fa792eb79b71
tree83573f79b601eb67fcdf2fecfa456c2bf4da7ca8
parentfd704f203ca15daa08d185526b10a9f4391ff408
vdpa/mlx5: fix feature negotiation across device reset

The mlx_features denotes the capability for which
set of virtio features is supported by device. In
principle, this field needs not be cleared during
virtio device reset, as this capability is static
and does not change across reset.

In fact, the current code seems to wrongly assume
that mlx_features can be reloaded or updated on
device reset thru the .get_features op. However,
the userspace VMM may save a copy of previously
advertised backend feature capability and won't
need to get it again on reset. In that event, all
virtio features reset to zero thus getting disabled
upon device reset. This ends up with guest holding
a mismatched view of available features with the
VMM/host's. For instance, the guest may assume
the presence of tx checksum offload feature across
reboot, however, since the feature is left disabled
on reset, frames with bogus partial checksum are
transmitted on the wire.

The fix is to retain the features capability on
reset, and get it only once from firmware on the
vdpa_dev_add path.

Fixes: 1a86b377aa21 ("vdpa/mlx5: Add VDPA driver for supported mlx5 devices")
Signed-off-by: Si-Wei Liu <si-wei.liu@oracle.com>
Acked-by: Eli Cohen <elic@nvidia.com>
Acked-by: Jason Wang <jasowang@redhat.com>
Link: https://lore.kernel.org/r/1619660934-30910-2-git-send-email-si-wei.liu@oracle.com
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
drivers/vdpa/mlx5/net/mlx5_vnet.c