Skip to content

Commit 9b01844

Browse files
authored
[qosorch] Update QoS scheduler params for shaping features (sonic-net#1296)
* Add shaping meter_type field to SCHEDULER_TABLE * Add scheduler reference field to PORT_QOS_MAP table for port level shaping * Refer to corresponding design document for more details: sonic-net/SONiC#535 Signed-off-by: Michael Li <michael.li@broadcom.com>
1 parent 86b5e99 commit 9b01844

File tree

3 files changed

+57
-19
lines changed

3 files changed

+57
-19
lines changed

doc/swss-schema.md

+38-13
Original file line numberDiff line numberDiff line change
@@ -256,23 +256,48 @@ and reflects the LAG ports into the redis under: `LAG_TABLE:<team0>:port`
256256
### SCHEDULER_TABLE
257257
; Scheduler table
258258
; SAI mapping - saicheduler.h
259-
key = "SCHEDULER_TABLE":name
260-
; field value
261-
type = "DWRR"/"WRR"/"PRIORITY"
262-
weight = 1*DIGIT
263-
priority = 1*DIGIT
259+
key = "SCHEDULER_TABLE":name
260+
; field value
261+
type = "DWRR"/"WRR"/"STRICT"
262+
weight = 2*DIGIT
263+
priority = 1*DIGIT
264+
meter_type = "packets"/"bytes"
265+
cir = 1*11 DIGIT ; guaranteed rate in pps or bytes/sec
266+
cbs = 1*11 DIGIT ; guaranteed burst size in packets or bytes
267+
pir = 1*11 DIGIT ; max rate in pps or bytes/sec
268+
pbs = 1*11 DIGIT ; max burst size in packets or bytes
264269

265270
Example:
266271
127.0.0.1:6379> hgetall SCHEDULER_TABLE:BEST_EFFORT
267-
1) "type"
268-
2) "PRIORITY"
269-
3) "priority"
270-
4) "7"
272+
1) "type"
273+
2) "PRIORITY"
274+
3) "priority"
275+
4) "7"
276+
5) "meter_type"
277+
6) "bytes"
278+
7) "cir"
279+
8) "1000000000"
280+
9) "cbs"
281+
10) "8192"
282+
11) "pir"
283+
12) "1250000000"
284+
13) "pbs"
285+
14) "8192"
271286
127.0.0.1:6379> hgetall SCHEDULER_TABLE:SCAVENGER
272-
1) "type"
273-
2) "DWRR"
274-
3) "weight"
275-
4) "35"
287+
1) "type"
288+
2) "DWRR"
289+
3) "weight"
290+
4) "35"
291+
5) "meter_type"
292+
6) "bytes"
293+
7) "cir"
294+
8) "1000000000"
295+
9) "cbs"
296+
10) "8192"
297+
11) "pir"
298+
12) "1250000000"
299+
13) "pbs"
300+
14) "8192"
276301

277302
---------------------------------------------
278303
### WRED\_PROFILE\_TABLE

orchagent/qosorch.cpp

+18-5
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,13 @@ map<string, sai_port_attr_t> qos_to_attr_map = {
4949
{tc_to_queue_field_name, SAI_PORT_ATTR_QOS_TC_TO_QUEUE_MAP},
5050
{tc_to_pg_map_field_name, SAI_PORT_ATTR_QOS_TC_TO_PRIORITY_GROUP_MAP},
5151
{pfc_to_pg_map_name, SAI_PORT_ATTR_QOS_PFC_PRIORITY_TO_PRIORITY_GROUP_MAP},
52-
{pfc_to_queue_map_name, SAI_PORT_ATTR_QOS_PFC_PRIORITY_TO_QUEUE_MAP}
52+
{pfc_to_queue_map_name, SAI_PORT_ATTR_QOS_PFC_PRIORITY_TO_QUEUE_MAP},
53+
{scheduler_field_name, SAI_PORT_ATTR_QOS_SCHEDULER_PROFILE_ID}
54+
};
55+
56+
map<string, sai_meter_type_t> scheduler_meter_map = {
57+
{"packets", SAI_METER_TYPE_PACKETS},
58+
{"bytes", SAI_METER_TYPE_BYTES}
5359
};
5460

5561
type_map QosOrch::m_qos_maps = {
@@ -813,28 +819,35 @@ task_process_status QosOrch::handleSchedulerTable(Consumer& consumer)
813819
// TODO: The meaning is to be able to adjus priority of the given scheduler group.
814820
// However currently SAI model does not provide such ability.
815821
}
822+
else if (fvField(*i) == scheduler_meter_type_field_name)
823+
{
824+
sai_meter_type_t meter_value = scheduler_meter_map.at(fvValue(*i));
825+
attr.id = SAI_SCHEDULER_ATTR_METER_TYPE;
826+
attr.value.s32 = meter_value;
827+
sai_attr_list.push_back(attr);
828+
}
816829
else if (fvField(*i) == scheduler_min_bandwidth_rate_field_name)
817830
{
818831
attr.id = SAI_SCHEDULER_ATTR_MIN_BANDWIDTH_RATE;
819-
attr.value.u64 = stoul(fvValue(*i));
832+
attr.value.u64 = stoull(fvValue(*i));
820833
sai_attr_list.push_back(attr);
821834
}
822835
else if (fvField(*i) == scheduler_min_bandwidth_burst_rate_field_name)
823836
{
824837
attr.id = SAI_SCHEDULER_ATTR_MIN_BANDWIDTH_BURST_RATE;
825-
attr.value.u64 = stoul(fvValue(*i));
838+
attr.value.u64 = stoull(fvValue(*i));
826839
sai_attr_list.push_back(attr);
827840
}
828841
else if (fvField(*i) == scheduler_max_bandwidth_rate_field_name)
829842
{
830843
attr.id = SAI_SCHEDULER_ATTR_MAX_BANDWIDTH_RATE;
831-
attr.value.u64 = stoul(fvValue(*i));
844+
attr.value.u64 = stoull(fvValue(*i));
832845
sai_attr_list.push_back(attr);
833846
}
834847
else if (fvField(*i) == scheduler_max_bandwidth_burst_rate_field_name)
835848
{
836849
attr.id = SAI_SCHEDULER_ATTR_MAX_BANDWIDTH_BURST_RATE;
837-
attr.value.u64 = stoul(fvValue(*i));
850+
attr.value.u64 = stoull(fvValue(*i));
838851
sai_attr_list.push_back(attr);
839852
}
840853
else {

orchagent/qosorch.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ const string scheduler_algo_WRR = "WRR";
3636
const string scheduler_algo_STRICT = "STRICT";
3737
const string scheduler_weight_field_name = "weight";
3838
const string scheduler_priority_field_name = "priority";
39-
39+
const string scheduler_meter_type_field_name = "meter_type";
4040
const string scheduler_min_bandwidth_rate_field_name = "cir";//Committed Information Rate
4141
const string scheduler_min_bandwidth_burst_rate_field_name = "cbs";//Committed Burst Size
4242
const string scheduler_max_bandwidth_rate_field_name = "pir";//Peak Information Rate

0 commit comments

Comments
 (0)