[3/5] app/testpmd: check not configuring port twice

Message ID 20181024134111.26771-4-thomas@monjalon.net (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers
Series app/testpmd: improve attach/detach support |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Thomas Monjalon Oct. 24, 2018, 1:41 p.m. UTC
  It is possible to request probing of a device twice,
and possibly get new ports for this device.
However, the ports which were already probed and setup
must not be setup again. That's why it is checked whether
the port is already part of fwd_ports_ids array at the beginning
of the function setup_attached_port().

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
 app/test-pmd/testpmd.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
  

Comments

Iremonger, Bernard Oct. 24, 2018, 3:50 p.m. UTC | #1
Hi Thomas,

> -----Original Message-----
> From: Thomas Monjalon [mailto:thomas@monjalon.net]
> Sent: Wednesday, October 24, 2018 2:41 PM
> To: Iremonger, Bernard <bernard.iremonger@intel.com>; Wu, Jingjing
> <jingjing.wu@intel.com>; Lu, Wenzhuo <wenzhuo.lu@intel.com>
> Cc: dev@dpdk.org; ophirmu@mellanox.com; wisamm@mellanox.com; Yigit,
> Ferruh <ferruh.yigit@intel.com>; arybchenko@solarflare.com
> Subject: [PATCH 3/5] app/testpmd: check not configuring port twice
> 
> It is possible to request probing of a device twice, and possibly get new ports for
> this device.

./devtools/check-git-log.sh -1
Wrong beginning of commit message:
        It is possible to request probing of a device twice,

> However, the ports which were already probed and setup must not be setup
> again. That's why it is checked whether the port is already part of fwd_ports_ids
> array at the beginning of the function setup_attached_port().
> 
> Signed-off-by: Thomas Monjalon <thomas@monjalon.net>

Otherwise

Acked-by: Bernard Iremonger <bernard.iremonger@intel.com>
  

Patch

diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index 21627ecb6..72b91adf5 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -2295,8 +2295,11 @@  attach_port(char *identifier)
 		return;
 	}
 
-	RTE_ETH_FOREACH_MATCHING_DEV(pi, identifier, &iterator)
+	RTE_ETH_FOREACH_MATCHING_DEV(pi, identifier, &iterator) {
+		if (port_is_forwarding(pi))
+			continue; /* port was already attached before */
 		setup_attached_port(pi);
+	}
 }
 
 static void