Hi,

With this change, which pmr parameters are possible to modify later on without 
pmr destroy? None, all, src/dst cos, term, val/mask, ...?

I think most common changes on the classification tree would be pmr val/mask 
changes. Those should not require pmr destroy/create cycle.

Also I think the classification API should be still streamlined further. For 
example,
- common prefix should be used (e.g. odp_cls_): odp_cls_match_t, odp_cls_cos_t, 
...
- odp_pmr_match_t should be used also in odp_pmr_create() (not only in 
odp_pmr_match_set_create())
- odp_pmr_set_t seems redundant. odp_pmr_match_t type (a list, first/last pmr, 
etc) could be used instead.
- odp_pktio_t should be visible only on few calls e.g. 
odp_pktio_default_cos(pktio)
  - the default cos could be used as a synonym for an interface
  - we can define that: default cos is fixed, user can only modify default cos 
params but not create/destroy it
- odp_cos_with_l2_priority and odp_cos_with_l3_qos seems special cases. Those 
could be redefined so that they create a sub-tree of match rules and coses, 
which the user then links e.g. to the pktio default cos, or somewhere else in 
the tree.


-Petri


> -----Original Message-----
> From: ext Taras Kondratiuk [mailto:[email protected]]
> Sent: Thursday, April 16, 2015 12:54 PM
> To: [email protected]; [email protected]
> Cc: [email protected]; [email protected];
> [email protected]; [email protected]; Taras Kondratiuk
> Subject: [API-NEXT PATCH] api: classification: connect PMR on creation
> 
> Current odp_pmr_t usage model has several issues:
> 1. The same PMR can be applied into different places in a classification
>    tree, but there is no way to modify each of its applications
>    separately. One can only destroy a rule completely which should
>    destroy all of its instances in a classification tree.
> 2. Initial intention behind odp_pmr_t was to abstract a handle to some HW
>    resource which imlements a PMR. But on platforms I'm aware of a
> separate
>    HW resource should be allocated for each PRM application. So there is
>    no 1:1 mapping between odp_pmr_t and HW resource.
>    If odp_pmr_t doesn't map to HW resource directly, then it just
>    represent a PRM description. It is an entry in some PRM descriptions
>    'database' which implementation have to maintain for no good reason.
> 
> There are two possible solutions:
> 1. Create odp_pmr_t handle as a result of a rule application/connection.
> 2. Connect rule on odp_pmr_t creation (suggested by Leonid Rosenboim).
> 
> I prefer a second solution because it is more compact and straight
> forward.
> Additional consequence of this solution: instead of connecting PMR to
> PktIO it is connected to PktIO's default CoS.
> 
> Signed-off-by: Taras Kondratiuk <[email protected]>
> ---
>  include/odp/api/classification.h | 59 ++++++++++++-----------------------
> -----
>  1 file changed, 17 insertions(+), 42 deletions(-)
> 
> diff --git a/include/odp/api/classification.h
> b/include/odp/api/classification.h
> index 7db3645..ef7d81e 100644
> --- a/include/odp/api/classification.h
> +++ b/include/odp/api/classification.h
> @@ -232,6 +232,9 @@ typedef enum odp_pmr_term {
>   * @param[in]        val_sz  Size of the val and mask arguments,
>   *                   that must match the value size requirement of the
>   *                   specific term.
> + * @param[in]        src_cos CoS to be filtered
> + * @param[in]        dst_cos CoS to be assigned to packets filtered from
> src_cos
> + *                   that match this rule.
>   *
>   * @return           Handle of the matching rule
>   * @retval           ODP_PMR_INVAL on failure
> @@ -239,7 +242,9 @@ typedef enum odp_pmr_term {
>  odp_pmr_t odp_pmr_create_match(odp_pmr_term_e term,
>                              const void *val,
>                              const void *mask,
> -                            uint32_t val_sz);
> +                            uint32_t val_sz,
> +                            odp_cos_t src_cos,
> +                            odp_cos_t dst_cos);
> 
>  /**
>   * Create a packet match rule with value range
> @@ -250,6 +255,9 @@ odp_pmr_t odp_pmr_create_match(odp_pmr_term_e term,
>   * @param[in]        val_sz  Size of the val1 and val2 arguments,
>   *                   that must match the value size requirement of the
>   *                   specific term.
> + * @param[in]        src_cos CoS to be filtered
> + * @param[in]        dst_cos CoS to be assigned to packets filtered from
> src_cos
> + *                   that match this rule.
>   *
>   * @return           Handle of the matching rule
>   * @retval           ODP_PMR_INVAL on failure
> @@ -258,7 +266,10 @@ odp_pmr_t odp_pmr_create_match(odp_pmr_term_e term,
>  odp_pmr_t odp_pmr_create_range(odp_pmr_term_e term,
>                              const void *val1,
>                              const void *val2,
> -                            uint32_t val_sz);
> +                            uint32_t val_sz,
> +                            odp_cos_t src_cos,
> +                            odp_cos_t dst_cos);
> +
>  /**
>   * Invalidate a packet match rule and vacate its resources
>   *
> @@ -270,32 +281,6 @@ odp_pmr_t odp_pmr_create_range(odp_pmr_term_e term,
>  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);
> -
> -/**
>   * Inquire about matching terms supported by the classifier
>   *
>   * @return A mask one bit per enumerated term, one for each of
> op_pmr_term_e
> @@ -356,6 +341,9 @@ typedef struct odp_pmr_match_t {
>   * @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[in]        src_cos         CoS to be filtered
> + * @param[in]        dst_cos         CoS to be assigned to packets filtered
> from
> + *                           src_cos that match all terms.
>   * @param[out]       pmr_set_id      Returned handle to the composite rule 
> set.
>   *
>   * @return                   the number of terms elements
> @@ -364,6 +352,7 @@ typedef struct odp_pmr_match_t {
>   * @retval                   <0 on failure
>   */
>  int odp_pmr_match_set_create(int num_terms, odp_pmr_match_t *terms,
> +                          odp_cos_t src_cos, odp_cos_t dst_cos,
>                            odp_pmr_set_t *pmr_set_id);
> 
>  /**
> @@ -385,20 +374,6 @@ int odp_pmr_match_set_create(int num_terms,
> odp_pmr_match_t *terms,
>  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);
> -
> -/**
>   * Get printable value for an odp_cos_t
>   *
>   * @param hdl  odp_cos_t handle to be printed
> --
> 1.9.1

_______________________________________________
lng-odp mailing list
[email protected]
https://lists.linaro.org/mailman/listinfo/lng-odp

Reply via email to