DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] app/testpmd: check port is stopped for QinQ setup
@ 2017-04-20 15:14 Bernard Iremonger
  2017-04-21  1:37 ` Xing, Beilei
  2017-04-24 10:24 ` [dpdk-dev] [PATCH v2] " Bernard Iremonger
  0 siblings, 2 replies; 7+ messages in thread
From: Bernard Iremonger @ 2017-04-20 15:14 UTC (permalink / raw)
  To: dev, beilei.xing, qi.zhang; +Cc: Bernard Iremonger

Check port is stopped before configuring it for QinQ,
with the "vlan set qinq on <port_id>" command.

Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
---
 app/test-pmd/cmdline.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index f6bd75b78..a96b8b67c 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -1,7 +1,7 @@
 /*-
  *   BSD LICENSE
  *
- *   Copyright(c) 2010-2016 Intel Corporation. All rights reserved.
+ *   Copyright(c) 2010-2017 Intel Corporation. All rights reserved.
  *   Copyright(c) 2014 6WIND S.A.
  *   All rights reserved.
  *
@@ -3036,6 +3036,7 @@ cmd_vlan_offload_parsed(void *parsed_result,
 	int i, len = 0;
 	portid_t port_id = 0;
 	unsigned int tmp;
+	struct rte_port *port;
 
 	str = res->port_id;
 	len = strnlen(str, STR_TOKEN_SIZE);
@@ -3053,6 +3054,7 @@ cmd_vlan_offload_parsed(void *parsed_result,
 	if(tmp >= RTE_MAX_ETHPORTS)
 		return;
 	port_id = (portid_t)tmp;
+	port = &ports[port_id];
 
 	if (!strcmp(res->on, "on"))
 		on = 1;
@@ -3079,9 +3081,13 @@ cmd_vlan_offload_parsed(void *parsed_result,
 	}
 	else if (!strcmp(res->what, "filter"))
 		rx_vlan_filter_set(port_id, on);
-	else
+	else {
+		if (port->port_status != RTE_PORT_STOPPED) {
+			printf("Please stop port %d first\n", port_id);
+			return;
+		}
 		vlan_extend_set(port_id, on);
-
+	}
 	return;
 }
 
-- 
2.11.0

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

end of thread, other threads:[~2017-04-27  8:11 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-20 15:14 [dpdk-dev] [PATCH] app/testpmd: check port is stopped for QinQ setup Bernard Iremonger
2017-04-21  1:37 ` Xing, Beilei
2017-04-24 10:24 ` [dpdk-dev] [PATCH v2] " Bernard Iremonger
2017-04-25  8:55   ` Wu, Jingjing
2017-04-25 15:50     ` Iremonger, Bernard
2017-04-27  5:28       ` Wu, Jingjing
2017-04-27  8:11         ` Iremonger, Bernard

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