Comments (10)
We do not support ternary lookups either. Range lookups could be converted to ternary lookups. Bpf has no range maps as far as I know.
from p4c-xdp.
Is there a way to iterate over each entry in the BPF map. With that, I think I can solve my problem.
from p4c-xdp.
You can iterate in user space, but not in the kernel.
from p4c-xdp.
Okay, thanks.
from p4c-xdp.
Is there any other way to implement range matching, as i want to use the priority of rules also.
from p4c-xdp.
If you can give an example of how you would do it in raw ebpf perhaps we can implement it in the compiler.
from p4c-xdp.
Suppose we have to match 3 columns, match data is (V1, V2, V3).
Now, For the first case, consider the table data as below. I want, rule 1 to be matched. (X is don't care, that is I don't care what value is placed there).
------------------------------------------
|column A | column B | column C| priority| => Action
------------------------------------------
| V1 | V2 | V3 | 0 | => ActionParam1
| V1 | V2 | X | 1 | => ActionParam2
------------------------------------------
Now, For the first case, consider the table data as below. I want, rule 2 to be matched. (X is don't care, that is I don't care what value is placed there).
------------------------------------------
|column A | column B | column C| priority| => Action
------------------------------------------
| V1 | V2 | V3 | 1 | => ActionParam1
| V1 | V2 | X | 0 | => ActionParam2
------------------------------------------
In bmv2, I implement this don't care condition using range(0->2^(length of the field)-1) and used priority to match the rules.
from p4c-xdp.
In raw ebpf, I was thinking to iterate over the MAP using bpf_get_next_key. And then for each key, get the whole element if key matches the current packet data using lookup or any other method. Also while iterating, compare it with previously matched rules.
from p4c-xdp.
You cannot write loops in ebpf programs. Bounded loops are considered, but i don't think iteration over map entries will ever be supported. Anyway, if you want fast packet processing you don't have time for loops.
from p4c-xdp.
Ok, Thanks
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 lpm HOT 5
- 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.