-
Notifications
You must be signed in to change notification settings - Fork 124
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[catpowder] Enhancement: Improve XDP LibOS
- Loading branch information
Showing
9 changed files
with
115 additions
and
96 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT license. | ||
|
||
//====================================================================================================================== | ||
// Structures | ||
//====================================================================================================================== | ||
|
||
pub(super) struct XdpRing(xdp_rs::XSK_RING); | ||
|
||
//====================================================================================================================== | ||
// Implementations | ||
//====================================================================================================================== | ||
|
||
impl XdpRing { | ||
pub(super) fn initialize(info: &xdp_rs::XSK_RING_INFO) -> Self { | ||
Self(unsafe { | ||
let mut ring: xdp_rs::XSK_RING = std::mem::zeroed(); | ||
xdp_rs::_XskRingInitialize(&mut ring, info); | ||
ring | ||
}) | ||
} | ||
|
||
pub(super) fn consumer_reserve(&mut self, count: u32, idx: *mut u32) -> u32 { | ||
unsafe { xdp_rs::_XskRingConsumerReserve(&mut self.0, count, idx) } | ||
} | ||
|
||
pub(super) fn consumer_release(&mut self, count: u32) { | ||
unsafe { xdp_rs::_XskRingConsumerRelease(&mut self.0, count) } | ||
} | ||
|
||
pub(super) fn producer_reserve(&mut self, count: u32, idx: *mut u32) -> u32 { | ||
unsafe { xdp_rs::_XskRingProducerReserve(&mut self.0, count, idx) } | ||
} | ||
|
||
pub(super) fn producer_submit(&mut self, count: u32) { | ||
unsafe { xdp_rs::_XskRingProducerSubmit(&mut self.0, count) } | ||
} | ||
|
||
pub(super) fn get_element(&self, idx: u32) -> *mut std::ffi::c_void { | ||
unsafe { xdp_rs::_XskRingGetElement(&self.0, idx) } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT license. | ||
|
||
//====================================================================================================================== | ||
// Modules | ||
//====================================================================================================================== | ||
|
||
mod generic; | ||
mod rx_ring; | ||
mod tx_ring; | ||
|
||
//====================================================================================================================== | ||
// Exports | ||
//====================================================================================================================== | ||
|
||
pub use rx_ring::RxRing; | ||
pub use tx_ring::TxRing; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.