Skip to content

Commit ac42493

Browse files
kcudniklguohan
authored andcommitted
Add support for FDB notification in virtual switch (sonic-net#287)
* Add support for FDB notification in virtual switch * Change aging fdb time to default * Address comments * Address comments * Address comments * Change notification to debug on fdb * Move sleep after processing to avoid deadlock * Remove join thread to remove possible deadlock * Bring back thread join Without join if process will call uninitialize and thread was running we will get coredump caused by not finished thread * Fix deadlock problem with try_lock
1 parent a6b5be8 commit ac42493

File tree

5 files changed

+610
-6
lines changed

5 files changed

+610
-6
lines changed

vslib/inc/sai_vs_state.h

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,38 @@ typedef std::map<sai_object_type_t, std::map<std::string, AttrHash>> ObjectHash;
103103

104104
#define DEFAULT_VLAN_NUMBER 1
105105

106+
typedef struct _fdb_info_t
107+
{
108+
sai_object_id_t port_id;
109+
110+
sai_object_id_t bridge_port_id;
111+
112+
sai_fdb_entry_t fdb_entry;
113+
114+
uint32_t timestamp;
115+
116+
bool operator<(const _fdb_info_t& other) const
117+
{
118+
int res = memcmp(fdb_entry.mac_address, other.fdb_entry.mac_address, sizeof(sai_mac_t));
119+
120+
if (res < 0)
121+
return true;
122+
123+
if (res > 0)
124+
return false;
125+
126+
return fdb_entry.vlan_id < other.fdb_entry.vlan_id;
127+
}
128+
129+
bool operator() (const _fdb_info_t& lhs, const _fdb_info_t & rhs) const
130+
{
131+
return lhs < rhs;
132+
}
133+
134+
} fdb_info_t;
135+
136+
extern std::set<fdb_info_t> g_fdb_info_set;
137+
106138
class SwitchState
107139
{
108140
public:
@@ -236,4 +268,8 @@ sai_object_id_t vs_create_real_object_id(
236268
_In_ sai_object_type_t object_type,
237269
_In_ sai_object_id_t switch_id);
238270

271+
void processFdbInfo(
272+
_In_ const fdb_info_t &fi,
273+
_In_ sai_fdb_event_t fdb_event);
274+
239275
#endif // __SAI_VS_STATE__

0 commit comments

Comments
 (0)