summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHuawei Xie <huawei.xie@intel.com>2014-12-02 17:02:05 +0800
committerThomas Monjalon <thomas.monjalon@6wind.com>2014-12-06 11:08:35 +0100
commitfdef8f927f311a51ab69bbea4a7bff8e5463813c (patch)
tree69026fbcfe8aa0c269ddb46160bd5e35d54bf948
parent51e16682cf5c8ee64b4ce4cc6a18d6d8f5e68948 (diff)
downloaddpdk-fdef8f927f311a51ab69bbea4a7bff8e5463813c.zip
dpdk-fdef8f927f311a51ab69bbea4a7bff8e5463813c.tar.gz
dpdk-fdef8f927f311a51ab69bbea4a7bff8e5463813c.tar.xz
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 <huawei.xie@intel.com> Acked-by: Helin Zhang <helin.zhang@intel.com> Acked-by: Jing Chen <jing.d.chen@intel.com>
-rw-r--r--lib/librte_pmd_i40e/i40e_ethdev.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/lib/librte_pmd_i40e/i40e_ethdev.c b/lib/librte_pmd_i40e/i40e_ethdev.c
index 002d4a9..1787611 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;