Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 33 additions & 16 deletions meta/Meta.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1685,27 +1685,45 @@ sai_status_t Meta::flushFdbEntries(
{
// use same logic as notification, so create notification event

sai_fdb_event_notification_data_t data = {};
std::vector<int32_t> types;

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);
auto *et = sai_metadata_get_attr_by_id(SAI_FDB_FLUSH_ATTR_ENTRY_TYPE, attr_count, attr_list);

sai_attribute_t list[2];
if (et)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is someone specifies the type but sets it to TYPE_ALL?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

already fixed in my next commit

{
types.push_back(et->value.s32);
}
else
{
// no type specified so we need to flush static and dynamic entries

list[0].id = SAI_FDB_ENTRY_ATTR_BRIDGE_PORT_ID;
list[0].value.oid = bp_id ? bp_id->value.oid : SAI_NULL_OBJECT_ID;
types.push_back(SAI_FDB_ENTRY_TYPE_DYNAMIC);
types.push_back(SAI_FDB_ENTRY_TYPE_STATIC);
}

list[1].id = SAI_FDB_ENTRY_ATTR_TYPE;
list[1].value.s32 = et ? et->value.s32 : SAI_FDB_FLUSH_ENTRY_TYPE_ALL;
for (auto type: types)
{
sai_fdb_event_notification_data_t data = {};

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;
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);

meta_sai_on_fdb_flush_event_consolidated(data);
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;
Expand Down Expand Up @@ -6976,8 +6994,7 @@ void Meta::meta_sai_on_fdb_flush_event_consolidated(
continue;
}

if ((type->value.s32 != SAI_FDB_FLUSH_ENTRY_TYPE_ALL) &&
(fdbTypeAttr->getSaiAttr()->value.s32 != type->value.s32))
if (fdbTypeAttr->getSaiAttr()->value.s32 != type->value.s32)
{
// entry type is not matching on this fdb entry
continue;
Expand Down