1pub(crate) mod monitor;
4pub(crate) mod rx_core;
6
7use crate::dpdk;
8
9use std::fmt;
10
11use serde::{Deserialize, Serialize};
12
13#[derive(Debug, Copy, Clone, Hash, Ord, Eq, PartialEq, PartialOrd)]
14pub(crate) struct SocketId(pub(crate) u32);
15
16impl SocketId {
17 pub(crate) fn raw(&self) -> u32 {
19 self.0
20 }
21}
22
23impl fmt::Display for SocketId {
24 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
25 write!(f, "{}", self.0)
26 }
27}
28
29#[derive(Debug, Copy, Clone, Hash, Ord, Eq, PartialEq, PartialOrd, Deserialize, Serialize)]
33pub struct CoreId(pub u32);
34
35impl CoreId {
36 pub(crate) fn socket_id(&self) -> SocketId {
37 unsafe { SocketId(dpdk::rte_lcore_to_socket_id(self.0)) }
38 }
39
40 pub fn raw(&self) -> u32 {
42 self.0
43 }
44}
45
46impl fmt::Display for CoreId {
47 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
48 write!(f, "{}", self.0)
49 }
50}