From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id 90EF21B617 for ; Mon, 23 Oct 2017 15:22:00 +0200 (CEST) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 23 Oct 2017 06:21:58 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.43,423,1503385200"; d="scan'208";a="1208960456" Received: from irsmsx105.ger.corp.intel.com ([163.33.3.28]) by fmsmga001.fm.intel.com with ESMTP; 23 Oct 2017 06:21:57 -0700 Received: from irsmsx103.ger.corp.intel.com ([169.254.3.49]) by irsmsx105.ger.corp.intel.com ([163.33.3.28]) with mapi id 14.03.0319.002; Mon, 23 Oct 2017 14:21:54 +0100 From: "Singh, Jasvinder" To: "Iremonger, Bernard" , "dev@dpdk.org" , "Yigit, Ferruh" , "Ananyev, Konstantin" , "Dumitrescu, Cristian" , "adrien.mazarguil@6wind.com" Thread-Topic: [PATCH v9 1/4] librte_flow_classify: add flow classify library Thread-Index: AQHTSzo1NTDp90BnEE6wp34VULDwIqLxaDKA Date: Mon, 23 Oct 2017 13:21:54 +0000 Message-ID: <54CBAA185211B4429112C315DA58FF6D33278037@IRSMSX103.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> In-Reply-To: <1508679124-5922-2-git-send-email-bernard.iremonger@intel.com> Accept-Language: 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.181] 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:22:01 -0000 > --- 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 Please check dependency, I think you don't need librte_port, librte_eal, li= brte_ether > DIRS-$(CONFIG_RTE_LIBRTE_SCHED) +=3D librte_sched > DEPDIRS-librte_sched :=3D librte_eal librte_mempool librte_mbuf librte_n= et > 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 > +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_tables) > + 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; > +} Remove checks in the above function as these are already checked in query f= unction below. > +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; > +} Also, there are some compilation warnings as below; 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_flow_classify/rte_flow_classify.c:642:13: error: use of undeclared i= dentifier 'ENODATA' int ret =3D -ENODATA; Thanks, Jasvinder