All of lore.kernel.org
 help / color / mirror / Atom feed
From: Si-Wei Liu <si-wei.liu@oracle.com>
To: Eli Cohen <elic@nvidia.com>
Cc: lvivier@redhat.com, mst@redhat.com,
	virtualization@lists.linux-foundation.org, eperezma@redhat.com
Subject: Re: [PATCH v2 09/10] vdpa: Support reporting max device virtqueues
Date: Wed, 15 Dec 2021 18:56:40 -0800	[thread overview]
Message-ID: <70af2d6e-bd4b-27d5-f3d9-3f745e91b9fd@oracle.com> (raw)
In-Reply-To: <20211214082229.GE89087@mtl-vdi-166.wap.labs.mlnx>



On 12/14/2021 12:22 AM, Eli Cohen wrote:
> On Mon, Dec 13, 2021 at 05:00:18PM -0800, Si-Wei Liu wrote:
>>
>> On 12/13/2021 6:42 AM, Eli Cohen wrote:
>>> Add max_supported_vqs field to struct vdpa_mgmt_dev. Upstream drivers
>>> need to feel this value according to the device capabilities.
>>>
>>> This value is reported back in a netlink message when showing a device.
>>>
>>> Example:
>>>
>>> $ vdpa dev show
>>> vdpa-a: type network mgmtdev auxiliary/mlx5_core.sf.1 vendor_id 5555 \
>>> 	max_vqp 3 max_vq_size 256 max_supported_vqs 256
>>>
>>> Signed-off-by: Eli Cohen <elic@nvidia.com>
>>> ---
>>>    drivers/vdpa/vdpa.c       | 2 ++
>>>    include/linux/vdpa.h      | 1 +
>>>    include/uapi/linux/vdpa.h | 1 +
>>>    3 files changed, 4 insertions(+)
>>>
>>> diff --git a/drivers/vdpa/vdpa.c b/drivers/vdpa/vdpa.c
>>> index 130a8d4aeaed..b9dd693146be 100644
>>> --- a/drivers/vdpa/vdpa.c
>>> +++ b/drivers/vdpa/vdpa.c
>>> @@ -695,6 +695,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_MIN_VQ_SIZE, min_vq_size))
>>>    		goto msg_err;
>>> +	if (nla_put_u16(msg, VDPA_ATTR_DEV_MAX_DEV_VQS, vdev->mdev->max_supported_vqs))
>>> +		goto msg_err;
>> What is the default value if vendor driver doesn't expose this value?
> I think each vendor should put a value here. If you don't, you can still
> add a vdpa device but you'll have to guess.
> Alternatively, I can provide a patch that sets this value to 2 for all
> vendors.
>
>> And it
>> doesn't seem this is something to stash on struct vdpa_mgmt_dev, only some
>> vdpa vendor for network drive may need to expose it; if otherwise not
>> exposed we can assume it's 32767 by the spec.
> I am not sure there's any device capable of so many VQs. In any case, I
> think use 2 as defauly is better since any device can support that.
OK, default to 2 is fine (for net).

>
>> A generic vdpa op
>> (get_device_capability?)
> The point is that you need this info to create a vdpa device so I don't
> see how it can be a vdpa device operation.
I wonder if this info should belong to mgmtdev rather than vdpa dev? It 
should be visible before user ever attempts to create a vdpa device.

>
>> to query device capability might be better I guess
>> (define a VDPA_CAPAB_NET_MAX_VQS subtype to get it).
> Why limit this capablity only for net devices? Any kind of vdpa device
> may want to report this capability.
I thought what you report here is the max number for data queues the 
device can support, no? The control or event queue that is emulated in 
userspace isn't much interesting to users IMHO.

User needs to take the hint from this value to create vdpa net device 
and specify a proper max_vqp value. It's rather counter intuitive if 
what they see is not what they would use.

Thanks,
-Siwei

>> -Siwei
>>
>>>    	genlmsg_end(msg, hdr);
>>>    	return 0;
>>> diff --git a/include/linux/vdpa.h b/include/linux/vdpa.h
>>> index 9245dfbf1b08..72ea8ad7ba21 100644
>>> --- a/include/linux/vdpa.h
>>> +++ b/include/linux/vdpa.h
>>> @@ -444,6 +444,7 @@ struct vdpa_mgmt_dev {
>>>    	const struct vdpa_mgmtdev_ops *ops;
>>>    	const struct virtio_device_id *id_table;
>>>    	u64 config_attr_mask;
>>> +	u16 max_supported_vqs;
>>>    	struct list_head list;
>>>    };
>>> diff --git a/include/uapi/linux/vdpa.h b/include/uapi/linux/vdpa.h
>>> index 23b854e3e5e2..1b758d77e228 100644
>>> --- a/include/uapi/linux/vdpa.h
>>> +++ b/include/uapi/linux/vdpa.h
>>> @@ -42,6 +42,7 @@ enum vdpa_attr {
>>>    	VDPA_ATTR_DEV_MAX_VQ_SIZE,		/* u16 */
>>>    	VDPA_ATTR_DEV_MIN_VQ_SIZE,		/* u16 */
>>>    	VDPA_ATTR_DEV_FLAGS,			/* u64 */
>>> +	VDPA_ATTR_DEV_MAX_DEV_VQS,		/* u16 */
>>>    	VDPA_ATTR_DEV_NET_CFG_MACADDR,		/* binary */
>>>    	VDPA_ATTR_DEV_NET_STATUS,		/* u8 */

_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

  parent reply	other threads:[~2021-12-16  2:56 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20211213144258.179984-1-elic@nvidia.com>
     [not found] ` <20211213144258.179984-10-elic@nvidia.com>
2021-12-13 23:50   ` [PATCH v2 09/10] vdpa: Support reporting max device virtqueues Si-Wei Liu
2021-12-14  1:00   ` Si-Wei Liu
     [not found]     ` <20211214082229.GE89087@mtl-vdi-166.wap.labs.mlnx>
2021-12-16  2:56       ` Si-Wei Liu [this message]
     [not found]         ` <20211219120839.GA84946@mtl-vdi-166.wap.labs.mlnx>
2021-12-21  8:02           ` Si-Wei Liu
     [not found] ` <20211213144258.179984-6-elic@nvidia.com>
2021-12-13 23:51   ` [PATCH v2 05/10] vdpa/mlx5: Fix config_attr_mask assignment Si-Wei Liu
     [not found] ` <20211213144258.179984-5-elic@nvidia.com>
2021-12-13 23:59   ` [PATCH v2 04/10] vdpa: Allow to configure max data virtqueues Si-Wei Liu
2021-12-14  3:17 ` [PATCH v2 00/10] Allow for configuring max number of virtqueue pairs Jason Wang
2021-12-14  4:11   ` Parav Pandit via Virtualization
2021-12-14  6:16     ` Jason Wang
2021-12-14  6:40       ` Parav Pandit via Virtualization
     [not found]   ` <20211214073141.GC89087@mtl-vdi-166.wap.labs.mlnx>
2021-12-14  8:53     ` Jason Wang
2021-12-14  9:42   ` Stefano Garzarella
     [not found]     ` <20211214095303.GA94217@mtl-vdi-166.wap.labs.mlnx>
2021-12-14 11:12       ` Stefano Garzarella
     [not found] ` <20211213144258.179984-2-elic@nvidia.com>
2021-12-14  3:37   ` [PATCH v2 01/10] vdpa: Provide interface to read driver features Jason Wang
     [not found] ` <20211213144258.179984-4-elic@nvidia.com>
2021-12-14  3:44   ` [PATCH v2 03/10] vdpa: Read device configuration only if FEATURES_OK Jason Wang
     [not found]     ` <20211214071411.GA89087@mtl-vdi-166.wap.labs.mlnx>
2021-12-14  8:53       ` Jason Wang
     [not found] ` <20211213144258.179984-8-elic@nvidia.com>
2021-12-13 23:49   ` [PATCH v2 07/10] vdpa: Add support for returning device configuration information Si-Wei Liu
2021-12-14  4:05   ` Jason Wang
     [not found]     ` <20211214071713.GB89087@mtl-vdi-166.wap.labs.mlnx>
2021-12-14  8:56       ` Jason Wang

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=70af2d6e-bd4b-27d5-f3d9-3f745e91b9fd@oracle.com \
    --to=si-wei.liu@oracle.com \
    --cc=elic@nvidia.com \
    --cc=eperezma@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.