-
Notifications
You must be signed in to change notification settings - Fork 448
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
create dpdk specific pna.p4 and extend it #3658
Conversation
This is as per p4lang/pna#49 (comment) |
@@ -533,7 +533,8 @@ enum PSA_CounterType_t { | |||
@noWarn("unused") | |||
extern Counter<W, S> { | |||
Counter(bit<32> n_counters, PSA_CounterType_t type); | |||
void count(in S index, @optional in bit<32> increment); | |||
void count(in S index); |
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.
What does DPDK do when a PSA program calls the original count
method that does not have a pkt_len parameter? Nothing? It would be good to have a comment here if it does anything other than what PSA defines.
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.
And also for the corresponding method in the DirectCounter extern. And for Meter and DirectMeter.
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 the comments
@@ -1,5 +1,5 @@ | |||
#include <core.p4> | |||
#include <pna.p4> | |||
#include <dpdk/pna.p4> |
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.
For PSA, I thought we had something in the p4c-dpdk front end script that made it automatically look in the dpdk directory for the psa.p4 include file, so that P4 developers could simply write #include <psa.p4>
and it would find it in the p4include/dpdk
directory. It would be nice to do the same for p4c-dpdk for PNA architecture programs.
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.
yes it only works for p4c-dpdk
but not with p4test
. When running tests(make check) every testfiles compiles with p4test
and p4c-dpdk
.
0dda52c
to
c91c47f
Compare
@@ -33,7 +33,6 @@ struct main_metadata_t { | |||
bit<8> local_metadata_timeout | |||
bit<32> local_metadata_port_out | |||
bit<32> pna_main_output_metadata_output_port | |||
bit<32> table_entry_index |
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 is a valid test for Direct Meter for tables with add_on_miss. These instructions/metadata field shouldn't be removed
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
backends/dpdk/dpdkArch.cpp
Outdated
@@ -2526,7 +2526,7 @@ bool CollectDirectCounterMeter::preorder(const IR::P4Table* tbl) { | |||
return false; | |||
} | |||
} | |||
if (!ifMethodFound(defaultActionDecl, "execute", meterExternName)) { | |||
if (!ifMethodFound(defaultActionDecl, "dpdk_execute", meterExternName)) { | |||
if (meterInstance) { | |||
::error(ErrorType::ERR_EXPECTED, "Expected default action %1% to have " | |||
"'execute' method call for DirectMeter extern instance %2%", |
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.
'execute' ->'dpdk_execute'
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.
Same name change is required in P4Action preorder
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.
done
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 now
70673df
to
c307557
Compare
c307557
to
47f8274
Compare
|
||
IngressPipeline(IngressParserImpl(), ingress(), IngressDeparserImpl()) ip; | ||
EgressPipeline(EgressParserImpl(), egress(), EgressDeparserImpl()) ep; | ||
PSA_Switch(ip, PacketReplicationEngine(), ep, BufferingQueueingEngine()) main; |
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 is the expected output file testdata/p4_16_samples_outputs/psa-example-dpdk-meter-execute-err.p4-stderr empty? I thought these changes claimed to give an error message if you tried to call the execute method without a packet length parameter? Doesn't it?
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.
@jafingerhut
Once #3680 is merged, we will move this test to p4_16_dpdk_errors directory and then the error output will also be fixed. Currently, it is added in XFAIL as all other negative tests
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.
sounds good
@@ -74,6 +74,13 @@ In P4 the second argument of the extract method is the number of bits. | |||
Compiler generates instructions which compute the size in bytes from the value in bits. | |||
If the value in bits is not a multiple of 8, the value is rounded down to the lower | |||
multiple of 8 bits. | |||
- Currently dpdk target does not support standard count and execute methods for Counter and Meter externs as defined in PSA and PNA specifications. It requires packet length as parameter in count and execute methods. | |||
```Meter |
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.
Does DPDK development have any plans in the future to support the standard count and execute methods, without a packet length parameter?
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.
There is no plan in the near future. There was an earlier discussion of providing ethernet frame size as default packet length, however it seems that it wouldn't be correct as DPDK implements trCM which do not work on ethernet frame length.
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.
"which do not work on ethernet frame length" Meters/policers can work on whatever length in bytes you give for a packet, whether it matches the packet's length or not, so it isn't clear to me what your statement means. If DPDK implements meters by default with ethernet frame length, then I would recommend enabling them to do so, and DOCUMENTING that the methods that do not take a packet length as input, use the ethernet frame length in bytes. If they work as documented, then I'd say that they work :-)
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.
I will take this up with the DPDK target team again and see if they can have this in their worklist. We can enable the p4c support when we have the default packet length available from the target side.
47f8274
to
e7f10e0
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.
With the future plans for additional changes later mentioned in comments, this looks good to me.
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.
LGTM Adding review from my Github account that has write permission this time.
as required by dpdk target
e7f10e0
to
cf29965
Compare
@jfingerh please merge it. |
dpdk target requires packet length in
count
andexecute
methods part ofCounter
andMeter
externs.