From 19c4b31eefe45bbbee2ba53f5394b5e32691451e Mon Sep 17 00:00:00 2001 From: Suvendhu Hansa <suvendhu.hansa@iopsys.eu> Date: Tue, 28 Jan 2025 13:47:01 +0000 Subject: [PATCH] Add support to set ShapingRate in percentage --- bbf_plugin/qos_bbf.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/bbf_plugin/qos_bbf.c b/bbf_plugin/qos_bbf.c index c44e636..93adf25 100644 --- a/bbf_plugin/qos_bbf.c +++ b/bbf_plugin/qos_bbf.c @@ -1400,8 +1400,11 @@ static int set_QoSPolicer_CommittedRate(char *refparam, struct dmctx *ctx, void { switch (action) { case VALUECHECK: - if (bbfdm_validate_unsignedLong(ctx, value, RANGE_ARGS{{NULL,NULL}}, 1)) + if (bbfdm_validate_unsignedLong(ctx, value, RANGE_ARGS{{"1000",NULL}}, 1)) { + bbfdm_set_fault_message(ctx, "CommittedRate value should be 1000 or higher"); return FAULT_9007; + } + break; case VALUESET: dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "committed_rate", value); @@ -1673,6 +1676,12 @@ static int set_QoSQueue_ShapingRate(char *refparam, struct dmctx *ctx, void *dat case VALUECHECK: if (bbfdm_validate_long(ctx, value, RANGE_ARGS{{"-1",NULL}}, 1)) return FAULT_9007; + + if (DM_STRTOL(value) >= 0 && DM_STRTOL(value) < 1000) { + bbfdm_set_fault_message(ctx, "ShapingRate value less than 1000 not supported"); + return FAULT_9007; + } + break; case VALUESET: dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "rate", value); @@ -1920,6 +1929,12 @@ static int set_QoSShaper_ShapingRate(char *refparam, struct dmctx *ctx, void *da case VALUECHECK: if (bbfdm_validate_long(ctx, value, RANGE_ARGS{{"-1",NULL}}, 1)) return FAULT_9007; + + if (DM_STRTOL(value) > 100 && DM_STRTOL(value) < 1000) { + bbfdm_set_fault_message(ctx, "ShapingRate value in range 101-999 not supported"); + return FAULT_9007; + } + break; case VALUESET: dmuci_set_value_by_section(((struct dm_data *)data)->config_section, "rate", value); -- GitLab