Skip to content

Conversation

@kamleshbhalui
Copy link
Owner

No description provided.


// 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.
Copy link
Collaborator

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.

Copy link
Collaborator

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.

Copy link
Owner Author

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);

Copy link
Collaborator

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.

Copy link
Owner Author

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?

Copy link
Owner Author

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__

Copy link
Collaborator

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.

Copy link
Collaborator

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

Copy link
Owner Author

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.

@kamleshbhalui kamleshbhalui requested a review from hanw March 10, 2022 12:12
@kamleshbhalui kamleshbhalui force-pushed the meter_method branch 2 times, most recently from 6a93cc4 to ff8e4c6 Compare March 11, 2022 08:38
Copy link
Collaborator

@hanw hanw left a 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"]
Copy link
Collaborator

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;

Copy link
Collaborator

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.

@kamleshbhalui kamleshbhalui force-pushed the meter_method branch 2 times, most recently from b52a4c0 to 1b6767b Compare May 6, 2022 10:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants