Message ID | 1460359379-3704-1-git-send-email-bala.manoharan@linaro.org |
---|---|
State | New |
Headers | show |
On Mon, Apr 11, 2016 at 2:22 AM, Balasubramanian Manoharan < bala.manoharan@linaro.org> wrote: > This RFC adds classification capability structure and PMR range > functionality. The implementation patch will be posted once consensus > is reached on API definition. > > Signed-off-by: Balasubramanian Manoharan <bala.manoharan@linaro.org> > --- > include/odp/api/spec/classification.h | 61 > ++++++++++++++++++++++++++--------- > 1 file changed, 45 insertions(+), 16 deletions(-) > > diff --git a/include/odp/api/spec/classification.h > b/include/odp/api/spec/classification.h > index 076b3de..1fcc520 100644 > --- a/include/odp/api/spec/classification.h > +++ b/include/odp/api/spec/classification.h > @@ -55,6 +55,24 @@ extern "C" { > */ > > /** > + * Classification capabilities > + * This capability structure defines system level classfication capability > + */ > +typedef struct odp_cls_capability_t { > + /** PMR terms supported by the classifier, > + A mask one bit for each of odp_pmr_term_t */ > + unsigned long long supported_pmr_terms; > + /** Maximum number of PMR terms */ > + unsigned max_pmr_terms; > + /** Number of PMR terms available for use now */ > + unsigned available_pmr_terms; > + /** Maximum number of CoS supported */ > + unsigned max_cos; > + /* A Boolean to denote support of PMR range */ > + bool pmr_range_supported; > +} odp_cls_capability_t; > + > +/** > * class of service packet drop policies > */ > typedef enum { > @@ -103,6 +121,17 @@ typedef struct odp_cls_cos_param { > void odp_cls_cos_param_init(odp_cls_cos_param_t *param); > > /** > + * Query classification capabilities > + * > + * Outputs classification capabilities on success. > + * > + * @param[out] capability Classification capability structure for > output > + * @retval 0 on success > + * @retval <0 on failure > + */ > +int odp_cls_capability(odp_cls_capability_t *capability); > + > +/** > * Create a class-of-service > * > * @param name String intended for debugging purposes. > @@ -272,8 +301,22 @@ typedef enum { > */ > typedef struct odp_pmr_match_t { > It looks strange to call this an odp_pmr_match_t and then have a subtype that says whether the match is actually a match or really a range. If we're introducing two types of PMRs then it would seem to make is clearer to rename the containing struct to be odp_pmr_t. For completeness we should also have an odp_pmr_init() API to do standard initialization of such for forward compatibility. > odp_pmr_term_t term; /**< PMR term value to be matched */ > - const void *val; /**< Value to be matched */ > - const void *mask; /**< Masked set of bits to be matched */ > + bool match; /**< True if the value is match and false if range > */ > Do we want match type rules to be the default or range type rules to be the default? Since match is more likely to be the default it would seem to flip this and call the field range with range = false (i.e., match rule) the default. This could also be an enum (rule_type) with the default being rule_type_match so that in future you could have rule types beyond just match or range. > + union { > + struct { > + /**< Value to be matched */ > + const void *val; > + /**< Masked set of bits to be matched */ > + const void *mask; > + } match; > + struct { > + /* Start and End values are included in the range > */ > + /**< start value of range */ > + const void *val_start; > + /**< End value of range */ > + const void *val_end; > + } range; > + }; > uint32_t val_sz; /**< Size of the term value */ > uint32_t offset; /**< User-defined offset in packet > Used if term == ODP_PMR_CUSTOM_FRAME only, > @@ -323,20 +366,6 @@ odp_pmr_t odp_cls_pmr_create(const odp_pmr_match_t > *terms, int num_terms, > int odp_cls_pmr_destroy(odp_pmr_t pmr_id); > > /** > - * Inquire about matching terms supported by the classifier > - * > - * @return A mask one bit per enumerated term, one for each of > odp_pmr_term_t > - */ > -unsigned long long odp_pmr_terms_cap(void); > - > -/** > - * Return the number of packet matching terms available for use > - * > - * @return A number of packet matcher resources available for use. > - */ > -unsigned odp_pmr_terms_avail(void); > - > -/** > * Assigns a packet pool for a specific class of service. > * All the packets belonging to the given class of service will > * be allocated from the assigned packet pool. > -- > 1.9.1 > > _______________________________________________ > lng-odp mailing list > lng-odp@lists.linaro.org > https://lists.linaro.org/mailman/listinfo/lng-odp >
Regards, Bala On 12 April 2016 at 03:19, Bill Fischofer <bill.fischofer@linaro.org> wrote: > > > On Mon, Apr 11, 2016 at 2:22 AM, Balasubramanian Manoharan < > bala.manoharan@linaro.org> wrote: > >> This RFC adds classification capability structure and PMR range >> functionality. The implementation patch will be posted once consensus >> is reached on API definition. >> >> Signed-off-by: Balasubramanian Manoharan <bala.manoharan@linaro.org> >> --- >> include/odp/api/spec/classification.h | 61 >> ++++++++++++++++++++++++++--------- >> 1 file changed, 45 insertions(+), 16 deletions(-) >> >> diff --git a/include/odp/api/spec/classification.h >> b/include/odp/api/spec/classification.h >> index 076b3de..1fcc520 100644 >> --- a/include/odp/api/spec/classification.h >> +++ b/include/odp/api/spec/classification.h >> @@ -55,6 +55,24 @@ extern "C" { >> */ >> >> /** >> + * Classification capabilities >> + * This capability structure defines system level classfication >> capability >> + */ >> +typedef struct odp_cls_capability_t { >> + /** PMR terms supported by the classifier, >> + A mask one bit for each of odp_pmr_term_t */ >> + unsigned long long supported_pmr_terms; >> + /** Maximum number of PMR terms */ >> + unsigned max_pmr_terms; >> + /** Number of PMR terms available for use now */ >> + unsigned available_pmr_terms; >> + /** Maximum number of CoS supported */ >> + unsigned max_cos; >> + /* A Boolean to denote support of PMR range */ >> + bool pmr_range_supported; >> +} odp_cls_capability_t; >> + >> +/** >> * class of service packet drop policies >> */ >> typedef enum { >> @@ -103,6 +121,17 @@ typedef struct odp_cls_cos_param { >> void odp_cls_cos_param_init(odp_cls_cos_param_t *param); >> >> /** >> + * Query classification capabilities >> + * >> + * Outputs classification capabilities on success. >> + * >> + * @param[out] capability Classification capability structure for >> output >> + * @retval 0 on success >> + * @retval <0 on failure >> + */ >> +int odp_cls_capability(odp_cls_capability_t *capability); >> + >> +/** >> * Create a class-of-service >> * >> * @param name String intended for debugging purposes. >> @@ -272,8 +301,22 @@ typedef enum { >> */ >> typedef struct odp_pmr_match_t { >> > > It looks strange to call this an odp_pmr_match_t and then have a subtype > that says whether the match is actually a match or really a range. If we're > introducing two types of PMRs then it would seem to make is clearer to > rename the containing struct to be odp_pmr_t. For completeness we should > also have an odp_pmr_init() API to do standard initialization of such for > forward compatibility. > Agreed. We can name it odp_pmr_params_t since odp_pmr_t is a handle name. > > >> odp_pmr_term_t term; /**< PMR term value to be matched */ >> - const void *val; /**< Value to be matched */ >> - const void *mask; /**< Masked set of bits to be matched */ >> + bool match; /**< True if the value is match and false if >> range */ >> > > Do we want match type rules to be the default or range type rules to be > the default? Since match is more likely to be the default it would seem to > flip this and call the field range with range = false (i.e., match rule) > the default. This could also be an enum (rule_type) with the default being > rule_type_match so that in future you could have rule types beyond just > match or range. > The idea was to have match as default and yes we can flip the boolean to make match as default. I do not foresee a scenario where the value matching will be anything other than match and range but if it is needed we can convert this to an enum. Regards, Bala > > >> + union { >> + struct { >> + /**< Value to be matched */ >> + const void *val; >> + /**< Masked set of bits to be matched */ >> + const void *mask; >> + } match; >> + struct { >> + /* Start and End values are included in the range >> */ >> + /**< start value of range */ >> + const void *val_start; >> + /**< End value of range */ >> + const void *val_end; >> + } range; >> + }; >> uint32_t val_sz; /**< Size of the term value */ >> uint32_t offset; /**< User-defined offset in packet >> Used if term == ODP_PMR_CUSTOM_FRAME >> only, >> @@ -323,20 +366,6 @@ odp_pmr_t odp_cls_pmr_create(const odp_pmr_match_t >> *terms, int num_terms, >> int odp_cls_pmr_destroy(odp_pmr_t pmr_id); >> >> /** >> - * Inquire about matching terms supported by the classifier >> - * >> - * @return A mask one bit per enumerated term, one for each of >> odp_pmr_term_t >> - */ >> -unsigned long long odp_pmr_terms_cap(void); >> - >> -/** >> - * Return the number of packet matching terms available for use >> - * >> - * @return A number of packet matcher resources available for use. >> - */ >> -unsigned odp_pmr_terms_avail(void); >> - >> -/** >> * Assigns a packet pool for a specific class of service. >> * All the packets belonging to the given class of service will >> * be allocated from the assigned packet pool. >> -- >> 1.9.1 >> >> _______________________________________________ >> lng-odp mailing list >> lng-odp@lists.linaro.org >> https://lists.linaro.org/mailman/listinfo/lng-odp >> > >
On 04/12/16 09:12, Bala Manoharan wrote: > > > Regards, > Bala > > On 12 April 2016 at 03:19, Bill Fischofer <bill.fischofer@linaro.org > <mailto:bill.fischofer@linaro.org>> wrote: > > > > On Mon, Apr 11, 2016 at 2:22 AM, Balasubramanian Manoharan > <bala.manoharan@linaro.org <mailto:bala.manoharan@linaro.org>> wrote: > > This RFC adds classification capability structure and PMR range > functionality. The implementation patch will be posted once > consensus > is reached on API definition. > > Signed-off-by: Balasubramanian Manoharan > <bala.manoharan@linaro.org <mailto:bala.manoharan@linaro.org>> > --- > include/odp/api/spec/classification.h | 61 > ++++++++++++++++++++++++++--------- > 1 file changed, 45 insertions(+), 16 deletions(-) > > diff --git a/include/odp/api/spec/classification.h > b/include/odp/api/spec/classification.h > index 076b3de..1fcc520 100644 > --- a/include/odp/api/spec/classification.h > +++ b/include/odp/api/spec/classification.h > @@ -55,6 +55,24 @@ extern "C" { > */ > > /** > + * Classification capabilities > + * This capability structure defines system level > classfication capability > + */ > +typedef struct odp_cls_capability_t { > + /** PMR terms supported by the classifier, > + A mask one bit for each of odp_pmr_term_t */ > + unsigned long long supported_pmr_terms; > in many places we use uint64_t. Here might be better to use it too for better match existence code style. (as well as unsinged - > uint32_t). Maxim. > + /** Maximum number of PMR terms */ > + unsigned max_pmr_terms; > + /** Number of PMR terms available for use now */ > + unsigned available_pmr_terms; > + /** Maximum number of CoS supported */ > + unsigned max_cos; > + /* A Boolean to denote support of PMR range */ > + bool pmr_range_supported; > +} odp_cls_capability_t; > + > +/** > * class of service packet drop policies > */ > typedef enum { > @@ -103,6 +121,17 @@ typedef struct odp_cls_cos_param { > void odp_cls_cos_param_init(odp_cls_cos_param_t *param); > > /** > + * Query classification capabilities > + * > + * Outputs classification capabilities on success. > + * > + * @param[out] capability Classification capability > structure for output > + * @retval 0 on success > + * @retval <0 on failure > + */ > +int odp_cls_capability(odp_cls_capability_t *capability); > + > +/** > * Create a class-of-service > * > * @param name String intended for debugging purposes. > @@ -272,8 +301,22 @@ typedef enum { > */ > typedef struct odp_pmr_match_t { > > > It looks strange to call this an odp_pmr_match_t and then have a > subtype that says whether the match is actually a match or really > a range. If we're introducing two types of PMRs then it would seem > to make is clearer to rename the containing struct to be > odp_pmr_t. For completeness we should also have an odp_pmr_init() > API to do standard initialization of such for forward compatibility. > > > Agreed. We can name it odp_pmr_params_t since odp_pmr_t is a handle name. > > odp_pmr_term_t term; /**< PMR term value to be > matched */ > - const void *val; /**< Value to be matched */ > - const void *mask; /**< Masked set of bits to be > matched */ > + bool match; /**< True if the value is match and > false if range */ > > > Do we want match type rules to be the default or range type rules > to be the default? Since match is more likely to be the default > it would seem to flip this and call the field range with range = > false (i.e., match rule) the default. This could also be an enum > (rule_type) with the default being rule_type_match so that in > future you could have rule types beyond just match or range. > > > The idea was to have match as default and yes we can flip the boolean > to make match as default. I do not foresee a scenario where the value > matching will be anything other than match and range but if it is > needed we can convert this to an enum. > > Regards, > Bala > > + union { > + struct { > + /**< Value to be matched */ > + const void *val; > + /**< Masked set of bits to be matched */ > + const void *mask; > + } match; > + struct { > + /* Start and End values are included > in the range */ > + /**< start value of range */ > + const void *val_start; > + /**< End value of range */ > + const void *val_end; > + } range; > + }; > uint32_t val_sz; /**< Size of the term value */ > uint32_t offset; /**< User-defined offset in > packet > Used if term == > ODP_PMR_CUSTOM_FRAME only, > @@ -323,20 +366,6 @@ odp_pmr_t odp_cls_pmr_create(const > odp_pmr_match_t *terms, int num_terms, > int odp_cls_pmr_destroy(odp_pmr_t pmr_id); > > /** > - * Inquire about matching terms supported by the classifier > - * > - * @return A mask one bit per enumerated term, one for each > of odp_pmr_term_t > - */ > -unsigned long long odp_pmr_terms_cap(void); > - > -/** > - * Return the number of packet matching terms available for use > - * > - * @return A number of packet matcher resources available for > use. > - */ > -unsigned odp_pmr_terms_avail(void); > - > -/** > * Assigns a packet pool for a specific class of service. > * All the packets belonging to the given class of service will > * be allocated from the assigned packet pool. > -- > 1.9.1 > > _______________________________________________ > lng-odp mailing list > lng-odp@lists.linaro.org <mailto:lng-odp@lists.linaro.org> > https://lists.linaro.org/mailman/listinfo/lng-odp > > > > > > _______________________________________________ > lng-odp mailing list > lng-odp@lists.linaro.org > https://lists.linaro.org/mailman/listinfo/lng-odp
On 12 April 2016 at 11:51, Maxim Uvarov <maxim.uvarov@linaro.org> wrote: > On 04/12/16 09:12, Bala Manoharan wrote: > >> >> >> Regards, >> Bala >> >> On 12 April 2016 at 03:19, Bill Fischofer <bill.fischofer@linaro.org >> <mailto:bill.fischofer@linaro.org>> wrote: >> >> >> >> On Mon, Apr 11, 2016 at 2:22 AM, Balasubramanian Manoharan >> <bala.manoharan@linaro.org <mailto:bala.manoharan@linaro.org>> wrote: >> >> This RFC adds classification capability structure and PMR range >> functionality. The implementation patch will be posted once >> consensus >> is reached on API definition. >> >> Signed-off-by: Balasubramanian Manoharan >> <bala.manoharan@linaro.org <mailto:bala.manoharan@linaro.org>> >> --- >> include/odp/api/spec/classification.h | 61 >> ++++++++++++++++++++++++++--------- >> 1 file changed, 45 insertions(+), 16 deletions(-) >> >> diff --git a/include/odp/api/spec/classification.h >> b/include/odp/api/spec/classification.h >> index 076b3de..1fcc520 100644 >> --- a/include/odp/api/spec/classification.h >> +++ b/include/odp/api/spec/classification.h >> @@ -55,6 +55,24 @@ extern "C" { >> */ >> >> /** >> + * Classification capabilities >> + * This capability structure defines system level >> classfication capability >> + */ >> +typedef struct odp_cls_capability_t { >> + /** PMR terms supported by the classifier, >> + A mask one bit for each of odp_pmr_term_t */ >> + unsigned long long supported_pmr_terms; >> >> > in many places we use uint64_t. Here might be better to use it too for > better match existence code style. > (as well as unsinged - > uint32_t). > > Maxim. > > Yes. We can change unsigned long long to uint64_t. Regards, Bala > + /** Maximum number of PMR terms */ >> + unsigned max_pmr_terms; >> + /** Number of PMR terms available for use now */ >> + unsigned available_pmr_terms; >> + /** Maximum number of CoS supported */ >> + unsigned max_cos; >> + /* A Boolean to denote support of PMR range */ >> + bool pmr_range_supported; >> +} odp_cls_capability_t; >> + >> +/** >> * class of service packet drop policies >> */ >> typedef enum { >> @@ -103,6 +121,17 @@ typedef struct odp_cls_cos_param { >> void odp_cls_cos_param_init(odp_cls_cos_param_t *param); >> >> /** >> + * Query classification capabilities >> + * >> + * Outputs classification capabilities on success. >> + * >> + * @param[out] capability Classification capability >> structure for output >> + * @retval 0 on success >> + * @retval <0 on failure >> + */ >> +int odp_cls_capability(odp_cls_capability_t *capability); >> + >> +/** >> * Create a class-of-service >> * >> * @param name String intended for debugging purposes. >> @@ -272,8 +301,22 @@ typedef enum { >> */ >> typedef struct odp_pmr_match_t { >> >> >> It looks strange to call this an odp_pmr_match_t and then have a >> subtype that says whether the match is actually a match or really >> a range. If we're introducing two types of PMRs then it would seem >> to make is clearer to rename the containing struct to be >> odp_pmr_t. For completeness we should also have an odp_pmr_init() >> API to do standard initialization of such for forward compatibility. >> >> >> Agreed. We can name it odp_pmr_params_t since odp_pmr_t is a handle name. >> >> odp_pmr_term_t term; /**< PMR term value to be >> matched */ >> - const void *val; /**< Value to be matched */ >> - const void *mask; /**< Masked set of bits to be >> matched */ >> + bool match; /**< True if the value is match and >> false if range */ >> >> >> Do we want match type rules to be the default or range type rules >> to be the default? Since match is more likely to be the default >> it would seem to flip this and call the field range with range = >> false (i.e., match rule) the default. This could also be an enum >> (rule_type) with the default being rule_type_match so that in >> future you could have rule types beyond just match or range. >> >> >> The idea was to have match as default and yes we can flip the boolean to >> make match as default. I do not foresee a scenario where the value matching >> will be anything other than match and range but if it is needed we can >> convert this to an enum. >> >> Regards, >> Bala >> >> + union { >> + struct { >> + /**< Value to be matched */ >> + const void *val; >> + /**< Masked set of bits to be matched */ >> + const void *mask; >> + } match; >> + struct { >> + /* Start and End values are included >> in the range */ >> + /**< start value of range */ >> + const void *val_start; >> + /**< End value of range */ >> + const void *val_end; >> + } range; >> + }; >> uint32_t val_sz; /**< Size of the term value */ >> uint32_t offset; /**< User-defined offset in >> packet >> Used if term == >> ODP_PMR_CUSTOM_FRAME only, >> @@ -323,20 +366,6 @@ odp_pmr_t odp_cls_pmr_create(const >> odp_pmr_match_t *terms, int num_terms, >> int odp_cls_pmr_destroy(odp_pmr_t pmr_id); >> >> /** >> - * Inquire about matching terms supported by the classifier >> - * >> - * @return A mask one bit per enumerated term, one for each >> of odp_pmr_term_t >> - */ >> -unsigned long long odp_pmr_terms_cap(void); >> - >> -/** >> - * Return the number of packet matching terms available for use >> - * >> - * @return A number of packet matcher resources available for >> use. >> - */ >> -unsigned odp_pmr_terms_avail(void); >> - >> -/** >> * Assigns a packet pool for a specific class of service. >> * All the packets belonging to the given class of service will >> * be allocated from the assigned packet pool. >> -- >> 1.9.1 >> >> _______________________________________________ >> lng-odp mailing list >> lng-odp@lists.linaro.org <mailto:lng-odp@lists.linaro.org> >> https://lists.linaro.org/mailman/listinfo/lng-odp >> >> >> >> >> >> _______________________________________________ >> lng-odp mailing list >> lng-odp@lists.linaro.org >> https://lists.linaro.org/mailman/listinfo/lng-odp >> > > _______________________________________________ > lng-odp mailing list > lng-odp@lists.linaro.org > https://lists.linaro.org/mailman/listinfo/lng-odp >
Hi, I will incorporate all these review comments in the API patch. Regards, Bala On 12 April 2016 at 19:01, Savolainen, Petri (Nokia - FI/Espoo) < petri.savolainen@nokia.com> wrote: > > > > -----Original Message----- > > From: EXT Balasubramanian Manoharan [mailto:bala.manoharan@linaro.org] > > Sent: Monday, April 11, 2016 10:23 AM > > To: lng-odp@lists.linaro.org > > Cc: Savolainen, Petri (Nokia - FI/Espoo) <petri.savolainen@nokia.com>; > > Balasubramanian Manoharan <bala.manoharan@linaro.org> > > Subject: [RFC] api: classification capability structure > > > > This RFC adds classification capability structure and PMR range > > functionality. The implementation patch will be posted once consensus > > is reached on API definition. > > > > Signed-off-by: Balasubramanian Manoharan <bala.manoharan@linaro.org> > > --- > > include/odp/api/spec/classification.h | 61 > ++++++++++++++++++++++++++---- > > ----- > > 1 file changed, 45 insertions(+), 16 deletions(-) > > > > diff --git a/include/odp/api/spec/classification.h > > b/include/odp/api/spec/classification.h > > index 076b3de..1fcc520 100644 > > --- a/include/odp/api/spec/classification.h > > +++ b/include/odp/api/spec/classification.h > > @@ -55,6 +55,24 @@ extern "C" { > > */ > > > > /** > > + * Classification capabilities > > + * This capability structure defines system level classfication > > capability > > + */ > > +typedef struct odp_cls_capability_t { > > + /** PMR terms supported by the classifier, > > + A mask one bit for each of odp_pmr_term_t */ > > Documentation should be wrapped into '*' prefixed lines, so that it's easy > to find struct fields. > > /** > * bla bla > * > */ > int variable_name; > > > > + unsigned long long supported_pmr_terms; > > Long long (coming from current API definition) should be replaced with > better defined type. Either a bit field (see e.g. odp_pktin_hash_proto_t) > or a uint64_t. I'd vote for bit fields since it results cleaner code for > checking/filling flags. > > cap = capability(); > > if (cap.pmr.udp_sport) > term = ODP_PMR_UDP_SPORT; > VS. > if (cap.pmr & (1 << ODP_PMR_UDP_SPORT)) > term = ODP_PMR_UDP_SPORT; > > > > > + /** Maximum number of PMR terms */ > > + unsigned max_pmr_terms; > > + /** Number of PMR terms available for use now */ > > + unsigned available_pmr_terms; > > + /** Maximum number of CoS supported */ > > + unsigned max_cos; > > + /* A Boolean to denote support of PMR range */ > > + bool pmr_range_supported; > > > A boolean type has to be odp_bool_t. > > > > +} odp_cls_capability_t; > > + > > +/** > > * class of service packet drop policies > > */ > > typedef enum { > > @@ -103,6 +121,17 @@ typedef struct odp_cls_cos_param { > > void odp_cls_cos_param_init(odp_cls_cos_param_t *param); > > > > /** > > + * Query classification capabilities > > + * > > + * Outputs classification capabilities on success. > > + * > > + * @param[out] capability Classification capability > structure for > > output > > + * @retval 0 on success > > + * @retval <0 on failure > > + */ > > +int odp_cls_capability(odp_cls_capability_t *capability); > > + > > +/** > > * Create a class-of-service > > * > > * @param name String intended for debugging purposes. > > @@ -272,8 +301,22 @@ typedef enum { > > */ > > typedef struct odp_pmr_match_t { > > odp_pmr_term_t term; /**< PMR term value to be matched */ > > - const void *val; /**< Value to be matched */ > > - const void *mask; /**< Masked set of bits to be matched */ > > + bool match; /**< True if the value is match and false if range > */ > > + union { > > + struct { > > + /**< Value to be matched */ > > /** instead of /**<, when documentation is on top of the field. > > -Petri > > > > > + const void *val; > > + /**< Masked set of bits to be matched */ > > + const void *mask; > > + } match; > > + struct { > > + /* Start and End values are included in the range > */ > > + /**< start value of range */ > > + const void *val_start; > > + /**< End value of range */ > > + const void *val_end; > > + } range; > > + }; > > uint32_t val_sz; /**< Size of the term value */ > > uint32_t offset; /**< User-defined offset in packet > > Used if term == ODP_PMR_CUSTOM_FRAME only, > > @@ -323,20 +366,6 @@ odp_pmr_t odp_cls_pmr_create(const odp_pmr_match_t > > *terms, int num_terms, > > int odp_cls_pmr_destroy(odp_pmr_t pmr_id); > > > > /** > > - * Inquire about matching terms supported by the classifier > > - * > > - * @return A mask one bit per enumerated term, one for each of > > odp_pmr_term_t > > - */ > > -unsigned long long odp_pmr_terms_cap(void); > > - > > -/** > > - * Return the number of packet matching terms available for use > > - * > > - * @return A number of packet matcher resources available for use. > > - */ > > -unsigned odp_pmr_terms_avail(void); > > - > > -/** > > * Assigns a packet pool for a specific class of service. > > * All the packets belonging to the given class of service will > > * be allocated from the assigned packet pool. > > -- > > 1.9.1 > >
diff --git a/include/odp/api/spec/classification.h b/include/odp/api/spec/classification.h index 076b3de..1fcc520 100644 --- a/include/odp/api/spec/classification.h +++ b/include/odp/api/spec/classification.h @@ -55,6 +55,24 @@ extern "C" { */ /** + * Classification capabilities + * This capability structure defines system level classfication capability + */ +typedef struct odp_cls_capability_t { + /** PMR terms supported by the classifier, + A mask one bit for each of odp_pmr_term_t */ + unsigned long long supported_pmr_terms; + /** Maximum number of PMR terms */ + unsigned max_pmr_terms; + /** Number of PMR terms available for use now */ + unsigned available_pmr_terms; + /** Maximum number of CoS supported */ + unsigned max_cos; + /* A Boolean to denote support of PMR range */ + bool pmr_range_supported; +} odp_cls_capability_t; + +/** * class of service packet drop policies */ typedef enum { @@ -103,6 +121,17 @@ typedef struct odp_cls_cos_param { void odp_cls_cos_param_init(odp_cls_cos_param_t *param); /** + * Query classification capabilities + * + * Outputs classification capabilities on success. + * + * @param[out] capability Classification capability structure for output + * @retval 0 on success + * @retval <0 on failure + */ +int odp_cls_capability(odp_cls_capability_t *capability); + +/** * Create a class-of-service * * @param name String intended for debugging purposes. @@ -272,8 +301,22 @@ typedef enum { */ typedef struct odp_pmr_match_t { odp_pmr_term_t term; /**< PMR term value to be matched */ - const void *val; /**< Value to be matched */ - const void *mask; /**< Masked set of bits to be matched */ + bool match; /**< True if the value is match and false if range */ + union { + struct { + /**< Value to be matched */ + const void *val; + /**< Masked set of bits to be matched */ + const void *mask; + } match; + struct { + /* Start and End values are included in the range */ + /**< start value of range */ + const void *val_start; + /**< End value of range */ + const void *val_end; + } range; + }; uint32_t val_sz; /**< Size of the term value */ uint32_t offset; /**< User-defined offset in packet Used if term == ODP_PMR_CUSTOM_FRAME only, @@ -323,20 +366,6 @@ odp_pmr_t odp_cls_pmr_create(const odp_pmr_match_t *terms, int num_terms, int odp_cls_pmr_destroy(odp_pmr_t pmr_id); /** - * Inquire about matching terms supported by the classifier - * - * @return A mask one bit per enumerated term, one for each of odp_pmr_term_t - */ -unsigned long long odp_pmr_terms_cap(void); - -/** - * Return the number of packet matching terms available for use - * - * @return A number of packet matcher resources available for use. - */ -unsigned odp_pmr_terms_avail(void); - -/** * Assigns a packet pool for a specific class of service. * All the packets belonging to the given class of service will * be allocated from the assigned packet pool.
This RFC adds classification capability structure and PMR range functionality. The implementation patch will be posted once consensus is reached on API definition. Signed-off-by: Balasubramanian Manoharan <bala.manoharan@linaro.org> --- include/odp/api/spec/classification.h | 61 ++++++++++++++++++++++++++--------- 1 file changed, 45 insertions(+), 16 deletions(-)