Skip to content

Commit d9b6290

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 18e59ce commit d9b6290

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

init/src/main.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ use tracing::{error, info};
1313

1414
use crate::{
1515
nic::PciDriver,
16+
nic::{BindToVfioPci, PciNic},
1617
sysfs::{SYSFS, SysfsPath},
1718
};
1819

@@ -92,5 +93,13 @@ fn setup() -> Result<(), InitErr> {
9293

9394
fn main() -> Result<(), InitErr> {
9495
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()?;
95104
Ok(())
96105
}

0 commit comments

Comments
 (0)