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

Move ProgramStructure out the BMv2 folder such that it can be used in other back ends. #4770

Merged
merged 1 commit into from
Jul 8, 2024

Conversation

fruffy
Copy link
Collaborator

@fruffy fruffy commented Jul 1, 2024

The ProgramStructure class in the BMv2 back end was used all across other back ends. The abstraction here was a bit leaky. I pulled it out and moved it in the "common" folder in backends. Refactoring suggestions or ideas are welcome here. There are still a bunch of leaky abstractions. The program structure class should ideally work for all back ends.

@qobilidop @rupesh-chiluka-marvell

@fruffy fruffy added bmv2 Topics related to BMv2 or v1model psa-bmv2 Topics related to the PSA BMv2 back end p4tc Topics related to the P4-TC back end labels Jul 1, 2024
@fruffy fruffy requested a review from Sosutha July 1, 2024 18:09
@fruffy fruffy force-pushed the fruffy/bmv2_program_structure branch from 957706b to 0bde3bf Compare July 1, 2024 18:24
@fruffy fruffy requested a review from jafingerhut July 1, 2024 18:41
@fruffy fruffy force-pushed the fruffy/bmv2_program_structure branch 2 times, most recently from 98dfbfd to 128f0e6 Compare July 1, 2024 21:15
@fruffy fruffy force-pushed the fruffy/bmv2_program_structure branch from 128f0e6 to accdd8e Compare July 1, 2024 22:43
Copy link
Contributor

@Sosutha Sosutha left a comment

Choose a reason for hiding this comment

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

Looks fine

@@ -58,6 +58,17 @@ class V1ModelProperties {
static const cstring validField;
};

// V1Model-specific blocks.
enum class BlockConverted {
Copy link
Contributor

@jafingerhut jafingerhut Jul 6, 2024

Choose a reason for hiding this comment

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

Is the fact that BlockConverted is v1model-specific part of what you consider the "leakiness of the abstraction" mentioned in your comment on this PR?

I am not familiar with the overall structure of the code here, but agree that lifting out common stuff seems like a good idea. I guess one question is how users of this code that are not implementing the v1model architecture replace this definition of BlockConverted with something else. Perhaps that is something you are hoping is addressed with later PRs?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Is the fact that BlockConverted is v1model-specific part of what you consider the "leakiness of the abstraction" mentioned in your comment on this PR?

Yeah, there are few other parts too. Like the meter map that needs to be part of the top level. Currently, the ProgramStructure still has elements that are v1model-specific. Rewriting code to make ProgramStructure fully generic is a little bit involved, so I am not addressing it in this PR.

@fruffy fruffy added this pull request to the merge queue Jul 8, 2024
Merged via the queue into main with commit 6edb878 Jul 8, 2024
17 checks passed
@fruffy fruffy deleted the fruffy/bmv2_program_structure branch July 8, 2024 01:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bmv2 Topics related to BMv2 or v1model p4tc Topics related to the P4-TC back end psa-bmv2 Topics related to the PSA BMv2 back end
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants