DPDK patches and discussions
 help / color / mirror / Atom feed
From: Wenjing Qiao <wenjing.qiao@intel.com>
To: jingjing.wu@intel.com, beilei.xing@intel.com
Cc: dev@dpdk.org, zhiminx.huang@intel.com,
	Wenjing Qiao <wenjing.qiao@intel.com>
Subject: [PATCH] net/iavf: fix vlan offload strip flag inconsistency
Date: Fri,  7 Jul 2023 07:58:03 +0000	[thread overview]
Message-ID: <20230707075802.620018-1-wenjing.qiao@intel.com> (raw)

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


             reply	other threads:[~2023-07-07  7:58 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-07  7:58 Wenjing Qiao [this message]
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

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=20230707075802.620018-1-wenjing.qiao@intel.com \
    --to=wenjing.qiao@intel.com \
    --cc=beilei.xing@intel.com \
    --cc=dev@dpdk.org \
    --cc=jingjing.wu@intel.com \
    --cc=zhiminx.huang@intel.com \
    /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).