Hi, Can you clarify the following:
"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." You mean that you have one pmr, lets say on a pktio (which is a physical port) and on another pktio you use the same pmr? If this is the case, you could impose restrictions in API due to your Hw configuration and thus the user will be provided with an error in case he tries to have such a configuration. Regarding the 2nd point: I don't think that the pmr should be 1 to 1 with the HW resource for the simple fact that you use just a handle. What I mean to say is that you could use different pmrs that inside maps to the same input structure given to the HW. For example two pmrs with ipv4.ipsrc are created with different selector values. Obviously on some platforms the same HW resource will point to to each of the pmrs. So if no abstraction is made for pmrs, that means that two HW resources will be created - but doing basically the same thing. Regards, Radu -----Original Message----- From: lng-odp [mailto:[email protected]] On Behalf Of Taras Kondratiuk Sent: Thursday, April 16, 2015 12:54 PM To: [email protected]; [email protected] Cc: [email protected] Subject: [lng-odp] [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 _______________________________________________ lng-odp mailing list [email protected] https://lists.linaro.org/mailman/listinfo/lng-odp
