Comments (5)
If I understand right, this should be very easy to do as far as the compiler is concerned.
from p4c-xdp.
I have pushed a PR against the compiler adding LPM table support.
p4lang/p4c#1962
I don't have a recent enough kernel, so perhaps you can help us test?
from p4c-xdp.
hi, Mihai Budiu
I saw this PR fail. Does this update relate to the kernel version? And if I want to test whether the compiler support lpm when I define a table in P4 like this :
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 dstmactable
table also should be the ip address and netmask. How do I specify and add these infomation as key. For example, I want to add 10.0.0.0/24 as key , and in the control plane , maybe this way to specify the key is right?
key.field0 = 0x0a00000020 // 0x0a000000 is 10.0.0.0 , 0x20 is netmask 24.
from p4c-xdp.
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.
from p4c-xdp.
Thank you for your prompt reply. And I'll test it by pulling the PR.
from p4c-xdp.
Related Issues (20)
- Unexpected behavior when running xdp3.o HOT 6
- how to implement a forwoading function using XDP_TX based on xdp7.p4 HOT 1
- What is the difference between bpf_obj_get() in libbpf.h and BPF_OBJ_GET() in init_tables() HOT 3
- Could this compiler support XDP_REDIRECT HOT 16
- changing reject to accept introduce stack increaseing HOT 9
- compiler support for range lookup HOT 10
- invalid indirect read from stack off HOT 3
- ebpf_ipv4_checksum Not working HOT 1
- Compiler support for htons, htonl, htonll HOT 2
- Compiler support for registers and hash functions HOT 3
- [doc] Vagrant image name HOT 2
- [Q] Vagrant image HOT 1
- Resource Leak
- Using XDP with clang/llvm version 9 HOT 3
- How to include ebpf_xdp.h HOT 3
- Adding PERCPU_ARRAY Question HOT 2
- p4x-xdp support for PSA HOT 9
- Test 17 fails HOT 1
- XDP metadata support HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from p4c-xdp.