Remove FDB entries when shutting down the interface#909
Open
InventecJamesHuang wants to merge 1 commit intosonic-net:masterfrom
Open
Remove FDB entries when shutting down the interface#909InventecJamesHuang wants to merge 1 commit intosonic-net:masterfrom
InventecJamesHuang wants to merge 1 commit intosonic-net:masterfrom
Conversation
prsunny
reviewed
Nov 26, 2019
| // 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; |
Collaborator
There was a problem hiding this comment.
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()); |
Collaborator
There was a problem hiding this comment.
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); |
bsbsrkg
reviewed
May 16, 2020
| 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()); |
oleksandrivantsiv
pushed a commit
to oleksandrivantsiv/sonic-swss
that referenced
this pull request
Mar 1, 2023
jianyuewu
pushed a commit
to jianyuewu/sonic-swss
that referenced
this pull request
Dec 24, 2025
…nSchema formats. (sonic-net#909) Summary: Add function ActionSchemaByNameAndObjectType to allow different ActionSchema formats. The SAI_ACL_ENTRY_ATTR_ACTION_REDIRECT action redirects to different object types, which have different formats. Multicast groups are hex strings, while next hops and ports are regular strings.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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