Skip to content

Commit

Permalink
remove FDB entires of BridgePort before removing the BridgePort (#1451)
Browse files Browse the repository at this point in the history
* remove FDB entires of BridgePort before removing the BridgePort
Co-authored-by: Madhan Babu <madhan@arc-build-server.mtr.labs.mlnx>
  • Loading branch information
madhanmellanox authored and yxieca committed Oct 25, 2022
1 parent a2db2ab commit ab785d8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
3 changes: 2 additions & 1 deletion orchagent/fdborch.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ class FdbOrch: public Orch, public Subject, public Observer
void update(sai_fdb_event_t, const sai_fdb_entry_t *, sai_object_id_t);
void update(SubjectType type, void *cntx);
bool getPort(const MacAddress&, uint16_t, Port&);
void flushFDBEntries(sai_object_id_t bridge_port_oid,
sai_object_id_t vlan_oid);

private:
PortsOrch *m_portsOrch;
Expand All @@ -62,7 +64,6 @@ class FdbOrch: public Orch, public Subject, public Observer
void updateVlanMember(const VlanMemberUpdate&);
bool addFdbEntry(const FdbEntry&, const string&, const string&);
bool removeFdbEntry(const FdbEntry&);

bool storeFdbEntryState(const FdbUpdate& update);
};

Expand Down
9 changes: 6 additions & 3 deletions orchagent/portsorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
#include "crmorch.h"
#include "countercheckorch.h"
#include "notifier.h"
#include "redisclient.h"
#include "fdborch.h"

extern sai_switch_api_t *sai_switch_api;
extern sai_bridge_api_t *sai_bridge_api;
Expand All @@ -36,6 +38,7 @@ extern IntfsOrch *gIntfsOrch;
extern NeighOrch *gNeighOrch;
extern CrmOrch *gCrmOrch;
extern BufferOrch *gBufferOrch;
extern FdbOrch *gFdbOrch;

#define VLAN_PREFIX "Vlan"
#define DEFAULT_VLAN_ID 1
Expand Down Expand Up @@ -2635,9 +2638,9 @@ bool PortsOrch::removeBridgePort(Port &port)
return false;
}

/* Flush FDB entries pointing to this bridge port */
// TODO: Remove all FDB entries associated with this bridge port before
// removing the bridge port itself
//Flush the FDB entires corresponding to the port
gFdbOrch->flushFDBEntries(port.m_bridge_port_id, SAI_NULL_OBJECT_ID);
SWSS_LOG_INFO("Flush FDB entries for port %s", port.m_alias.c_str());

/* Remove bridge port */
status = sai_bridge_api->remove_bridge_port(port.m_bridge_port_id);
Expand Down

0 comments on commit ab785d8

Please sign in to comment.