linux-generic implementation support for API name change from odp_cos_set_queue() to odp_cos_queue_set() and odp_cos_set_drop() to odp_cos_drop_set(). Adds queue handle to cos internal structure to support odp_cos_queue() and odp_cos_drop() getter function.
Fixes: https://bugs.linaro.org/show_bug.cgi?id=1711 Signed-off-by: Balasubramanian Manoharan <bala.manoha...@linaro.org> --- .../include/odp_classification_datamodel.h | 1 + platform/linux-generic/odp_classification.c | 33 ++++++++++++++++++++-- 2 files changed, 31 insertions(+), 3 deletions(-) diff --git a/platform/linux-generic/include/odp_classification_datamodel.h b/platform/linux-generic/include/odp_classification_datamodel.h index 9da54c7..cb970f1 100644 --- a/platform/linux-generic/include/odp_classification_datamodel.h +++ b/platform/linux-generic/include/odp_classification_datamodel.h @@ -70,6 +70,7 @@ struct cos_s { uint32_t valid; /* validity Flag */ odp_drop_e drop_policy; /* Associated Drop Policy */ odp_queue_group_t queue_group; /* Associated Queue Group */ + odp_queue_t queue_id; /* Associated Queue handle */ odp_cos_flow_set_t flow_set; /* Assigned Flow Set */ char name[ODP_COS_NAME_LEN]; /* name */ size_t headroom; /* Headroom for this CoS */ diff --git a/platform/linux-generic/odp_classification.c b/platform/linux-generic/odp_classification.c index fdb544d..17c123a 100644 --- a/platform/linux-generic/odp_classification.c +++ b/platform/linux-generic/odp_classification.c @@ -265,7 +265,7 @@ int odp_cos_destroy(odp_cos_t cos_id) return 0; } -int odp_cos_set_queue(odp_cos_t cos_id, odp_queue_t queue_id) +int odp_cos_queue_set(odp_cos_t cos_id, odp_queue_t queue_id) { cos_t *cos = get_cos_entry(cos_id); if (cos == NULL) { @@ -275,13 +275,27 @@ int odp_cos_set_queue(odp_cos_t cos_id, odp_queue_t queue_id) /* Locking is not required as intermittent stale data during CoS modification is acceptable*/ cos->s.queue = queue_to_qentry(queue_id); + cos->s.queue_id = queue_id; return 0; } -int odp_cos_set_drop(odp_cos_t cos_id, odp_drop_e drop_policy) +odp_queue_t odp_cos_queue(odp_cos_t cos_id) { cos_t *cos = get_cos_entry(cos_id); - if (cos == NULL) { + + if (!cos) { + ODP_ERR("Invalid odp_cos_t handle"); + return ODP_QUEUE_INVALID; + } + + return cos->s.queue_id; +} + +int odp_cos_drop_set(odp_cos_t cos_id, odp_drop_e drop_policy) +{ + cos_t *cos = get_cos_entry(cos_id); + + if (!cos) { ODP_ERR("Invalid odp_cos_t handle"); return -1; } @@ -291,10 +305,23 @@ int odp_cos_set_drop(odp_cos_t cos_id, odp_drop_e drop_policy) return 0; } +odp_drop_e odp_cos_drop(odp_cos_t cos_id) +{ + cos_t *cos = get_cos_entry(cos_id); + + if (!cos) { + ODP_ERR("Invalid odp_cos_t handle"); + return -1; + } + + return cos->s.drop_policy; +} + int odp_pktio_default_cos_set(odp_pktio_t pktio_in, odp_cos_t default_cos) { pktio_entry_t *entry; cos_t *cos; + entry = get_pktio_entry(pktio_in); if (entry == NULL) { ODP_ERR("Invalid odp_pktio_t handle"); -- 1.9.1 _______________________________________________ lng-odp mailing list lng-odp@lists.linaro.org https://lists.linaro.org/mailman/listinfo/lng-odp