[dpdk-dev] [PATCH v5 3/9] app/testpmd: check port is not forwarding
Bernard Iremonger
bernard.iremonger at intel.com
Tue Jun 14 17:35:36 CEST 2016
Add calls to port_is_forwarding function in stop_port and
close_port functions to check that port is not forwarding.
Signed-off-by: Bernard Iremonger <bernard.iremonger at intel.com>
---
app/test-pmd/testpmd.c | 24 ++++++++++--------------
1 file changed, 10 insertions(+), 14 deletions(-)
diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index 7a1e470..f22d1b6 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -1279,11 +1279,6 @@ start_port(portid_t pid)
struct rte_port *port;
struct ether_addr mac_addr;
- if (test_done == 0) {
- printf("Please stop forwarding first\n");
- return -1;
- }
-
if (port_id_is_invalid(pid, ENABLED_WARN))
return 0;
@@ -1435,10 +1430,6 @@ stop_port(portid_t pid)
struct rte_port *port;
int need_check_link_status = 0;
- if (test_done == 0) {
- printf("Please stop forwarding first\n");
- return;
- }
if (dcb_test) {
dcb_test = 0;
dcb_config = 0;
@@ -1453,6 +1444,11 @@ stop_port(portid_t pid)
if (pid != pi && pid != (portid_t)RTE_PORT_ALL)
continue;
+ if (port_is_forwarding(pi) != 0 && test_done == 0) {
+ printf("Please remove port %d from forwarding configuration.\n", pi);
+ continue;
+ }
+
port = &ports[pi];
if (rte_atomic16_cmpset(&(port->port_status), RTE_PORT_STARTED,
RTE_PORT_HANDLING) == 0)
@@ -1477,11 +1473,6 @@ close_port(portid_t pid)
portid_t pi;
struct rte_port *port;
- if (test_done == 0) {
- printf("Please stop forwarding first\n");
- return;
- }
-
if (port_id_is_invalid(pid, ENABLED_WARN))
return;
@@ -1491,6 +1482,11 @@ close_port(portid_t pid)
if (pid != pi && pid != (portid_t)RTE_PORT_ALL)
continue;
+ if (port_is_forwarding(pi) != 0 && test_done == 0) {
+ printf("Please remove port %d from forwarding configuration.\n", pi);
+ continue;
+ }
+
port = &ports[pi];
if (rte_atomic16_cmpset(&(port->port_status),
RTE_PORT_CLOSED, RTE_PORT_CLOSED) == 1) {
--
2.6.3
More information about the dev
mailing list