From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 359ADB3D4 for ; Thu, 5 Feb 2015 01:54:37 +0100 (CET) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga102.jf.intel.com with ESMTP; 04 Feb 2015 16:51:00 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.09,521,1418112000"; d="scan'208";a="522758995" Received: from kmsmsx152.gar.corp.intel.com ([172.21.73.87]) by orsmga003.jf.intel.com with ESMTP; 04 Feb 2015 16:46:50 -0800 Received: from shsmsx103.ccr.corp.intel.com (10.239.110.14) by KMSMSX152.gar.corp.intel.com (172.21.73.87) with Microsoft SMTP Server (TLS) id 14.3.195.1; Thu, 5 Feb 2015 08:54:29 +0800 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.124]) by SHSMSX103.ccr.corp.intel.com ([169.254.4.91]) with mapi id 14.03.0195.001; Thu, 5 Feb 2015 08:54:30 +0800 From: "Ouyang, Changchun" To: "Xie, Huawei" , "dev@dpdk.org" Thread-Topic: [PATCH v3 19/25] ether: Fix vlan strip/insert issue Thread-Index: AQHQO5S03BBqxicPXEqTMFt2zTFrKpzhRLrg Date: Thu, 5 Feb 2015 00:54:27 +0000 Message-ID: References: <1422326164-13697-1-git-send-email-changchun.ouyang@intel.com> <1422516249-14596-1-git-send-email-changchun.ouyang@intel.com> <1422516249-14596-20-git-send-email-changchun.ouyang@intel.com> In-Reply-To: Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH v3 19/25] 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: , X-List-Received-Date: Thu, 05 Feb 2015 00:54:37 -0000 Hi huawei, > -----Original Message----- > From: Xie, Huawei > Sent: Wednesday, February 4, 2015 6:54 PM > To: Ouyang, Changchun; dev@dpdk.org > Cc: stephen@networkplumber.org; Cao, Waterman; Xu, Qian Q > Subject: Re: [PATCH v3 19/25] ether: Fix vlan strip/insert issue >=20 > On 1/29/2015 3:24 PM, Ouyang Changchun wrote: > > 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 > > =3D rte_pktmbuf_mtod(m, struct ether_hdr *); > > > > - if (eh->ether_type !=3D ETHER_TYPE_VLAN) > > + if (eh->ether_type !=3D rte_cpu_to_be_16(ETHER_TYPE_VLAN)) > rte_be_to_cpu_16? Eh->ether_type is in network byte order(big endian), While ETHER_TYPE_VLAN is host byte order(little endian on x86), so it need= change into big endian. > > return -1; > > > > struct vlan_hdr *vh =3D (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 =3D ETHER_TYPE_VLAN; > > + nh->ether_type =3D rte_cpu_to_be_16(ETHER_TYPE_VLAN); > rte_be_to_cpu_16? Similar reason as above. Thanks Changchun