lwip-users
[Top][All Lists]
Advanced

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

Re: [lwip-users] LWIP/WIN32 UDP performance (throughtput)


From: Stephane Lesage
Subject: Re: [lwip-users] LWIP/WIN32 UDP performance (throughtput)
Date: Thu, 16 Feb 2012 23:11:47 +0100

> Correct me if I am wrong, but I think for this to work you have to
> invalidate a pbuf before passing it to the RX engine. When payload
> starts on a 32 bit boundary, you can leave a TX pbuf inalidated and
> pass it to RX.

I'm not sure to understand what you mean.
Yes, the driver needs to invalidate after allocating and before DMA RX.

This is a good time to publish my drivers:
http://lwip.wikia.com/wiki/Available_device_drivers#lwIP_1.4.1

Here's how they work:
1. init:
- prepare TX descriptors list
- init RX descriptors list: allocate pbuf and WriteBack+Invalidate the
payload buffer
- init interrupts, start DMA, start MAC

2. low_level_output:
- we need 1 contiguous buffer: pbuf_ref() or pbuf_copy()
- get a TX descriptor from the "free" queue
- setup descriptor and WriteBack the payload buffer
- append to "queued" descriptors
- if DMA not active, move "queued" to "active" and start DMA

3. RX interrupt:
- move received descriptors to "complete" queue
- update "active" queue: remove "complete", add "queued" descriptors and
eventually restart DMA
- tcpip_trycallback(rxmsg);

4. RX callback in the tcpip thread:
- loop to extract descriptors from "complete" queue
- update statistics
- give the packet to the stack with ethernet_input()
- try to allocate a pbuf for the newly free descriptor:
If the pbuf has been reused in the meantime -> move to "free".
If pbuf re-allocated:
- WriteBack+Invalidate the payload buffer
- move to "queued" descriptors
- if DMA not active, move "queued" to "active" and start DMA

5. TX interrupt:
- move sent descriptors to "complete" queue
- update "active" queue: remove "complete", add "queued" descriptors and
eventually restart DMA
- tcpip_trycallback(txmsg);

6. TX callback in the tcpip thread:
- loop to extract descriptors from "complete" queue
- update statistics
- free the pbuf
- move back the descriptor to "free" queue
- on exit, try to allocate pbuf for RX "free" descriptors to move to
"queued" descriptors

-- 
Stephane




reply via email to

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