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

Message ID 1493029477-27106-1-git-send-email-bernard.iremonger@intel.com (mailing list archive)
State Rejected, archived
Delegated to: Ferruh Yigit
Headers

Checks

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

Commit Message

Iremonger, Bernard April 24, 2017, 10:24 a.m. UTC
  Check port is stopped before configuring it for QinQ,
with the "vlan set qinq on <port_id>" command.

The above command sets the hw_vlan_extend flag.
When the port is started it calls the
i40e_rx_vec_dev_conf_condition_check_default function to
decide whether or not to select the vector mode driver
depending on the state of the hw_vlan_extend flag.

Fixes: a47aa8b97afe ("app/testpmd: add vlan offload support")
Cc: stable@dpdk.org

Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
Acked-by: Beilei Xing <beilei.xing@intel.com>
---
 Changes in v2:
 Rebased to latest dpdk-next-net
 revised commit message.
 add Fixes and Cc lines.

 app/test-pmd/cmdline.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
  

Comments

Jingjing Wu April 25, 2017, 8:55 a.m. UTC | #1
> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Bernard Iremonger
> Sent: Monday, April 24, 2017 6:25 PM
> To: dev@dpdk.org
> Cc: Xing, Beilei <beilei.xing@intel.com>; Zhang, Qi <qi.zhang@intel.com>;
> Iremonger, Bernard <bernard.iremonger@intel.com>; stable@dpdk.org
> Subject: [dpdk-dev] [PATCH v2] 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.
> 
> The above command sets the hw_vlan_extend flag.
> When the port is started it calls the
> i40e_rx_vec_dev_conf_condition_check_default function to decide whether or
> not to select the vector mode driver depending on the state of the
> hw_vlan_extend flag.
> 
The command vlan set qinq on <port_id> is an common command, but not only
For i40e. I think it's better to doc it somewhere instead of changing the default
Behavior of this command.
  
Iremonger, Bernard April 25, 2017, 3:50 p.m. UTC | #2
Hi  Jingjing,

> -----Original Message-----
> From: Wu, Jingjing
> Sent: Tuesday, April 25, 2017 9:55 AM
> To: Iremonger, Bernard <bernard.iremonger@intel.com>; dev@dpdk.org
> Cc: Xing, Beilei <beilei.xing@intel.com>; Zhang, Qi <qi.zhang@intel.com>;
> Iremonger, Bernard <bernard.iremonger@intel.com>; stable@dpdk.org
> Subject: RE: [dpdk-dev] [PATCH v2] app/testpmd: check port is stopped for
> QinQ setup
> 
> 
> 
> > -----Original Message-----
> > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Bernard
> Iremonger
> > Sent: Monday, April 24, 2017 6:25 PM
> > To: dev@dpdk.org
> > Cc: Xing, Beilei <beilei.xing@intel.com>; Zhang, Qi
> > <qi.zhang@intel.com>; Iremonger, Bernard
> > <bernard.iremonger@intel.com>; stable@dpdk.org
> > Subject: [dpdk-dev] [PATCH v2] 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.
> >
> > The above command sets the hw_vlan_extend flag.
> > When the port is started it calls the
> > i40e_rx_vec_dev_conf_condition_check_default function to decide
> > whether or not to select the vector mode driver depending on the state
> > of the hw_vlan_extend flag.
> >
> The command vlan set qinq on <port_id> is an common command, but not
> only For i40e. I think it's better to doc it somewhere instead of changing the
> default Behavior of this command.

There is a doc patch in flight:
http://dpdk.org/dev/patchwork/patch/23704/

Is this enough or should I send a v3 of this patch for the i40e PMD only?

Regards,

Bernard.
  
Jingjing Wu April 27, 2017, 5:28 a.m. UTC | #3
> > The command vlan set qinq on <port_id> is an common command, but not
> > only For i40e. I think it's better to doc it somewhere instead of
> > changing the default Behavior of this command.
> 
> There is a doc patch in flight:
> http://dpdk.org/dev/patchwork/patch/23704/
> 
> Is this enough or should I send a v3 of this patch for the i40e PMD only?
> 
Yes. I think doc it is enough.
We don't need this patch.

Thanks
Jingjing
  
Iremonger, Bernard April 27, 2017, 8:11 a.m. UTC | #4
Hi Jingjing,

> -----Original Message-----
> From: Wu, Jingjing
> Sent: Thursday, April 27, 2017 6:28 AM
> To: Iremonger, Bernard <bernard.iremonger@intel.com>; dev@dpdk.org
> Cc: Xing, Beilei <beilei.xing@intel.com>; Zhang, Qi <qi.zhang@intel.com>;
> stable@dpdk.org
> Subject: RE: [dpdk-dev] [PATCH v2] app/testpmd: check port is stopped for
> QinQ setup
> 
> 
> 
> > > The command vlan set qinq on <port_id> is an common command, but
> not
> > > only For i40e. I think it's better to doc it somewhere instead of
> > > changing the default Behavior of this command.
> >
> > There is a doc patch in flight:
> > http://dpdk.org/dev/patchwork/patch/23704/
> >
> > Is this enough or should I send a v3 of this patch for the i40e PMD only?
> >
> Yes. I think doc it is enough.
> We don't need this patch.
> 
> Thanks
> Jingjing


I will NAK this patch.

Self NAK

Regards,

Bernard.
  

Patch

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