-
Notifications
You must be signed in to change notification settings - Fork 539
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
[Orchagent]: FdbOrch changes for EVPN VXLAN #1275
Changes from 23 commits
6d3d2b5
84642fc
4d9bd0a
187388e
fb85618
304234e
073da4a
7025c7e
7a83154
88f487e
b9e696a
2c0b5f5
e119e4f
4c58722
e84411e
e209750
eedde3c
ef3adf8
f97af78
5f38e64
41a4a18
f17b20e
3ceb819
9021773
df6b9e7
1665c71
798d5fe
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,14 @@ | |
#include "observer.h" | ||
#include "portsorch.h" | ||
|
||
enum FdbOrigin | ||
{ | ||
FDB_ORIGIN_INVALID = 0, | ||
FDB_ORIGIN_LEARN = 1, | ||
FDB_ORIGIN_PROVISIONED = 2, | ||
FDB_ORIGIN_VXLAN_ADVERTIZED = 4 | ||
}; | ||
|
||
struct FdbEntry | ||
{ | ||
MacAddress mac; | ||
|
@@ -15,12 +23,17 @@ struct FdbEntry | |
{ | ||
return tie(mac, bv_id) < tie(other.mac, other.bv_id); | ||
} | ||
bool operator==(const FdbEntry& other) const | ||
{ | ||
return tie(mac, bv_id) == tie(other.mac, other.bv_id); | ||
} | ||
}; | ||
|
||
struct FdbUpdate | ||
{ | ||
FdbEntry entry; | ||
Port port; | ||
string type; | ||
bool add; | ||
}; | ||
|
||
|
@@ -30,10 +43,35 @@ struct FdbFlushUpdate | |
Port port; | ||
}; | ||
|
||
struct SavedFdbEntry | ||
struct FdbData | ||
{ | ||
FdbEntry entry; | ||
sai_object_id_t bridge_port_id; | ||
string type; | ||
FdbOrigin origin; | ||
/** | ||
{"dynamic", FDB_ORIGIN_LEARN} => dynamically learnt | ||
{"dynamic", FDB_ORIGIN_PROVISIONED} => provisioned dynamic with swssconfig in APPDB | ||
{"dynamic", FDB_ORIGIN_ADVERTIZED} => synced from remote device e.g. BGP MAC route | ||
{"static", FDB_ORIGIN_LEARN} => Invalid | ||
{"static", FDB_ORIGIN_PROVISIONED} => statically provisioned | ||
{"static", FDB_ORIGIN_ADVERTIZED} => sticky synced from remote device | ||
*/ | ||
|
||
/* Remote FDB related info */ | ||
string remote_ip; | ||
string esi; | ||
unsigned int vni; | ||
}; | ||
|
||
struct SavedFdbEntry | ||
{ | ||
MacAddress mac; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why did we remove FdbEntry and added mac and vlanID explicitly. Can we keep FdbEntry and use its overloaded comparision operator to compare savedFdbEntry? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. SaveFdbEntry is used for storing an FDB which has valid vlan (vlan is created) but is waiting for the port to become the associated vlan's member. |
||
unsigned short vlanId; | ||
FdbData fdbData; | ||
bool operator==(const SavedFdbEntry& other) const | ||
{ | ||
return tie(mac, vlanId) == tie(other.mac, other.vlanId); | ||
} | ||
}; | ||
|
||
typedef unordered_map<string, vector<SavedFdbEntry>> fdb_entries_by_port_t; | ||
|
@@ -42,7 +80,7 @@ class FdbOrch: public Orch, public Subject, public Observer | |
{ | ||
public: | ||
|
||
FdbOrch(TableConnector applDbConnector, TableConnector stateDbConnector, PortsOrch *port); | ||
FdbOrch(DBConnector* applDbConnector, vector<table_name_with_pri_t> appFdbTables, TableConnector stateDbFdbConnector, PortsOrch *port); | ||
|
||
~FdbOrch() | ||
{ | ||
|
@@ -53,15 +91,19 @@ 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&); | ||
|
||
bool removeFdbEntry(const FdbEntry& entry, FdbOrigin origin=FDB_ORIGIN_PROVISIONED); | ||
|
||
static const int fdborch_pri; | ||
void flushFDBEntries(sai_object_id_t bridge_port_oid, | ||
sai_object_id_t vlan_oid); | ||
void notifyObserversFDBFlush(Port &p, sai_object_id_t&); | ||
|
||
private: | ||
PortsOrch *m_portsOrch; | ||
set<FdbEntry> m_entries; | ||
map<FdbEntry, FdbData> m_entries; | ||
fdb_entries_by_port_t saved_fdb_entries; | ||
Table m_table; | ||
vector<Table*> m_appTables; | ||
Table m_fdbStateTable; | ||
NotificationConsumer* m_flushNotificationsConsumer; | ||
NotificationConsumer* m_fdbNotificationConsumer; | ||
|
@@ -71,9 +113,12 @@ class FdbOrch: public Orch, public Subject, public Observer | |
|
||
void updateVlanMember(const VlanMemberUpdate&); | ||
void updatePortOperState(const PortOperStateUpdate&); | ||
bool addFdbEntry(const FdbEntry&, const string&); | ||
bool removeFdbEntry(const FdbEntry&); | ||
|
||
bool addFdbEntry(const FdbEntry&, const string&, FdbData fdbData); | ||
void deleteFdbEntryFromSavedFDB(const MacAddress &mac, const unsigned short &vlanId, FdbOrigin origin, const string portName=""); | ||
|
||
bool storeFdbEntryState(const FdbUpdate& update); | ||
void notifyTunnelOrch(Port& port); | ||
}; | ||
|
||
#endif /* SWSS_FDBORCH_H */ |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -229,14 +229,13 @@ PortsOrch::PortsOrch(DBConnector *db, vector<table_name_with_pri_t> &tableNames) | |
/* Initialize counter table */ | ||
m_counter_db = shared_ptr<DBConnector>(new DBConnector("COUNTERS_DB", 0)); | ||
m_counterTable = unique_ptr<Table>(new Table(m_counter_db.get(), COUNTERS_PORT_NAME_MAP)); | ||
|
||
m_counterLagTable = unique_ptr<Table>(new Table(m_counter_db.get(), COUNTERS_LAG_NAME_MAP)); | ||
FieldValueTuple tuple("", ""); | ||
vector<FieldValueTuple> defaultLagFv; | ||
defaultLagFv.push_back(tuple); | ||
m_counterLagTable->set("", defaultLagFv); | ||
|
||
/* Initialize port table */ | ||
/* Initialize port and vlan table */ | ||
m_portTable = unique_ptr<Table>(new Table(db, APP_PORT_TABLE_NAME)); | ||
|
||
/* Initialize gearbox */ | ||
|
@@ -1882,7 +1881,6 @@ bool PortsOrch::initPort(const string &alias, const int index, const set<int> &l | |
|
||
/* Add port to port list */ | ||
m_portList[alias] = p; | ||
m_port_ref_count[alias] = 0; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i think you accidently remove this line. Can you put it back? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this line was somehow showing as a new addition as seen in your pervious comment. I just re-added this line. |
||
m_portOidToIndex[id] = index; | ||
|
||
/* Add port name map to counter table */ | ||
|
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 structure will contain all the information related to an FDB entry, so, it would be neat keep VxLAN related info in a separate structure and add it here as a variable, but I will leave it up to you!
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.
keeping it the same for now.