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 + Asym PFC]: Allow PFCWD to detect PFC storm on all priorities when Asym PFC is enabled #1360

Closed

Conversation

volodymyrsamotiy
Copy link
Collaborator

@volodymyrsamotiy volodymyrsamotiy commented Jul 23, 2020

Signed-off-by: Volodymyr Samotiy volodymyrs@mellanox.com

What I did
Add possibility for PFCWD to detect PFC storm on all priorities when asymmetric PFC is enabled.

According to requirements PFCWD should detect PFC storm on the lossy priorities for the port on which asymmetric PFC is enabled.
(when asymmetric PFC is enabled on some port that means such port is enabled for receiving PFC frames on all priorities)

Why I did it
To fix issue #1128.

How I verified it

  1. Enable asymmetric PFC on test port.
pfc config asymmetric on <port>
  1. Enable PFCWD on the test port.
pfcwd start --action drop --restoration-time 3000 <port> 1000
pfcwd interval 500
  1. Run pause frames to the test port for all priorities.
  2. Verify that PFCWD detected storm for all priorities.
pfcwd show stats

Details if related
N/A

@liat-grozovik
Copy link
Collaborator

retest vs please

@liat-grozovik
Copy link
Collaborator

liat-grozovik commented Jul 28, 2020

retest this please

1 similar comment
@volodymyrsamotiy
Copy link
Collaborator Author

retest this please

@liat-grozovik
Copy link
Collaborator

retest this please

… when Asym PFC is enabled

Signed-off-by: Volodymyr Samotiy <volodymyrs@mellanox.com>
@volodymyrsamotiy
Copy link
Collaborator Author

retest this please

@volodymyrsamotiy volodymyrsamotiy marked this pull request as ready for review August 12, 2020 09:06
@volodymyrsamotiy
Copy link
Collaborator Author

retest this please

sai_status_t status = sai_port_api->set_port_attribute(portId, &attr);
if (status != SAI_STATUS_SUCCESS)
{
SWSS_LOG_ERROR("Failed to set PFC bitmask 0x%x for the port 0x%" PRIx64 " (rc:%d)",
Copy link
Collaborator

Choose a reason for hiding this comment

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

not sure i understand this part.
you are using the tx pfc bitmask for setting flow control and the message in the log is still pfc bitmask which i can see later on you have one for rx and tx.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This logic is explained in the "Asymmentric PFC" HLD in the "2.2.1 PortsOrch" section
https://github.com/Azure/SONiC/wiki/Asymmetric-PFC-High-Level-Design#221-portsorch

}
else
{
pfc_rx_bitmask = pfc_tx_bitmask;
Copy link
Collaborator

Choose a reason for hiding this comment

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

logic has changed, can you elaborate it in the code?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Logic is exactly the same but code was refactored according to changes for set/getPortPfc API.


sai_status_t status = sai_port_api->set_port_attribute(port.m_port_id, &attr);
if (status != SAI_STATUS_SUCCESS)
{
SWSS_LOG_ERROR("Failed to set PFC mode %d to port id 0x%" PRIx64 " (rc:%d)", port.m_pfc_asym, port.m_port_id, status);
SWSS_LOG_ERROR("Failed to set PFC mode %d for the port 0x%" PRIx64 " (rc:%d)",
Copy link
Collaborator

Choose a reason for hiding this comment

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

IMO you should remove 'the' after the 'for'

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

changed

@@ -1329,7 +1329,7 @@ task_process_status QosOrch::handlePortQosMapTable(Consumer& consumer)

if (pfc_enable)
{
if (!gPortsOrch->setPortPfc(port.m_port_id, pfc_enable))
if (!gPortsOrch->setPortPfc(port.m_port_id, pfc_enable, pfc_enable))
Copy link
Collaborator

Choose a reason for hiding this comment

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

the pfc_enable is on/off? if this is the case all other places are mask. can you please elaborate on that?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, it is according to requirements, "Asym PFC" is "on"/"off" port attribute for the user but SAI requires PFC value to be as bit vector.
https://github.com/Azure/SONiC/wiki/Asymmetric-PFC-High-Level-Design#11-functional-requirements

@liat-grozovik
Copy link
Collaborator

retest this please

@liat-grozovik
Copy link
Collaborator

@volodymyrsamotiy please handle conflicts

…wd_asym_pfc

Conflicts:
	orchagent/port.h
	orchagent/portsorch.h
… when Asym PFC is enabled

* Correct error message for setting PFC mode

Signed-off-by: Volodymyr Samotiy <volodymyrs@nvidia.com>
@volodymyrsamotiy
Copy link
Collaborator Author

@volodymyrsamotiy please handle conflicts

handled

… when Asym PFC is enabled

* Fix LGTM failure

Signed-off-by: Volodymyr Samotiy <volodymyrs@nvidia.com>
@liat-grozovik liat-grozovik changed the title [PFCWD + Asym PFC]: Allow PFCWD to detect PFC storm on all priorities… [PFCWD + Asym PFC]: Allow PFCWD to detect PFC storm on all priorities when Asym PFC is enabled Feb 25, 2021
liat-grozovik
liat-grozovik previously approved these changes Feb 25, 2021
@liat-grozovik
Copy link
Collaborator

@neethajohn kindly reminder. this PR should go to 202012 as well.

@dprital
Copy link
Collaborator

dprital commented Mar 5, 2021

@neethajohn Kindly Reminder, we are waiting for the merge of this PR. Thanks.

@dprital
Copy link
Collaborator

dprital commented Mar 10, 2021

@neethajohn - Who can merge this PR ? Thanks.

Copy link
Contributor

@neethajohn neethajohn left a comment

Choose a reason for hiding this comment

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

Please add unit tests

orchagent/portsorch.cpp Outdated Show resolved Hide resolved
orchagent/pfcwdorch.cpp Show resolved Hide resolved
orchagent/pfcwdorch.cpp Show resolved Hide resolved
{
SWSS_LOG_ERROR("Failed to get PFC mask on port 0x%" PRIx64, port);
}

pfcMask = static_cast<uint8_t>(pfcMask & ~(1 << queueId));
pfcTxMask = static_cast<uint8_t>(pfcTxMask & ~(1 << queueId));
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we need to modify Tx Mask? In any case, its a noop if pfcwd is triggered on a lossy priority because the txMask only contains priorities 3 and 4

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Agree, we don' need it. Fixed to modify only Rx mask.

{
SWSS_LOG_ERROR("Failed to get PFC mask on port 0x%" PRIx64, getPort());
}

pfcMask = static_cast<uint8_t>(pfcMask | (1 << getQueueId()));
pfcTxMask = static_cast<uint8_t>(pfcTxMask | (1 << getQueueId()));
Copy link
Contributor

Choose a reason for hiding this comment

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

We shouldn't be modifying Tx Mask since it contains only priorities 3 and 4. We will setting tx mask to incorrect values on pfcwd storm restore if pfcwd was triggered on a lossy priority

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Agree, we don' need it. Fixed to modify only Rx mask.

Copy link
Contributor

Choose a reason for hiding this comment

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

Thinking about this more, we need to set the txmask but need to do it only for queues set in 'pfc_enable' field

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ok, I will change it back and verify

…wd_asym_pfc

Conflicts:
	orchagent/port.h
	orchagent/portsorch.cpp
… when Asym PFC is enabled

* Fix review comments

Signed-off-by: Volodymyr Samotiy <volodymyrs@nvidia.com>
… when Asym PFC is enabled

* Fix SAI errors handling for setPortPfc()

Signed-off-by: Volodymyr Samotiy <volodymyrs@nvidia.com>
@lgtm-com
Copy link

lgtm-com bot commented Dec 22, 2021

This pull request fixes 1 alert when merging d710235 into a4c80c3 - view on LGTM.com

fixed alerts:

  • 1 for Unused import

@volodymyrsamotiy
Copy link
Collaborator Author

/azpw run

@mssonicbld
Copy link
Collaborator

/AzurePipelines run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@volodymyrsamotiy
Copy link
Collaborator Author

/azpw run

@mssonicbld
Copy link
Collaborator

/AzurePipelines run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@liat-grozovik
Copy link
Collaborator

/azp run Azure.sonic-swss

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

…wd_asym_pfc

Conflicts:
	tests/test_pfcwd.py
@lgtm-com
Copy link

lgtm-com bot commented Jan 12, 2022

This pull request fixes 1 alert when merging 6fd9206 into 8fd6e48 - view on LGTM.com

fixed alerts:

  • 1 for Unused import

EdenGri pushed a commit to EdenGri/sonic-swss that referenced this pull request Feb 28, 2022
…witch" for deriving tor ipv4_address (sonic-net#1360)

This PR provides the support for fixing the show muxcable config.
There was a change in the Config_DB schema where there was an addition of key-value pair
"peer_switch:tor_name" in DEVICE_METADATA|localhost table which actually gives the other TOR's name (hostname).
This TOR name is then utilized in PEER_SWITCH|switchname table which has "address_ipv4: IPv4 address" key-value pair,
which correctly gives the ip address for displaying on the show mux config

What is the motivation for this PR?
To add the fix the working for show muxcable config

Signed-off-by: vaibhav-dahiya <vdahiya@microsoft.com>
…orch

Signed-off-by: Volodymyr Samotiy <volodymyrs@nvidia.com>
…w one

Signed-off-by: Volodymyr Samotiy <volodymyrs@nvidia.com>
Signed-off-by: Volodymyr Samotiy <volodymyrs@nvidia.com>
@liat-grozovik
Copy link
Collaborator

@neethajohn please note comments were addressed. please review and signoff.

@dprital
Copy link
Collaborator

dprital commented Apr 13, 2022

@neethajohn - Can you please approve this PR ?

@dprital
Copy link
Collaborator

dprital commented Apr 26, 2022

@neethajohn - as discussed yesterday, please review. Thanks.

@rlhui rlhui requested a review from vmittal-msft May 23, 2022 23:06
@liat-grozovik
Copy link
Collaborator

@volodymyrsamotiy please handle conflicts and we will have it merged.

@liat-grozovik
Copy link
Collaborator

@volodymyrsamotiy kindly reminder to handle conflicts so I can merge

@liat-grozovik
Copy link
Collaborator

The issue was reported many many releases a go.
due to very low attention from the community and probably not in interest of others, i am closing this PR.
if at any time in the future the fix will be needed, we will need community attention. till then the issues is open

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants