DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] examples/multi_process/symmetric_mp: fix link check
@ 2019-03-27 11:22 Akhil Goyal
  2019-03-27 11:22 ` Akhil Goyal
  2019-03-27 11:33 ` [dpdk-dev] [PATCH v2] " Akhil Goyal
  0 siblings, 2 replies; 8+ messages in thread
From: Akhil Goyal @ 2019-03-27 11:22 UTC (permalink / raw)
  To: dev; +Cc: anatoly.burakov, thomas, Akhil Goyal, stable

link check is done for primary process for the ports
which are given in the port mask and not the complete
set of ports.

Fixes: d3641ae86313 ("examples: update link status checks")
Cc: stable@dpdk.org

Signed-off-by: Akhil Goyal <akhil.goyal@nxp.com>
---
 examples/multi_process/symmetric_mp/main.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/examples/multi_process/symmetric_mp/main.c b/examples/multi_process/symmetric_mp/main.c
index c310e942b..ed407ab2c 100644
--- a/examples/multi_process/symmetric_mp/main.c
+++ b/examples/multi_process/symmetric_mp/main.c
@@ -73,6 +73,7 @@ static unsigned num_procs = 0;
 
 static uint16_t ports[RTE_MAX_ETHPORTS];
 static unsigned num_ports = 0;
+static unsigned port_mask = 0;
 
 static struct lcore_ports lcore_ports[RTE_MAX_LCORE];
 static struct port_stats pstats[RTE_MAX_ETHPORTS];
@@ -115,7 +116,7 @@ smp_parse_args(int argc, char **argv)
 	int opt, ret;
 	char **argvopt;
 	int option_index;
-	uint16_t i, port_mask = 0;
+	uint16_t i;
 	char *prgname = argv[0];
 	static struct option lgopts[] = {
 			{PARAM_NUM_PROCS, 1, 0, 0},
@@ -349,7 +350,7 @@ lcore_main(void *arg __rte_unused)
 
 /* Check the link status of all ports in up to 9s, and print them finally */
 static void
-check_all_ports_link_status(uint16_t port_num, uint32_t port_mask)
+check_all_ports_link_status(uint16_t port_num, uint32_t mask)
 {
 #define CHECK_INTERVAL 100 /* 100ms */
 #define MAX_CHECK_TIME 90 /* 9s (90 * 100ms) in total */
@@ -362,7 +363,7 @@ check_all_ports_link_status(uint16_t port_num, uint32_t port_mask)
 	for (count = 0; count <= MAX_CHECK_TIME; count++) {
 		all_ports_up = 1;
 		for (portid = 0; portid < port_num; portid++) {
-			if ((port_mask & (1 << portid)) == 0)
+			if ((mask & (1 << portid)) == 0)
 				continue;
 			memset(&link, 0, sizeof(link));
 			rte_eth_link_get_nowait(portid, &link);
@@ -451,7 +452,7 @@ main(int argc, char **argv)
 	}
 
 	if (proc_type == RTE_PROC_PRIMARY)
-		check_all_ports_link_status((uint8_t)num_ports, (~0x0));
+		check_all_ports_link_status(rte_eth_dev_count(), port_mask);
 
 	assign_ports_to_cores();
 
-- 
2.17.1

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

* [dpdk-dev] [PATCH] examples/multi_process/symmetric_mp: fix link check
  2019-03-27 11:22 [dpdk-dev] [PATCH] examples/multi_process/symmetric_mp: fix link check Akhil Goyal
@ 2019-03-27 11:22 ` Akhil Goyal
  2019-03-27 11:33 ` [dpdk-dev] [PATCH v2] " Akhil Goyal
  1 sibling, 0 replies; 8+ messages in thread
From: Akhil Goyal @ 2019-03-27 11:22 UTC (permalink / raw)
  To: dev; +Cc: anatoly.burakov, thomas, Akhil Goyal, stable

link check is done for primary process for the ports
which are given in the port mask and not the complete
set of ports.

Fixes: d3641ae86313 ("examples: update link status checks")
Cc: stable@dpdk.org

Signed-off-by: Akhil Goyal <akhil.goyal@nxp.com>
---
 examples/multi_process/symmetric_mp/main.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/examples/multi_process/symmetric_mp/main.c b/examples/multi_process/symmetric_mp/main.c
index c310e942b..ed407ab2c 100644
--- a/examples/multi_process/symmetric_mp/main.c
+++ b/examples/multi_process/symmetric_mp/main.c
@@ -73,6 +73,7 @@ static unsigned num_procs = 0;
 
 static uint16_t ports[RTE_MAX_ETHPORTS];
 static unsigned num_ports = 0;
+static unsigned port_mask = 0;
 
 static struct lcore_ports lcore_ports[RTE_MAX_LCORE];
 static struct port_stats pstats[RTE_MAX_ETHPORTS];
@@ -115,7 +116,7 @@ smp_parse_args(int argc, char **argv)
 	int opt, ret;
 	char **argvopt;
 	int option_index;
-	uint16_t i, port_mask = 0;
+	uint16_t i;
 	char *prgname = argv[0];
 	static struct option lgopts[] = {
 			{PARAM_NUM_PROCS, 1, 0, 0},
@@ -349,7 +350,7 @@ lcore_main(void *arg __rte_unused)
 
 /* Check the link status of all ports in up to 9s, and print them finally */
 static void
-check_all_ports_link_status(uint16_t port_num, uint32_t port_mask)
+check_all_ports_link_status(uint16_t port_num, uint32_t mask)
 {
 #define CHECK_INTERVAL 100 /* 100ms */
 #define MAX_CHECK_TIME 90 /* 9s (90 * 100ms) in total */
@@ -362,7 +363,7 @@ check_all_ports_link_status(uint16_t port_num, uint32_t port_mask)
 	for (count = 0; count <= MAX_CHECK_TIME; count++) {
 		all_ports_up = 1;
 		for (portid = 0; portid < port_num; portid++) {
-			if ((port_mask & (1 << portid)) == 0)
+			if ((mask & (1 << portid)) == 0)
 				continue;
 			memset(&link, 0, sizeof(link));
 			rte_eth_link_get_nowait(portid, &link);
@@ -451,7 +452,7 @@ main(int argc, char **argv)
 	}
 
 	if (proc_type == RTE_PROC_PRIMARY)
-		check_all_ports_link_status((uint8_t)num_ports, (~0x0));
+		check_all_ports_link_status(rte_eth_dev_count(), port_mask);
 
 	assign_ports_to_cores();
 
-- 
2.17.1


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

* [dpdk-dev] [PATCH v2] examples/multi_process/symmetric_mp: fix link check
  2019-03-27 11:22 [dpdk-dev] [PATCH] examples/multi_process/symmetric_mp: fix link check Akhil Goyal
  2019-03-27 11:22 ` Akhil Goyal
@ 2019-03-27 11:33 ` Akhil Goyal
  2019-03-27 11:33   ` Akhil Goyal
                     ` (2 more replies)
  1 sibling, 3 replies; 8+ messages in thread
From: Akhil Goyal @ 2019-03-27 11:33 UTC (permalink / raw)
  To: dev; +Cc: anatoly.burakov, thomas, Akhil Goyal, stable

link check is done for primary process for the ports
which are given in the port mask and not the complete
set of ports.

Fixes: d3641ae86313 ("examples: update link status checks")
Cc: stable@dpdk.org

Signed-off-by: Akhil Goyal <akhil.goyal@nxp.com>
---
 examples/multi_process/symmetric_mp/main.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/examples/multi_process/symmetric_mp/main.c b/examples/multi_process/symmetric_mp/main.c
index c310e942b..7fb2a24ea 100644
--- a/examples/multi_process/symmetric_mp/main.c
+++ b/examples/multi_process/symmetric_mp/main.c
@@ -73,6 +73,7 @@ static unsigned num_procs = 0;
 
 static uint16_t ports[RTE_MAX_ETHPORTS];
 static unsigned num_ports = 0;
+static uint16_t port_mask;
 
 static struct lcore_ports lcore_ports[RTE_MAX_LCORE];
 static struct port_stats pstats[RTE_MAX_ETHPORTS];
@@ -115,7 +116,7 @@ smp_parse_args(int argc, char **argv)
 	int opt, ret;
 	char **argvopt;
 	int option_index;
-	uint16_t i, port_mask = 0;
+	uint16_t i;
 	char *prgname = argv[0];
 	static struct option lgopts[] = {
 			{PARAM_NUM_PROCS, 1, 0, 0},
@@ -349,7 +350,7 @@ lcore_main(void *arg __rte_unused)
 
 /* Check the link status of all ports in up to 9s, and print them finally */
 static void
-check_all_ports_link_status(uint16_t port_num, uint32_t port_mask)
+check_all_ports_link_status(uint16_t port_num, uint32_t mask)
 {
 #define CHECK_INTERVAL 100 /* 100ms */
 #define MAX_CHECK_TIME 90 /* 9s (90 * 100ms) in total */
@@ -362,7 +363,7 @@ check_all_ports_link_status(uint16_t port_num, uint32_t port_mask)
 	for (count = 0; count <= MAX_CHECK_TIME; count++) {
 		all_ports_up = 1;
 		for (portid = 0; portid < port_num; portid++) {
-			if ((port_mask & (1 << portid)) == 0)
+			if ((mask & (1 << portid)) == 0)
 				continue;
 			memset(&link, 0, sizeof(link));
 			rte_eth_link_get_nowait(portid, &link);
@@ -451,7 +452,7 @@ main(int argc, char **argv)
 	}
 
 	if (proc_type == RTE_PROC_PRIMARY)
-		check_all_ports_link_status((uint8_t)num_ports, (~0x0));
+		check_all_ports_link_status(rte_eth_dev_count(), port_mask);
 
 	assign_ports_to_cores();
 
-- 
2.17.1

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

* [dpdk-dev] [PATCH v2] examples/multi_process/symmetric_mp: fix link check
  2019-03-27 11:33 ` [dpdk-dev] [PATCH v2] " Akhil Goyal
@ 2019-03-27 11:33   ` Akhil Goyal
  2019-04-05 12:42   ` Burakov, Anatoly
  2019-04-05 13:03   ` Thomas Monjalon
  2 siblings, 0 replies; 8+ messages in thread
From: Akhil Goyal @ 2019-03-27 11:33 UTC (permalink / raw)
  To: dev; +Cc: anatoly.burakov, thomas, Akhil Goyal, stable

link check is done for primary process for the ports
which are given in the port mask and not the complete
set of ports.

Fixes: d3641ae86313 ("examples: update link status checks")
Cc: stable@dpdk.org

Signed-off-by: Akhil Goyal <akhil.goyal@nxp.com>
---
 examples/multi_process/symmetric_mp/main.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/examples/multi_process/symmetric_mp/main.c b/examples/multi_process/symmetric_mp/main.c
index c310e942b..7fb2a24ea 100644
--- a/examples/multi_process/symmetric_mp/main.c
+++ b/examples/multi_process/symmetric_mp/main.c
@@ -73,6 +73,7 @@ static unsigned num_procs = 0;
 
 static uint16_t ports[RTE_MAX_ETHPORTS];
 static unsigned num_ports = 0;
+static uint16_t port_mask;
 
 static struct lcore_ports lcore_ports[RTE_MAX_LCORE];
 static struct port_stats pstats[RTE_MAX_ETHPORTS];
@@ -115,7 +116,7 @@ smp_parse_args(int argc, char **argv)
 	int opt, ret;
 	char **argvopt;
 	int option_index;
-	uint16_t i, port_mask = 0;
+	uint16_t i;
 	char *prgname = argv[0];
 	static struct option lgopts[] = {
 			{PARAM_NUM_PROCS, 1, 0, 0},
@@ -349,7 +350,7 @@ lcore_main(void *arg __rte_unused)
 
 /* Check the link status of all ports in up to 9s, and print them finally */
 static void
-check_all_ports_link_status(uint16_t port_num, uint32_t port_mask)
+check_all_ports_link_status(uint16_t port_num, uint32_t mask)
 {
 #define CHECK_INTERVAL 100 /* 100ms */
 #define MAX_CHECK_TIME 90 /* 9s (90 * 100ms) in total */
@@ -362,7 +363,7 @@ check_all_ports_link_status(uint16_t port_num, uint32_t port_mask)
 	for (count = 0; count <= MAX_CHECK_TIME; count++) {
 		all_ports_up = 1;
 		for (portid = 0; portid < port_num; portid++) {
-			if ((port_mask & (1 << portid)) == 0)
+			if ((mask & (1 << portid)) == 0)
 				continue;
 			memset(&link, 0, sizeof(link));
 			rte_eth_link_get_nowait(portid, &link);
@@ -451,7 +452,7 @@ main(int argc, char **argv)
 	}
 
 	if (proc_type == RTE_PROC_PRIMARY)
-		check_all_ports_link_status((uint8_t)num_ports, (~0x0));
+		check_all_ports_link_status(rte_eth_dev_count(), port_mask);
 
 	assign_ports_to_cores();
 
-- 
2.17.1


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

* Re: [dpdk-dev] [PATCH v2] examples/multi_process/symmetric_mp: fix link check
  2019-03-27 11:33 ` [dpdk-dev] [PATCH v2] " Akhil Goyal
  2019-03-27 11:33   ` Akhil Goyal
@ 2019-04-05 12:42   ` Burakov, Anatoly
  2019-04-05 12:42     ` Burakov, Anatoly
  2019-04-05 13:03   ` Thomas Monjalon
  2 siblings, 1 reply; 8+ messages in thread
From: Burakov, Anatoly @ 2019-04-05 12:42 UTC (permalink / raw)
  To: Akhil Goyal, dev; +Cc: thomas, stable

On 27-Mar-19 11:33 AM, Akhil Goyal wrote:
> link check is done for primary process for the ports
> which are given in the port mask and not the complete
> set of ports.
> 
> Fixes: d3641ae86313 ("examples: update link status checks")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Akhil Goyal <akhil.goyal@nxp.com>
> ---

Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>

-- 
Thanks,
Anatoly

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

* Re: [dpdk-dev] [PATCH v2] examples/multi_process/symmetric_mp: fix link check
  2019-04-05 12:42   ` Burakov, Anatoly
@ 2019-04-05 12:42     ` Burakov, Anatoly
  0 siblings, 0 replies; 8+ messages in thread
From: Burakov, Anatoly @ 2019-04-05 12:42 UTC (permalink / raw)
  To: Akhil Goyal, dev; +Cc: thomas, stable

On 27-Mar-19 11:33 AM, Akhil Goyal wrote:
> link check is done for primary process for the ports
> which are given in the port mask and not the complete
> set of ports.
> 
> Fixes: d3641ae86313 ("examples: update link status checks")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Akhil Goyal <akhil.goyal@nxp.com>
> ---

Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>

-- 
Thanks,
Anatoly

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

* Re: [dpdk-dev] [PATCH v2] examples/multi_process/symmetric_mp: fix link check
  2019-03-27 11:33 ` [dpdk-dev] [PATCH v2] " Akhil Goyal
  2019-03-27 11:33   ` Akhil Goyal
  2019-04-05 12:42   ` Burakov, Anatoly
@ 2019-04-05 13:03   ` Thomas Monjalon
  2019-04-05 13:03     ` Thomas Monjalon
  2 siblings, 1 reply; 8+ messages in thread
From: Thomas Monjalon @ 2019-04-05 13:03 UTC (permalink / raw)
  To: Akhil Goyal, anatoly.burakov; +Cc: dev, stable

27/03/2019 12:33, Akhil Goyal:
> link check is done for primary process for the ports
> which are given in the port mask and not the complete
> set of ports.
> 
> Fixes: d3641ae86313 ("examples: update link status checks")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Akhil Goyal <akhil.goyal@nxp.com>
> ---
>  		for (portid = 0; portid < port_num; portid++) {

The logic of this loop is wrong.
The port ids may be not contiguous.
Look at RTE_ETH_FOREACH_DEV* for such iteration.

> -			if ((port_mask & (1 << portid)) == 0)
> +			if ((mask & (1 << portid)) == 0)
>  				continue;
[...]
> -		check_all_ports_link_status((uint8_t)num_ports, (~0x0));
> +		check_all_ports_link_status(rte_eth_dev_count(), port_mask);

The function rte_eth_dev_count is deprecated.
It should be noticed when compiling.

On more comment, I think such wrong implementation is existing
in many examples:
% git grep -l 'check_all_ports_link_status(.*num'
	app/test/test_pmd_perf.c
	examples/link_status_interrupt/main.c
	examples/load_balancer/init.c
	examples/multi_process/client_server_mp/mp_server/init.c
	examples/multi_process/symmetric_mp/main.c
	examples/server_node_efd/server/init.c

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

* Re: [dpdk-dev] [PATCH v2] examples/multi_process/symmetric_mp: fix link check
  2019-04-05 13:03   ` Thomas Monjalon
@ 2019-04-05 13:03     ` Thomas Monjalon
  0 siblings, 0 replies; 8+ messages in thread
From: Thomas Monjalon @ 2019-04-05 13:03 UTC (permalink / raw)
  To: Akhil Goyal, anatoly.burakov; +Cc: dev, stable

27/03/2019 12:33, Akhil Goyal:
> link check is done for primary process for the ports
> which are given in the port mask and not the complete
> set of ports.
> 
> Fixes: d3641ae86313 ("examples: update link status checks")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Akhil Goyal <akhil.goyal@nxp.com>
> ---
>  		for (portid = 0; portid < port_num; portid++) {

The logic of this loop is wrong.
The port ids may be not contiguous.
Look at RTE_ETH_FOREACH_DEV* for such iteration.

> -			if ((port_mask & (1 << portid)) == 0)
> +			if ((mask & (1 << portid)) == 0)
>  				continue;
[...]
> -		check_all_ports_link_status((uint8_t)num_ports, (~0x0));
> +		check_all_ports_link_status(rte_eth_dev_count(), port_mask);

The function rte_eth_dev_count is deprecated.
It should be noticed when compiling.

On more comment, I think such wrong implementation is existing
in many examples:
% git grep -l 'check_all_ports_link_status(.*num'
	app/test/test_pmd_perf.c
	examples/link_status_interrupt/main.c
	examples/load_balancer/init.c
	examples/multi_process/client_server_mp/mp_server/init.c
	examples/multi_process/symmetric_mp/main.c
	examples/server_node_efd/server/init.c



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

end of thread, other threads:[~2019-04-05 13:03 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-27 11:22 [dpdk-dev] [PATCH] examples/multi_process/symmetric_mp: fix link check Akhil Goyal
2019-03-27 11:22 ` Akhil Goyal
2019-03-27 11:33 ` [dpdk-dev] [PATCH v2] " Akhil Goyal
2019-03-27 11:33   ` Akhil Goyal
2019-04-05 12:42   ` Burakov, Anatoly
2019-04-05 12:42     ` Burakov, Anatoly
2019-04-05 13:03   ` Thomas Monjalon
2019-04-05 13:03     ` Thomas Monjalon

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).