From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id 1E733293B for ; Wed, 6 Dec 2017 13:04:11 +0100 (CET) Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 06 Dec 2017 04:04:10 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.45,367,1508828400"; d="scan'208";a="596325" Received: from irsmsx102.ger.corp.intel.com ([163.33.3.155]) by orsmga006.jf.intel.com with ESMTP; 06 Dec 2017 04:04:09 -0800 Received: from irsmsx108.ger.corp.intel.com ([169.254.11.167]) by IRSMSX102.ger.corp.intel.com ([169.254.2.180]) with mapi id 14.03.0319.002; Wed, 6 Dec 2017 12:04:03 +0000 From: "Iremonger, Bernard" To: "Singh, Jasvinder" , "dev@dpdk.org" Thread-Topic: [PATCH 3/3] doc: update documentation for flow classify lib Thread-Index: AQHTZEz6f9MMpeaLREaieZfpR+qTraM2SelA Date: Wed, 6 Dec 2017 12:04:02 +0000 Message-ID: <8CEF83825BEC744B83065625E567D7C24E064C27@IRSMSX108.ger.corp.intel.com> References: <20171123113215.64757-1-jasvinder.singh@intel.com> <20171123113215.64757-3-jasvinder.singh@intel.com> In-Reply-To: <20171123113215.64757-3-jasvinder.singh@intel.com> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiNTZiZGU4N2YtMjc4My00MTIxLWFhZjItMzQyNGMwYWQ0ZmY0IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjIuNS4xOCIsIlRydXN0ZWRMYWJlbEhhc2giOiJTVlppSUdMNUNuVko0SFJ3NjdMUVhxREpodVM5UEp0TXRCb0duNmwxRFg1aDN5cGRtR0szZVY4RFhKRjh5YlwveCJ9 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 3/3] doc: update documentation for flow classify lib 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: Wed, 06 Dec 2017 12:04:12 -0000 Hi Jasvinder > -----Original Message----- > From: Singh, Jasvinder > Sent: Thursday, November 23, 2017 11:32 AM > To: dev@dpdk.org > Cc: Iremonger, Bernard > Subject: [PATCH 3/3] doc: update documentation for flow classify lib >=20 > Updates the documentation for flow classification library and sample > application. >=20 > Signed-off-by: Jasvinder Singh > --- > doc/guides/prog_guide/flow_classify_lib.rst | 79 +++++++++++++++++------= ----- > - doc/guides/sample_app_ug/flow_classify.rst | 8 +-- > 2 files changed, 49 insertions(+), 38 deletions(-) >=20 > diff --git a/doc/guides/prog_guide/flow_classify_lib.rst > b/doc/guides/prog_guide/flow_classify_lib.rst > index 820dc72..519117c 100644 > --- a/doc/guides/prog_guide/flow_classify_lib.rst > +++ b/doc/guides/prog_guide/flow_classify_lib.rst > @@ -101,30 +101,26 @@ The library has the following API's > * Handle to flow classifier instance > * @param params > * Parameters for flow_classify table creation > - * @param table_id > - * Table ID. Valid only within the scope of table IDs of the curre= nt > - * classifier. Only returned after a successful invocation. > * @return > * 0 on success, error code otherwise > */ > int > rte_flow_classify_table_create(struct rte_flow_classifier *cls, > - struct rte_flow_classify_table_params *params, > - uint32_t *table_id); > + struct rte_flow_classify_table_params *params); >=20 > /** > * Add a flow classify rule to the flow_classifier table. > * > * @param[in] cls > * Flow classifier handle > - * @param[in] table_id > - * id of table > * @param[in] attr > * Flow rule attributes > * @param[in] pattern > * Pattern specification (list terminated by the END pattern item)= . > * @param[in] actions > * Associated actions (list terminated by the END pattern item). > + * @param[out] key_found > + * returns 1 if rule present already, 0 otherwise. > * @param[out] error > * Perform verbose error reporting if not NULL. Structure > * initialised in case of error only. > @@ -133,10 +129,10 @@ The library has the following API's > */ > struct rte_flow_classify_rule * > rte_flow_classify_table_entry_add(struct rte_flow_classifier *cls, > - uint32_t table_id, > const struct rte_flow_attr *attr, > const struct rte_flow_item pattern[], > const struct rte_flow_action actions[], > + int *key_found; > struct rte_flow_error *error); >=20 > /** > @@ -144,8 +140,6 @@ The library has the following API's > * > * @param[in] cls > * Flow classifier handle > - * @param[in] table_id > - * id of table > * @param[in] rule > * Flow classify rule > * @return > @@ -153,16 +147,37 @@ The library has the following API's > */ > int > rte_flow_classify_table_entry_delete(struct rte_flow_classifier *cls= , > - uint32_t table_id, > struct rte_flow_classify_rule *rule); >=20 > /** > + * Flow classifier run. > + * > + * As a result of lookup operation, flow classifer idenfies the > + * table entries that are hit and executes the actions on the packet= s. > + * > + * @param[in] cls > + * Flow classifier handle > + * @param[in] pkts > + * Pointer to packets to process > + * @param[in] nb_pkts > + * Number of packets to process > + * @param[in] pkt_offset > + * Offset to store action metadata in the mbuf headroom > + * > + * @return > + * 0 on success, error code otherwise. > + */ > + int > + rte_flow_classifier_run(struct rte_flow_classifier *cls, > + struct rte_mbuf **pkts, > + const uint16_t nb_pkts, > + uint32_t pkt_offset); > + > + /** > * Query flow classifier for given rule. > * > * @param[in] cls > * Flow classifier handle > - * @param[in] table_id > - * id of table > * @param[in] pkts > * Pointer to packets to process > * @param[in] nb_pkts > @@ -177,7 +192,6 @@ The library has the following API's > */ > 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, @@ -200,16 +214,13 @@ a= pplication > before calling the API. > /** CPU socket ID where memory for the flow classifier and its *= / > /** elements (tables) should be allocated */ > int socket_id; > - > - /** Table type */ > - enum rte_flow_classify_table_type type; > }; >=20 > The ``Classifier`` has the following internal structures: >=20 > .. code-block:: c >=20 > - struct rte_table { > + struct rte_cls_table { > /* Input parameters */ > struct rte_table_ops ops; > uint32_t entry_size; > @@ -225,11 +236,16 @@ The ``Classifier`` has the following internal struc= tures: > /* Input parameters */ > char name[RTE_FLOW_CLASSIFIER_MAX_NAME_SZ]; > int socket_id; > - enum rte_flow_classify_table_type type; >=20 > - /* Internal tables */ > - struct rte_table tables[RTE_FLOW_CLASSIFY_TABLE_MAX]; > + /* Internal */ > + /* ntuple_fliter */ > + struct rte_eth_ntuple_filter ntuple_filter; > + > + /* clasifier tables */ > + struct rte_cls_table tables[RTE_FLOW_CLASSIFY_TABLE_MAX]; > + uint32_t table_mask; > uint32_t num_tables; > + > uint16_t nb_pkts; > struct rte_flow_classify_table_entry > *entries[RTE_PORT_IN_BURST_SIZE_MAX]; > @@ -252,9 +268,8 @@ application before calling the API. > /** Opaque param to be passed to the table create operation */ > void *arg_create; >=20 > - /** Memory size to be reserved per classifier object entry for *= / > - /** storing meta data */ > - uint32_t table_metadata_size; > + /** Classifier table type */ > + enum rte_flow_classify_table_type type; > }; >=20 > To create an ACL table the ``rte_table_acl_params`` structure must be @@= - > 321,7 +336,7 @@ IPv4 5-tuple pattern, attributes and actions and returns = the 5- > tuple data in the .. code-block:: c >=20 > static int > - flow_classify_parse_flow( > + flow_classify_parse_flow(struct rte_flow_classifier *cls, This should be rte_flow_classify_validate now. > const struct rte_flow_attr *attr, > const struct rte_flow_item pattern[], > const struct rte_flow_action actions[], @@ -355,24 +3= 70,24 @@ > parses the Flow rule. >=20 > struct rte_flow_classify { > uint32_t id; /* unique ID of classify object */ > - struct rte_flow_action action; /* action when match found */ > - struct classify_rules rules; /* union of rules */ > + enum rte_flow_classify_table_type tbl_type; /* rule table */ > + struct classify_rules rules; /* union of rules */ > union { > struct acl_keys key; > } u; > int key_found; /* rule key found in table */ > - void *entry; /* pointer to buffer to hold rule meta data */ > - void *entry_ptr; /* handle to the table entry for rule meta data= */ > + struct rte_flow_classify_table_entry entry; /* rule meta data *= / > + void *entry_ptr; /* handle to the table entry for rule meta data > + */ > }; >=20 > -It then calls the ``table[table_id].ops.f_add`` API to add the rule to t= he ACL > +It then calls the ``table.ops.f_add`` API to add the rule to the ACL > table. >=20 > Deleting Flow Rules > ~~~~~~~~~~~~~~~~~~~ >=20 > The ``rte_flow_classify_table_entry_delete`` API calls the - > ``table[table_id].ops.f_delete`` API to delete a rule from the ACL table. > +``table.ops.f_delete`` API to delete a rule from the ACL table. >=20 > Packet Matching > ~~~~~~~~~~~~~~~ > @@ -380,7 +395,7 @@ Packet Matching > The ``rte_flow_classifier_query`` API is used to find packets which matc= h a > given flow Flow rule in the table. > This API calls the flow_classify_run internal function which calls the - > ``table[table_id].ops.f_lookup`` API to see if any packets in a burst mat= ch any > +``table.ops.f_lookup`` API to see if any packets in a burst match any > of the Flow rules in the table. > The meta data for the highest priority rule matched for each packet is r= eturned > in the entries array in the ``rte_flow_classify`` object. > diff --git a/doc/guides/sample_app_ug/flow_classify.rst > b/doc/guides/sample_app_ug/flow_classify.rst > index bc12b87..427fded 100644 > --- a/doc/guides/sample_app_ug/flow_classify.rst > +++ b/doc/guides/sample_app_ug/flow_classify.rst > @@ -228,7 +228,6 @@ table`` to the flow classifier. >=20 > struct flow_classifier { > struct rte_flow_classifier *cls; > - uint32_t table_id[RTE_FLOW_CLASSIFY_TABLE_MAX]; > }; >=20 > struct flow_classifier_acl { > @@ -243,7 +242,6 @@ table`` to the flow classifier. >=20 > cls_params.name =3D "flow_classifier"; > cls_params.socket_id =3D socket_id; > - cls_params.type =3D RTE_FLOW_CLASSIFY_TABLE_TYPE_ACL; >=20 > cls_app->cls =3D rte_flow_classifier_create(&cls_params); > if (cls_app->cls =3D=3D NULL) { > @@ -260,10 +258,9 @@ table`` to the flow classifier. > /* initialise table create params */ > cls_table_params.ops =3D &rte_table_acl_ops, > cls_table_params.arg_create =3D &table_acl_params, > - cls_table_params.table_metadata_size =3D 0; > + cls_table_params.type =3D RTE_FLOW_CLASSIFY_TABLE_ACL_IP4_5TUPLE; >=20 > - ret =3D rte_flow_classify_table_create(cls_app->cls, &cls_table_para= ms, > - &cls->table_id[0]); > + ret =3D rte_flow_classify_table_create(cls_app->cls, > + &cls_table_params); > if (ret) { > rte_flow_classifier_free(cls_app->cls); > rte_free(cls); > @@ -495,7 +492,6 @@ following: > if (rules[i]) { > ret =3D rte_flow_classifier_query( > cls_app->cls, > - cls_app->table_id[0], > bufs, nb_rx, rules[i], > &classify_stats); > if (ret) > -- > 2.9.3 Regards, Bernard.