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 14078A0C43; Thu, 26 Aug 2021 16:02:47 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id CEF1F40689; Thu, 26 Aug 2021 16:02:46 +0200 (CEST) Received: from mail-m972.mail.163.com (mail-m972.mail.163.com [123.126.97.2]) by mails.dpdk.org (Postfix) with ESMTP id F1CE640140 for ; Thu, 26 Aug 2021 16:02: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=7HGkP G5nohsM/gA6U6K3WNiL/NL7VXSaNVdu797aBvw=; b=a3nwZJImTHONtOEji0WDZ AyjAuvMlHc99HIGFfgRqx4MZmW2gd2nNOo/g7hNa/Kv7lBEqT2T/ZTgZR1GJjX5U mfUDxzfdn1p2yOCAK+k7mIDBkovY4uuhEYsgaJdejqspuBvy/vVp9hyHUE3Jj1EK htLKR5UHCbaKdPnxH4LGCk= Received: from localhost.localdomain (unknown [124.160.214.252]) by smtp2 (Coremail) with SMTP id GtxpCgAXouUAnydhqDQdQA--.2417S2; Thu, 26 Aug 2021 22:02:42 +0800 (CST) From: Qiming Chen To: dev@dpdk.org Cc: beilei.xing@intel.com, Qiming Chen Date: Thu, 26 Aug 2021 22:01:58 +0800 Message-Id: <20210826140158.1232-1-chenqiming_huawei@163.com> X-Mailer: git-send-email 2.30.1.windows.1 In-Reply-To: <20210824092951.9701-1-chenqiming_huawei@163.com> References: <20210824092951.9701-1-chenqiming_huawei@163.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: GtxpCgAXouUAnydhqDQdQA--.2417S2 X-Coremail-Antispam: 1Uf129KBjvJXoWxJr43AF15Zr1kuF4rtryxXwb_yoW8urW3pF W2kayUAF1qqFyDXayUAa1xCrWrGan5Aa98KFs8A3sxt390y3WxtrW7KFyDu3ZFyr1kWFyq vF4qvrWUua4kCr7anT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07jBoGdUUUUU= X-Originating-IP: [124.160.214.252] X-CM-SenderInfo: xfkh01xlpl0w5bkxt4lhl6il2tof0z/xtbBzwL6oFaEAAqEOwAAsw Subject: [dpdk-dev] [PATCH v3] net/i40e: solve vf vlan strip 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" Kernal PF+DPDK VF mode, after vf adds vlan, the test result shows that the vlan received from vf has been stripped. The patch solves the problem that the kernel i40e.ko driver strips the vlan by default after vf adds vlan. Determine whether to strip vlan through the DEV_RX_OFFLOAD_VLAN_STRIP mask bit in rxmode.offload. Environmental information: 1) dpdk 19.11 2) Kernel PF i40e.ko: 2.7.12 3) Firmware: 6.01 0x800034a3 1.1747.0 I did not use testpmd to test vlan filter, but write Demo for testing based on the following deployment: 1) x710 nic, use 2 PFs, each PF virtualizes 1 VF 2) 2 pf connected with fiber optic cable 3) 2 vf are hard to pass through to the VM 4) In vm, dpdk takes over the vf port, 5) One port is used as the sending port, and the other port is used as the receiving port, e.g. xmit portid is 0, rx portid is 1 Use the default configuration for port 0 as the sender, and configure port 1 as the receiving port as follows: 1) rte_eth_dev_set_vlan_offload(1, ETH_VLAN_FILTER_OFFLOAD) 2) rte_eth_dev_vlan_filter(1, 100, 1) Do the following tests: Demo constructs a message with vlan 100 to be sent from port 0, and found that the vlan header of the message received from port 1 was stripped. Signed-off-by: Qiming Chen --- v2: Re-test vlan filtering is no problem. --- drivers/net/i40e/i40e_ethdev_vf.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c index 12e69a3233..2a291365c4 100644 --- a/drivers/net/i40e/i40e_ethdev_vf.c +++ b/drivers/net/i40e/i40e_ethdev_vf.c @@ -1900,11 +1900,15 @@ 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; - if (on) + 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); + } return ret; } -- 2.30.1.windows.1