Thread (1 message) 1 message, 1 author, 2021-10-25

Re: [PATCH v6 7/8] vdpa: add new attribute VDPA_ATTR_DEV_MIN_VQ_SIZE

From: Jason Wang <hidden>
Date: 2021-10-25 02:24:08
Also in: lkml

On Fri, Oct 22, 2021 at 10:45 AM Wu Zongyong
[off-list ref] wrote:
This attribute advertises the min value of virtqueue size. The value is
0 by default.
As discussed previously, 0 seems an invalid value. We should use 1 at least.

Thanks
quoted hunk
Signed-off-by: Wu Zongyong <redacted>
---
 drivers/vdpa/vdpa.c       | 5 +++++
 include/uapi/linux/vdpa.h | 1 +
 2 files changed, 6 insertions(+)
diff --git a/drivers/vdpa/vdpa.c b/drivers/vdpa/vdpa.c
index fd014ecec711..4aeb1458b924 100644
--- a/drivers/vdpa/vdpa.c
+++ b/drivers/vdpa/vdpa.c
@@ -500,6 +500,7 @@ vdpa_dev_fill(struct vdpa_device *vdev, struct sk_buff *msg, u32 portid, u32 seq
              int flags, struct netlink_ext_ack *extack)
 {
        u16 max_vq_size;
+       u16 min_vq_size = 0;
        u32 device_id;
        u32 vendor_id;
        void *hdr;
@@ -516,6 +517,8 @@ vdpa_dev_fill(struct vdpa_device *vdev, struct sk_buff *msg, u32 portid, u32 seq
        device_id = vdev->config->get_device_id(vdev);
        vendor_id = vdev->config->get_vendor_id(vdev);
        max_vq_size = vdev->config->get_vq_num_max(vdev);
+       if (vdev->config->get_vq_num_min)
+               min_vq_size = vdev->config->get_vq_num_min(vdev);

        err = -EMSGSIZE;
        if (nla_put_string(msg, VDPA_ATTR_DEV_NAME, dev_name(&vdev->dev)))
@@ -528,6 +531,8 @@ vdpa_dev_fill(struct vdpa_device *vdev, struct sk_buff *msg, u32 portid, u32 seq
                goto msg_err;
        if (nla_put_u16(msg, VDPA_ATTR_DEV_MAX_VQ_SIZE, max_vq_size))
                goto msg_err;
+       if (nla_put_u16(msg, VDPA_ATTR_DEV_MIN_VQ_SIZE, min_vq_size))
+               goto msg_err;

        genlmsg_end(msg, hdr);
        return 0;
diff --git a/include/uapi/linux/vdpa.h b/include/uapi/linux/vdpa.h
index 66a41e4ec163..e3b87879514c 100644
--- a/include/uapi/linux/vdpa.h
+++ b/include/uapi/linux/vdpa.h
@@ -32,6 +32,7 @@ enum vdpa_attr {
        VDPA_ATTR_DEV_VENDOR_ID,                /* u32 */
        VDPA_ATTR_DEV_MAX_VQS,                  /* u32 */
        VDPA_ATTR_DEV_MAX_VQ_SIZE,              /* u16 */
+       VDPA_ATTR_DEV_MIN_VQ_SIZE,              /* u16 */

        /* new attributes must be added above here */
        VDPA_ATTR_MAX,
--
2.31.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