From: Huawei Xie Date: Tue, 2 Dec 2014 09:02:05 +0000 (+0800) Subject: i40e: fix vlan filtering X-Git-Tag: spdx-start~9971 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=fdef8f927f311a51ab69bbea4a7bff8e5463813c;p=dpdk.git i40e: fix vlan filtering ">> 5" rather than ">> 4" vlan id is a 12 bit value. VFTA is 128 x 32 bit array (128 double word array) which could store 2^12 vlan bits. Each bit represents whether corresponding vlan tag is set in the VSI. Use high 7 bits as the index for the double word array. Signed-off-by: Huawei Xie Acked-by: Helin Zhang Acked-by: Jing Chen --- diff --git a/lib/librte_pmd_i40e/i40e_ethdev.c b/lib/librte_pmd_i40e/i40e_ethdev.c index 002d4a9965..17876114d3 100644 --- a/lib/librte_pmd_i40e/i40e_ethdev.c +++ b/lib/librte_pmd_i40e/i40e_ethdev.c @@ -4183,14 +4183,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 >> 5) & 0x7F); + vid_bit = (uint32_t) (1 << (vlan_id & 0x1F)); if (on) vsi->vfta[vid_idx] |= vid_bit;