Skip to content

Commit 54fb04b

Browse files
Zhu Lingshanmstsirkin
authored andcommitted
vDPA: report virtio-block MQ info to user space
This commits allows vDPA reporting virtio-block multi-queue configuration to user sapce. Signed-off-by: Zhu Lingshan <lingshan.zhu@intel.com> Message-Id: <20240218185606.13509-6-lingshan.zhu@intel.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
1 parent 81f64e1 commit 54fb04b

2 files changed

Lines changed: 17 additions & 0 deletions

File tree

drivers/vdpa/vdpa.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -999,6 +999,19 @@ vdpa_dev_blk_seg_max_config_fill(struct sk_buff *msg, u64 features,
999999
return nla_put_u32(msg, VDPA_ATTR_DEV_BLK_CFG_SEG_MAX, val_u32);
10001000
}
10011001

1002+
static int vdpa_dev_blk_mq_config_fill(struct sk_buff *msg, u64 features,
1003+
const struct virtio_blk_config *config)
1004+
{
1005+
u16 val_u16;
1006+
1007+
if ((features & BIT_ULL(VIRTIO_BLK_F_MQ)) == 0)
1008+
return 0;
1009+
1010+
val_u16 = __virtio16_to_cpu(true, config->num_queues);
1011+
1012+
return nla_put_u16(msg, VDPA_ATTR_DEV_BLK_CFG_NUM_QUEUES, val_u16);
1013+
}
1014+
10021015
static int vdpa_dev_blk_config_fill(struct vdpa_device *vdev,
10031016
struct sk_buff *msg)
10041017
{
@@ -1025,6 +1038,9 @@ static int vdpa_dev_blk_config_fill(struct vdpa_device *vdev,
10251038
if (vdpa_dev_blk_seg_max_config_fill(msg, features_device, &config))
10261039
return -EMSGSIZE;
10271040

1041+
if (vdpa_dev_blk_mq_config_fill(msg, features_device, &config))
1042+
return -EMSGSIZE;
1043+
10281044
return 0;
10291045
}
10301046

include/uapi/linux/vdpa.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ enum vdpa_attr {
6060
VDPA_ATTR_DEV_BLK_CFG_SEG_SIZE, /* u32 */
6161
VDPA_ATTR_DEV_BLK_CFG_BLK_SIZE, /* u32 */
6262
VDPA_ATTR_DEV_BLK_CFG_SEG_MAX, /* u32 */
63+
VDPA_ATTR_DEV_BLK_CFG_NUM_QUEUES, /* u16 */
6364

6465
/* new attributes must be added above here */
6566
VDPA_ATTR_MAX,

0 commit comments

Comments
 (0)