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

when ringbuffer map size is not a power-of-2 multiple of page size, prompt users in a user-friendly way #1420

Merged
merged 2 commits into from
Apr 10, 2024

Conversation

hengyoush
Copy link

example:

struct {
	__uint(type, BPF_MAP_TYPE_RINGBUF);
	__uint(max_entries, 4097);
} rb SEC(".maps");

then output:

program dev_hard_start_xmit: map rb: EINVAL (ring map size 4097 not a power of two page size(pageSize 4096))

@hengyoush hengyoush requested a review from a team as a code owner April 8, 2024 06:32
@hengyoush hengyoush force-pushed the ring-map-size-error branch from 4c4228f to 7638f55 Compare April 8, 2024 06:35
map.go Outdated Show resolved Hide resolved
@hengyoush hengyoush force-pushed the ring-map-size-error branch from 3c49b2e to f8c12e5 Compare April 8, 2024 09:37
@hengyoush hengyoush requested a review from florianl April 8, 2024 09:38
Move pow() from package btf to package internal.

Signed-off-by: Lorenz Bauer <lmb@isovalent.com>
@lmb lmb force-pushed the ring-map-size-error branch from f8c12e5 to d882b65 Compare April 10, 2024 09:52
@lmb
Copy link
Collaborator

lmb commented Apr 10, 2024

I've pushed a small refactoring to reuse an existing implementation of pow we already had in the code base.

map.go Outdated Show resolved Hide resolved
Signed-off-by: hengyouhai <hengyouhai@tuhu.cn>
@lmb lmb force-pushed the ring-map-size-error branch from 7c294df to 7e0b9c1 Compare April 10, 2024 11:31
@lmb lmb merged commit d4bceb5 into cilium:main Apr 10, 2024
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants