Skip to content

Commit fc68523

Browse files
Fredi-raspallfredi
authored andcommitted
feat(dataplane): create taps at initialization
Create taps for the interfaces specified via cmd line args. Taps should be created before drivers start so that the latter can learn their during their initialization. Signed-off-by: Fredi Raspall <fredi@githedgehog.com>
1 parent ade8eb6 commit fc68523

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

dataplane/src/main.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ use pyroscope::PyroscopeAgent;
2020
use pyroscope_pprofrs::{PprofConfig, pprof_backend};
2121

2222
use net::buffer::{TestBuffer, TestBufferPool};
23-
use pkt_io::start_io;
23+
use pkt_io::{start_io, tap_init};
2424

2525
use routing::RouterParamsBuilder;
2626
use tracectl::{custom_target, get_trace_ctl, trace_target};
@@ -133,15 +133,18 @@ fn main() {
133133
// pipeline builder
134134
let pipeline_factory = setup.pipeline;
135135

136-
// Start driver with the provided pipeline builder. Driver should create a portmap table,
137-
// populate it with [`PortSpec`]s and return the writer
136+
// Start driver with the provided pipeline builder. Taps must have been created before this
137+
// happens so that their ifindex is available when drivers initialize.
138138
let (_handle, iom_ctl) = {
139139
match &launch_config.driver {
140-
args::DriverConfigSection::Dpdk(_section) => {
140+
args::DriverConfigSection::Dpdk(section) => {
141+
tap_init(&section.interfaces).expect("Tap initialization failed");
142+
141143
info!("Using driver DPDK...");
142144
todo!();
143145
}
144146
args::DriverConfigSection::Kernel(section) => {
147+
tap_init(&section.interfaces).expect("Tap initialization failed");
145148
info!("Using driver kernel...");
146149
DriverKernel::start(
147150
section.interfaces.clone().into_iter(),

0 commit comments

Comments
 (0)