From 484e3851602ad40a251a2790149d380f9a11c652 Mon Sep 17 00:00:00 2001 From: Astro Date: Thu, 16 Jul 2020 00:06:47 +0200 Subject: [PATCH] eth: implement DeviceCapabilities.max_burst_size this is a hint that /could/ boost TCP performance. --- libboard_zynq/src/eth/mod.rs | 1 + libboard_zynq/src/eth/rx.rs | 4 ++++ libboard_zynq/src/eth/tx.rs | 4 ++++ 3 files changed, 9 insertions(+) diff --git a/libboard_zynq/src/eth/mod.rs b/libboard_zynq/src/eth/mod.rs index 413dd3b..8b6f6a6 100644 --- a/libboard_zynq/src/eth/mod.rs +++ b/libboard_zynq/src/eth/mod.rs @@ -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 diff --git a/libboard_zynq/src/eth/rx.rs b/libboard_zynq/src/eth/rx.rs index 4efd0ec..01a10c3 100644 --- a/libboard_zynq/src/eth/rx.rs +++ b/libboard_zynq/src/eth/rx.rs @@ -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 } diff --git a/libboard_zynq/src/eth/tx.rs b/libboard_zynq/src/eth/tx.rs index b326414..a5b215c 100644 --- a/libboard_zynq/src/eth/tx.rs +++ b/libboard_zynq/src/eth/tx.rs @@ -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 }