lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lwip-users] pbuf handling / possible bug?


From: Michael Steinberg
Subject: Re: [lwip-users] pbuf handling / possible bug?
Date: Mon, 10 Aug 2015 13:21:35 +0200
User-agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.1.0

Hello again,

> [...]
> - RAM: TX buffer, in one piece, struct pbuf and its payload are
> contiguous memory (although the "in one piece" might be removed in
> future versions)
> - POOL: RX buffer, can be chained (e.g. scater-gather-RX), struct pbuf
> and its payload are contiguous memory
> - REF: can be anything pointing to volatile memory, struct pbuf is
> allocated on its own, payload can be anywhere
> - ROM: same as REF but pointing to non-volatile memory (i.e. when
> queued, payload does not have to be copied)
> [...]
How is this information used, it's overwhelming me to look through the
whole source just now. Say, we know that the PBUF + payload is
contiguous, how does this help, or how is the knowledge exploited in the
sources? I'm currently thinking flags like READ_ONLY/CONTIGUOUS + memory
source id would make the system somewhat "orthogonal". This way
memory_source could be used to map to an implementation (pools, heap,
custom, whatnot) and lwip client code would act according to the flags.
Then there could be a table with memory source implementations. This way
you'd not need to store a free function per custom pbuf and client code
would not branch depending on the actual pbuf source, but on the
capabilities of the source. Also you could implement every operation
(like realloc for instance) for every memory source. It's just that the
current implementation feels to me as if WHAT and HOW are mixed in there.

(A sidenote: in my local implementation, I added a compilation flag for
now, which let's me substitute the 16-bit refcount with an 8 bit
refcount + 8 bit custom flags. My rationale is, even with only 255
maximum refs, it would take a kilobyte of ram just to store the
references to the pbuf, which seems to be that it's a reasonable upper
limit)

I'm just thinking loud so maybe you can detect my misconceptions.

Kind Regards,
Michael





reply via email to

[Prev in Thread] Current Thread [Next in Thread]