DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH] net/iavf: fix vlan offload strip flag inconsistency
@ 2023-07-07  7:58 Wenjing Qiao
  2023-07-07  9:22 ` Huang, ZhiminX
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Wenjing Qiao @ 2023-07-07  7:58 UTC (permalink / raw)
  To: jingjing.wu, beilei.xing; +Cc: dev, zhiminx.huang, Wenjing Qiao

For i40e in-tree kernel driver, it will set strip on when setting
filter on. To be consistent with dpdk, disable strip again.

Fixes: cb25d4323fbf ("net/avf: enable MAC VLAN and promisc ops")

Signed-off-by: Wenjing Qiao <wenjing.qiao@intel.com>
---
 drivers/net/iavf/iavf.h        |  1 +
 drivers/net/iavf/iavf_ethdev.c | 18 ++++++++++++++++++
 drivers/net/iavf/iavf_vchnl.c  |  2 ++
 3 files changed, 21 insertions(+)

diff --git a/drivers/net/iavf/iavf.h b/drivers/net/iavf/iavf.h
index 98861e4242..18b05f5cce 100644
--- a/drivers/net/iavf/iavf.h
+++ b/drivers/net/iavf/iavf.h
@@ -325,6 +325,7 @@ struct iavf_adapter {
 	bool closed;
 	uint16_t fdir_ref_cnt;
 	struct iavf_devargs devargs;
+	bool is_strip; /* only for vlan v1 */
 };
 
 /* IAVF_DEV_PRIVATE_TO */
diff --git a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethdev.c
index 00b963128b..8cd534e93c 100644
--- a/drivers/net/iavf/iavf_ethdev.c
+++ b/drivers/net/iavf/iavf_ethdev.c
@@ -1379,6 +1379,24 @@ iavf_dev_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on)
 	err = iavf_add_del_vlan(adapter, vlan_id, on);
 	if (err)
 		return -EIO;
+	/* for i40e in-tree kernel driver, it will set strip on when setting
+	 * filter on. To be consistent with dpdk, disable strip again.
+	 */
+	if (adapter->hw.vendor_id == IAVF_INTEL_VENDOR_ID) {
+		switch (adapter->hw.device_id) {
+		case IAVF_DEV_ID_VF:
+		case IAVF_DEV_ID_VF_HV:
+		case IAVF_DEV_ID_X722_VF:
+			if (on && !adapter->is_strip) {
+				err = iavf_disable_vlan_strip(adapter);
+				if (err)
+					return -EIO;
+			}
+			break;
+		default:
+			break;
+		}
+	}
 	return 0;
 }
 
diff --git a/drivers/net/iavf/iavf_vchnl.c b/drivers/net/iavf/iavf_vchnl.c
index 524732f67d..2d2fee4312 100644
--- a/drivers/net/iavf/iavf_vchnl.c
+++ b/drivers/net/iavf/iavf_vchnl.c
@@ -589,6 +589,7 @@ iavf_enable_vlan_strip(struct iavf_adapter *adapter)
 		PMD_DRV_LOG(ERR, "Failed to execute command of"
 			    " OP_ENABLE_VLAN_STRIPPING");
 
+	adapter->is_strip = true;
 	return ret;
 }
 
@@ -611,6 +612,7 @@ iavf_disable_vlan_strip(struct iavf_adapter *adapter)
 			    " OP_DISABLE_VLAN_STRIPPING");
 
 	return ret;
+	adapter->is_strip = false;
 }
 
 #define VIRTCHNL_VERSION_MAJOR_START 1
-- 
2.34.1


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

* RE: [PATCH] net/iavf: fix vlan offload strip flag inconsistency
  2023-07-07  7:58 [PATCH] net/iavf: fix vlan offload strip flag inconsistency Wenjing Qiao
@ 2023-07-07  9:22 ` Huang, ZhiminX
  2023-07-10  1:42 ` Zhang, Qi Z
  2023-07-12  7:48 ` [PATCH v2] " Wenjing Qiao
  2 siblings, 0 replies; 5+ messages in thread
From: Huang, ZhiminX @ 2023-07-07  9:22 UTC (permalink / raw)
  To: Qiao, Wenjing, Wu, Jingjing, Xing, Beilei; +Cc: dev

-----Original Message-----
From: Qiao, Wenjing <wenjing.qiao@intel.com> 
Sent: Friday, July 7, 2023 3:58 PM
To: Wu, Jingjing <jingjing.wu@intel.com>; Xing, Beilei <beilei.xing@intel.com>
Cc: dev@dpdk.org; Huang, ZhiminX <zhiminx.huang@intel.com>; Qiao, Wenjing <wenjing.qiao@intel.com>
Subject: [PATCH] net/iavf: fix vlan offload strip flag inconsistency

For i40e in-tree kernel driver, it will set strip on when setting filter on. To be consistent with dpdk, disable strip again.

Fixes: cb25d4323fbf ("net/avf: enable MAC VLAN and promisc ops")

Signed-off-by: Wenjing Qiao <wenjing.qiao@intel.com>
---
 drivers/net/iavf/iavf.h        |  1 +
 drivers/net/iavf/iavf_ethdev.c | 18 ++++++++++++++++++  drivers/net/iavf/iavf_vchnl.c  |  2 ++
 3 files changed, 21 insertions(+)

Verified vf vlan filter and strip cases in i40e and ice intree driver, tested pass.
Tested-by: Zhimin Huang <zhiminx.huang@intel.com >



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

* RE: [PATCH] net/iavf: fix vlan offload strip flag inconsistency
  2023-07-07  7:58 [PATCH] net/iavf: fix vlan offload strip flag inconsistency Wenjing Qiao
  2023-07-07  9:22 ` Huang, ZhiminX
@ 2023-07-10  1:42 ` Zhang, Qi Z
  2023-07-12  7:48 ` [PATCH v2] " Wenjing Qiao
  2 siblings, 0 replies; 5+ messages in thread
From: Zhang, Qi Z @ 2023-07-10  1:42 UTC (permalink / raw)
  To: Qiao, Wenjing, Wu, Jingjing, Xing, Beilei
  Cc: dev, Huang, ZhiminX, Qiao, Wenjing



> -----Original Message-----
> From: Wenjing Qiao <wenjing.qiao@intel.com>
> Sent: Friday, July 7, 2023 3:58 PM
> To: Wu, Jingjing <jingjing.wu@intel.com>; Xing, Beilei <beilei.xing@intel.com>
> Cc: dev@dpdk.org; Huang, ZhiminX <zhiminx.huang@intel.com>; Qiao,
> Wenjing <wenjing.qiao@intel.com>
> Subject: [PATCH] net/iavf: fix vlan offload strip flag inconsistency
> 
> For i40e in-tree kernel driver, it will set strip on when setting filter on. To be
> consistent with dpdk, disable strip again.
> 
> Fixes: cb25d4323fbf ("net/avf: enable MAC VLAN and promisc ops")
> 
> Signed-off-by: Wenjing Qiao <wenjing.qiao@intel.com>
> ---
>  drivers/net/iavf/iavf.h        |  1 +
>  drivers/net/iavf/iavf_ethdev.c | 18 ++++++++++++++++++
> drivers/net/iavf/iavf_vchnl.c  |  2 ++
>  3 files changed, 21 insertions(+)
> 
> diff --git a/drivers/net/iavf/iavf.h b/drivers/net/iavf/iavf.h index
> 98861e4242..18b05f5cce 100644
> --- a/drivers/net/iavf/iavf.h
> +++ b/drivers/net/iavf/iavf.h
> @@ -325,6 +325,7 @@ struct iavf_adapter {
>  	bool closed;
>  	uint16_t fdir_ref_cnt;
>  	struct iavf_devargs devargs;
> +	bool is_strip; /* only for vlan v1 */

Can we just use " dev_conf->rxmode.offloads & RTE_ETH_RX_OFFLOAD_VLAN_STRIP"?

>  };
> 
>  /* IAVF_DEV_PRIVATE_TO */
> diff --git a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethdev.c
> index 00b963128b..8cd534e93c 100644
> --- a/drivers/net/iavf/iavf_ethdev.c
> +++ b/drivers/net/iavf/iavf_ethdev.c
> @@ -1379,6 +1379,24 @@ iavf_dev_vlan_filter_set(struct rte_eth_dev *dev,
> uint16_t vlan_id, int on)
>  	err = iavf_add_del_vlan(adapter, vlan_id, on);
>  	if (err)
>  		return -EIO;
> +	/* for i40e in-tree kernel driver, it will set strip on when setting
> +	 * filter on. To be consistent with dpdk, disable strip again.
> +	 */
> +	if (adapter->hw.vendor_id == IAVF_INTEL_VENDOR_ID) {
> +		switch (adapter->hw.device_id) {
> +		case IAVF_DEV_ID_VF:
> +		case IAVF_DEV_ID_VF_HV:
> +		case IAVF_DEV_ID_X722_VF:

How we identify this is an in-tree or out-of-tree i40e kernel driver?

> +			if (on && !adapter->is_strip) {
> +				err = iavf_disable_vlan_strip(adapter);
> +				if (err)
> +					return -EIO;
> +			}
> +			break;
> +		default:
> +			break;
> +		}
> +	}
>  	return 0;
>  }
> 
> diff --git a/drivers/net/iavf/iavf_vchnl.c b/drivers/net/iavf/iavf_vchnl.c index
> 524732f67d..2d2fee4312 100644
> --- a/drivers/net/iavf/iavf_vchnl.c
> +++ b/drivers/net/iavf/iavf_vchnl.c
> @@ -589,6 +589,7 @@ iavf_enable_vlan_strip(struct iavf_adapter *adapter)
>  		PMD_DRV_LOG(ERR, "Failed to execute command of"
>  			    " OP_ENABLE_VLAN_STRIPPING");
> 
> +	adapter->is_strip = true;
>  	return ret;
>  }
> 
> @@ -611,6 +612,7 @@ iavf_disable_vlan_strip(struct iavf_adapter *adapter)
>  			    " OP_DISABLE_VLAN_STRIPPING");
> 
>  	return ret;
> +	adapter->is_strip = false;
>  }
> 
>  #define VIRTCHNL_VERSION_MAJOR_START 1
> --
> 2.34.1


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

* [PATCH v2] net/iavf: fix vlan offload strip flag inconsistency
  2023-07-07  7:58 [PATCH] net/iavf: fix vlan offload strip flag inconsistency Wenjing Qiao
  2023-07-07  9:22 ` Huang, ZhiminX
  2023-07-10  1:42 ` Zhang, Qi Z
@ 2023-07-12  7:48 ` Wenjing Qiao
  2023-07-12  8:43   ` Huang, ZhiminX
  2 siblings, 1 reply; 5+ messages in thread
From: Wenjing Qiao @ 2023-07-12  7:48 UTC (permalink / raw)
  To: jingjing.wu, beilei.xing; +Cc: dev, Wenjing Qiao, stable

For i40e in-tree kernel driver, it will set strip on when setting
filter on. To be consistent with dpdk, disable strip again.

Fixes: cb25d4323fbf ("net/avf: enable MAC VLAN and promisc ops")
Cc: stable@dpdk.org

Signed-off-by: Wenjing Qiao <wenjing.qiao@intel.com>
---
Depends-on: patch-129488 ("common/iavf: fix hw mac type for 710 NIC")
---
 drivers/net/iavf/iavf_ethdev.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethdev.c
index 00b963128b..d5dfa019f7 100644
--- a/drivers/net/iavf/iavf_ethdev.c
+++ b/drivers/net/iavf/iavf_ethdev.c
@@ -1361,6 +1361,7 @@ iavf_dev_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on)
 	struct iavf_adapter *adapter =
 		IAVF_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
 	struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter);
+	struct rte_eth_conf *dev_conf = &dev->data->dev_conf;
 	int err;
 
 	if (adapter->closed)
@@ -1379,6 +1380,17 @@ iavf_dev_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on)
 	err = iavf_add_del_vlan(adapter, vlan_id, on);
 	if (err)
 		return -EIO;
+	/* for i40e in-tree kernel driver, it will set strip on when setting
+	 * filter on. To be consistent with dpdk, disable strip again.
+	 */
+	if (adapter->hw.mac.type == IAVF_MAC_XL710 ||
+	    adapter->hw.mac.type == IAVF_MAC_X722_VF) {
+		if (on && !(dev_conf->rxmode.offloads & RTE_ETH_RX_OFFLOAD_VLAN_STRIP)) {
+			err = iavf_disable_vlan_strip(adapter);
+			if (err)
+				return -EIO;
+		}
+	}
 	return 0;
 }
 
-- 
2.34.1


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

* RE: [PATCH v2] net/iavf: fix vlan offload strip flag inconsistency
  2023-07-12  7:48 ` [PATCH v2] " Wenjing Qiao
@ 2023-07-12  8:43   ` Huang, ZhiminX
  0 siblings, 0 replies; 5+ messages in thread
From: Huang, ZhiminX @ 2023-07-12  8:43 UTC (permalink / raw)
  To: Qiao, Wenjing, Wu, Jingjing, Xing, Beilei; +Cc: dev, Qiao, Wenjing, stable

-----Original Message-----
From: Wenjing Qiao <wenjing.qiao@intel.com> 
Sent: Wednesday, July 12, 2023 3:49 PM
To: Wu, Jingjing <jingjing.wu@intel.com>; Xing, Beilei <beilei.xing@intel.com>
Cc: dev@dpdk.org; Qiao, Wenjing <wenjing.qiao@intel.com>; stable@dpdk.org
Subject: [PATCH v2] net/iavf: fix vlan offload strip flag inconsistency

For i40e in-tree kernel driver, it will set strip on when setting filter on. To be consistent with dpdk, disable strip again.

Fixes: cb25d4323fbf ("net/avf: enable MAC VLAN and promisc ops")
Cc: stable@dpdk.org

Signed-off-by: Wenjing Qiao <wenjing.qiao@intel.com>
---
Depends-on: patch-129488 ("common/iavf: fix hw mac type for 710 NIC")
---
Verified vf vlan filter and strip cases in i40e intree driver, tested pass.
Tested-by: Zhimin Huang <zhiminx.huang@intel.com >

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

end of thread, other threads:[~2023-07-12  8:43 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-07  7:58 [PATCH] net/iavf: fix vlan offload strip flag inconsistency Wenjing Qiao
2023-07-07  9:22 ` Huang, ZhiminX
2023-07-10  1:42 ` Zhang, Qi Z
2023-07-12  7:48 ` [PATCH v2] " Wenjing Qiao
2023-07-12  8:43   ` Huang, ZhiminX

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