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

DPDK Backend: Insert table keys generated by compiler closer to the standard and user metadata #3160

Merged
merged 9 commits into from
Apr 2, 2022

Conversation

usha1830
Copy link
Contributor

DPDK needs all the table keys to come from single structure and all the table keys should fit within 64 bytes inclusive of all holes in between.

For ex: The below program will fail to load onto DPDK pipeline because the gap between two table keys is more than 64 bytes.

struct metadata {
   bit<8> tmp1;
   ...
   ...
   // more fields summing up to >=64 bytes
   ...
   bit <8> tmp2;
}

control{
   table {
      key = {
              tmp1 : exact;
               tmp2 : exact;
         }
    …
   }
   …
}

This PR inserts the table keys generated by the compiler right after the standard and user metadata to keep them closer to the metadata fields which can possibly be the table keys in the user program.

if (max == -1 || max < offset) {
max = offset;
auto field_type = key->expression->type;
if (auto t = field_type->to<IR::Type_Bits>()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

you may want to make this a utility function

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@usha1830
Copy link
Contributor Author

usha1830 commented Apr 2, 2022

@mbudiu-vmw Addressed the comments. Please merge if the changes look fine.

@mihaibudiu mihaibudiu merged commit e1ce01b into p4lang:main Apr 2, 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