diff --git a/meta/Meta.cpp b/meta/Meta.cpp index 7bd275e77dc9..354b8c7f1f05 100644 --- a/meta/Meta.cpp +++ b/meta/Meta.cpp @@ -1683,7 +1683,61 @@ sai_status_t Meta::flushFdbEntries( if (status == SAI_STATUS_SUCCESS) { - SWSS_LOG_WARN("TODO, remove all matching fdb entries here, currently removed in FDB notification"); + // use same logic as notification, so create notification event + + std::vector types; + + auto *et = sai_metadata_get_attr_by_id(SAI_FDB_FLUSH_ATTR_ENTRY_TYPE, attr_count, attr_list); + + if (et) + { + switch (et->value.s32) + { + case SAI_FDB_FLUSH_ENTRY_TYPE_DYNAMIC: + types.push_back(SAI_FDB_ENTRY_TYPE_DYNAMIC); + break; + + case SAI_FDB_FLUSH_ENTRY_TYPE_STATIC: + types.push_back(SAI_FDB_ENTRY_TYPE_STATIC); + break; + + default: + types.push_back(SAI_FDB_ENTRY_TYPE_DYNAMIC); + types.push_back(SAI_FDB_ENTRY_TYPE_STATIC); + break; + } + } + else + { + // no type specified so we need to flush static and dynamic entries + + types.push_back(SAI_FDB_ENTRY_TYPE_DYNAMIC); + types.push_back(SAI_FDB_ENTRY_TYPE_STATIC); + } + + for (auto type: types) + { + sai_fdb_event_notification_data_t data = {}; + + auto *bv_id = sai_metadata_get_attr_by_id(SAI_FDB_FLUSH_ATTR_BV_ID, attr_count, attr_list); + auto *bp_id = sai_metadata_get_attr_by_id(SAI_FDB_FLUSH_ATTR_BRIDGE_PORT_ID, attr_count, attr_list); + + sai_attribute_t list[2]; + + list[0].id = SAI_FDB_ENTRY_ATTR_BRIDGE_PORT_ID; + list[0].value.oid = bp_id ? bp_id->value.oid : SAI_NULL_OBJECT_ID; + + list[1].id = SAI_FDB_ENTRY_ATTR_TYPE; + list[1].value.s32 = type; + + data.event_type = SAI_FDB_EVENT_FLUSHED; + data.fdb_entry.switch_id = switch_id; + data.fdb_entry.bv_id = (bv_id) ? bv_id->value.oid : SAI_NULL_OBJECT_ID; + data.attr_count = 2; + data.attr = list; + + meta_sai_on_fdb_flush_event_consolidated(data); + } } return status;