From: Si-Wei Liu <si-wei.liu@oracle.com>
To: elic@nvidia.com, mst@redhat.com, jasowang@redhat.com,
virtualization@lists.linux-foundation.org
Cc: lvivier@redhat.com, eperezma@redhat.com, si-wei.liu@oracle.com
Subject: [PATCH 2/3] vdpa/mlx5: set_features should nack MQ if no CTRL_VQ
Date: Thu, 13 Jan 2022 00:10:50 -0500 [thread overview]
Message-ID: <1642050651-16197-3-git-send-email-si-wei.liu@oracle.com> (raw)
In-Reply-To: <1642050651-16197-1-git-send-email-si-wei.liu@oracle.com>
Made corresponding change per spec:
The device MUST NOT offer a feature which requires another feature
which was not offered.
Fixes: 52893733f2c5 ("vdpa/mlx5: Add multiqueue support")
Signed-off-by: Si-Wei Liu<si-wei.liu@oracle.com>
---
drivers/vdpa/mlx5/net/mlx5_vnet.c | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)
diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.c b/drivers/vdpa/mlx5/net/mlx5_vnet.c
index b53603d..46d4deb 100644
--- a/drivers/vdpa/mlx5/net/mlx5_vnet.c
+++ b/drivers/vdpa/mlx5/net/mlx5_vnet.c
@@ -1897,11 +1897,21 @@ static u64 mlx5_vdpa_get_device_features(struct vdpa_device *vdev)
return ndev->mvdev.mlx_features;
}
-static int verify_min_features(struct mlx5_vdpa_dev *mvdev, u64 features)
+static int verify_driver_features(struct mlx5_vdpa_dev *mvdev, u64 *features)
{
- if (!(features & BIT_ULL(VIRTIO_F_ACCESS_PLATFORM)))
+ /* minimum features to expect */
+ if (!(*features & BIT_ULL(VIRTIO_F_ACCESS_PLATFORM)))
return -EOPNOTSUPP;
+ /* Double check features combination sent down by the driver.
+ * NACK invalid feature due to the absence of depended feature.
+ * Driver is expected to re-read the negotiated features once
+ * return from set_driver_features.
+ */
+ if ((*features & (BIT_ULL(VIRTIO_NET_F_MQ) | BIT_ULL(VIRTIO_NET_F_CTRL_VQ))) ==
+ BIT_ULL(VIRTIO_NET_F_MQ))
+ *features &= ~BIT_ULL(VIRTIO_NET_F_MQ);
+
return 0;
}
@@ -1977,7 +1987,7 @@ static int mlx5_vdpa_set_driver_features(struct vdpa_device *vdev, u64 features)
print_features(mvdev, features, true);
- err = verify_min_features(mvdev, features);
+ err = verify_driver_features(mvdev, &features);
if (err)
return err;
--
1.8.3.1
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
next prev parent reply other threads:[~2022-01-13 6:05 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-13 5:10 [PATCH 0/3] fixes for mlx5_vdpa multiqueue support Si-Wei Liu
2022-01-13 5:10 ` [PATCH 1/3] vdpa: factor out vdpa_set_features_unlocked for vdpa internal use Si-Wei Liu
2022-01-13 6:46 ` Michael S. Tsirkin
2022-01-13 5:10 ` Si-Wei Liu [this message]
2022-01-13 6:57 ` [PATCH 2/3] vdpa/mlx5: set_features should nack MQ if no CTRL_VQ Michael S. Tsirkin
2022-01-14 8:51 ` Si-Wei Liu
2022-01-14 12:53 ` Michael S. Tsirkin
[not found] ` <20220113080914.GB1312@mtl-vdi-166.wap.labs.mlnx>
2022-01-14 6:08 ` Jason Wang
2022-01-13 5:10 ` [PATCH 3/3] vdpa/mlx5: validate the queue pair value from driver Si-Wei Liu
2022-01-13 7:00 ` Michael S. Tsirkin
2022-01-14 9:19 ` Si-Wei Liu
2022-01-13 7:03 ` [PATCH 0/3] fixes for mlx5_vdpa multiqueue support Michael S. Tsirkin
2022-01-14 9:24 ` Si-Wei Liu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1642050651-16197-3-git-send-email-si-wei.liu@oracle.com \
--to=si-wei.liu@oracle.com \
--cc=elic@nvidia.com \
--cc=eperezma@redhat.com \
--cc=jasowang@redhat.com \
--cc=lvivier@redhat.com \
--cc=mst@redhat.com \
--cc=virtualization@lists.linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).