summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShaopeng He <shaopeng.he@intel.com>2015-11-20 22:09:47 +0800
committerThomas Monjalon <thomas.monjalon@6wind.com>2015-11-24 12:35:19 +0100
commit6b59a3bc82b1cb2e69b9a68bc2f0c476bc6d193e (patch)
tree5996ba293a233f1d0dd01e551b1ac0d6289240f4
parent4522eca1352d8ed7c0823e328e2a68c2ba6459ab (diff)
downloaddpdk-next-eventdev-6b59a3bc82b1.zip
dpdk-next-eventdev-6b59a3bc82b1.tar.gz
dpdk-next-eventdev-6b59a3bc82b1.tar.xz
fm10k: fix VLAN in Rx mbuf
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. Packets in fm10k device always carry at least one VLAN tag. For those packets coming in without VLAN tag, the port default VLAN tag 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> Acked-by: Stephen Hemminger <stephen@networkplumber.org>
-rw-r--r--drivers/net/fm10k/fm10k_rxtx.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/drivers/net/fm10k/fm10k_rxtx.c b/drivers/net/fm10k/fm10k_rxtx.c
index 1bac28d..e958865 100644
--- a/drivers/net/fm10k/fm10k_rxtx.c
+++ b/drivers/net/fm10k/fm10k_rxtx.c
@@ -104,9 +104,6 @@ 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;
-
if (unlikely(d->d.staterr & FM10K_RXD_STATUS_HBO))
m->ol_flags |= PKT_RX_HBUF_OVERFLOW;
@@ -146,6 +143,15 @@ fm10k_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
#endif
mbuf->hash.rss = desc.d.rss;
+ /**
+ * Packets in fm10k device always carry at least one VLAN tag.
+ * For those packets coming in without VLAN tag,
+ * the port default VLAN tag will be used.
+ * So, always PKT_RX_VLAN_PKT flag is set and vlan_tci
+ * is valid for each RX packet's mbuf.
+ */
+ mbuf->ol_flags |= PKT_RX_VLAN_PKT;
+ mbuf->vlan_tci = desc.w.vlan;
rx_pkts[count] = mbuf;
if (++next_dd == q->nb_desc) {
@@ -292,6 +298,15 @@ 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;
+ /**
+ * Packets in fm10k device always carry at least one VLAN tag.
+ * For those packets coming in without VLAN tag,
+ * the port default VLAN tag will be used.
+ * So, always PKT_RX_VLAN_PKT flag is set and vlan_tci
+ * is valid for each RX packet's mbuf.
+ */
+ mbuf->ol_flags |= PKT_RX_VLAN_PKT;
+ 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 +