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

remove FDB entires of BridgePort before removing the BridgePort #1451

Merged
merged 8 commits into from
Oct 2, 2020
5 changes: 2 additions & 3 deletions orchagent/fdborch.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,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 @@ -64,9 +66,6 @@ class FdbOrch: public Orch, public Subject, public Observer
void updatePortOperState(const PortOperStateUpdate&);
bool addFdbEntry(const FdbEntry&, const string&);
bool removeFdbEntry(const FdbEntry&);
void flushFDBEntries(sai_object_id_t bridge_port_oid,
sai_object_id_t vlan_oid);

bool storeFdbEntryState(const FdbUpdate& update);
};

Expand Down
6 changes: 6 additions & 0 deletions orchagent/portsorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include "countercheckorch.h"
#include "notifier.h"
#include "redisclient.h"
#include "fdborch.h"
prsunny marked this conversation as resolved.
Show resolved Hide resolved

extern sai_switch_api_t *sai_switch_api;
extern sai_bridge_api_t *sai_bridge_api;
Expand All @@ -41,6 +42,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 @@ -3431,6 +3433,10 @@ bool PortsOrch::removeBridgePort(Port &port)
return false;
}

//Flush the FDB entires corresponding to the port
prsunny marked this conversation as resolved.
Show resolved Hide resolved
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);
if (status != SAI_STATUS_SUCCESS)
Expand Down