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