[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [lwip-users] implementing device driver: netif events handling
From: |
Krzysztof Wesołowski |
Subject: |
Re: [lwip-users] implementing device driver: netif events handling |
Date: |
Thu, 9 Aug 2012 08:01:33 +0200 |
> 2. Link change events initiated by driver are not thread-safe.
> Wiki page
> http://lwip.wikia.com/wiki/Writing_a_device_driver#Link_change_events
> claims that driver should use netif_set_link_up/netif_set_link_down
> functions. But they manipulate netif flags directly. Moreover, they
> directly call several lwip processing functions leading to execute them in
> driver thread context.
While multiple ports use separate thread for packets input, it is not
the only way LwIP can work. If yor driver operates in tcp_ip thread
there is no need for it to be thread safe. If u use separate threa
thera are netifapi_* variants of functions which uses messages with
call back to pass execution to tcpip thread.
I have modified some sample STM32 driver, added extra maintenance
timer to check PHY/Link status and I execute it with timers inside
tcpip thread. So called "driver context" is not the one and only
solution - and especially TX is usually handled directly in tcpip
thread.
Regards,
Krzysztof Wesołowski