Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

accept PSA_MeterColor_t in action parameter #3365

Merged
merged 1 commit into from
Jun 1, 2022

Conversation

kamleshbhalui
Copy link
Contributor

No description provided.

addActionDataField(
dataJson, param.id(), param.name(), true /* mandatory */,
false /* read_only */, makeTypeBytes(param.bitwidth()), annotations);
if (param.type_name().name() == "PSA_MeterColor_t") {
Copy link
Contributor

Choose a reason for hiding this comment

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

it may be safer to check the type of the parameter as obtained from the typeMap (the canonical type).
This may not work if the type is a typedef (unless the midend actually eliminates typedefs).
You should probably add a test for this case.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

bfrt generation happens before midend.

@@ -973,20 +973,24 @@ class P4RuntimeAnalyzer {
auto paramType = typeMap->getType(actionParam, true);
if (!paramType->is<IR::Type_Bits>() && !paramType->is<IR::Type_Boolean>()
&& !paramType->is<IR::Type_Newtype>() &&
!paramType->is<IR::Type_SerEnum>()) {
!paramType->is<IR::Type_SerEnum>() && !paramType->is<IR::Type_Enum>()) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

type already checked while generating p4info here.

@kamleshbhalui
Copy link
Contributor Author

@mbudiu-vmw please review it.

@mihaibudiu mihaibudiu merged commit 1b102f9 into p4lang:main Jun 1, 2022
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.

2 participants