DPDK patches and discussions
 help / color / mirror / Atom feed
From: Shaopeng He <shaopeng.he@intel.com>
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH v2] fm10k: fix wrong VLAN value in RX mbuf
Date: Fri, 20 Nov 2015 14:28:55 +0800	[thread overview]
Message-ID: <1448000935-29391-1-git-send-email-shaopeng.he@intel.com> (raw)
In-Reply-To: <1447836609-23944-1-git-send-email-shaopeng.he@intel.com>

vlan_tci should be copied from RX descriptor to mbuf,
and flag PKT_RX_VLAN_PKT should be set for every RX packet,
this patch fixes this issue.
fm10k's Ethernet switch core associates a VLAN ID and VLAN PRI
for each packet. For those packets coming in without a VLAN,
the port default VLAN ID will be used.
So in fm10k, always PKT_RX_VLAN_PKT flag is set and vlan_tci
is valid for each RX packet's mbuf.

Signed-off-by: Shaopeng He <shaopeng.he@intel.com>
---
ChangeLog:

v2:
* change flag PKT_RX_VLAN_PKT to always set
* preserve the priority bits in vlan_tci

 drivers/net/fm10k/fm10k_rxtx.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/drivers/net/fm10k/fm10k_rxtx.c b/drivers/net/fm10k/fm10k_rxtx.c
index 1bac28d..764f4f4 100644
--- a/drivers/net/fm10k/fm10k_rxtx.c
+++ b/drivers/net/fm10k/fm10k_rxtx.c
@@ -104,8 +104,14 @@ rx_desc_to_ol_flags(struct rte_mbuf *m, const union fm10k_rx_desc *d)
 		(FM10K_RXD_STATUS_L4CS | FM10K_RXD_STATUS_L4E)))
 		m->ol_flags |= PKT_RX_L4_CKSUM_BAD;
 
-	if (d->d.staterr & FM10K_RXD_STATUS_VEXT)
-		m->ol_flags |= PKT_RX_VLAN_PKT;
+	/**
+	 * fm10k's Ethernet switch core associates a VLAN ID and VLAN PRI
+	 * for each packet. For those packets coming in without a VLAN,
+	 * the port default VLAN ID will be used.
+	 * So in fm10k, always PKT_RX_VLAN_PKT flag is set and vlan_tci
+	 * is valid for each RX packet's mbuf.
+	 */
+	m->ol_flags |= PKT_RX_VLAN_PKT;
 
 	if (unlikely(d->d.staterr & FM10K_RXD_STATUS_HBO))
 		m->ol_flags |= PKT_RX_HBUF_OVERFLOW;
@@ -146,6 +152,8 @@ fm10k_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 #endif
 
 		mbuf->hash.rss = desc.d.rss;
+		/* in fm10k, vlan_tci is always valid for RX packet */
+		mbuf->vlan_tci = desc.w.vlan;
 
 		rx_pkts[count] = mbuf;
 		if (++next_dd == q->nb_desc) {
@@ -292,6 +300,8 @@ fm10k_recv_scattered_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 		rx_desc_to_ol_flags(first_seg, &desc);
 #endif
 		first_seg->hash.rss = desc.d.rss;
+		/* in fm10k, vlan_tci is always valid for RX packet */
+		first_seg->vlan_tci = desc.w.vlan;
 
 		/* Prefetch data of first segment, if configured to do so. */
 		rte_packet_prefetch((char *)first_seg->buf_addr +
-- 
1.9.3

  parent reply	other threads:[~2015-11-20  6:29 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-18  8:50 [dpdk-dev] [PATCH] " Shaopeng He
2015-11-19  7:05 ` Chen, Jing D
2015-11-20  2:33   ` He, Shaopeng
2015-11-19 17:25 ` Stephen Hemminger
2015-11-20  2:54   ` He, Shaopeng
2015-11-20  6:28 ` Shaopeng He [this message]
2015-11-20 10:35   ` [dpdk-dev] [PATCH v2] " Chen, Jing D
2015-11-20 14:23     ` He, Shaopeng
2015-11-20 14:09   ` [dpdk-dev] [PATCH v3] " Shaopeng He
2015-11-20 16:35     ` Stephen Hemminger
2015-11-24 10:28       ` 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=1448000935-29391-1-git-send-email-shaopeng.he@intel.com \
    --to=shaopeng.he@intel.com \
    --cc=dev@dpdk.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).