netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH iproute2] vdpa: Add virtqueue pairs set capacity
@ 2022-03-24  9:19 08005325
  2022-04-06  3:45 ` Parav Pandit
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: 08005325 @ 2022-03-24  9:19 UTC (permalink / raw)
  To: netdev; +Cc: parav, stephen, Michael Qiu

From: Michael Qiu <qiudayu@archeros.com>

vdpa framework not only support query the max virtqueue pair, but
also for the set action.

This patch enable this capacity, and it is very useful for VMs
 who needs multiqueue support.

Signed-off-by: Michael Qiu <qiudayu@archeros.com>
---
 vdpa/vdpa.c | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/vdpa/vdpa.c b/vdpa/vdpa.c
index f048e47..434d68e 100644
--- a/vdpa/vdpa.c
+++ b/vdpa/vdpa.c
@@ -23,6 +23,7 @@
 #define VDPA_OPT_VDEV_HANDLE		BIT(3)
 #define VDPA_OPT_VDEV_MAC		BIT(4)
 #define VDPA_OPT_VDEV_MTU		BIT(5)
+#define VDPA_OPT_VDEV_QUEUE_PAIRS	BIT(6)
 
 struct vdpa_opts {
 	uint64_t present; /* flags of present items */
@@ -32,6 +33,7 @@ struct vdpa_opts {
 	unsigned int device_id;
 	char mac[ETH_ALEN];
 	uint16_t mtu;
+	uint16_t max_vq_pairs;
 };
 
 struct vdpa {
@@ -219,6 +221,8 @@ static void vdpa_opts_put(struct nlmsghdr *nlh, struct vdpa *vdpa)
 			     sizeof(opts->mac), opts->mac);
 	if (opts->present & VDPA_OPT_VDEV_MTU)
 		mnl_attr_put_u16(nlh, VDPA_ATTR_DEV_NET_CFG_MTU, opts->mtu);
+	if (opts->present & VDPA_OPT_VDEV_QUEUE_PAIRS)
+		mnl_attr_put_u16(nlh, VDPA_ATTR_DEV_NET_CFG_MAX_VQP, opts->max_vq_pairs);
 }
 
 static int vdpa_argv_parse(struct vdpa *vdpa, int argc, char **argv,
@@ -287,6 +291,15 @@ static int vdpa_argv_parse(struct vdpa *vdpa, int argc, char **argv,
 
 			NEXT_ARG_FWD();
 			o_found |= VDPA_OPT_VDEV_MTU;
+		} else if ((strcmp(*argv, "max_vq_pairs") == 0) &&
+			   (o_all & VDPA_OPT_VDEV_QUEUE_PAIRS)) {
+			NEXT_ARG_FWD();
+			err = vdpa_argv_u16(vdpa, argc, argv, &opts->max_vq_pairs);
+			if (err)
+				return err;
+
+			NEXT_ARG_FWD();
+			o_found |= VDPA_OPT_VDEV_QUEUE_PAIRS;
 		} else {
 			fprintf(stderr, "Unknown option \"%s\"\n", *argv);
 			return -EINVAL;
@@ -467,7 +480,7 @@ static int cmd_mgmtdev(struct vdpa *vdpa, int argc, char **argv)
 static void cmd_dev_help(void)
 {
 	fprintf(stderr, "Usage: vdpa dev show [ DEV ]\n");
-	fprintf(stderr, "       vdpa dev add name NAME mgmtdev MANAGEMENTDEV [ mac MACADDR ] [ mtu MTU ]\n");
+	fprintf(stderr, "       vdpa dev add name NAME mgmtdev MANAGEMENTDEV [ mac MACADDR ] [ mtu MTU ] [ max_vq_pairs N ]\n");
 	fprintf(stderr, "       vdpa dev del DEV\n");
 	fprintf(stderr, "Usage: vdpa dev config COMMAND [ OPTIONS ]\n");
 }
@@ -557,7 +570,7 @@ static int cmd_dev_add(struct vdpa *vdpa, int argc, char **argv)
 					  NLM_F_REQUEST | NLM_F_ACK);
 	err = vdpa_argv_parse_put(nlh, vdpa, argc, argv,
 				  VDPA_OPT_VDEV_MGMTDEV_HANDLE | VDPA_OPT_VDEV_NAME,
-				  VDPA_OPT_VDEV_MAC | VDPA_OPT_VDEV_MTU);
+				  VDPA_OPT_VDEV_MAC | VDPA_OPT_VDEV_MTU | VDPA_OPT_VDEV_QUEUE_PAIRS);
 	if (err)
 		return err;
 
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* RE: [PATCH iproute2] vdpa: Add virtqueue pairs set capacity
  2022-03-24  9:19 [PATCH iproute2] vdpa: Add virtqueue pairs set capacity 08005325
@ 2022-04-06  3:45 ` Parav Pandit
  2022-04-06  9:36 ` [PATCH iproute2 v2] " Michael Qiu
  2022-04-06 15:33 ` [PATCH iproute2] " Stephen Hemminger
  2 siblings, 0 replies; 6+ messages in thread
From: Parav Pandit @ 2022-04-06  3:45 UTC (permalink / raw)
  To: 08005325, netdev; +Cc: stephen, Michael Qiu


> From: 08005325@163.com <08005325@163.com>
> Sent: Thursday, March 24, 2022 5:19 AM
> 
> From: Michael Qiu <qiudayu@archeros.com>
>
Sorry for the late response.
Please see short comments below.
 
> vdpa framework not only support query the max virtqueue pair, but also for
> the set action.
> 
> This patch enable this capacity, and it is very useful for VMs  who needs
> multiqueue support.
>
A simpler rewrite as below.
This patch enables user to set max vq pairs for the net vdpa device during device addition time.
An example,

$ vdpa dev add ..  please give exact command that other users can copy.

 
> Signed-off-by: Michael Qiu <qiudayu@archeros.com>
> ---
>  vdpa/vdpa.c | 17 +++++++++++++++--
>  1 file changed, 15 insertions(+), 2 deletions(-)
> 
> diff --git a/vdpa/vdpa.c b/vdpa/vdpa.c
> index f048e47..434d68e 100644
> --- a/vdpa/vdpa.c
> +++ b/vdpa/vdpa.c
> @@ -23,6 +23,7 @@
>  #define VDPA_OPT_VDEV_HANDLE           BIT(3)
>  #define VDPA_OPT_VDEV_MAC              BIT(4)
>  #define VDPA_OPT_VDEV_MTU              BIT(5)
> +#define VDPA_OPT_VDEV_QUEUE_PAIRS      BIT(6)
> 
>  struct vdpa_opts {
>         uint64_t present; /* flags of present items */ @@ -32,6 +33,7 @@
> struct vdpa_opts {
>         unsigned int device_id;
>         char mac[ETH_ALEN];
>         uint16_t mtu;
> +       uint16_t max_vq_pairs;
>  };
> 
>  struct vdpa {
> @@ -219,6 +221,8 @@ static void vdpa_opts_put(struct nlmsghdr *nlh,
> struct vdpa *vdpa)
>                              sizeof(opts->mac), opts->mac);
>         if (opts->present & VDPA_OPT_VDEV_MTU)
>                 mnl_attr_put_u16(nlh, VDPA_ATTR_DEV_NET_CFG_MTU, opts-
> >mtu);
> +       if (opts->present & VDPA_OPT_VDEV_QUEUE_PAIRS)
> +               mnl_attr_put_u16(nlh, VDPA_ATTR_DEV_NET_CFG_MAX_VQP,
> + opts->max_vq_pairs);
>  }
> 
>  static int vdpa_argv_parse(struct vdpa *vdpa, int argc, char **argv, @@ -
> 287,6 +291,15 @@ static int vdpa_argv_parse(struct vdpa *vdpa, int argc,
> char **argv,
> 
>                         NEXT_ARG_FWD();
>                         o_found |= VDPA_OPT_VDEV_MTU;
> +               } else if ((strcmp(*argv, "max_vq_pairs") == 0) &&

Currently on query side this is printed as "max_vqp".
Please keep the same name on argument too to keep symmetry in get and set.

> +                          (o_all & VDPA_OPT_VDEV_QUEUE_PAIRS)) {
> +                       NEXT_ARG_FWD();
> +                       err = vdpa_argv_u16(vdpa, argc, argv, &opts->max_vq_pairs);
> +                       if (err)
> +                               return err;
> +
> +                       NEXT_ARG_FWD();
> +                       o_found |= VDPA_OPT_VDEV_QUEUE_PAIRS;
>                 } else {
>                         fprintf(stderr, "Unknown option \"%s\"\n", *argv);
>                         return -EINVAL;
> @@ -467,7 +480,7 @@ static int cmd_mgmtdev(struct vdpa *vdpa, int argc,
> char **argv)  static void cmd_dev_help(void)  {
>         fprintf(stderr, "Usage: vdpa dev show [ DEV ]\n");
> -       fprintf(stderr, "       vdpa dev add name NAME mgmtdev
> MANAGEMENTDEV [ mac MACADDR ] [ mtu MTU ]\n");
> +       fprintf(stderr, "       vdpa dev add name NAME mgmtdev
> MANAGEMENTDEV [ mac MACADDR ] [ mtu MTU ] [ max_vq_pairs N ]\n");
>         fprintf(stderr, "       vdpa dev del DEV\n");
>         fprintf(stderr, "Usage: vdpa dev config COMMAND [ OPTIONS ]\n");  }
> @@ -557,7 +570,7 @@ static int cmd_dev_add(struct vdpa *vdpa, int argc,
> char **argv)
>                                           NLM_F_REQUEST | NLM_F_ACK);
>         err = vdpa_argv_parse_put(nlh, vdpa, argc, argv,
>                                   VDPA_OPT_VDEV_MGMTDEV_HANDLE |
> VDPA_OPT_VDEV_NAME,
> -                                 VDPA_OPT_VDEV_MAC | VDPA_OPT_VDEV_MTU);
> +                                 VDPA_OPT_VDEV_MAC | VDPA_OPT_VDEV_MTU
> + | VDPA_OPT_VDEV_QUEUE_PAIRS);
>         if (err)
>                 return err;
> 
> --
> 1.8.3.1

Please also extend the man page for this addition with example in man/man8/vdpa-dev.8.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH iproute2 v2] vdpa: Add virtqueue pairs set capacity
  2022-03-24  9:19 [PATCH iproute2] vdpa: Add virtqueue pairs set capacity 08005325
  2022-04-06  3:45 ` Parav Pandit
@ 2022-04-06  9:36 ` Michael Qiu
  2022-04-06 15:39   ` Stephen Hemminger
  2022-04-06 20:56   ` Parav Pandit
  2022-04-06 15:33 ` [PATCH iproute2] " Stephen Hemminger
  2 siblings, 2 replies; 6+ messages in thread
From: Michael Qiu @ 2022-04-06  9:36 UTC (permalink / raw)
  To: parav, stephen; +Cc: netdev, Michael Qiu

vdpa framework not only support query the max virtqueue pair, but
also for the set action.

This patch enable this capacity, and it is very useful for VMs
 who needs multiqueue support.

After enable this feature, we could simply use below command to
create multi-queue support:

vdpa dev add mgmtdev pci/0000:03:10.3 name foo mac 56:d0:2f:03:c9:6d max_vqp 6

Signed-off-by: Michael Qiu <qiudayu@archeros.com>
---

v2 --> v1:
    rename "max_vq_pairs" to "max_vqp"

    extend the man page for this addition with example
---
 man/man8/vdpa-dev.8 |  9 +++++++++
 vdpa/vdpa.c         | 19 ++++++++++++++++---
 2 files changed, 25 insertions(+), 3 deletions(-)

diff --git a/man/man8/vdpa-dev.8 b/man/man8/vdpa-dev.8
index aa21ae3..a401115 100644
--- a/man/man8/vdpa-dev.8
+++ b/man/man8/vdpa-dev.8
@@ -74,6 +74,10 @@ This is applicable only for the network type of vdpa device. This is optional.
 - specifies the mtu for the new vdpa device.
 This is applicable only for the network type of vdpa device. This is optional.
 
+.BI max_vqp " MAX_VQP"
+- specifies the max queue pairs for the new vdpa device.
+This is applicable only for the network type of vdpa device. This is optional.
+
 .SS vdpa dev del - Delete the vdpa device.
 
 .PP
@@ -119,6 +123,11 @@ vdpa dev add name foo mgmtdev vdpa_sim_net mac 00:11:22:33:44:55 mtu 9000
 Add the vdpa device named foo on the management device vdpa_sim_net with mac address of 00:11:22:33:44:55 and mtu of 9000 bytes.
 .RE
 .PP
+vdpa dev add name foo mgmtdev vdpa_sim_net mac 00:11:22:33:44:55 mtu 9000 max_vqp 6
+.RS 4
+Add the vdpa device named foo on the management device vdpa_sim_net with mac address of 00:11:22:33:44:55, mtu of 9000 bytes and max virtqueue pairs of 6.
+.RE
+.PP
 vdpa dev del foo
 .RS 4
 Delete the vdpa device named foo which was previously created.
diff --git a/vdpa/vdpa.c b/vdpa/vdpa.c
index f048e47..104c503 100644
--- a/vdpa/vdpa.c
+++ b/vdpa/vdpa.c
@@ -23,6 +23,7 @@
 #define VDPA_OPT_VDEV_HANDLE		BIT(3)
 #define VDPA_OPT_VDEV_MAC		BIT(4)
 #define VDPA_OPT_VDEV_MTU		BIT(5)
+#define VDPA_OPT_VDEV_QUEUE_PAIRS	BIT(6)
 
 struct vdpa_opts {
 	uint64_t present; /* flags of present items */
@@ -32,6 +33,7 @@ struct vdpa_opts {
 	unsigned int device_id;
 	char mac[ETH_ALEN];
 	uint16_t mtu;
+	uint16_t max_vqp;
 };
 
 struct vdpa {
@@ -219,6 +221,8 @@ static void vdpa_opts_put(struct nlmsghdr *nlh, struct vdpa *vdpa)
 			     sizeof(opts->mac), opts->mac);
 	if (opts->present & VDPA_OPT_VDEV_MTU)
 		mnl_attr_put_u16(nlh, VDPA_ATTR_DEV_NET_CFG_MTU, opts->mtu);
+	if (opts->present & VDPA_OPT_VDEV_QUEUE_PAIRS)
+		mnl_attr_put_u16(nlh, VDPA_ATTR_DEV_NET_CFG_MAX_VQP, opts->max_vqp);
 }
 
 static int vdpa_argv_parse(struct vdpa *vdpa, int argc, char **argv,
@@ -287,6 +291,15 @@ static int vdpa_argv_parse(struct vdpa *vdpa, int argc, char **argv,
 
 			NEXT_ARG_FWD();
 			o_found |= VDPA_OPT_VDEV_MTU;
+		} else if ((strcmp(*argv, "max_vqp") == 0) &&
+			   (o_all & VDPA_OPT_VDEV_QUEUE_PAIRS)) {
+			NEXT_ARG_FWD();
+			err = vdpa_argv_u16(vdpa, argc, argv, &opts->max_vqp);
+			if (err)
+				return err;
+
+			NEXT_ARG_FWD();
+			o_found |= VDPA_OPT_VDEV_QUEUE_PAIRS;
 		} else {
 			fprintf(stderr, "Unknown option \"%s\"\n", *argv);
 			return -EINVAL;
@@ -467,7 +480,7 @@ static int cmd_mgmtdev(struct vdpa *vdpa, int argc, char **argv)
 static void cmd_dev_help(void)
 {
 	fprintf(stderr, "Usage: vdpa dev show [ DEV ]\n");
-	fprintf(stderr, "       vdpa dev add name NAME mgmtdev MANAGEMENTDEV [ mac MACADDR ] [ mtu MTU ]\n");
+	fprintf(stderr, "       vdpa dev add name NAME mgmtdev MANAGEMENTDEV [ mac MACADDR ] [ mtu MTU ] [ max_vqp N ]\n");
 	fprintf(stderr, "       vdpa dev del DEV\n");
 	fprintf(stderr, "Usage: vdpa dev config COMMAND [ OPTIONS ]\n");
 }
@@ -557,7 +570,7 @@ static int cmd_dev_add(struct vdpa *vdpa, int argc, char **argv)
 					  NLM_F_REQUEST | NLM_F_ACK);
 	err = vdpa_argv_parse_put(nlh, vdpa, argc, argv,
 				  VDPA_OPT_VDEV_MGMTDEV_HANDLE | VDPA_OPT_VDEV_NAME,
-				  VDPA_OPT_VDEV_MAC | VDPA_OPT_VDEV_MTU);
+				  VDPA_OPT_VDEV_MAC | VDPA_OPT_VDEV_MTU | VDPA_OPT_VDEV_QUEUE_PAIRS);
 	if (err)
 		return err;
 
@@ -603,7 +616,7 @@ static void pr_out_dev_net_config(struct nlattr **tb)
 	}
 	if (tb[VDPA_ATTR_DEV_NET_CFG_MAX_VQP]) {
 		val_u16 = mnl_attr_get_u16(tb[VDPA_ATTR_DEV_NET_CFG_MAX_VQP]);
-		print_uint(PRINT_ANY, "max_vq_pairs", "max_vq_pairs %d ",
+		print_uint(PRINT_ANY, "max_vqp", "max_vqp %d ",
 			     val_u16);
 	}
 	if (tb[VDPA_ATTR_DEV_NET_CFG_MTU]) {
-- 
1.8.3.1



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH iproute2] vdpa: Add virtqueue pairs set capacity
  2022-03-24  9:19 [PATCH iproute2] vdpa: Add virtqueue pairs set capacity 08005325
  2022-04-06  3:45 ` Parav Pandit
  2022-04-06  9:36 ` [PATCH iproute2 v2] " Michael Qiu
@ 2022-04-06 15:33 ` Stephen Hemminger
  2 siblings, 0 replies; 6+ messages in thread
From: Stephen Hemminger @ 2022-04-06 15:33 UTC (permalink / raw)
  To: 08005325; +Cc: netdev, parav, Michael Qiu

On Thu, 24 Mar 2022 05:19:13 -0400
08005325@163.com wrote:

> From: Michael Qiu <qiudayu@archeros.com>
> 
> vdpa framework not only support query the max virtqueue pair, but
> also for the set action.
> 
> This patch enable this capacity, and it is very useful for VMs
>  who needs multiqueue support.
> 
> Signed-off-by: Michael Qiu <qiudayu@archeros.com>

You need to add show logic to pr_out_dev_net_config

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH iproute2 v2] vdpa: Add virtqueue pairs set capacity
  2022-04-06  9:36 ` [PATCH iproute2 v2] " Michael Qiu
@ 2022-04-06 15:39   ` Stephen Hemminger
  2022-04-06 20:56   ` Parav Pandit
  1 sibling, 0 replies; 6+ messages in thread
From: Stephen Hemminger @ 2022-04-06 15:39 UTC (permalink / raw)
  To: Michael Qiu; +Cc: parav, netdev

On Wed,  6 Apr 2022 05:36:31 -0400
Michael Qiu <qiudayu@archeros.com> wrote:

> 	if (tb[VDPA_ATTR_DEV_NET_CFG_MAX_VQP]) {
>  		val_u16 = mnl_attr_get_u16(tb[VDPA_ATTR_DEV_NET_CFG_MAX_VQP]);
> -		print_uint(PRINT_ANY, "max_vq_pairs", "max_vq_pairs %d ",
> +		print_uint(PRINT_ANY, "max_vqp", "max_vqp %d ",
>  			     val_u16);

Good, the print should match the set parameters.

Wanted to apply but can not go against main branch, is the targeted for next

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: [PATCH iproute2 v2] vdpa: Add virtqueue pairs set capacity
  2022-04-06  9:36 ` [PATCH iproute2 v2] " Michael Qiu
  2022-04-06 15:39   ` Stephen Hemminger
@ 2022-04-06 20:56   ` Parav Pandit
  1 sibling, 0 replies; 6+ messages in thread
From: Parav Pandit @ 2022-04-06 20:56 UTC (permalink / raw)
  To: Michael Qiu, stephen; +Cc: netdev

Hi Michael,

> From: Michael Qiu <qiudayu@archeros.com>
> Sent: Wednesday, April 6, 2022 5:37 AM
> To: Parav Pandit <parav@nvidia.com>; stephen@networkplumber.org
> Cc: netdev@vger.kernel.org; Michael Qiu <qiudayu@archeros.com>
> Subject: [PATCH iproute2 v2] vdpa: Add virtqueue pairs set capacity
> 
> vdpa framework not only support query the max virtqueue pair, but also for
> the set action.
> 
> This patch enable this capacity, and it is very useful for VMs  who needs
> multiqueue support.
> 
> After enable this feature, we could simply use below command to create
> multi-queue support:
> 
> vdpa dev add mgmtdev pci/0000:03:10.3 name foo mac 56:d0:2f:03:c9:6d
> max_vqp 6
> 
> Signed-off-by: Michael Qiu <qiudayu@archeros.com>
> ---
> 
> v2 --> v1:
>     rename "max_vq_pairs" to "max_vqp"
> 
>     extend the man page for this addition with example
> ---
>  man/man8/vdpa-dev.8 |  9 +++++++++
>  vdpa/vdpa.c         | 19 ++++++++++++++++---
>  2 files changed, 25 insertions(+), 3 deletions(-)
> 
> diff --git a/man/man8/vdpa-dev.8 b/man/man8/vdpa-dev.8 index
> aa21ae3..a401115 100644
> --- a/man/man8/vdpa-dev.8
> +++ b/man/man8/vdpa-dev.8
> @@ -74,6 +74,10 @@ This is applicable only for the network type of vdpa
> device. This is optional.
>  - specifies the mtu for the new vdpa device.
>  This is applicable only for the network type of vdpa device. This is optional.
> 
> +.BI max_vqp " MAX_VQP"
> +- specifies the max queue pairs for the new vdpa device.
> +This is applicable only for the network type of vdpa device. This is optional.
> +
>  .SS vdpa dev del - Delete the vdpa device.
> 
>  .PP
> @@ -119,6 +123,11 @@ vdpa dev add name foo mgmtdev vdpa_sim_net
> mac 00:11:22:33:44:55 mtu 9000  Add the vdpa device named foo on the
> management device vdpa_sim_net with mac address of 00:11:22:33:44:55
> and mtu of 9000 bytes.
>  .RE
>  .PP
> +vdpa dev add name foo mgmtdev vdpa_sim_net mac 00:11:22:33:44:55 mtu
> +9000 max_vqp 6 .RS 4 Add the vdpa device named foo on the management
> +device vdpa_sim_net with mac address of 00:11:22:33:44:55, mtu of 9000
> bytes and max virtqueue pairs of 6.
> +.RE
> +.PP
>  vdpa dev del foo
>  .RS 4
>  Delete the vdpa device named foo which was previously created.
> diff --git a/vdpa/vdpa.c b/vdpa/vdpa.c
> index f048e47..104c503 100644
> --- a/vdpa/vdpa.c
> +++ b/vdpa/vdpa.c
> @@ -23,6 +23,7 @@
>  #define VDPA_OPT_VDEV_HANDLE		BIT(3)
>  #define VDPA_OPT_VDEV_MAC		BIT(4)
>  #define VDPA_OPT_VDEV_MTU		BIT(5)
> +#define VDPA_OPT_VDEV_QUEUE_PAIRS	BIT(6)
> 
>  struct vdpa_opts {
>  	uint64_t present; /* flags of present items */ @@ -32,6 +33,7 @@
> struct vdpa_opts {
>  	unsigned int device_id;
>  	char mac[ETH_ALEN];
>  	uint16_t mtu;
> +	uint16_t max_vqp;
>  };
> 
>  struct vdpa {
> @@ -219,6 +221,8 @@ static void vdpa_opts_put(struct nlmsghdr *nlh,
> struct vdpa *vdpa)
>  			     sizeof(opts->mac), opts->mac);
>  	if (opts->present & VDPA_OPT_VDEV_MTU)
>  		mnl_attr_put_u16(nlh, VDPA_ATTR_DEV_NET_CFG_MTU,
> opts->mtu);
> +	if (opts->present & VDPA_OPT_VDEV_QUEUE_PAIRS)
> +		mnl_attr_put_u16(nlh,
> VDPA_ATTR_DEV_NET_CFG_MAX_VQP, opts->max_vqp);
>  }
> 
>  static int vdpa_argv_parse(struct vdpa *vdpa, int argc, char **argv, @@ -
> 287,6 +291,15 @@ static int vdpa_argv_parse(struct vdpa *vdpa, int argc,
> char **argv,
> 
>  			NEXT_ARG_FWD();
>  			o_found |= VDPA_OPT_VDEV_MTU;
> +		} else if ((strcmp(*argv, "max_vqp") == 0) &&
> +			   (o_all & VDPA_OPT_VDEV_QUEUE_PAIRS)) {
> +			NEXT_ARG_FWD();
> +			err = vdpa_argv_u16(vdpa, argc, argv, &opts-
> >max_vqp);
> +			if (err)
> +				return err;
> +
> +			NEXT_ARG_FWD();
> +			o_found |= VDPA_OPT_VDEV_QUEUE_PAIRS;
>  		} else {
>  			fprintf(stderr, "Unknown option \"%s\"\n", *argv);
>  			return -EINVAL;
> @@ -467,7 +480,7 @@ static int cmd_mgmtdev(struct vdpa *vdpa, int argc,
> char **argv)  static void cmd_dev_help(void)  {
>  	fprintf(stderr, "Usage: vdpa dev show [ DEV ]\n");
> -	fprintf(stderr, "       vdpa dev add name NAME mgmtdev
> MANAGEMENTDEV [ mac MACADDR ] [ mtu MTU ]\n");
> +	fprintf(stderr, "       vdpa dev add name NAME mgmtdev
> MANAGEMENTDEV [ mac MACADDR ] [ mtu MTU ] [ max_vqp N ]\n");
>  	fprintf(stderr, "       vdpa dev del DEV\n");
>  	fprintf(stderr, "Usage: vdpa dev config COMMAND [ OPTIONS ]\n");
> } @@ -557,7 +570,7 @@ static int cmd_dev_add(struct vdpa *vdpa, int argc,
> char **argv)
>  					  NLM_F_REQUEST | NLM_F_ACK);
>  	err = vdpa_argv_parse_put(nlh, vdpa, argc, argv,
>  				  VDPA_OPT_VDEV_MGMTDEV_HANDLE |
> VDPA_OPT_VDEV_NAME,
> -				  VDPA_OPT_VDEV_MAC |
> VDPA_OPT_VDEV_MTU);
> +				  VDPA_OPT_VDEV_MAC |
> VDPA_OPT_VDEV_MTU |
> +VDPA_OPT_VDEV_QUEUE_PAIRS);
>  	if (err)
>  		return err;
> 
> @@ -603,7 +616,7 @@ static void pr_out_dev_net_config(struct nlattr **tb)
>  	}
>  	if (tb[VDPA_ATTR_DEV_NET_CFG_MAX_VQP]) {
>  		val_u16 =
> mnl_attr_get_u16(tb[VDPA_ATTR_DEV_NET_CFG_MAX_VQP]);
> -		print_uint(PRINT_ANY, "max_vq_pairs", "max_vq_pairs %d
> ",
> +		print_uint(PRINT_ANY, "max_vqp", "max_vqp %d ",
>  			     val_u16);
>  	}
>  	if (tb[VDPA_ATTR_DEV_NET_CFG_MTU]) {
> --
> 1.8.3.1
> 

You are probably not using right iproute2 tree.

I already see existing code from Eli in commit [1] that supports setting this field.

The iproute2 tree to use for upstream work is [2].

[1] commit 16482fd4d ("vdpa: Support for configuring max VQ pairs for a device")
[2] git://git.kernel.org/pub/scm/network/iproute2/iproute2.git

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-04-06 21:38 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-24  9:19 [PATCH iproute2] vdpa: Add virtqueue pairs set capacity 08005325
2022-04-06  3:45 ` Parav Pandit
2022-04-06  9:36 ` [PATCH iproute2 v2] " Michael Qiu
2022-04-06 15:39   ` Stephen Hemminger
2022-04-06 20:56   ` Parav Pandit
2022-04-06 15:33 ` [PATCH iproute2] " Stephen Hemminger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).