-
Notifications
You must be signed in to change notification settings - Fork 26
compiler support for lpm #114
Comments
If I understand right, this should be very easy to do as far as the compiler is concerned. |
I have pushed a PR against the compiler adding LPM table support. |
hi, Mihai Budiu table dstmactable {
key = { hd.ipv4.dstAddr : lpm; }
actions = {
Fallback_action;
Drop_action;
}
default_action = Drop_action;
implementation = hash_table(64);
} do I need to pull the new commit of p4c and rebuild it firstly? And the key of key.field0 = 0x0a00000020 // 0x0a000000 is 10.0.0.0 , 0x20 is netmask 24. |
The PR did not pass because of a minor C++ style issue. You can test this by indeed pulling this PR and building it; you can also wait until the PR is merged into master, but I don't know how soon that will be. Interestingly, this PR may actually do what you want for the kernel, but it will break our user-level tests, since we do not support LPM tables in user space. I will file a separate issue for that. Since I didn't write a user-level test, we will be fine for now. To insert entries in this table you will have to use the APIs specific to tries, see for example torvalds/linux@b95a5c4. The key is specified as the actual key plus a length. Currently we do not generate a specific key+length structure for this purpose, that's something that we could probably also add. Please note that next week I will be traveling and I may be unable to respond to requests in a timeline manner. |
Thank you for your prompt reply. And I'll test it by pulling the PR. |
Hi,
Could this compiler support lpm for looking up key? For example , I could add 10.10.1.0/24 to the map of the table defined in P4 as key and want to match this subnet.
The text was updated successfully, but these errors were encountered: