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

LPMTrie support #1

Open
dylandreimerink opened this issue May 23, 2022 · 0 comments
Open

LPMTrie support #1

dylandreimerink opened this issue May 23, 2022 · 0 comments
Labels
enhancement New feature or request

Comments

@dylandreimerink
Copy link
Owner

We support a fair amount of linux map types already, however BPF_MAP_LPM_TRIE is missing. This map type is a trie(prefix tree) with some unique features to complement its intended use, best described in the code itself. TLDR.: It is a tree with keys that contain both a value and prefix/mask length. It does bit level comparison on the key value and picks the next child node to traverse based on the value of the bit, like a binary tree.

I was unable to find a library which is both generic(works with []byte up to 256 bytes long), does longest prefix matching, compares on bits and not whole bytes and has a sparse data representation. So we will have to write our own based on the C code of linux.

Another issue to take into account is how we will be registering the nodes in the memory controller, there are two approaches here:

  • Register each individual node as its own memory entry, easy to implement, makes the memory overview very noisy and makes a lot of records.
  • Take the hash approach, maintain a PlainMemory buffer which will be used as an array, maintain a freelist of addresses to be used and store the addresses in the tree. This is more overhead and complexer to implement, it also makes the memory controller listing and fragmentation less.
@dylandreimerink dylandreimerink added the enhancement New feature or request label May 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant