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 <taras.kondrat...@linaro.org> --- 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 lng-odp@lists.linaro.org https://lists.linaro.org/mailman/listinfo/lng-odp