From patchwork Mon Aug 21 09:52:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wenjing Qiao X-Patchwork-Id: 130555 X-Patchwork-Delegate: qi.z.zhang@intel.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id C46CF430BE; Mon, 21 Aug 2023 11:53:05 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 956C1427E9; Mon, 21 Aug 2023 11:53:05 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.24]) by mails.dpdk.org (Postfix) with ESMTP id 9799341149; Mon, 21 Aug 2023 11:53:03 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1692611583; x=1724147583; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=SuhHeegUWgFP7AGeeJ58TC5JN0R2vQVHvZh3TtsYN+A=; b=PU3XaEyBdveWFJ3pxEGu+ozrwlcM8/pPr1UhAdb2gN9PGEuoUx0ao96B Ahie7Sw2styQk2C3jaAaCfUIM0TyzNCOn/e1YRmKPPjriMOgu+W3sPQIT 6L5qUJyNf82FC+gH4fUsFuWSR9i3JSlGlZgIlhRQ8jp/J6sXGcSwpHc0J pJCPmm3AXriSbLwVUSqt1QDwT3Kd1aYk+ze9p/XrTmRl+g+NhX+PysPfN nYuDo2Q0ddVMDjfp1NSecuG6SbdjzW35ahMHnbFllbvRyq6xXs9lUcL6K LmEGs4JPepRrT10xkkng2nCIdqB3jsXt40YIRNKvdBuGbznyBo1ZnFPES g==; X-IronPort-AV: E=McAfee;i="6600,9927,10808"; a="376298451" X-IronPort-AV: E=Sophos;i="6.01,189,1684825200"; d="scan'208";a="376298451" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Aug 2023 02:53:02 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10808"; a="712729298" X-IronPort-AV: E=Sophos;i="6.01,189,1684825200"; d="scan'208";a="712729298" Received: from dpdk-wenjing-02.sh.intel.com ([10.67.119.75]) by orsmga006.jf.intel.com with ESMTP; 21 Aug 2023 02:53:00 -0700 From: Wenjing Qiao To: jingjing.wu@intel.com, beilei.xing@intel.com Cc: dev@dpdk.org, zhiminx.huang@intel.com, Wenjing Qiao , stable@dpdk.org Subject: [PATCH v4] net/iavf: fix VLAN offload strip flag inconsistency Date: Mon, 21 Aug 2023 09:52:12 +0000 Message-Id: <20230821095211.223328-1-wenjing.qiao@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230821092031.211436-1-wenjing.qiao@intel.com> References: <20230821092031.211436-1-wenjing.qiao@intel.com> MIME-Version: 1.0 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 kernel driver which only supports vlan(v1) VIRTCHNL OP, it will set strip on when setting filter on but dpdk side will not change strip flag. To be consistent with dpdk side, disable strip again. Fixes: cb25d4323fbf ("net/avf: enable MAC VLAN and promisc ops") Cc: stable@dpdk.org Signed-off-by: Wenjing Qiao Acked-by: Qi Zhang --- drivers/net/iavf/iavf_ethdev.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethdev.c index 00b963128b..bdfc0ed098 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,23 @@ 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 kernel driver which only supports vlan(v1) VIRTCHNL OP, + * it will set strip on when setting filter on but dpdk side will not + * change strip flag. To be consistent with dpdk side, disable strip + * again. + * + * For i40e kernel driver which supports vlan v2, dpdk will invoke vlan v2 + * related function, so it won't go through here. + */ + 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; }