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>,
	mst@redhat.com, jasowang@redhat.com,
	virtualization@lists.linux-foundation.org
Cc: lvivier@redhat.com, eperezma@redhat.com
Subject: Re: [PATCH 1/2] vdpa: Allow to configure max data virtqueues
Date: Tue, 30 Nov 2021 17:24:03 -0800	[thread overview]
Message-ID: <ab454062-da69-a72e-1953-716257bb464c@oracle.com> (raw)
In-Reply-To: <20211130094838.15489-2-elic@nvidia.com>



On 11/30/2021 1:48 AM, Eli Cohen wrote:
> Allow to configure the max virtqueues for a device.
>
> Signed-off-by: Eli Cohen <elic@nvidia.com>
> ---
>   drivers/vdpa/vdpa.c  | 16 +++++++++++++++-
>   include/linux/vdpa.h |  1 +
>   2 files changed, 16 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/vdpa/vdpa.c b/drivers/vdpa/vdpa.c
> index 7332a74a4b00..e185ec2ee851 100644
> --- a/drivers/vdpa/vdpa.c
> +++ b/drivers/vdpa/vdpa.c
> @@ -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).

>   
>   static 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 *i
>   			nla_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) {
> +			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

> +			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
> diff --git a/include/linux/vdpa.h b/include/linux/vdpa.h
> index c3011ccda430..2f0b09c6d1ae 100644
> --- a/include/linux/vdpa.h
> +++ b/include/linux/vdpa.h
> @@ -101,6 +101,7 @@ struct vdpa_dev_set_config {
>   		u16 mtu;
>   	} net;
>   	u64 mask;
> +	u16 max_virtqueues;
>   };
>   
>   /**

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

       reply	other threads:[~2021-12-01  1:24 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20211130094838.15489-1-elic@nvidia.com>
     [not found] ` <20211130094838.15489-2-elic@nvidia.com>
2021-12-01  1:24   ` Si-Wei Liu [this message]
     [not found]     ` <20211201100307.GA239524@mtl-vdi-166.wap.labs.mlnx>
2021-12-01 10:09       ` [PATCH 1/2] vdpa: Allow to configure max data virtqueues Parav Pandit via Virtualization
     [not found]         ` <20211201115838.GA3465@mtl-vdi-166.wap.labs.mlnx>
2021-12-01 12:28           ` Parav Pandit via Virtualization
2021-12-02  3:40         ` Jason Wang
2021-12-02  3:42           ` Parav Pandit via Virtualization
2021-12-01 19:40       ` Si-Wei Liu
2021-12-01 19:46       ` Si-Wei Liu
     [not found] ` <20211130094838.15489-3-elic@nvidia.com>
2021-12-01  1:43   ` [PATCH 2/2] vdpa/mlx5: Support configuring " Si-Wei Liu

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=ab454062-da69-a72e-1953-716257bb464c@oracle.com \
    --to=si-wei.liu@oracle.com \
    --cc=elic@nvidia.com \
    --cc=eperezma@redhat.com \
    --cc=jasowang@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.