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

[pfcwd] Observe pfc enable bits change #1697

Open
wants to merge 111 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
111 commits
Select commit Hold shift + click to select a range
76add4b
Disable last tc
wendani Jan 13, 2021
099582e
Adjust log level
wendani Jan 18, 2021
41a9d4e
Introduce pfc bit mask status to track the pfc bit mask status in asic
wendani Jan 21, 2021
fb4fef4
Introduce private member function bool setPortPfcStatus(const Port &p…
wendani Jan 21, 2021
c2ba1e0
getPortPfc to get pfc status and cfg bit masks
wendani Jan 21, 2021
5b1e38c
Overload setPortPfcStatus
wendani Jan 21, 2021
908166e
Fix compile error
wendani Jan 21, 2021
b6e06d0
Fix typo
wendani Jan 21, 2021
d7fb1bf
Fix typo
wendani Jan 21, 2021
ddd480f
Set pfc bit in lossy handler destruction only if the corresponding bit
wendani Jan 23, 2021
53b2043
Update comment
wendani Jan 23, 2021
6c96bb6
Update code format and comment
wendani Jan 24, 2021
90cd76f
Merge remote-tracking branch 'origin/master' into pfc_bitmask
wendani Feb 4, 2021
60ade5d
Merge remote-tracking branch 'origin/master' into pfc_bitmask
wendani Feb 8, 2021
eb9f10a
Merge remote-tracking branch 'origin/master' into pfc_bitmask
wendani Feb 10, 2021
601b5d0
Introduce registerQueueInWdDb
wendani Jan 23, 2021
d529118
No change to original processing logic
wendani Feb 15, 2021
114d011
Update code format and add comment
wendani Jan 23, 2021
7169312
No change to original processing logic
wendani Feb 15, 2021
70f545c
Introduce unregisterQueueFromWdDb
wendani Jan 23, 2021
2d8d5c2
Add SWSS_LOG_ENTER() to newly defined member functions
wendani Jan 23, 2021
93f31f3
No change to original processing logic
wendani Feb 16, 2021
9a31710
Remove m_portCfgMap.erase(name)
wendani Jan 24, 2021
5de552a
Update comment and add log messages
wendani Jan 23, 2021
ed522f0
Remove debug symbols
wendani Feb 16, 2021
e910be7
Change to unordered_map
wendani Jan 23, 2021
caaa808
Add member function for port level db register & unregister
wendani Jan 23, 2021
1675791
Update comment
wendani Jan 23, 2021
a4a961d
Update code format
wendani Jan 23, 2021
da33ae9
Update comments
wendani Jan 23, 2021
b1f0d8b
Update comment
wendani Jan 24, 2021
ab153a1
Remove line
wendani Jan 24, 2021
bdd47af
Update comments
wendani Jan 24, 2021
a125fdc
Fix compile error
wendani Jan 24, 2021
eb46d98
Merge remote-tracking branch 'public/master' into pfc_bitmask
wendani Feb 16, 2021
d08fe01
Fix typo
wendani Feb 16, 2021
04b599e
Replace RedisClient with DBConnector
wendani Feb 16, 2021
6ba3131
Fix compile error
wendani Feb 16, 2021
20a5bca
Make QosOrch Subject
wendani Jan 21, 2021
14cff6a
Make PfcWdOrch observing QosOrch
wendani Jan 21, 2021
f84111b
Fix compile error
wendani Jan 21, 2021
47ca97d
Introduce PfcWdCfgEntry to track pfcwd config
wendani Jan 23, 2021
d4eb918
Return task_failed when failed to start PFC Watchdog on port
wendani Jan 23, 2021
cd5a7cd
Implement update non big red switch case
wendani Jan 23, 2021
4da4664
Introduce disableBigRedSwitchModeOnQueue
wendani Jan 24, 2021
e426ff9
Introduce enableBigRedSwitchModeOnQueue
wendani Jan 24, 2021
5f29e6b
Fix compile error
wendani Jan 24, 2021
69675f1
Implement update on red big switch case
wendani Jan 24, 2021
2b0cecd
Fix compile error
wendani Jan 24, 2021
1cc57f3
red big switch mode and port config co-exist
wendani Jan 24, 2021
4f0babc
Update comments
wendani Jan 24, 2021
90a636d
Add log message
wendani Jan 25, 2021
d73c808
Revert "No change to original processing logic"
wendani Feb 16, 2021
af13f1c
Correction
wendani Feb 16, 2021
0c58e8f
Do not create acl table group on ports
wendani Feb 16, 2021
e4e8343
Replace RedisClient with DBConnector
wendani Feb 16, 2021
8fa3842
Fix compile error
wendani Feb 16, 2021
a2c2527
Merge remote-tracking branch 'public/master' into pfc_bitmask
wendani Feb 17, 2021
6979e38
Merge remote-tracking branch 'public/master' into pfc_bitmask
wendani Feb 17, 2021
f609c95
Merge remote-tracking branch 'public/master' into pfc_bitmask
wendani Mar 12, 2021
cbcdc3d
Address comment: Revert log level
wendani Mar 12, 2021
3668328
Address comment: rename private function as setPortPfcStatus_
wendani Mar 12, 2021
095c2de
Address comment: rename m_pfc_bitmask_cfg to m_pfc_bitmask_usercfg,
wendani Mar 26, 2021
31e366b
Address comment: getPortPfc use reference
wendani Mar 26, 2021
19c5277
Address comment: getPortPfc use reference in pfcactionhandler
wendani Mar 26, 2021
625270c
Address comment: Address comment: getPortPfc use reference in pfcwdorch
wendani Mar 26, 2021
f548b2d
Address comment: getPortPfc use reference in setPortPfcAsym
wendani Mar 26, 2021
12e6c1f
Update comment
wendani Mar 27, 2021
df020b4
Restore log level
wendani Mar 27, 2021
47a8fad
Test case 1
wendani Mar 28, 2021
26bb587
Correct typo
wendani Mar 28, 2021
87f8dd0
Refactor
wendani Mar 28, 2021
50f60bf
Use getBitMaskStr
wendani Mar 28, 2021
d8d8dff
Test pfc enable bits clear
wendani Mar 28, 2021
6cf47b5
If pfc enable bits stay unchanged, sleep 2 seconds before check; Reve…
wendani Mar 28, 2021
f6d6e6d
brd test case
wendani Mar 28, 2021
e1bd125
Add comment
wendani Mar 28, 2021
ed11cac
Check fc cntr db removal of both queues
wendani Mar 30, 2021
8de9ac4
Rename variable
wendani Mar 30, 2021
92a0e35
Rename variable
wendani Mar 30, 2021
36d347b
Refactor
wendani Mar 30, 2021
7fc6079
Rename variable
wendani Mar 30, 2021
cbb2410
Merge remote-tracking branch 'public/master' into pfc_bitmask
wendani Mar 31, 2021
8d8c42e
Merge branch 'pfc_bitmask' into pfc_refactor
wendani Mar 31, 2021
fd66bee
Merge branch 'pfc_refactor' into pfcwd_observer
wendani Mar 31, 2021
6673a9c
Merge remote-tracking branch 'public/master' into pfc_bitmask
wendani Apr 2, 2021
c491f08
Merge remote-tracking branch 'public/master' into pfc_bitmask
wendani Apr 3, 2021
eb4d0f4
Merge branch 'pfc_bitmask' into pfc_refactor
wendani Apr 4, 2021
63b6ba2
Remove {port, queue} in-storm status when pfc wd config on port is re…
wendani Apr 4, 2021
7e59764
Remove {port, queue} in-storm status when big red switch mode is enabled
wendani Apr 4, 2021
d8b5e09
Update code formats
wendani Apr 4, 2021
46cdc5f
Merge branch 'pfcwd_appl' into pfc_refactor
wendani Apr 4, 2021
ba8bc04
Merge branch 'pfc_refactor' into pfcwd_observer
wendani Apr 4, 2021
7699df3
Update proc order
wendani Apr 4, 2021
c1e50e3
Update code formats
wendani Apr 5, 2021
116daf1
Update code formats
wendani Apr 5, 2021
3201b26
Merge branch 'pfcwd_appl' into pfc_refactor
wendani Apr 5, 2021
254d56c
Use create_entry in place of raw hset
wendani Apr 5, 2021
8248910
Update code formats
wendani Apr 5, 2021
e930ce4
Merge commit '8248910' into pfcwd_appl
wendani Apr 5, 2021
cedb134
Clear queue deadlock counters
wendani Apr 5, 2021
c68db83
Merge commit 'cedb134' into pfc_refactor
wendani Apr 5, 2021
44fcea0
Merge commit 'c68db83' into pfcwd_observer
wendani Apr 5, 2021
accff40
test update for embracing wd self adaptation
wendani Apr 5, 2021
e61cb5b
Change order
wendani Apr 6, 2021
0bc500e
Change order
wendani Apr 6, 2021
76acf04
test update for embracing wd self adaptation
wendani Apr 6, 2021
f92e736
Clear pfc enable bits
wendani Apr 6, 2021
2c51919
Clean up
wendani Apr 6, 2021
e725e6b
Update code format
wendani Apr 6, 2021
4ce1bce
Update log level
wendani Apr 6, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions orchagent/countercheckorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ void CounterCheckOrch::mcCounterCheck()
{
auto oid = i.first;
auto mcCounters = i.second;
uint8_t pfcMask = 0;
uint8_t dummy = 0;
uint8_t pfcMaskCfg = 0;

Port port;
if (!gPortsOrch->getPort(oid, port))
Expand All @@ -67,15 +68,15 @@ void CounterCheckOrch::mcCounterCheck()

auto newMcCounters = getQueueMcCounters(port);

if (!gPortsOrch->getPortPfc(port.m_port_id, &pfcMask))
if (!gPortsOrch->getPortPfc(port.m_port_id, dummy, pfcMaskCfg))
{
SWSS_LOG_ERROR("Failed to get PFC mask on port %s", port.m_alias.c_str());
continue;
}

for (size_t prio = 0; prio != mcCounters.size(); prio++)
{
bool isLossy = ((1 << prio) & pfcMask) == 0;
bool isLossy = ((1 << prio) & pfcMaskCfg) == 0;
if (newMcCounters[prio] == numeric_limits<uint64_t>::max())
{
SWSS_LOG_WARN("Could not retreive MC counters on queue %zu port %s",
Expand Down Expand Up @@ -104,7 +105,8 @@ void CounterCheckOrch::pfcFrameCounterCheck()
auto oid = i.first;
auto counters = i.second;
auto newCounters = getPfcFrameCounters(oid);
uint8_t pfcMask = 0;
uint8_t dummy = 0;
uint8_t pfcMaskCfg = 0;

Port port;
if (!gPortsOrch->getPort(oid, port))
Expand All @@ -113,15 +115,15 @@ void CounterCheckOrch::pfcFrameCounterCheck()
continue;
}

if (!gPortsOrch->getPortPfc(port.m_port_id, &pfcMask))
if (!gPortsOrch->getPortPfc(port.m_port_id, dummy, pfcMaskCfg))
{
SWSS_LOG_ERROR("Failed to get PFC mask on port %s", port.m_alias.c_str());
continue;
}

for (size_t prio = 0; prio != counters.size(); prio++)
{
bool isLossy = ((1 << prio) & pfcMask) == 0;
bool isLossy = ((1 << prio) & pfcMaskCfg) == 0;
if (newCounters[prio] == numeric_limits<uint64_t>::max())
{
SWSS_LOG_WARN("Could not retreive PFC frame count on queue %zu port %s",
Expand Down
1 change: 1 addition & 0 deletions orchagent/observer.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ enum SubjectType
SUBJECT_TYPE_PORT_CHANGE,
SUBJECT_TYPE_PORT_OPER_STATE_CHANGE,
SUBJECT_TYPE_FDB_FLUSH_CHANGE,
SUBJECT_TYPE_PORT_PFC_CHANGE,
};

class Observer
Expand Down
6 changes: 5 additions & 1 deletion orchagent/orchdaemon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ bool OrchDaemon::init()
};

gMacsecOrch = new MACsecOrch(m_applDb, m_stateDb, macsec_app_tables, gPortsOrch);

/*
* The order of the orch list is important for state restore of warm start and
* the queued processing in m_toSync map after gPortsOrch->allPortsReady() is set.
Expand Down Expand Up @@ -379,6 +379,7 @@ bool OrchDaemon::init()
m_orchList.push_back(new PfcWdSwOrch<PfcWdZeroBufferHandler, PfcWdLossyHandler>(
m_configDb,
pfc_wd_tables,
qos_orch,
portStatIds,
queueStatIds,
queueAttrIds,
Expand Down Expand Up @@ -422,6 +423,7 @@ bool OrchDaemon::init()
m_orchList.push_back(new PfcWdSwOrch<PfcWdZeroBufferHandler, PfcWdLossyHandler>(
m_configDb,
pfc_wd_tables,
qos_orch,
portStatIds,
queueStatIds,
queueAttrIds,
Expand All @@ -432,6 +434,7 @@ bool OrchDaemon::init()
m_orchList.push_back(new PfcWdSwOrch<PfcWdAclHandler, PfcWdLossyHandler>(
m_configDb,
pfc_wd_tables,
qos_orch,
portStatIds,
queueStatIds,
queueAttrIds,
Expand Down Expand Up @@ -474,6 +477,7 @@ bool OrchDaemon::init()
m_orchList.push_back(new PfcWdSwOrch<PfcWdAclHandler, PfcWdLossyHandler>(
m_configDb,
pfc_wd_tables,
qos_orch,
portStatIds,
queueStatIds,
queueAttrIds,
Expand Down
20 changes: 12 additions & 8 deletions orchagent/pfcactionhandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,7 @@ PfcWdAclHandler::PfcWdAclHandler(sai_object_id_t port, sai_object_id_t queue,
{
// First time of handling PFC for this queue, create ACL table, and bind
createPfcAclTable(port, m_strIngressTable, true);
// Create acl rule in bound acl table
shared_ptr<AclRulePfcwd> newRule = make_shared<AclRulePfcwd>(gAclOrch, m_strRule, m_strIngressTable, table_type);
createPfcAclRule(newRule, queueId, m_strIngressTable, port);
}
Expand Down Expand Up @@ -393,16 +394,17 @@ PfcWdLossyHandler::PfcWdLossyHandler(sai_object_id_t port, sai_object_id_t queue
{
SWSS_LOG_ENTER();

uint8_t pfcMask = 0;
uint8_t pfcMaskWdCfg = 0;
uint8_t dummy = 0;

if (!gPortsOrch->getPortPfc(port, &pfcMask))
if (!gPortsOrch->getPortPfc(port, pfcMaskWdCfg, dummy))
{
SWSS_LOG_ERROR("Failed to get PFC mask on port 0x%" PRIx64, port);
}

pfcMask = static_cast<uint8_t>(pfcMask & ~(1 << queueId));
pfcMaskWdCfg = static_cast<uint8_t>(pfcMaskWdCfg & ~(1 << queueId));

if (!gPortsOrch->setPortPfc(port, pfcMask))
if (!gPortsOrch->setPortPfcStatus(port, pfcMaskWdCfg))
{
SWSS_LOG_ERROR("Failed to set PFC mask on port 0x%" PRIx64, port);
}
Expand All @@ -412,16 +414,18 @@ PfcWdLossyHandler::~PfcWdLossyHandler(void)
{
SWSS_LOG_ENTER();

uint8_t pfcMask = 0;
uint8_t pfcMaskWdCfg = 0;
uint8_t pfcMaskUserCfg = 0;

if (!gPortsOrch->getPortPfc(getPort(), &pfcMask))
if (!gPortsOrch->getPortPfc(getPort(), pfcMaskWdCfg, pfcMaskUserCfg))
{
SWSS_LOG_ERROR("Failed to get PFC mask on port 0x%" PRIx64, getPort());
}

pfcMask = static_cast<uint8_t>(pfcMask | (1 << getQueueId()));
// Set PFC enable bit to asic only if the corresponding bit in user config is set
pfcMaskWdCfg = static_cast<uint8_t>(pfcMaskWdCfg | ((1 << getQueueId()) & pfcMaskUserCfg));

if (!gPortsOrch->setPortPfc(getPort(), pfcMask))
if (!gPortsOrch->setPortPfcStatus(getPort(), pfcMaskWdCfg))
{
SWSS_LOG_ERROR("Failed to set PFC mask on port 0x%" PRIx64, getPort());
}
Expand Down
Loading