diff mbox

[API-NEXT,PATCHv1,1/4] api: classification: add pmr create api

Message ID 1453463648-11158-1-git-send-email-bala.manoharan@linaro.org
State New
Headers show

Commit Message

Balasubramanian Manoharan Jan. 22, 2016, 11:54 a.m. UTC
Packet match rule creation is modified to include source and destination
class of service. Removes the ability to add any class of service directly
with pktio. If a PMR needs to be applied at the pktio level the same
should be applied to default class of service.

Packet match rule destroy function is updated to removes the link between
the source and destination class of service.

Signed-off-by: Balasubramanian Manoharan <bala.manoharan@linaro.org>
---
 include/odp/api/classification.h | 74 +++++++++++++---------------------------
 1 file changed, 24 insertions(+), 50 deletions(-)

Comments

Ivan Khoronzhuk Jan. 22, 2016, 3:47 p.m. UTC | #1
+ list

On 22.01.16 17:46, Ivan Khoronzhuk wrote:
> It discussed several times when started to look at it and Bill proposed to add some cls environment.
> Finally, it's sent. After this change PMR is created while connection to CoSes,
> and it's eliminates ability to connect the same PMR to several CoSes (which may arise questions...),
> and maps PMR handle directly to physical rule. It greatly simplifies life for implementors.
>
>
> On 22.01.16 13:54, Balasubramanian Manoharan wrote:
>> Packet match rule creation is modified to include source and destination
>> class of service. Removes the ability to add any class of service directly
>> with pktio. If a PMR needs to be applied at the pktio level the same
>> should be applied to default class of service.
>>
>> Packet match rule destroy function is updated to removes the link between
>> the source and destination class of service.
>>
>> Signed-off-by: Balasubramanian Manoharan <bala.manoharan@linaro.org>
>> ---
>>   include/odp/api/classification.h | 74 +++++++++++++---------------------------
>>   1 file changed, 24 insertions(+), 50 deletions(-)
>>
>> diff --git a/include/odp/api/classification.h b/include/odp/api/classification.h
>> index f46912e..59bd01d 100644
>> --- a/include/odp/api/classification.h
>> +++ b/include/odp/api/classification.h
>> @@ -50,7 +50,7 @@ extern "C" {
>>   /**
>>    * @def ODP_PMR_INVAL
>>    * Invalid odp_pmr_t value.
>> - * This value is returned from odp_pmr_create()
>> + * This value is returned from odp_cls_pmr_create()
>>    * function on failure.
>>    */
>>
>> @@ -286,50 +286,33 @@ typedef struct odp_pmr_match_t {
>>   } odp_pmr_match_t;
>>
>>   /**
>> - * Create a packet match rule with mask and value
>> + * Create a packet match rule between source and destination class of service.
>> + * This packet matching rule is applied on all packets arriving at the source
>> + * class of service and packets satisfying this PMR are sent to the destination
>> + * class of service.
>>    *
>>    * @param[in]    match   packet matching rule definition
>> + * @param[in]    src_cos    source CoS handle
>> + * @param[in]    dst_cos    destination CoS handle
>>    *
>>    * @return        Handle of the matching rule
>>    * @retval        ODP_PMR_INVAL on failure
>>    */
>> -odp_pmr_t odp_pmr_create(const odp_pmr_match_t *match);
>> -
>> +odp_pmr_t odp_cls_pmr_create(const odp_pmr_match_t *match, odp_cos_t src_cos,
>> +                 odp_cos_t dst_cos);
>>   /**
>> - * Invalidate a packet match rule and vacate its resources
>> + * Function to destroy a packet match rule
>> + * Destroying a PMR removes the link between the source and destination
>> + * class of service and this PMR will no longer be applied for packets arriving
>> + * at the source class of service. All the resource associated with the PMR
>> + * be release but the class of service will remain intact.
>>    *
>>    * @param[in]    pmr_id    Identifier of the PMR to be destroyed
>>    *
>>    * @retval        0 on success
>>    * @retval        <0 on failure
>>    */
>> -int odp_pmr_destroy(odp_pmr_t pmr_id);
>> -
>> -/**
>> - * Apply a PMR to a pktio to assign a CoS.
>> - *
>> - * @param[in]    pmr_id        PMR to be activated
>> - * @param[in]    src_pktio    pktio to which this PMR is to be applied
>> - * @param[in]    dst_cos        CoS to be assigned by this PMR
>> - *
>> - * @retval        0 on success
>> - * @retval        <0 on failure
>> - */
>> -int odp_pktio_pmr_cos(odp_pmr_t pmr_id,
>> -              odp_pktio_t src_pktio, odp_cos_t dst_cos);
>> -
>> -/**
>> - * Cascade a PMR to refine packets from one CoS to another.
>> - *
>> - * @param[in]    pmr_id        PMR to be activated
>> - * @param[in]    src_cos        CoS to be filtered
>> - * @param[in]    dst_cos        CoS to be assigned to packets filtered
>> - *                from src_cos that match pmr_id.
>> - *
>> - * @retval        0 on success
>> - * @retval        <0 on failure
>> - */
>> -int odp_cos_pmr_cos(odp_pmr_t pmr_id, odp_cos_t src_cos, odp_cos_t dst_cos);
>> +int odp_cls_pmr_destroy(odp_pmr_t pmr_id);
>>
>>   /**
>>    * Inquire about matching terms supported by the classifier
>> @@ -357,19 +340,24 @@ unsigned odp_pmr_terms_avail(void);
>>    * of value match rules, and the application should take care
>>    * of inspecting the return value when installing such rules, and perform
>>    * appropriate fallback action.
>> + * This is same as odp_cls_pmr_create() except that it creates the link
>> + * using pmr match set instead of a single PMR.
>>    *
>>    * @param[in]    num_terms    Number of terms in the match rule.
>>    * @param[in]    terms        Array of num_terms entries, one entry per
>>    *                term desired.
>>    * @param[out]    pmr_set_id    Returned handle to the composite rule set.
>> + * @param[in]    src_cos        source CoS handle
>> + * @param[in]    dst_cos        destination CoS handle
>>    *
>>    * @return            the number of terms elements
>>    *                that have been successfully mapped to the
>>    *                underlying platform classification engine
>>    * @retval            <0 on failure
>>    */
>> -int odp_pmr_match_set_create(int num_terms, const odp_pmr_match_t *terms,
>> -                 odp_pmr_set_t *pmr_set_id);
>> +int odp_cls_pmr_match_set_create(int num_terms, const odp_pmr_match_t *terms,
>> +                 odp_pmr_set_t *pmr_set_id, odp_cos_t src_cos,
>> +                 odp_cos_t dst_cos);
>>
>>   /**
>>    * Function to delete a composite packet match rule set
>> @@ -378,7 +366,7 @@ int odp_pmr_match_set_create(int num_terms, const odp_pmr_match_t *terms,
>>    * same or essentially similar rule-set.
>>    *
>>    * All of the resources pertaining to the match set associated with the
>> - * class-of-service will be released, but the class-of-service will
>> + * class of service will be released, but the class of service will
>>    * remain intact.
>>    *
>>    * @param[in]    pmr_set_id    A composite rule-set handle
>> @@ -387,21 +375,7 @@ int odp_pmr_match_set_create(int num_terms, const odp_pmr_match_t *terms,
>>    * @retval            0 on success
>>    * @retval            <0 on failure
>>    */
>> -int odp_pmr_match_set_destroy(odp_pmr_set_t pmr_set_id);
>> -
>> -/**
>> - * Apply a PMR Match Set to a pktio to assign a CoS.
>> - *
>> - * @param[in]    pmr_set_id    PMR match set to be activated
>> - * @param[in]    src_pktio    pktio to which this PMR match
>> - *                set is to be applied
>> - * @param[in]    dst_cos        CoS to be assigned by this PMR match set
>> - *
>> - * @retval            0 on success
>> - * @retval            <0 on failure
>> - */
>> -int odp_pktio_pmr_match_set_cos(odp_pmr_set_t pmr_set_id, odp_pktio_t src_pktio,
>> -                odp_cos_t dst_cos);
>> +int odp_cls_pmr_match_set_destroy(odp_pmr_set_t pmr_set_id);
>>
>>   /**
>>   * Assigns a packet pool for a specific class of service.
>>
>
Bill Fischofer Jan. 26, 2016, 1:07 a.m. UTC | #2
The question of contexts for stateful classification was discussed last
July. <https://lists.linaro.org/pipermail/lng-odp/2015-July/012769.html>
We can discuss this further during tomorrow's public call to see if we want
to pursue this for Monarch or if it should be considered a post-Monarch
item.

On Fri, Jan 22, 2016 at 9:47 AM, Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org
> wrote:


> + list

>

> On 22.01.16 17:46, Ivan Khoronzhuk wrote:

>

>> It discussed several times when started to look at it and Bill proposed

>> to add some cls environment.

>> Finally, it's sent. After this change PMR is created while connection to

>> CoSes,

>> and it's eliminates ability to connect the same PMR to several CoSes

>> (which may arise questions...),

>> and maps PMR handle directly to physical rule. It greatly simplifies life

>> for implementors.

>>

>>

>>

>> On 22.01.16 13:54, Balasubramanian Manoharan wrote:

>>

>>> Packet match rule creation is modified to include source and destination

>>> class of service. Removes the ability to add any class of service

>>> directly

>>> with pktio. If a PMR needs to be applied at the pktio level the same

>>> should be applied to default class of service.

>>>

>>> Packet match rule destroy function is updated to removes the link between

>>> the source and destination class of service.

>>>

>>> Signed-off-by: Balasubramanian Manoharan <bala.manoharan@linaro.org>

>>> ---

>>>   include/odp/api/classification.h | 74

>>> +++++++++++++---------------------------

>>>   1 file changed, 24 insertions(+), 50 deletions(-)

>>>

>>> diff --git a/include/odp/api/classification.h

>>> b/include/odp/api/classification.h

>>> index f46912e..59bd01d 100644

>>> --- a/include/odp/api/classification.h

>>> +++ b/include/odp/api/classification.h

>>> @@ -50,7 +50,7 @@ extern "C" {

>>>   /**

>>>    * @def ODP_PMR_INVAL

>>>    * Invalid odp_pmr_t value.

>>> - * This value is returned from odp_pmr_create()

>>> + * This value is returned from odp_cls_pmr_create()

>>>    * function on failure.

>>>    */

>>>

>>> @@ -286,50 +286,33 @@ typedef struct odp_pmr_match_t {

>>>   } odp_pmr_match_t;

>>>

>>>   /**

>>> - * Create a packet match rule with mask and value

>>> + * Create a packet match rule between source and destination class of

>>> service.

>>> + * This packet matching rule is applied on all packets arriving at the

>>> source

>>> + * class of service and packets satisfying this PMR are sent to the

>>> destination

>>> + * class of service.

>>>    *

>>>    * @param[in]    match   packet matching rule definition

>>> + * @param[in]    src_cos    source CoS handle

>>> + * @param[in]    dst_cos    destination CoS handle

>>>    *

>>>    * @return        Handle of the matching rule

>>>    * @retval        ODP_PMR_INVAL on failure

>>>    */

>>> -odp_pmr_t odp_pmr_create(const odp_pmr_match_t *match);

>>> -

>>> +odp_pmr_t odp_cls_pmr_create(const odp_pmr_match_t *match, odp_cos_t

>>> src_cos,

>>> +                 odp_cos_t dst_cos);

>>>   /**

>>> - * Invalidate a packet match rule and vacate its resources

>>> + * Function to destroy a packet match rule

>>> + * Destroying a PMR removes the link between the source and destination

>>> + * class of service and this PMR will no longer be applied for packets

>>> arriving

>>> + * at the source class of service. All the resource associated with the

>>> PMR

>>> + * be release but the class of service will remain intact.

>>>    *

>>>    * @param[in]    pmr_id    Identifier of the PMR to be destroyed

>>>    *

>>>    * @retval        0 on success

>>>    * @retval        <0 on failure

>>>    */

>>> -int odp_pmr_destroy(odp_pmr_t pmr_id);

>>> -

>>> -/**

>>> - * Apply a PMR to a pktio to assign a CoS.

>>> - *

>>> - * @param[in]    pmr_id        PMR to be activated

>>> - * @param[in]    src_pktio    pktio to which this PMR is to be applied

>>> - * @param[in]    dst_cos        CoS to be assigned by this PMR

>>> - *

>>> - * @retval        0 on success

>>> - * @retval        <0 on failure

>>> - */

>>> -int odp_pktio_pmr_cos(odp_pmr_t pmr_id,

>>> -              odp_pktio_t src_pktio, odp_cos_t dst_cos);

>>> -

>>> -/**

>>> - * Cascade a PMR to refine packets from one CoS to another.

>>> - *

>>> - * @param[in]    pmr_id        PMR to be activated

>>> - * @param[in]    src_cos        CoS to be filtered

>>> - * @param[in]    dst_cos        CoS to be assigned to packets filtered

>>> - *                from src_cos that match pmr_id.

>>> - *

>>> - * @retval        0 on success

>>> - * @retval        <0 on failure

>>> - */

>>> -int odp_cos_pmr_cos(odp_pmr_t pmr_id, odp_cos_t src_cos, odp_cos_t

>>> dst_cos);

>>> +int odp_cls_pmr_destroy(odp_pmr_t pmr_id);

>>>

>>>   /**

>>>    * Inquire about matching terms supported by the classifier

>>> @@ -357,19 +340,24 @@ unsigned odp_pmr_terms_avail(void);

>>>    * of value match rules, and the application should take care

>>>    * of inspecting the return value when installing such rules, and

>>> perform

>>>    * appropriate fallback action.

>>> + * This is same as odp_cls_pmr_create() except that it creates the link

>>> + * using pmr match set instead of a single PMR.

>>>    *

>>>    * @param[in]    num_terms    Number of terms in the match rule.

>>>    * @param[in]    terms        Array of num_terms entries, one entry per

>>>    *                term desired.

>>>    * @param[out]    pmr_set_id    Returned handle to the composite rule

>>> set.

>>> + * @param[in]    src_cos        source CoS handle

>>> + * @param[in]    dst_cos        destination CoS handle

>>>    *

>>>    * @return            the number of terms elements

>>>    *                that have been successfully mapped to the

>>>    *                underlying platform classification engine

>>>    * @retval            <0 on failure

>>>    */

>>> -int odp_pmr_match_set_create(int num_terms, const odp_pmr_match_t

>>> *terms,

>>> -                 odp_pmr_set_t *pmr_set_id);

>>> +int odp_cls_pmr_match_set_create(int num_terms, const odp_pmr_match_t

>>> *terms,

>>> +                 odp_pmr_set_t *pmr_set_id, odp_cos_t src_cos,

>>> +                 odp_cos_t dst_cos);

>>>

>>>   /**

>>>    * Function to delete a composite packet match rule set

>>> @@ -378,7 +366,7 @@ int odp_pmr_match_set_create(int num_terms, const

>>> odp_pmr_match_t *terms,

>>>    * same or essentially similar rule-set.

>>>    *

>>>    * All of the resources pertaining to the match set associated with the

>>> - * class-of-service will be released, but the class-of-service will

>>> + * class of service will be released, but the class of service will

>>>    * remain intact.

>>>    *

>>>    * @param[in]    pmr_set_id    A composite rule-set handle

>>> @@ -387,21 +375,7 @@ int odp_pmr_match_set_create(int num_terms, const

>>> odp_pmr_match_t *terms,

>>>    * @retval            0 on success

>>>    * @retval            <0 on failure

>>>    */

>>> -int odp_pmr_match_set_destroy(odp_pmr_set_t pmr_set_id);

>>> -

>>> -/**

>>> - * Apply a PMR Match Set to a pktio to assign a CoS.

>>> - *

>>> - * @param[in]    pmr_set_id    PMR match set to be activated

>>> - * @param[in]    src_pktio    pktio to which this PMR match

>>> - *                set is to be applied

>>> - * @param[in]    dst_cos        CoS to be assigned by this PMR match set

>>> - *

>>> - * @retval            0 on success

>>> - * @retval            <0 on failure

>>> - */

>>> -int odp_pktio_pmr_match_set_cos(odp_pmr_set_t pmr_set_id, odp_pktio_t

>>> src_pktio,

>>> -                odp_cos_t dst_cos);

>>> +int odp_cls_pmr_match_set_destroy(odp_pmr_set_t pmr_set_id);

>>>

>>>   /**

>>>   * Assigns a packet pool for a specific class of service.

>>>

>>>

>>

> --

> Regards,

> Ivan Khoronzhuk

>

> _______________________________________________

> lng-odp mailing list

> lng-odp@lists.linaro.org

> https://lists.linaro.org/mailman/listinfo/lng-odp

>
Balasubramanian Manoharan Jan. 27, 2016, 2:03 p.m. UTC | #3
Ping. Any feedback on the API definition and comments most welcome.

Regards,
Bala


On 26 January 2016 at 06:37, Bill Fischofer <bill.fischofer@linaro.org> wrote:
> The question of contexts for stateful classification was discussed last
> July.  We can discuss this further during tomorrow's public call to see if
> we want to pursue this for Monarch or if it should be considered a
> post-Monarch item.
>
> On Fri, Jan 22, 2016 at 9:47 AM, Ivan Khoronzhuk
> <ivan.khoronzhuk@linaro.org> wrote:
>>
>> + list
>>
>> On 22.01.16 17:46, Ivan Khoronzhuk wrote:
>>>
>>> It discussed several times when started to look at it and Bill proposed
>>> to add some cls environment.
>>> Finally, it's sent. After this change PMR is created while connection to
>>> CoSes,
>>> and it's eliminates ability to connect the same PMR to several CoSes
>>> (which may arise questions...),
>>> and maps PMR handle directly to physical rule. It greatly simplifies life
>>> for implementors.
>>>
>>>
>>>
>>> On 22.01.16 13:54, Balasubramanian Manoharan wrote:
>>>>
>>>> Packet match rule creation is modified to include source and destination
>>>> class of service. Removes the ability to add any class of service
>>>> directly
>>>> with pktio. If a PMR needs to be applied at the pktio level the same
>>>> should be applied to default class of service.
>>>>
>>>> Packet match rule destroy function is updated to removes the link
>>>> between
>>>> the source and destination class of service.
>>>>
>>>> Signed-off-by: Balasubramanian Manoharan <bala.manoharan@linaro.org>
>>>> ---
>>>>   include/odp/api/classification.h | 74
>>>> +++++++++++++---------------------------
>>>>   1 file changed, 24 insertions(+), 50 deletions(-)
>>>>
>>>> diff --git a/include/odp/api/classification.h
>>>> b/include/odp/api/classification.h
>>>> index f46912e..59bd01d 100644
>>>> --- a/include/odp/api/classification.h
>>>> +++ b/include/odp/api/classification.h
>>>> @@ -50,7 +50,7 @@ extern "C" {
>>>>   /**
>>>>    * @def ODP_PMR_INVAL
>>>>    * Invalid odp_pmr_t value.
>>>> - * This value is returned from odp_pmr_create()
>>>> + * This value is returned from odp_cls_pmr_create()
>>>>    * function on failure.
>>>>    */
>>>>
>>>> @@ -286,50 +286,33 @@ typedef struct odp_pmr_match_t {
>>>>   } odp_pmr_match_t;
>>>>
>>>>   /**
>>>> - * Create a packet match rule with mask and value
>>>> + * Create a packet match rule between source and destination class of
>>>> service.
>>>> + * This packet matching rule is applied on all packets arriving at the
>>>> source
>>>> + * class of service and packets satisfying this PMR are sent to the
>>>> destination
>>>> + * class of service.
>>>>    *
>>>>    * @param[in]    match   packet matching rule definition
>>>> + * @param[in]    src_cos    source CoS handle
>>>> + * @param[in]    dst_cos    destination CoS handle
>>>>    *
>>>>    * @return        Handle of the matching rule
>>>>    * @retval        ODP_PMR_INVAL on failure
>>>>    */
>>>> -odp_pmr_t odp_pmr_create(const odp_pmr_match_t *match);
>>>> -
>>>> +odp_pmr_t odp_cls_pmr_create(const odp_pmr_match_t *match, odp_cos_t
>>>> src_cos,
>>>> +                 odp_cos_t dst_cos);
>>>>   /**
>>>> - * Invalidate a packet match rule and vacate its resources
>>>> + * Function to destroy a packet match rule
>>>> + * Destroying a PMR removes the link between the source and destination
>>>> + * class of service and this PMR will no longer be applied for packets
>>>> arriving
>>>> + * at the source class of service. All the resource associated with the
>>>> PMR
>>>> + * be release but the class of service will remain intact.
>>>>    *
>>>>    * @param[in]    pmr_id    Identifier of the PMR to be destroyed
>>>>    *
>>>>    * @retval        0 on success
>>>>    * @retval        <0 on failure
>>>>    */
>>>> -int odp_pmr_destroy(odp_pmr_t pmr_id);
>>>> -
>>>> -/**
>>>> - * Apply a PMR to a pktio to assign a CoS.
>>>> - *
>>>> - * @param[in]    pmr_id        PMR to be activated
>>>> - * @param[in]    src_pktio    pktio to which this PMR is to be applied
>>>> - * @param[in]    dst_cos        CoS to be assigned by this PMR
>>>> - *
>>>> - * @retval        0 on success
>>>> - * @retval        <0 on failure
>>>> - */
>>>> -int odp_pktio_pmr_cos(odp_pmr_t pmr_id,
>>>> -              odp_pktio_t src_pktio, odp_cos_t dst_cos);
>>>> -
>>>> -/**
>>>> - * Cascade a PMR to refine packets from one CoS to another.
>>>> - *
>>>> - * @param[in]    pmr_id        PMR to be activated
>>>> - * @param[in]    src_cos        CoS to be filtered
>>>> - * @param[in]    dst_cos        CoS to be assigned to packets filtered
>>>> - *                from src_cos that match pmr_id.
>>>> - *
>>>> - * @retval        0 on success
>>>> - * @retval        <0 on failure
>>>> - */
>>>> -int odp_cos_pmr_cos(odp_pmr_t pmr_id, odp_cos_t src_cos, odp_cos_t
>>>> dst_cos);
>>>> +int odp_cls_pmr_destroy(odp_pmr_t pmr_id);
>>>>
>>>>   /**
>>>>    * Inquire about matching terms supported by the classifier
>>>> @@ -357,19 +340,24 @@ unsigned odp_pmr_terms_avail(void);
>>>>    * of value match rules, and the application should take care
>>>>    * of inspecting the return value when installing such rules, and
>>>> perform
>>>>    * appropriate fallback action.
>>>> + * This is same as odp_cls_pmr_create() except that it creates the link
>>>> + * using pmr match set instead of a single PMR.
>>>>    *
>>>>    * @param[in]    num_terms    Number of terms in the match rule.
>>>>    * @param[in]    terms        Array of num_terms entries, one entry
>>>> per
>>>>    *                term desired.
>>>>    * @param[out]    pmr_set_id    Returned handle to the composite rule
>>>> set.
>>>> + * @param[in]    src_cos        source CoS handle
>>>> + * @param[in]    dst_cos        destination CoS handle
>>>>    *
>>>>    * @return            the number of terms elements
>>>>    *                that have been successfully mapped to the
>>>>    *                underlying platform classification engine
>>>>    * @retval            <0 on failure
>>>>    */
>>>> -int odp_pmr_match_set_create(int num_terms, const odp_pmr_match_t
>>>> *terms,
>>>> -                 odp_pmr_set_t *pmr_set_id);
>>>> +int odp_cls_pmr_match_set_create(int num_terms, const odp_pmr_match_t
>>>> *terms,
>>>> +                 odp_pmr_set_t *pmr_set_id, odp_cos_t src_cos,
>>>> +                 odp_cos_t dst_cos);
>>>>
>>>>   /**
>>>>    * Function to delete a composite packet match rule set
>>>> @@ -378,7 +366,7 @@ int odp_pmr_match_set_create(int num_terms, const
>>>> odp_pmr_match_t *terms,
>>>>    * same or essentially similar rule-set.
>>>>    *
>>>>    * All of the resources pertaining to the match set associated with
>>>> the
>>>> - * class-of-service will be released, but the class-of-service will
>>>> + * class of service will be released, but the class of service will
>>>>    * remain intact.
>>>>    *
>>>>    * @param[in]    pmr_set_id    A composite rule-set handle
>>>> @@ -387,21 +375,7 @@ int odp_pmr_match_set_create(int num_terms, const
>>>> odp_pmr_match_t *terms,
>>>>    * @retval            0 on success
>>>>    * @retval            <0 on failure
>>>>    */
>>>> -int odp_pmr_match_set_destroy(odp_pmr_set_t pmr_set_id);
>>>> -
>>>> -/**
>>>> - * Apply a PMR Match Set to a pktio to assign a CoS.
>>>> - *
>>>> - * @param[in]    pmr_set_id    PMR match set to be activated
>>>> - * @param[in]    src_pktio    pktio to which this PMR match
>>>> - *                set is to be applied
>>>> - * @param[in]    dst_cos        CoS to be assigned by this PMR match
>>>> set
>>>> - *
>>>> - * @retval            0 on success
>>>> - * @retval            <0 on failure
>>>> - */
>>>> -int odp_pktio_pmr_match_set_cos(odp_pmr_set_t pmr_set_id, odp_pktio_t
>>>> src_pktio,
>>>> -                odp_cos_t dst_cos);
>>>> +int odp_cls_pmr_match_set_destroy(odp_pmr_set_t pmr_set_id);
>>>>
>>>>   /**
>>>>   * Assigns a packet pool for a specific class of service.
>>>>
>>>
>>
>> --
>> Regards,
>> Ivan Khoronzhuk
>>
>> _______________________________________________
>> lng-odp mailing list
>> lng-odp@lists.linaro.org
>> https://lists.linaro.org/mailman/listinfo/lng-odp
>
>
Balasubramanian Manoharan Jan. 29, 2016, 9 a.m. UTC | #4
Okay. I will incorporate these changes in the next version.

Regards,
Bala


On 28 January 2016 at 20:31, Savolainen, Petri (Nokia - FI/Espoo)
<petri.savolainen@nokia.com> wrote:
>
> This is otherwise OK (and exactly the feature I was missing in the call yesterday), but I'm wondering the benefit of having both odp_pmr_set_t and odp_pmr_t types. API would be simpler with only one type.
>
> To me odp_pmr_t is a odp_pmr_set_t with only one matching rule in it, right? We could get rid of odp_pmr_set_t (use only odp_pmr_t since it's a shorter name) and define that a odp_pmr_t can be build from N cascaded match rules.
>
>
> odp_pmr_t odp_cls_pmr_create(const odp_pmr_match_t match[], unsigned num,
>                              odp_cos_t src_cos, odp_cos_t dst_cos);
>
> Maximum 'num' value could be defined in a capability struct (a conservative system could define 1), with potential other constrains on the tree dimensions (max num pmr's per cos, etc).
>
>
> -Petri
>
>
>
>> -----Original Message-----
>> From: EXT Balasubramanian Manoharan [mailto:bala.manoharan@linaro.org]
>> Sent: Friday, January 22, 2016 1:54 PM
>> To: lng-odp@lists.linaro.org
>> Cc: Savolainen, Petri (Nokia - FI/Espoo); Balasubramanian Manoharan
>> Subject: [API-NEXT PATCHv1 1/4] api: classification: add pmr create api
>>
>> Packet match rule creation is modified to include source and destination
>> class of service. Removes the ability to add any class of service directly
>> with pktio. If a PMR needs to be applied at the pktio level the same
>> should be applied to default class of service.
>>
>> Packet match rule destroy function is updated to removes the link between
>> the source and destination class of service.
>>
>> Signed-off-by: Balasubramanian Manoharan <bala.manoharan@linaro.org>
>> ---
>>  include/odp/api/classification.h | 74 +++++++++++++----------------------
>> -----
>>  1 file changed, 24 insertions(+), 50 deletions(-)
>>
>> diff --git a/include/odp/api/classification.h
>> b/include/odp/api/classification.h
>> index f46912e..59bd01d 100644
>> --- a/include/odp/api/classification.h
>> +++ b/include/odp/api/classification.h
>> @@ -50,7 +50,7 @@ extern "C" {
>>  /**
>>   * @def ODP_PMR_INVAL
>>   * Invalid odp_pmr_t value.
>> - * This value is returned from odp_pmr_create()
>> + * This value is returned from odp_cls_pmr_create()
>>   * function on failure.
>>   */
>>
>> @@ -286,50 +286,33 @@ typedef struct odp_pmr_match_t {
>>  } odp_pmr_match_t;
>>
>>  /**
>> - * Create a packet match rule with mask and value
>> + * Create a packet match rule between source and destination class of
>> service.
>> + * This packet matching rule is applied on all packets arriving at the
>> source
>> + * class of service and packets satisfying this PMR are sent to the
>> destination
>> + * class of service.
>>   *
>>   * @param[in]        match   packet matching rule definition
>> + * @param[in]        src_cos source CoS handle
>> + * @param[in]        dst_cos destination CoS handle
>>   *
>>   * @return           Handle of the matching rule
>>   * @retval           ODP_PMR_INVAL on failure
>>   */
>> -odp_pmr_t odp_pmr_create(const odp_pmr_match_t *match);
>> -
>> +odp_pmr_t odp_cls_pmr_create(const odp_pmr_match_t *match, odp_cos_t
>> src_cos,
>> +                          odp_cos_t dst_cos);
>>  /**
>> - * Invalidate a packet match rule and vacate its resources
>> + * Function to destroy a packet match rule
>> + * Destroying a PMR removes the link between the source and destination
>> + * class of service and this PMR will no longer be applied for packets
>> arriving
>> + * at the source class of service. All the resource associated with the
>> PMR
>> + * be release but the class of service will remain intact.
>>   *
>>   * @param[in]        pmr_id  Identifier of the PMR to be destroyed
>>   *
>>   * @retval           0 on success
>>   * @retval           <0 on failure
>>   */
>> -int odp_pmr_destroy(odp_pmr_t pmr_id);
>> -
>> -/**
>> - * Apply a PMR to a pktio to assign a CoS.
>> - *
>> - * @param[in]        pmr_id          PMR to be activated
>> - * @param[in]        src_pktio       pktio to which this PMR is to be applied
>> - * @param[in]        dst_cos         CoS to be assigned by this PMR
>> - *
>> - * @retval           0 on success
>> - * @retval           <0 on failure
>> - */
>> -int odp_pktio_pmr_cos(odp_pmr_t pmr_id,
>> -                   odp_pktio_t src_pktio, odp_cos_t dst_cos);
>> -
>> -/**
>> - * Cascade a PMR to refine packets from one CoS to another.
>> - *
>> - * @param[in]        pmr_id          PMR to be activated
>> - * @param[in]        src_cos         CoS to be filtered
>> - * @param[in]        dst_cos         CoS to be assigned to packets filtered
>> - *                           from src_cos that match pmr_id.
>> - *
>> - * @retval           0 on success
>> - * @retval           <0 on failure
>> - */
>> -int odp_cos_pmr_cos(odp_pmr_t pmr_id, odp_cos_t src_cos, odp_cos_t
>> dst_cos);
>> +int odp_cls_pmr_destroy(odp_pmr_t pmr_id);
>>
>>  /**
>>   * Inquire about matching terms supported by the classifier
>> @@ -357,19 +340,24 @@ unsigned odp_pmr_terms_avail(void);
>>   * of value match rules, and the application should take care
>>   * of inspecting the return value when installing such rules, and perform
>>   * appropriate fallback action.
>> + * This is same as odp_cls_pmr_create() except that it creates the link
>> + * using pmr match set instead of a single PMR.
>>   *
>>   * @param[in]        num_terms       Number of terms in the match rule.
>>   * @param[in]        terms           Array of num_terms entries, one entry per
>>   *                           term desired.
>>   * @param[out]       pmr_set_id      Returned handle to the composite rule set.
>> + * @param[in]        src_cos         source CoS handle
>> + * @param[in]        dst_cos         destination CoS handle
>>   *
>>   * @return                   the number of terms elements
>>   *                           that have been successfully mapped to the
>>   *                           underlying platform classification engine
>>   * @retval                   <0 on failure
>>   */
>> -int odp_pmr_match_set_create(int num_terms, const odp_pmr_match_t *terms,
>> -                          odp_pmr_set_t *pmr_set_id);
>> +int odp_cls_pmr_match_set_create(int num_terms, const odp_pmr_match_t
>> *terms,
>> +                              odp_pmr_set_t *pmr_set_id, odp_cos_t src_cos,
>> +                              odp_cos_t dst_cos);
>>
>>  /**
>>   * Function to delete a composite packet match rule set
>> @@ -378,7 +366,7 @@ int odp_pmr_match_set_create(int num_terms, const
>> odp_pmr_match_t *terms,
>>   * same or essentially similar rule-set.
>>   *
>>   * All of the resources pertaining to the match set associated with the
>> - * class-of-service will be released, but the class-of-service will
>> + * class of service will be released, but the class of service will
>>   * remain intact.
>>   *
>>   * @param[in]        pmr_set_id      A composite rule-set handle
>> @@ -387,21 +375,7 @@ int odp_pmr_match_set_create(int num_terms, const
>> odp_pmr_match_t *terms,
>>   * @retval                   0 on success
>>   * @retval                   <0 on failure
>>   */
>> -int odp_pmr_match_set_destroy(odp_pmr_set_t pmr_set_id);
>> -
>> -/**
>> - * Apply a PMR Match Set to a pktio to assign a CoS.
>> - *
>> - * @param[in]        pmr_set_id      PMR match set to be activated
>> - * @param[in]        src_pktio       pktio to which this PMR match
>> - *                           set is to be applied
>> - * @param[in]        dst_cos         CoS to be assigned by this PMR match
>> set
>> - *
>> - * @retval                   0 on success
>> - * @retval                   <0 on failure
>> - */
>> -int odp_pktio_pmr_match_set_cos(odp_pmr_set_t pmr_set_id, odp_pktio_t
>> src_pktio,
>> -                             odp_cos_t dst_cos);
>> +int odp_cls_pmr_match_set_destroy(odp_pmr_set_t pmr_set_id);
>>
>>  /**
>>  * Assigns a packet pool for a specific class of service.
>> --
>> 1.9.1
>
diff mbox

Patch

diff --git a/include/odp/api/classification.h b/include/odp/api/classification.h
index f46912e..59bd01d 100644
--- a/include/odp/api/classification.h
+++ b/include/odp/api/classification.h
@@ -50,7 +50,7 @@  extern "C" {
 /**
  * @def ODP_PMR_INVAL
  * Invalid odp_pmr_t value.
- * This value is returned from odp_pmr_create()
+ * This value is returned from odp_cls_pmr_create()
  * function on failure.
  */
 
@@ -286,50 +286,33 @@  typedef struct odp_pmr_match_t {
 } odp_pmr_match_t;
 
 /**
- * Create a packet match rule with mask and value
+ * Create a packet match rule between source and destination class of service.
+ * This packet matching rule is applied on all packets arriving at the source
+ * class of service and packets satisfying this PMR are sent to the destination
+ * class of service.
  *
  * @param[in]	match   packet matching rule definition
+ * @param[in]	src_cos	source CoS handle
+ * @param[in]	dst_cos	destination CoS handle
  *
  * @return		Handle of the matching rule
  * @retval		ODP_PMR_INVAL on failure
  */
-odp_pmr_t odp_pmr_create(const odp_pmr_match_t *match);
-
+odp_pmr_t odp_cls_pmr_create(const odp_pmr_match_t *match, odp_cos_t src_cos,
+			     odp_cos_t dst_cos);
 /**
- * Invalidate a packet match rule and vacate its resources
+ * Function to destroy a packet match rule
+ * Destroying a PMR removes the link between the source and destination
+ * class of service and this PMR will no longer be applied for packets arriving
+ * at the source class of service. All the resource associated with the PMR
+ * be release but the class of service will remain intact.
  *
  * @param[in]	pmr_id	Identifier of the PMR to be destroyed
  *
  * @retval		0 on success
  * @retval		<0 on failure
  */
-int odp_pmr_destroy(odp_pmr_t pmr_id);
-
-/**
- * Apply a PMR to a pktio to assign a CoS.
- *
- * @param[in]	pmr_id		PMR to be activated
- * @param[in]	src_pktio	pktio to which this PMR is to be applied
- * @param[in]	dst_cos		CoS to be assigned by this PMR
- *
- * @retval		0 on success
- * @retval		<0 on failure
- */
-int odp_pktio_pmr_cos(odp_pmr_t pmr_id,
-		      odp_pktio_t src_pktio, odp_cos_t dst_cos);
-
-/**
- * Cascade a PMR to refine packets from one CoS to another.
- *
- * @param[in]	pmr_id		PMR to be activated
- * @param[in]	src_cos		CoS to be filtered
- * @param[in]	dst_cos		CoS to be assigned to packets filtered
- *				from src_cos that match pmr_id.
- *
- * @retval		0 on success
- * @retval		<0 on failure
- */
-int odp_cos_pmr_cos(odp_pmr_t pmr_id, odp_cos_t src_cos, odp_cos_t dst_cos);
+int odp_cls_pmr_destroy(odp_pmr_t pmr_id);
 
 /**
  * Inquire about matching terms supported by the classifier
@@ -357,19 +340,24 @@  unsigned odp_pmr_terms_avail(void);
  * of value match rules, and the application should take care
  * of inspecting the return value when installing such rules, and perform
  * appropriate fallback action.
+ * This is same as odp_cls_pmr_create() except that it creates the link
+ * using pmr match set instead of a single PMR.
  *
  * @param[in]	num_terms	Number of terms in the match rule.
  * @param[in]	terms		Array of num_terms entries, one entry per
  *				term desired.
  * @param[out]	pmr_set_id	Returned handle to the composite rule set.
+ * @param[in]	src_cos		source CoS handle
+ * @param[in]	dst_cos		destination CoS handle
  *
  * @return			the number of terms elements
  *				that have been successfully mapped to the
  *				underlying platform classification engine
  * @retval			<0 on failure
  */
-int odp_pmr_match_set_create(int num_terms, const odp_pmr_match_t *terms,
-			     odp_pmr_set_t *pmr_set_id);
+int odp_cls_pmr_match_set_create(int num_terms, const odp_pmr_match_t *terms,
+				 odp_pmr_set_t *pmr_set_id, odp_cos_t src_cos,
+				 odp_cos_t dst_cos);
 
 /**
  * Function to delete a composite packet match rule set
@@ -378,7 +366,7 @@  int odp_pmr_match_set_create(int num_terms, const odp_pmr_match_t *terms,
  * same or essentially similar rule-set.
  *
  * All of the resources pertaining to the match set associated with the
- * class-of-service will be released, but the class-of-service will
+ * class of service will be released, but the class of service will
  * remain intact.
  *
  * @param[in]	pmr_set_id	A composite rule-set handle
@@ -387,21 +375,7 @@  int odp_pmr_match_set_create(int num_terms, const odp_pmr_match_t *terms,
  * @retval			0 on success
  * @retval			<0 on failure
  */
-int odp_pmr_match_set_destroy(odp_pmr_set_t pmr_set_id);
-
-/**
- * Apply a PMR Match Set to a pktio to assign a CoS.
- *
- * @param[in]	pmr_set_id	PMR match set to be activated
- * @param[in]	src_pktio	pktio to which this PMR match
- *				set is to be applied
- * @param[in]	dst_cos		CoS to be assigned by this PMR match set
- *
- * @retval			0 on success
- * @retval			<0 on failure
- */
-int odp_pktio_pmr_match_set_cos(odp_pmr_set_t pmr_set_id, odp_pktio_t src_pktio,
-				odp_cos_t dst_cos);
+int odp_cls_pmr_match_set_destroy(odp_pmr_set_t pmr_set_id);
 
 /**
 * Assigns a packet pool for a specific class of service.