vdpa: Allow to configure max data virtqueues
Quoted 13 lines · Eli Cohen
Allow to configure the max virtqueues for a device.
Signed-off-by Eli Cohen <[email protected]>--- drivers/vdpa/vdpa.c | 16 +++++++++++++++- include/linux/vdpa.h | 1 + 2 files changed, 16 insertions(+), 1 deletion(-)drivers/vdpa/vdpa.c +0
-0
drivers/vdpa/vdpa.c vdpa_nl_cmd_mgmtdev_get_dumpit(struct sk_buff *msg, struct netlink_callback *cb) · line 484
Quoted 6 lines
drivers/vdpa/vdpa.c +2
-1@@ -480,7 +480,8 @@ vdpa_nl_cmd_mgmtdev_get_dumpit(struct sk_buff *msg, struct netlink_callback *cb) }#define VDPA_DEV_NET_ATTRS_MASK ((1 << VDPA_ATTR_DEV_NET_CFG_MACADDR) | \ - (1 << VDPA_ATTR_DEV_NET_CFG_MTU)) + (1 << VDPA_ATTR_DEV_NET_CFG_MTU) | \ + (1 << VDPA_ATTR_DEV_NET_CFG_MAX_VQP))
It seems VDPA_ATTR_DEV_MAX_VQS (u32) is what you want (# of data virtqueues instead of # of data virtqueue pairs)? Not sure what's possible use of VDPA_ATTR_DEV_NET_CFG_MAX_VQP, was it to dump/display the config space max_virtqueue_pairs value (u16, 1-32768) for virtio-net? Why there's such quasi-duplicate attribute introduced in the first place?
Not even sure VDPA_ATTR_DEV_MAX_VQS by definition should include other virtqueues as well: such as control virtqueue or event virtqueue. Hence the name will be more applicable to vdpa devices of other virtio type than just virtio-net. Otherwise I would think this attribute is slightly misnamed (max_data_vqs might be a proper name).
Quoted 6 lines
drivers/vdpa/vdpa.c +0
-0static int vdpa_nl_cmd_dev_add_set_doit (struct sk_buff *skb,struct genl_info *info) {@@ -506,6 +507,19 @@ static int vdpa_nl_cmd_dev_add_set_doit(struct sk_buff *skb, struct genl_info *inla_get_u16 (nl_attrs[VDPA_ATTR_DEV_NET_CFG_MTU ]); config.mask |= (1 <<VDPA_ATTR_DEV_NET_CFG_MTU );
drivers/vdpa/vdpa.c static int vdpa_nl_cmd_dev_add_set_doit(struct sk_buff *skb, struct genl_info *i · line 518
Quoted 10 lines
drivers/vdpa/vdpa.c +9
-0} +if (nl_attrs[VDPA_ATTR_DEV_NET_CFG_MAX_VQP ]) { + config.max_virtqueues =nla_get_u16 (nl_attrs[VDPA_ATTR_DEV_NET_CFG_MAX_VQP ]); +if (config.max_virtqueues <2 ) { +NL_SET_ERR_MSG_MOD (info->extack,"At least two virtqueues are required" ); +return -EINVAL ; + } +if ((config.max_virtqueues -1 ) & config.max_virtqueues) { +NL_SET_ERR_MSG_MOD (info->extack, +"Must provide power of two number of virtqueues" );
Why there's such limitation for the number of vDPA virtqueues? I thought the software virtio doesn't have this limitation (power of two).
-Siwei
Quoted 12 lines
drivers/vdpa/vdpa.c +4
-0+return -EINVAL ; + } + config.mask |=BIT_ULL (VDPA_ATTR_DEV_NET_CFG_MAX_VQP ); + }/* Skip checking capability if user didn't prefer to configure any * device networking attributes. It is likely that user might have used include/linux/vdpa.h +0
-0
include/linux/vdpa.h struct vdpa_dev_set_config { · line 107
Quoted 7 lines
include/linux/vdpa.h +1
-0@@ -101,6 +101,7 @@ struct vdpa_dev_set_config {u16 mtu; } net;u64 mask; +u16 max_virtqueues; };/**
_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Re: [PATCH 2/2] vdpa/mlx5: Support configuring max data virtqueues
In reply to a message not in the archiveQuoted 49 lines · Eli Cohen
Check if the required number of data virtqueues was provided when a adding a new device and verify the new value does not exceed device capabilities.
In addition, change the arrays holding virtqueue and callback contexts to be dynamically allocated.
Signed-off-by Eli Cohen <[email protected]>--- drivers/vdpa/mlx5/net/mlx5_vnet.c | 32 +++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-)drivers/vdpa/mlx5/net/mlx5_vnet.c +3
-8@@ -131,11 +131,6 @@ struct mlx5_vdpa_virtqueue {struct mlx5_vq_restore_info ri; }; -/* We will remove this limitation once mlx5_vdpa_alloc_resources() -* provides for driver space allocation -*/ -#define MLX5_MAX_SUPPORTED_VQS 16 -static bool is_index_valid (struct mlx5_vdpa_dev *mvdev,u16 idx) {if (unlikely (idx > mvdev->max_idx))@@ -148,8 +143,8 @@ struct mlx5_vdpa_net {struct mlx5_vdpa_dev mvdev;struct mlx5_vdpa_net_resources res;struct virtio_net_config config; -struct mlx5_vdpa_virtqueue vqs[MLX5_MAX_SUPPORTED_VQS ]; -struct vdpa_callback event_cbs[MLX5_MAX_SUPPORTED_VQS +1 ]; +struct mlx5_vdpa_virtqueue *vqs; +struct vdpa_callback *event_cbs;/* Serialize vq resources creation and destruction. This is required * since memory map might change and we need to destroy and create @@ -1218,7 +1213,7 @@ static void suspend_vqs(struct mlx5_vdpa_net *ndev) {int i; -for (i =0 ; i <MLX5_MAX_SUPPORTED_VQS ; i++) +for (i =0 ; i < ndev->mvdev.max_vqs; i++)suspend_vq (ndev, &ndev->vqs[i]); }
drivers/vdpa/mlx5/net/mlx5_vnet.c static int create_rqt(struct mlx5_vdpa_net *ndev) · line 1244
Quoted 6 lines
drivers/vdpa/mlx5/net/mlx5_vnet.c +1
-1@@ -1245,7 +1240,7 @@ static int create_rqt(struct mlx5_vdpa_net *ndev)int i, j;int err; - max_rqt =min_t (int,MLX5_MAX_SUPPORTED_VQS /2 , + max_rqt =min_t (int, ndev->mvdev.max_vqs /2 ,1 <<MLX5_CAP_GEN (ndev->mvdev.mdev, log_max_rqt_size));
Here the user configured number of data vqs may get silently capped to what the device can support (up to 2^log_max_rqt_size). Do you consider expose this device specific capacity to vdpa users so it doesn't get blindly misconfigured, and/or return appropriate error message to indicate the failure cause?
If mlx5 vdpa really can't support power of 2 number of data vqs due to hardware limitation (?), an appropriate message should be returned here.
-Siwei
Quoted 46 lines
drivers/vdpa/mlx5/net/mlx5_vnet.c +14
-2if (max_rqt <1 )return -EOPNOTSUPP ;@@ -2235,7 +2230,7 @@ static int mlx5_vdpa_reset(struct vdpa_device *vdev)clear_vqs_ready (ndev);mlx5_vdpa_destroy_mr (&ndev->mvdev); ndev->mvdev.status =0 ; -memset (ndev->event_cbs,0 ,sizeof (ndev->event_cbs)); +memset (ndev->event_cbs,0 ,sizeof (*ndev->event_cbs) * (mvdev->max_vqs +1 )); ndev->mvdev.actual_features =0 ; ++mvdev->generation;if (MLX5_CAP_GEN (mvdev->mdev, umem_uid_0)) {@@ -2308,6 +2303,8 @@ static void mlx5_vdpa_free(struct vdpa_device *vdev) }mlx5_vdpa_free_resources (&ndev->mvdev);mutex_destroy (&ndev->reslock); +kfree (ndev->event_cbs); +kfree (ndev->vqs); }static struct vdpa_notification_area mlx5_get_vq_notification (struct vdpa_device *vdev,u16 idx)@@ -2547,13 +2544,23 @@ static int mlx5_vdpa_dev_add(struct vdpa_mgmt_dev *v_mdev, const char *name,/* we save one virtqueue for control virtqueue should we require it */ max_vqs =MLX5_CAP_DEV_VDPA_EMULATION (mdev, max_num_virtio_queues); - max_vqs =min_t (u32, max_vqs,MLX5_MAX_SUPPORTED_VQS ); +if (add_config->mask &BIT_ULL (VDPA_ATTR_DEV_NET_CFG_MAX_VQP )) { +if (add_config->max_virtqueues > max_vqs) +return -EINVAL ; + max_vqs =min_t (u32, max_vqs, add_config->max_virtqueues); + } ndev = vdpa_alloc_device(struct mlx5_vdpa_net, mvdev.vdev, mdev->device, &mlx5_vdpa_ops, name, false);if (IS_ERR (ndev))return PTR_ERR (ndev); + ndev->vqs =kcalloc (max_vqs,sizeof (*ndev->vqs),GFP_KERNEL ); + ndev->event_cbs =kcalloc (max_vqs +1 ,sizeof (*ndev->event_cbs),GFP_KERNEL ); +if (!ndev->vqs || !ndev->event_cbs) { + err = -ENOMEM ; + goto err_mtu; + } ndev->mvdev.max_vqs = max_vqs; mvdev = &ndev->mvdev; mvdev->mdev = mdev;
drivers/vdpa/mlx5/net/mlx5_vnet.c static int mlx5v_probe(struct auxiliary_device *adev, · line 2690
Quoted 9 lines
drivers/vdpa/mlx5/net/mlx5_vnet.c +2
-1@@ -2676,7 +2683,8 @@ static int mlx5v_probe(struct auxiliary_device *adev, mgtdev->mgtdev.ops = &mdev_ops; mgtdev->mgtdev.device = mdev->device; mgtdev->mgtdev.id_table = id_table; - mgtdev->mgtdev.config_attr_mask = (1 <<VDPA_ATTR_DEV_NET_CFG_MACADDR ); + mgtdev->mgtdev.config_attr_mask =BIT_ULL (VDPA_ATTR_DEV_NET_CFG_MACADDR ) | +BIT_ULL (VDPA_ATTR_DEV_NET_CFG_MAX_VQP ); mgtdev->madev = madev; err =vdpa_mgmtdev_register (&mgtdev->mgtdev);
_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Quoted 33 lines
From: Eli Cohen <[email protected]>
Sent: Wednesday, December 1, 2021 3:33 PMQuoted 11 lines · Si-Wei Liu
Quoted 8 lines · Eli Cohen
Allow to configure the max virtqueues for a device.
Signed-off-by Eli Cohen <[email protected]>--- drivers/vdpa/vdpa.c | 16 +++++++++++++++- include/linux/vdpa.h | 1 + 2 files changed, 16 insertions(+), 1 deletion(-)Quoted 5 lines
drivers/vdpa/vdpa.c vdpa_nl_cmd_mgmtdev_get_dumpit(struct sk_buff
Quoted 5 lines
drivers/vdpa/vdpa.c index renamed from drivers/vdpa/vdpa.c +0
-0
7332a74a4b00..e185ec2ee851100644drivers/vdpa/vdpa.c +0
-0@@ -480,7 +480,8 @@ vdpa_nl_cmd_mgmtdev_get_dumpit(struct sk_buff*msg, struct
netlink_callback*cb)Quoted 2 lines
drivers/vdpa/vdpa.c vdpa_nl_cmd_mgmtdev_get_dumpit(struct sk_buff · line 481
Quoted 2 lines
drivers/vdpa/vdpa.c +0
-0}#define VDPA_DEV_NET_ATTRS_MASK ((1 <<
VDPA_ATTR_DEV_NET_CFG_MACADDR) | \Quoted 6 lines
drivers/vdpa/vdpa.c vdpa_nl_cmd_mgmtdev_get_dumpit(struct sk_buff · line 483
Quoted 3 lines
drivers/vdpa/vdpa.c +2
-1- (1 << VDPA_ATTR_DEV_NET_CFG_MTU)) + (1 <<VDPA_ATTR_DEV_NET_CFG_MTU ) | \ + (1 << VDPA_ATTR_DEV_NET_CFG_MAX_VQP))It seems
VDPA_ATTR_DEV_MAX_VQS(u32) is what you want (# of data virtqueues instead of # of data virtqueue pairs)? Not sure what's possible use ofVDPA_ATTR_DEV_NET_CFG_MAX_VQP, was it todump/display
Quoted 9 lines
Quoted 2 lines
the config space
max_virtqueue_pairsvalue (u16, 1-32768) for virtio-net? Why there's such quasi-duplicate attribute introduced in the firstplace?
Quoted 1 line
VDPA_ATTR_DEV_MAX_VQScurrently returnsvdev->nvqswhich equals whatever passed to_vdpa_register_device(). The latter depends on the value provided by (struct vdpa_dev_set_config).max_virtqueues.
Max VQs configuration should reuse VDPA_ATTR_DEV_MAX_VQS.
it indicates what is the max vqs a given vdpa device is using. Until now it was driver's choice, now its users choice if provided. So no need for additional attribute.
Quoted 3 lines
Maybe we should add attributes to add aditional virtqueues like control virtqueue and their index. They could be returned by
vdpa_dev_net_config_fill().
Yes.
_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Quoted 49 lines
From: Eli Cohen <[email protected]>
Sent: Wednesday, December 1, 2021 5:29 PMQuoted 24 lines · Parav Pandit
Quoted 24 lines
From: Eli Cohen <[email protected]>
Sent: Wednesday, December 1, 2021 3:33 PMQuoted 11 lines · Si-Wei Liu
Quoted 8 lines · Eli Cohen
Allow to configure the max virtqueues for a device.
Signed-off-by Eli Cohen <[email protected]>--- drivers/vdpa/vdpa.c | 16 +++++++++++++++- include/linux/vdpa.h | 1 + 2 files changed, 16 insertions(+), 1 deletion(-)Quoted 6 lines
Quoted 6 lines
drivers/vdpa/vdpa.c index renamed from drivers/vdpa/vdpa.c +0
-0
7332a74a4b00..e185ec2ee851100644drivers/vdpa/vdpa.c +0
-0@@ -480,7 +480,8 @@ vdpa_nl_cmd_mgmtdev_get_dumpit(struct
sk_buff*msg, struct
netlink_callback*cb)Quoted 4 lines
Quoted 4 lines
Quoted 2 lines
Quoted 2 lines
} #define VDPA_DEV_NET_ATTRS_MASK ((1 <<
VDPA_ATTR_DEV_NET_CFG_MACADDR) | \Quoted 1 line
drivers/vdpa/vdpa.c
Quoted 1 line
drivers/vdpa/vdpa.c +0
-1- (1 <<
VDPA_ATTR_DEV_NET_CFG_MTU))Quoted 1 line
Quoted 1 line
Quoted 1 line
drivers/vdpa/vdpa.c
Quoted 1 line
drivers/vdpa/vdpa.c +1
-0+ (1 <<
VDPA_ATTR_DEV_NET_CFG_MTU) | \Quoted 1 line
Quoted 1 line
Quoted 1 line
drivers/vdpa/vdpa.c
Quoted 1 line
drivers/vdpa/vdpa.c +1
-0+ (1 <<
VDPA_ATTR_DEV_NET_CFG_MAX_VQP))Quoted 10 lines
Quoted 10 lines
Quoted 3 lines
It seems
VDPA_ATTR_DEV_MAX_VQS(u32) is what you want (# of data virtqueues instead of # of data virtqueue pairs)? Not sure what's possible use ofVDPA_ATTR_DEV_NET_CFG_MAX_VQP, was it todump/display
Quoted 3 lines
the config space
max_virtqueue_pairsvalue (u16, 1-32768) for virtio-net? Why there's such quasi-duplicate attribute introduced in the firstplace?
Quoted 1 line
Quoted 6 lines
Quoted 4 lines
Quoted 4 lines
VDPA_ATTR_DEV_MAX_VQScurrently returnsvdev->nvqswhich equals whatever passed to_vdpa_register_device(). The latter depends on the value provided by (struct vdpa_dev_set_config).max_virtqueues.But currently
VDPA_ATTR_DEV_MAX_VQSreturns the number of used queues,
No. it doesn't.
It reports nvqs passed in _vdpa_register_device().
And this API has clear definition of nvqs = number of virtqueues supported by this device nvqs != number of used vqs.
So current MAX_VQS is doing its job right.
For example nvqs can be be 8 and guest VM driver may just use two VQs (1 tx, 1 rx, and used vqs = 2).
_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Quoted 27 lines · Eli Cohen
Quoted 10 lines · Si-Wei Liu
Quoted 8 lines · Eli Cohen
Allow to configure the max virtqueues for a device.
Signed-off-by Eli Cohen <[email protected]>--- drivers/vdpa/vdpa.c | 16 +++++++++++++++- include/linux/vdpa.h | 1 + 2 files changed, 16 insertions(+), 1 deletion(-)Quoted 16 lines
drivers/vdpa/vdpa.c vdpa_nl_cmd_mgmtdev_get_dumpit(struct sk_buff *msg, struct netlink_callback *cb) · line 483
Quoted 10 lines
drivers/vdpa/vdpa.c +2
-1@@ -480,7 +480,8 @@ vdpa_nl_cmd_mgmtdev_get_dumpit(struct sk_buff *msg, struct netlink_callback *cb) }#define VDPA_DEV_NET_ATTRS_MASK ((1 << VDPA_ATTR_DEV_NET_CFG_MACADDR) | \ - (1 << VDPA_ATTR_DEV_NET_CFG_MTU)) + (1 << VDPA_ATTR_DEV_NET_CFG_MTU) | \ + (1 << VDPA_ATTR_DEV_NET_CFG_MAX_VQP))It seems
VDPA_ATTR_DEV_MAX_VQS(u32) is what you want (# of data virtqueues instead of # of data virtqueue pairs)? Not sure what's possible use ofVDPA_ATTR_DEV_NET_CFG_MAX_VQP, was it to dump/display the config spacemax_virtqueue_pairsvalue (u16, 1-32768) for virtio-net? Why there's such quasi-duplicate attribute introduced in the first place?
Quoted 6 lines
VDPA_ATTR_DEV_MAX_VQScurrently returnsvdev->nvqswhich equals whatever passed to_vdpa_register_device(). The latter depends on the value provided by (struct vdpa_dev_set_config).max_virtqueues. It's the only way to let the user know if there are other virtqueues besides the data virtqueues. For example, if we support control virtqueue and configured 2 data QPs, we will return 5.
That's right. Then let VDPA_ATTR_DEV_MAX_VQS continue to be read-only as is.
Quoted 4 lines
Maybe we should add attributes to add aditional virtqueues like control virtqueue and their index. They could be returned by
vdpa_dev_net_config_fill().
Probably this info would need to return to QEMU for proper virtq modeling via vDPA ioctls rather than just netlink API. Agreed it's virtio-net specific config.
Quoted 4 lines
VDPA_ATTR_DEV_NET_CFG_MAX_VQPseems the right choice since it is used to provid the requested number of data virtqueues when creating the device. Maybe we need to change the name toVDPA_ATTR_DEV_NET_CFG_MAX_VQand then this patch makes more sense.
I would just keep the name for VDPA_ATTR_DEV_NET_CFG_MAX_VQP and have user configure the number of data queue pairs instead. Very few virtio types come with virtqueue in pairs, so this has to be vdpa net specific config.
Thanks,
-Siwei
Quoted 41 lines
I will post another series to address all these issues.
Quoted 15 lines
Not even sure
VDPA_ATTR_DEV_MAX_VQSby definition should include other virtqueues as well: such as control virtqueue or event virtqueue. Hence the name will be more applicable to vdpa devices of other virtio type than just virtio-net. Otherwise I would think this attribute is slightly misnamed (max_data_vqsmight be a proper name).Quoted 9 lines
drivers/vdpa/vdpa.c +3
-0static int vdpa_nl_cmd_dev_add_set_doit (struct sk_buff *skb,struct genl_info *info) {@@ -506,6 +507,19 @@ static int vdpa_nl_cmd_dev_add_set_doit(struct sk_buff *skb, struct genl_info *inla_get_u16 (nl_attrs[VDPA_ATTR_DEV_NET_CFG_MTU ]); config.mask |= (1 <<VDPA_ATTR_DEV_NET_CFG_MTU ); } +if (nl_attrs[VDPA_ATTR_DEV_NET_CFG_MAX_VQP ]) { + config.max_virtqueues =nla_get_u16 (nl_attrs[VDPA_ATTR_DEV_NET_CFG_MAX_VQP ]); +if (config.max_virtqueues <2 ) {Quoted 8 lines
drivers/vdpa/vdpa.c static int vdpa_nl_cmd_dev_add_set_doit(struct sk_buff *skb, struct genl_info *i · line 518
Quoted 6 lines
drivers/vdpa/vdpa.c +6
-0+NL_SET_ERR_MSG_MOD (info->extack,"At least two virtqueues are required" ); +return -EINVAL ; + } +if ((config.max_virtqueues -1 ) & config.max_virtqueues) { +NL_SET_ERR_MSG_MOD (info->extack, +"Must provide power of two number of virtqueues" );Why there's such limitation for the number of vDPA virtqueues? I thought the software virtio doesn't have this limitation (power of two).
Right, the limitation comes from
mlx5_vdpa. I will post a patch later to remove that limitation.Quoted 11 lines
-Siwei
Quoted 9 lines
drivers/vdpa/vdpa.c +4
-0+return -EINVAL ; + } + config.mask |=BIT_ULL (VDPA_ATTR_DEV_NET_CFG_MAX_VQP ); + }/* Skip checking capability if user didn't prefer to configure any * device networking attributes. It is likely that user might have used include/linux/vdpa.h +0
-1--- a/include/linux/vdpa.h
Quoted 8 lines
Quoted 8 lines
include/linux/vdpa.h struct vdpa_dev_set_config { · line 106
Quoted 8 lines
+++
b/include/linux/vdpa.hinclude/linux/vdpa.h +1
-0@@ -101,6 +101,7 @@ struct vdpa_dev_set_config {u16 mtu; } net;u64 mask; +u16 max_virtqueues; };/**
_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Quoted 8 lines · Eli Cohen
Quoted 5 lines
Review
Quoted 3 lines
(quoted diff) +3
-0+ if ((config.max_virtqueues - 1) & config.max_virtqueues) { + NL_SET_ERR_MSG_MOD(info->extack, + "Must provide power of two number of virtqueues");Why there's such limitation for the number of vDPA virtqueues? I thought the software virtio doesn't have this limitation (power of two).
Right, the limitation comes from
mlx5_vdpa. I will post a patch later to remove that limitation.
I mean the check should not live here. Other vdpa vendor device/driver may not have this limitation.
-Siwei
_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Quoted 33 lines · Parav Pandit
Quoted 33 lines
From: Eli Cohen <[email protected]>
Sent: Wednesday, December 1, 2021 3:33 PMQuoted 10 lines · Si-Wei Liu
Quoted 8 lines · Eli Cohen
Allow to configure the max virtqueues for a device.
Signed-off-by Eli Cohen <[email protected]>--- drivers/vdpa/vdpa.c | 16 +++++++++++++++- include/linux/vdpa.h | 1 + 2 files changed, 16 insertions(+), 1 deletion(-)Quoted 5 lines
drivers/vdpa/vdpa.c vdpa_nl_cmd_mgmtdev_get_dumpit(struct sk_buff
Quoted 5 lines
drivers/vdpa/vdpa.c index renamed from drivers/vdpa/vdpa.c +0
-0
7332a74a4b00..e185ec2ee851100644drivers/vdpa/vdpa.c +0
-0@@ -480,7 +480,8 @@ vdpa_nl_cmd_mgmtdev_get_dumpit(struct sk_buff*msg, struct
netlink_callback*cb)Quoted 2 lines
drivers/vdpa/vdpa.c vdpa_nl_cmd_mgmtdev_get_dumpit(struct sk_buff · line 481
Quoted 2 lines
drivers/vdpa/vdpa.c +0
-0}#define VDPA_DEV_NET_ATTRS_MASK ((1 <<
VDPA_ATTR_DEV_NET_CFG_MACADDR) | \Quoted 6 lines
drivers/vdpa/vdpa.c vdpa_nl_cmd_mgmtdev_get_dumpit(struct sk_buff · line 483
Quoted 3 lines
drivers/vdpa/vdpa.c +2
-1- (1 << VDPA_ATTR_DEV_NET_CFG_MTU)) + (1 <<VDPA_ATTR_DEV_NET_CFG_MTU ) | \ + (1 << VDPA_ATTR_DEV_NET_CFG_MAX_VQP))It seems
VDPA_ATTR_DEV_MAX_VQS(u32) is what you want (# of data virtqueues instead of # of data virtqueue pairs)? Not sure what's possible use ofVDPA_ATTR_DEV_NET_CFG_MAX_VQP, was it todump/display
Quoted 2 lines
the config space
max_virtqueue_pairsvalue (u16, 1-32768) for virtio-net? Why there's such quasi-duplicate attribute introduced in the first
Quoted 8 lines
Quoted 5 lines
place?
VDPA_ATTR_DEV_MAX_VQScurrently returnsvdev->nvqswhich equals whatever passed to_vdpa_register_device(). The latter depends on the value provided by (struct vdpa_dev_set_config).max_virtqueues.Max VQs configuration should reuse
VDPA_ATTR_DEV_MAX_VQS.
it indicates what is the max vqs a given vdpa device is using. Until now it was driver's choice, now its users choice if provided. So no need for additional attribute.
I think a device specific attribute might be better:
1) max_virt_queue_pairs is part of config space so it should work as mtu and mac
2) it's more convenient for the user to specifc qps instead of doing 2*N+1 calculation
Thanks
Quoted 6 lines
Quoted 4 lines
Maybe we should add attributes to add aditional virtqueues like control virtqueue and their index. They could be returned by
vdpa_dev_net_config_fill().Yes.
_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Quoted 53 lines
From: Jason Wang <[email protected]>
Sent: Thursday, December 2, 2021 9:11 AMQuoted 15 lines · Parav Pandit
Quoted 15 lines
From: Eli Cohen <[email protected]>
Sent: Wednesday, December 1, 2021 3:33 PMQuoted 10 lines · Si-Wei Liu
Quoted 8 lines · Eli Cohen
Allow to configure the max virtqueues for a device.
Signed-off-by Eli Cohen <[email protected]>--- drivers/vdpa/vdpa.c | 16 +++++++++++++++- include/linux/vdpa.h | 1 + 2 files changed, 16 insertions(+), 1 deletion(-)Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
drivers/vdpa/vdpa.c vdpa_nl_cmd_mgmtdev_get_dumpit(struct
Quoted 5 lines
drivers/vdpa/vdpa.c index renamed from drivers/vdpa/vdpa.c +0
-0
7332a74a4b00..e185ec2ee851100644drivers/vdpa/vdpa.c +0
-0@@ -480,7 +480,8 @@ vdpa_nl_cmd_mgmtdev_get_dumpit(struct
sk_buffQuoted 7 lines
Quoted 7 lines
*msg, struct
netlink_callback*cb)Quoted 2 lines
drivers/vdpa/vdpa.c vdpa_nl_cmd_mgmtdev_get_dumpit(struct · line 481
Quoted 2 lines
drivers/vdpa/vdpa.c +0
-0}#define VDPA_DEV_NET_ATTRS_MASK ((1 <<
VDPA_ATTR_DEV_NET_CFG_MACADDR) | \Quoted 3 lines
drivers/vdpa/vdpa.c vdpa_nl_cmd_mgmtdev_get_dumpit(struct · line 483
Quoted 3 lines
drivers/vdpa/vdpa.c +2
-1- (1 << VDPA_ATTR_DEV_NET_CFG_MTU)) + (1 << VDPA_ATTR_DEV_NET_CFG_MTU) | \ + (1 <<
VDPA_ATTR_DEV_NET_CFG_MAX_VQP))Quoted 7 lines
Quoted 7 lines
Quoted 3 lines
It seems
VDPA_ATTR_DEV_MAX_VQS(u32) is what you want (# of data virtqueues instead of # of data virtqueue pairs)? Not sure what's possible use ofVDPA_ATTR_DEV_NET_CFG_MAX_VQP, was it todump/display
Quoted 3 lines
the config space
max_virtqueue_pairsvalue (u16, 1-32768) for virtio-net? Why there's such quasi-duplicate attribute introduced in the firstQuoted 7 lines
Quoted 5 lines
place?
VDPA_ATTR_DEV_MAX_VQScurrently returnsvdev->nvqswhich equals whatever passed to_vdpa_register_device(). The latter depends on the value provided by (struct vdpa_dev_set_config).max_virtqueues.Max VQs configuration should reuse
VDPA_ATTR_DEV_MAX_VQS.
it indicates what is the max vqs a given vdpa device is using. Until now it wasdriver's choice, now its users choice if provided.
Quoted 1 line
So no need for additional attribute.
Quoted 8 lines
I think a device specific attribute might be better:
1)
max_virt_queue_pairsis part of config space so it should work as mtu and mac2) it's more convenient for the user to specifc qps instead of doing 2*N+1 calculation
Yes. Eli's new series already took care of this by reusing existing attribute.
_______________________________________________
Virtualization mailing list [email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization