From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by dpdk.org (Postfix) with ESMTP id B2F8B1B1AB for ; Wed, 11 Oct 2017 03:32:07 +0200 (CEST) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga104.jf.intel.com with ESMTP; 10 Oct 2017 18:32:06 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.43,359,1503385200"; d="scan'208";a="908725010" Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by FMSMGA003.fm.intel.com with ESMTP; 10 Oct 2017 18:32:06 -0700 Received: from fmsmsx124.amr.corp.intel.com (10.18.125.39) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.319.2; Tue, 10 Oct 2017 18:32:06 -0700 Received: from shsmsx152.ccr.corp.intel.com (10.239.6.52) by fmsmsx124.amr.corp.intel.com (10.18.125.39) with Microsoft SMTP Server (TLS) id 14.3.319.2; Tue, 10 Oct 2017 18:32:05 -0700 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.175]) by SHSMSX152.ccr.corp.intel.com ([169.254.6.93]) with mapi id 14.03.0319.002; Wed, 11 Oct 2017 09:32:04 +0800 From: "Lu, Wenzhuo" To: Roger B Melton CC: "dev@dpdk.org" Thread-Topic: [PATCH] net/e1000: i350 VLAN tags in loopback packets are big endian Thread-Index: AQHTPvuY6qscqtzoHEGAc9MArtq4PKLd14XQ Date: Wed, 11 Oct 2017 01:32:02 +0000 Message-ID: <6A0DE07E22DDAD4C9103DF62FEBC09093B6C2328@shsmsx102.ccr.corp.intel.com> References: <20171006233355.9378-1-rmelton@cisco.com> In-Reply-To: <20171006233355.9378-1-rmelton@cisco.com> Accept-Language: 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] net/e1000: i350 VLAN tags in loopback packets are big endian X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Oct 2017 01:32:08 -0000 Hi Roger, > -----Original Message----- > From: Roger B Melton [mailto:rmelton@cisco.com] > Sent: Saturday, October 7, 2017 7:34 AM > To: Lu, Wenzhuo > Cc: dev@dpdk.org; Roger B Melton > Subject: [PATCH] net/e1000: i350 VLAN tags in loopback packets are big > endian >=20 > When copying VLAN tags from the RX descriptor to the vlan_tci field in th= e > mbuf header, igb_rxtx.c:eth_igb_recv_pkts() and > eth_igb_recv_scattered_pkts() both assume that the VLAN tag is always lit= tle > endian. While i350 VLAN non-loopback packets are stored little endian, > VLAN tags for i350 VLAN loopback packets are big endian. >=20 > For i350 VLAN loopback packets, swap the tag when copying from the RX > descriptor to the mbuf header. This will ensure that the mbuf vlan_tci i= s > always little endian. >=20 > Signed-off-by: Roger B Melton > --- > drivers/net/e1000/igb_rxtx.c | 56 > ++++++++++++++++++++++++++++++++++++++++---- > 1 file changed, 51 insertions(+), 5 deletions(-) >=20 > diff --git a/drivers/net/e1000/igb_rxtx.c b/drivers/net/e1000/igb_rxtx.c = index > 1c80a2a..8432d8b 100644 > --- a/drivers/net/e1000/igb_rxtx.c > +++ b/drivers/net/e1000/igb_rxtx.c > @@ -2278,6 +2300,18 @@ eth_igb_rx_init(struct rte_eth_dev *dev) >=20 > rxq =3D dev->data->rx_queues[i]; >=20 > + rxq->flags =3D 0; > + /* > + * The i210, i211, i350, i354 and i350VF LB vlan packets > + * have vlan tags byte swapped. > + */ > + if (hw->mac.type >=3D e1000_i350) { Many thanks for the patch. I think we need to check i350 and i354 here as LB bit is only meaningful on= these NICs. > + rxq->flags |=3D IGB_RXQ_FLAG_LB_BSWAP_VLAN; > + PMD_INIT_LOG(DEBUG, "IGB rx vlan bswap > required"); > + } else { > + PMD_INIT_LOG(DEBUG, "IGB rx vlan bswap not > required"); > + } > + > /* Allocate buffers for descriptor rings and set up queue */ > ret =3D igb_alloc_rx_queue_mbufs(rxq); > if (ret) > @@ -2557,6 +2591,18 @@ eth_igbvf_rx_init(struct rte_eth_dev *dev) >=20 > rxq =3D dev->data->rx_queues[i]; >=20 > + rxq->flags =3D 0; > + /* > + * The i210, i211, i350, i354 and i350VF LB vlan packets > + * have vlan tags byte swapped. > + */ > + if (hw->mac.type >=3D e1000_i350) { We need to check e1000_vfadapt_i350 here to exclude e1000_vfadapt. > + rxq->flags |=3D IGB_RXQ_FLAG_LB_BSWAP_VLAN; > + PMD_INIT_LOG(DEBUG, "IGB rx vlan bswap > required"); > + } else { > + PMD_INIT_LOG(DEBUG, "IGB rx vlan bswap not > required"); > + } > + > /* Allocate buffers for descriptor rings and set up queue */ > ret =3D igb_alloc_rx_queue_mbufs(rxq); > if (ret) > -- > 2.10.3.dirty