@@ -219,7 +219,7 @@ void FdbOrch::handleSyncdFlushNotif(const sai_object_id_t& bv_id,
219219 for (auto itr = m_entries.begin (); itr != m_entries.end ();)
220220 {
221221 auto curr = itr++;
222- if (curr->second .type != " static" && (curr->first .mac == mac || mac == flush_mac))
222+ if (curr->second .type != " static" && (curr->first .mac == mac || mac == flush_mac) && curr-> second . is_flush_pending )
223223 {
224224 clearFdbEntry (curr->first );
225225 }
@@ -233,7 +233,7 @@ void FdbOrch::handleSyncdFlushNotif(const sai_object_id_t& bv_id,
233233 auto curr = itr++;
234234 if (curr->second .bridge_port_id == bridge_port_id)
235235 {
236- if (curr->second .type != " static" && (curr->first .mac == mac || mac == flush_mac))
236+ if (curr->second .type != " static" && (curr->first .mac == mac || mac == flush_mac) && curr-> second . is_flush_pending )
237237 {
238238 clearFdbEntry (curr->first );
239239 }
@@ -248,7 +248,7 @@ void FdbOrch::handleSyncdFlushNotif(const sai_object_id_t& bv_id,
248248 auto curr = itr++;
249249 if (curr->first .bv_id == bv_id)
250250 {
251- if (curr->second .type != " static" && (curr->first .mac == mac || mac == flush_mac))
251+ if (curr->second .type != " static" && (curr->first .mac == mac || mac == flush_mac) && curr-> second . is_flush_pending )
252252 {
253253 clearFdbEntry (curr->first );
254254 }
@@ -263,7 +263,7 @@ void FdbOrch::handleSyncdFlushNotif(const sai_object_id_t& bv_id,
263263 auto curr = itr++;
264264 if (curr->first .bv_id == bv_id && curr->second .bridge_port_id == bridge_port_id)
265265 {
266- if (curr->second .type != " static" && (curr->first .mac == mac || mac == flush_mac))
266+ if (curr->second .type != " static" && (curr->first .mac == mac || mac == flush_mac) && curr-> second . is_flush_pending )
267267 {
268268 clearFdbEntry (curr->first );
269269 }
@@ -819,6 +819,7 @@ void FdbOrch::doTask(Consumer& consumer)
819819 fdbData.remote_ip = remote_ip;
820820 fdbData.esi = esi;
821821 fdbData.vni = vni;
822+ fdbData.is_flush_pending = false ;
822823 if (addFdbEntry (entry, port, fdbData))
823824 {
824825 if (origin == FDB_ORIGIN_MCLAG_ADVERTIZED)
@@ -907,6 +908,14 @@ void FdbOrch::doTask(NotificationConsumer& consumer)
907908 SWSS_LOG_ERROR (" Flush fdb failed, return code %x" , status);
908909 }
909910
911+ if (status == SAI_STATUS_SUCCESS) {
912+ for (map<FdbEntry, FdbData>::iterator it = m_entries.begin ();
913+ it != m_entries.end (); it++)
914+ {
915+ it->second .is_flush_pending = true ;
916+ }
917+ }
918+
910919 return ;
911920 }
912921 else if (op == " PORT" )
@@ -1071,6 +1080,20 @@ void FdbOrch::flushFDBEntries(sai_object_id_t bridge_port_oid,
10711080 {
10721081 SWSS_LOG_ERROR (" Flushing FDB failed. rv:%d" , rv);
10731082 }
1083+
1084+ if (SAI_STATUS_SUCCESS == rv) {
1085+ for (map<FdbEntry, FdbData>::iterator it = m_entries.begin ();
1086+ it != m_entries.end (); it++)
1087+ {
1088+ if ((bridge_port_oid != SAI_NULL_OBJECT_ID &&
1089+ it->second .bridge_port_id == bridge_port_oid) ||
1090+ (vlan_oid != SAI_NULL_OBJECT_ID &&
1091+ it->first .bv_id == vlan_oid))
1092+ {
1093+ it->second .is_flush_pending = true ;
1094+ }
1095+ }
1096+ }
10741097}
10751098
10761099void FdbOrch::notifyObserversFDBFlush (Port &port, sai_object_id_t & bvid)
0 commit comments