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 4E86DA0C4D; Tue, 24 Aug 2021 11:30:47 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C1A8040687; Tue, 24 Aug 2021 11:30:46 +0200 (CEST) Received: from mail-m971.mail.163.com (mail-m971.mail.163.com [123.126.97.1]) by mails.dpdk.org (Postfix) with ESMTP id F21B54014E for ; Tue, 24 Aug 2021 11:30:44 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-Id:MIME-Version; bh=EMWbL 4znJpBgamE0xzPnDICY7k2eZEyIp+KDKAJQr8w=; b=Vz8q1QrKT/Wd4B9wjt46W 90SKvN4m26EkrF27awz8BVKBSzYy3tiyWJ8cc0LMBjWsxMQSQfRwESNv0s4Icd/3 BpIRFlnYnWJMGtJf9Mx8zwUBrI6dOrbeN2n7LVaMAakzl08HhPNMmc6/AqsXPWxg cAHrImseVUSwfA/JXaDzhA= Received: from localhost.localdomain (unknown [124.160.213.1]) by smtp1 (Coremail) with SMTP id GdxpCgC3oJI7vCRhG_blOw--.10S2; Tue, 24 Aug 2021 17:30:40 +0800 (CST) From: Qiming Chen To: dev@dpdk.org Cc: beilei.xing@intel.com, Qiming Chen Date: Tue, 24 Aug 2021 17:29:51 +0800 Message-Id: <20210824092951.9701-1-chenqiming_huawei@163.com> X-Mailer: git-send-email 2.30.1.windows.1 In-Reply-To: <20210824085101.9142-1-chenqiming_huawei@163.com> References: <20210824085101.9142-1-chenqiming_huawei@163.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: GdxpCgC3oJI7vCRhG_blOw--.10S2 X-Coremail-Antispam: 1Uf129KBjvJXoW7WrWrXrykJFW7Kw47JFW8JFb_yoW8AFW7pa yUGF90yFyUXa1fZ3yakFZF9FZ8Wws5tryjgr9xG34vv3yYyF1rXF1xta4Yva4q9rn8JFs8 Jr1kAFyDCFWUA3JanT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07jDKsUUUUUU= X-Originating-IP: [124.160.213.1] X-CM-SenderInfo: xfkh01xlpl0w5bkxt4lhl6il2tof0z/xtbBzx-4oFaD--RzhwADsh Subject: [dpdk-dev] [PATCH v2] net/i40e: solve the failure of vf vlan filtering 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 Sender: "dev" When vf driver port promiscuous is turned on, the vlan filtering function is invalid. Through communication with PAE expert, this is a limitation of the i40e chip. Before adding or removing VLANs, you must first disable unicast promiscuous or multicast promiscuous, then operate the vlan, and finally restore unicast promiscuous or multicast promiscuous state. Signed-off-by: Qiming Chen --- drivers/net/i40e/i40e_ethdev_vf.c | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c index 12e69a3233..a099daae6b 100644 --- a/drivers/net/i40e/i40e_ethdev_vf.c +++ b/drivers/net/i40e/i40e_ethdev_vf.c @@ -1900,11 +1900,30 @@ static int i40evf_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on) { int ret; + struct rte_eth_conf *dev_conf = &dev->data->dev_conf; + struct i40e_vf *vf = I40EVF_DEV_PRIVATE_TO_VF(dev->data->dev_private); + bool promisc_unicast_enabled = vf->promisc_unicast_enabled; + bool promisc_multicast_enabled = vf->promisc_multicast_enabled; - if (on) + if (promisc_unicast_enabled) + i40evf_dev_promiscuous_disable(dev); + + if (promisc_multicast_enabled) + i40evf_dev_allmulticast_disable(dev); + + if (on) { ret = i40evf_add_vlan(dev, vlan_id); - else + if ((dev_conf->rxmode.offloads & DEV_RX_OFFLOAD_VLAN_STRIP) == 0) + i40evf_disable_vlan_strip(dev); + } else { ret = i40evf_del_vlan(dev,vlan_id); + } + + if (promisc_unicast_enabled) + i40evf_dev_promiscuous_enable(dev); + + if (promisc_multicast_enabled) + i40evf_dev_allmulticast_enable(dev); return ret; } -- 2.30.1.windows.1