Skip to content

Commit

Permalink
[meta] Make sai switch pointers attr list stable (#2111)
Browse files Browse the repository at this point in the history
Will make sure attr list contains attributes which id is increasing
  • Loading branch information
kcudnik authored Nov 22, 2024
1 parent 13e1953 commit 4820582
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion meta/parse.pl
Original file line number Diff line number Diff line change
Expand Up @@ -5188,7 +5188,7 @@ sub CreateSwitchPointersAttributesList
my @pointers = keys %NOTIFICATIONS;
push @pointers, values %ATTR_TO_CALLBACK;

for my $name (sort @pointers)
for my $name (GetSwitchPointersInOrder(@pointers))
{
next if not $name =~ /^sai_(\w+)_fn/;

Expand Down
6 changes: 6 additions & 0 deletions meta/saisanitycheck.c
Original file line number Diff line number Diff line change
Expand Up @@ -5499,9 +5499,15 @@ void check_switch_pointers_list()

size_t i;

sai_attr_id_t id = 0;

for (i = 0; i < sai_metadata_switch_pointers_attr_count; ++i)
{
META_ASSERT_NOT_NULL(sai_metadata_switch_pointers_attr[i]);

META_ASSERT_TRUE(id <= sai_metadata_switch_pointers_attr[i]->attrid, "sai_metadata_switch_pointers_attr attr pointers expected to increase")

id = sai_metadata_switch_pointers_attr[i]->attrid;
}

/* check for NULL guard */
Expand Down

0 comments on commit 4820582

Please sign in to comment.