DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] net/i40e: issue with ADD VLAN from Guest
@ 2020-12-09 17:55 Souvik Dey
  2020-12-11  3:07 ` Guo, Jia
  2020-12-12 13:05 ` [dpdk-dev] [PATCH v2] " Souvik Dey
  0 siblings, 2 replies; 18+ messages in thread
From: Souvik Dey @ 2020-12-09 17:55 UTC (permalink / raw)
  To: beilei.xing, jia.guo, qi.z.zhang; +Cc: dev, Souvik Dey

In case of i40evf pmd, when ADD_VLAN is sent down the linux i40e driver,
along with add the vlan the kernel driver also enables the vlan stripping
by default.
This might have issues if the app configured DEV_RX_OFFLOAD_VLAN_STRIP
as off at the port configuration. The app after adding the VLAN will
expect the VLAN to be coming in the received packets but, due to
VLAN_STRIP enabled at the PF, it will get stripped.
This behavior of the Linux driver causes confussion with the DPDK app
using i40e_pmd. So it is better to reconfigure the vlan_offload, which
checks for DEV_RX_OFFLOAD_VLAN_STRIP flag in the dev_conf and enables or
disables the vlan strip in the PF.
Also rte_eth_dev_set_vlan_offload() to disable VLAN_STRIP cannot be used
from the application, as this will only work for the first time when
original and current confi mismatch, but for all subsequent call it will
ignore it.

Signed-off-by: Souvik Dey <sodey@rbbn.com>
---
 drivers/net/i40e/i40e_ethdev_vf.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c
index c26b036..2ecf74b 100644
--- a/drivers/net/i40e/i40e_ethdev_vf.c
+++ b/drivers/net/i40e/i40e_ethdev_vf.c
@@ -1078,8 +1078,19 @@ i40evf_add_vlan(struct rte_eth_dev *dev, uint16_t vlanid)
 	args.out_buffer = vf->aq_resp;
 	args.out_size = I40E_AQ_BUF_SZ;
 	err = i40evf_execute_vf_cmd(dev, &args);
-	if (err)
+	if (err) {
 		PMD_DRV_LOG(ERR, "fail to execute command OP_ADD_VLAN");
+		return err;
+	}
+	/*
+	 * In linux kernel driver on receiving ADD_VLAN it enables
+	 * VLAN_STRIP by default. So reconfigure the vlan_offload
+	 * as it was done by the app earlier.
+	 */
+	err = i40evf_vlan_offload_set(dev, ETH_VLAN_STRIP_MASK);
+	if (err)
+		PMD_DRV_LOG(ERR, "fail to execute command disable_vlan_strip "
+			"as a part of OP_ADD_VLAN");
 
 	return err;
 }
-- 
2.9.3.windows.1


^ permalink raw reply	[flat|nested] 18+ messages in thread
* [dpdk-dev] [PATCH] net/i40e: issue with ADD VLAN from Guest
@ 2020-12-09 16:23 Souvik Dey
  0 siblings, 0 replies; 18+ messages in thread
From: Souvik Dey @ 2020-12-09 16:23 UTC (permalink / raw)
  To: beilei.xing, jia.guo, qi.z.zhang; +Cc: dev, Souvik Dey

In case of i40evf pmd, when ADD_VLAN is sent down the linux i40e driver,
along with add the vlan the kernel driver also enables the vlan stripping
by default.
This might have issues if the app configured DEV_RX_OFFLOAD_VLAN_STRIP
as off at the port configuration. The app after adding the VLAN will
expect the VLAN to be coming in the received packets but, due to
VLAN_STRIP enabled at the PF, it will get stripped.
This behavior of the Linux driver causes confussion with the DPDK app
using i40e_pmd. So it is better to reconfigure the vlan_offload, which
checks for DEV_RX_OFFLOAD_VLAN_STRIP flag in the dev_conf and enables or
disables the vlan strip in the PF.
Also rte_eth_dev_set_vlan_offload() to disable VLAN_STRIP cannot be used
from the application, as this will only work for the first time when
original and current confi mismatch, but for all subsequent call it will
ignore it.

Signed-off-by: Souvik Dey <sodey@rbbn.com>
---
 drivers/net/i40e/i40e_ethdev_vf.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c
index c26b036..2ecf74b 100644
--- a/drivers/net/i40e/i40e_ethdev_vf.c
+++ b/drivers/net/i40e/i40e_ethdev_vf.c
@@ -1078,8 +1078,19 @@ i40evf_add_vlan(struct rte_eth_dev *dev, uint16_t vlanid)
 	args.out_buffer = vf->aq_resp;
 	args.out_size = I40E_AQ_BUF_SZ;
 	err = i40evf_execute_vf_cmd(dev, &args);
-	if (err)
+	if (err) {
 		PMD_DRV_LOG(ERR, "fail to execute command OP_ADD_VLAN");
+		return err;
+	}
+	/*
+	 * In linux kernel driver on receiving ADD_VLAN it enables
+	 * VLAN_STRIP by default. So reconfigure the vlan_offload
+	 * as it was done by the app earlier.
+	 */
+	err = i40evf_vlan_offload_set(dev, ETH_VLAN_STRIP_MASK)
+	if (err)
+		PMD_DRV_LOG(ERR, "fail to execute command disable_vlan_strip "
+			"as a part of OP_ADD_VLAN");
 
 	return err;
 }
-- 
2.9.3.windows.1


^ permalink raw reply	[flat|nested] 18+ messages in thread
* [dpdk-dev] [PATCH] net/i40e: issue with ADD VLAN from Guest
@ 2020-04-14 23:06 Souvik Dey
  0 siblings, 0 replies; 18+ messages in thread
From: Souvik Dey @ 2020-04-14 23:06 UTC (permalink / raw)
  To: beilei.xing, qi.z.zhang; +Cc: dev, Souvik Dey

In case of i40evf pmd, when ADD_VLAN is sent down the linux i40e driver,
along with add the vlan the kernel driver also enables the vlan stripping
by default.
This might have issues if the app configured DEV_RX_OFFLOAD_VLAN_STRIP
as off at the port configuration. The app after adding the VLAN will
expect the VLAN to be coming in the received packets but, due to
VLAN_STRIP enabled at the PF, it will get stripped.
This behavior of the Linux driver causes confussion with the DPDK app
using i40e_pmd. So it is better to check the state of the
DEV_RX_OFFLOAD_VLAN_STRIP flag in the dev_conf and disable the vlan strip
after sending add_vlan if app configured the VLAN_STRIP as disabled.


Signed-off-by: Souvik Dey <sodey@rbbn.com>
---
 drivers/net/i40e/i40e_ethdev_vf.c | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c
index 244397e..d9c30be 100644
--- a/drivers/net/i40e/i40e_ethdev_vf.c
+++ b/drivers/net/i40e/i40e_ethdev_vf.c
@@ -1044,6 +1044,7 @@ i40evf_add_vlan(struct rte_eth_dev *dev, uint16_t vlanid)
 {
 	struct i40e_vf *vf = I40EVF_DEV_PRIVATE_TO_VF(dev->data->dev_private);
 	struct virtchnl_vlan_filter_list *vlan_list;
+	struct rte_eth_conf *dev_conf = &dev->data->dev_conf;
 	uint8_t cmd_buffer[sizeof(struct virtchnl_vlan_filter_list) +
 							sizeof(uint16_t)];
 	int err;
@@ -1060,8 +1061,21 @@ i40evf_add_vlan(struct rte_eth_dev *dev, uint16_t vlanid)
 	args.out_buffer = vf->aq_resp;
 	args.out_size = I40E_AQ_BUF_SZ;
 	err = i40evf_execute_vf_cmd(dev, &args);
-	if (err)
+	if (err) {
 		PMD_DRV_LOG(ERR, "fail to execute command OP_ADD_VLAN");
+		return err;
+	}
+	/*
+	 * In linux kernel driver on receiving ADD_VLAN it enables
+	 * VLAN_STRIP by default. So disable it if app confifured
+	 * it that way.
+	 */
+	if (!(dev_conf->rxmode.offloads & DEV_RX_OFFLOAD_VLAN_STRIP)) {
+		err = i40evf_disable_vlan_strip(dev);
+		if (err)
+			PMD_DRV_LOG(ERR, "fail to execute command disable_vlan_strip "
+				"as a part of OP_ADD_VLAN");
+	}
 
 	return err;
 }
-- 
2.9.3.windows.1


^ permalink raw reply	[flat|nested] 18+ messages in thread
* [dpdk-dev] [PATCH] net/i40e: issue with ADD VLAN from Guest
@ 2020-04-14 22:07 Souvik Dey
  0 siblings, 0 replies; 18+ messages in thread
From: Souvik Dey @ 2020-04-14 22:07 UTC (permalink / raw)
  To: beilei.xing, qi.z.zhang; +Cc: dev, Souvik Dey

In case of i40evf pmd, when ADD_VLAN is sent down the linux i40e driver,
along with add the vlan the kernel driver also enables the vlan stripping
by default.
This might have issues if the app configured DEV_RX_OFFLOAD_VLAN_STRIP
as off at the port configuration. The app after adding the VLAN will
expect the VLAN to be coming in the received packets but, due to
VLAN_STRIP enabled at the PF, it will get stripped.
This behavior of the Linux driver causes confussion with the DPDK app
using i40e_pmd. So it is better to check the state of the
DEV_RX_OFFLOAD_VLAN_STRIP flag in the dev_conf and disable the vlan strip
after sending add_vlan if app configured the VLAN_STRIP as disabled.


Signed-off-by: Souvik Dey <sodey@rbbn.com>
---
 drivers/net/i40e/i40e_ethdev_vf.c | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c
index 244397e..b8b6c57 100644
--- a/drivers/net/i40e/i40e_ethdev_vf.c
+++ b/drivers/net/i40e/i40e_ethdev_vf.c
@@ -1044,6 +1044,7 @@ i40evf_add_vlan(struct rte_eth_dev *dev, uint16_t vlanid)
 {
 	struct i40e_vf *vf = I40EVF_DEV_PRIVATE_TO_VF(dev->data->dev_private);
 	struct virtchnl_vlan_filter_list *vlan_list;
+	struct rte_eth_conf *dev_conf = &dev->data->dev_conf;
 	uint8_t cmd_buffer[sizeof(struct virtchnl_vlan_filter_list) +
 							sizeof(uint16_t)];
 	int err;
@@ -1060,8 +1061,21 @@ i40evf_add_vlan(struct rte_eth_dev *dev, uint16_t vlanid)
 	args.out_buffer = vf->aq_resp;
 	args.out_size = I40E_AQ_BUF_SZ;
 	err = i40evf_execute_vf_cmd(dev, &args);
-	if (err)
+	if (err) {
 		PMD_DRV_LOG(ERR, "fail to execute command OP_ADD_VLAN");
+		return ret;
+	}
+	/*
+	 * In linux kernel driver on receiving ADD_VLAN it enables
+	 * VLAN_STRIP by default. So disable it if app confifured
+	 * it that way.
+	 */
+	if (!(dev_conf->rxmode.offloads & DEV_RX_OFFLOAD_VLAN_STRIP)) {
+		err = i40evf_disable_vlan_strip(dev);
+		if (err)
+			PMD_DRV_LOG(ERR, "fail to execute command disable_vlan_strip "
+				"as a part of OP_ADD_VLAN");
+	}
 
 	return err;
 }
-- 
2.9.3.windows.1


^ permalink raw reply	[flat|nested] 18+ messages in thread
* [dpdk-dev] [PATCH] net/i40e: issue with ADD VLAN from Guest
@ 2020-04-14 21:58 Souvik Dey
  2020-09-14 15:54 ` Dey, Souvik
  0 siblings, 1 reply; 18+ messages in thread
From: Souvik Dey @ 2020-04-14 21:58 UTC (permalink / raw)
  To: beilei.xing, qi.z.zhang; +Cc: dev, Dey, Souvik

From: "Dey, Souvik" <sodey@rbbn.com>

In case of i40evf pmd, when ADD_VLAN is sent down the linux i40e driver,
along with add the vlan the kernel driver also enables the vlan stripping
by default.
This might have issues if the app configured DEV_RX_OFFLOAD_VLAN_STRIP
as off at the port configuration. The app after adding the VLAN will
expect the VLAN to be coming in the received packets but, due to
VLAN_STRIP enabled at the PF, it will get stripped.
This behavior of the Linux driver causes confussion with the DPDK app
using i40e_pmd. So it is better to check the state of the
DEV_RX_OFFLOAD_VLAN_STRIP flag in the dev_conf and disable the vlan strip
after sending add_vlan if app configured the VLAN_STRIP as disabled.


Signed-off-by: Souvik Dey <sodey@rbbn.com>
---
 drivers/net/i40e/i40e_ethdev_vf.c | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c
index 244397e..b8b6c57 100644
--- a/drivers/net/i40e/i40e_ethdev_vf.c
+++ b/drivers/net/i40e/i40e_ethdev_vf.c
@@ -1044,6 +1044,7 @@ i40evf_add_vlan(struct rte_eth_dev *dev, uint16_t vlanid)
 {
 	struct i40e_vf *vf = I40EVF_DEV_PRIVATE_TO_VF(dev->data->dev_private);
 	struct virtchnl_vlan_filter_list *vlan_list;
+	struct rte_eth_conf *dev_conf = &dev->data->dev_conf;
 	uint8_t cmd_buffer[sizeof(struct virtchnl_vlan_filter_list) +
 							sizeof(uint16_t)];
 	int err;
@@ -1060,8 +1061,21 @@ i40evf_add_vlan(struct rte_eth_dev *dev, uint16_t vlanid)
 	args.out_buffer = vf->aq_resp;
 	args.out_size = I40E_AQ_BUF_SZ;
 	err = i40evf_execute_vf_cmd(dev, &args);
-	if (err)
+	if (err) {
 		PMD_DRV_LOG(ERR, "fail to execute command OP_ADD_VLAN");
+		return ret;
+	}
+	/*
+	 * In linux kernel driver on receiving ADD_VLAN it enables
+	 * VLAN_STRIP by default. So disable it if app confifured
+	 * it that way.
+	 */
+	if (!(dev_conf->rxmode.offloads & DEV_RX_OFFLOAD_VLAN_STRIP)) {
+		err = i40evf_disable_vlan_strip(dev);
+		if (err)
+			PMD_DRV_LOG(ERR, "fail to execute command disable_vlan_strip "
+				"as a part of OP_ADD_VLAN");
+	}
 
 	return err;
 }
-- 
2.9.3.windows.1


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

end of thread, other threads:[~2021-01-05 10:45 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-09 17:55 [dpdk-dev] [PATCH] net/i40e: issue with ADD VLAN from Guest Souvik Dey
2020-12-11  3:07 ` Guo, Jia
2020-12-12 12:26   ` Dey, Souvik
2020-12-12 13:05 ` [dpdk-dev] [PATCH v2] " Souvik Dey
2020-12-15  2:24   ` Guo, Jia
2020-12-15 13:16     ` Dey, Souvik
2020-12-15 13:30       ` Dey, Souvik
2020-12-15 13:28   ` [dpdk-dev] [PATCH v3] " Souvik Dey
2020-12-16  2:09     ` Guo, Jia
2020-12-23 10:51       ` Zhang, Qi Z
2021-01-04 16:42       ` Ferruh Yigit
2021-01-05  3:07         ` Guo, Jia
2021-01-05 10:45           ` Ferruh Yigit
  -- strict thread matches above, loose matches on Subject: below --
2020-12-09 16:23 [dpdk-dev] [PATCH] " Souvik Dey
2020-04-14 23:06 Souvik Dey
2020-04-14 22:07 Souvik Dey
2020-04-14 21:58 Souvik Dey
2020-09-14 15:54 ` Dey, Souvik

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