Skip to content

Commit

Permalink
Move QoS configuration to config DB (sonic-net#378)
Browse files Browse the repository at this point in the history
* Move QoS configuration to config DB

Signed-off-by: Andriy Moroz <c_andriym@mellanox.com>

* Remove old Mellanox QoS config

Signed-off-by: Andriy Moroz <c_andriym@mellanox.com>

* Delimiter variable rename

Signed-off-by: Andriy Moroz <c_andriym@mellanox.com>
  • Loading branch information
andriymoroz-mlnx authored and yxieca committed Nov 21, 2017
1 parent 00e38be commit 3a9cf8f
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 217 deletions.
1 change: 0 additions & 1 deletion debian/swss.install
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
swssconfig/sample/netbouncer.json etc/swss/config.d
swssconfig/sample/00-copp.config.json etc/swss/config.d
swssconfig/sample/msn27xx.32ports.qos.json etc/swss/config.d
swssconfig/sample/td2.32ports.buffers.json etc/swss/config.d
swssconfig/sample/td2.32ports.qos.json etc/swss/config.d
swssconfig/sample/th.64ports.buffers.json etc/swss/config.d
Expand Down
8 changes: 6 additions & 2 deletions orchagent/orch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,12 @@ bool Orch::parseReference(type_map &type_maps, string &ref_in, string &type_name
tokens = tokenize(ref_content, delimiter);
if (tokens.size() != 2)
{
SWSS_LOG_ERROR("malformed reference:%s. Must contain 2 tokens\n", ref_content.c_str());
return false;
tokens = tokenize(ref_content, config_db_key_delimiter);
if (tokens.size() != 2)
{
SWSS_LOG_ERROR("malformed reference:%s. Must contain 2 tokens\n", ref_content.c_str());
return false;
}
}
auto type_it = type_maps.find(tokens[0]);
if (type_it == type_maps.end())
Expand Down
1 change: 1 addition & 0 deletions orchagent/orch.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ const char ref_start = '[';
const char ref_end = ']';
const char comma = ',';
const char range_specifier = '-';
const char config_db_key_delimiter = '|';

#define MLNX_PLATFORM_SUBSTRING "mellanox"
#define BRCM_PLATFORM_SUBSTRING "broadcom"
Expand Down
20 changes: 10 additions & 10 deletions orchagent/orchdaemon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,17 +66,17 @@ bool OrchDaemon::init()
TunnelDecapOrch *tunnel_decap_orch = new TunnelDecapOrch(m_applDb, APP_TUNNEL_DECAP_TABLE_NAME);

vector<string> qos_tables = {
APP_TC_TO_QUEUE_MAP_TABLE_NAME,
APP_SCHEDULER_TABLE_NAME,
APP_DSCP_TO_TC_MAP_TABLE_NAME,
APP_QUEUE_TABLE_NAME,
APP_PORT_QOS_MAP_TABLE_NAME,
APP_WRED_PROFILE_TABLE_NAME,
APP_TC_TO_PRIORITY_GROUP_MAP_NAME,
APP_PFC_PRIORITY_TO_PRIORITY_GROUP_MAP_NAME,
APP_PFC_PRIORITY_TO_QUEUE_MAP_NAME
CFG_TC_TO_QUEUE_MAP_TABLE_NAME,
CFG_SCHEDULER_TABLE_NAME,
CFG_DSCP_TO_TC_MAP_TABLE_NAME,
CFG_QUEUE_TABLE_NAME,
CFG_PORT_QOS_MAP_TABLE_NAME,
CFG_WRED_PROFILE_TABLE_NAME,
CFG_TC_TO_PRIORITY_GROUP_MAP_TABLE_NAME,
CFG_PFC_PRIORITY_TO_PRIORITY_GROUP_MAP_TABLE_NAME,
CFG_PFC_PRIORITY_TO_QUEUE_MAP_TABLE_NAME
};
QosOrch *qos_orch = new QosOrch(m_applDb, qos_tables);
QosOrch *qos_orch = new QosOrch(m_configDb, qos_tables);

vector<string> buffer_tables = {
APP_BUFFER_POOL_TABLE_NAME,
Expand Down
44 changes: 22 additions & 22 deletions orchagent/qosorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,15 @@ map<string, sai_port_attr_t> qos_to_attr_map = {
};

type_map QosOrch::m_qos_maps = {
{APP_DSCP_TO_TC_MAP_TABLE_NAME, new object_map()},
{APP_TC_TO_QUEUE_MAP_TABLE_NAME, new object_map()},
{APP_SCHEDULER_TABLE_NAME, new object_map()},
{APP_WRED_PROFILE_TABLE_NAME, new object_map()},
{APP_PORT_QOS_MAP_TABLE_NAME, new object_map()},
{APP_QUEUE_TABLE_NAME, new object_map()},
{APP_TC_TO_PRIORITY_GROUP_MAP_NAME, new object_map()},
{APP_PFC_PRIORITY_TO_PRIORITY_GROUP_MAP_NAME, new object_map()},
{APP_PFC_PRIORITY_TO_QUEUE_MAP_NAME, new object_map()}
{CFG_DSCP_TO_TC_MAP_TABLE_NAME, new object_map()},
{CFG_TC_TO_QUEUE_MAP_TABLE_NAME, new object_map()},
{CFG_SCHEDULER_TABLE_NAME, new object_map()},
{CFG_WRED_PROFILE_TABLE_NAME, new object_map()},
{CFG_PORT_QOS_MAP_TABLE_NAME, new object_map()},
{CFG_QUEUE_TABLE_NAME, new object_map()},
{CFG_TC_TO_PRIORITY_GROUP_MAP_TABLE_NAME, new object_map()},
{CFG_PFC_PRIORITY_TO_PRIORITY_GROUP_MAP_TABLE_NAME, new object_map()},
{CFG_PFC_PRIORITY_TO_QUEUE_MAP_TABLE_NAME, new object_map()}
};

task_process_status QosMapHandler::processWorkItem(Consumer& consumer)
Expand Down Expand Up @@ -743,16 +743,16 @@ void QosOrch::initAclEntryForEcn(sai_object_id_t acl_table_id, sai_uint32_t prio
void QosOrch::initTableHandlers()
{
SWSS_LOG_ENTER();
m_qos_handler_map.insert(qos_handler_pair(APP_DSCP_TO_TC_MAP_TABLE_NAME, &QosOrch::handleDscpToTcTable));
m_qos_handler_map.insert(qos_handler_pair(APP_TC_TO_QUEUE_MAP_TABLE_NAME, &QosOrch::handleTcToQueueTable));
m_qos_handler_map.insert(qos_handler_pair(APP_SCHEDULER_TABLE_NAME, &QosOrch::handleSchedulerTable));
m_qos_handler_map.insert(qos_handler_pair(APP_QUEUE_TABLE_NAME, &QosOrch::handleQueueTable));
m_qos_handler_map.insert(qos_handler_pair(APP_PORT_QOS_MAP_TABLE_NAME, &QosOrch::handlePortQosMapTable));
m_qos_handler_map.insert(qos_handler_pair(APP_WRED_PROFILE_TABLE_NAME, &QosOrch::handleWredProfileTable));

m_qos_handler_map.insert(qos_handler_pair(APP_TC_TO_PRIORITY_GROUP_MAP_NAME, &QosOrch::handleTcToPgTable));
m_qos_handler_map.insert(qos_handler_pair(APP_PFC_PRIORITY_TO_PRIORITY_GROUP_MAP_NAME, &QosOrch::handlePfcPrioToPgTable));
m_qos_handler_map.insert(qos_handler_pair(APP_PFC_PRIORITY_TO_QUEUE_MAP_NAME, &QosOrch::handlePfcToQueueTable));
m_qos_handler_map.insert(qos_handler_pair(CFG_DSCP_TO_TC_MAP_TABLE_NAME, &QosOrch::handleDscpToTcTable));
m_qos_handler_map.insert(qos_handler_pair(CFG_TC_TO_QUEUE_MAP_TABLE_NAME, &QosOrch::handleTcToQueueTable));
m_qos_handler_map.insert(qos_handler_pair(CFG_SCHEDULER_TABLE_NAME, &QosOrch::handleSchedulerTable));
m_qos_handler_map.insert(qos_handler_pair(CFG_QUEUE_TABLE_NAME, &QosOrch::handleQueueTable));
m_qos_handler_map.insert(qos_handler_pair(CFG_PORT_QOS_MAP_TABLE_NAME, &QosOrch::handlePortQosMapTable));
m_qos_handler_map.insert(qos_handler_pair(CFG_WRED_PROFILE_TABLE_NAME, &QosOrch::handleWredProfileTable));

m_qos_handler_map.insert(qos_handler_pair(CFG_TC_TO_PRIORITY_GROUP_MAP_TABLE_NAME, &QosOrch::handleTcToPgTable));
m_qos_handler_map.insert(qos_handler_pair(CFG_PFC_PRIORITY_TO_PRIORITY_GROUP_MAP_TABLE_NAME, &QosOrch::handlePfcPrioToPgTable));
m_qos_handler_map.insert(qos_handler_pair(CFG_PFC_PRIORITY_TO_QUEUE_MAP_TABLE_NAME, &QosOrch::handlePfcToQueueTable));
}

task_process_status QosOrch::handleSchedulerTable(Consumer& consumer)
Expand All @@ -763,7 +763,7 @@ task_process_status QosOrch::handleSchedulerTable(Consumer& consumer)
sai_object_id_t sai_object = SAI_NULL_OBJECT_ID;

KeyOpFieldsValuesTuple tuple = consumer.m_toSync.begin()->second;
string qos_map_type_name = APP_SCHEDULER_TABLE_NAME;
string qos_map_type_name = CFG_SCHEDULER_TABLE_NAME;
string qos_object_name = kfvKey(tuple);
string op = kfvOp(tuple);

Expand Down Expand Up @@ -1012,8 +1012,8 @@ task_process_status QosOrch::handleQueueTable(Consumer& consumer)
vector<string> port_names;

ref_resolve_status resolve_result;
// sample "QUEUE_TABLE:ETHERNET4:1"
tokens = tokenize(key, delimiter);
// sample "QUEUE: {Ethernet4|0-1}"
tokens = tokenize(key, config_db_key_delimiter);
if (tokens.size() != 2)
{
SWSS_LOG_ERROR("malformed key:%s. Must contain 2 tokens", key.c_str());
Expand Down
182 changes: 0 additions & 182 deletions swssconfig/sample/msn27xx.32ports.qos.json

This file was deleted.

0 comments on commit 3a9cf8f

Please sign in to comment.