lwip-users
[Top][All Lists]
Advanced

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

Re: [lwip-users] Transferring large data fast and pointing pbufs directl


From: Jonathan Larmour
Subject: Re: [lwip-users] Transferring large data fast and pointing pbufs directly to Ethernet receive buffers
Date: Wed, 12 Dec 2007 21:45:59 +0000
User-agent: Thunderbird 1.5.0.12 (X11/20070530)

Bill Auerbach wrote:
>>> I see this is the way to go.  I'll have to see if I can figure how to
>>> release the ETH buffer the pbuf points to when the pbuf has been
>> processed.
>>
>> Yes I added a hook in the lwIP code in my tree for this. A proper solution
>> will take some discussion and isn't there now (nor will it be for 1.3.0).
>>
>> As Simon said, the alternative is just to receive into static buffers and
>> then memcpy everything to pbufs, with the obvious space and speed hit.
> 
> OK.  I was wondering about checking in pbuf_free if payload is within the
> ETH buffer area (it's contiguous and has compile-time bounds).  If I see an
> ETH buffer address, then mark the buffer as free (you update the BD which
> contains the buffer address).  I'd have to search the BDs to find the owner
> of the buffer - this may take more time than memcpying the payload. :)

As per my and Jared's example you don't do it that way. When you receive a
packet you replace it with a new pool pbuf straight away. Then you can mark
it as free straight away.

What I did if you run out of pbufs is, as I said, to add a hook in the pbuf
free code. Then if a pbuf allocation failed, a flag is set in an
interface-specific struct the buffer is not marked as free and in fact I
set the payload pointer to NULL, When a pbuf is freed, the hook is called,
checks the value of the flag and if needed scans all the bd's for any with
NULL payloads. If all the bd's are replenished, the flag gets cleared.

> I'll do the memcpy for now and see how it goes.  I don't think memcpy's are
> going to be the bottleneck.  Using half the RAM would have been nice.

You don't need to have that much space for the pool pbufs you are DMAing into.

Jifl
-- 
eCosCentric Limited      http://www.eCosCentric.com/     The eCos experts
Barnwell House, Barnwell Drive, Cambridge, UK.       Tel: +44 1223 245571
Registered in England and Wales: Reg No 4422071.
------["Si fractum non sit, noli id reficere"]------       Opinions==mine




reply via email to

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