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

Extern for checksum'ing payload #13

Open
telmich opened this issue Apr 13, 2019 · 2 comments
Open

Extern for checksum'ing payload #13

telmich opened this issue Apr 13, 2019 · 2 comments

Comments

@telmich
Copy link

telmich commented Apr 13, 2019

Hello,

I have found https://github.com/NetFPGA/P4-NetFPGA-public/wiki/IP-Checksum-Extern-Function that describes one extern for computing the IPv4 checksu.

I am working on a P4 NAT64 gateway that heavily relies on computing checksums of udp, tcp, icmp6, which include the payload of the packet (see https://gitlab.ethz.ch/nicosc/master-thesis/blob/master/p4src/checksums.p4).

How would I access the payload in p4-netfpga and/or is there already any extern that already does computations over the headers + payload that could be adopted?

@sibanez12
Copy link
Collaborator

None the P4->NetFPGA externs have access to the packet payload. If you need to access the packet payload for something you have a couple options:

  1. You can implement a custom HDL module and insert it before, after, or in between P4-SDNet generated modules, by updating nf_datapath.v.
  2. P4 programs are translated into Xilinx PX programs. P4 externs are mapped onto PX user engines. User engines can actually receive the packet payload, but that functionality is not exploited by the P4-to-PX frontend. So one option you can explore is to manually edit the generated PX program to pass the packet through your user engine. Page 50 shows an example user engine with packet ports.

@telmich
Copy link
Author

telmich commented May 11, 2019

@sibanez12 thanks for the follow up! As someone who knows a bit about P4, but not much about (V)HDL - do you have some pointers on where to start if I wanted to go down the custom HDL module?

And if I go that way, is there any chance that the code will be accepted upstream?

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

No branches or pull requests

2 participants