DPDK patches and discussions
 help / color / mirror / Atom feed
From: Qiming Chen <chenqiming_huawei@163.com>
To: dev@dpdk.org
Cc: beilei.xing@intel.com, Qiming Chen <chenqiming_huawei@163.com>
Subject: [dpdk-dev] [PATCH v2] net/i40e: solve the failure of vf vlan filtering
Date: Tue, 24 Aug 2021 17:29:51 +0800	[thread overview]
Message-ID: <20210824092951.9701-1-chenqiming_huawei@163.com> (raw)
In-Reply-To: <20210824085101.9142-1-chenqiming_huawei@163.com>

When vf driver port promiscuous is turned on, the vlan filtering function
is invalid.
Through communication with PAE expert, this is a limitation of the i40e
chip. Before adding or removing VLANs, you must first disable unicast
promiscuous or multicast promiscuous, then operate the vlan, and finally
restore unicast promiscuous or multicast promiscuous state.

Signed-off-by: Qiming Chen <chenqiming_huawei@163.com>
---
 drivers/net/i40e/i40e_ethdev_vf.c | 23 +++++++++++++++++++++--
 1 file changed, 21 insertions(+), 2 deletions(-)

diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c
index 12e69a3233..a099daae6b 100644
--- a/drivers/net/i40e/i40e_ethdev_vf.c
+++ b/drivers/net/i40e/i40e_ethdev_vf.c
@@ -1900,11 +1900,30 @@ static int
 i40evf_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on)
 {
 	int ret;
+	struct rte_eth_conf *dev_conf = &dev->data->dev_conf;
+	struct i40e_vf *vf = I40EVF_DEV_PRIVATE_TO_VF(dev->data->dev_private);
+	bool promisc_unicast_enabled = vf->promisc_unicast_enabled;
+	bool promisc_multicast_enabled = vf->promisc_multicast_enabled;
 
-	if (on)
+	if (promisc_unicast_enabled)
+		i40evf_dev_promiscuous_disable(dev);
+
+	if (promisc_multicast_enabled)
+		i40evf_dev_allmulticast_disable(dev);
+
+	if (on) {
 		ret = i40evf_add_vlan(dev, vlan_id);
-	else
+		if ((dev_conf->rxmode.offloads & DEV_RX_OFFLOAD_VLAN_STRIP) == 0)
+			i40evf_disable_vlan_strip(dev);
+	} else {
 		ret = i40evf_del_vlan(dev,vlan_id);
+	}
+
+	if (promisc_unicast_enabled)
+		i40evf_dev_promiscuous_enable(dev);
+
+	if (promisc_multicast_enabled)
+		i40evf_dev_allmulticast_enable(dev);
 
 	return ret;
 }
-- 
2.30.1.windows.1


  reply	other threads:[~2021-08-24  9:30 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-24  8:51 [dpdk-dev] [PATCH] " Qiming Chen
2021-08-24  9:29 ` Qiming Chen [this message]
2021-08-25  7:13   ` [dpdk-dev] [PATCH v2] " Xing, Beilei
2021-08-26  9:40     ` Qiming Chen
2021-08-26 14:01   ` [dpdk-dev] [PATCH v3] net/i40e: solve vf vlan strip Qiming Chen
2021-08-26 14:09     ` Qiming Chen
2021-08-30  0:49       ` Zhang, Qi Z

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210824092951.9701-1-chenqiming_huawei@163.com \
    --to=chenqiming_huawei@163.com \
    --cc=beilei.xing@intel.com \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).