[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [lwip-users] Blocking netif_linkoutput
From: |
Simon Goldschmidt |
Subject: |
Re: [lwip-users] Blocking netif_linkoutput |
Date: |
Wed, 5 Jun 2013 12:53:10 +0200 (CEST) |
Dimax wrote:
> I continue working on STM32 Ethernet driver. I'd like to understand
> the right implementation of the netif_linkoutput.
>
> 1. What should driver do if it has no free DMA descriptors to post
> output packet? Should it try to wait some time? If yes what is a
> reasonable wait time?
Yes, it should wait until a packet is sent and there is a free descriptor. This
is not optimal regarding CPU usage, of course, since RX is also blocked in this
case, but that's the way it is, currently :-(
You can also wait for the TX-ISR to wait you up instead of waiting activeliy.
In this case, another thread can run until a packet is sent.
> 2. As far as I can see linkoutput is called from tcpip_thread context
> (in case of OS usage). Should it be reenterable? I do not think so but
No. It is only called from tcpip_thread. As it should not call back into the
stack, it cannot be reentered.
> want to make sure as in original implementation there is a semaphore
> taken at the beginning and given at the end.
I don't know where the idea came from, but that sempaphore is not necessary.
Simon