Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 18 additions & 8 deletions orchagent/qosorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,24 @@ bool WredMapHandler::convertFieldValuesToAttributes(KeyOpFieldsValuesTuple &tupl
attr.value.s32 = stoi(fvValue(*i));
attribs.push_back(attr);
}
else if (fvField(*i) == green_drop_probability_field_name)
{
attr.id = SAI_WRED_ATTR_GREEN_DROP_PROBABILITY;
attr.value.s32 = stoi(fvValue(*i));
attribs.push_back(attr);
}
else if (fvField(*i) == yellow_drop_probability_field_name)
{
attr.id = SAI_WRED_ATTR_YELLOW_DROP_PROBABILITY;
attr.value.s32 = stoi(fvValue(*i));
attribs.push_back(attr);
}
else if (fvField(*i) == red_drop_probability_field_name)
{
attr.id = SAI_WRED_ATTR_RED_DROP_PROBABILITY;
attr.value.s32 = stoi(fvValue(*i));
attribs.push_back(attr);
}
else if (fvField(*i) == wred_green_enable_field_name)
{
attr.id = SAI_WRED_ATTR_GREEN_ENABLE;
Expand Down Expand Up @@ -395,14 +413,6 @@ sai_object_id_t WredMapHandler::addQosItem(const vector<sai_attribute_t> &attrib
sai_attribute_t attr;
vector<sai_attribute_t> attrs;

attr.id = SAI_WRED_ATTR_GREEN_DROP_PROBABILITY;
attr.value.s32 = 100;
attrs.push_back(attr);

attr.id = SAI_WRED_ATTR_YELLOW_DROP_PROBABILITY;
attr.value.s32 = 100;
attrs.push_back(attr);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This chunk of code looks like providing some default values for these settings. By removing them, you also removed the 'default' value.

I don't see other enforcement to make sure we pass down the configuration all the time. Maybe that belongs to a different PR?

If 'default' value is desirable, then you can create 2 attr objects for them, set the default value before going through the if - else lists. But don't add them until the whole if-else block is done. like following:

type attr_green_drop;
attr_green_drop.s32 = 100;

... ...
if ...
else if ...
...

attrs.push(attr_green_drops);

@lguohan do we need to do this?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see your other review. But we don't apply qos.json unless we have buffer configuration. So maybe default value is still needed. If we have default value, then the other PR is no longer needed. right?

Copy link
Copy Markdown
Contributor Author

@wendani wendani Aug 10, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hardware has a default value if you do not set. This is the case with RED_DROP_PROBABILITY, which is interestingly not set default here.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with @yxieca , the pr can be modified as follows. if the user does not provide drop probability, we should set the default value in swss to be 100. In this case, your other pr is not needed.

attr.id = SAI_WRED_ATTR_WEIGHT;
attr.value.s32 = 0;
attrs.push_back(attr);
Expand Down
73 changes: 38 additions & 35 deletions orchagent/qosorch.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,41 +7,44 @@
#include "orch.h"
#include "portsorch.h"

const string dscp_to_tc_field_name = "dscp_to_tc_map";
const string pfc_to_pg_map_name = "pfc_to_pg_map";
const string pfc_to_queue_map_name = "pfc_to_queue_map";
const string pfc_enable_name = "pfc_enable";
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";
const string wred_yellow_enable_field_name = "wred_yellow_enable";
const string wred_green_enable_field_name = "wred_green_enable";

const string scheduler_algo_type_field_name = "type";
const string scheduler_algo_DWRR = "DWRR";
const string scheduler_algo_WRR = "WRR";
const string scheduler_algo_STRICT = "STRICT";
const string scheduler_weight_field_name = "weight";
const string scheduler_priority_field_name = "priority";

const string ecn_field_name = "ecn";
const string ecn_none = "ecn_none";
const string ecn_red = "ecn_red";
const string ecn_yellow = "ecn_yellow";
const string ecn_yellow_red = "ecn_yellow_red";
const string ecn_green = "ecn_green";
const string ecn_green_red = "ecn_green_red";
const string ecn_green_yellow = "ecn_green_yellow";
const string ecn_all = "ecn_all";
const string dscp_to_tc_field_name = "dscp_to_tc_map";
const string pfc_to_pg_map_name = "pfc_to_pg_map";
const string pfc_to_queue_map_name = "pfc_to_queue_map";
const string pfc_enable_name = "pfc_enable";
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 red_drop_probability_field_name = "red_drop_probability";
const string yellow_drop_probability_field_name = "yellow_drop_probability";
const string green_drop_probability_field_name = "green_drop_probability";

const string wred_profile_field_name = "wred_profile";
const string wred_red_enable_field_name = "wred_red_enable";
const string wred_yellow_enable_field_name = "wred_yellow_enable";
const string wred_green_enable_field_name = "wred_green_enable";

const string scheduler_algo_type_field_name = "type";
const string scheduler_algo_DWRR = "DWRR";
const string scheduler_algo_WRR = "WRR";
const string scheduler_algo_STRICT = "STRICT";
const string scheduler_weight_field_name = "weight";
const string scheduler_priority_field_name = "priority";

const string ecn_field_name = "ecn";
const string ecn_none = "ecn_none";
const string ecn_red = "ecn_red";
const string ecn_yellow = "ecn_yellow";
const string ecn_yellow_red = "ecn_yellow_red";
const string ecn_green = "ecn_green";
const string ecn_green_red = "ecn_green_red";
const string ecn_green_yellow = "ecn_green_yellow";
const string ecn_all = "ecn_all";

class QosMapHandler
{
Expand Down