From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f54.google.com (mail-wm0-f54.google.com [74.125.82.54]) by dpdk.org (Postfix) with ESMTP id ADE7A532E for ; Tue, 27 Dec 2016 13:40:23 +0100 (CET) Received: by mail-wm0-f54.google.com with SMTP id k184so88385643wme.1 for ; Tue, 27 Dec 2016 04:40:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=jGvyoXpyr+oe9Lu1eJI65wLQyNyjeQ/dOFnb3Hwy8/s=; b=abNlBKCsJNq2425Aw6BH/LdjxRr5cwnN9xC4AWC1fyUctww2e564/RRBQSQ9yQNaec qUSB8DJ3AffIwUKa51kDhvrGak/kS4f62U0sCSrtV7IJMpUGLChMpknSlCwSlmDDKG2d qPyYsiumf7sZxQ7FfMMiKlm/hoJMD6VrMjoDL/vWpiuiTQnYpUx8pD4Fu+XNCIysL9Ub AagBw5lVclhXuQO69paD8M7f44RfXkNOZz9pajkg9i2JFF4E/vv1cHDssIJsdHBgckVW grEgRZqchuiDvT+UZwBOrCw8qHyrEwrMonAtpQnpN6Z5Et2cOnJV4dVHKK5I/UyVHLeq Ij4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=jGvyoXpyr+oe9Lu1eJI65wLQyNyjeQ/dOFnb3Hwy8/s=; b=PV5wvP6BdngXBxyhgdqXYC2vBfUnlGkHHvAwl58bHp0ktULMAJDMAXcU2dYe/2z3aJ 0l2H1uTrDFeC0eAT2yAD8R+mu6af02NjwF0nFwQaNMZxLa1JDHwdkdEtZnrbDdGpTaad GMlBapEKDwachZM/8Rc5HsyU3iBcEMOnXclTwrMP6ilOEJHCbbwZYmcBoonHNOi5PAfI 8/HO1hzO4G5on5GVwiHKYQZ6HnnLqhasc9HXUJvpvjs3lUt4zl7NocT7OF22+VTsUlpF QERYMKxFe4vSk5ap78Vt+F2PHwUukP6UbLD0Y6BvEHxdkmZSywMEARAPMjlFroYE70qL vFng== X-Gm-Message-State: AIkVDXKR0sPw5Fr6HEsTrPz5k6V2ybXZE5SBvC7LfQfIDv2S6YYzcrac6JGUz0Zo3HBBk8W6 X-Received: by 10.28.214.84 with SMTP id n81mr26537313wmg.120.1482842423307; Tue, 27 Dec 2016 04:40:23 -0800 (PST) Received: from 6wind.com (guy78-3-82-239-227-177.fbx.proxad.net. [82.239.227.177]) by smtp.gmail.com with ESMTPSA id w197sm55839973wmd.11.2016.12.27.04.40.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 27 Dec 2016 04:40:22 -0800 (PST) Date: Tue, 27 Dec 2016 13:40:15 +0100 From: Adrien Mazarguil To: Beilei Xing Cc: jingjing.wu@intel.com, helin.zhang@intel.com, dev@dpdk.org Message-ID: <20161227124015.GB3737@6wind.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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1482819984-14120-16-git-send-email-beilei.xing@intel.com> 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: Tue, 27 Dec 2016 12:40:23 -0000 Hi Beilei, 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 = pf->adapter->eth_dev; > + struct i40e_fdir_info *fdir_info = &pf->fdir; > + struct i40e_fdir_filter *fdir_filter; > + struct i40e_flow *flow; > + int ret = 0; > + > + ret = i40e_fdir_flush(dev); > + if (!ret) { > + /* Delete FDIR filters in FDIR list. */ > + while ((fdir_filter = 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 == RTE_ETH_FILTER_FDIR) { > + TAILQ_REMOVE(&pf->flow_list, flow, node); > + rte_free(flow); > + } > + } 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. > + } > + > + return ret; > +} -- Adrien Mazarguil 6WIND