Skip to content

Commit

Permalink
[qosorch]: Add possibility to set min value for WRED thresholds (soni…
Browse files Browse the repository at this point in the history
…c-net#276)

- Set min thresholds equal to max to preserve default behavior.
  • Loading branch information
oleksandrivantsiv authored and Shuotian Cheng committed Aug 8, 2017
1 parent 3223732 commit f9b55d3
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 12 deletions.
21 changes: 12 additions & 9 deletions orchagent/qosorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -283,8 +283,9 @@ bool WredMapHandler::convertFieldValuesToAttributes(KeyOpFieldsValuesTuple &tupl
attr.id = SAI_WRED_ATTR_YELLOW_MAX_THRESHOLD;
attr.value.s32 = stoi(fvValue(*i));
attribs.push_back(attr);

// set min threshold to the same value as MAX
}
else if (fvField(*i) == yellow_min_threshold_field_name)
{
attr.id = SAI_WRED_ATTR_YELLOW_MIN_THRESHOLD;
attr.value.s32 = stoi(fvValue(*i));
attribs.push_back(attr);
Expand All @@ -294,19 +295,21 @@ bool WredMapHandler::convertFieldValuesToAttributes(KeyOpFieldsValuesTuple &tupl
attr.id = SAI_WRED_ATTR_GREEN_MAX_THRESHOLD;
attr.value.s32 = stoi(fvValue(*i));
attribs.push_back(attr);

// set min threshold to the same value as MAX
attr.id = SAI_WRED_ATTR_GREEN_MIN_THRESHOLD;
attr.value.s32 = stoi(fvValue(*i));
attribs.push_back(attr);
}
else if (fvField(*i) == green_min_threshold_field_name)
{
attr.id = SAI_WRED_ATTR_GREEN_MIN_THRESHOLD;
attr.value.s32 = stoi(fvValue(*i));
attribs.push_back(attr);
}
else if (fvField(*i) == red_max_threshold_field_name)
{
attr.id = SAI_WRED_ATTR_RED_MAX_THRESHOLD;
attr.value.s32 = stoi(fvValue(*i));
attribs.push_back(attr);

// set min threshold to the same value as MAX
}
else if (fvField(*i) == red_min_threshold_field_name)
{
attr.id = SAI_WRED_ATTR_RED_MIN_THRESHOLD;
attr.value.s32 = stoi(fvValue(*i));
attribs.push_back(attr);
Expand Down
3 changes: 3 additions & 0 deletions orchagent/qosorch.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,11 @@ const string tc_to_pg_map_field_name = "tc_to_pg_map";
const string tc_to_queue_field_name = "tc_to_queue_map";
const string scheduler_field_name = "scheduler";
const string red_max_threshold_field_name = "red_max_threshold";
const string red_min_threshold_field_name = "red_min_threshold";
const string yellow_max_threshold_field_name = "yellow_max_threshold";
const string yellow_min_threshold_field_name = "yellow_min_threshold";
const string green_max_threshold_field_name = "green_max_threshold";
const string green_min_threshold_field_name = "green_min_threshold";

const string wred_profile_field_name = "wred_profile";
const string wred_red_enable_field_name = "wred_red_enable";
Expand Down
5 changes: 4 additions & 1 deletion swssconfig/sample/msn2700.32ports.qos.json
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,11 @@
"wred_yellow_enable":"true",
"ecn":"ecn_all",
"red_max_threshold":"512000",
"red_min_threshold":"512000",
"yellow_max_threshold":"512000",
"green_max_threshold": "184320"
"yellow_min_threshold":"512000",
"green_max_threshold": "184320",
"green_min_threshold": "184320"
},
"OP": "SET"
},
Expand Down
5 changes: 4 additions & 1 deletion swssconfig/sample/msn2740.32ports.qos.json
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,11 @@
"wred_yellow_enable":"true",
"ecn":"ecn_all",
"red_max_threshold":"512000",
"red_min_threshold":"512000",
"yellow_max_threshold":"512000",
"green_max_threshold": "184320"
"yellow_min_threshold":"512000",
"green_max_threshold": "184320",
"green_min_threshold": "184320"
},
"OP": "SET"
},
Expand Down
5 changes: 4 additions & 1 deletion swssconfig/sample/td2.32ports.qos.json
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,11 @@
"wred_yellow_enable":"true",
"ecn":"ecn_all",
"red_max_threshold":"512000",
"red_min_threshold":"512000",
"yellow_max_threshold":"512000",
"green_max_threshold": "184320"
"yellow_min_threshold":"512000",
"green_max_threshold": "184320",
"green_min_threshold": "184320"
},
"OP": "SET"
},
Expand Down

0 comments on commit f9b55d3

Please sign in to comment.