Skip to content

Commit dd13ec8

Browse files
committed
Fix yet an other error and remove a redundant variable
Signed-off-by: Stephen Sun <[email protected]>
1 parent 751ff99 commit dd13ec8

File tree

2 files changed

+4
-17
lines changed

2 files changed

+4
-17
lines changed

cfgmgr/buffermgrdyn.cpp

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -343,25 +343,15 @@ void BufferMgrDynamic::recalculateSharedBufferPool()
343343

344344
auto &poolSizeStr = pairs[1];
345345
unsigned long poolSizeNum = atol(poolSizeStr.c_str());
346-
if (m_mmuSizeNumber > 0 && m_mmuSizeNumber >= poolSizeNum)
347-
{
348-
pool.total_size = poolSizeStr;
349-
}
350-
else
346+
if (m_mmuSizeNumber > 0 && m_mmuSizeNumber < poolSizeNum)
351347
{
352348
SWSS_LOG_ERROR("Buffer pool %s: Invalid size %s, exceeding the mmu size %s",
353349
poolName.c_str(), poolSizeStr.c_str(), m_mmuSize.c_str());
350+
continue;
354351
}
355352

356-
if (pool.initialized)
357-
{
358-
updateBufferPoolToDb(poolName, pool);
359-
}
360-
else
361-
{
362-
updateBufferPoolToDb(poolName, pool);
363-
pool.initialized = true;
364-
}
353+
pool.total_size = poolSizeStr;
354+
updateBufferPoolToDb(poolName, pool);
365355

366356
SWSS_LOG_NOTICE("Buffer pool %s had been updated with new size [%s]", poolName.c_str(), pool.total_size.c_str());
367357
}
@@ -1170,7 +1160,6 @@ task_process_status BufferMgrDynamic::handleBufferPoolTable(Consumer &consumer)
11701160
// 2. Record the table in the internal cache m_bufferPoolLookup
11711161
buffer_pool_t &bufferPool = m_bufferPoolLookup[pool];
11721162

1173-
bufferPool.initialized = false;
11741163
bufferPool.dynamic_size = true;
11751164
for (auto i = kfvFieldsValues(tuple).begin(); i != kfvFieldsValues(tuple).end(); i++)
11761165
{
@@ -1199,7 +1188,6 @@ task_process_status BufferMgrDynamic::handleBufferPoolTable(Consumer &consumer)
11991188
}
12001189
if (!bufferPool.dynamic_size)
12011190
{
1202-
bufferPool.initialized = true;
12031191
m_applBufferPoolTable.set(pool, fvVector);
12041192
m_stateBufferPoolTable.set(pool, fvVector);
12051193
}

cfgmgr/buffermgrdyn.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ namespace swss {
1919
typedef struct {
2020
bool ingress;
2121
bool dynamic_size;
22-
bool initialized;
2322
std::string total_size;
2423
std::string mode;
2524
std::string xoff;

0 commit comments

Comments
 (0)