From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id 76116199B6 for ; Fri, 6 Oct 2017 17:00:59 +0200 (CEST) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 06 Oct 2017 08:00:57 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.42,483,1500966000"; d="scan'208";a="320363648" Received: from irsmsx107.ger.corp.intel.com ([163.33.3.99]) by fmsmga004.fm.intel.com with ESMTP; 06 Oct 2017 08:00:55 -0700 Received: from irsmsx103.ger.corp.intel.com ([169.254.3.49]) by IRSMSX107.ger.corp.intel.com ([169.254.10.65]) with mapi id 14.03.0319.002; Fri, 6 Oct 2017 16:00:54 +0100 From: "Singh, Jasvinder" To: "Iremonger, Bernard" , "dev@dpdk.org" , "Yigit, Ferruh" , "Ananyev, Konstantin" , "Dumitrescu, Cristian" , "adrien.mazarguil@6wind.com" CC: "Iremonger, Bernard" Thread-Topic: [dpdk-dev] [PATCH v7 1/4] librte_flow_classify: add librte_flow_classify library Thread-Index: AQHTO2FRMCy0juLORkqjze0j/mNb86LW7ahQ Date: Fri, 6 Oct 2017 15:00:54 +0000 Message-ID: <54CBAA185211B4429112C315DA58FF6D33264ABA@IRSMSX103.ger.corp.intel.com> References: <1506676737-23900-1-git-send-email-bernard.iremonger@intel.com> <1506936668-31197-2-git-send-email-bernard.iremonger@intel.com> In-Reply-To: <1506936668-31197-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: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiYzlhNmNiMjctMjBjZC00ZmYyLTliN2YtZjkwNGRjYmU0MWY5IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE2LjUuOS4zIiwiVHJ1c3RlZExhYmVsSGFzaCI6ImpNZ1BQVUpSWHVvTjQ0NlVwTWplTlJQbXQ0aWFlUlpaNmhvYjNUZEVyeDg9In0= 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 v7 1/4] librte_flow_classify: add librte_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: Fri, 06 Oct 2017 15:01:01 -0000 Hi Bernard, > +struct rte_flow_classify * > +rte_flow_classify_create(void *table_handle, > + uint32_t entry_size, > + const struct rte_flow_attr *attr, > + const struct rte_flow_item pattern[], > + const struct rte_flow_action actions[], > + struct rte_flow_error *error) > +{ > + struct rte_flow_classify *flow_classify; > + int ret; > + > + if (!error) > + return NULL; > + > + if (!table_handle) { > + rte_flow_error_set(error, EINVAL, > RTE_FLOW_ERROR_TYPE_HANDLE, > + NULL, "NULL table_handle."); > + return NULL; > + } > + > + if (!pattern) { > + rte_flow_error_set(error, EINVAL, > RTE_FLOW_ERROR_TYPE_ITEM_NUM, > + NULL, "NULL pattern."); > + return NULL; > + } > + > + if (!actions) { > + rte_flow_error_set(error, EINVAL, > + RTE_FLOW_ERROR_TYPE_ACTION_NUM, > + NULL, "NULL action."); > + return NULL; > + } > + > + if (!attr) { > + rte_flow_error_set(error, EINVAL, > + RTE_FLOW_ERROR_TYPE_ATTR, > + NULL, "NULL attribute."); > + return NULL; > + } > + > + /* parse attr, pattern and actions */ > + ret =3D rte_flow_classify_validate(table_handle, attr, pattern, > + actions, error); > + if (ret < 0) > + return NULL; > + > + flow_classify =3D allocate_5tuple(); > + if (!flow_classify) > + return NULL; > + > + flow_classify->entry =3D malloc(entry_size); > + if (!flow_classify->entry) { > + free(flow_classify); > + flow_classify =3D NULL; > + return NULL; > + } > + memset(flow_classify->entry, 0, entry_size); > + memmove(flow_classify->entry, &flow_classify->id, > sizeof(uint32_t)); > + > + ret =3D rte_table_acl_ops.f_add(table_handle, &flow_classify- > >key_add, > + flow_classify->entry, &flow_classify->key_found, > + &flow_classify->entry_ptr); > + if (ret) { > + free(flow_classify->entry); > + free(flow_classify); > + flow_classify =3D NULL; > + return NULL; > + } > + > + return flow_classify; > +} The API in its current form creates the classifier object which will always= use librte_acl based classification mechanism. This behavior imposes restriction on the application to always pass only ACL table relate= d parameters for flow classification. In my opinion, API implementation should be agnostic to specific classification method and should be generic = enough to allow application to select any of the available flow classificat= ion method (for e.g. acl, hash, LPM, etc.). Otherwise, this library will be= come another abstraction of librte_acl for flow classification. Also, library allows table entries to be added while creating the classifie= r object, not later. Is there any specific reason?=20