Skip to content

Commit

Permalink
Revert "[bufferorch] : Support for buffer profiles for VoQ on chassis (
Browse files Browse the repository at this point in the history
…#2465)"

This reverts commit 17cdad3.
  • Loading branch information
yxieca committed Jan 5, 2023
1 parent bbccc68 commit 4897e93
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 133 deletions.
135 changes: 21 additions & 114 deletions orchagent/bufferorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ extern sai_buffer_api_t *sai_buffer_api;
extern PortsOrch *gPortsOrch;
extern Directory<Orch*> gDirectory;
extern sai_object_id_t gSwitchId;
extern string gMySwitchType;

#define BUFFER_POOL_WATERMARK_FLEX_STAT_COUNTER_POLL_MSECS "60000"

Expand Down Expand Up @@ -104,32 +103,16 @@ void BufferOrch::initBufferReadyLists(DBConnector *applDb, DBConnector *confDb)
Table pg_table(applDb, APP_BUFFER_PG_TABLE_NAME);
initBufferReadyList(pg_table, false);

if(gMySwitchType == "voq")
{
Table queue_table(applDb, APP_BUFFER_QUEUE_TABLE_NAME);
initVoqBufferReadyList(queue_table, false);
}
else
{
Table queue_table(applDb, APP_BUFFER_QUEUE_TABLE_NAME);
initBufferReadyList(queue_table, false);
}
Table queue_table(applDb, APP_BUFFER_QUEUE_TABLE_NAME);
initBufferReadyList(queue_table, false);
}
else
{
Table pg_table(confDb, CFG_BUFFER_PG_TABLE_NAME);
initBufferReadyList(pg_table, true);

if(gMySwitchType == "voq")
{
Table queue_table(confDb, CFG_BUFFER_QUEUE_TABLE_NAME);
initVoqBufferReadyList(queue_table, true);
}
else
{
Table queue_table(confDb, CFG_BUFFER_QUEUE_TABLE_NAME);
initBufferReadyList(queue_table, true);
}
Table queue_table(confDb, CFG_BUFFER_QUEUE_TABLE_NAME);
initBufferReadyList(queue_table, true);
}
}

Expand Down Expand Up @@ -166,38 +149,6 @@ void BufferOrch::initBufferReadyList(Table& table, bool isConfigDb)
}
}

void BufferOrch::initVoqBufferReadyList(Table& table, bool isConfigDb)
{
SWSS_LOG_ENTER();

std::vector<std::string> keys;
table.getKeys(keys);

const char dbKeyDelimiter = (isConfigDb ? config_db_key_delimiter : delimiter);

// populate the lists with buffer configuration information
for (const auto& key: keys)
{
auto &&tokens = tokenize(key, dbKeyDelimiter);
if (tokens.size() != 4)
{
SWSS_LOG_ERROR("Wrong format of a table '%s' key '%s'. Skip it", table.getTableName().c_str(), key.c_str());
continue;
}

// We need transform the key from config db format to appl db format
auto appldb_key = tokens[0] + config_db_key_delimiter + tokens[1] + config_db_key_delimiter + tokens[2] + delimiter + tokens[3];
m_ready_list[appldb_key] = false;

auto &&port_names = tokenize(tokens[0] + config_db_key_delimiter + tokens[1] + config_db_key_delimiter + tokens[2], list_item_delimiter);
for(const auto& port_name: port_names)
{
SWSS_LOG_INFO("Item %s has been inserted into ready list", appldb_key.c_str());
m_port_ready_list_ref[port_name].push_back(appldb_key);
}
}
}

void BufferOrch::initBufferConstants()
{
sai_status_t status;
Expand Down Expand Up @@ -761,8 +712,7 @@ task_process_status BufferOrch::processBufferProfile(KeyOpFieldsValuesTuple &tup
}

/*
Input sample "BUFFER_QUEUE|Ethernet4,Ethernet45|10-15" or
"BUFFER_QUEUE|STG01-0101-0400-01T2-LC6|ASIC0|Ethernet4|10-15"
Input sample "BUFFER_QUEUE|Ethernet4,Ethernet45|10-15"
*/
task_process_status BufferOrch::processQueue(KeyOpFieldsValuesTuple &tuple)
{
Expand All @@ -777,35 +727,15 @@ task_process_status BufferOrch::processQueue(KeyOpFieldsValuesTuple &tuple)

SWSS_LOG_DEBUG("Processing:%s", key.c_str());
tokens = tokenize(key, delimiter);

vector<string> port_names;
if (gMySwitchType == "voq")
if (tokens.size() != 2)
{
if (tokens.size() != 4)
{
SWSS_LOG_ERROR("malformed key:%s. Must contain 4 tokens", key.c_str());
return task_process_status::task_invalid_entry;
}

port_names = tokenize(tokens[0] + config_db_key_delimiter + tokens[1] + config_db_key_delimiter + tokens[2], list_item_delimiter);
if (!parseIndexRange(tokens[3], range_low, range_high))
{
return task_process_status::task_invalid_entry;
}
SWSS_LOG_ERROR("malformed key:%s. Must contain 2 tokens", key.c_str());
return task_process_status::task_invalid_entry;
}
else
vector<string> port_names = tokenize(tokens[0], list_item_delimiter);
if (!parseIndexRange(tokens[1], range_low, range_high))
{
if (tokens.size() != 2)
{
SWSS_LOG_ERROR("malformed key:%s. Must contain 2 tokens", key.c_str());
return task_process_status::task_invalid_entry;
}

port_names = tokenize(tokens[0], list_item_delimiter);
if (!parseIndexRange(tokens[1], range_low, range_high))
{
return task_process_status::task_invalid_entry;
}
return task_process_status::task_invalid_entry;
}

if (op == SET_COMMAND)
Expand Down Expand Up @@ -862,35 +792,20 @@ task_process_status BufferOrch::processQueue(KeyOpFieldsValuesTuple &tuple)
for (size_t ind = range_low; ind <= range_high; ind++)
{
SWSS_LOG_DEBUG("processing queue:%zd", ind);
sai_object_id_t queue_id;

if (gMySwitchType == "voq")
if (port.m_queue_ids.size() <= ind)
{
std :: vector<sai_object_id_t> queue_ids = gPortsOrch->getPortVoQIds(port);
if (queue_ids.size() <= ind)
{
SWSS_LOG_ERROR("Invalid voq index specified:%zd", ind);
return task_process_status::task_invalid_entry;
}
queue_id = queue_ids[ind];
}
else
SWSS_LOG_ERROR("Invalid queue index specified:%zd", ind);
return task_process_status::task_invalid_entry;
}
if (port.m_queue_lock[ind])
{
if (port.m_queue_ids.size() <= ind)
{
SWSS_LOG_ERROR("Invalid queue index specified:%zd", ind);
return task_process_status::task_invalid_entry;
}
if (port.m_queue_lock[ind])
{
SWSS_LOG_WARN("Queue %zd on port %s is locked, will retry", ind, port_name.c_str());
return task_process_status::task_need_retry;
}
queue_id = port.m_queue_ids[ind];
SWSS_LOG_WARN("Queue %zd on port %s is locked, will retry", ind, port_name.c_str());
return task_process_status::task_need_retry;
}

if (need_update_sai)
{
sai_object_id_t queue_id;
queue_id = port.m_queue_ids[ind];
SWSS_LOG_DEBUG("Applying buffer profile:0x%" PRIx64 " to queue index:%zd, queue sai_id:0x%" PRIx64, sai_buffer_profile, ind, queue_id);
sai_status_t sai_status = sai_queue_api->set_queue_attribute(queue_id, &attr);
if (sai_status != SAI_STATUS_SUCCESS)
Expand Down Expand Up @@ -1339,15 +1254,7 @@ void BufferOrch::doTask(Consumer &consumer)
{
SWSS_LOG_ENTER();

if (gMySwitchType == "voq")
{
if(!gPortsOrch->isInitDone())
{
SWSS_LOG_INFO("Buffer task for %s can't be executed ahead of port config done", consumer.getTableName().c_str());
return;
}
}
else if (!gPortsOrch->isConfigDone())
if (!gPortsOrch->isConfigDone())
{
SWSS_LOG_INFO("Buffer task for %s can't be executed ahead of port config done", consumer.getTableName().c_str());
return;
Expand Down
1 change: 0 additions & 1 deletion orchagent/bufferorch.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ class BufferOrch : public Orch
void initTableHandlers();
void initBufferReadyLists(DBConnector *confDb, DBConnector *applDb);
void initBufferReadyList(Table& table, bool isConfigDb);
void initVoqBufferReadyList(Table& table, bool isConfigDb);
void initFlexCounterGroupTable(void);
void initBufferConstants();
task_process_status processBufferPool(KeyOpFieldsValuesTuple &tuple);
Expand Down
12 changes: 2 additions & 10 deletions orchagent/portsorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7521,14 +7521,13 @@ bool PortsOrch::addSystemPorts()
}

//System port for local port. Update the system port info in the existing physical port
Port local_port;
if(!getPort(attr.value.oid, local_port))
if(!getPort(attr.value.oid, port))
{
//This is system port for non-front panel local port (CPU or OLP or RCY (Inband)). Not an error
SWSS_LOG_NOTICE("Add port for non-front panel local system port 0x%" PRIx64 "; core: %d, core port: %d",
system_port_oid, core_index, core_port_index);
}
local_port.m_system_port_info.local_port_oid = attr.value.oid;
port.m_system_port_info.local_port_oid = attr.value.oid;
}

port.m_system_port_oid = system_port_oid;
Expand Down Expand Up @@ -7788,13 +7787,6 @@ bool PortsOrch::isMACsecPort(sai_object_id_t port_id) const
return m_macsecEnabledPorts.find(port_id) != m_macsecEnabledPorts.end();
}

vector<sai_object_id_t> PortsOrch::getPortVoQIds(Port& port)
{
SWSS_LOG_ENTER();

return m_port_voq_ids[port.m_alias];
}

/* Refresh the per-port Auto-Negotiation operational states */
void PortsOrch::refreshPortStateAutoNeg(const Port &port)
{
Expand Down
1 change: 0 additions & 1 deletion orchagent/portsorch.h
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,6 @@ class PortsOrch : public Orch, public Subject

void setMACsecEnabledState(sai_object_id_t port_id, bool enabled);
bool isMACsecPort(sai_object_id_t port_id) const;
vector<sai_object_id_t> getPortVoQIds(Port& port);

private:
unique_ptr<Table> m_counterTable;
Expand Down
7 changes: 0 additions & 7 deletions tests/test_virtual_chassis.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
from dvslib.dvs_database import DVSDatabase
import ast
import time
import pytest

class TestVirtualChassis(object):

Expand Down Expand Up @@ -137,7 +136,6 @@ def test_voq_switch(self, vct):
spcfg = ast.literal_eval(value)
assert spcfg['count'] == sp_count, "Number of systems ports configured is invalid"

@pytest.mark.skip(reason="Failing. Under investigation")
def test_chassis_app_db_sync(self, vct):
"""Test chassis app db syncing.
Expand All @@ -158,7 +156,6 @@ def test_chassis_app_db_sync(self, vct):
keys = chassis_app_db.get_keys("SYSTEM_INTERFACE")
assert len(keys), "No chassis app db syncing is done"

@pytest.mark.skip(reason="Failing. Under investigation")
def test_chassis_system_interface(self, vct):
"""Test RIF record creation in ASIC_DB for remote interfaces.
Expand Down Expand Up @@ -215,7 +212,6 @@ def test_chassis_system_interface(self, vct):
# Remote system ports's switch id should not match local switch id
assert spcfginfo["attached_switch_id"] != lc_switch_id, "RIF system port with wrong switch_id"

@pytest.mark.skip(reason="Failing. Under investigation")
def test_chassis_system_neigh(self, vct):
"""Test neigh record create/delete and syncing to chassis app db.
Expand Down Expand Up @@ -486,7 +482,6 @@ def chassis_system_neigh_create():
# Cleanup inband if configuration
self.del_inbandif_port(vct, inband_port)

@pytest.mark.skip(reason="Failing. Under investigation")
def test_chassis_system_lag(self, vct):
"""Test PortChannel in VOQ based chassis systems.
Expand Down Expand Up @@ -623,7 +618,6 @@ def test_chassis_system_lag(self, vct):

break

@pytest.mark.skip(reason="Failing. Under investigation")
def test_chassis_system_lag_id_allocator_table_full(self, vct):
"""Test lag id allocator table full.
Expand Down Expand Up @@ -701,7 +695,6 @@ def test_chassis_system_lag_id_allocator_table_full(self, vct):

break

@pytest.mark.skip(reason="Failing. Under investigation")
def test_chassis_system_lag_id_allocator_del_id(self, vct):
"""Test lag id allocator's release id and re-use id processing.
Expand Down

0 comments on commit 4897e93

Please sign in to comment.