From patchwork Mon Feb 9 01:14:08 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ouyang Changchun X-Patchwork-Id: 3050 Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id B4D149AAA; Mon, 9 Feb 2015 02:15:10 +0100 (CET) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id DB2FC9AAA for ; Mon, 9 Feb 2015 02:15:09 +0100 (CET) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga102.fm.intel.com with ESMTP; 08 Feb 2015 17:15:08 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.09,540,1418112000"; d="scan'208";a="674856171" Received: from shvmail01.sh.intel.com ([10.239.29.42]) by fmsmga002.fm.intel.com with ESMTP; 08 Feb 2015 17:15:07 -0800 Received: from shecgisg004.sh.intel.com (shecgisg004.sh.intel.com [10.239.29.89]) by shvmail01.sh.intel.com with ESMTP id t191F5uK018028; Mon, 9 Feb 2015 09:15:05 +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 t191F2HU011532; Mon, 9 Feb 2015 09:15:04 +0800 Received: (from couyang@localhost) by shecgisg004.sh.intel.com (8.13.6/8.13.6/Submit) id t191F2hm011528; Mon, 9 Feb 2015 09:15:02 +0800 From: Ouyang Changchun To: dev@dpdk.org Date: Mon, 9 Feb 2015 09:14:08 +0800 Message-Id: <1423444455-11330-20-git-send-email-changchun.ouyang@intel.com> X-Mailer: git-send-email 1.7.12.2 In-Reply-To: <1423444455-11330-1-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> Subject: [dpdk-dev] [PATCH v4 19/26] ether: Fix vlan strip/insert issue 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: , Errors-To: dev-bounces@dpdk.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);