Skip to content

Should AF_XDP's driver running on a seperate thread? #146

@Lethe10137

Description

@Lethe10137

When working on AF_XDP driver, I went into some issue:

for packet in packets {
self.sender
.blocking_send(packet)
.map_err(|_| std::io::Error::other("send error"))?;
}

I believe that the send_bulk quoted above is essential for rattan to achieve the packet forwarding performance comparable to that in the repo camellia 's examples. Yet blocking_send was used there, making it impossible to be used directly in the tokio runtime.

A direct solution is making our veth receiving futures, aka the ones tokio::spawn in VirtualEthernetEgress::new to
be running on a seperate thread, which means using std::thread::spawn. Is this the designed way to use it?

for d in driver.into_iter() {
let notify = AsyncFd::new(d.raw_fd())?;
tokio::spawn(Self::recv(
flow_map.clone(),
notify,
d.into_receiver(),
tx.clone(),
log_tx.clone(),
base_ts,
));
}

@minhuw

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions