Skip to content

[meta] Keep hostif trap custom-range base values in enum metadata - #2373

Closed
AnantKishorSharma wants to merge 1 commit into
opencomputeproject:masterfrom
AnantKishorSharma:meta-hostif-trap-custom-range
Closed

AnantKishorSharma wants to merge 1 commit into
opencomputeproject:masterfrom
AnantKishorSharma:meta-hostif-trap-custom-range

Conversation

@AnantKishorSharma

Copy link
Copy Markdown

Description:

meta/parse.pl strips every *_RANGE_BASE enumerator from an enum's generated
allowed-values array (they are internal range markers, removed in #1038). For
sai_hostif_trap_type_t this also removes the user-facing custom-range bases
(SWITCH/ROUTER/LOCAL_IP _CUSTOM_RANGE_BASE), which are valid
SAI_HOSTIF_TRAP_ATTR_TRAP_TYPE values used to create custom traps (base + offset). As a
result sai_metadata_is_allowed_enum_value() returns false for them and
meta_generic_validation_create() rejects create_hostif_trap() for any custom-range
trap type with SAI_STATUS_INVALID_PARAMETER.

Fixes #2372

Fix:

Keep the hostif-trap custom-range bases in the allowed-values while still stripping the
internal *_RANGE_BASE markers of all other enums:

-        @values = grep(!/^SAI_\w+(RANGE_BASE)$/, @values);
+        @values = grep(!/^SAI_\w+(RANGE_BASE)$/ || /^SAI_HOSTIF_TRAP_TYPE_\w*CUSTOM_RANGE_BASE$/, @values);

Only sai_hostif_trap_type_t is affected (valuescount +3 for SWITCH/ROUTER/LOCAL_IP);
stat/type/other enums are unchanged.

Verification:

  • make -C meta regenerates saimetadata.c;
    sai_metadata_enum_sai_hostif_trap_type_t.valuescount increases by 3 and the three
    custom-range bases appear in the allowed-values / name arrays. No other enum changes.
  • create_hostif_trap() with a custom-range TRAP_TYPE now passes
    meta_generic_validation_create().

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

@AnantKishorSharma

Copy link
Copy Markdown
Author

Hi @kcudnik , could you please help review this? Thanks!

Signed-off-by: Anant Kishor Sharma <anant.kishor-sharma@hpe.com>
@AnantKishorSharma
AnantKishorSharma force-pushed the meta-hostif-trap-custom-range branch from bbf66e6 to 5bf4a36 Compare October 22, 2026 00:52

@kcudnik kcudnik left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Please close this PR as it's not needed, please see my comment in Issiue you created

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[meta] Custom-range hostif trap types are stripped from metadata, blocking create_hostif_trap

2 participants