From mboxrd@z Thu Jan 1 00:00:00 1970 From: Pawel Wodkowski Subject: [PATCH v4 7/7] pmd ixgbe: fix vlan setting in in PF Date: Thu, 19 Feb 2015 16:54:49 +0100 Message-ID: <1424361289-30718-8-git-send-email-pawelx.wodkowski@intel.com> References: <1421672551-11652-1-git-send-email-pawelx.wodkowski@intel.com> <1424361289-30718-1-git-send-email-pawelx.wodkowski@intel.com> To: dev-VfR2kkLFssw@public.gmane.org Return-path: In-Reply-To: <1424361289-30718-1-git-send-email-pawelx.wodkowski-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org> List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces-VfR2kkLFssw@public.gmane.org Sender: "dev" The ixgbe_vlan_filter_set() should use hw->mac.ops.set_vfta() to set VLAN filtering as this is generic function that handles both non-SRIOV and SRIOV cases. Bug was discovered issuing command in testpmd 'rx_vlan add VLAN PORT' for PF. Requested VLAN was enabled but pool mask is not set. Only command 'rx_vlan add VLAN port PORT vf MASK' can enable pointed VLAN id for PF. Signed-off-by: Pawel Wodkowski --- lib/librte_pmd_ixgbe/ixgbe_ethdev.c | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/lib/librte_pmd_ixgbe/ixgbe_ethdev.c b/lib/librte_pmd_ixgbe/ixgbe_ethdev.c index 7551bcc..7aef0e8 100644 --- a/lib/librte_pmd_ixgbe/ixgbe_ethdev.c +++ b/lib/librte_pmd_ixgbe/ixgbe_ethdev.c @@ -1162,21 +1162,18 @@ ixgbe_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on) IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private); struct ixgbe_vfta * shadow_vfta = IXGBE_DEV_PRIVATE_TO_VFTA(dev->data->dev_private); - uint32_t vfta; + struct rte_eth_dev_sriov *sriov = &RTE_ETH_DEV_SRIOV(dev); + u32 vind = sriov->active ? sriov->def_vmdq_idx : 0; + s32 ret_val; uint32_t vid_idx; - uint32_t vid_bit; - vid_idx = (uint32_t) ((vlan_id >> 5) & 0x7F); - vid_bit = (uint32_t) (1 << (vlan_id & 0x1F)); - vfta = IXGBE_READ_REG(hw, IXGBE_VFTA(vid_idx)); - if (on) - vfta |= vid_bit; - else - vfta &= ~vid_bit; - IXGBE_WRITE_REG(hw, IXGBE_VFTA(vid_idx), vfta); + ret_val = hw->mac.ops.set_vfta(hw, vlan_id, vind, on); + if (ret_val != IXGBE_SUCCESS) + return ret_val; + vid_idx = (uint32_t) ((vlan_id >> 5) & 0x7F); /* update local VFTA copy */ - shadow_vfta->vfta[vid_idx] = vfta; + shadow_vfta->vfta[vid_idx] = IXGBE_READ_REG(hw, IXGBE_VFTA(vid_idx)); return 0; } -- 1.9.1