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
_______________________________________________
lwip-users mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/lwip-users