Skip to content

Commit

Permalink
feat(s2n-quic-xdp): provide umem ptr method (#2146)
Browse files Browse the repository at this point in the history
  • Loading branch information
ollie-etl authored Mar 7, 2024
1 parent fb3ac86 commit a14804f
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions tools/xdp/s2n-quic-xdp/src/umem.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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]
Expand All @@ -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 _) }
}
}

Expand Down

0 comments on commit a14804f

Please sign in to comment.