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 C909B5F35 for ; Sat, 29 Sep 2018 10:37:54 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 29 Sep 2018 01:37:53 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,319,1534834800"; d="scan'208";a="77356648" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by orsmga008.jf.intel.com with ESMTP; 29 Sep 2018 01:37:02 -0700 Received: from fmsmsx115.amr.corp.intel.com (10.18.116.19) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.319.2; Sat, 29 Sep 2018 01:37:02 -0700 Received: from shsmsx152.ccr.corp.intel.com (10.239.6.52) by fmsmsx115.amr.corp.intel.com (10.18.116.19) with Microsoft SMTP Server (TLS) id 14.3.319.2; Sat, 29 Sep 2018 01:37:02 -0700 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.220]) by SHSMSX152.ccr.corp.intel.com ([169.254.6.37]) with mapi id 14.03.0319.002; Sat, 29 Sep 2018 16:37:00 +0800 From: "Xing, Beilei" To: "Li, Xiaoyun" , "Zhang, Qi Z" , "Yigit, Ferruh" CC: "dev@dpdk.org" Thread-Topic: [PATCH v2] net/i40e: select fdir config automatically Thread-Index: AQHUVxwU2iMOKF8Y40atcRB6l1GBuaUG8Dig Date: Sat, 29 Sep 2018 08:36:59 +0000 Message-ID: <94479800C636CB44BD422CB454846E013224C3C2@SHSMSX101.ccr.corp.intel.com> References: <20180928072453.6348-1-xiaoyun.li@intel.com> <20180928110303.90561-1-xiaoyun.li@intel.com> In-Reply-To: <20180928110303.90561-1-xiaoyun.li@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] 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: Sat, 29 Sep 2018 08:37:55 -0000 > -----Original Message----- > From: Li, Xiaoyun > Sent: Friday, September 28, 2018 7:03 PM > To: Xing, Beilei ; Zhang, Qi Z ; > Yigit, Ferruh > Cc: dev@dpdk.org; Li, Xiaoyun > Subject: [PATCH v2] net/i40e: select fdir config automatically >=20 > I40e driver needed users to config exact fdir mode to create rte_flow rul= es > but it shouldn't. This patch allows users to create rte_flow rules withou= t > configuring fdir mode and let the driver select the config automatically.= And > remove the workaround in flow_filtering example. >=20 > Signed-off-by: Xiaoyun Li > --- > v2: > * Added fdir teardown in i40e_flow_flush_fdir_filter. > * Replace TAILQ_FIRST with TAILQ_EMPTY which is more intuitive. > * Remove the workaround in flow_filtering example since the driver will > * set the fdir config automatically. > --- > drivers/net/i40e/i40e_flow.c | 35 +++++++++++++++++++++++++++++----- > examples/flow_filtering/main.c | 16 ---------------- > 2 files changed, 30 insertions(+), 21 deletions(-) >=20 > diff --git a/drivers/net/i40e/i40e_flow.c b/drivers/net/i40e/i40e_flow.c = index > c67b264de..68ae00a27 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, >=20 > 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; > } >=20 > return 0; > +err: > + i40e_fdir_teardown(pf); > + return -rte_errno; > } >=20 > /* 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_EMPTY(&pf->fdir.fdir_list)) { Should be if (!ret && TAILQ_EMPTY(&pf->fdir.fdir_list)) here? > + i40e_fdir_teardown(pf); > + dev->data->dev_conf.fdir_conf.mode =3D > + RTE_FDIR_MODE_NONE; > + } > break; > case RTE_ETH_FILTER_HASH: > ret =3D i40e_config_rss_filter_del(dev, @@ -4900,6 +4923,8 > @@ i40e_flow_flush_fdir_filter(struct i40e_pf *pf) > pf->fdir.inset_flag[pctype] =3D 0; > } >=20 > + i40e_fdir_teardown(pf); > + > return ret; > } >=20 > diff --git a/examples/flow_filtering/main.c b/examples/flow_filtering/mai= n.c > index b3f85b563..a73d120e3 100644 > --- a/examples/flow_filtering/main.c > +++ b/examples/flow_filtering/main.c > @@ -131,22 +131,6 @@ init_port(void) > DEV_TX_OFFLOAD_SCTP_CKSUM | > DEV_TX_OFFLOAD_TCP_TSO, > }, > - /* > - * Initialize fdir_conf of rte_eth_conf. > - * Fdir is used in flow filtering for I40e, > - * so rte_flow rules involve some fdir > - * configurations. In long term it's better > - * that drivers don't require any fdir > - * configuration for rte_flow, but we need to > - * get this workaround so that sample app can > - * run on I40e. > - */ > - .fdir_conf =3D { > - .mode =3D RTE_FDIR_MODE_PERFECT, > - .pballoc =3D RTE_FDIR_PBALLOC_64K, > - .status =3D RTE_FDIR_REPORT_STATUS, > - .drop_queue =3D 127, > - }, > }; > struct rte_eth_txconf txq_conf; > struct rte_eth_rxconf rxq_conf; > -- > 2.17.1