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 34F2D1B5E7 for ; Mon, 23 Oct 2017 15:37:43 +0200 (CEST) Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga104.jf.intel.com with ESMTP; 23 Oct 2017 06:37:42 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.43,423,1503385200"; d="scan'208";a="141246915" Received: from irsmsx151.ger.corp.intel.com ([163.33.192.59]) by orsmga004.jf.intel.com with ESMTP; 23 Oct 2017 06:37:41 -0700 Received: from irsmsx112.ger.corp.intel.com (10.108.20.5) by IRSMSX151.ger.corp.intel.com (163.33.192.59) with Microsoft SMTP Server (TLS) id 14.3.319.2; Mon, 23 Oct 2017 14:37:40 +0100 Received: from irsmsx108.ger.corp.intel.com ([169.254.11.167]) by irsmsx112.ger.corp.intel.com ([169.254.1.12]) with mapi id 14.03.0319.002; Mon, 23 Oct 2017 14:37:39 +0100 From: "Iremonger, Bernard" To: "Singh, Jasvinder" , "dev@dpdk.org" , "Yigit, Ferruh" , "Ananyev, Konstantin" , "Dumitrescu, Cristian" , "adrien.mazarguil@6wind.com" CC: "Iremonger, Bernard" Thread-Topic: [PATCH v9 1/4] librte_flow_classify: add flow classify library Thread-Index: AQHTSzo1iVl7fRqlm0WVM7cguHg99qLxXJEAgAAT5XA= Date: Mon, 23 Oct 2017 13:37:39 +0000 Message-ID: <8CEF83825BEC744B83065625E567D7C24E054F71@IRSMSX108.ger.corp.intel.com> References: <1508271970-2229-1-git-send-email-bernard.iremonger@intel.com> <1508679124-5922-2-git-send-email-bernard.iremonger@intel.com> <54CBAA185211B4429112C315DA58FF6D33278037@IRSMSX103.ger.corp.intel.com> In-Reply-To: <54CBAA185211B4429112C315DA58FF6D33278037@IRSMSX103.ger.corp.intel.com> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiNzg2NjA2M2UtOTYxMi00MDgyLThjOGMtMWY1OTYzNDYxMmJlIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE2LjUuOS4zIiwiVHJ1c3RlZExhYmVsSGFzaCI6IklrMCtIcjZ1a0ZoWFdoOXU2NEo1c1BPekVSTmRkZitzcytPRm5CYlBzanM9In0= x-ctpclassification: CTP_IC dlp-product: dlpe-windows dlp-version: 11.0.0.116 dlp-reaction: no-action x-originating-ip: [163.33.239.182] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH v9 1/4] librte_flow_classify: add flow classify library 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: Mon, 23 Oct 2017 13:37:43 -0000 Hi Jasvinder, Thanks for reviewing. > -----Original Message----- > From: Singh, Jasvinder > Sent: Monday, October 23, 2017 2:22 PM > To: Iremonger, Bernard ; dev@dpdk.org; > Yigit, Ferruh ; Ananyev, Konstantin > ; Dumitrescu, Cristian > ; adrien.mazarguil@6wind.com > Subject: RE: [PATCH v9 1/4] librte_flow_classify: add flow classify libra= ry >=20 > > > --- a/lib/Makefile > > +++ b/lib/Makefile > > @@ -83,6 +83,9 @@ DIRS-$(CONFIG_RTE_LIBRTE_POWER) +=3D > librte_power > > DEPDIRS-librte_power :=3D librte_eal > > DIRS-$(CONFIG_RTE_LIBRTE_METER) +=3D librte_meter DEPDIRS- > librte_meter > > :=3D librte_eal > > +DIRS-$(CONFIG_RTE_LIBRTE_FLOW_CLASSIFY) +=3D librte_flow_classify > > +DEPDIRS-librte_flow_classify :=3D librte_eal librte_ether librte_net > > +DEPDIRS-librte_flow_classify +=3D librte_table librte_acl librte_port >=20 > Please check dependency, I think you don't need librte_port, librte_eal, > librte_ether I will check dependency > > DIRS-$(CONFIG_RTE_LIBRTE_SCHED) +=3D librte_sched DEPDIRS- > librte_sched > > :=3D librte_eal librte_mempool librte_mbuf librte_net > > DEPDIRS-librte_sched +=3D librte_timer diff --git > > a/lib/librte_eal/common/include/rte_log.h > > b/lib/librte_eal/common/include/rte_log.h > > index 2fa1199..67209ae 100644 > > --- a/lib/librte_eal/common/include/rte_log.h > > +++ b/lib/librte_eal/common/include/rte_log.h > > @@ -88,6 +88,7 @@ struct rte_logs { > > #define RTE_LOGTYPE_EFD 18 /**< Log related to EFD. */ > > #define RTE_LOGTYPE_EVENTDEV 19 /**< Log related to eventdev. */ > > #define RTE_LOGTYPE_GSO 20 /**< Log related to GSO. */ > > +#define RTE_LOGTYPE_CLASSIFY 21 /**< Log related to flow classify. > > +*/ > > >=20 > >=20 > > +static int > > +flow_classifier_run(struct rte_flow_classifier *cls, > > + uint32_t table_id, > > + struct rte_mbuf **pkts, > > + const uint16_t nb_pkts) > > +{ > > + int ret =3D -EINVAL; > > + uint64_t pkts_mask; > > + uint64_t lookup_hit_mask; > > + > > + if (!cls || !pkts || nb_pkts =3D=3D 0 || table_id >=3D cls->num_table= s) > > + return ret; > > + > > + if (cls->tables[table_id].ops.f_lookup !=3D NULL) { > > + pkts_mask =3D RTE_LEN2MASK(nb_pkts, uint64_t); > > + ret =3D cls->tables[table_id].ops.f_lookup( > > + cls->tables[table_id].h_table, > > + pkts, pkts_mask, &lookup_hit_mask, > > + (void **)cls->entries); > > + > > + if (!ret && lookup_hit_mask) > > + cls->nb_pkts =3D nb_pkts; > > + else > > + cls->nb_pkts =3D 0; > > + } > > + > > + return ret; > > +} >=20 > Remove checks in the above function as these are already checked in query > function below. Ok, will do. =20 > > +static int > > +action_apply(struct rte_flow_classifier *cls, > > + struct rte_flow_classify_rule *rule, > > + struct rte_flow_classify_stats *stats) { > > + struct rte_flow_classify_ipv4_5tuple_stats *ntuple_stats; > > + uint64_t count =3D 0; > > + int i; > > + int ret =3D -ENODATA; > > + > > + switch (rule->action.type) { > > + case RTE_FLOW_ACTION_TYPE_COUNT: > > + for (i =3D 0; i < cls->nb_pkts; i++) { > > + if (rule->id =3D=3D cls->entries[i]->rule_id) > > + count++; > > + } > > + if (count) { > > + ret =3D 0; > > + ntuple_stats =3D > > + (struct rte_flow_classify_ipv4_5tuple_stats > > *) > > + stats->stats; > > + ntuple_stats->counter1 =3D count; > > + ntuple_stats->ipv4_5tuple =3D rule- > > >rules.u.ipv4_5tuple; > > + } > > + break; > > + default: > > + ret =3D -ENOTSUP; > > + break; > > + } > > + > > + return ret; > > +} > > + > > +int > > +rte_flow_classifier_query(struct rte_flow_classifier *cls, > > + uint32_t table_id, > > + struct rte_mbuf **pkts, > > + const uint16_t nb_pkts, > > + struct rte_flow_classify_rule *rule, > > + struct rte_flow_classify_stats *stats) { > > + int ret =3D -EINVAL; > > + > > + if (!cls || !rule || !stats || !pkts || nb_pkts =3D=3D 0 || > > + table_id >=3D cls->num_tables) > > + return ret; > > + > > + ret =3D flow_classifier_run(cls, table_id, pkts, nb_pkts); > > + if (!ret) > > + ret =3D action_apply(cls, rule, stats); > > + return ret; > > +} >=20 >=20 > Also, there are some compilation warnings as below; >=20 > Failed Build #1: > OS: FreeBSD10.3_64 > Target: x86_64-native-bsdapp-clang, x86_64-native-bsdapp-gcc > SYMLINK-FILE > include/rte_flow_classify.h/home/patchWorkOrg/compilation/lib/librte_flo > w_classify/rte_flow_classify.c:642:13: error: use of undeclared identifie= r > 'ENODATA' > int ret =3D -ENODATA; Ok, I will replace -ENODAT with -EINVAL =20 =20 > Thanks, > Jasvinder I will seed a v10 patch set. Regards, Bernard.