From a14804f295ecdaf781dcccce52c9985a0f9017b6 Mon Sep 17 00:00:00 2001 From: ollie <72926894+ollie-etl@users.noreply.github.com> Date: Thu, 7 Mar 2024 15:00:53 +0000 Subject: [PATCH] feat(s2n-quic-xdp): provide umem ptr method (#2146) --- tools/xdp/s2n-quic-xdp/src/umem.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tools/xdp/s2n-quic-xdp/src/umem.rs b/tools/xdp/s2n-quic-xdp/src/umem.rs index 87fc43c241..5993d1fb7d 100644 --- a/tools/xdp/s2n-quic-xdp/src/umem.rs +++ b/tools/xdp/s2n-quic-xdp/src/umem.rs @@ -121,6 +121,12 @@ impl Umem { self.area.len() } + /// Returns the pointer to the umem memory region + #[inline] + pub fn as_ptr(&self) -> *mut u8 { + self.mem.as_ptr() + } + /// Returns `true` if the Umem is empty #[inline] pub fn is_empty(&self) -> bool { @@ -178,7 +184,7 @@ impl Umem { desc.address + desc.len as u64 <= self.area.len() as u64, "pointer out of bounds" ); - unsafe { self.mem.as_ptr().add(desc.address as _) } + unsafe { self.as_ptr().add(desc.address as _) } } #[inline] @@ -187,7 +193,7 @@ impl Umem { desc.address + self.frame_size as u64 <= self.area.len() as u64, "pointer out of bounds" ); - unsafe { self.mem.as_ptr().add(desc.address as _) } + unsafe { self.as_ptr().add(desc.address as _) } } }