[Hw PFCWD feature] Refactor existing pfcwd code#4358
Conversation
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
98525fa to
372e521
Compare
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
@radha-danda |
|
/azpw run |
|
/AzurePipelines run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
/azwp retry |
|
/azpw retry |
|
Retrying failed(or canceled) jobs... |
|
Build not found. Please close and reopen the PR or rebase your branch to trigger a new build. |
2aceb51 to
8d08bfa
Compare
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
/azp run |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
@vmittal-msft Latest commit fixes the comments. Kindly have a look. Thanks! |
vmittal-msft
left a comment
There was a problem hiding this comment.
Reviewed this as a pure move-refactor (splitting the templated PfcWdOrch into a non-template base PfcWdBaseOrch in pfcwdorch.cpp/h and moving the software implementation PfcWdSwOrch into new pfcwdsworch.cpp/h). Verified faithfulness at the line level, not just by reading the diff.
LGTM — no behavioral changes, structurally sound.
What I verified
- Function inventory — every function from the original
pfcwdorch.cppmaps to a location in the new files; nothing dropped or duplicated.counterIdsToStrmoved to the base (now an inline static template),report_pfc_stormmoved to the base with a field-based signature, andreport_pfc_restored/getLosslessTcsForPortwere extracted from previously-inline code. - Line-level equivalence — after normalizing class names and doing a set-diff of old vs. new (base + sw combined), the only differences are the expected transformations. All other function bodies are byte-identical (indentation preserved). The
report_pfc_stormevent params still map 1:1 (entry->first→queueId,entry->second.portId→portId,entry->second.index→queueIndex,entry->second.portAlias→portAlias), andreport_pfc_restoredpreserves the exact restore log. - Macros —
PFC_WD_TC_MAXnow has a single definition inorch.h(removed fromcountercheckorch.h, which still includesorch.h); config/timer macros moved topfcwdorch.h; SW-only macros correctly live inpfcwdsworch.cpp. No duplicate/missing definitions. - Templates & linkage — all four explicit
PfcWdSwOrch<...>instantiations are preserved at the tail ofpfcwdsworch.cpp. The base.cppinclude set is byte-identical to the original, so transitive types (SwitchOrch, handlers, flex-counter manager) resolve as before. No danglingPfcWdOrch/PfcDlrPacketActionreferences anywhere. - Tests —
mock_orchagent_main.hadds#include "pfcwdsworch.h"inside both the#define private publicand#define protected publicblocks, soportsorch_ut/flexcounter_utaccess tom_pfcwd_ports,m_entryMap, andm_platformstill works;gPfcwdOrchremains typed as the still-templatedPfcWdSwOrch<...>*. Makefiles updated. - Nice cleanup: moving
packet_action_mapout of the header intopfcwdorch.cppremoves an unused internal-linkage copy from every TU that included the header.
Minor nits (non-blocking)
PFC_WD_POLL_TIMEOUT(pfcwdsworch.cpp) is defined but unused. It was dead in the original too, but since one of the commits is "remove unused locals and dead code," it would be consistent to drop it here as well.- Tiny log-noise change: if
getPortPfcWatchdogStatusfails inside the newgetLosslessTcsForPort,registerInWdDbnow additionally logsNOTICE "No lossless TC found..."after the helper'sERROR. The original returned immediately after the error without that NOTICE. Purely cosmetic. getLosslessTcsForPortisn't reused in the two similarpfcMaskloops inenableBigRedSwitchMode— acceptable since their logic differs slightly, just noting it for a potential follow-up.
@abhishek-nexthop @pinky-nexthop anything we can handle here. Also, please add tests for coverage shortage |
@vmittal-msft We have requested broadcom for a knob to disable h/w recovery mode. Currently s/w can be selected using |
Signed-off-by: Abhishek <abhishek@nexthop.ai>
… functions. Signed-off-by: Abhishek <abhishek@nexthop.ai>
53e1013 to
ac1c238
Compare
|
/azp run |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
|
/azp run Azure.sonic-swss |
|
Commenter does not have sufficient privileges for PR 4358 in repo sonic-net/sonic-swss |
Remove unused locals and dead code, consolidate shared macros in pfcwdorch.h with PFC_WD_TC_MAX in orch.h, move packet_action_map to pfcwdorch.cpp and rename PfcDlrPacketAction to m_pfcDlrPacketAction. Signed-off-by: Abhishek <abhishek@nexthop.ai>
ac1c238 to
54ba349
Compare
|
/azp run |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
|
/azpw retry |
|
Retrying failed(or canceled) jobs... |
|
Retrying failed(or canceled) stages in build 1173721: ✅Stage TestAsan:
✅Stage Test:
|
|
/azp run |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
41e8e11 to
0c40334
Compare
|
/azp run |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
Cycle drop, alert and forward actions in test_pfcwd_software_single_queue and assert the APPL_DB PFC_WD_TABLE_INSTORM mirroring per storm cycle. Add a BIG_RED_SWITCH invalid-value case and a no-lossless-TC port case. Signed-off-by: Abhishek <abhishek@nexthop.ai>
0c40334 to
d96f5b2
Compare
|
/azp run |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
What I did
Why I did it
Refactor PFC Watchdog code to improve maintainability by splitting base class and software implementation in different file. Base file now can be extended for hardware based implementation.
How I verified it
Build the orchagent and ran existing pfc test to check any change in behavior.
HLD: 2159