Skip to content

Commit

Permalink
Update pool sizes during initialization from timer only (sonic-net#1708)
Browse files Browse the repository at this point in the history
- What I did
This is a supplement of sonic-net#1685. In that PR, most of the cases in which the buffer pool updated during initialization have been avoided but there are still some rare cases not covered. Eg., it will try to recalculate the pool size because the lossless PSs are removed if one port is admin down.

- Why I did it
Make sure that the the buffer pools will be updated only once during initialization.

- How I verified it
Run regression and manual test

Signed-off-by: Stephen Sun <[email protected]>
  • Loading branch information
stephenxs authored and raphaelt-nvidia committed Oct 5, 2021
1 parent 582bf00 commit 28282ea
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
10 changes: 8 additions & 2 deletions cfgmgr/buffermgrdyn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -455,10 +455,16 @@ void BufferMgrDynamic::recalculateSharedBufferPool()
}
}

void BufferMgrDynamic::checkSharedBufferPoolSize()
void BufferMgrDynamic::checkSharedBufferPoolSize(bool force_update_during_initialization = false)
{
// PortInitDone indicates all steps of port initialization has been done
// Only after that does the buffer pool size update starts
if (!m_portInitDone && !force_update_during_initialization)
{
SWSS_LOG_INFO("Skip buffer pool updating during initialization");
return;
}

if (!m_portInitDone)
{
vector<FieldValueTuple> values;
Expand Down Expand Up @@ -2060,5 +2066,5 @@ void BufferMgrDynamic::doTask(Consumer &consumer)

void BufferMgrDynamic::doTask(SelectableTimer &timer)
{
checkSharedBufferPoolSize();
checkSharedBufferPoolSize(true);
}
2 changes: 1 addition & 1 deletion cfgmgr/buffermgrdyn.h
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ class BufferMgrDynamic : public Orch

// Meta flows
void calculateHeadroomSize(buffer_profile_t &headroom);
void checkSharedBufferPoolSize();
void checkSharedBufferPoolSize(bool force_update_during_initialization);
void recalculateSharedBufferPool();
task_process_status allocateProfile(const std::string &speed, const std::string &cable, const std::string &mtu, const std::string &threshold, const std::string &gearbox_model, std::string &profile_name);
void releaseProfile(const std::string &profile_name);
Expand Down

0 comments on commit 28282ea

Please sign in to comment.