-
Notifications
You must be signed in to change notification settings - Fork 648
[DPB]: Fix stale queue counter maps in COUNTERS_DB after port breakout #3982
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
base: master
Are you sure you want to change the base?
Changes from all commits
e4a615f
4120053
d8f887c
11cd188
d48a81f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4015,6 +4015,40 @@ void PortsOrch::registerPort(Port &p) | |
| wred_port_stat_manager.setCounterIdList(p.m_port_id, CounterType::PORT, wred_port_stats); | ||
| } | ||
|
|
||
| // If queue-related flex counters are already enabled, generate queue maps | ||
| // for the newly added port so that usecases like dynamic port breakout works. | ||
| bool queueFcEnabled = flex_counters_orch->getQueueCountersState() || | ||
| flex_counters_orch->getQueueWatermarkCountersState() || | ||
| flex_counters_orch->getWredQueueCountersState(); | ||
| if (queueFcEnabled && !p.m_queue_ids.empty()) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @rminnikanti could you please check the DPB sonic-mgmt tests? If this is not covered, could you please add them?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @kperumalbfn I don't see DPB test component in PTF. As far as I understand, DPB testing in sonic-mgmt can be performed on ports that are not part of the topology. The mock_tests included in this PR verifies the regeneration of the NAME_MAP's. I’ve also validated this behavior on a device and shared the redis-dump output in the PR description for reference. |
||
| { | ||
| auto queuesStateVector = flex_counters_orch->getQueueConfigurations(); | ||
|
|
||
| auto maxQueueNumber = getNumberOfPortSupportedQueueCounters(p.m_alias); | ||
| FlexCounterQueueStates flexCounterQueueState(maxQueueNumber); | ||
|
|
||
| if (queuesStateVector.count(p.m_alias)) | ||
| { | ||
| flexCounterQueueState = queuesStateVector.at(p.m_alias); | ||
| } | ||
| else if (queuesStateVector.count(createAllAvailableBuffersStr)) | ||
| { | ||
| if (maxQueueNumber > 0) | ||
| { | ||
| flexCounterQueueState.enableQueueCounters(0, maxQueueNumber - 1); | ||
| } | ||
| } | ||
| else | ||
| { | ||
| if (p.m_host_tx_queue_configured && p.m_host_tx_queue <= maxQueueNumber) | ||
| { | ||
| flexCounterQueueState.enableQueueCounter(p.m_host_tx_queue); | ||
| } | ||
| } | ||
|
|
||
| generateQueueMapPerPort(p, flexCounterQueueState, false); | ||
| } | ||
|
|
||
| PortUpdate update = { p, true }; | ||
| notify(SUBJECT_TYPE_PORT_CHANGE, static_cast<void *>(&update)); | ||
|
|
||
|
|
@@ -4038,9 +4072,12 @@ void PortsOrch::deInitPort(string alias, sai_object_id_t port_id) | |
| return; | ||
| } | ||
|
|
||
| if (p.m_host_tx_queue_configured && p.m_queue_ids.size() > p.m_host_tx_queue) | ||
| if (!p.m_queue_ids.empty()) | ||
| { | ||
| removePortBufferQueueCounters(p, to_string(p.m_host_tx_queue), false); | ||
| auto skip_host_tx_queue = p.m_host_tx_queue_configured && (p.m_queue_ids.size() > p.m_host_tx_queue); | ||
| // Remove all queue counters and mappings for this port to avoid stale entries | ||
| std::string range = "0-" + to_string(p.m_queue_ids.size() - 1); | ||
| removePortBufferQueueCounters(p, range, skip_host_tx_queue); | ||
| } | ||
|
|
||
| /* remove port from flex_counter_table for updating counters */ | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Pterosaur can you please review?