-
Notifications
You must be signed in to change notification settings - Fork 241
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
bpf(): improve map and program compatibility #3980
base: main
Are you sure you want to change the base?
Conversation
047d4c2
to
9140f0f
Compare
@lmb - the CICD tests are failing on this PR. Can you please take a look? |
Yes, I’m aware. My dev environment destroyed itself and setting it back up had to take lower priority. I’ll update when I can. |
Rebased this on |
Hi, since the build is passing in CICD pipeline, you can probably use the artifacts from the pipeline to run the tests locally. |
Allow passing a name for maps and programs and allow retrieving it via BPF_OBJ_GET_INFO_BY_FD. This requires a bunch of glue code because the bpf_prog_info, etc. structs are not compatible with Linux.
Internally both zero and EBPF_ID_NONE are used to refer to non-existing ID. Use zero when retrieving link info, since that aligns with Linux better.
Tests are finally passing! |
@@ -652,7 +652,7 @@ ebpf_link_get_info( | |||
|
|||
memset(info, 0, sizeof(*info)); | |||
info->id = link->object.id; | |||
info->prog_id = (link->program) ? ((ebpf_core_object_t*)link->program)->id : EBPF_ID_NONE; | |||
info->prog_id = (link->program) ? ((ebpf_core_object_t*)link->program)->id : 0; |
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.
Question: should EBPF_ID_NONE be defined to be 0?
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.
attr.info.info = (uintptr_t)&info; | ||
attr.info.info_len = sizeof(info); | ||
REQUIRE(bpf(BPF_OBJ_GET_INFO_BY_FD, &attr, sizeof(attr)) == 0); | ||
// TODO: Should this be BPF_LINK_TYPE_PLAIN? |
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.
As far as I know, yes.
// TODO: Should this be BPF_LINK_TYPE_PLAIN? | |
// TODO: This should be BPF_LINK_TYPE_PLAIN. |
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.
See #4096
Co-authored-by: Dave Thaler <[email protected]>
Allow passing a name for maps and programs and allow retrieving it via BPF_OBJ_GET_INFO_BY_FD. This requires a bunch of glue code because the bpf_prog_info, etc. structs are not compatible with Linux.