From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 1FB54595E for ; Fri, 20 Nov 2015 07:29:02 +0100 (CET) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga102.fm.intel.com with ESMTP; 19 Nov 2015 22:29:02 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.20,321,1444719600"; d="scan'208";a="824769919" Received: from shvmail01.sh.intel.com ([10.239.29.42]) by orsmga001.jf.intel.com with ESMTP; 19 Nov 2015 22:29:02 -0800 Received: from shecgisg004.sh.intel.com (shecgisg004.sh.intel.com [10.239.29.89]) by shvmail01.sh.intel.com with ESMTP id tAK6SxnU005669; Fri, 20 Nov 2015 14:28:59 +0800 Received: from shecgisg004.sh.intel.com (localhost [127.0.0.1]) by shecgisg004.sh.intel.com (8.13.6/8.13.6/SuSE Linux 0.8) with ESMTP id tAK6Sv8i029425; Fri, 20 Nov 2015 14:28:59 +0800 Received: (from heshaope@localhost) by shecgisg004.sh.intel.com (8.13.6/8.13.6/Submit) id tAK6SvDv029421; Fri, 20 Nov 2015 14:28:57 +0800 From: Shaopeng He To: dev@dpdk.org Date: Fri, 20 Nov 2015 14:28:55 +0800 Message-Id: <1448000935-29391-1-git-send-email-shaopeng.he@intel.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1447836609-23944-1-git-send-email-shaopeng.he@intel.com> References: <1447836609-23944-1-git-send-email-shaopeng.he@intel.com> Subject: [dpdk-dev] [PATCH v2] fm10k: fix wrong VLAN value in RX mbuf X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 Nov 2015 06:29:03 -0000 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 --- 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