Thread (1 message) 1 message, 1 author, 2022-04-25

Re: [PATCH v2 1/2] vdpa: add the check for id_table in struct vdpa_mgmt_dev

flat view

From: Jason Wang <hidden>
Date: 2022-04-25 09:00:11
Also in: lkml

On Mon, Apr 25, 2022 at 2:27 PM Cindy Lu [off-list ref] wrote:
quoted hunk
To support the dynamic ids in vp_vdpa, we need to add the check for
id table. If the id table is NULL, will not set the device type

Signed-off-by: Cindy Lu <redacted>
---
 drivers/vdpa/vdpa.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/drivers/vdpa/vdpa.c b/drivers/vdpa/vdpa.c
index 1ea525433a5c..09edd92cede0 100644
--- a/drivers/vdpa/vdpa.c
+++ b/drivers/vdpa/vdpa.c
@@ -492,10 +492,13 @@ static int vdpa_mgmtdev_fill(const struct vdpa_mgmt_dev *mdev, struct sk_buff *m
        if (err)
                goto msg_err;

-       while (mdev->id_table[i].device) {
-               if (mdev->id_table[i].device <= 63)
-                       supported_classes |= BIT_ULL(mdev->id_table[i].device);
-               i++;
+       if (mdev->id_table != NULL) {
+               while (mdev->id_table[i].device) {
+                       if (mdev->id_table[i].device <= 63)
+                               supported_classes |=
+                                       BIT_ULL(mdev->id_table[i].device);
+                       i++;
+               }
        }
This will cause 0 to be advertised as the supported classes.

I wonder if we can simply use VIRTIO_DEV_ANY_ID here (and need to
export it to via uAPI probably).

Thanks
        if (nla_put_u64_64bit(msg, VDPA_ATTR_MGMTDEV_SUPPORTED_CLASSES,
--
2.34.1
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help