eth: implement DeviceCapabilities.max_burst_size

this is a hint that /could/ boost TCP performance.
This commit is contained in:
Astro 2020-07-16 00:06:47 +02:00
parent 074438c3c7
commit 484e385160
3 changed files with 9 additions and 0 deletions

View File

@ -370,6 +370,7 @@ impl<'r, 'a> smoltcp::phy::Device<'a> for &mut Eth<'r, rx::DescList, tx::DescLis
let mut caps = DeviceCapabilities::default();
caps.max_transmission_unit = MTU;
caps.max_burst_size = Some(self.rx.len().min(self.tx.len()));
caps.checksum = checksum_caps;
caps

View File

@ -93,6 +93,10 @@ impl DescList {
}
}
pub fn len(&self) -> usize {
self.list.len().min(self.buffers.len())
}
pub fn list_addr(&self) -> u32 {
&self.list[0] as *const _ as u32
}

View File

@ -85,6 +85,10 @@ impl DescList {
}
}
pub fn len(&self) -> usize {
self.list.len().min(self.buffers.len())
}
pub fn list_addr(&self) -> u32 {
&self.list[0] as *const _ as u32
}