Add tcp latency test over virtio-net

This commit is contained in:
jiangjianfeng
2024-10-12 02:09:58 +00:00
committed by Tate, Hongliang Tian
parent e78303b01a
commit 090149eed7
14 changed files with 102 additions and 9 deletions

View File

@ -154,7 +154,7 @@ impl NetworkDevice {
.rx_buffers
.remove(token as usize)
.ok_or(VirtioNetError::WrongToken)?;
rx_buffer.set_packet_len(len as usize);
rx_buffer.set_packet_len(len as usize - size_of::<VirtioNetHdr>());
// FIXME: Ideally, we can reuse the returned buffer without creating new buffer.
// But this requires locking device to be compatible with smoltcp interface.
let rx_pool = RX_BUFFER_POOL.get().unwrap();
@ -180,6 +180,8 @@ impl NetworkDevice {
self.send_queue.notify();
}
debug!("send packet, token = {}, len = {}", token, packet.len());
debug_assert!(self.tx_buffers[token as usize].is_none());
self.tx_buffers[token as usize] = Some(tx_buffer);