All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH 0/3] configurable max queue number per VF
@ 2017-07-31 19:27 Wenzhuo Lu
  2017-07-31 19:27 ` [RFC PATCH 1/3] librte_ether: VF max queue number setting Wenzhuo Lu
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Wenzhuo Lu @ 2017-07-31 19:27 UTC (permalink / raw)
  To: dev; +Cc: Wenzhuo Lu

Currently, on i40e, the max queue number per VF is set by a macro.
It means the value is decided when compiling. It's not friendly to
the users. Because every time the users want to change the value,
the code need to be re-compiled.

The reason of using a macro for the max queue number is that the
number is needed at the very early stage. At this stage, we haven't
got the device configuration yet.
There's a simple idea to replace the macro by a global varialbe.
Then the users can set the value without compiling the code again
and again.

This patch set implements this idea and is an example to show how
to use it.

Wenzhuo Lu (3):
  librte_ether: VF max queue number setting
  net/i40e: max VF queue number setting
  app/testpmd: a parameter to set max queue per VF

 app/test-pmd/parameters.c      | 33 ++++++++++++++++++++++++++++++++-
 app/test-pmd/testpmd.c         |  2 ++
 app/test-pmd/testpmd.h         |  1 +
 config/common_base             |  1 -
 drivers/net/i40e/i40e_ethdev.c |  4 ++--
 lib/librte_ether/rte_ethdev.c  |  3 +++
 lib/librte_ether/rte_ethdev.h  |  2 ++
 7 files changed, 42 insertions(+), 4 deletions(-)

-- 
1.9.3

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

* [RFC PATCH 1/3] librte_ether: VF max queue number setting
  2017-07-31 19:27 [RFC PATCH 0/3] configurable max queue number per VF Wenzhuo Lu
@ 2017-07-31 19:27 ` Wenzhuo Lu
  2017-07-31 19:27 ` [RFC PATCH 2/3] net/i40e: max VF " Wenzhuo Lu
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Wenzhuo Lu @ 2017-07-31 19:27 UTC (permalink / raw)
  To: dev; +Cc: Wenzhuo Lu

Add a global variable to set the max queue number per VF.
This variable is only valid on PF.

Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
---
 lib/librte_ether/rte_ethdev.c | 3 +++
 lib/librte_ether/rte_ethdev.h | 2 ++
 2 files changed, 5 insertions(+)

diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index d4ebb1b..9d3e650 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -138,6 +138,9 @@ enum {
 	STAT_QMAP_RX
 };
 
+/**< Max queue number per VF, only valid on PF port. */
+uint32_t g_max_queue_number_per_vf = 4;
+
 uint8_t
 rte_eth_find_next(uint8_t port_id)
 {
diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
index 0e99090..1c3f668 100644
--- a/lib/librte_ether/rte_ethdev.h
+++ b/lib/librte_ether/rte_ethdev.h
@@ -1091,6 +1091,8 @@ struct rte_eth_dcb_info {
 /**< l2 tunnel forwarding mask */
 #define ETH_L2_TUNNEL_FORWARDING_MASK   0x00000008
 
+extern uint32_t g_max_queue_number_per_vf;
+
 /*
  * Definitions of all functions exported by an Ethernet driver through the
  * the generic structure of type *eth_dev_ops* supplied in the *rte_eth_dev*
-- 
1.9.3

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

* [RFC PATCH 2/3] net/i40e: max VF queue number setting
  2017-07-31 19:27 [RFC PATCH 0/3] configurable max queue number per VF Wenzhuo Lu
  2017-07-31 19:27 ` [RFC PATCH 1/3] librte_ether: VF max queue number setting Wenzhuo Lu
@ 2017-07-31 19:27 ` Wenzhuo Lu
  2017-07-31 19:27 ` [RFC PATCH 3/3] app/testpmd: a parameter to set max queue per VF Wenzhuo Lu
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Wenzhuo Lu @ 2017-07-31 19:27 UTC (permalink / raw)
  To: dev; +Cc: Wenzhuo Lu

Remove the compile macro for max queue number per
VF. Use the global variable to set the number.

Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
---
 config/common_base             | 1 -
 drivers/net/i40e/i40e_ethdev.c | 4 ++--
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/config/common_base b/config/common_base
index 7805605..f361cb8 100644
--- a/config/common_base
+++ b/config/common_base
@@ -191,7 +191,6 @@ CONFIG_RTE_LIBRTE_I40E_RX_ALLOW_BULK_ALLOC=y
 CONFIG_RTE_LIBRTE_I40E_INC_VECTOR=y
 CONFIG_RTE_LIBRTE_I40E_16BYTE_RX_DESC=n
 CONFIG_RTE_LIBRTE_I40E_QUEUE_NUM_PER_PF=64
-CONFIG_RTE_LIBRTE_I40E_QUEUE_NUM_PER_VF=4
 CONFIG_RTE_LIBRTE_I40E_QUEUE_NUM_PER_VM=4
 # interval up to 8160 us, aligned to 2 (or default value)
 CONFIG_RTE_LIBRTE_I40E_ITR_INTERVAL=-1
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 9fcccda..6d724d8 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -3881,7 +3881,7 @@ enum i40e_status_code
 	pf->max_num_vsi = hw->func_caps.num_vsis;
 	pf->lan_nb_qp_max = RTE_LIBRTE_I40E_QUEUE_NUM_PER_PF;
 	pf->vmdq_nb_qp_max = RTE_LIBRTE_I40E_QUEUE_NUM_PER_VM;
-	pf->vf_nb_qp_max = RTE_LIBRTE_I40E_QUEUE_NUM_PER_VF;
+	pf->vf_nb_qp_max = g_max_queue_number_per_vf;
 
 	/* FDir queue/VSI allocation */
 	pf->fdir_qp_offset = 0;
@@ -3911,7 +3911,7 @@ enum i40e_status_code
 	pf->vf_qp_offset = pf->lan_qp_offset + pf->lan_nb_qps;
 	if (hw->func_caps.sr_iov_1_1 && pci_dev->max_vfs) {
 		pf->flags |= I40E_FLAG_SRIOV;
-		pf->vf_nb_qps = RTE_LIBRTE_I40E_QUEUE_NUM_PER_VF;
+		pf->vf_nb_qps = g_max_queue_number_per_vf;
 		pf->vf_num = pci_dev->max_vfs;
 		PMD_DRV_LOG(DEBUG,
 			"%u VF VSIs, %u queues per VF VSI, in total %u queues",
-- 
1.9.3

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

* [RFC PATCH 3/3] app/testpmd: a parameter to set max queue per VF
  2017-07-31 19:27 [RFC PATCH 0/3] configurable max queue number per VF Wenzhuo Lu
  2017-07-31 19:27 ` [RFC PATCH 1/3] librte_ether: VF max queue number setting Wenzhuo Lu
  2017-07-31 19:27 ` [RFC PATCH 2/3] net/i40e: max VF " Wenzhuo Lu
@ 2017-07-31 19:27 ` Wenzhuo Lu
  2017-12-15 19:24 ` [RFC PATCH 0/3] configurable max queue number " Ferruh Yigit
  2017-12-22  2:26 ` Ferruh Yigit
  4 siblings, 0 replies; 6+ messages in thread
From: Wenzhuo Lu @ 2017-07-31 19:27 UTC (permalink / raw)
  To: dev; +Cc: Wenzhuo Lu

Add a parameter in testpmd CLI. This parameter is used
to set the max queue number per VF.

Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
---
 app/test-pmd/parameters.c | 33 ++++++++++++++++++++++++++++++++-
 app/test-pmd/testpmd.c    |  2 ++
 app/test-pmd/testpmd.h    |  1 +
 3 files changed, 35 insertions(+), 1 deletion(-)

diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c
index 2f7f70f..2dd806d 100644
--- a/app/test-pmd/parameters.c
+++ b/app/test-pmd/parameters.c
@@ -100,7 +100,7 @@
 	       "--rss-ip | --rss-udp | "
 	       "--rxpt= | --rxht= | --rxwt= | --rxfreet= | "
 	       "--txpt= | --txht= | --txwt= | --txfreet= | "
-	       "--txrst= | --txqflags= ]\n",
+	       "--txrst= | --txqflags= | --vf-max-queue= ]\n",
 	       progname);
 #ifdef RTE_LIBRTE_CMDLINE
 	printf("  --interactive: run in interactive mode.\n");
@@ -216,6 +216,8 @@
 	       "disable print of designated event or all of them.\n");
 	printf("  --flow-isolate-all: "
 	       "requests flow API isolated mode on all ports at initialization time.\n");
+	printf("  --vf-max-queue=N: set the maximum queue number per VF "
+	       "(N: positive integer).\n");
 }
 
 #ifdef RTE_LIBRTE_CMDLINE
@@ -638,6 +640,7 @@
 		{ "no-rmv-interrupt",		0, 0, 0 },
 		{ "print-event",		1, 0, 0 },
 		{ "mask-event",			1, 0, 0 },
+		{ "vf-max-queue",		1, 0, 0 },
 		{ 0, 0, 0, 0 },
 	};
 
@@ -1133,3 +1136,31 @@
 		}
 	}
 }
+
+void
+pre_launch_args_parse(int argc, char **argv)
+{
+	int i;
+	char *tmp;
+	int nb_queue = 0;
+
+	/**
+	 * Don't want to check the first string.
+	 * It should not be a parameter.
+	 */
+	for (i = 1; i < argc; i++) {
+		tmp = *(argv + i);
+		if (!strncmp(tmp, "--vf-max-queue=", 15)) {
+			tmp += 15;
+			nb_queue = atoi(tmp);
+			if (nb_queue > 0)
+				g_max_queue_number_per_vf = nb_queue;
+			else
+				rte_exit(EXIT_FAILURE,
+					 "vf-max-queue must be > 0\n");
+
+			/* delete it if more than 1 patameters to check */
+			break;
+		}
+	}
+}
diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index e754d12..b374f38 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -2289,6 +2289,8 @@ uint8_t port_is_bonding_slave(portid_t slave_pid)
 	signal(SIGINT, signal_handler);
 	signal(SIGTERM, signal_handler);
 
+	pre_launch_args_parse(argc, argv);
+
 	diag = rte_eal_init(argc, argv);
 	if (diag < 0)
 		rte_panic("Cannot init EAL\n");
diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
index c9d7739..8d0e72b 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -650,6 +650,7 @@ void port_rss_hash_key_update(portid_t port_id, char rss_type[],
 uint8_t *open_ddp_package_file(const char *file_path, uint32_t *size);
 int save_ddp_package_file(const char *file_path, uint8_t *buf, uint32_t size);
 int close_ddp_package_file(uint8_t *buf);
+void pre_launch_args_parse(int argc, char **argv);
 
 enum print_warning {
 	ENABLED_WARN = 0,
-- 
1.9.3

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

* Re: [RFC PATCH 0/3] configurable max queue number per VF
  2017-07-31 19:27 [RFC PATCH 0/3] configurable max queue number per VF Wenzhuo Lu
                   ` (2 preceding siblings ...)
  2017-07-31 19:27 ` [RFC PATCH 3/3] app/testpmd: a parameter to set max queue per VF Wenzhuo Lu
@ 2017-12-15 19:24 ` Ferruh Yigit
  2017-12-22  2:26 ` Ferruh Yigit
  4 siblings, 0 replies; 6+ messages in thread
From: Ferruh Yigit @ 2017-12-15 19:24 UTC (permalink / raw)
  To: Wenzhuo Lu, dev

On 7/31/2017 12:27 PM, Wenzhuo Lu wrote:
> Currently, on i40e, the max queue number per VF is set by a macro.
> It means the value is decided when compiling. It's not friendly to
> the users. Because every time the users want to change the value,
> the code need to be re-compiled.
> 
> The reason of using a macro for the max queue number is that the
> number is needed at the very early stage. At this stage, we haven't
> got the device configuration yet.
> There's a simple idea to replace the macro by a global varialbe.
> Then the users can set the value without compiling the code again
> and again.

Hi Wenzhuo,

It is good to convert compile time options to something more dynamic, but I am
not sure adding max_queue_number_per_vf global variable into ethdev lib. Also
currently only i40e requires this but what if some other PMD requires this and
conflicts with the values i40e requires? Application directly setting library
global value is another concern.

Problem looks like setting library defaults problem. Currently we are setting
defaults via config options and changing them requires re-compiling the library,
which indeed not should be required.

This will be more ambitious but what about addressing problem in DPDK level so
that we can move many config options.

What about creating a global rte_default object and put all defaults from config
file there, and other libraries access to this object to learn about default
values. rte_config or lcore_config are already global config objects, and
lcore_config seems already exposed to the applications, similar thing can be
done here.
Provide APIs to set / values in this object so that application dynamically set
them before eal_init() _if_ they need to change something, but mostly defaults
should be good to run apps without needs to modify them for majority of cases.

Later this can be worked out to distribute defaults to own library, so that each
library can hold their own default values.

Any comments?

> 
> This patch set implements this idea and is an example to show how
> to use it.
> 
> Wenzhuo Lu (3):
>   librte_ether: VF max queue number setting
>   net/i40e: max VF queue number setting
>   app/testpmd: a parameter to set max queue per VF
> 
>  app/test-pmd/parameters.c      | 33 ++++++++++++++++++++++++++++++++-
>  app/test-pmd/testpmd.c         |  2 ++
>  app/test-pmd/testpmd.h         |  1 +
>  config/common_base             |  1 -
>  drivers/net/i40e/i40e_ethdev.c |  4 ++--
>  lib/librte_ether/rte_ethdev.c  |  3 +++
>  lib/librte_ether/rte_ethdev.h  |  2 ++
>  7 files changed, 42 insertions(+), 4 deletions(-)
> 

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

* Re: [RFC PATCH 0/3] configurable max queue number per VF
  2017-07-31 19:27 [RFC PATCH 0/3] configurable max queue number per VF Wenzhuo Lu
                   ` (3 preceding siblings ...)
  2017-12-15 19:24 ` [RFC PATCH 0/3] configurable max queue number " Ferruh Yigit
@ 2017-12-22  2:26 ` Ferruh Yigit
  4 siblings, 0 replies; 6+ messages in thread
From: Ferruh Yigit @ 2017-12-22  2:26 UTC (permalink / raw)
  To: Wenzhuo Lu, dev

On 7/31/2017 12:27 PM, Wenzhuo Lu wrote:
> Currently, on i40e, the max queue number per VF is set by a macro.
> It means the value is decided when compiling. It's not friendly to
> the users. Because every time the users want to change the value,
> the code need to be re-compiled.
> 
> The reason of using a macro for the max queue number is that the
> number is needed at the very early stage. At this stage, we haven't
> got the device configuration yet.
> There's a simple idea to replace the macro by a global varialbe.
> Then the users can set the value without compiling the code again
> and again.
> 
> This patch set implements this idea and is an example to show how
> to use it.
> 
> Wenzhuo Lu (3):
>   librte_ether: VF max queue number setting
>   net/i40e: max VF queue number setting
>   app/testpmd: a parameter to set max queue per VF

RFC seems superseded by https://dpdk.org/dev/patchwork/patch/31996/, updating
status of set as superseded.

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

end of thread, other threads:[~2017-12-22  2:26 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-07-31 19:27 [RFC PATCH 0/3] configurable max queue number per VF Wenzhuo Lu
2017-07-31 19:27 ` [RFC PATCH 1/3] librte_ether: VF max queue number setting Wenzhuo Lu
2017-07-31 19:27 ` [RFC PATCH 2/3] net/i40e: max VF " Wenzhuo Lu
2017-07-31 19:27 ` [RFC PATCH 3/3] app/testpmd: a parameter to set max queue per VF Wenzhuo Lu
2017-12-15 19:24 ` [RFC PATCH 0/3] configurable max queue number " Ferruh Yigit
2017-12-22  2:26 ` Ferruh Yigit

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.