Skip to content

[pfcwd]: support BIG_RED_SWITCH mode#467

Merged
sihuihan88 merged 2 commits intosonic-net:masterfrom
sihuihan88:dev/sihan/brs
Apr 13, 2018
Merged

[pfcwd]: support BIG_RED_SWITCH mode#467
sihuihan88 merged 2 commits intosonic-net:masterfrom
sihuihan88:dev/sihan/brs

Conversation

@sihuihan88
Copy link
Contributor

@sihuihan88 sihuihan88 commented Apr 10, 2018

Signed-off-by: Sihui Han sihan@microsoft.com

What I did
Enable support for BIG_RED_SWITCH mode:
The Expect behavior:

  1. When BIG_RED_SWITCH mode is enabled:
  • Regardless of PFCWD configuration or PFC storm status, PFCWD starts to drop all lossless TC packets on all ports. It's a big red button to drop all lossless packets "blindly".
  • PFCWD will not do storm check/restore once BIG_RED_SWITCH is enabled. If there is some active action handler handling ongoing PFC storm when enabling BIG_RED_SWITCH, stop these handlers and rely on BIG_RED_SWITCH to drop all the packets.
  • Lossy traffic should not be affected.
  1. When BIG_RED_SWITCH mode is disabled:
    PFCWD goes back to normal, and start to check/restore pfc storm.

  2. BIG_RED_SWITCH mode can be enabled and disabled anytime even if PFCWD was not enabled on any port before.

Why I did it
Per request, BIG_RED_SWITCH mode provides a button to drop all lossless packets on a switch.
How I verified it
Tested on DUT
Details if related

Signed-off-by: Sihui Han <sihan@microsoft.com>
@sihuihan88
Copy link
Contributor Author

cli sonic-net/sonic-utilities#237

@sihuihan88
Copy link
Contributor Author

retest this please

@sihuihan88 sihuihan88 changed the title [pfcwd]: enable BIG_RED_SWITCH mode [pfcwd]: support BIG_RED_SWITCH mode Apr 11, 2018
{
if (entry->second.handler != nullptr)
{
SWSS_LOG_NOTICE(
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why move logs from handler to this orch?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Since in big-red-switch mode, we don't want to have log relates to storm detect/restore. Moving log out of handler class provides flexibility for users to input various logs depending on the use case when they create action handler

Copy link
Collaborator

Choose a reason for hiding this comment

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

ok

for (auto & it: allPorts)
{
Port port = it.second;
if (port.m_alias != "Ethernet8")
Copy link
Collaborator

Choose a reason for hiding this comment

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

What's this magic ifname?

void setBigRedSwitchMode(string value);

map<sai_object_id_t, PfcWdQueueEntry> m_entryMap;
map<sai_object_id_t, PfcWdQueueEntry> m_brsEntryMap;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why separate map for BRS?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

After disable big-red-switch, we need to keep the PFC WD original configuration. This information actually is stored in m_entryMap. It would be better if we don't mix this information with brs.

Copy link
Collaborator

Choose a reason for hiding this comment

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

In line 398 in .cpp file entry is removed from the regular map when BRS is enabled, but it is not added back when BRS is disabled.
In case we had some handler, and BRS is flipped on/off, will we end up with no handler after BRS off?

Copy link
Contributor Author

@sihuihan88 sihuihan88 Apr 12, 2018

Choose a reason for hiding this comment

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

That’s true. The previous active handlers mark the storm happens when BRS was enabled. After BRS runs for a while, the previous state is out of date so it’s unecessary to recreate those handlers. Instead we just need to recover the PWCWD configuration and let it detect storm again. And the configuration comes from entrymap

Copy link
Collaborator

Choose a reason for hiding this comment

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

ok

string queueIdStr = sai_serialize_object_id(queueId);

vector<FieldValueTuple> countersFieldValues;
countersFieldValues.emplace_back("BIG_RED_SWITCH_MODE", "enable");
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't think that plugins should know about BRS. Since you chose to keep them running, you might as well ignore notifications from plugins by checking a flag in orch.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I would prefer to let plugins aware of BRS. Otherwise, syncd will runplugin and keeps sending notification every 100ms. Even though swss can ingore, it still consumes a lot unnecessary resources.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe then it is better to unregister plugins or have some field in DB along with poll interval that will globally turn plugins on/off?

Copy link
Contributor Author

@sihuihan88 sihuihan88 Apr 12, 2018

Choose a reason for hiding this comment

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

I think both method are mostly identical, and the only difference is how to skip plugins. The benefit to achieve this in lua script is it's lightweight and only affect pfcwd, also it don't need modification of syncd and makes syncd logic simpler. If you would prefer to change the logic to syncd, I can add it to backlog and change it later.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Have added it to backlog. sonic-net/sonic-sairedis#314

Copy link
Collaborator

Choose a reason for hiding this comment

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

ok

return;
}

uint8_t pfcMask = attr.value.u8;
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is not aligned with asymmetric PFC

Copy link
Contributor Author

@sihuihan88 sihuihan88 Apr 11, 2018

Choose a reason for hiding this comment

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

This need to be updated once asym PFC is supported. There was one comment above this part of the code to remind us to update this part once asy is enabled.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Oh, I thought it already was. My bad.

@sihuihan88 sihuihan88 merged commit 046628b into sonic-net:master Apr 13, 2018
@sihuihan88 sihuihan88 deleted the dev/sihan/brs branch April 13, 2018 17:49
lguohan pushed a commit that referenced this pull request Apr 27, 2018
* [pfcwd]: enable BIG_RED_SWITCH mode

Signed-off-by: Sihui Han <sihan@microsoft.com>

* update as comments
EdenGri pushed a commit to EdenGri/sonic-swss that referenced this pull request Feb 28, 2022
* Option '-d' means read the EEPROM information from DB directly
* CLI "show platform syseeprom" will invoke decode-syseeprom with
  '-d' option

Signed-off-by: Kevin Wang <kevinw@mellanox.com>
oleksandrivantsiv pushed a commit to oleksandrivantsiv/sonic-swss that referenced this pull request Mar 1, 2023
* Rename to fix typo

Signed-off-by: Wenda Ni <wenni@microsoft.com>

* Correct shared_ptr creation parameters

Signed-off-by: Wenda Ni <wenni@microsoft.com>
Janetxxx pushed a commit to Janetxxx/sonic-swss that referenced this pull request Nov 10, 2025
* [pfcwd]: enable BIG_RED_SWITCH mode

Signed-off-by: Sihui Han <sihan@microsoft.com>

* update as comments
Janetxxx pushed a commit to Janetxxx/sonic-swss that referenced this pull request Nov 10, 2025
* [pfcwd]: enable BIG_RED_SWITCH mode

Signed-off-by: Sihui Han <sihan@microsoft.com>

* update as comments
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