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

Implement XDP Map Types #292

Closed
wants to merge 2 commits into from
Closed

Conversation

dave-tucker
Copy link
Member

@dave-tucker dave-tucker commented May 30, 2022

This commit adds implementations for:

  • xskmap
  • devmap
  • devmap_hash
  • cpumap

Which can all be used to redirect XDP packets to various different
locations

TODO:

  • Implementation in aya-bpf
  • Test program to verify that these work as expected

Closes: #193 #194 #195 #199

@netlify
Copy link

netlify bot commented May 30, 2022

Deploy Preview for aya-rs ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 464102b
🔍 Latest deploy log https://app.netlify.com/sites/aya-rs/deploys/6294a459016de80008534692
😎 Deploy Preview https://deploy-preview-292--aya-rs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@dave-tucker dave-tucker marked this pull request as draft May 30, 2022 10:47
@dave-tucker dave-tucker changed the title aya: Implement XDP Map Types Implement XDP Map Types May 30, 2022
This commit adds implementations for:
- xskmap
- devmap
- devmap_hash
- cpumap

Which can all be used to redirect XDP packets to various different
locations

Signed-off-by: Dave Tucker <[email protected]>
Signed-off-by: Dave Tucker <[email protected]>
aztecher added a commit to aztecher/aya that referenced this pull request Sep 18, 2022
Add BpfLoader::set_max_entries, which sets the max_entries for the
specified map, as the load-time option.
The max_entries set at map initialization in the ebpf component can be
overwritten by this method called on the userspace component.
If you want to set max_entries for multiple maps in an ebpf component,
you can do so by calling set_max_entries in the form of a method chain.

Fixes: aya-rs#308
Refs: aya-rs#292
aztecher added a commit to aztecher/aya that referenced this pull request Sep 18, 2022
Add BpfLoader::set_max_entries, which sets the max_entries for the
specified map, as the load-time option.
The max_entries set at map initialization in the ebpf component can be
overwritten by this method called on the userspace component.
If you want to set max_entries for multiple maps in an ebpf component,
you can do so by calling set_max_entries in the form of a method chain.

Fixes: aya-rs#308
Refs: aya-rs#292
aztecher added a commit to aztecher/aya that referenced this pull request Sep 19, 2022
Add BpfLoader::set_max_entries, which sets the max_entries for the
specified map, as the load-time option.
The max_entries set at map initialization in the ebpf component can be
overwritten by this method called on the userspace component.
If you want to set max_entries for multiple maps in an ebpf component,
you can do so by calling set_max_entries in the form of a method chain.

Fixes: aya-rs#308
Refs: aya-rs#292
NonNull::new(value as *mut u32).map(|p| p.as_ref())
}
}
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that a method such as the following is also necessary, as there's otherwise no way to access the raw map (that I've found) so that bpf_redirect_map can be called by a user of this type

Suggested change
}
pub unsafe fn redirect(&mut self, key: u64, flags: u64) -> i64 {
bpf_redirect_map(
&mut self.def as *mut _ as *mut _,
key,
flags,
)
}
}

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct, I just wondered about the "missing" bpf_redirect_map() wrapper myself.

@brevilo
Copy link

brevilo commented Feb 9, 2023

Please consider enabling these new maps for use in multi-buffer contexts (via their specific section names), similar to #519.

Thanks for your efforts!

@Tuetuopay Tuetuopay mentioned this pull request Feb 20, 2023
3 tasks
@dave-tucker
Copy link
Member Author

Closing in favour of #527

@mergify mergify bot added aya This is about aya (userspace) aya-bpf This is about aya-bpf (kernel) labels Sep 14, 2023
@mergify
Copy link

mergify bot commented Sep 25, 2023

@dave-tucker, this pull request is now in conflict and requires a rebase.

@mergify mergify bot added the needs-rebase label Sep 25, 2023
@tamird
Copy link
Member

tamird commented Sep 26, 2023

Closing in favour of #527

Closing for real.

@tamird tamird closed this Sep 26, 2023
@mergify mergify bot removed the needs-rebase label Sep 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
aya This is about aya (userspace) aya-bpf This is about aya-bpf (kernel)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for BPF_MAP_TYPE_DEVMAP
4 participants