From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by dpdk.org (Postfix) with ESMTP id 5D7EB1B17B for ; Fri, 28 Sep 2018 12:38:44 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 28 Sep 2018 03:38:43 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,314,1534834800"; d="scan'208";a="73801976" Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203]) by fmsmga007.fm.intel.com with ESMTP; 28 Sep 2018 03:38:25 -0700 Received: from FMSMSX110.amr.corp.intel.com (10.18.116.10) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.319.2; Fri, 28 Sep 2018 03:38:25 -0700 Received: from shsmsx104.ccr.corp.intel.com (10.239.4.70) by fmsmsx110.amr.corp.intel.com (10.18.116.10) with Microsoft SMTP Server (TLS) id 14.3.319.2; Fri, 28 Sep 2018 03:38:24 -0700 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.220]) by SHSMSX104.ccr.corp.intel.com ([169.254.5.183]) with mapi id 14.03.0319.002; Fri, 28 Sep 2018 18:38:22 +0800 From: "Li, Xiaoyun" To: "Xing, Beilei" , "Yigit, Ferruh" , "Zhang, Qi Z" , "dev@dpdk.org" Thread-Topic: [PATCH] net/i40e: select fdir config automatically Thread-Index: AQHUVv2DuOMCZP/BDEi+GwUFGIM6vKUE2aCAgACnASA= Date: Fri, 28 Sep 2018 10:38:21 +0000 Message-ID: References: <20180928072453.6348-1-xiaoyun.li@intel.com> <94479800C636CB44BD422CB454846E013224BDA2@SHSMSX101.ccr.corp.intel.com> In-Reply-To: <94479800C636CB44BD422CB454846E013224BDA2@SHSMSX101.ccr.corp.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] net/i40e: select fdir config automatically 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: Fri, 28 Sep 2018 10:38:44 -0000 Will correct it in v2. Thanks. > -----Original Message----- > From: Xing, Beilei > Sent: Friday, September 28, 2018 16:40 > To: Li, Xiaoyun ; Yigit, Ferruh > ; Zhang, Qi Z ; > dev@dpdk.org > Subject: RE: [PATCH] net/i40e: select fdir config automatically >=20 >=20 >=20 > > -----Original Message----- > > From: Li, Xiaoyun > > Sent: Friday, September 28, 2018 3:25 PM > > To: Yigit, Ferruh ; Zhang, Qi Z > > ; Xing, Beilei ; > > dev@dpdk.org > > Cc: Li, Xiaoyun > > Subject: [PATCH] net/i40e: select fdir config automatically > > > > I40e driver needed users to config exact fdir mode to create rte_flow > > rules but it shouldn't. This patch allows users to create rte_flow > > rules without configuring fdir mode and let the driver select the confi= g > automatically. > > > > Signed-off-by: Xiaoyun Li > > --- > > drivers/net/i40e/i40e_flow.c | 33 ++++++++++++++++++++++++++++----- > > 1 file changed, 28 insertions(+), 5 deletions(-) > > > > diff --git a/drivers/net/i40e/i40e_flow.c > > b/drivers/net/i40e/i40e_flow.c index > > c67b264de..70ff33ac0 100644 > > --- a/drivers/net/i40e/i40e_flow.c > > +++ b/drivers/net/i40e/i40e_flow.c > > @@ -3127,6 +3127,7 @@ i40e_flow_parse_fdir_filter(struct rte_eth_dev > > *dev, > > struct rte_flow_error *error, > > union i40e_filter_t *filter) > > { > > + struct i40e_pf *pf =3D I40E_DEV_PRIVATE_TO_PF(dev->data- > > >dev_private); > > struct i40e_fdir_filter_conf *fdir_filter =3D > > &filter->fdir_filter; > > int ret; > > @@ -3148,14 +3149,29 @@ i40e_flow_parse_fdir_filter(struct > rte_eth_dev > > *dev, > > > > if (dev->data->dev_conf.fdir_conf.mode !=3D > > RTE_FDIR_MODE_PERFECT) { > > - rte_flow_error_set(error, ENOTSUP, > > - RTE_FLOW_ERROR_TYPE_UNSPECIFIED, > > - NULL, > > - "Check the mode in fdir_conf."); > > - return -rte_errno; > > + /* Enable fdir when fdir flow is added at first time. */ > > + ret =3D i40e_fdir_setup(pf); > > + if (ret !=3D I40E_SUCCESS) { > > + rte_flow_error_set(error, ENOTSUP, > > + RTE_FLOW_ERROR_TYPE_HANDLE, > > + NULL, "Failed to setup fdir."); > > + return -rte_errno; > > + } > > + ret =3D i40e_fdir_configure(dev); > > + if (ret < 0) { > > + rte_flow_error_set(error, ENOTSUP, > > + RTE_FLOW_ERROR_TYPE_HANDLE, > > + NULL, "Failed to configure fdir."); > > + goto err; > > + } > > + > > + dev->data->dev_conf.fdir_conf.mode =3D > > RTE_FDIR_MODE_PERFECT; > > } > > > > return 0; > > +err: > > + i40e_fdir_teardown(pf); > > + return -rte_errno; > > } > > > > /* Parse to get the action info of a tunnel filter @@ -4708,6 > > +4724,13 @@ i40e_flow_destroy(struct rte_eth_dev *dev, > > case RTE_ETH_FILTER_FDIR: > > ret =3D i40e_flow_add_del_fdir_filter(dev, > > &((struct i40e_fdir_filter *)flow->rule)->fdir, 0); > > + > > + /* If the last flow is destroyed, disable fdir. */ > > + if (!ret && !TAILQ_FIRST(&pf->fdir.fdir_list)) { >=20 > How about TAILQ_EMPTY which is more intuitive? >=20 > > + i40e_fdir_teardown(pf); > > + dev->data->dev_conf.fdir_conf.mode =3D > > + RTE_FDIR_MODE_NONE; > > + } >=20 > Do you consider FDIR teardown after FDIR flush? >=20 > > break; > > case RTE_ETH_FILTER_HASH: > > ret =3D i40e_config_rss_filter_del(dev, > > -- > > 2.17.1