-
Notifications
You must be signed in to change notification settings - Fork 445
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
header_union support #561
Comments
* Improve support for header unions; part 1 * def-use analysis for unions * Front-end support for unions; partial fix for #561 * cpplint fix * Fix typo/bug
I'm running into this when trying to correctly parse IPv6 extension headers and TCP options. Is there any work being done on this currently? |
Not really. What are you doing that isn't working? |
I'm parsing IPv6 extension headers and TCP options. They don't appear in a specified order, and there may even be more than one header of the same type. Some of those headers I need to modify (change checksums, change the TCP MSS option etc.). And at the end I need to emit them in the original order again. I don't see a way to do this without a stack of header unions. Basically the same use case as https://github.com/jafingerhut/p4-guide/tree/master/tcp-options-parser. What would it cost to sponsor you to get that working for P4 with BMv2-SS? Not making any promises, but I can ask my boss ;) |
One could use VarBits in P4. Define a size of VarBits you think is right for as many IPv6 options as possible. IPv6 has the next Header of the preceding header that helps index the subsequent header. Each IPv6 extension option uses a TLV format. Thus, the length is also known. |
There is no way you can sponsor me. I just have a biggish backlog of bugs that I am working on, and I prioritize them in some order based on who needs the features. What would be most useful is a simple program that does not work that we can turn into a test case. If you have inputs/outputs for the program - even better. |
That would mean letting the parser put everything in one large VarBits field, and then writing my own parser. That seems very inefficient, especially as the P4 spec has already standardised what I need... |
https://github.com/jafingerhut/p4-guide/blob/master/tcp-options-parser/tcp-options-parser.p4 seems to be a good fit :) |
I think that I am almost done with union support in bmv2. Working out the last few kinks. |
Wow, thanks! I don't know what an STF file is, but I'll read up on that |
See slide 136 of p4c/docs/compiler-design.ppts. There are several examples of such files in p4c/testdata/p4_16_samples/ |
@StefanN STF files are simple files that have input and output packets. You can see a few examples in the #1760 pull request. Here is an example:
So this says that if you send packet with four zero bytes on port 0 you expect a packet with 4 bytes on port 0 where the second byte is FF. If you can create a file to test tcp-options-parser.p4 we could get some confidence that this PR fixes indeed the issue. My tests are much simpler. You should name your file as tcp-options-parser.stf. @jafingerhut will thank you too. Please note that this also required a small fix in the bmv2 simulator, so you may need to recompile and install that one too. |
Seems you have already finished this. Many many thanks!!! You are all awesome |
But we could still benefit from having some tests for your program |
The compiler support for header unions is incomplete.
This applies to both the front-end and to the existing back-ends.
The text was updated successfully, but these errors were encountered: