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

Extracting Packet Payload for Checksum Offload in P4 (XSA Architecture) #5129

Open
vijayaKesavan19 opened this issue Feb 17, 2025 · 3 comments
Labels
question This is a topic requesting clarification.

Comments

@vijayaKesavan19
Copy link

Hi,

I am working on integrating the VitisNetP4 IP into the OpenNIC design using the XSA architecture. As part of this process, I need to implement checksum offloading in P4.

The IPv4 checksum is working correctly since it does not require access to the packet payload. However, when attempting to compute the checksum for TCP/UDP packets, which require payload access, I am unable to extract the necessary data.

Could you please guide me on how to extract the packet payload using P4 in the XSA architecture? Additionally, if you have any example code related to this, I would appreciate it.

@jafingerhut
Copy link
Contributor

@thomascalvert-xlnx Is this something you know about, or can forward to someone who does?

It is not clear to me whether this issue has anything to do with published code in the p4c repo, or is purely related to implementation of an architecture that is not in this repo at all.

@ChrisDodd
Copy link
Contributor

ChrisDodd commented Feb 17, 2025

Usually the TCP checksum is calculated by differential over the header, without looking at the payload -- compute the checksum over the incoming headers (assuming the checksum there is correct) and subtracting it from the checksum over the outgoing headers. This should give an outgoing packet with a correct checksum iff the checksum on the incoming packet was correct.

This is a general approach used on P4 for most architectures, not specific to XSA or any other specific architecture.

@fruffy fruffy added the question This is a topic requesting clarification. label Feb 18, 2025
@thomascalvert-xlnx
Copy link
Member

@vijayaKesavan19 according to the official documentation, VitisNetP4 supports the standard Checksum and InternetChecksum externs but these can't be used for checksumming the payload:

This extern [...] is primarily intended for IPv4 checksum calculations. It can also be used for UDP checksum updates, but not full UDP checksum calculations as the calculation over the packet payload is not supported.

In any case, this p4c repository does not support XSA. Is your project in collaboration with a team from AMD/Xilinx? It may be worth contacting them to request a roadmap item. Alternatively you could look to implement a custom extern or augment the existing ones to allow checksumming over the payload.

@ChrisDodd the incremental strategy won't work in the case of a NIC which is expected to offload the full checksum computation from the host (assuming this is indeed the goal here).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question This is a topic requesting clarification.
Projects
None yet
Development

No branches or pull requests

5 participants