From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id 3AA2337A6 for ; Wed, 28 Dec 2016 09:02:42 +0100 (CET) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga103.fm.intel.com with ESMTP; 28 Dec 2016 00:02:41 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,421,1477983600"; d="scan'208";a="916767717" Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203]) by orsmga003.jf.intel.com with ESMTP; 28 Dec 2016 00:02:41 -0800 Received: from fmsmsx118.amr.corp.intel.com (10.18.116.18) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.248.2; Wed, 28 Dec 2016 00:02:41 -0800 Received: from shsmsx104.ccr.corp.intel.com (10.239.4.70) by fmsmsx118.amr.corp.intel.com (10.18.116.18) with Microsoft SMTP Server (TLS) id 14.3.248.2; Wed, 28 Dec 2016 00:02:41 -0800 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.177]) by SHSMSX104.ccr.corp.intel.com ([10.239.4.70]) with mapi id 14.03.0248.002; Wed, 28 Dec 2016 16:02:39 +0800 From: "Xing, Beilei" To: Adrien Mazarguil CC: "Wu, Jingjing" , "Zhang, Helin" , "dev@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH v2 15/17] net/i40e: add flow flush function Thread-Index: AQHSYArflMIk9469mEaa+oXbAbi/5KEbNoyAgAHKv4A= Date: Wed, 28 Dec 2016 08:02:38 +0000 Message-ID: <94479800C636CB44BD422CB454846E013158C0EE@SHSMSX101.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-16-git-send-email-beilei.xing@intel.com> <20161227124015.GB3737@6wind.com> In-Reply-To: <20161227124015.GB3737@6wind.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 15/17] net/i40e: add flow flush function 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 08:02:43 -0000 > -----Original Message----- > From: Adrien Mazarguil [mailto:adrien.mazarguil@6wind.com] > Sent: Tuesday, December 27, 2016 8:40 PM > To: Xing, Beilei > Cc: Wu, Jingjing ; Zhang, Helin > ; dev@dpdk.org > Subject: Re: [dpdk-dev] [PATCH v2 15/17] net/i40e: add flow flush functio= n >=20 > Hi Beilei, >=20 > On Tue, Dec 27, 2016 at 02:26:22PM +0800, Beilei Xing wrote: > > This patch adds i40e_flow_flush function to flush all filters for > > users. And flow director flush function is involved first. > > > > Signed-off-by: Beilei Xing > > --- > > drivers/net/i40e/i40e_ethdev.h | 3 +++ > > drivers/net/i40e/i40e_fdir.c | 8 ++------ > > drivers/net/i40e/i40e_flow.c | 46 > ++++++++++++++++++++++++++++++++++++++++++ > > 3 files changed, 51 insertions(+), 6 deletions(-) > [...] > > diff --git a/drivers/net/i40e/i40e_flow.c > > b/drivers/net/i40e/i40e_flow.c > [...] > > +static int > > +i40e_fdir_filter_flush(struct i40e_pf *pf) { > > + struct rte_eth_dev *dev =3D pf->adapter->eth_dev; > > + struct i40e_fdir_info *fdir_info =3D &pf->fdir; > > + struct i40e_fdir_filter *fdir_filter; > > + struct i40e_flow *flow; > > + int ret =3D 0; > > + > > + ret =3D i40e_fdir_flush(dev); > > + if (!ret) { > > + /* Delete FDIR filters in FDIR list. */ > > + while ((fdir_filter =3D TAILQ_FIRST(&fdir_info->fdir_list))) > > + i40e_sw_fdir_filter_del(pf, fdir_filter); > > + > > + /* Delete FDIR flows in flow list. */ > > + TAILQ_FOREACH(flow, &pf->flow_list, node) { > > + if (flow->filter_type =3D=3D RTE_ETH_FILTER_FDIR) { > > + TAILQ_REMOVE(&pf->flow_list, flow, node); > > + rte_free(flow); > > + } > > + } >=20 > Be careful, I'm not sure calling TAILQ_REMOVE() followed by rte_free() > inside a TAILQ_FOREACH() is safe. BSD has the _SAFE() variant for this > purpose but Linux does not. >=20 Yes, thanks for reminder, I'll check it later:) > > + } > > + > > + return ret; > > +} >=20 > -- > Adrien Mazarguil > 6WIND