Skip to content

Commit

Permalink
QOS field reference ABNF format to string changes
Browse files Browse the repository at this point in the history
  • Loading branch information
AshokDaparthi committed May 29, 2021
1 parent 6c4c9ad commit f0896e7
Show file tree
Hide file tree
Showing 16 changed files with 155 additions and 171 deletions.
2 changes: 1 addition & 1 deletion cfgmgr/buffer_pool_mellanox.lua
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ local function iterate_all_items(all_items)
profiles[index][2] = profiles[index][2] + size
local speed = redis.call('HGET', 'PORT_TABLE:'..port, 'speed')
if speed == '400000' then
if profile == '[BUFFER_PROFILE_TABLE:ingress_lossy_profile]' then
if profile == 'ingress_lossy_profile' then
lossypg_400g = lossypg_400g + size
end
port_count_400g = port_count_400g + 1
Expand Down
23 changes: 4 additions & 19 deletions cfgmgr/buffermgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ Create/update two tables: profile (in m_cfgBufferProfileTable) and port buffer (
"BUFFER_PROFILE": {
"pg_lossless_100G_300m_profile": {
"pool":"[BUFFER_POOL_TABLE:ingress_lossless_pool]",
"pool":"ingress_lossless_pool",
"xon":"18432",
"xon_offset":"2496",
"xoff":"165888",
Expand All @@ -116,7 +116,7 @@ Create/update two tables: profile (in m_cfgBufferProfileTable) and port buffer (
}
"BUFFER_PG" :{
Ethernet44|3-4": {
"profile" : "[BUFFER_PROFILE:pg_lossless_100000_300m_profile]"
"profile" : "pg_lossless_100000_300m_profile"
}
}
*/
Expand Down Expand Up @@ -160,11 +160,8 @@ task_process_status BufferMgr::doSpeedUpdateTask(string port, string speed)

// profile threshold field name
mode += "_th";
string pg_pool_reference = string(CFG_BUFFER_POOL_TABLE_NAME) +
m_cfgBufferProfileTable.getTableNameSeparator() +
INGRESS_LOSSLESS_PG_POOL_NAME;

fvVector.push_back(make_pair("pool", "[" + pg_pool_reference + "]"));
fvVector.push_back(make_pair("pool", INGRESS_LOSSLESS_PG_POOL_NAME));
fvVector.push_back(make_pair("xon", m_pgProfileLookup[speed][cable].xon));
if (m_pgProfileLookup[speed][cable].xon_offset.length() > 0) {
fvVector.push_back(make_pair("xon_offset",
Expand All @@ -184,11 +181,7 @@ task_process_status BufferMgr::doSpeedUpdateTask(string port, string speed)

string buffer_pg_key = port + m_cfgBufferPgTable.getTableNameSeparator() + LOSSLESS_PGS;

string profile_ref = string("[") +
CFG_BUFFER_PROFILE_TABLE_NAME +
m_cfgBufferPgTable.getTableNameSeparator() +
buffer_profile_key +
"]";
string profile_ref = buffer_profile_key;

/* Check if PG Mapping is already then log message and return. */
m_cfgBufferPgTable.get(buffer_pg_key, fvVector);
Expand Down Expand Up @@ -284,14 +277,6 @@ void BufferMgr::doBufferTableTask(Consumer &consumer, ProducerStateTable &applTa

for (auto i : kfvFieldsValues(t))
{
SWSS_LOG_INFO("Inserting field %s value %s", fvField(i).c_str(), fvValue(i).c_str());
//transform the separator in values from "|" to ":"
if (fvField(i) == "pool")
transformReference(fvValue(i));
if (fvField(i) == "profile")
transformReference(fvValue(i));
if (fvField(i) == "profile_list")
transformReference(fvValue(i));
fvVector.emplace_back(FieldValueTuple(fvField(i), fvValue(i)));
SWSS_LOG_INFO("Inserting field %s value %s", fvField(i).c_str(), fvValue(i).c_str());
}
Expand Down
27 changes: 4 additions & 23 deletions cfgmgr/buffermgrdyn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -526,17 +526,14 @@ void BufferMgrDynamic::updateBufferProfileToDb(const string &name, const buffer_

// profile threshold field name
mode += "_th";
string pg_pool_reference = string(APP_BUFFER_POOL_TABLE_NAME) +
m_applBufferProfileTable.getTableNameSeparator() +
INGRESS_LOSSLESS_PG_POOL_NAME;

fvVector.emplace_back("xon", profile.xon);
if (!profile.xon_offset.empty()) {
fvVector.emplace_back("xon_offset", profile.xon_offset);
}
fvVector.emplace_back("xoff", profile.xoff);
fvVector.emplace_back("size", profile.size);
fvVector.emplace_back("pool", "[" + pg_pool_reference + "]");
fvVector.emplace_back("pool", INGRESS_LOSSLESS_PG_POOL_NAME);
fvVector.emplace_back(mode, profile.threshold);

m_applBufferProfileTable.set(name, fvVector);
Expand All @@ -553,15 +550,7 @@ void BufferMgrDynamic::updateBufferPgToDb(const string &key, const string &profi

fvVector.clear();

string profile_ref = string("[") +
APP_BUFFER_PROFILE_TABLE_NAME +
m_applBufferPgTable.getTableNameSeparator() +
profile +
"]";

fvVector.clear();

fvVector.push_back(make_pair("profile", profile_ref));
fvVector.push_back(make_pair("profile", profile));
m_applBufferPgTable.set(key, fvVector);
}
else
Expand Down Expand Up @@ -1626,8 +1615,7 @@ task_process_status BufferMgrDynamic::handleBufferProfileTable(KeyOpFieldsValues
{
if (!value.empty())
{
transformReference(value);
auto poolName = parseObjectNameFromReference(value);
auto poolName = value;
if (poolName.empty())
{
SWSS_LOG_ERROR("BUFFER_PROFILE: Invalid format of reference to pool: %s", value.c_str());
Expand Down Expand Up @@ -1800,8 +1788,7 @@ task_process_status BufferMgrDynamic::handleOneBufferPgEntry(const string &key,
{
// Headroom override
pureDynamic = false;
transformReference(value);
string profileName = parseObjectNameFromReference(value);
string profileName = value;
if (profileName.empty())
{
SWSS_LOG_ERROR("BUFFER_PG: Invalid format of reference to profile: %s", value.c_str());
Expand Down Expand Up @@ -2007,12 +1994,6 @@ task_process_status BufferMgrDynamic::doBufferTableTask(KeyOpFieldsValuesTuple &
for (auto i : kfvFieldsValues(tuple))
{
// Transform the separator in values from "|" to ":"
if (fvField(i) == "pool")
transformReference(fvValue(i));
if (fvField(i) == "profile")
transformReference(fvValue(i));
if (fvField(i) == "profile_list")
transformReference(fvValue(i));
fvVector.emplace_back(fvField(i), fvValue(i));
SWSS_LOG_INFO("Inserting field %s value %s", fvField(i).c_str(), fvValue(i).c_str());
}
Expand Down
42 changes: 21 additions & 21 deletions doc/Configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -343,13 +343,13 @@ When the system is running in traditional buffer model, profiles needs to explic
{
"BUFFER_PG": {
"Ethernet0|3-4": {
"profile": "[BUFFER_PROFILE|pg_lossless_40000_5m_profile]"
"profile": "pg_lossless_40000_5m_profile"
},
"Ethernet1|3-4": {
"profile": "[BUFFER_PROFILE|pg_lossless_40000_5m_profile]"
"profile": "pg_lossless_40000_5m_profile"
},
"Ethernet2|3-4": {
"profile": "[BUFFER_PROFILE|pg_lossless_40000_5m_profile]"
"profile": "pg_lossless_40000_5m_profile"
}
}
}
Expand All @@ -371,7 +371,7 @@ When the system is running in dynamic buffer model, profiles can be:
"profile": "NULL"
},
"Ethernet2|3-4": {
"profile": "[BUFFER_PROFILE|static_profile]"
"profile": "static_profile"
}
}
}
Expand Down Expand Up @@ -437,33 +437,33 @@ When the system is running in dynamic buffer model, the size of some of the buff
"BUFFER_PROFILE": {
"egress_lossless_profile": {
"static_th": "3995680",
"pool": "[BUFFER_POOL|egress_lossless_pool]",
"pool": "egress_lossless_pool",
"size": "1518"
},
"egress_lossy_profile": {
"dynamic_th": "3",
"pool": "[BUFFER_POOL|egress_lossy_pool]",
"pool": "egress_lossy_pool",
"size": "1518"
},
"ingress_lossy_profile": {
"dynamic_th": "3",
"pool": "[BUFFER_POOL|ingress_lossless_pool]",
"pool": "ingress_lossless_pool",
"size": "0"
},
"pg_lossless_40000_5m_profile": {
"xon_offset": "2288",
"dynamic_th": "-3",
"xon": "2288",
"xoff": "66560",
"pool": "[BUFFER_POOL|ingress_lossless_pool]",
"pool": "ingress_lossless_pool",
"size": "1248"
},
"pg_lossless_40000_40m_profile": {
"xon_offset": "2288",
"dynamic_th": "-3",
"xon": "2288",
"xoff": "71552",
"pool": "[BUFFER_POOL|ingress_lossless_pool]",
"pool": "ingress_lossless_pool",
"size": "1248"
}
}
Expand Down Expand Up @@ -491,13 +491,13 @@ This kind of profiles will be handled by buffer manager and won't be applied to
{
"BUFFER_QUEUE": {
"Ethernet50,Ethernet52,Ethernet54,Ethernet56|0-2": {
"profile": "[BUFFER_PROFILE|egress_lossy_profile]"
"profile": "egress_lossy_profile"
},
"Ethernet50,Ethernet52,Ethernet54,Ethernet56|3-4": {
"profile": "[BUFFER_PROFILE|egress_lossless_profile]"
"profile": "egress_lossless_profile"
},
"Ethernet50,Ethernet52,Ethernet54,Ethernet56|5-6": {
"profile": "[BUFFER_PROFILE|egress_lossy_profile]"
"profile": "egress_lossy_profile"
}
}
}
Expand Down Expand Up @@ -1104,12 +1104,12 @@ name as object key and member list as attribute.
{
"PORT_QOS_MAP": {
"Ethernet50,Ethernet52,Ethernet54,Ethernet56": {
"tc_to_pg_map": "[TC_TO_PRIORITY_GROUP_MAP|AZURE]",
"tc_to_queue_map": "[TC_TO_QUEUE_MAP|AZURE]",
"tc_to_pg_map": "AZURE",
"tc_to_queue_map": "AZURE",
"pfc_enable": "3,4",
"pfc_to_queue_map": "[MAP_PFC_PRIORITY_TO_QUEUE|AZURE]",
"dscp_to_tc_map": "[DSCP_TO_TC_MAP|AZURE]",
"scheduler": "[SCHEDULER|scheduler.port]"
"pfc_to_queue_map": "AZURE",
"dscp_to_tc_map": "AZURE",
"scheduler": "scheduler.port"
}
}
}
Expand All @@ -1120,14 +1120,14 @@ name as object key and member list as attribute.
{
"QUEUE": {
"Ethernet56|4": {
"wred_profile": "[WRED_PROFILE|AZURE_LOSSLESS]",
"scheduler": "[SCHEDULER|scheduler.1]"
"wred_profile": "AZURE_LOSSLESS",
"scheduler": "scheduler.1"
},
"Ethernet56|5": {
"scheduler": "[SCHEDULER|scheduler.0]"
"scheduler": "scheduler.0"
},
"Ethernet56|6": {
"scheduler": "[SCHEDULER|scheduler.0]"
"scheduler": "scheduler.0"
}
}
}
Expand Down
8 changes: 4 additions & 4 deletions doc/swss-schema.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ Stores information for physical switch ports managed by the switch chip. Ports t
Example:
127.0.0.1:6379> hgetall PORT_TABLE:ETHERNET4
1) "dscp_to_tc_map"
2) "[DSCP_TO_TC_MAP_TABLE:AZURE]"
2) "AZURE"
3) "tc_to_queue_map"
4) "[TC_TO_QUEUE_MAP_TABLE:AZURE]"
4) "AZURE"

---------------------------------------------
### INTF_TABLE
Expand Down Expand Up @@ -209,9 +209,9 @@ and reflects the LAG ports into the redis under: `LAG_TABLE:<team0>:port`
Example:
127.0.0.1:6379> hgetall QUEUE_TABLE:ETHERNET4:1
1) "scheduler"
2) "[SCHEDULER_TABLE:BEST_EFFORT]"
2) "BEST_EFFORT"
3) "wred_profile"
4) "[WRED_PROFILE_TABLE:AZURE]"
4) "AZURE"

---------------------------------------------
### TC\_TO\_QUEUE\_MAP\_TABLE
Expand Down
30 changes: 23 additions & 7 deletions orchagent/bufferorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ type_map BufferOrch::m_buffer_type_maps = {
{APP_BUFFER_PORT_EGRESS_PROFILE_LIST_NAME, new object_reference_map()}
};

map<string, string> buffer_to_ref_table_map = {
{buffer_pool_field_name, APP_BUFFER_POOL_TABLE_NAME},
{buffer_profile_field_name, APP_BUFFER_PROFILE_TABLE_NAME},
{buffer_profile_list_field_name, APP_BUFFER_PROFILE_TABLE_NAME}
};

BufferOrch::BufferOrch(DBConnector *applDb, DBConnector *confDb, DBConnector *stateDb, vector<string> &tableNames) :
Orch(applDb, tableNames),
m_flexCounterDb(new DBConnector("FLEX_COUNTER_DB", 0)),
Expand Down Expand Up @@ -476,7 +482,9 @@ task_process_status BufferOrch::processBufferProfile(KeyOpFieldsValuesTuple &tup
}

sai_object_id_t sai_pool;
ref_resolve_status resolve_result = resolveFieldRefValue(m_buffer_type_maps, buffer_pool_field_name, tuple, sai_pool, pool_name);
ref_resolve_status resolve_result = resolveFieldRefValue(m_buffer_type_maps, buffer_pool_field_name,
buffer_to_ref_table_map.at(buffer_pool_field_name),
tuple, sai_pool, pool_name);
if (ref_resolve_status::success != resolve_result)
{
if(ref_resolve_status::not_resolved == resolve_result)
Expand Down Expand Up @@ -665,7 +673,9 @@ task_process_status BufferOrch::processQueue(KeyOpFieldsValuesTuple &tuple)

if (op == SET_COMMAND)
{
ref_resolve_status resolve_result = resolveFieldRefValue(m_buffer_type_maps, buffer_profile_field_name, tuple, sai_buffer_profile, buffer_profile_name);
ref_resolve_status resolve_result = resolveFieldRefValue(m_buffer_type_maps, buffer_profile_field_name,
buffer_to_ref_table_map.at(buffer_profile_field_name), tuple,
sai_buffer_profile, buffer_profile_name);
if (ref_resolve_status::success != resolve_result)
{
if (ref_resolve_status::not_resolved == resolve_result)
Expand Down Expand Up @@ -788,7 +798,9 @@ task_process_status BufferOrch::processPriorityGroup(KeyOpFieldsValuesTuple &tup

if (op == SET_COMMAND)
{
ref_resolve_status resolve_result = resolveFieldRefValue(m_buffer_type_maps, buffer_profile_field_name, tuple, sai_buffer_profile, buffer_profile_name);
ref_resolve_status resolve_result = resolveFieldRefValue(m_buffer_type_maps, buffer_profile_field_name,
buffer_to_ref_table_map.at(buffer_profile_field_name), tuple,
sai_buffer_profile, buffer_profile_name);
if (ref_resolve_status::success != resolve_result)
{
if (ref_resolve_status::not_resolved == resolve_result)
Expand Down Expand Up @@ -892,7 +904,7 @@ task_process_status BufferOrch::processPriorityGroup(KeyOpFieldsValuesTuple &tup
}

/*
Input sample:"[BUFFER_PROFILE_TABLE:i_port.profile0],[BUFFER_PROFILE_TABLE:i_port.profile1]"
Input sample:"i_port.profile0,i_port.profile1"
*/
task_process_status BufferOrch::processIngressBufferProfileList(KeyOpFieldsValuesTuple &tuple)
{
Expand All @@ -907,7 +919,9 @@ task_process_status BufferOrch::processIngressBufferProfileList(KeyOpFieldsValue
vector<sai_object_id_t> profile_list;

string profile_name_list;
ref_resolve_status resolve_status = resolveFieldRefArray(m_buffer_type_maps, buffer_profile_list_field_name, tuple, profile_list, profile_name_list);
ref_resolve_status resolve_status = resolveFieldRefArray(m_buffer_type_maps, buffer_profile_list_field_name,
buffer_to_ref_table_map.at(buffer_profile_list_field_name), tuple,
profile_list, profile_name_list);
if (ref_resolve_status::success != resolve_status)
{
if(ref_resolve_status::not_resolved == resolve_status)
Expand Down Expand Up @@ -948,7 +962,7 @@ task_process_status BufferOrch::processIngressBufferProfileList(KeyOpFieldsValue
}

/*
Input sample:"[BUFFER_PROFILE_TABLE:e_port.profile0],[BUFFER_PROFILE_TABLE:e_port.profile1]"
Input sample:"e_port.profile0,e_port.profile1"
*/
task_process_status BufferOrch::processEgressBufferProfileList(KeyOpFieldsValuesTuple &tuple)
{
Expand All @@ -961,7 +975,9 @@ task_process_status BufferOrch::processEgressBufferProfileList(KeyOpFieldsValues
vector<sai_object_id_t> profile_list;

string profile_name_list;
ref_resolve_status resolve_status = resolveFieldRefArray(m_buffer_type_maps, buffer_profile_list_field_name, tuple, profile_list, profile_name_list);
ref_resolve_status resolve_status = resolveFieldRefArray(m_buffer_type_maps, buffer_profile_list_field_name,
buffer_to_ref_table_map.at(buffer_profile_list_field_name), tuple,
profile_list, profile_name_list);
if (ref_resolve_status::success != resolve_status)
{
if(ref_resolve_status::not_resolved == resolve_status)
Expand Down
Loading

0 comments on commit f0896e7

Please sign in to comment.