Skip to content
This repository was archived by the owner on Nov 20, 2025. It is now read-only.

Cleanup and StackSlab#16

Merged
Jake-Shadle merged 9 commits intomainfrom
stackslab
Mar 3, 2025
Merged

Cleanup and StackSlab#16
Jake-Shadle merged 9 commits intomainfrom
stackslab

Conversation

@Jake-Shadle
Copy link
Owner

  • All unsafe usage now has a (sometimes minimal...) SAFETY: comment for my own sanity
  • Changed some libc definitions to just use u8 instead of i8 (c_char) since they were annoying to deal with, cleaning up parts of the nic code
  • Fixed undefined behavior in the netlink code that was doing the same unaligned pointer casting as the old packet code
  • Simplified Packet by keeping it simple and removing the &'static mut [u8] and replacing it with a *,usize pair instead as most of the code is directly interacting with the pointer anways. Also fixed a bug where the capacity was incorrectly including the XDP_PACKET_HEADROOM
  • Moved HeapSlab into a slab module, and added a new Slab trait and a new implementation, StackSlab which is a simple fixed size ring buffer
  • Lots of internal cleanup

Looking back, it never made sense to transmute to workaround lifetimes, all operations needed the pointer at some point.
The capacity was including the packet headroom, even though that is never accessible from the packet
Also add a simple StackSlab ring buffer type that doesn't require the heap unlike HeapSlab
@Jake-Shadle Jake-Shadle merged commit 7892fa5 into main Mar 3, 2025
8 checks passed
@Jake-Shadle Jake-Shadle deleted the stackslab branch March 3, 2025 15:29
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant