Skip to content

Commit 58ada9e

Browse files
committed
Check cable len only
No need check profile name, as it might not use lossless directly, in future or in some specific scenario. Remove duplicate check. Signed-off-by: Jianyue Wu <jianyuew@nvidia.com>
1 parent 61afaa6 commit 58ada9e

File tree

1 file changed

+5
-17
lines changed

1 file changed

+5
-17
lines changed

cfgmgr/buffermgrdyn.cpp

+5-17
Original file line numberDiff line numberDiff line change
@@ -944,13 +944,6 @@ void BufferMgrDynamic::updateBufferObjectListToDb(const string &key, const strin
944944
// We have to check the headroom ahead of applying them
945945
task_process_status BufferMgrDynamic::allocateProfile(const string &speed, const string &cable_len, const string &mtu, const string &threshold, const string &gearbox_model, long lane_count, string &profile_name)
946946
{
947-
bool is_lossless = (profile_name.find("lossless") != string::npos);
948-
if (cable_len == "0m" && is_lossless)
949-
{
950-
SWSS_LOG_NOTICE("Not creating lossless profile when cable length is set to %s", cable_len.c_str());
951-
return task_process_status::task_success;
952-
}
953-
954947
// Create record in BUFFER_PROFILE table
955948

956949
SWSS_LOG_INFO("Allocating new BUFFER_PROFILE %s", profile_name.c_str());
@@ -1470,22 +1463,17 @@ task_process_status BufferMgrDynamic::refreshPgsForPort(const string &port, cons
14701463
}
14711464

14721465
// If cable len is 0m, remove lossless PG, keep lossy PG.
1473-
bool old_profile_is_lossless = (oldProfile.find("lossless") != string::npos);
1474-
if (cable_length == "0m" && portPg.lossless && old_profile_is_lossless)
1466+
if (cable_length == "0m" && portPg.lossless)
14751467
{
14761468
if (oldProfile.empty())
14771469
{
1478-
SWSS_LOG_WARN("No lossless profile found for port %s when cable length is set to '0m'.", port.c_str());
1470+
SWSS_LOG_NOTICE("No lossless profile found for port %s when cable length is set to '0m'.", port.c_str());
14791471
continue;
14801472
}
14811473
updateBufferObjectToDb(key, oldProfile, false);
1482-
SWSS_LOG_NOTICE("All profiles for port %s have been removed due to cable length being set to '0m'", port.c_str());
1483-
1484-
if (!oldProfile.empty())
1485-
{
1486-
profilesToBeReleased.insert(oldProfile);
1487-
m_bufferProfileLookup[oldProfile].port_pgs.erase(key);
1488-
}
1474+
profilesToBeReleased.insert(oldProfile);
1475+
m_bufferProfileLookup[oldProfile].port_pgs.erase(key);
1476+
SWSS_LOG_NOTICE("All lossless profiles for port %s will be removed due to cable length being set to '0m'", port.c_str());
14891477
continue;
14901478
}
14911479

0 commit comments

Comments
 (0)