From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ouyang Changchun Subject: [PATCH v4 19/26] ether: Fix vlan strip/insert issue Date: Mon, 9 Feb 2015 09:14:08 +0800 Message-ID: <1423444455-11330-20-git-send-email-changchun.ouyang@intel.com> References: <1422516249-14596-1-git-send-email-changchun.ouyang@intel.com> <1423444455-11330-1-git-send-email-changchun.ouyang@intel.com> To: dev-VfR2kkLFssw@public.gmane.org Return-path: In-Reply-To: <1423444455-11330-1-git-send-email-changchun.ouyang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org> List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces-VfR2kkLFssw@public.gmane.org Sender: "dev" Need swap the data from cpu to BE(big endian) for vlan-type. Signed-off-by: Changchun Ouyang --- lib/librte_ether/rte_ether.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/librte_ether/rte_ether.h b/lib/librte_ether/rte_ether.h index 74f71c2..0797908 100644 --- a/lib/librte_ether/rte_ether.h +++ b/lib/librte_ether/rte_ether.h @@ -351,7 +351,7 @@ static inline int rte_vlan_strip(struct rte_mbuf *m) struct ether_hdr *eh = rte_pktmbuf_mtod(m, struct ether_hdr *); - if (eh->ether_type != ETHER_TYPE_VLAN) + if (eh->ether_type != rte_cpu_to_be_16(ETHER_TYPE_VLAN)) return -1; struct vlan_hdr *vh = (struct vlan_hdr *)(eh + 1); @@ -401,7 +401,7 @@ static inline int rte_vlan_insert(struct rte_mbuf **m) return -ENOSPC; memmove(nh, oh, 2 * ETHER_ADDR_LEN); - nh->ether_type = ETHER_TYPE_VLAN; + nh->ether_type = rte_cpu_to_be_16(ETHER_TYPE_VLAN); vh = (struct vlan_hdr *) (nh + 1); vh->vlan_tci = rte_cpu_to_be_16((*m)->vlan_tci); -- 1.8.4.2