-
Notifications
You must be signed in to change notification settings - Fork 0
Dpdk always require packet len for Meter's method execute() #8
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
base: main
Are you sure you want to change the base?
Conversation
5a17433 to
bdbed1c
Compare
p4include/dpdk/psa.p4
Outdated
|
|
||
| // DPDK does not support PACKETS metering if testcases still use | ||
| // packets metering type compiler converts it to bytes metering | ||
| // Hence execute method below always require pkt_len 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.
I think a cleaner design would be to create a Meter that is specifically designed for DPDK.
extern DPDKMeter<S> {
DPDKMeter(bit<32> n_meters, PSA_MeterType_t type);
PSA_MeterColor_t execute(in S index, in PSA_MeterColor_t color, in bit<32> pkt_len);
}
In the dpdk backend, you can check if the P4 program uses the vanilla Meter extern. If so, report an error and suggest customer to use the DPDKMeter instead.
In addition, if we introduce DPDKMeter, we wouldn't need this PR that I did last year: p4lang#2818 and the dpdk/psa.p4 file would only contain the DPDK specific extern definition, instead of duplicating the entire psa.p4 file again. That would be a much cleaner solution.
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.
Portability is not achievable with the current meter implementation in dpdk, We should make that explicit, instead of pretending the program is portable by supporting a slight variant of the Meter extern that is actually 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.
Should we have DPDKCounter too? Because PSA spec forbid the 2nd argument for count but dpdk adds a extra optional parameter increment?
void count(in S index, @optional in bit<32> increment);
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, DPDKCounter as well.
Please consider deduplicate the dpdk/psa.p4, revert the open-source p4c to contain only one copy of psa.p4 file, and add dpdk/psa-ext.p4 for dpdk specific extensions.
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 the user explicitly have to include dpdk/psa-ext.p4 in the p4 program?
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.
or we should do something like this?
// for target specific extensions
#if defined(__TARGET_DPDK__)
#include "dpdk/psa_ext.p4"
#elif defined(__TARGET_BMV2__)
#include "bmv2/psa_ext.p4"
#else
// to get rid of unknown identifier when compile with p4test
#include "dpdk/psa_ext.p4"
#include "bmv2/psa_ext.p4"
#endif // __TARGET_DPDK__
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.
bmv2 should be able to implement the standard psa.p4, there is no reason to extend psa.p4 for bmv2. DPDK is a target with specific limitation, so it would require extension to meter and counter. p4test is also generic enough that it could use the standard psa.p4 as well.
the directory structure should look like
p4include/psa.p4
p4include/dpdk/psa_ext.p4
p4include/v1model.p4
you can remove the p4include/bmv2/ directory, and revert the PR I mentioned above.
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.
If user program uses DPDKMeter or DPDKCounter, then it needs to include dpdk/psa_ext.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.
All the suggestions incorporated, please review again.
bdbed1c to
d45b2d7
Compare
6a93cc4 to
ff8e4c6
Compare
hanw
left a comment
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 to me
| @@ -55,217 +55,6 @@ | |||
| "data" : [], | |||
| "supported_operations" : [], | |||
| "attributes" : ["EntryScope"] | |||
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.
We will have to add support for DpdkMeter and DpdkCounter in bfRT json and P4info.
| } | ||
|
|
||
| V1Switch<H, M>(ParserI(), VerifyChecksumI(), IngressI(), EgressI(), ComputeChecksumI(), DeparserI()) 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.
These are unrelated changes. Please remove it while creating public PR.
b52a4c0 to
1b6767b
Compare
target specific extension included in common psa.p4 based on backend determined by macros.
this needs(backends/dpdk/control-plane/proto/p4info_config_v1.proto) to be moved to p4runtime with name p4info.proto
1b6767b to
f98befe
Compare
No description provided.