From: Stephen Hemminger <stephen@networkplumber.org>
To: dev@dpdk.org
Cc: Stephen Hemminger <stephen@networkplumber.org>,
Stephen Hemminger <sthemmin@microsoft.com>
Subject: [PATCH 1/3] net/netvsc: support receive without vlan strip
Date: Thu, 13 Dec 2018 17:26:19 -0800 [thread overview]
Message-ID: <20181214012621.15213-2-stephen@networkplumber.org> (raw)
In-Reply-To: <20181214012621.15213-1-stephen@networkplumber.org>
In some cases, VLAN stripping is not desireable. If necessary
re-insert stripped vlan tag.
Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
---
drivers/net/netvsc/hn_ethdev.c | 2 ++
drivers/net/netvsc/hn_rxtx.c | 8 ++++++++
drivers/net/netvsc/hn_var.h | 5 +++--
3 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/drivers/net/netvsc/hn_ethdev.c b/drivers/net/netvsc/hn_ethdev.c
index b330bf3d7255..d7ac0c7320b0 100644
--- a/drivers/net/netvsc/hn_ethdev.c
+++ b/drivers/net/netvsc/hn_ethdev.c
@@ -378,6 +378,8 @@ static int hn_dev_configure(struct rte_eth_dev *dev)
return -EINVAL;
}
+ hv->vlan_strip = !!(rxmode->offloads & DEV_RX_OFFLOAD_VLAN_STRIP);
+
err = hn_rndis_conf_offload(hv, txmode->offloads,
rxmode->offloads);
if (err) {
diff --git a/drivers/net/netvsc/hn_rxtx.c b/drivers/net/netvsc/hn_rxtx.c
index f4a36641b6c3..622a83983e10 100644
--- a/drivers/net/netvsc/hn_rxtx.c
+++ b/drivers/net/netvsc/hn_rxtx.c
@@ -501,6 +501,14 @@ static void hn_rxpkt(struct hn_rx_queue *rxq, struct hn_rx_bufinfo *rxb,
if (info->vlan_info != HN_NDIS_VLAN_INFO_INVALID) {
m->vlan_tci = info->vlan_info;
m->ol_flags |= PKT_RX_VLAN_STRIPPED | PKT_RX_VLAN;
+
+ /* NDIS always strips tag, put it back if necessary */
+ if (!hv->vlan_strip && rte_vlan_insert(&m)) {
+ PMD_DRV_LOG(DEBUG, "vlan insert failed");
+ ++rxq->stats.errors;
+ rte_pktmbuf_free(m);
+ return;
+ }
}
if (info->csum_info != HN_NDIS_RXCSUM_INFO_INVALID) {
diff --git a/drivers/net/netvsc/hn_var.h b/drivers/net/netvsc/hn_var.h
index e1072c7cfa55..cd173f6af942 100644
--- a/drivers/net/netvsc/hn_var.h
+++ b/drivers/net/netvsc/hn_var.h
@@ -97,8 +97,9 @@ struct hn_data {
struct rte_eth_dev *vf_dev; /* Subordinate device */
rte_spinlock_t vf_lock;
uint16_t port_id;
- bool closed;
- bool vf_present;
+ uint8_t closed;
+ uint8_t vf_present;
+ uint8_t vlan_strip;
uint32_t link_status;
uint32_t link_speed;
--
2.19.2
next prev parent reply other threads:[~2018-12-14 1:26 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-14 1:26 [PATCH 0/3] net/netvsc: misc fixes Stephen Hemminger
2018-12-14 1:26 ` Stephen Hemminger [this message]
2018-12-14 16:09 ` [PATCH 1/3] net/netvsc: support receive without vlan strip Ferruh Yigit
2018-12-14 16:28 ` Stephen Hemminger
2018-12-17 10:27 ` Ferruh Yigit
2018-12-14 1:26 ` [PATCH 2/3] net/netvsc: cleanup transmit descriptor pool Stephen Hemminger
2018-12-17 10:46 ` Ferruh Yigit
2018-12-17 22:11 ` Ferruh Yigit
2018-12-14 1:26 ` [PATCH 3/3] net/netvsc: not finding VF should not cause failure Stephen Hemminger
2018-12-17 10:49 ` Ferruh Yigit
[not found] ` <DM5PR21MB0698C89DE76C533F41190931CCBC0@DM5PR21MB0698.namprd21.prod.outlook.com>
2018-12-17 22:11 ` Ferruh Yigit
2018-12-17 22:12 ` Ferruh Yigit
2018-12-17 22:13 ` [PATCH 0/3] net/netvsc: misc fixes Ferruh Yigit
2018-12-18 6:32 ` Stephen Hemminger
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=20181214012621.15213-2-stephen@networkplumber.org \
--to=stephen@networkplumber.org \
--cc=dev@dpdk.org \
--cc=sthemmin@microsoft.com \
/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.