[dpdk-dev] app/testpmd: check port is stopped for QinQ setup
diff mbox

Message ID 1492701258-7968-1-git-send-email-bernard.iremonger@intel.com
State Superseded, archived
Delegated to: Ferruh Yigit
Headers show

Checks

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

Commit Message

Bernard Iremonger April 20, 2017, 3:14 p.m. UTC
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(-)

Comments

Xing, Beilei April 21, 2017, 1:37 a.m. UTC | #1
Hi Bernard,

> -----Original Message-----
> From: Iremonger, Bernard
> Sent: Thursday, April 20, 2017 11:14 PM
> To: dev@dpdk.org; Xing, Beilei <beilei.xing@intel.com>; Zhang, Qi
> <qi.zhang@intel.com>
> Cc: Iremonger, Bernard <bernard.iremonger@intel.com>
> Subject: [PATCH] app/testpmd: check port is stopped for QinQ setup
> 
> 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>

Acked-by: Beilei Xing <beilei.xing@intel.com>

Maybe it's better to introduce why stopping port is needed now in commit log.

Patch
diff mbox

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;
 }