Skip to content

Commit f9a7b1f

Browse files
committed
feat(init): implement dataplane NIC initialization
Implements basic NIC driver binding for DPDK compatibility. Binds PCI network devices to vfio-pci driver as required by DPDK for device control. This is part 1 of the dataplane initialization system, focusing on minimal viable functionality for team testing. Future work: - Add proper argument parsing - Implement privilege dropping (especially CAP_SYS_ADMIN) - Add exec to dataplane process after success Signed-off-by: Daniel Noland <[email protected]>
1 parent dc21060 commit f9a7b1f

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

init/src/main.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use std::path::PathBuf;
1212
use tracing::{error, info};
1313

1414
use crate::{
15-
nic::PciDriver,
15+
nic::{BindToVfioPci, PciDriver, PciNic},
1616
sysfs::{SYSFS, SysfsPath},
1717
};
1818

@@ -93,5 +93,13 @@ fn setup() {
9393

9494
fn main() -> Result<(), InitErr> {
9595
setup();
96+
// TODO: proper argument parsing
97+
// -- hack add a real command line parser
98+
let mut args = std::env::args().skip(1);
99+
// -- end hack
100+
// TODO: fix unwraps in the next PR. These can't be properly addressed before the arg parser is done.
101+
let address = hardware::pci::address::PciAddress::try_from(args.next().unwrap()).unwrap();
102+
let mut device = PciNic::new(address)?;
103+
device.bind_to_vfio_pci()?;
96104
Ok(())
97105
}

0 commit comments

Comments
 (0)