From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id 058667E75 for ; Thu, 4 Dec 2014 10:50:13 +0100 (CET) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga101.fm.intel.com with ESMTP; 04 Dec 2014 01:50:12 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.97,862,1389772800"; d="scan'208";a="424962678" Received: from shvmail01.sh.intel.com ([10.239.29.42]) by FMSMGA003.fm.intel.com with ESMTP; 04 Dec 2014 01:39:53 -0800 Received: from shecgisg003.sh.intel.com (shecgisg003.sh.intel.com [10.239.29.90]) by shvmail01.sh.intel.com with ESMTP id sB49o8ob021598; Thu, 4 Dec 2014 17:50:09 +0800 Received: from shecgisg003.sh.intel.com (localhost [127.0.0.1]) by shecgisg003.sh.intel.com (8.13.6/8.13.6/SuSE Linux 0.8) with ESMTP id sB49o67B006815; Thu, 4 Dec 2014 17:50:08 +0800 Received: (from jingche2@localhost) by shecgisg003.sh.intel.com (8.13.6/8.13.6/Submit) id sB49o6P9006811; Thu, 4 Dec 2014 17:50:06 +0800 From: "Chen Jing D(Mark)" To: dev@dpdk.org Date: Thu, 4 Dec 2014 17:50:05 +0800 Message-Id: <1417686605-6778-1-git-send-email-jing.d.chen@intel.com> X-Mailer: git-send-email 1.7.12.2 Subject: [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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Dec 2014 09:50:14 -0000 From: "Chen Jing D(Mark)" i40e uses an bitmap array to store those vlan tags that are set by application. In function i40e_set_vlan_filter, it stores vlan tag to wrong place. This change will fix it. Signed-off-by: Chen Jing D(Mark) --- lib/librte_pmd_i40e/i40e_ethdev.c | 11 ++++------- 1 files changed, 4 insertions(+), 7 deletions(-) diff --git a/lib/librte_pmd_i40e/i40e_ethdev.c b/lib/librte_pmd_i40e/i40e_ethdev.c index 87e750a..cebc21d 100644 --- a/lib/librte_pmd_i40e/i40e_ethdev.c +++ b/lib/librte_pmd_i40e/i40e_ethdev.c @@ -4163,8 +4163,8 @@ i40e_find_vlan_filter(struct i40e_vsi *vsi, { uint32_t vid_idx, vid_bit; - vid_idx = (uint32_t) ((vlan_id >> 5) & 0x7F); - vid_bit = (uint32_t) (1 << (vlan_id & 0x1F)); + vid_idx = (uint32_t)(vlan_id / I40E_UINT32_BIT_SIZE); + vid_bit = (uint32_t)(1 << (vlan_id % I40E_UINT32_BIT_SIZE)); if (vsi->vfta[vid_idx] & vid_bit) return 1; @@ -4178,14 +4178,11 @@ i40e_set_vlan_filter(struct i40e_vsi *vsi, { uint32_t vid_idx, vid_bit; -#define UINT32_BIT_MASK 0x1F -#define VALID_VLAN_BIT_MASK 0xFFF /* VFTA is 32-bits size array, each element contains 32 vlan bits, Find the * element first, then find the bits it belongs to */ - vid_idx = (uint32_t) ((vlan_id & VALID_VLAN_BIT_MASK) >> - sizeof(uint32_t)); - vid_bit = (uint32_t) (1 << (vlan_id & UINT32_BIT_MASK)); + vid_idx = (uint32_t)(vlan_id / I40E_UINT32_BIT_SIZE); + vid_bit = (uint32_t)(1 << (vlan_id % I40E_UINT32_BIT_SIZE)); if (on) vsi->vfta[vid_idx] |= vid_bit; -- 1.7.7.6