diff mbox

[API-NEXT,PATCHv1,3/4] linux-generic: classification: queue and drop policy API name change

Message ID 1439210472-15839-4-git-send-email-bala.manoharan@linaro.org
State Superseded
Headers show

Commit Message

Balasubramanian Manoharan Aug. 10, 2015, 12:41 p.m. UTC
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.

Signed-off-by: Balasubramanian Manoharan <bala.manoharan@linaro.org>
---
 .../include/odp_classification_datamodel.h         |  1 +
 platform/linux-generic/odp_classification.c        | 33 ++++++++++++++++++++--
 2 files changed, 31 insertions(+), 3 deletions(-)
diff mbox

Patch

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");