From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id F09DD5A9B for ; Wed, 20 Jan 2016 04:54:28 +0100 (CET) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga102.jf.intel.com with ESMTP; 19 Jan 2016 19:54:27 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.22,319,1449561600"; d="scan'208";a="864383661" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by orsmga001.jf.intel.com with ESMTP; 19 Jan 2016 19:54:27 -0800 Received: from fmsmsx121.amr.corp.intel.com (10.18.125.36) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.248.2; Tue, 19 Jan 2016 19:54:27 -0800 Received: from shsmsx101.ccr.corp.intel.com (10.239.4.153) by fmsmsx121.amr.corp.intel.com (10.18.125.36) with Microsoft SMTP Server (TLS) id 14.3.248.2; Tue, 19 Jan 2016 19:54:26 -0800 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.172]) by SHSMSX101.ccr.corp.intel.com ([169.254.1.215]) with mapi id 14.03.0248.002; Wed, 20 Jan 2016 11:54:24 +0800 From: "Pei, Yulong" To: Julien Meunier , "Zhang, Helin" Thread-Topic: [dpdk-dev] [PATCH] i40e: fix vlan filtering Thread-Index: AQHRUowpa9vC7K84DUOronc4Brv2kZ8Dx1dQ Date: Wed, 20 Jan 2016 03:54:24 +0000 Message-ID: <188971FCDA171749BED5DA74ABF3E6F00352A52C@shsmsx102.ccr.corp.intel.com> References: <1453137515-19195-1-git-send-email-julien.meunier@6wind.com> In-Reply-To: <1453137515-19195-1-git-send-email-julien.meunier@6wind.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiMjJmOTQ4NDAtOWExMy00MjhiLTk4YjYtNTNlMTlhZDRkOTRmIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE1LjQuMTAuMTkiLCJUcnVzdGVkTGFiZWxIYXNoIjoibmhqMkVDTWh1M0lrdlJGK0wzd1A0ZmJWWGJyR3FyQlNpOEJTTFk0YWhOQT0ifQ== x-ctpclassification: CTP_IC x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Cc: "dev@dpdk.org" Subject: Re: [dpdk-dev] [PATCH] i40e: fix vlan filtering 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: Wed, 20 Jan 2016 03:54:29 -0000 It works as expected, thanks. Tested-by Yulong.pei@intel.com Best Regards Yulong Pei -----Original Message----- From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Julien Meunier Sent: Tuesday, January 19, 2016 1:19 AM To: Zhang, Helin Cc: dev@dpdk.org Subject: [dpdk-dev] [PATCH] i40e: fix vlan filtering VLAN filtering was always performed, even if hw_vlan_filter was disabled. D= uring device initialization, default filter RTE_MACVLAN_PERFECT_MATCH was a= pplied. In this situation, all incoming VLAN frames were dropped by the car= d (increase of the register RUPP - Rx Unsupported Protocol). In order to restore default behavior, if HW VLAN filtering is activated, se= t a filter to match MAC and VLAN. If not, set a filter to only match MAC. Signed-off-by: Julien Meunier Signed-off-by: David Marchand --- drivers/net/i40e/i40e_ethdev.c | 39 ++++++++++++++++++++++++++++++++++++++= - drivers/net/i40e/i40e_ethdev.h | 1 + 2 files changed, 39 insertions(+), 1 deletion(-) diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.= c index bf6220d..ef9d578 100644 --- a/drivers/net/i40e/i40e_ethdev.c +++ b/drivers/net/i40e/i40e_ethdev.c @@ -2332,6 +2332,13 @@ i40e_vlan_offload_set(struct rte_eth_dev *dev, int m= ask) struct i40e_pf *pf =3D I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private); struct i40e_vsi *vsi =3D pf->main_vsi; =20 + if (mask & ETH_VLAN_FILTER_MASK) { + if (dev->data->dev_conf.rxmode.hw_vlan_filter) + i40e_vsi_config_vlan_filter(vsi, TRUE); + else + i40e_vsi_config_vlan_filter(vsi, FALSE); + } + if (mask & ETH_VLAN_STRIP_MASK) { /* Enable or disable VLAN stripping */ if (dev->data->dev_conf.rxmode.hw_vlan_strip) @@ -4156,6 +4163,34 @@ fail_mem: return NULL; } =20 +/* Configure vlan filter on or off */ +int +i40e_vsi_config_vlan_filter(struct i40e_vsi *vsi, bool on) { + struct i40e_hw *hw =3D I40E_VSI_TO_HW(vsi); + struct i40e_mac_filter_info filter; + int ret; + + rte_memcpy(&filter.mac_addr, + (struct ether_addr *)(hw->mac.perm_addr), ETH_ADDR_LEN); + ret =3D i40e_vsi_delete_mac(vsi, &filter.mac_addr); + + if (on) { + /* Filter to match MAC and VLAN */ + filter.filter_type =3D RTE_MACVLAN_PERFECT_MATCH; + } else { + /* Filter to match only MAC */ + filter.filter_type =3D RTE_MAC_PERFECT_MATCH; + } + + ret |=3D i40e_vsi_add_mac(vsi, &filter); + + if (ret) + PMD_DRV_LOG(INFO, "Update VSI failed to %s vlan filter", + on ? "enable" : "disable"); + return ret; +} + /* Configure vlan stripping on or off */ int i40e_vsi_config_vlan_stripp= ing(struct i40e_vsi *vsi, bool on) @@ -4203,9 +4238,11 @@ i40e_dev_init_vla= n(struct rte_eth_dev *dev) { struct rte_eth_dev_data *data =3D dev->data; int ret; + int mask =3D 0; =20 /* Apply vlan offload setting */ - i40e_vlan_offload_set(dev, ETH_VLAN_STRIP_MASK); + mask =3D ETH_VLAN_STRIP_MASK | ETH_VLAN_FILTER_MASK; + i40e_vlan_offload_set(dev, mask); =20 /* Apply double-vlan setting, not implemented yet */ =20 diff --git a/drivers/net/i40e/i40e_ethdev.h b/drivers/net/i40e/i40e_ethdev.= h index 1f9792b..5505d72 100644 --- a/drivers/net/i40e/i40e_ethdev.h +++ b/drivers/net/i40e/i40e_ethdev.h @@ -551,6 +551,7 @@ void i40e_vsi_queues_unbind_intr(struct i40e_vsi *vsi);= int i40e_vsi_vlan_pvid_set(struct i40e_vsi *vsi, struct i40e_vsi_vlan_pvid_info *info); int i40e_vsi_config_vlan_str= ipping(struct i40e_vsi *vsi, bool on); +int i40e_vsi_config_vlan_filter(struct i40e_vsi *vsi, bool on); uint64_t i40e_config_hena(uint64_t flags); uint64_t i40e_parse_hena(uint6= 4_t flags); enum i40e_status_code i40e_fdir_setup_tx_resources(struct i40e= _pf *pf); -- 2.1.4