diff mbox

[dpdk-dev,v3] i40e: fix VLAN filter in promiscuous mode

Message ID 1467249955-1420-1-git-send-email-jingjing.wu@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Bruce Richardson
Headers show

Commit Message

Wu, Jingjing June 30, 2016, 1:25 a.m. UTC
For VLAN filtering VLAN table should be enabled.
But VLAN table is disabled by default until a rule added. In
promiscuous mode no rule is added to enable the VLAN table.

So this patch clears promiscuous VLAN flag on VSI, and adds a
rule to enable VLAN table to fix VLAN filtering in promiscuous
mode.

Fixes: 4861cde46116 ("i40e: new poll mode driver")
Signed-off-by: Jingjing Wu <jingjing.wu@intel.com>
---
v2
 * commit log rework.
v3
 * commit log rework.

 drivers/net/i40e/i40e_ethdev.c | 23 +++++++++++++++++++----
 1 file changed, 19 insertions(+), 4 deletions(-)

Comments

Helin Zhang July 4, 2016, 6:33 a.m. UTC | #1
> -----Original Message-----
> From: Wu, Jingjing
> Sent: Thursday, June 30, 2016 9:26 AM
> To: Zhang, Helin
> Cc: dev@dpdk.org; Wu, Jingjing; Yigit, Ferruh
> Subject: [PATCH v3] i40e: fix VLAN filter in promiscuous mode
> 
> For VLAN filtering VLAN table should be enabled.
> But VLAN table is disabled by default until a rule added. In promiscuous mode
> no rule is added to enable the VLAN table.
> 
> So this patch clears promiscuous VLAN flag on VSI, and adds a rule to enable
> VLAN table to fix VLAN filtering in promiscuous mode.
> 
> Fixes: 4861cde46116 ("i40e: new poll mode driver")
> Signed-off-by: Jingjing Wu <jingjing.wu@intel.com>
Acked-by: Helin Zhang <helin.zhang@intel.com>
Bruce Richardson July 4, 2016, 1:45 p.m. UTC | #2
On Mon, Jul 04, 2016 at 06:33:30AM +0000, Zhang, Helin wrote:
> 
> 
> > -----Original Message-----
> > From: Wu, Jingjing
> > Sent: Thursday, June 30, 2016 9:26 AM
> > To: Zhang, Helin
> > Cc: dev@dpdk.org; Wu, Jingjing; Yigit, Ferruh
> > Subject: [PATCH v3] i40e: fix VLAN filter in promiscuous mode
> > 
> > For VLAN filtering VLAN table should be enabled.
> > But VLAN table is disabled by default until a rule added. In promiscuous mode
> > no rule is added to enable the VLAN table.
> > 
> > So this patch clears promiscuous VLAN flag on VSI, and adds a rule to enable
> > VLAN table to fix VLAN filtering in promiscuous mode.
> > 
> > Fixes: 4861cde46116 ("i40e: new poll mode driver")
> > Signed-off-by: Jingjing Wu <jingjing.wu@intel.com>
> Acked-by: Helin Zhang <helin.zhang@intel.com>

Applied to dpdk-next-net/rel_16_07

/Bruce
diff mbox

Patch

diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index c07da1b..7ddd93a 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -2709,12 +2709,16 @@  i40e_vlan_offload_set(struct rte_eth_dev *dev, int mask)
 {
 	struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
 	struct i40e_vsi *vsi = pf->main_vsi;
+	struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
 
 	if (mask & ETH_VLAN_FILTER_MASK) {
-		if (dev->data->dev_conf.rxmode.hw_vlan_filter)
+		if (dev->data->dev_conf.rxmode.hw_vlan_filter) {
+			i40e_aq_set_vsi_vlan_promisc(hw, vsi->seid, false, NULL);
 			i40e_vsi_config_vlan_filter(vsi, TRUE);
-		else
+		} else {
+			i40e_aq_set_vsi_vlan_promisc(hw, vsi->seid, true, NULL);
 			i40e_vsi_config_vlan_filter(vsi, FALSE);
+		}
 	}
 
 	if (mask & ETH_VLAN_STRIP_MASK) {
@@ -5760,17 +5764,28 @@  i40e_set_vlan_filter(struct i40e_vsi *vsi,
 			 uint16_t vlan_id, bool on)
 {
 	uint32_t vid_idx, vid_bit;
+	struct i40e_hw *hw = I40E_VSI_TO_HW(vsi);
+	struct i40e_aqc_add_remove_vlan_element_data vlan_data = {0};
+	int ret;
 
 	if (vlan_id > ETH_VLAN_ID_MAX)
 		return;
 
 	vid_idx = I40E_VFTA_IDX(vlan_id);
 	vid_bit = I40E_VFTA_BIT(vlan_id);
+	vlan_data.vlan_tag = rte_cpu_to_le_16(vlan_id);
 
-	if (on)
+	if (on) {
+		ret = i40e_aq_add_vlan(hw, vsi->seid, &vlan_data, 1, NULL);
+		if (ret != I40E_SUCCESS)
+			PMD_DRV_LOG(ERR, "Failed to add vlan filter");
 		vsi->vfta[vid_idx] |= vid_bit;
-	else
+	} else {
+		ret = i40e_aq_remove_vlan(hw, vsi->seid, &vlan_data, 1, NULL);
+		if (ret != I40E_SUCCESS)
+			PMD_DRV_LOG(ERR, "Failed to remove vlan filter");
 		vsi->vfta[vid_idx] &= ~vid_bit;
+	}
 }
 
 /**