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

[sonic-swss]:enable unconfiguring PFC on last TC on a port #1962

Merged
merged 2 commits into from
Nov 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
8 changes: 7 additions & 1 deletion orchagent/qosorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1392,7 +1392,13 @@ task_process_status QosOrch::handlePortQosMapTable(Consumer& consumer)
SWSS_LOG_INFO("Applied %s to port %s", it->second.first.c_str(), port_name.c_str());
}

if (pfc_enable)
sai_uint8_t old_pfc_enable = 0;
if (!gPortsOrch->getPortPfc(port.m_port_id, &old_pfc_enable))
{
SWSS_LOG_ERROR("Failed to retrieve PFC bits on port %s", port_name.c_str());
}

if (pfc_enable || old_pfc_enable)
{
if (!gPortsOrch->setPortPfc(port.m_port_id, pfc_enable))
{
Expand Down
27 changes: 27 additions & 0 deletions tests/test_pfc.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,34 @@ def test_PfcAsymmetric(self, dvs, testlog):
pfc = getPortAttr(dvs, port_oid, 'SAI_PORT_ATTR_PRIORITY_FLOW_CONTROL')
assert pfc == pfc_tx

def test_PfcUnconfig(self, dvs, testlog):

port_name = 'Ethernet0'
pfc_queues = [ 3, 4 ]

# Configure default PFC
setPortPfc(dvs, port_name, pfc_queues)

# Get SAI object ID for the interface
port_oid = getPortOid(dvs, port_name)

# Verify default PFC is set to configured value
pfc = getPortAttr(dvs, port_oid, 'SAI_PORT_ATTR_PRIORITY_FLOW_CONTROL')
assert pfc == getBitMaskStr(pfc_queues)

# Configure PFC on single TC
pfc_queues = [ 3 ]
setPortPfc(dvs, port_name, pfc_queues)
# Verify default PFC is set to configured value
pfc = getPortAttr(dvs, port_oid, 'SAI_PORT_ATTR_PRIORITY_FLOW_CONTROL')
assert pfc == getBitMaskStr(pfc_queues)

# Disable PFC on last TC
pfc_queues = [ ]
setPortPfc(dvs, port_name, pfc_queues)
# Verify default PFC is set to configured value
pfc = getPortAttr(dvs, port_oid, 'SAI_PORT_ATTR_PRIORITY_FLOW_CONTROL')
assert pfc == getBitMaskStr(pfc_queues)

# Add Dummy always-pass test at end as workaroud
# for issue when Flaky fail on final test it invokes module tear-down before retrying
Expand Down