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

Jianfeng Tan jianfeng.tan at intel.com
Thu Aug 18 07:46:13 CEST 2016


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 at intel.com>
Signed-off-by: Jianfeng Tan <jianfeng.tan at intel.com>
---
 doc/guides/sample_app_ug/vhost.rst | 11 ++++-------
 examples/vhost/main.c              | 26 +-------------------------
 2 files changed, 5 insertions(+), 32 deletions(-)

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



More information about the dev mailing list