-
Notifications
You must be signed in to change notification settings - Fork 0
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
tc_may_override annotation implementation #4
Conversation
4bbf2bb
to
5fef734
Compare
@Sosutha question:
This syntax will be fine if we had another table ipv4_tbl_2 and therefore we could say: Assuming the ebpf code will generate different variables for the two default values so we can override them. Currently for one of them you would have in testdata/p4tc_samples_outputs/tc_may_override_example_01_parser.h:
Assuming this (P4) scenario is legit and above would work, it would require some change from our side.
note the "flags runtime" is move to the action creation line above. With this approach there is no need for any change from our side. |
@jhsmt, It is possible for two P4 tables to have same default action with different values.
Please confirm. |
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.
Looks Good
Confirmed.. |
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.
Looks fine to me
@@ -354,29 +354,52 @@ void ConvertToBackendIR::updateDefaultMissAction(const IR::P4Table *t, IR::TCTab | |||
if (defaultActionProperty->isConstant) { | |||
tabledef->setDefaultMissConst(true); | |||
} | |||
auto annoList = defaultActionProperty->getAnnotations()->annotations; | |||
bool isTCMayOverride = false; |
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.
getSingle function shall be used instead of the loop.
overrideAnno = defaultActionProperty->getAnnotations()->getSingle(ParseTCAnnoations::tcMayOverride)
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.
Updated the code
5fef734
to
e173ee5
Compare
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.
Looks fine
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.
Looks good
cstring tblName = table->getTableName(); | ||
cstring defaultActionName = table->defaultMissAction->getActionName(); | ||
auto actionNameStr = defaultActionName.c_str(); | ||
for (long unsigned int i = 0; i < defaultActionName.size(); 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.
Why use long unsigned int? long and int are both 4 bytes
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.
Compiler issues warning because of the return type of size() function
backends/tc/tc.def
Outdated
@@ -231,12 +265,18 @@ class TCTable { | |||
void setDefaultMissConst(bool i) { | |||
isDefaultMissConst = i; | |||
} | |||
void setTcMayOverride(bool 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.
Are you setting this with value other than "true". Is the argument needed?
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.
Updated the function without argument
backends/tc/tc.def
Outdated
@@ -309,9 +350,12 @@ class TCTable { | |||
tcTable += " permissions 0x1024"; | |||
} | |||
tcTable += " action " + defaultMissAction->getName(); | |||
for (auto param : defaultMissActionParams) { | |||
if (!defaultMissActionParams.empty()) | |||
tcTable += " param"; |
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.
indentation within if is incorrect
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.
Updated the code
e173ee5
to
38ff070
Compare
* tc_may_override annotation for tc backend * Added testcases for annotation
38ff070
to
9b0ec6b
Compare
@Sosutha i just noticed one thing, for this situation the action value should be retrieved from struct p4tc_filter_fields.
should be:
Sorry for not catching this sooner.. |
@jhsmt Jamal, I will implement this change in separate PR. I have already raised opensource PR for this implementation. |
@jhsmt , could you please clarify the query for proceeding with the implementation of the change |
@Sosutha I apologize I thought i responded. Sure lets have a second PR for the fix. |
@jhsmt I have a query regarding this change. These statements will be executed for table entries which have this next_hop action as designated action for that entry and also for default action when there is no action given. Will this change hold fine for both the cases? When these statements gets executed for table entries that have this action, Will p4tc_filter_fields.ipv4_tbl_1_next_hop_vport hold the correct value for that entry, not the value->u.MainControlImpl_next_hop.vport? |
@Sosutha excellent catch. So if the value is for the default miss/hit action then the earlier switch statement we discussed i.e.
changes to:
But i would say the if statement is only necessary if we have a case such as this where the action is used both in the table entry and as a default hit/miss action |
@jhsmt We can generate if statement as you suggested. But so far all the implementation done related to default action has considered only default_miss action. For default_hit action( specific only to tc), we need to a similar implementation with different design. Since default_hit is annotation based and default_miss was statement based, Different design is needed for default_hit. In order to complete default_miss implementation fully, I will make the change you proposed in one PR. In that we can have implementation for if statement as below
For default_hit related changes, we can have separate PR. I will propose design related to default_hit annotation in the issue https://github.com/p4tc-dev/p4tc-e2e/issues/60. Please confirm |
Confirmed for this and for p4tc-dev/p4tc-e2e#60 |
#1 (comment)