-
Notifications
You must be signed in to change notification settings - Fork 334
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
ERROR: Table '_____' is invoked multiple times. #231
Comments
You have at least three options:
1) [BEST] Restructure your code. Looks like "ecmp_group" and "forward"
are both applied in both cases so just move them so that they are
invoked after the conditional blocks.
2) [OK] Make functionally equivalent copies of ecmp_group and forward,
with new names. This is not so great because you'll have more table
entries to manage but performance-wise this should work fine.
3) [NOT RECOMMENDED] Make use of the 'resubmit' primitive to sidestep
the 'invoke each table only once' limitation. Throughput will take a
hit, with the performance penalty depending on how often the resubmit is
triggered.
…--David
On 11/25/2016 08:54 PM, Raymondma-public wrote:
I face to a problem that when I am going to do the same thing in
different switch role I defined.
I have read the following and know that applying a table multiple
times is normally not allowed.
http://lists.p4.org/pipermail/p4-dev_lists.p4.org/2016-June/000388.html
But in my case I will only invoke a table for once for different
switch role.
Would there be any solution for my case to reduce duplication of P4
code and switch commands?
P4 Code:
|if(user_metadata.switch_role==0){ //ECMP if(valid(ipv4) and ipv4.ttl >
0) { apply(ecmp_group); apply(forward); } }else
if(user_metadata.switch_role==1){//Expeditus-ToR //the counter show P4
recgonized SYN if(tcp.ctrl==TCP_SYN){ apply(increment_SYN_table);
apply(expeditus_header_table); apply(ecmp_group); apply(forward); } } |
Error:
|ERROR: Table 'ecmp_group' is invoked multiple times.|
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#231>, or mute the
thread
<https://github.com/notifications/unsubscribe-auth/AO6YA4K0PliVXg06M7n5y7d-i7fWYn5Jks5rB61tgaJpZM4K8zLg>.
|
For the first option. |
Maybe. But perhaps you can write sufficiently complex boolean logic
that identifies all of the roles that *do* contain ecmp_group and
forward so that you only apply those tables for those roles. In other
words, you have not convinced me that your code can't be restructured so
that each table is only invoked once in your program. But you know your
project best, so if restructuring isn't possible, go for the second option.
…--David
On 11/28/2016 06:00 AM, Raymondma-public wrote:
For the first option.
Indeed I will have some more roles that do not contain those
"ecmp_group" and "forward". So does it mean I should use the second
option that copy the tables and commands to new one with different name?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#231 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AO6YAzDoJtw9LUXmT_gRbGLJpratOxoLks5rCtBsgaJpZM4K8zLg>.
|
Just adding some more info to @dhankook answer. In theory, the compiler and software switch should allow you to invoke the same table from 2 different places in the control flow, providing the 2 invocations are mutually exclusive (i.e. the same packet cannot go through the same table twice). However, because of the way we process the control flow in the current P4 compiler (we transform it into a table graph), it is actually pretty difficult to allow this, so we just throw an error if the same table is "applied" twice. While there is no immediate plan to fix this in the current compiler, we are hoping the next compiler (for P4_16) will not have this limitation. Regarding your specific use case, I'd like to point out that most people will probably achieve different roles by writing different P4 programs and swapping the programs on the target as needed. This can be done in bmv2 through the runtime CLI. When you include all your roles in a single P4 program, you may limit the amount of physical resources available for each role. While in bmv2 your programs can be arbitrarily complex, this won't be the case for hardware P4 targets. |
I face to a problem that when I am going to do the same thing in different switch role I defined.
I have read the following and know that applying a table multiple times is normally not allowed.
http://lists.p4.org/pipermail/p4-dev_lists.p4.org/2016-June/000388.html
But in my case I will only invoke a table for once for different switch role.
Would there be any solution for my case to reduce duplication of P4 code and switch commands?
P4 Code:
Error:
ERROR: Table 'ecmp_group' is invoked multiple times.
The text was updated successfully, but these errors were encountered: