lwip-users
[Top][All Lists]
Advanced

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

Re: [lwip-users] lwip driver model


From: address@hidden
Subject: Re: [lwip-users] lwip driver model
Date: Thu, 12 Mar 2009 19:21:58 +0100
User-agent: Thunderbird 2.0.0.19 (Macintosh/20081209)

Jeff Barber schrieb:
1. The function ethernet_input should be called to introduce new
packets into the lwip stack.
   (Or, more specifically, it appears that my framework should specify
ethernet_input in the netif_add call as the input function; then the
driver should call netif->input.)
Correct.
2. Interrupt handler *may* call pbuf_alloc or mem*_alloc in interrupt
context (with an appropriate definition of sys_arch_protect) but
should not call ethernet_input if there is any chance that other code
in the stack is already executing.
I'd extend that to a '*must* not call ethernet_input' from interrupt context! The reason is that you can get a long time span of disabled interrupts (during which you cannot accept new packets), as well as that you might have to handle re-entrancy in the driver.
3. Hence, practically speaking, the interrupt handler will need to
defer actually introducing packets into the stack until the main
polling loop.
Exactly. You will have to put them on a queue or even defer copying them from the MAC to the main loop (if you don't have DMA).

The Win32 example port in contrib should be a good example on this, although it lacks the interrupt level :-)

Simon




reply via email to

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