From 72c2b06520a2e25e180df6d89d5b3b39a8380f0c Mon Sep 17 00:00:00 2001 From: dvdsk Date: Fri, 7 Jun 2024 23:06:30 +0200 Subject: [PATCH] Explain the const params N_RX & N_TX in the docs of State On chips with a low amount of ram it's easy to run out of ram. When looking at the current docs for the State struct it is not easy to see that these params can cause a lot of ram usage. --- embassy-net-wiznet/src/lib.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/embassy-net-wiznet/src/lib.rs b/embassy-net-wiznet/src/lib.rs index da70d22bd..545b2a2e4 100644 --- a/embassy-net-wiznet/src/lib.rs +++ b/embassy-net-wiznet/src/lib.rs @@ -17,12 +17,22 @@ use embedded_hal_async::spi::SpiDevice; use crate::chip::Chip; use crate::device::WiznetDevice; +// If you change this update the docs of State const MTU: usize = 1514; /// Type alias for the embassy-net driver. pub type Device<'d> = embassy_net_driver_channel::Device<'d, MTU>; /// Internal state for the embassy-net integration. +/// +/// The two generic arguments `N_RX` and `N_TX` set the size of the receive and +/// send packet queue. With a the ethernet MTU of _1514_ this takes up `N_RX + +/// NTX * 1514` bytes. While setting these both to 1 is the minimum this might +/// hurt performance as a packet can not be received while processing another. +/// +/// # Warning +/// On devices with a small amount of ram (think ~64k) watch out with the size +/// of there parameters. They will quickly use too much RAM. pub struct State { ch_state: ch::State, }