-
Notifications
You must be signed in to change notification settings - Fork 94
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
[libsai] Re-implement APIs create/remove #653
Conversation
/azp run |
Commenter does not have sufficient privileges for PR 653 in repo sonic-net/DASH |
d7f18a9
to
28dabbe
Compare
/azp run |
Commenter does not have sufficient privileges for PR 653 in repo sonic-net/DASH |
/azp run |
Commenter does not have sufficient privileges for PR 653 in repo sonic-net/DASH |
5c2bc0b
to
6b8b884
Compare
/azp run |
Commenter does not have sufficient privileges for PR 653 in repo sonic-net/DASH |
6b8b884
to
8b334c3
Compare
/azp run |
Commenter does not have sufficient privileges for PR 653 in repo sonic-net/DASH |
dash-pipeline/SAI/src/p4meta.cpp
Outdated
{ | ||
for (auto i=0u; i<keys.size(); i++) { | ||
if (key_name == keys[i].name) { | ||
return &keys[i]; | ||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
over entire PR incosistent placemtn { once in end of function once in new line, over all project has { in new line
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
8b334c3
to
93e8cca
Compare
/azp run |
Commenter does not have sufficient privileges for PR 653 in repo sonic-net/DASH |
/azp run |
Commenter does not have sufficient privileges for PR 653 in repo sonic-net/DASH |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this change looks good to me! do you mind to add an example of the generated sibling table related metadata into the PR description? It will be great for people to understand the change.
dash-pipeline/SAI/src/dashsai.cpp
Outdated
|
||
for (uint32_t i = 0; i < attr_count; i++) | ||
{ | ||
if (auto meta_param = meta_table.get_meta_action_param(action_id, attr_list[i].id)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will be better to move the assignment out of the if. this code pattern is easy to go wrong in general.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
} | ||
|
||
std::shared_ptr<p4::v1::TableEntry> entry = std::make_shared<p4::v1::TableEntry>(); | ||
entry->CopyFrom(*matchActionEntry); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will be better to add a comment here to indicate all key and attribute index/id are the same.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
only the action is different.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added comments
/azp run |
Commenter does not have sufficient privileges for PR 653 in repo sonic-net/DASH |
Updated PR description to have the generated sibling tables for acl rule. |
Following #651, refactor APIs create/remove for easier read and maintenance:
DashSai::create
andDashSai::remove
to implement them for all SAI objects/entriesThe generated sample code of APIs create/remove attribute is as below:
SAI object objectID
SAI object entry
For the case of acl rule object, one acl rule is inserted into multiple p4 tables in different stages. These p4 stage tables are same and the only difference is
table id
andtable action id
in table entry, captured in struct P4MetaSiblingTable:The generated code of sibling tables for acl rule is as below: