From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id 64961376C for ; Wed, 28 Dec 2016 03:25:20 +0100 (CET) Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga101.fm.intel.com with ESMTP; 27 Dec 2016 18:25:19 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,419,1477983600"; d="scan'208";a="47302101" Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by fmsmga005.fm.intel.com with ESMTP; 27 Dec 2016 18:25:19 -0800 Received: from fmsmsx156.amr.corp.intel.com (10.18.116.74) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.248.2; Tue, 27 Dec 2016 18:25:19 -0800 Received: from shsmsx151.ccr.corp.intel.com (10.239.6.50) by fmsmsx156.amr.corp.intel.com (10.18.116.74) with Microsoft SMTP Server (TLS) id 14.3.248.2; Tue, 27 Dec 2016 18:25:18 -0800 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.20]) by SHSMSX151.ccr.corp.intel.com ([169.254.3.204]) with mapi id 14.03.0248.002; Wed, 28 Dec 2016 10:25:16 +0800 From: "Wu, Jingjing" To: "Xing, Beilei" , "Zhang, Helin" CC: "dev@dpdk.org" Thread-Topic: [PATCH v2 04/17] net/i40e: restore ethertype filter Thread-Index: AQHSYApG6N8TSLSfsUSLjkxsUqg+x6Ecovwg Date: Wed, 28 Dec 2016 02:25:16 +0000 Message-ID: <9BB6961774997848B5B42BEC655768F810CC0063@SHSMSX103.ccr.corp.intel.com> References: <1480679625-4157-1-git-send-email-beilei.xing@intel.com> <1482819984-14120-1-git-send-email-beilei.xing@intel.com> <1482819984-14120-5-git-send-email-beilei.xing@intel.com> In-Reply-To: <1482819984-14120-5-git-send-email-beilei.xing@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH v2 04/17] net/i40e: restore ethertype filter X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Dec 2016 02:25:20 -0000 > -----Original Message----- > From: Xing, Beilei > Sent: Tuesday, December 27, 2016 2:26 PM > To: Wu, Jingjing ; Zhang, Helin > Cc: dev@dpdk.org > Subject: [PATCH v2 04/17] net/i40e: restore ethertype filter >=20 > Add support of restoring ethertype filter in case filter dropped accident= ally, as all > filters need to be added and removed by user obviously for generic filter= API. >=20 > Signed-off-by: Beilei Xing > --- > drivers/net/i40e/i40e_ethdev.c | 39 > +++++++++++++++++++++++++++++++++++++++ > 1 file changed, 39 insertions(+) >=20 > diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethde= v.c > index 427ebdc..cd7c309 100644 > --- a/drivers/net/i40e/i40e_ethdev.c > +++ b/drivers/net/i40e/i40e_ethdev.c > @@ -484,6 +484,9 @@ static int i40e_sw_tunnel_filter_insert(struct i40e_p= f *pf, > static int i40e_sw_tunnel_filter_del(struct i40e_pf *pf, > struct i40e_tunnel_filter *tunnel_filter); >=20 > +static void i40e_ethertype_filter_restore(struct i40e_pf *pf); static > +void i40e_filter_restore(struct i40e_pf *pf); > + > static const struct rte_pci_id pci_id_i40e_map[] =3D { > { RTE_PCI_DEVICE(I40E_INTEL_VENDOR_ID, I40E_DEV_ID_SFP_XL710) }, > { RTE_PCI_DEVICE(I40E_INTEL_VENDOR_ID, I40E_DEV_ID_QEMU) }, > @@ -1964,6 +1967,8 @@ i40e_dev_start(struct rte_eth_dev *dev) > /* enable uio intr after callback register */ > rte_intr_enable(intr_handle); >=20 > + i40e_filter_restore(pf); > + > return I40E_SUCCESS; >=20 > err_up: > @@ -10066,3 +10071,37 @@ i40e_dev_mtu_set(struct rte_eth_dev *dev, > uint16_t mtu) >=20 > return ret; > } > + > +/* Restore ethertype filter */ > +static void > +i40e_ethertype_filter_restore(struct i40e_pf *pf) { > + struct i40e_hw *hw =3D I40E_PF_TO_HW(pf); > + struct i40e_ethertype_filter_list > + *ethertype_list =3D &pf->ethertype.ethertype_list; > + struct i40e_ethertype_filter *f; > + struct i40e_control_filter_stats stats; > + uint16_t flags; > + > + TAILQ_FOREACH(f, ethertype_list, rules) { > + flags =3D 0; > + if (!(f->flags & RTE_ETHTYPE_FLAGS_MAC)) > + flags |=3D > I40E_AQC_ADD_CONTROL_PACKET_FLAGS_IGNORE_MAC; > + if (f->flags & RTE_ETHTYPE_FLAGS_DROP) > + flags |=3D > I40E_AQC_ADD_CONTROL_PACKET_FLAGS_DROP; > + flags |=3D I40E_AQC_ADD_CONTROL_PACKET_FLAGS_TO_QUEUE; > + > + memset(&stats, 0, sizeof(stats)); > + i40e_aq_add_rem_control_packet_filter(hw, > + f->input.mac_addr.addr_bytes, > + f->input.ether_type, > + flags, pf->main_vsi->seid, > + f->queue, 1, &stats, NULL); > + } How about to lig the stats to show how many filters are restored? Thanks Jingjing