DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] net/i40e: solve the failure of vf vlan filtering
@ 2021-08-24  8:51 Qiming Chen
  2021-08-24  9:29 ` [dpdk-dev] [PATCH v2] " Qiming Chen
  0 siblings, 1 reply; 7+ messages in thread
From: Qiming Chen @ 2021-08-24  8:51 UTC (permalink / raw)
  To: dev; +Cc: beilei.xing, Qiming Chen

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 | 22 ++++++++++++++++++++--
 1 file changed, 20 insertions(+), 2 deletions(-)

diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c
index 12e69a3233..a6f87aa1e6 100644
--- a/drivers/net/i40e/i40e_ethdev_vf.c
+++ b/drivers/net/i40e/i40e_ethdev_vf.c
@@ -1900,12 +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


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [dpdk-dev] [PATCH v2] net/i40e: solve the failure of vf vlan filtering
  2021-08-24  8:51 [dpdk-dev] [PATCH] net/i40e: solve the failure of vf vlan filtering Qiming Chen
@ 2021-08-24  9:29 ` Qiming Chen
  2021-08-25  7:13   ` Xing, Beilei
  2021-08-26 14:01   ` [dpdk-dev] [PATCH v3] net/i40e: solve vf vlan strip Qiming Chen
  0 siblings, 2 replies; 7+ messages in thread
From: Qiming Chen @ 2021-08-24  9:29 UTC (permalink / raw)
  To: dev; +Cc: beilei.xing, Qiming Chen

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


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [dpdk-dev] [PATCH v2] net/i40e: solve the failure of vf vlan filtering
  2021-08-24  9:29 ` [dpdk-dev] [PATCH v2] " Qiming Chen
@ 2021-08-25  7:13   ` 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
  1 sibling, 1 reply; 7+ messages in thread
From: Xing, Beilei @ 2021-08-25  7:13 UTC (permalink / raw)
  To: Qiming Chen, dev



> -----Original Message-----
> From: dev <dev-bounces@dpdk.org> On Behalf Of Qiming Chen
> Sent: Tuesday, August 24, 2021 5:30 PM
> To: dev@dpdk.org
> Cc: Xing, Beilei <beilei.xing@intel.com>; Qiming Chen
> <chenqiming_huawei@163.com>
> Subject: [dpdk-dev] [PATCH v2] net/i40e: solve the failure of vf vlan filtering
> 
> 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.

Thanks for the patch.
But I heard from DPDK validation team that there's no vf vlan filter issue with
i40evf driver. Please refer to the test plan
https://doc.dpdk.org/dts/test_plans/kernelpf_iavf_test_plan.html.

So could you please detail the issue?
E.g. do you use kernel PF + DPDK VF or DPDK PF + DPDK VF? 
What's the driver version? And what's the step to reproduce with testpmd?

BTW, for the commit log, needn't to describe the details you communicated
with PAE, just describe what's the issue, the root cause, and how to fix it.
Besides, fix patch needs fix line. Please refer to other fix patches.

Beilei

> 
> 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


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [dpdk-dev] [PATCH v2] net/i40e: solve the failure of vf vlan filtering
  2021-08-25  7:13   ` Xing, Beilei
@ 2021-08-26  9:40     ` Qiming Chen
  0 siblings, 0 replies; 7+ messages in thread
From: Qiming Chen @ 2021-08-26  9:40 UTC (permalink / raw)
  To: beilei.xing, dev

Thanks your reply.


I use kenerl PF + DPDK VF, version is follow:
DPDK: 19.11
Kernel PF i40e.ko: 2.7.12
Firmware: 6.01 0x800034a3 1.1747.0


I did not use testpmd to test vlan filter, but wrote Demo for testing based on the following deployment:
1) x710 nic, use 2 PFs, each PF virtualizes 1 VF
2) 2 pf connected with fiber optic cable
3) 2 vf are hard to pass through to the VM
4) In vm, dpdk takes over the vf port,
5) One port is used as the sending port, and the other port is used as the receiving port, e.g. xmit portid is 0, rx portid is 1


Use the default configuration for port 0 as the sender, and configure port 1 as the receiving port as follows:
1) rte_eth_promiscuous_enable(1)
2) rte_eth_dev_set_vlan_offload(1, ETH_VLAN_FILTER_OFFLOAD)
3) rte_eth_dev_vlan_filter(1, 100, 1)


Do the following 2 scene tests:
1) Demo constructs a message with vlan 100 to be sent from port 0, and the test is OK
2) Demo constructs a message with VLAN 200 to send from port 0, test NOK, the message can also be received, VLAN filtering does not take effect


| |
Qiming Chen
|
|
chenqiming_huawei@163.com
|
签名由网易邮箱大师定制
On 8/25/2021 15:13,Xing, Beilei<beilei.xing@intel.com> wrote:


-----Original Message-----
From: dev <dev-bounces@dpdk.org> On Behalf Of Qiming Chen
Sent: Tuesday, August 24, 2021 5:30 PM
To: dev@dpdk.org
Cc: Xing, Beilei <beilei.xing@intel.com>; Qiming Chen
<chenqiming_huawei@163.com>
Subject: [dpdk-dev] [PATCH v2] net/i40e: solve the failure of vf vlan filtering

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.

Thanks for the patch.
But I heard from DPDK validation team that there's no vf vlan filter issue with
i40evf driver. Please refer to the test plan
https://doc.dpdk.org/dts/test_plans/kernelpf_iavf_test_plan.html.

So could you please detail the issue?
E.g. do you use kernel PF + DPDK VF or DPDK PF + DPDK VF?
What's the driver version? And what's the step to reproduce with testpmd?

BTW, for the commit log, needn't to describe the details you communicated
with PAE, just describe what's the issue, the root cause, and how to fix it.
Besides, fix patch needs fix line. Please refer to other fix patches.

Beilei


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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [dpdk-dev] [PATCH v3] net/i40e: solve vf vlan strip
  2021-08-24  9:29 ` [dpdk-dev] [PATCH v2] " Qiming Chen
  2021-08-25  7:13   ` Xing, Beilei
@ 2021-08-26 14:01   ` Qiming Chen
  2021-08-26 14:09     ` Qiming Chen
  1 sibling, 1 reply; 7+ messages in thread
From: Qiming Chen @ 2021-08-26 14:01 UTC (permalink / raw)
  To: dev; +Cc: beilei.xing, Qiming Chen

Kernal PF+DPDK VF mode, after vf adds vlan, the test result shows that the
vlan received from vf has been stripped.

The patch solves the problem that the kernel i40e.ko driver strips the vlan
by default after vf adds vlan. Determine whether to strip vlan through
the DEV_RX_OFFLOAD_VLAN_STRIP mask bit in rxmode.offload.

Environmental information:
1) dpdk 19.11
2) Kernel PF i40e.ko: 2.7.12
3) Firmware: 6.01 0x800034a3 1.1747.0

I did not use testpmd to test vlan filter, but write Demo for testing
based on the following deployment:
1) x710 nic, use 2 PFs, each PF virtualizes 1 VF
2) 2 pf connected with fiber optic cable
3) 2 vf are hard to pass through to the VM
4) In vm, dpdk takes over the vf port,
5) One port is used as the sending port, and the other port is used as
the receiving port, e.g. xmit portid is 0, rx portid is 1

Use the default configuration for port 0 as the sender, and configure
port 1 as the receiving port as follows:
1) rte_eth_dev_set_vlan_offload(1, ETH_VLAN_FILTER_OFFLOAD)
2) rte_eth_dev_vlan_filter(1, 100, 1)

Do the following tests:
Demo constructs a message with vlan 100 to be sent from port 0, and found
that the vlan header of the message received from port 1 was stripped.

Signed-off-by: Qiming Chen <chenqiming_huawei@163.com>
---
v2:
  Re-test vlan filtering is no problem.
---
 drivers/net/i40e/i40e_ethdev_vf.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c
index 12e69a3233..2a291365c4 100644
--- a/drivers/net/i40e/i40e_ethdev_vf.c
+++ b/drivers/net/i40e/i40e_ethdev_vf.c
@@ -1900,11 +1900,15 @@ 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;
 
-	if (on)
+	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);
+	}
 
 	return ret;
 }
-- 
2.30.1.windows.1


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [dpdk-dev] [PATCH v3] net/i40e: solve vf vlan strip
  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
  0 siblings, 1 reply; 7+ messages in thread
From: Qiming Chen @ 2021-08-26 14:09 UTC (permalink / raw)
  To: dev; +Cc: beilei.xing, Qiming Chen

Kernel PF+DPDK VF mode, after vf adds vlan, the test result shows that the
vlan received from vf has been stripped.

The patch solves the problem that the kernel i40e.ko driver strips the vlan
by default after vf adds vlan. Determine whether to strip vlan through
the DEV_RX_OFFLOAD_VLAN_STRIP mask bit in rxmode.offload.

Environmental information:
1) dpdk 19.11
2) Kernel PF i40e.ko: 2.7.12
3) Firmware: 6.01 0x800034a3 1.1747.0

I did not use testpmd to test vlan filter, but write Demo for testing
based on the following deployment:
1) x710 nic, use 2 PFs, each PF virtualizes 1 VF
2) 2 pf connected with fiber optic cable
3) 2 vf are hard to pass through to the VM
4) In vm, dpdk takes over the vf port,
5) One port is used as the sending port, and the other port is used as
the receiving port, e.g. xmit portid is 0, rx portid is 1

Use the default configuration for port 0 as the sender, and configure
port 1 as the receiving port as follows:
1) rte_eth_dev_set_vlan_offload(1, ETH_VLAN_FILTER_OFFLOAD)
2) rte_eth_dev_vlan_filter(1, 100, 1)

Do the following tests:
Demo constructs a message with vlan 100 to be sent from port 0, and found
that the vlan header of the message received from port 1 was stripped.

Signed-off-by: Qiming Chen <chenqiming_huawei@163.com>
---
v2:
  Re-test vlan filtering is no problem.
v3:
  Clear coding style quesion.
---
 drivers/net/i40e/i40e_ethdev_vf.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c
index 12e69a3233..2a291365c4 100644
--- a/drivers/net/i40e/i40e_ethdev_vf.c
+++ b/drivers/net/i40e/i40e_ethdev_vf.c
@@ -1900,11 +1900,15 @@ 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;
 
-	if (on)
+	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);
+	}
 
 	return ret;
 }
-- 
2.30.1.windows.1


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [dpdk-dev] [PATCH v3] net/i40e: solve vf vlan strip
  2021-08-26 14:09     ` Qiming Chen
@ 2021-08-30  0:49       ` Zhang, Qi Z
  0 siblings, 0 replies; 7+ messages in thread
From: Zhang, Qi Z @ 2021-08-30  0:49 UTC (permalink / raw)
  To: Qiming Chen, dev; +Cc: Xing, Beilei



> -----Original Message-----
> From: dev <dev-bounces@dpdk.org> On Behalf Of Qiming Chen
> Sent: Thursday, August 26, 2021 10:10 PM
> To: dev@dpdk.org
> Cc: Xing, Beilei <beilei.xing@intel.com>; Qiming Chen
> <chenqiming_huawei@163.com>
> Subject: [dpdk-dev] [PATCH v3] net/i40e: solve vf vlan strip
> 
> Kernel PF+DPDK VF mode, after vf adds vlan, the test result shows that the vlan
> received from vf has been stripped.
> 
> The patch solves the problem that the kernel i40e.ko driver strips the vlan by
> default after vf adds vlan. Determine whether to strip vlan through the
> DEV_RX_OFFLOAD_VLAN_STRIP mask bit in rxmode.offload.
> 
> Environmental information:
> 1) dpdk 19.11
> 2) Kernel PF i40e.ko: 2.7.12
> 3) Firmware: 6.01 0x800034a3 1.1747.0
> 
> I did not use testpmd to test vlan filter, but write Demo for testing based on
> the following deployment:
> 1) x710 nic, use 2 PFs, each PF virtualizes 1 VF
> 2) 2 pf connected with fiber optic cable
> 3) 2 vf are hard to pass through to the VM
> 4) In vm, dpdk takes over the vf port,
> 5) One port is used as the sending port, and the other port is used as the
> receiving port, e.g. xmit portid is 0, rx portid is 1
> 
> Use the default configuration for port 0 as the sender, and configure port 1 as
> the receiving port as follows:
> 1) rte_eth_dev_set_vlan_offload(1, ETH_VLAN_FILTER_OFFLOAD)
> 2) rte_eth_dev_vlan_filter(1, 100, 1)
> 
> Do the following tests:
> Demo constructs a message with vlan 100 to be sent from port 0, and found
> that the vlan header of the message received from port 1 was stripped.

As i40evf will be removed in DPDK 21.11, so please submit a patch target to LTS directly.

Thanks
Qi



^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-08-30  0:49 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-24  8:51 [dpdk-dev] [PATCH] net/i40e: solve the failure of vf vlan filtering Qiming Chen
2021-08-24  9:29 ` [dpdk-dev] [PATCH v2] " Qiming Chen
2021-08-25  7:13   ` 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

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).