-
Notifications
You must be signed in to change notification settings - Fork 95
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
Add APIs to utilize map of maps #213
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left some initial comments, will do another pass later
// | ||
// See usage of `bpf_map_get_fd_by_id()` in kernel selftests for more info. | ||
func (m *Module) GetMapByID(id uint32) (*BPFMap, error) { | ||
fdOrError := C.bpf_map_get_fd_by_id(C.uint(id)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we perhaps check the second return value (errno
)?
// This is only to satify the eBPF verifier and needs to be called before loading the module. | ||
func (b *BPFMap) SetInnerMap(innerMap *BPFMap) error { | ||
// b is the outer map. | ||
errC := C.bpf_map__set_inner_map_fd(b.bpfMap, C.int(innerMap.fd)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above
c67f0cb
to
5621189
Compare
Add selftest for these interactions
5621189
to
4731da7
Compare
Hi @kakkoyun Should this still be set as a draft? Do you think it's ready for review and if not can I help you with it? |
This is still a draft. I'll give it another shot now that I'm back to my usual working environment (better for testing), hopefully soon. I could use an initial review and suggestions regarding the APIs though. |
@kakkoyun Sounds good! i'll take a look later today. There may be a new API in libbpf 1.0 that could help with this as well. |
@kakkoyun do you still have plans to get going with this PR? Thanks for contributing. |
@geyslan I still want to have it in libbpfgo. I just need to spare time to figure out how to make it happen. Feel free to help me guide me :) |
Ok then. First, could you resolve the conflicts? After call me for review. 👍🏼 |
Is there any interest in continuing this work ? I'm afraid we did not have enough time to rebase and fix the issues, I'll keep it opened for sometime to see if there is any movement here. Cheers! |
I would love to revisit this. However, I don't have enough free-cycles to work on this. Please feel free to just close it. I'll get back to it when I have time again. |
@kakkoyun I'll continue this. 👍🏼 |
I gave some air to this in #343. |
This function allows to retrieve a map (BPFMapLow) by its ID. This is useful when a map is created by a different origin. Initial effort: aquasecurity#213 Co-authored-by: Kemal Akkoyun <kakkoyun@gmail.com>
This allows to set the inner map definition of a map of maps which doesn't have a preallocated inner map. Initial effort: aquasecurity#213 Co-authored-by: Kemal Akkoyun <kakkoyun@gmail.com>
This allows to set the inner map prototype of a map of maps which doesn't have a pre-allocated inner map. Initial effort: aquasecurity#213 Co-authored-by: Kemal Akkoyun <kakkoyun@gmail.com>
This allows to set the inner map prototype of a map of maps which doesn't have a pre-allocated inner map. Initial effort: aquasecurity#213 Co-authored-by: Kemal Akkoyun <kakkoyun@gmail.com>
This function allows to retrieve a map (BPFMapLow) by its ID. This is useful when a map is created by a different origin. Initial effort: aquasecurity#213 Co-authored-by: Kemal Akkoyun <kakkoyun@gmail.com>
This allows to set the inner map prototype of a map of maps which doesn't have a pre-allocated inner map. Initial effort: aquasecurity#213 Co-authored-by: Kemal Akkoyun <kakkoyun@gmail.com>
This function allows to retrieve a map (BPFMapLow) by its ID. This is useful when a map is created by a different origin. Initial effort: aquasecurity#213 Co-authored-by: Kemal Akkoyun <kakkoyun@gmail.com>
This allows to set the inner map prototype of a map of maps which doesn't have a pre-allocated inner map. Initial effort: aquasecurity#213 Co-authored-by: Kemal Akkoyun <kakkoyun@gmail.com>
This function allows to retrieve a map (BPFMapLow) by its ID. This is useful when a map is created by a different origin. Initial effort: aquasecurity#213 Co-authored-by: Kemal Akkoyun <kakkoyun@gmail.com>
This allows to set the inner map prototype of a map of maps which doesn't have a pre-allocated inner map. Initial effort: aquasecurity#213 Co-authored-by: Kemal Akkoyun <kakkoyun@gmail.com>
This function allows to retrieve a map (BPFMapLow) by its ID. This is useful when a map is created by a different origin. Initial effort: aquasecurity#213 Co-authored-by: Kemal Akkoyun <kakkoyun@gmail.com>
This allows to set the inner map prototype of a map of maps which doesn't have a pre-allocated inner map. Initial effort: aquasecurity#213 Co-authored-by: Kemal Akkoyun <kakkoyun@gmail.com>
This function allows to retrieve a map (BPFMapLow) by its ID. This is useful when a map is created by a different origin. Initial effort: #213 Co-authored-by: Kemal Akkoyun <kakkoyun@gmail.com>
This allows to set the inner map prototype of a map of maps which doesn't have a pre-allocated inner map. Initial effort: #213 Co-authored-by: Kemal Akkoyun <kakkoyun@gmail.com>
Add selftest for the map of map interactions.
TODO