eth: latter tuning

eth
Astro 2020-06-24 02:08:37 +02:00
parent 7ae8be58cf
commit 8267acfcba
2 changed files with 12 additions and 6 deletions

View File

@ -184,10 +184,10 @@ if false {
let eth = zynq::eth::Eth::default(HWADDR.clone()); let eth = zynq::eth::Eth::default(HWADDR.clone());
println!("Eth on"); println!("Eth on");
const RX_LEN: usize = 4096; const RX_LEN: usize = 8192;
// Number of transmission buffers (minimum is two because with // Number of transmission buffers (minimum is two because with
// one, duplicate packet transmission occurs) // one, duplicate packet transmission occurs)
const TX_LEN: usize = 4096; const TX_LEN: usize = 8192;
let eth = eth.start_rx(RX_LEN); let eth = eth.start_rx(RX_LEN);
let mut eth = eth.start_tx(TX_LEN); let mut eth = eth.start_tx(TX_LEN);
@ -217,7 +217,7 @@ if false {
while let Ok(stream) = TcpStream::accept(TCP_PORT, 0x10_0000, 0x10_0000).await { while let Ok(stream) = TcpStream::accept(TCP_PORT, 0x10_0000, 0x10_0000).await {
let stats_tx = stats_tx.clone(); let stats_tx = stats_tx.clone();
task::spawn(async move { task::spawn(async move {
let tx_data = (0..=255).take(65536).collect::<alloc::vec::Vec<u8>>(); let tx_data = (0..=255).take(8192).collect::<alloc::vec::Vec<u8>>();
loop { loop {
// const CHUNK_SIZE: usize = 65536; // const CHUNK_SIZE: usize = 65536;
// match stream.send((0..=255).cycle().take(CHUNK_SIZE)).await { // match stream.send((0..=255).cycle().take(CHUNK_SIZE)).await {

View File

@ -83,6 +83,8 @@ impl DescList {
entry.word1.write( entry.word1.write(
DescWord1::zeroed() DescWord1::zeroed()
); );
l2cache().invalidate_slice(&mut buffer[..]);
dcci_slice(&buffer[..]);
} }
DescList { DescList {
@ -108,9 +110,9 @@ impl DescList {
let word1 = entry.word1.read(); let word1 = entry.word1.read();
let len = word1.frame_length_lsbs().into(); let len = word1.frame_length_lsbs().into();
let buffer = &mut self.buffers[self.next][0..len]; let buffer = &mut self.buffers[self.next][0..len];
// Invalidate caches for packet buffer // // Invalidate caches for packet buffer
l2cache().invalidate_slice(&mut buffer[..]); // l2cache().invalidate_slice(&mut buffer[..]);
dcci_slice(&buffer[..]); // dcci_slice(&buffer[..]);
self.next += 1; self.next += 1;
if self.next >= list_len { if self.next >= list_len {
@ -139,6 +141,10 @@ pub struct PktRef<'a> {
impl<'a> Drop for PktRef<'a> { impl<'a> Drop for PktRef<'a> {
fn drop(&mut self) { fn drop(&mut self) {
// Flush buffer from cache, to be filled by the peripheral
// before next read
l2cache().invalidate_slice(self.buffer);
dcci_slice(self.buffer);
self.entry.word0.modify(|_, w| w.used(false)); self.entry.word0.modify(|_, w| w.used(false));
dmb(); dmb();