[Top][All Lists]
[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: |
Tue, 11 Dec 2007 22:40:39 +0000 |
User-agent: |
Mozilla Thunderbird 1.0.8-1.1.fc3.4.legacy (X11/20060515) |
address@hidden wrote:
Secondly, the PowerPC loads packets directly into buffer descriptor
memory. Is looks possible (best) at low_level_input to point pbufs
right into the received packet without copying. If I’m correct that
this can be done, the question I have is, where can I know the data
was read by the upper layer to be able free the pbuf and at the same
time to be able to free memory for the Ethernet controller?
Normally, you would allocate a pbuf including data buffer: type
PBUF_POOL and make sure the data buffer is in one piece (p->next ==
NULL; for that, PBUF_POOL_BUFSIZE has to be set to 1516 for ethernet).
Just being pedantic I know, but that isn't strictly true - I'm working on
one board which can scatter/gather pbufs and where the memory pointed to
by the buffer descriptors is fixed at 128 bytes.
However if you do have the memory it is more efficient to use the full
1516. The question then is whether you have the memory because _every_
packet received will occupy the full 1516 bytes, and if you're keeping
them around till you've got the lot, that can add up. If you are receiving
your 4MB image in 256 byte chunks, you'd need at least 24MB of RAM ;).
NB the value of 1516 bytes can depend on your hardware, e.g. if your
hardware also transfers the CRCs. See
http://sd.wareonearth.com/~phil/net/jumbo/ for example.
Then you set the ETH DMA to receive to p->payload. When a packet is
received, substract the offset from p->payload so you get the pbuf
pointer, which you can pass into the stack.
Just to clarify what Simon is saying, pool pbufs consist of a 'struct
pbuf' immediately followed in memory by the payload - so if you have the
payload pointer, you know where the struct pbuf is.
Of course, this only works
if your ETH DMA can receive to the memory where the memp pools are
allocated.
Unfortunately, using a PBUF_REF for receiving input packets doesn't work
so good I think...
Indeed. I've certainly only been working in terms of (inherently
preallocated) pool pbufs.
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.
------["The best things in life aren't things."]------ Opinions==mine
- [lwip-users] Transferring large data fast and pointing pbufs directly to Ethernet receive buffers, Bill Auerbach, 2007/12/11
- Re: [lwip-users] Transferring large data fast and pointing pbufs directly to Ethernet receive buffers, address@hidden, 2007/12/11
- Re: [lwip-users] Transferring large data fast and pointing pbufs directly to Ethernet receive buffers,
Jonathan Larmour <=
- RE: [lwip-users] Transferring large data fast and pointing pbufs directly to Ethernet receive buffers, Bill Auerbach, 2007/12/12
- Re: [lwip-users] Transferring large data fast and pointing pbufs directly to Ethernet receive buffers, Jonathan Larmour, 2007/12/12
- RE: [lwip-users] Transferring large data fast and pointing pbufs directly to Ethernet receive buffers, Bill Auerbach, 2007/12/12
- Re: [lwip-users] Transferring large data fast and pointing pbufs directly to Ethernet receive buffers, Jonathan Larmour, 2007/12/12
- RE: [lwip-users] Transferring large data fast and pointing pbufsdirectly to Ethernet receive buffers, Grubb, Jared, 2007/12/12
- RE: [lwip-users] Transferring large data fast and pointing pbufs directly to Ethernet receive buffers, Bill Auerbach, 2007/12/12