From 3c66cf71b228f3b00fb8a11c2565a77f573ecdf4 Mon Sep 17 00:00:00 2001
From: Rohit Topno <r.topno@gxgroup.eu>
Date: Tue, 4 Jun 2024 10:15:59 +0000
Subject: [PATCH] R#14452 - Integrate VLAN ID and p-bit translation support in
 qosmngr and TR181

---
 bbf_plugin/qos_bbf.c | 22 +++++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)

diff --git a/bbf_plugin/qos_bbf.c b/bbf_plugin/qos_bbf.c
index 542a38f..2dfc286 100644
--- a/bbf_plugin/qos_bbf.c
+++ b/bbf_plugin/qos_bbf.c
@@ -1222,6 +1222,26 @@ static int set_QoSClassification_EthernetPriorityCheck(char *refparam, struct dm
 	return 0;
 }
 
+static int get_QoSClassification_EthernetPriorityMark(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
+{
+	*value = dmuci_get_value_by_section_fallback_def(((struct dm_data *)data)->config_section, "pcp_mark", "-1");
+	return 0;
+}
+
+static int set_QoSClassification_EthernetPriorityMark(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
+{
+	switch (action)	{
+	case VALUECHECK:
+		if (bbfdm_validate_int(ctx, value, RANGE_ARGS{{"-2",NULL}}, 1))
+			return FAULT_9007;
+		break;
+	case VALUESET:
+		dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "pcp_mark", value);
+		break;
+	}
+	return 0;
+}
+
 static int get_QoSClassification_VLANIDCheck(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
 {
 	*value = dmuci_get_value_by_section_fallback_def(((struct dm_data *)data)->config_section, "vid_check", "-1");
@@ -2041,7 +2061,7 @@ DMLEAF tQoSClassificationParams[] = {
 {"DSCPMark", &DMWRITE, DMT_INT, get_QoSClassification_DSCPMark, set_QoSClassification_DSCPMark, BBFDM_BOTH},
 {"EthernetPriorityCheck", &DMWRITE, DMT_INT, get_QoSClassification_EthernetPriorityCheck, set_QoSClassification_EthernetPriorityCheck, BBFDM_BOTH},
 //{"EthernetPriorityExclude", &DMWRITE, DMT_BOOL, get_QoSClassification_EthernetPriorityExclude, set_QoSClassification_EthernetPriorityExclude, BBFDM_BOTH},
-//{"EthernetPriorityMark", &DMWRITE, DMT_INT, get_QoSClassification_EthernetPriorityMark, set_QoSClassification_EthernetPriorityMark, BBFDM_BOTH},
+{"EthernetPriorityMark", &DMWRITE, DMT_INT, get_QoSClassification_EthernetPriorityMark, set_QoSClassification_EthernetPriorityMark, BBFDM_BOTH},
 //{"InnerEthernetPriorityCheck", &DMWRITE, DMT_INT, get_QoSClassification_InnerEthernetPriorityCheck, set_QoSClassification_InnerEthernetPriorityCheck, BBFDM_BOTH},
 //{"InnerEthernetPriorityExclude", &DMWRITE, DMT_BOOL, get_QoSClassification_InnerEthernetPriorityExclude, set_QoSClassification_InnerEthernetPriorityExclude, BBFDM_BOTH},
 //{"InnerEthernetPriorityMark", &DMWRITE, DMT_INT, get_QoSClassification_InnerEthernetPriorityMark, set_QoSClassification_InnerEthernetPriorityMark, BBFDM_BOTH},
-- 
GitLab