From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 0CAE43792 for ; Mon, 30 May 2016 04:41:48 +0200 (CEST) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga102.fm.intel.com with ESMTP; 29 May 2016 19:41:48 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.26,387,1459839600"; d="scan'208,217";a="976982890" Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203]) by fmsmga001.fm.intel.com with ESMTP; 29 May 2016 19:41:48 -0700 Received: from fmsmsx152.amr.corp.intel.com (10.18.125.5) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.248.2; Sun, 29 May 2016 19:41:47 -0700 Received: from shsmsx104.ccr.corp.intel.com (10.239.4.70) by FMSMSX152.amr.corp.intel.com (10.18.125.5) with Microsoft SMTP Server (TLS) id 14.3.248.2; Sun, 29 May 2016 19:41:46 -0700 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.220]) by SHSMSX104.ccr.corp.intel.com ([169.254.5.116]) with mapi id 14.03.0248.002; Mon, 30 May 2016 10:41:45 +0800 From: "Peng, Yuan" To: "Wu, Jingjing" , "Zhang, Helin" CC: "dev@dpdk.org" , "Wu, Jingjing" , "Pei, Yulong" Thread-Topic: [dpdk-dev] [PATCH] i40e: fix vlan filter in promiscuous mode Thread-Index: AQHRt+6h9KwwCkeenk2ZLpdyEBSgiJ/Qto+A Date: Mon, 30 May 2016 02:41:45 +0000 Message-ID: <67D543A150B29E4CAAE53918F64EDAEAA9C2BE@shsmsx102.ccr.corp.intel.com> References: <1464336345-20529-1-git-send-email-jingjing.wu@intel.com> In-Reply-To: <1464336345-20529-1-git-send-email-jingjing.wu@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiOGI4MDBmOGYtZDY3OS00YzUwLWI5YzMtNzllOGFlZTczZDI1IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE1LjkuNi42IiwiVHJ1c3RlZExhYmVsSGFzaCI6Im1qVkR6U1BReHpnR1FYQ25cL3RsM0lNOTlNQ25abDBEUDQ2NXNZekxRbkVRPSJ9 x-ctpclassification: CTP_IC x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.15 Subject: Re: [dpdk-dev] [PATCH] i40e: fix vlan filter in promiscuous mode X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 May 2016 02:41:50 -0000 Tested-by: Peng Yuan - Test Commit: a3f9ec846f9e7347d3a98da52256607345b4861d - OS/Kernel: Fedora 23/4.2.3 - GCC: gcc version 5.3.1 20151207 (Red Hat 5.3.1-2) (GCC) - CPU: Intel(R) Xeon(R) CPU E5-2699 v3 @ 2.30GHz - Total 7 cases, 7 passed, 0 failed. pf vf(pf_kerneldriver) mac_filter vlan_filter mac+vlan_filter mac_filter vlan_filter mac+vlan_filter promisc off PASS(dts case) PASS PASS PASS(dts case) PASS(dts case) PASS promisc on N/A PASS(dts case) N/A N/A N/A N/A All the test cases I verified covers 7 scenarios as below table. The issue happened in vlan_filter/promisc on, so I just describe the test s= teps in this scenario. Test_vlan_enable_receipt 1. Fortpark i40e driver, . /dpdk_nic_bind.py --bind=3Digb_uio 0000:8= a:00.1 0000:8a:00.3 2. ./x86_64-native-linuxapp-gcc/app/testpmd -c 0x6 -n 4 -- -i --port= mask=3D0x1 --port-topology=3Dloop --txqflags=3D0 3. Testpmd> set verbose 1 Testpmd> set fwd mac Testpmd> vlan set filter on 0 Testpmd> vlan set strip off 0 Testpmd> rx_vlan add 51 0 Testpmd>start 4. Tester: sendp([Ether(dst=3D"00:00:00:00:03:15")/Dot1Q(vlan=3D51)/IP()/UDP()],iface= =3D"enp138s0f0", count=3D1) 5. DUT can receive the packet, and check the vlan ID is correct. 6. Send packet with vlan0 and the packet can be received, send packet without vlan and the packet can be received. Send packet with wrong vlan(52/4095) and packet can't be receive. Test_ vlan_disable_receipt 1. Testpmd>rx_vlan rm 51 0 Testpmd>start 2. Tester: sendp([Ether(dst=3D"00:00:00:00:03:15")/Dot1Q(vlan=3D51)/IP()/UDP()],iface= =3D"enp138s0f0", count=3D1) 3. DUT can not receive the packet. The vlan filter works normally. Thanks Yuan. -----Original Message----- From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Jingjing Wu Sent: Friday, May 27, 2016 4:06 PM To: Zhang, Helin Cc: dev@dpdk.org; Wu, Jingjing ; Pei, Yulong Subject: [dpdk-dev] [PATCH] i40e: fix vlan filter in promiscuous mode Vlan filter didn't work if promiscuous mode is enabled. That is because i40= e driver uses MAC VLAN table for the l2 filtering and internal switch. And = the vlan table is disabled by default, till the first time to add rule in v= lan table. This patch fixed this issue to enable vlan filter by using vlan table. Fixes: 4861cde46116 (i40e: new poll mode driver) Signed-off-by: Jingjing Wu > --- drivers/net/i40e/i40e_ethdev.c | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.= c index 24777d5..0d91e29 100644 --- a/drivers/net/i40e/i40e_ethdev.c +++ b/drivers/net/i40e/i40e_ethdev.c @@ -2443,12 +2443,16 @@ i40e_vlan_offload_set(struct rte_eth_dev *dev, int = mask) { struct i40e_pf *pf =3D I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private= ); struct i40e_vsi *vsi =3D pf->main_vsi; + struct i40e_hw *hw =3D I40E_DEV_PRIVATE_TO_HW(dev->data->dev_privat= e); if (mask & ETH_VLAN_FILTER_MASK) { - if (dev->data->dev_conf.rxmode.hw_vlan_filter) + if (dev->data->dev_conf.rxmode.hw_vlan_filter) { + i40e_aq_set_vsi_vlan_promisc(hw, vsi->seid, fals= e, NULL); i40e_vsi_config_vlan_filter(vsi, TRUE); - else + } else { + i40e_aq_set_vsi_vlan_promisc(hw, vsi->seid, true= , NULL); i40e_vsi_config_vlan_filter(vsi, FALSE); + } } if (mask & ETH_VLAN_STRIP_MASK) { @@ -5419,17 +5423,28 @@ i40e_set_vlan_filter(struct i40e_vsi *vsi, uint16_t vlan_id, bool on) { uint32_t vid_idx, vid_bit; + struct i40e_hw *hw =3D I40E_VSI_TO_HW(vsi); + struct i40e_aqc_add_remove_vlan_element_data vlan_data =3D {0}; + int ret; if (vlan_id > ETH_VLAN_ID_MAX) return; vid_idx =3D I40E_VFTA_IDX(vlan_id); vid_bit =3D I40E_VFTA_BIT(vlan_id); + vlan_data.vlan_tag =3D rte_cpu_to_le_16(vlan_id); - if (on) + if (on) { + ret =3D i40e_aq_add_vlan(hw, vsi->seid, &vlan_data, 1, NUL= L); + if (ret !=3D I40E_SUCCESS) + PMD_DRV_LOG(ERR, "Failed to add vlan filter"); vsi->vfta[vid_idx] |=3D vid_bit; - else + } else { + ret =3D i40e_aq_remove_vlan(hw, vsi->seid, &vlan_data, 1, = NULL); + if (ret !=3D I40E_SUCCESS) + PMD_DRV_LOG(ERR, "Failed to remove vlan filter")= ; vsi->vfta[vid_idx] &=3D ~vid_bit; + } } /** -- 2.4.0