Skip to content

Commit 836e686

Browse files
new core runtime
1 parent 0355170 commit 836e686

File tree

11 files changed

+656
-32
lines changed

11 files changed

+656
-32
lines changed

core/core

Whitespace-only changes.

core/src/ffi/dpdk.rs

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ pub(crate) fn mempool_free(ptr: &mut MempoolPtr) {
131131
}
132132

133133
/// An opaque identifier for a logical execution unit of the processor.
134-
#[derive(Copy, Clone, Eq, Hash, Ord, PartialEq, PartialOrd)]
134+
#[derive(Copy, Clone)]
135135
pub(crate) struct LcoreId(raw::c_uint);
136136

137137
impl LcoreId {
@@ -144,6 +144,24 @@ impl LcoreId {
144144
pub(crate) fn current() -> LcoreId {
145145
unsafe { LcoreId(cffi::_rte_lcore_id()) }
146146
}
147+
148+
/// Returns the ID of the main lcore.
149+
#[inline]
150+
pub(crate) fn main() -> LcoreId {
151+
unsafe { LcoreId(cffi::rte_get_master_lcore()) }
152+
}
153+
154+
/// Returns the ID of the physical CPU socket of the lcore.
155+
#[allow(clippy::trivially_copy_pass_by_ref)]
156+
#[inline]
157+
pub(crate) fn socket(&self) -> SocketId {
158+
unsafe { (cffi::rte_lcore_to_socket_id(self.0) as raw::c_int).into() }
159+
}
160+
161+
/// Returns the raw value.
162+
pub(crate) fn raw(&self) -> usize {
163+
self.0 as usize
164+
}
147165
}
148166

149167
impl fmt::Debug for LcoreId {

core/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ pub mod packets;
134134
#[cfg(feature = "pcap-dump")]
135135
#[cfg_attr(docsrs, doc(cfg(feature = "pcap-dump")))]
136136
mod pcap;
137-
mod rt2;
137+
pub mod rt2;
138138
mod runtime;
139139
#[cfg(any(test, feature = "testils"))]
140140
#[cfg_attr(docsrs, doc(cfg(feature = "testils")))]

0 commit comments

Comments
 (0)