From ab785d822052813a5f3f6098bea33891e88cf509 Mon Sep 17 00:00:00 2001 From: madhanmellanox <62459540+madhanmellanox@users.noreply.github.com> Date: Fri, 2 Oct 2020 09:56:25 -0700 Subject: [PATCH] remove FDB entires of BridgePort before removing the BridgePort (#1451) * remove FDB entires of BridgePort before removing the BridgePort Co-authored-by: Madhan Babu --- orchagent/fdborch.h | 3 ++- orchagent/portsorch.cpp | 9 ++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/orchagent/fdborch.h b/orchagent/fdborch.h index 3125b3112d..d058dff4ab 100644 --- a/orchagent/fdborch.h +++ b/orchagent/fdborch.h @@ -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; @@ -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); }; diff --git a/orchagent/portsorch.cpp b/orchagent/portsorch.cpp index b5ef8d934c..29d194180b 100755 --- a/orchagent/portsorch.cpp +++ b/orchagent/portsorch.cpp @@ -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; @@ -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 @@ -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);