[Hw PFCWD feature] Skeleton hw pfcwd#4403
Conversation
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
28da074 to
dd3fc1c
Compare
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
dd3fc1c to
d1e15c4
Compare
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
d1e15c4 to
4c5ce7a
Compare
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
4c5ce7a to
9d92949
Compare
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
9d92949 to
cfbfb45
Compare
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Signed-off-by: Abhishek <abhishek@nexthop.ai>
… functions. Signed-off-by: Abhishek <abhishek@nexthop.ai>
Signed-off-by: Abhishek <abhishek@nexthop.ai>
cfbfb45 to
03e418b
Compare
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
@abhishek-nexthop please help resolve conflicts |
There was a problem hiding this comment.
Pull request overview
This PR introduces an initial framework for hardware-based PFC watchdog (PFCWD) support in orchagent. It refactors existing PFCWD logic into a new PfcWdBaseOrch, moves the software watchdog implementation into PfcWdSwOrch, adds a skeleton PfcWdHwOrch, and wires runtime SKU detection to select HW vs SW watchdog at startup.
Changes:
- Refactor PFC watchdog common logic into
PfcWdBaseOrchand move software watchdog into newpfcwdsworch.*files. - Add
PfcWdHwOrchskeleton and build plumbing (Makefiles, includes) for HW watchdog compilation. - Add HWSKU read + regex-based SKU support check in
SwitchOrch, and select HW vs SW watchdog inOrchDaemon::init().
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/mock_tests/mock_orchagent_main.h | Includes SW PFCWD header for mock test builds. |
| tests/mock_tests/Makefile.am | Adds new PFCWD SW/HW source files to mock test build. |
| orchagent/switchorch.h | Exposes HWSKU getter and HW PFCWD SKU support query. |
| orchagent/switchorch.cpp | Implements HWSKU read from CONFIG_DB and SKU regex match helper. |
| orchagent/pfcwdsworch.h | Introduces PfcWdSwOrch (software watchdog) as a separate class. |
| orchagent/pfcwdsworch.cpp | Contains the migrated software watchdog implementation. |
| orchagent/pfcwdorch.h | Introduces PfcWdBaseOrch to host shared PFCWD logic. |
| orchagent/pfcwdorch.cpp | Implements the new base class and moves shared helpers into it. |
| orchagent/pfcwdhworch.h | Adds HW PFCWD orchestrator class declaration (skeleton). |
| orchagent/pfcwdhworch.cpp | Adds HW PFCWD orchestrator stub implementation (TODOs). |
| orchagent/orchdaemon.h | Wires in new SW/HW PFCWD headers for orchagent build. |
| orchagent/orchdaemon.cpp | Chooses HW vs SW watchdog based on SKU + DLR INIT enablement. |
| orchagent/Makefile.am | Adds new SW/HW PFCWD source files to orchagent build. |
Comments suppressed due to low confidence (1)
orchagent/orchdaemon.h:35
- Both pfcwdorch.h and countercheckorch.h define PFC_WD_TC_MAX. Since orchdaemon.h includes both, this can trigger a macro redefinition warning (the build uses -Werror/-Wextra) and break the build depending on compiler settings. Consider consolidating the constant in one header; as a minimal mitigation here, undefine the macro before including countercheckorch.h.
#include "pfcwdorch.h"
#include "pfcwdsworch.h"
#include "pfcwdhworch.h"
#include "switchorch.h"
#include "crmorch.h"
#include "vrforch.h"
#include "vxlanorch.h"
#include "vnetorch.h"
#include "countercheckorch.h"
| task_process_status PfcWdHwOrch::createEntry(const string& key, const vector<FieldValueTuple>& data) | ||
| { | ||
| SWSS_LOG_ENTER(); | ||
| // TODO: Implementation | ||
| return task_process_status::task_success; | ||
| } |
| task_process_status PfcWdHwOrch::deleteEntry(const string& key) | ||
| { | ||
| SWSS_LOG_ENTER(); | ||
| // TODO: Implementation | ||
| return task_process_status::task_success; | ||
| } |
| // TODO: Implementation | ||
| PfcWdQueueStats stats; | ||
| memset(&stats, 0, sizeof(PfcWdQueueStats)); | ||
| return stats; |
| // Check if SKU supports PFC hardware watchdog | ||
| bool pfcHwWdSupportedSku = gSwitchOrch->isHwPfcWdSupportedSku(); | ||
|
|
||
| if (pfcHwWdSupportedSku) | ||
| { | ||
| SWSS_LOG_NOTICE("HWSKU '%s' supports PFC hardware watchdog", gSwitchOrch->getHwSku().c_str()); | ||
| } | ||
| else | ||
| { | ||
| SWSS_LOG_NOTICE("HWSKU '%s' does not support PFC hardware watchdog", gSwitchOrch->getHwSku().c_str()); | ||
| } | ||
|
|
||
| if (pfcDlrInit && pfcHwWdSupportedSku) | ||
| { | ||
| SWSS_LOG_NOTICE("Starting hardware-based pfc watchdog"); | ||
| m_orchList.push_back(new PfcWdHwOrch( | ||
| m_configDb, | ||
| pfc_wd_tables, | ||
| portStatIds, | ||
| queueStatIds, | ||
| queueAttrIds)); | ||
| } |
| // Read HWSKU from CONFIG_DB | ||
| DBConnector configDb("CONFIG_DB", 0); | ||
| Table deviceMetadataTable(&configDb, CFG_DEVICE_METADATA_TABLE_NAME); | ||
| deviceMetadataTable.hget("localhost", "hwsku", m_hwSku); | ||
| SWSS_LOG_NOTICE("HWSKU: %s", m_hwSku.c_str()); | ||
|
|
|
What is this PR about when there are other hw pfcwd PRs.? Folks, if this is experimental, please keep this as "draft". |
Signed-off-by: Abhishek <abhishek@nexthop.ai>
Signed-off-by: Abhishek <abhishek@nexthop.ai>
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
@prsunny We have 3 PRs for pfcwd h/w orch.
|
|
Hi, there are workflow run(s) waiting for approval, you may be first-time contributor. I will notify maintainers to help approve once PR is approved. Thanks! ---Powered by SONiC BuildBot
|
|
@abhishek-nexthop please take care of copilot comments. once depending PRs are in. we can do further review. |
What I did
Added hardware-based PFC watchdog support with SKU-specific enablement. Created PfcWdHwOrch skeleton class that inherits from PfcWdBaseOrch, refactored shared functionality into the base class, and implemented runtime SKU detection to automatically choose between hardware and software watchdog implementations.
Why I did it
Modern switch ASICs support hardware-based PFC deadlock detection/recovery which is more efficient than software-based approaches. Need infrastructure to:
• Enable hardware watchdog only on supported SKUs
• Share common code between software and hardware implementations
• Gracefully fall back to software watchdog on unsupported platforms
How I verified it
• Check logs: grep "PFC hardware watchdog" /var/log/syslog
• Supported SKU shows: "HWSKU 'nh-4010' supports PFC hardware watchdog"
• Unsupported SKU shows: "does not support PFC hardware watchdog"