-
Notifications
You must be signed in to change notification settings - Fork 516
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
Remove FDB entries when shutting down the interface #909
base: master
Are you sure you want to change the base?
Conversation
// If the number of enabled members is less than the value of this channel miniport, | ||
// It will cause that the LAG channel oper_status DOWN, | ||
// then we should clear the entire FDB entry. | ||
vector<FieldValueTuple> lag_value; |
There was a problem hiding this comment.
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 do this here? there is a doLagTask
that gets the oper_status
command and you could invoke the function removeFDBEntriesByBridgePortID
in that flow.
Port port; | ||
if (getPort(id, port)) | ||
{ | ||
SWSS_LOG_NOTICE("%s status is DOWN, remove the FDB entries.", port.m_alias.c_str()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add the bridge port id as well to log message?
vector<sai_attribute_t> flush_attrs; | ||
sai_status_t rv; | ||
|
||
SWSS_LOG_NOTICE("SAI_FDB_FLUSH_ATTR_BRIDGE_PORT_ID By 0x%lx", bridge_port_id); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be INFO level
flush_attr.id = SAI_FDB_FLUSH_ATTR_BRIDGE_PORT_ID; | ||
flush_attr.value.oid = bridge_port_id; | ||
flush_attrs.push_back(flush_attr); | ||
rv = sai_fdb_api->flush_fdb_entries(gSwitchId, (uint32_t)flush_attrs.size(), flush_attrs.data()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
when the CRM counter be updated?
What I did
Add the flushing FDB feature in PortsOrch to handle the situation when the user shut down the interface.
How I did it
We create the new function named 'removeFDBEntriesByBridgePortID'.
This function is responsible for calling the SAI flush_fdb_entries() function to remove the FDB entries.
There are three situations to call the above function,
When SONiC receives the port_state_change op event, if the interface goes down, it calls removeFDBEntriesByBridgePortID() to remove FDB entries.
When SONiC removes the LAG, it also calls removeFDBEntriesByBridgePortID() to remove FDB entries.
When SONiC removes one member from the LAG, if it causes the LAG's oper_status goes DOWN ( since the total number of enabled links less than the minimum number of links), it also calls removeFDBEntriesByBridgePortID() to remove FDB entries.
How I verified it
We prepared two physical ports (Ethernet44) and one virtual port (PortChannel1) to test.
First, I enabled two ports and each port learned 5 different FDB entries.
Shutting down Ethernet44
Shutting down PortChannel01
Test LAG minimun links case
In the beginning, we prepare the LAG channel which includes three ports, and the min_ports setting is 2 and we let this LAG learn 5 different FDB entries.
First, we shut down the Ethernet72 then shut down the Ethernet76, it will cause the LAG oper_status goes down.
Details if related