[dpdk-dev] examples/vhost: remove VLAN strip option

Message ID 1471499173-11749-1-git-send-email-jianfeng.tan@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Yuanhan Liu
Headers

Commit Message

Jianfeng Tan Aug. 18, 2016, 5:46 a.m. UTC
  When VMDQ is enabled, different NICs have different behaviors for
disabling VLAN strip. In detail, i40e only enables/disables it of
PF's main vsi; fm10k cannot disable VLAN strip, etc. We now remove
this option, --vlan-strip, to reduce any confusion. And now, VLAN
strip will be enabled and cannot be disabled.

Reported-by: Qian Xu <qian.q.xu@intel.com>
Signed-off-by: Jianfeng Tan <jianfeng.tan@intel.com>
---
 doc/guides/sample_app_ug/vhost.rst | 11 ++++-------
 examples/vhost/main.c              | 26 +-------------------------
 2 files changed, 5 insertions(+), 32 deletions(-)
  

Comments

Maxime Coquelin Aug. 18, 2016, 7:52 a.m. UTC | #1
On 08/18/2016 07:46 AM, Jianfeng Tan wrote:
> When VMDQ is enabled, different NICs have different behaviors for
> disabling VLAN strip. In detail, i40e only enables/disables it of
> PF's main vsi; fm10k cannot disable VLAN strip, etc. We now remove
> this option, --vlan-strip, to reduce any confusion. And now, VLAN
> strip will be enabled and cannot be disabled.
>
> Reported-by: Qian Xu <qian.q.xu@intel.com>
> Signed-off-by: Jianfeng Tan <jianfeng.tan@intel.com>
> ---
>  doc/guides/sample_app_ug/vhost.rst | 11 ++++-------
>  examples/vhost/main.c              | 26 +-------------------------
>  2 files changed, 5 insertions(+), 32 deletions(-)

Minor comment below. Other than that:
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>

> diff --git a/doc/guides/sample_app_ug/vhost.rst b/doc/guides/sample_app_ug/vhost.rst
> index 2b7defc..a204f78 100644
> --- a/doc/guides/sample_app_ug/vhost.rst
> +++ b/doc/guides/sample_app_ug/vhost.rst
> @@ -496,13 +496,10 @@ due to the large and complex code, it's better to redesign it than fixing
>  it to make it work again. Hence, zero copy may be added back later.
>
>  **VLAN strip.**
> -The VLAN strip option enable/disable the VLAN strip on host, if disabled, the guest will receive the packets with VLAN tag.
> -It is enabled by default.
> -
> -.. code-block:: console
> -
> -    ./vhost-switch -c f -n 4 --socket-mem 1024 --huge-dir /mnt/huge \
> -     -- --vlan-strip [0, 1]
> +VLAN strip option is removed, because different NICs have different behaviors
> +when disabling VLAN strip. Such feature, which heavily depends on hardware,
> +should be removed from this example to deduce confusion. Now, VLAN strip is
I'm not a native English speaker, but I would use "reduce" instead of
"deduce" here. I might be wrong, so feel free to keep as-is if
appropriate.

Thanks,
Maxime
  
Jianfeng Tan Aug. 18, 2016, 10:19 a.m. UTC | #2
Hi Maxime,

> -----Original Message-----
> From: Maxime Coquelin [mailto:maxime.coquelin@redhat.com]
> Sent: Thursday, August 18, 2016 3:52 PM
> To: Tan, Jianfeng; dev@dpdk.org
> Cc: yuanhan.liu@linux.intel.com
> Subject: Re: [dpdk-dev] [PATCH] examples/vhost: remove VLAN strip option
> 
> 
> 
> On 08/18/2016 07:46 AM, Jianfeng Tan wrote:
> > When VMDQ is enabled, different NICs have different behaviors for
> > disabling VLAN strip. In detail, i40e only enables/disables it of
> > PF's main vsi; fm10k cannot disable VLAN strip, etc. We now remove
> > this option, --vlan-strip, to reduce any confusion. And now, VLAN
> > strip will be enabled and cannot be disabled.
> >
> > Reported-by: Qian Xu <qian.q.xu@intel.com>
> > Signed-off-by: Jianfeng Tan <jianfeng.tan@intel.com>
> > ---
> >  doc/guides/sample_app_ug/vhost.rst | 11 ++++-------
> >  examples/vhost/main.c              | 26 +-------------------------
> >  2 files changed, 5 insertions(+), 32 deletions(-)
> 
> Minor comment below. Other than that:
> Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
> 
> > diff --git a/doc/guides/sample_app_ug/vhost.rst
> b/doc/guides/sample_app_ug/vhost.rst
> > index 2b7defc..a204f78 100644
> > --- a/doc/guides/sample_app_ug/vhost.rst
> > +++ b/doc/guides/sample_app_ug/vhost.rst
> > @@ -496,13 +496,10 @@ due to the large and complex code, it's better to
> redesign it than fixing
> >  it to make it work again. Hence, zero copy may be added back later.
> >
> >  **VLAN strip.**
> > -The VLAN strip option enable/disable the VLAN strip on host, if disabled,
> the guest will receive the packets with VLAN tag.
> > -It is enabled by default.
> > -
> > -.. code-block:: console
> > -
> > -    ./vhost-switch -c f -n 4 --socket-mem 1024 --huge-dir /mnt/huge \
> > -     -- --vlan-strip [0, 1]
> > +VLAN strip option is removed, because different NICs have different
> behaviors
> > +when disabling VLAN strip. Such feature, which heavily depends on
> hardware,
> > +should be removed from this example to deduce confusion. Now, VLAN
> strip is
> I'm not a native English speaker, but I would use "reduce" instead of
> "deduce" here. I might be wrong, so feel free to keep as-is if
> appropriate.

Nice catch! Yes, "reduce" instead of "deduce".

Thanks,
Jianfeng

> 
> Thanks,
> Maxime
  
Yuanhan Liu Aug. 23, 2016, 6:12 a.m. UTC | #3
On Thu, Aug 18, 2016 at 10:19:15AM +0000, Tan, Jianfeng wrote:
> > > +VLAN strip option is removed, because different NICs have different
> > behaviors
> > > +when disabling VLAN strip. Such feature, which heavily depends on
> > hardware,
> > > +should be removed from this example to deduce confusion. Now, VLAN
> > strip is
> > I'm not a native English speaker, but I would use "reduce" instead of
> > "deduce" here. I might be wrong, so feel free to keep as-is if
> > appropriate.
> 
> Nice catch! Yes, "reduce" instead of "deduce".

Fixed and applied to dpdk-next-virtio.

Thanks.

	--yliu
  

Patch

diff --git a/doc/guides/sample_app_ug/vhost.rst b/doc/guides/sample_app_ug/vhost.rst
index 2b7defc..a204f78 100644
--- a/doc/guides/sample_app_ug/vhost.rst
+++ b/doc/guides/sample_app_ug/vhost.rst
@@ -496,13 +496,10 @@  due to the large and complex code, it's better to redesign it than fixing
 it to make it work again. Hence, zero copy may be added back later.
 
 **VLAN strip.**
-The VLAN strip option enable/disable the VLAN strip on host, if disabled, the guest will receive the packets with VLAN tag.
-It is enabled by default.
-
-.. code-block:: console
-
-    ./vhost-switch -c f -n 4 --socket-mem 1024 --huge-dir /mnt/huge \
-     -- --vlan-strip [0, 1]
+VLAN strip option is removed, because different NICs have different behaviors
+when disabling VLAN strip. Such feature, which heavily depends on hardware,
+should be removed from this example to deduce confusion. Now, VLAN strip is
+enabled and cannot be disabled.
 
 .. _vhost_app_running:
 
diff --git a/examples/vhost/main.c b/examples/vhost/main.c
index 92a9823..71b05d0 100644
--- a/examples/vhost/main.c
+++ b/examples/vhost/main.c
@@ -109,9 +109,6 @@  static uint32_t num_devices;
 static struct rte_mempool *mbuf_pool;
 static int mergeable;
 
-/* Do vlan strip on host, enabled on default */
-static uint32_t vlan_strip = 1;
-
 /* Enable VM2VM communications. If this is disabled then the MAC address compare is skipped. */
 typedef enum {
 	VM2VM_DISABLED = 0,
@@ -470,7 +467,6 @@  us_vhost_usage(const char *prgname)
 	"		--rx-retry-delay [0-N]: timeout(in usecond) between retries on RX. This makes effect only if retries on rx enabled\n"
 	"		--rx-retry-num [0-N]: the number of retries on rx. This makes effect only if retries on rx enabled\n"
 	"		--mergeable [0|1]: disable(default)/enable RX mergeable buffers\n"
-	"		--vlan-strip [0|1]: disable/enable(default) RX VLAN strip on host\n"
 	"		--stats [0-N]: 0: Disable stats, N: Time in seconds to print stats\n"
 	"		--dev-basename: The basename to be used for the character device.\n"
 	"		--tx-csum [0|1] disable/enable TX checksum offload.\n"
@@ -495,7 +491,6 @@  us_vhost_parse_args(int argc, char **argv)
 		{"rx-retry-delay", required_argument, NULL, 0},
 		{"rx-retry-num", required_argument, NULL, 0},
 		{"mergeable", required_argument, NULL, 0},
-		{"vlan-strip", required_argument, NULL, 0},
 		{"stats", required_argument, NULL, 0},
 		{"dev-basename", required_argument, NULL, 0},
 		{"tx-csum", required_argument, NULL, 0},
@@ -618,22 +613,6 @@  us_vhost_parse_args(int argc, char **argv)
 				}
 			}
 
-			/* Enable/disable RX VLAN strip on host. */
-			if (!strncmp(long_option[option_index].name,
-				"vlan-strip", MAX_LONG_OPT_SZ)) {
-				ret = parse_num_opt(optarg, 1);
-				if (ret == -1) {
-					RTE_LOG(INFO, VHOST_CONFIG,
-						"Invalid argument for VLAN strip [0|1]\n");
-					us_vhost_usage(prgname);
-					return -1;
-				} else {
-					vlan_strip = !!ret;
-					vmdq_conf_default.rxmode.hw_vlan_strip =
-						vlan_strip;
-				}
-			}
-
 			/* Enable/disable stats. */
 			if (!strncmp(long_option[option_index].name, "stats", MAX_LONG_OPT_SZ)) {
 				ret = parse_num_opt(optarg, INT32_MAX);
@@ -761,10 +740,7 @@  link_vmdq(struct vhost_dev *vdev, struct rte_mbuf *m)
 			"(%d) failed to add device MAC address to VMDQ\n",
 			vdev->vid);
 
-	/* Enable stripping of the vlan tag as we handle routing. */
-	if (vlan_strip)
-		rte_eth_dev_set_vlan_strip_on_queue(ports[0],
-			(uint16_t)vdev->vmdq_rx_q, 1);
+	rte_eth_dev_set_vlan_strip_on_queue(ports[0], vdev->vmdq_rx_q, 1);
 
 	/* Set device as ready for RX. */
 	vdev->ready = DEVICE_RX;