All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ouyang Changchun <changchun.ouyang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
To: dev-VfR2kkLFssw@public.gmane.org
Subject: [PATCH v3 21/25] example/vhost: Add vlan-strip cmd line option
Date: Thu, 29 Jan 2015 15:24:05 +0800	[thread overview]
Message-ID: <1422516249-14596-22-git-send-email-changchun.ouyang@intel.com> (raw)
In-Reply-To: <1422516249-14596-1-git-send-email-changchun.ouyang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>

Support turn on/off RX VLAN strip on host, this let guest get the chance of
using its software VALN strip functionality.

Signed-off-by: Changchun Ouyang <changchun.ouyang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
---
 examples/vhost/main.c | 25 ++++++++++++++++++++++++-
 1 file changed, 24 insertions(+), 1 deletion(-)

diff --git a/examples/vhost/main.c b/examples/vhost/main.c
index 6af7874..1876c8e 100644
--- a/examples/vhost/main.c
+++ b/examples/vhost/main.c
@@ -159,6 +159,9 @@ static uint32_t num_devices;
 static uint32_t zero_copy;
 static int mergeable;
 
+/* Do vlan strip on host, enabled on default */
+static uint32_t vlan_strip = 1;
+
 /* number of descriptors to apply*/
 static uint32_t num_rx_descriptor = RTE_TEST_RX_DESC_DEFAULT_ZCP;
 static uint32_t num_tx_descriptor = RTE_TEST_TX_DESC_DEFAULT_ZCP;
@@ -564,6 +567,7 @@ 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"
 	"		--zero-copy [0|1]: disable(default)/enable rx/tx "
@@ -591,6 +595,7 @@ 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},
 		{"zero-copy", required_argument, NULL, 0},
@@ -691,6 +696,22 @@ 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);
@@ -950,7 +971,9 @@ link_vmdq(struct vhost_dev *vdev, struct rte_mbuf *m)
 					dev->device_fh);
 
 	/* Enable stripping of the vlan tag as we handle routing. */
-	rte_eth_dev_set_vlan_strip_on_queue(ports[0], (uint16_t)vdev->vmdq_rx_q, 1);
+	if (vlan_strip)
+		rte_eth_dev_set_vlan_strip_on_queue(ports[0],
+			(uint16_t)vdev->vmdq_rx_q, 1);
 
 	/* Set device as ready for RX. */
 	vdev->ready = DEVICE_RX;
-- 
1.8.4.2

  parent reply	other threads:[~2015-01-29  7:24 UTC|newest]

Thread overview: 132+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-15  5:15 [PATCH 00/22] Single virtio implementation Ouyang Changchun
     [not found] ` <1421298930-15210-1-git-send-email-changchun.ouyang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2015-01-15  5:15   ` [PATCH 01/22] virtio: Rearrange resource initialization Ouyang Changchun
2015-01-15  5:15   ` [PATCH 02/22] virtio: Use weaker barriers Ouyang Changchun
2015-01-15  5:15   ` [PATCH 03/22] virtio: Allow starting with link down Ouyang Changchun
2015-01-15  5:15   ` [PATCH 04/22] virtio: Add support for Link State interrupt Ouyang Changchun
2015-01-15  5:15   ` [PATCH 05/22] ether: Add soft vlan encap/decap functions Ouyang Changchun
2015-01-15  5:15   ` [PATCH 06/22] virtio: Use software vlan stripping Ouyang Changchun
2015-01-15  5:15   ` [PATCH 07/22] virtio: Remove unnecessary adapter structure Ouyang Changchun
2015-01-15  5:15   ` [PATCH 08/22] virtio: Remove redundant vq_alignment Ouyang Changchun
2015-01-15  5:15   ` [PATCH 09/22] virtio: Fix how states are handled during initialization Ouyang Changchun
2015-01-15  5:15   ` [PATCH 10/22] virtio: Make vtpci_get_status local Ouyang Changchun
2015-01-15  5:15   ` [PATCH 11/22] virtio: Check for packet headroom at compile time Ouyang Changchun
2015-01-15  5:15   ` [PATCH 12/22] virtio: Move allocation before initialization Ouyang Changchun
2015-01-15  5:15   ` [PATCH 13/22] virtio: Add support for vlan filtering Ouyang Changchun
2015-01-15  5:15   ` [PATCH 14/22] virtio: Add suport for multiple mac addresses Ouyang Changchun
2015-01-15  5:15   ` [PATCH 15/22] virtio: Add ability to set MAC address Ouyang Changchun
2015-01-15  5:15   ` [PATCH 16/22] virtio: Free mbuf's with threshold Ouyang Changchun
2015-01-15  5:15   ` [PATCH 17/22] virtio: Use port IO to get PCI resource Ouyang Changchun
2015-01-15  5:15   ` [PATCH 18/22] virtio: Fix descriptor index issue Ouyang Changchun
     [not found]     ` <1421298930-15210-19-git-send-email-changchun.ouyang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2015-01-15 16:54       ` Stephen Hemminger
2015-01-16  0:55         ` Ouyang, Changchun
2015-01-15  5:15   ` [PATCH 19/22] ether: Fix vlan strip/insert issue Ouyang Changchun
2015-01-15  5:15   ` [PATCH 20/22] example/vhost: Avoid inserting vlan twice Ouyang Changchun
2015-01-15  5:15   ` [PATCH 21/22] example/vhost: Add vlan-strip cmd line option Ouyang Changchun
2015-01-15  5:15   ` [PATCH 22/22] virtio: Use soft vlan strip in mergeable Rx path Ouyang Changchun
     [not found]     ` <1421298930-15210-23-git-send-email-changchun.ouyang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2015-01-15 16:55       ` Stephen Hemminger
2015-01-16  0:56         ` Ouyang, Changchun
2015-01-27  2:35   ` [PATCH v2 00/24] Single virtio implementation Ouyang Changchun
     [not found]     ` <1422326164-13697-1-git-send-email-changchun.ouyang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2015-01-27  2:35       ` [PATCH v2 01/24] virtio: Rearrange resource initialization Ouyang Changchun
2015-01-27  2:35       ` [PATCH v2 02/24] virtio: Use weaker barriers Ouyang Changchun
     [not found]         ` <1422326164-13697-3-git-send-email-changchun.ouyang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2015-01-27  7:03           ` Xie, Huawei
     [not found]             ` <C37D651A908B024F974696C65296B57B0F361A10-0J0gbvR4kThpB2pF5aRoyrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2015-01-27  9:58               ` Stephen Hemminger
     [not found]                 ` <20150127095831.1572b67a-CA4OZQ/Yy2Lykuyl+CZolw@public.gmane.org>
2015-01-27 16:16                   ` Xie, Huawei
     [not found]                     ` <C37D651A908B024F974696C65296B57B0F362A77-0J0gbvR4kThpB2pF5aRoyrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2015-01-28  6:12                       ` Ouyang, Changchun
2015-01-27  7:56           ` Xie, Huawei
     [not found]             ` <C37D651A908B024F974696C65296B57B0F361AD5-0J0gbvR4kThpB2pF5aRoyrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2015-01-27  8:04               ` Ouyang, Changchun
2015-01-27  2:35       ` [PATCH v2 03/24] virtio: Allow starting with link down Ouyang Changchun
2015-01-27  2:35       ` [PATCH v2 04/24] virtio: Add support for Link State interrupt Ouyang Changchun
     [not found]         ` <1422326164-13697-5-git-send-email-changchun.ouyang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2015-01-27  9:04           ` Xie, Huawei
     [not found]             ` <C37D651A908B024F974696C65296B57B0F361C0C-0J0gbvR4kThpB2pF5aRoyrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2015-01-27 10:00               ` Stephen Hemminger
     [not found]                 ` <20150127100006.007fbf8c-CA4OZQ/Yy2Lykuyl+CZolw@public.gmane.org>
2015-01-28  3:03                   ` Ouyang, Changchun
     [not found]                     ` <F52918179C57134FAEC9EA62FA2F96251198F0D1-E2R4CRU6q/6iAffOGbnezLfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2015-01-28 15:11                       ` Stephen Hemminger
2015-01-27  2:35       ` [PATCH v2 05/24] ether: Add soft vlan encap/decap functions Ouyang Changchun
2015-01-27  2:35       ` [PATCH v2 06/24] virtio: Use software vlan stripping Ouyang Changchun
2015-01-27  2:35       ` [PATCH v2 07/24] virtio: Remove unnecessary adapter structure Ouyang Changchun
2015-01-27  2:35       ` [PATCH v2 08/24] virtio: Remove redundant vq_alignment Ouyang Changchun
2015-01-27  2:35       ` [PATCH v2 09/24] virtio: Fix how states are handled during initialization Ouyang Changchun
2015-01-27  2:35       ` [PATCH v2 10/24] virtio: Make vtpci_get_status local Ouyang Changchun
2015-01-27  2:35       ` [PATCH v2 11/24] virtio: Check for packet headroom at compile time Ouyang Changchun
2015-01-27  2:35       ` [PATCH v2 12/24] virtio: Move allocation before initialization Ouyang Changchun
2015-01-27  2:35       ` [PATCH v2 13/24] virtio: Add support for vlan filtering Ouyang Changchun
2015-01-27  2:35       ` [PATCH v2 14/24] virtio: Add suport for multiple mac addresses Ouyang Changchun
2015-01-27  2:35       ` [PATCH v2 15/24] virtio: Add ability to set MAC address Ouyang Changchun
2015-01-27  2:35       ` [PATCH v2 16/24] virtio: Free mbuf's with threshold Ouyang Changchun
2015-01-27  2:35       ` [PATCH v2 17/24] virtio: Use port IO to get PCI resource Ouyang Changchun
2015-01-27  2:35       ` [PATCH v2 18/24] virtio: Fix descriptor index issue Ouyang Changchun
2015-01-27  2:35       ` [PATCH v2 19/24] ether: Fix vlan strip/insert issue Ouyang Changchun
2015-01-27  2:36       ` [PATCH v2 20/24] example/vhost: Avoid inserting vlan twice Ouyang Changchun
2015-01-27  2:36       ` [PATCH v2 21/24] example/vhost: Add vlan-strip cmd line option Ouyang Changchun
2015-01-27  2:36       ` [PATCH v2 22/24] virtio: Use soft vlan strip in mergeable Rx path Ouyang Changchun
2015-01-27  2:36       ` [PATCH v2 23/24] virtio: Fix zero copy break issue Ouyang Changchun
2015-01-27  2:36       ` [PATCH v2 24/24] virtio: Remove hotspots Ouyang Changchun
2015-01-27  3:06       ` [PATCH v2 00/24] Single virtio implementation Matthew Hall
     [not found]         ` <20150127030612.GA13138-Hv3ogNYU3JfZZajBQzqCxQ@public.gmane.org>
2015-01-27  3:42           ` Wiles, Keith
     [not found]             ` <D0EC568F.10DB9%keith.wiles-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2015-01-27  9:41               ` Matthew Hall
2015-01-27 10:02           ` Stephen Hemminger
     [not found]             ` <20150127100224.751850c1-CA4OZQ/Yy2Lykuyl+CZolw@public.gmane.org>
2015-01-27 18:59               ` Matthew Hall
2015-01-29  7:23       ` [PATCH v3 00/25] " Ouyang Changchun
     [not found]         ` <1422516249-14596-1-git-send-email-changchun.ouyang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2015-01-29  7:23           ` [PATCH v3 01/25] virtio: Rearrange resource initialization Ouyang Changchun
2015-01-29  7:23           ` [PATCH v3 02/25] virtio: Use weaker barriers Ouyang Changchun
2015-01-29  7:23           ` [PATCH v3 03/25] virtio: Allow starting with link down Ouyang Changchun
2015-01-29  7:23           ` [PATCH v3 04/25] virtio: Add support for Link State interrupt Ouyang Changchun
2015-01-29  7:23           ` [PATCH v3 05/25] ether: Add soft vlan encap/decap functions Ouyang Changchun
2015-01-29  7:23           ` [PATCH v3 06/25] virtio: Use software vlan stripping Ouyang Changchun
2015-01-29  7:23           ` [PATCH v3 07/25] virtio: Remove unnecessary adapter structure Ouyang Changchun
2015-01-29  7:23           ` [PATCH v3 08/25] virtio: Remove redundant vq_alignment Ouyang Changchun
2015-01-29  7:23           ` [PATCH v3 09/25] virtio: Fix how states are handled during initialization Ouyang Changchun
2015-01-29  7:23           ` [PATCH v3 10/25] virtio: Make vtpci_get_status local Ouyang Changchun
2015-01-29  7:23           ` [PATCH v3 11/25] virtio: Check for packet headroom at compile time Ouyang Changchun
2015-01-29  7:23           ` [PATCH v3 12/25] virtio: Move allocation before initialization Ouyang Changchun
2015-01-29  7:23           ` [PATCH v3 13/25] virtio: Add support for vlan filtering Ouyang Changchun
2015-01-29  7:23           ` [PATCH v3 14/25] virtio: Add suport for multiple mac addresses Ouyang Changchun
2015-01-29  7:23           ` [PATCH v3 15/25] virtio: Add ability to set MAC address Ouyang Changchun
2015-01-29  7:24           ` [PATCH v3 16/25] virtio: Free mbuf's with threshold Ouyang Changchun
2015-01-29  7:24           ` [PATCH v3 17/25] virtio: Use port IO to get PCI resource Ouyang Changchun
     [not found]             ` <1422516249-14596-18-git-send-email-changchun.ouyang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2015-01-29 23:14               ` Thomas Monjalon
2015-02-04  1:31                 ` Ouyang, Changchun
2015-01-29  7:24           ` [PATCH v3 18/25] virtio: Fix descriptor index issue Ouyang Changchun
2015-01-29  7:24           ` [PATCH v3 19/25] ether: Fix vlan strip/insert issue Ouyang Changchun
2015-02-04 10:54             ` Xie, Huawei
     [not found]               ` <C37D651A908B024F974696C65296B57B0F38064E-0J0gbvR4kThpB2pF5aRoyrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2015-02-05  0:54                 ` Ouyang, Changchun
2015-01-29  7:24           ` [PATCH v3 20/25] example/vhost: Avoid inserting vlan twice Ouyang Changchun
2015-01-29  7:24           ` Ouyang Changchun [this message]
2015-01-29  7:24           ` [PATCH v3 22/25] virtio: Use soft vlan strip in mergeable Rx path Ouyang Changchun
2015-01-29  7:24           ` [PATCH v3 23/25] virtio: Fix zero copy break issue Ouyang Changchun
2015-01-29  7:24           ` [PATCH v3 24/25] virtio: Remove hotspots Ouyang Changchun
2015-01-29  7:24           ` [PATCH v3 25/25] virtio: Fix wmb issue Ouyang Changchun
2015-02-09  1:13           ` [PATCH v4 00/26] Single virtio implementation Ouyang Changchun
     [not found]             ` <1423444455-11330-1-git-send-email-changchun.ouyang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2015-02-09  1:13               ` [PATCH v4 01/26] virtio: Rearrange resource initialization Ouyang Changchun
2015-02-09  1:13               ` [PATCH v4 02/26] virtio: Use weaker barriers Ouyang Changchun
2015-02-09  1:13               ` [PATCH v4 03/26] virtio: Allow starting with link down Ouyang Changchun
2015-02-09  1:13               ` [PATCH v4 04/26] virtio: Add support for Link State interrupt Ouyang Changchun
2015-02-09  1:13               ` [PATCH v4 05/26] ether: Add soft vlan encap/decap functions Ouyang Changchun
2015-02-09  1:13               ` [PATCH v4 06/26] virtio: Use software vlan stripping Ouyang Changchun
2015-02-09  1:13               ` [PATCH v4 07/26] virtio: Remove unnecessary adapter structure Ouyang Changchun
2015-02-09  1:13               ` [PATCH v4 08/26] virtio: Remove redundant vq_alignment Ouyang Changchun
2015-02-09  1:13               ` [PATCH v4 09/26] virtio: Fix how states are handled during initialization Ouyang Changchun
2015-02-09  1:13               ` [PATCH v4 10/26] virtio: Make vtpci_get_status local Ouyang Changchun
2015-02-09  1:14               ` [PATCH v4 11/26] virtio: Check for packet headroom at compile time Ouyang Changchun
2015-02-09  1:14               ` [PATCH v4 12/26] virtio: Move allocation before initialization Ouyang Changchun
2015-02-09  1:14               ` [PATCH v4 13/26] virtio: Add support for vlan filtering Ouyang Changchun
2015-02-09  1:14               ` [PATCH v4 14/26] virtio: Add suport for multiple mac addresses Ouyang Changchun
2015-02-09  1:14               ` [PATCH v4 15/26] virtio: Add ability to set MAC address Ouyang Changchun
2015-02-09  1:14               ` [PATCH v4 16/26] virtio: Free mbuf's with threshold Ouyang Changchun
2015-02-09  1:14               ` [PATCH v4 17/26] virtio: Use port IO to get PCI resource Ouyang Changchun
     [not found]                 ` <1423444455-11330-18-git-send-email-changchun.ouyang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2015-02-11  4:32                   ` Stephen Hemminger
     [not found]                     ` <20150210203232.6c1934ad-CA4OZQ/Yy2Lykuyl+CZolw@public.gmane.org>
2015-02-11  4:50                       ` Ouyang, Changchun
     [not found]                         ` <F52918179C57134FAEC9EA62FA2F9625119E4846-E2R4CRU6q/6iAffOGbnezLfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2015-02-11  7:29                           ` Vincent JARDIN
     [not found]                             ` <54DB04DF.4040201-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>
2015-02-11 13:50                               ` Stephen Hemminger
     [not found]                                 ` <CAOaVG1476B7GehK3kWoq4zs-+iJKDcpf9fOkOM-Ge3y+hzV94w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-02-11 14:16                                   ` Thomas Monjalon
2015-02-12  0:52                                     ` Ouyang, Changchun
2015-02-09  1:14               ` [PATCH v4 18/26] virtio: Fix descriptor index issue Ouyang Changchun
2015-02-09  1:14               ` [PATCH v4 19/26] ether: Fix vlan strip/insert issue Ouyang Changchun
2015-02-09  1:14               ` [PATCH v4 20/26] example/vhost: Avoid inserting vlan twice Ouyang Changchun
2015-02-09  1:14               ` [PATCH v4 21/26] example/vhost: Add vlan-strip cmd line option Ouyang Changchun
2015-02-09  1:14               ` [PATCH v4 22/26] virtio: Use soft vlan strip in mergeable Rx path Ouyang Changchun
2015-02-09  1:14               ` [PATCH v4 23/26] virtio: Fix zero copy break issue Ouyang Changchun
2015-02-09  1:14               ` [PATCH v4 24/26] virtio: Remove hotspots Ouyang Changchun
2015-02-09  1:14               ` [PATCH v4 25/26] virtio: Fix wmb issue Ouyang Changchun
2015-02-09  1:14               ` [PATCH v4 26/26] virtio: Fix updating vring descriptor index issue Ouyang Changchun
2015-02-17  6:04             ` [PATCH v4 00/26] Single virtio implementation Xie, Huawei
     [not found]               ` <C37D651A908B024F974696C65296B57B0F39ADCC-0J0gbvR4kThpB2pF5aRoyrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2015-02-20 18:06                 ` Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1422516249-14596-22-git-send-email-changchun.ouyang@intel.com \
    --to=changchun.ouyang-ral2jqcrhueavxtiumwx3w@public.gmane.org \
    --cc=dev-VfR2kkLFssw@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.