Skip to content

Commit

Permalink
[buffers] Fixed orchagent crash issue
Browse files Browse the repository at this point in the history
Signed-off-by: vadymhlushko-mlnx <vadymh@nvidia.com>
  • Loading branch information
vadymhlushko-mlnx committed Oct 20, 2023
1 parent 1ed0352 commit 63beb21
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions orchagent/portsorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6309,7 +6309,7 @@ void PortsOrch::generateQueueMap(map<string, FlexCounterQueueStates> queuesState
{
auto maxQueueNumber = getNumberOfPortSupportedQueueCounters(it.second.m_alias);
FlexCounterQueueStates flexCounterQueueState(maxQueueNumber);
if (isCreateAllQueues)
if (isCreateAllQueues && maxQueueNumber)
{
flexCounterQueueState.enableQueueCounters(0, maxQueueNumber - 1);
}
Expand Down Expand Up @@ -6447,7 +6447,7 @@ void PortsOrch::addQueueFlexCounters(map<string, FlexCounterQueueStates> queuesS
{
auto maxQueueNumber = getNumberOfPortSupportedQueueCounters(it.second.m_alias);
FlexCounterQueueStates flexCounterQueueState(maxQueueNumber);
if (isCreateAllQueues)
if (isCreateAllQueues && maxQueueNumber)
{
flexCounterQueueState.enableQueueCounters(0, maxQueueNumber - 1);
}
Expand Down Expand Up @@ -6524,7 +6524,7 @@ void PortsOrch::addQueueWatermarkFlexCounters(map<string, FlexCounterQueueStates
{
auto maxQueueNumber = getNumberOfPortSupportedQueueCounters(it.second.m_alias);
FlexCounterQueueStates flexCounterQueueState(maxQueueNumber);
if (isCreateAllQueues)
if (isCreateAllQueues && maxQueueNumber)
{
flexCounterQueueState.enableQueueCounters(0, maxQueueNumber - 1);
}
Expand Down Expand Up @@ -6707,7 +6707,7 @@ void PortsOrch::generatePriorityGroupMap(map<string, FlexCounterPgStates> pgsSta
{
auto maxPgNumber = getNumberOfPortSupportedPgCounters(it.second.m_alias);
FlexCounterPgStates flexCounterPgState(maxPgNumber);
if (isCreateAllPgs)
if (isCreateAllPgs && maxPgNumber)
{
flexCounterPgState.enablePgCounters(0, maxPgNumber - 1);
}
Expand Down Expand Up @@ -6823,7 +6823,7 @@ void PortsOrch::addPriorityGroupFlexCounters(map<string, FlexCounterPgStates> pg
{
auto maxPgNumber = getNumberOfPortSupportedPgCounters(it.second.m_alias);
FlexCounterPgStates flexCounterPgState(maxPgNumber);
if (isCreateAllPgs)
if (isCreateAllPgs && maxPgNumber)
{
flexCounterPgState.enablePgCounters(0, maxPgNumber - 1);
}
Expand Down Expand Up @@ -6892,7 +6892,7 @@ void PortsOrch::addPriorityGroupWatermarkFlexCounters(map<string, FlexCounterPgS
{
auto maxPgNumber = getNumberOfPortSupportedPgCounters(it.second.m_alias);
FlexCounterPgStates flexCounterPgState(maxPgNumber);
if (isCreateAllPgs)
if (isCreateAllPgs && maxPgNumber)
{
flexCounterPgState.enablePgCounters(0, maxPgNumber - 1);
}
Expand Down

0 comments on commit 63beb21

Please sign in to comment.