From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <michael.qiu@intel.com>
Received: from mga11.intel.com (mga11.intel.com [192.55.52.93])
 by dpdk.org (Postfix) with ESMTP id 392987E75
 for <dev@dpdk.org>; Thu,  4 Dec 2014 11:18:51 +0100 (CET)
Received: from fmsmga002.fm.intel.com ([10.253.24.26])
 by fmsmga102.fm.intel.com with ESMTP; 04 Dec 2014 02:18:50 -0800
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.07,514,1413270000"; d="scan'208";a="642266973"
Received: from pgsmsx103.gar.corp.intel.com ([10.221.44.82])
 by fmsmga002.fm.intel.com with ESMTP; 04 Dec 2014 02:18:49 -0800
Received: from shsmsx104.ccr.corp.intel.com (10.239.4.70) by
 PGSMSX103.gar.corp.intel.com (10.221.44.82) with Microsoft SMTP Server (TLS)
 id 14.3.195.1; Thu, 4 Dec 2014 18:18:48 +0800
Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.110]) by
 SHSMSX104.ccr.corp.intel.com ([169.254.5.182]) with mapi id 14.03.0195.001;
 Thu, 4 Dec 2014 18:18:41 +0800
From: "Qiu, Michael" <michael.qiu@intel.com>
To: "Chen, Jing D" <jing.d.chen@intel.com>, "dev@dpdk.org" <dev@dpdk.org>
Thread-Topic: [dpdk-dev] [PATCH] i40e: Fix a vlan bug
Thread-Index: AQHQD6fZrH4WpLjbN0KTm8KpCWnh4A==
Date: Thu, 4 Dec 2014 10:18:40 +0000
Message-ID: <533710CFB86FA344BFBF2D6802E60286C9CAEC@SHSMSX101.ccr.corp.intel.com>
References: <1417686605-6778-1-git-send-email-jing.d.chen@intel.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] i40e: Fix a vlan bug
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: patches and discussions about DPDK <dev.dpdk.org>
List-Unsubscribe: <http://dpdk.org/ml/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://dpdk.org/ml/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <http://dpdk.org/ml/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Thu, 04 Dec 2014 10:18:51 -0000

Hi Mark,=0A=
=0A=
I think Huawei (huawei.xie@intel.com) has one patch set to fix this issue.=
=0A=
=0A=
If your patch is totally different with him:=0A=
=0A=
[dpdk-dev] [PATCH v4 0/2] lib/librte_pmd_i40e: set vlan filter fix=0A=
=0A=
please ignore my comments :)=0A=
=0A=
But you both calculation are different.=0A=
=0A=
Thanks,=0A=
Michael=0A=
On 12/4/2014 5:51 PM, Chen Jing D(Mark) wrote:=0A=
> From: "Chen Jing D(Mark)" <jing.d.chen@intel.com>=0A=
>=0A=
> i40e uses an bitmap array to store those vlan tags that are set by=0A=
> application. In function i40e_set_vlan_filter, it stores vlan tag=0A=
> to wrong place. This change will fix it.=0A=
>=0A=
> Signed-off-by: Chen Jing D(Mark) <jing.d.chen@intel.com>=0A=
> ---=0A=
>  lib/librte_pmd_i40e/i40e_ethdev.c |   11 ++++-------=0A=
>  1 files changed, 4 insertions(+), 7 deletions(-)=0A=
>=0A=
> diff --git a/lib/librte_pmd_i40e/i40e_ethdev.c b/lib/librte_pmd_i40e/i40e=
_ethdev.c=0A=
> index 87e750a..cebc21d 100644=0A=
> --- a/lib/librte_pmd_i40e/i40e_ethdev.c=0A=
> +++ b/lib/librte_pmd_i40e/i40e_ethdev.c=0A=
> @@ -4163,8 +4163,8 @@ i40e_find_vlan_filter(struct i40e_vsi *vsi,=0A=
>  {=0A=
>  	uint32_t vid_idx, vid_bit;=0A=
>  =0A=
> -	vid_idx =3D (uint32_t) ((vlan_id >> 5) & 0x7F);=0A=
> -	vid_bit =3D (uint32_t) (1 << (vlan_id & 0x1F));=0A=
> +	vid_idx =3D (uint32_t)(vlan_id / I40E_UINT32_BIT_SIZE);=0A=
> +	vid_bit =3D (uint32_t)(1 << (vlan_id % I40E_UINT32_BIT_SIZE));=0A=
>  =0A=
>  	if (vsi->vfta[vid_idx] & vid_bit)=0A=
>  		return 1;=0A=
> @@ -4178,14 +4178,11 @@ i40e_set_vlan_filter(struct i40e_vsi *vsi,=0A=
>  {=0A=
>  	uint32_t vid_idx, vid_bit;=0A=
>  =0A=
> -#define UINT32_BIT_MASK      0x1F=0A=
> -#define VALID_VLAN_BIT_MASK  0xFFF=0A=
>  	/* VFTA is 32-bits size array, each element contains 32 vlan bits, Find=
 the=0A=
>  	 *  element first, then find the bits it belongs to=0A=
>  	 */=0A=
> -	vid_idx =3D (uint32_t) ((vlan_id & VALID_VLAN_BIT_MASK) >>=0A=
> -		  sizeof(uint32_t));=0A=
> -	vid_bit =3D (uint32_t) (1 << (vlan_id & UINT32_BIT_MASK));=0A=
> +	vid_idx =3D (uint32_t)(vlan_id / I40E_UINT32_BIT_SIZE);=0A=
> +	vid_bit =3D (uint32_t)(1 << (vlan_id % I40E_UINT32_BIT_SIZE));=0A=
>  =0A=
>  	if (on)=0A=
>  		vsi->vfta[vid_idx] |=3D vid_bit;=0A=
=0A=