Skip to content

Commit

Permalink
Handle the case where enable is "false"
Browse files Browse the repository at this point in the history
Signed-off-by: Stephen Sun <stephens@nvidia.com>
  • Loading branch information
stephenxs committed Aug 24, 2022
1 parent 238488f commit 0b02be3
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
15 changes: 12 additions & 3 deletions orchagent/qosorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -739,13 +739,22 @@ sai_object_id_t WredMapHandler::addQosItem(const vector<sai_attribute_t> &attrib
switch (attrib.id)
{
case SAI_WRED_ATTR_GREEN_ENABLE:
wred_enable_set |= GREEN_WRED_ENABLED;
if (attrib.value.booldata)
{
wred_enable_set |= GREEN_WRED_ENABLED;
}
break;
case SAI_WRED_ATTR_YELLOW_ENABLE:
wred_enable_set |= YELLOW_WRED_ENABLED;
if (attrib.value.booldata)
{
wred_enable_set |= YELLOW_WRED_ENABLED;
}
break;
case SAI_WRED_ATTR_RED_ENABLE:
wred_enable_set |= RED_WRED_ENABLED;
if (attrib.value.booldata)
{
wred_enable_set |= RED_WRED_ENABLED;
}
break;
case SAI_WRED_ATTR_GREEN_DROP_PROBABILITY:
drop_prob_set |= GREEN_DROP_PROBABILITY_SET;
Expand Down
3 changes: 3 additions & 0 deletions tests/mock_tests/qosorch_ut.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1381,6 +1381,7 @@ namespace qosorch_test
// QoS orchagent should guarantee that the new min is configured first and then new max
vector<FieldValueTuple> greenProfile = {
{"wred_green_enable", "true"},
{"wred_yellow_enable", "false"},
};
qos_wred_max_drop_probability_t greenProbabilities = {
100, // green_max_drop_probability
Expand All @@ -1395,6 +1396,7 @@ namespace qosorch_test

vector<FieldValueTuple> yellowProfile = {
{"wred_yellow_enable", "true"},
{"wred_red_enable", "false"},
};
qos_wred_max_drop_probability_t yellowProbabilities = {
0, // green_max_drop_probability
Expand All @@ -1408,6 +1410,7 @@ namespace qosorch_test
updateMaxDropProbabilityAndCheck("yellow", yellowProfile, yellowProbabilities);

vector<FieldValueTuple> redProfile = {
{"wred_green_enable", "false"},
{"wred_red_enable", "true"},
};
qos_wred_max_drop_probability_t redProbabilities = {
Expand Down

0 comments on commit 0b02be3

Please sign in to comment.