diff mbox

[dpdk-dev,19/22] ether: Fix vlan strip/insert issue

Message ID 1421298930-15210-20-git-send-email-changchun.ouyang@intel.com (mailing list archive)
State Superseded, archived
Headers show

Commit Message

Ouyang Changchun Jan. 15, 2015, 5:15 a.m. UTC
Need swap the data from cpu to BE(big endian) for vlan-type.

Signed-off-by: Changchun Ouyang <changchun.ouyang@intel.com>
---
 lib/librte_ether/rte_ether.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff mbox

Patch

diff --git a/lib/librte_ether/rte_ether.h b/lib/librte_ether/rte_ether.h
index 3b6ab4b..90fb3c9 100644
--- a/lib/librte_ether/rte_ether.h
+++ b/lib/librte_ether/rte_ether.h
@@ -350,7 +350,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);
@@ -400,7 +400,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);