Skip to content
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

Merged
merged 11 commits into from
Nov 11, 2022
Prev Previous commit
Next Next commit
added comments and improve readme
  • Loading branch information
kamleshbhalui committed Nov 11, 2022
commit 37d5b9e850154655705a7f588017c0e715d6d6f3
2 changes: 1 addition & 1 deletion backends/dpdk/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ 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 as defined in PSA and PNA, it requires packet length in methods count and execute which are part of Counter and Meter externs. Adding param ``` in bit<32> pkt_len``` to execute (part of Meter extern) leads to overload resolution failure due to ambiguous candidates, as p4c do overload resolution based on number of parameter and does not consider types. To workaround this we introduced new method in Meter extern `dpdk_execute` which has extra param.
- 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
Copy link
Contributor

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?

Copy link
Contributor

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.

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

Copy link
Contributor

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.

PNA_MeterColor_t dpdk_execute(in S index, in PNA_MeterColor_t color, in bit<32> pkt_len);
```
Expand Down
5 changes: 5 additions & 0 deletions p4include/dpdk/pna.p4
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,11 @@ extern Meter<S> {
// RFC 2698). The color of the packet before the method call was
// made is specified by the color parameter.
PNA_MeterColor_t execute(in S index, in PNA_MeterColor_t color);
// Adding param `in bit<32> pkt_len` to execute (part of Meter extern)
// leads to overload resolution failure due to ambiguous candidates,
// as p4c do overload resolution based on number of parameter and does
// not consider types. To workaround this we introduced new method in
// Meter extern `dpdk_execute` which has extra param.
PNA_MeterColor_t dpdk_execute(in S index, in PNA_MeterColor_t color, in bit<32> pkt_len);

// Use this method call to perform a color blind meter update (see
Expand Down
5 changes: 5 additions & 0 deletions p4include/dpdk/psa.p4
Original file line number Diff line number Diff line change
Expand Up @@ -667,6 +667,11 @@ extern Meter<S> {
// RFC 2698). The color of the packet before the method call was
// made is specified by the color parameter.
PSA_MeterColor_t execute(in S index, in PSA_MeterColor_t color);
// Adding param `in bit<32> pkt_len` to execute (part of Meter extern)
// leads to overload resolution failure due to ambiguous candidates,
// as p4c do overload resolution based on number of parameter and does
// not consider types. To workaround this we introduced new method in
// Meter extern `dpdk_execute` which has extra param.
PSA_MeterColor_t dpdk_execute(in S index, in PSA_MeterColor_t color, in bit<32> pkt_len);

// Use this method call to perform a color blind meter update (see
Expand Down