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

align watermark flow with port configuration #2

Closed
wants to merge 1 commit into from

Conversation

dbarashinvd
Copy link
Owner

What I did
Align watermark flow with port configuration
correct the queue, watermark and pg-drop counterpoll functionality according to cli commands

Why I did it
the flow before this commit was wrong, when watermark counterpoll was enabled, stats wasn't created in FLEX_COUNTERS_DB
and COUNTERS_DB unless enabling queue counterpoll as well.
in the same way when pg-drop counterpoll was enabled stats weren't added until watermark was enabled.
This is due to the wrong flow where queue and pg maps were generated only when queue or watermark (pg-watermark)
key was detected in flexcountersorch.cpp

How I verified it
manual testing
VS test (updated to reflect current flow) - before this commit only queue was tested

Details if related

@dbarashinvd dbarashinvd force-pushed the dbarashi_align_watermark branch 3 times, most recently from ae96260 to 4191a64 Compare October 25, 2022 12:02
@dbarashinvd dbarashinvd self-assigned this Oct 25, 2022
Copy link

@stephenxs stephenxs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The main logic looks good to me but please rebase it on the latest master.
there is significant change in this part.

orchagent/portsorch.cpp Outdated Show resolved Hide resolved
@dbarashinvd
Copy link
Owner Author

I see it's only 2 commits behind.
you mean this commit:
[counters] Improve performance by polling only configured ports buffers
that was reverted by Prince in the past and now reverted again 3 days ago (i.e. merged the original one) ?

@stephenxs
Copy link

I see it's only 2 commits behind.
you mean this commit:
[counters] Improve performance by polling only configured ports buffers
that was reverted by Prince in the past and now reverted again 3 days ago (i.e. merged the original one) ?

Yes. This is a significant change in this part. Originally, counters were created for all queues and PGs. Now, they are created for queues and PGs with buffer configured only

@dbarashinvd dbarashinvd force-pushed the dbarashi_align_watermark branch 2 times, most recently from 425bca2 to 8579c62 Compare November 6, 2022 12:28
orchagent/bufferorch.cpp Outdated Show resolved Hide resolved
@@ -250,14 +266,24 @@ bool FlexCounterOrch::getPortBufferDropCountersState() const
return m_port_buffer_drop_counter_enabled;
}

bool FlexCounterOrch::getPgWatermarkCountersState() const
bool FlexCounterOrch::getQueueCountersState() const

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better not to change position of the functions that are not modified.

{
string queueType;
uint8_t queueRealIndex = 0;
if (getQueueTypeAndIndex(port.m_queue_ids[queueIndex], queueType, queueRealIndex))

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we check (!queuesState.isQueueCounterEnabled(queueRealIndex)) first and then (getQueueTypeAndIndex(port.m_queue_ids[queueIndex], queueType, queueRealIndex))?
AFAIU, the former is light and the latter is a bit heavier. If the former returns false, we do not need to call the latter.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how can this be done ?
we first get the queueRealIIndex using the getQueueTypeAndIndex and then use in for queuesState.isQueueCounterEnabled(queueRealIndex).
this is also the implementation of the PR sonic-net#2473 [counters] Improve performance by polling only configured ports buffer queue/pg counters that uses it in generateQueueMapPerPort function.
can I use the queueIndex rather than the queueRealIndex ? if so I can ditch the whole getQueueTypeAndIndex if statement.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok. You are correct. I didn’t realize it depends on the output argument of the former function call.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants