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

Implementation of Common Functionality #17

Merged
merged 8 commits into from
Aug 18, 2023
Merged

Conversation

jkoeppeler
Copy link
Contributor

Adding new commands to the psa ebpf backend in p4rrot.

  • Random Number Generator
  • Hash Functions
  • Timestamp

Jonas Köppeler and others added 6 commits July 15, 2023 16:35
Adds the AssignRandomValue command. To get a
random value in the PSA architecture you need
to instatiate a random value generator in the
a_declarations section. This is achieved by
declaring it as a state variable. To get a random
value only the variable and the name of the random
number genrator need to be supplied to the
AssignRandomValue constructor. This will end up to
call the read method of the rng.
This helps when testing hashes and other methods where the output might be non-readable acii.
this command assigns the hash of source-variable to the target-variable
execute is note yet implemented

adds simple test for CRC32
Adding GetTimestamp command. According to PSA specification
the width of the Timestamp_t data type is dependent on the
implementation. In case of ebpf this is a u64. Defined in psa.h
A new data type is added to P4rrot because otherwise the p4c compiler
complains.
@gycsaba96
Copy link
Collaborator

Hi Jonas and Alex,

Could you please add some examples for the random number generator and the timestamping? The main goal is to show how to use them and ensure that the generated code compiles. (You do not need to create test packets.)

Thank you in advance!

@jkoeppeler
Copy link
Contributor Author

Hi Csaba,
I added the tests and examples. Further I changed the function signature of AssignRandomValue to match the V1model's signature.

@gycsaba96 gycsaba96 merged commit 2b2be75 into Team-P4RROT:main Aug 18, 2023
6 checks passed
gycsaba96 pushed a commit that referenced this pull request Sep 27, 2023
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.

2 participants