Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SAG]: Add SAG implementation #1974

Open
wants to merge 18 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
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
39 changes: 39 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,45 @@ stages:
artifact_name: sonic-swss.arm64
archive_gcov: false

- stage: BuildBookworm
dependsOn: BuildArm
condition: succeeded('BuildArm')
jobs:
- template: .azure-pipelines/build-template.yml
parameters:
arch: amd64
pool: sonicbld
sonic_slave: sonic-slave-bookworm
common_lib_artifact_name: common-lib
swss_common_artifact_name: sonic-swss-common-bookworm
sairedis_artifact_name: sonic-sairedis-bookworm
artifact_name: sonic-swss-bookworm
archive_gcov: false

- template: .azure-pipelines/build-template.yml
parameters:
arch: armhf
timeout: 240
pool: sonicbld-armhf
sonic_slave: sonic-slave-bookworm-armhf
common_lib_artifact_name: common-lib.armhf
swss_common_artifact_name: sonic-swss-common-bookworm.armhf
sairedis_artifact_name: sonic-sairedis-bookworm.armhf
artifact_name: sonic-swss-bookworm.armhf
archive_gcov: false

- template: .azure-pipelines/build-template.yml
parameters:
arch: arm64
timeout: 240
pool: sonicbld-arm64
sonic_slave: sonic-slave-bookworm-arm64
common_lib_artifact_name: common-lib.arm64
swss_common_artifact_name: sonic-swss-common-bookworm.arm64
sairedis_artifact_name: sonic-sairedis-bookworm.arm64
artifact_name: sonic-swss-bookworm.arm64
archive_gcov: false

- stage: BuildDocker
dependsOn: Build
condition: succeeded('Build')
Expand Down
19 changes: 15 additions & 4 deletions cfgmgr/buffer_pool_mellanox.lua
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ local function iterate_profile_list(all_items)
return 0
end

local function fetch_buffer_pool_size_from_appldb()
local function fetch_buffer_pool_size_from_appldb(shp_enabled)
local buffer_pools = {}
redis.call('SELECT', config_db)
local buffer_pool_keys = redis.call('KEYS', 'BUFFER_POOL|*')
Expand All @@ -158,7 +158,18 @@ local function fetch_buffer_pool_size_from_appldb()
end
xoff = redis.call('HGET', 'BUFFER_POOL_TABLE:' .. buffer_pools[i], 'xoff')
if not xoff then
table.insert(result, buffer_pools[i] .. ':' .. size)
if shp_enabled and size == "0" and buffer_pools[i] == "ingress_lossless_pool" then
-- During initialization, if SHP is enabled
-- 1. the buffer pool sizes, xoff have initialized to 0, which means the shared headroom pool is disabled
-- 2. but the buffer profiles already indicate the shared headroom pool is enabled
-- 3. later on the buffer pool sizes are updated with xoff being non-zero
-- In case the orchagent starts handling buffer configuration between 2 and 3,
-- It is inconsistent between buffer pools and profiles, which fails Mellanox SAI sanity check
-- To avoid it, it indicates the shared headroom pool is enabled by setting a very small buffer pool and shared headroom pool sizes
table.insert(result, buffer_pools[i] .. ':2048:1024')
else
table.insert(result, buffer_pools[i] .. ':' .. size)
end
else
table.insert(result, buffer_pools[i] .. ':' .. size .. ':' .. xoff)
end
Expand Down Expand Up @@ -295,7 +306,7 @@ local fail_count = 0
fail_count = fail_count + iterate_all_items(all_pgs, true)
fail_count = fail_count + iterate_all_items(all_tcs, false)
if fail_count > 0 then
fetch_buffer_pool_size_from_appldb()
fetch_buffer_pool_size_from_appldb(shp_enabled)
return result
end

Expand All @@ -305,7 +316,7 @@ local all_egress_profile_lists = redis.call('KEYS', 'BUFFER_PORT_EGRESS_PROFILE_
fail_count = fail_count + iterate_profile_list(all_ingress_profile_lists)
fail_count = fail_count + iterate_profile_list(all_egress_profile_lists)
if fail_count > 0 then
fetch_buffer_pool_size_from_appldb()
fetch_buffer_pool_size_from_appldb(shp_enabled)
return result
end

Expand Down
35 changes: 17 additions & 18 deletions cfgmgr/buffermgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -549,24 +549,23 @@ void BufferMgr::doTask(Consumer &consumer)
task_status = doSpeedUpdateTask(port);
}
}

switch (task_status)
{
case task_process_status::task_failed:
SWSS_LOG_ERROR("Failed to process table update");
return;
case task_process_status::task_need_retry:
SWSS_LOG_INFO("Unable to process table update. Will retry...");
++it;
break;
case task_process_status::task_invalid_entry:
SWSS_LOG_ERROR("Failed to process invalid entry, drop it");
it = consumer.m_toSync.erase(it);
break;
default:
it = consumer.m_toSync.erase(it);
break;
}
}
switch (task_status)
{
case task_process_status::task_failed:
SWSS_LOG_ERROR("Failed to process table update");
return;
case task_process_status::task_need_retry:
SWSS_LOG_INFO("Unable to process table update. Will retry...");
++it;
break;
case task_process_status::task_invalid_entry:
SWSS_LOG_ERROR("Failed to process invalid entry, drop it");
it = consumer.m_toSync.erase(it);
break;
default:
it = consumer.m_toSync.erase(it);
break;
}
}
}
10 changes: 6 additions & 4 deletions cfgmgr/coppmgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,11 @@ static set<string> g_copp_init_set;

void CoppMgr::parseInitFile(void)
{
std::ifstream ifs(COPP_INIT_FILE);
std::ifstream ifs(m_coppCfgfile);

if (ifs.fail())
{
SWSS_LOG_ERROR("COPP init file %s not found", COPP_INIT_FILE);
SWSS_LOG_ERROR("COPP init file %s not found", m_coppCfgfile.c_str());
return;
}
json j = json::parse(ifs);
Expand Down Expand Up @@ -293,15 +294,16 @@ bool CoppMgr::isDupEntry(const std::string &key, std::vector<FieldValueTuple> &f
return true;
}

CoppMgr::CoppMgr(DBConnector *cfgDb, DBConnector *appDb, DBConnector *stateDb, const vector<string> &tableNames) :
CoppMgr::CoppMgr(DBConnector *cfgDb, DBConnector *appDb, DBConnector *stateDb, const vector<string> &tableNames, const string copp_init_file) :
Orch(cfgDb, tableNames),
m_cfgCoppTrapTable(cfgDb, CFG_COPP_TRAP_TABLE_NAME),
m_cfgCoppGroupTable(cfgDb, CFG_COPP_GROUP_TABLE_NAME),
m_cfgFeatureTable(cfgDb, CFG_FEATURE_TABLE_NAME),
m_appCoppTable(appDb, APP_COPP_TABLE_NAME),
m_stateCoppTrapTable(stateDb, STATE_COPP_TRAP_TABLE_NAME),
m_stateCoppGroupTable(stateDb, STATE_COPP_GROUP_TABLE_NAME),
m_coppTable(appDb, APP_COPP_TABLE_NAME)
m_coppTable(appDb, APP_COPP_TABLE_NAME),
m_coppCfgfile(copp_init_file)
{
SWSS_LOG_ENTER();
parseInitFile();
Expand Down
3 changes: 2 additions & 1 deletion cfgmgr/coppmgr.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class CoppMgr : public Orch
{
public:
CoppMgr(DBConnector *cfgDb, DBConnector *appDb, DBConnector *stateDb,
const std::vector<std::string> &tableNames);
const std::vector<std::string> &tableNames, const std::string copp_init_file = COPP_INIT_FILE);

using Orch::doTask;
private:
Expand All @@ -75,6 +75,7 @@ class CoppMgr : public Orch
CoppCfg m_coppGroupInitCfg;
CoppCfg m_coppTrapInitCfg;
CoppCfg m_featuresCfgTable;
std::string m_coppCfgfile;


void doTask(Consumer &consumer);
Expand Down
4 changes: 2 additions & 2 deletions cfgmgr/fabricmgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,12 @@ bool FabricMgr::writeConfigToAppDb(const std::string &key, const std::string &fi
if (key == "FABRIC_MONITOR_DATA")
{
m_appFabricMonitorTable.set(key, fvs);
SWSS_LOG_NOTICE("Write FABRIC_MONITOR:%s %s to %s", key.c_str(), field.c_str(), value.c_str());
SWSS_LOG_INFO("Write FABRIC_MONITOR:%s %s to %s", key.c_str(), field.c_str(), value.c_str());
}
else
{
m_appFabricPortTable.set(key, fvs);
SWSS_LOG_NOTICE("Write FABRIC_PORT:%s %s to %s", key.c_str(), field.c_str(), value.c_str());
SWSS_LOG_INFO("Write FABRIC_PORT:%s %s to %s", key.c_str(), field.c_str(), value.c_str());
}

return true;
Expand Down
2 changes: 1 addition & 1 deletion cfgmgr/fabricmgr.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class FabricMgr : public Orch
Table m_cfgFabricMonitorTable;
Table m_cfgFabricPortTable;
Table m_appFabricMonitorTable;
Table m_appFabricPortTable;
ProducerStateTable m_appFabricPortTable;

void doTask(Consumer &consumer);
bool writeConfigToAppDb(const std::string &alias, const std::string &field, const std::string &value);
Expand Down
Loading
Loading