From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id C348C42DF4; Fri, 7 Jul 2023 09:58:39 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9BF09406B5; Fri, 7 Jul 2023 09:58:39 +0200 (CEST) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by mails.dpdk.org (Postfix) with ESMTP id 2A22940685 for ; Fri, 7 Jul 2023 09:58:37 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1688716718; x=1720252718; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=cDWgBuZFRntIqeQFyqg0wkWhyp9FSxXcKs0zTE5S8c0=; b=dD1e6QE3UqQGawzWEzcqLDp5GnwNBX/TS6MKaols2TTuL5Uts/IFCvRE 2ibSvNiKNUJ9lWWRdAooZ04F47SvPOkHT76dIWWon5AWY/4B6LOqbjspe VQrxqS34ORti/yw75fLQKSHvTD781Pt+MlZSCfMLU2oOC/1mvIumFVE1J jkxzDjqigSNNeTylyAstIwJUXyKFq2FcJfrtCmYpE+z0bM20ZBpDGQ3kw HAhDTNakXoMX0YHdVYMsHRJysAVOlnw5P08wJQtnszze8UYQdEw3DwtUV h2pYpM76utuewWD7VG/bRLPHkXXAAH3Fw0cq/58TvnED3rPmdFgaYa16L Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10763"; a="362699291" X-IronPort-AV: E=Sophos;i="6.01,187,1684825200"; d="scan'208";a="362699291" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Jul 2023 00:58:37 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10763"; a="966552528" X-IronPort-AV: E=Sophos;i="6.01,187,1684825200"; d="scan'208";a="966552528" Received: from dpdk-wenjing-02.sh.intel.com ([10.67.119.75]) by fmsmga006.fm.intel.com with ESMTP; 07 Jul 2023 00:58:35 -0700 From: Wenjing Qiao To: jingjing.wu@intel.com, beilei.xing@intel.com Cc: dev@dpdk.org, zhiminx.huang@intel.com, Wenjing Qiao Subject: [PATCH] net/iavf: fix vlan offload strip flag inconsistency Date: Fri, 7 Jul 2023 07:58:03 +0000 Message-Id: <20230707075802.620018-1-wenjing.qiao@intel.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org 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 --- 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