FreeRTOS + Lwip, transmit gets BLOCKED

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

FreeRTOS + Lwip, transmit gets BLOCKED

mjanicek
Hello,
 
I have STM32F407 running FreeRTOS + Lwip (netconn). I have several tasks.
Only one Task1 is transmitting continously small packets (85 bytes) every 5
miliseconds on ethernet.
Transmitting is randomly paused for a long time (cca 1-2 sec) then it is
resumed.
 
Task1 in function lwip_netconn_do_write() takes the semaphore by
sys_arch_sem_wait(LWIP_API_MSG_SEM(msg), 0) and Task1 gets BLOCKED. It
remains blocked for cca 1-2 seconds.
When tcpip_thread in function lwip_netconn_do_writemore() gives semaphore by
sys_sem_signal(op_completed_sem) then Task1 gets finally READY.
 
Please do you have idea why this is happening for such a long time?
 
Thanks
Marek




--
Sent from: http://lwip.100.n7.nabble.com/lwip-users-f3.html

_______________________________________________
lwip-users mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-users
Reply | Threaded
Open this post in threaded view
|

Re: FreeRTOS + Lwip, transmit gets BLOCKED

Simon Wilton
Hi Marek

There is an automatic back-off mechanism designed to stop nodes flooding the network with small TCP messages called Nagle algorithm. Check if you are being blocked by that. You can turn it off - i think on a per connection basis.

There is also a similar thread that I found when i was looking at a similar problem http://lwip.100.n7.nabble.com/lwIP-hangs-on-transfers-with-many-short-packets-td11044.html

BR

Simon

From: lwip-users <lwip-users-bounces+simon.wilton=[hidden email]> on behalf of mjanicek <[hidden email]>
Sent: 03 March 2020 08:46
To: [hidden email] <[hidden email]>
Subject: [lwip-users] FreeRTOS + Lwip, transmit gets BLOCKED
 
Hello,
 
I have STM32F407 running FreeRTOS + Lwip (netconn). I have several tasks.
Only one Task1 is transmitting continously small packets (85 bytes) every 5
miliseconds on ethernet.
Transmitting is randomly paused for a long time (cca 1-2 sec) then it is
resumed.
 
Task1 in function lwip_netconn_do_write() takes the semaphore by
sys_arch_sem_wait(LWIP_API_MSG_SEM(msg), 0) and Task1 gets BLOCKED. It
remains blocked for cca 1-2 seconds.
When tcpip_thread in function lwip_netconn_do_writemore() gives semaphore by
sys_sem_signal(op_completed_sem) then Task1 gets finally READY.
 
Please do you have idea why this is happening for such a long time?
 
Thanks
Marek




--
Sent from: http://lwip.100.n7.nabble.com/lwip-users-f3.html

_______________________________________________
lwip-users mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-users

_______________________________________________
lwip-users mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-users
Reply | Threaded
Open this post in threaded view
|

Re: FreeRTOS + Lwip, transmit gets BLOCKED

mjanicek

Hi Simon,

 

tcp_nagle_disable() helped.  Now there is long delay only when there are also  incoming packets while transmitting.

This happens only when lwip_netconn_do_writemore() ends with error. That means there is not enough memory.

So I will also check on this.

 

Thanks a lot.

Br

 

Marek

 

 

From: lwip-users <lwip-users-bounces+mjanicek=[hidden email]> On Behalf Of Simon Wilton
Sent: Tuesday, March 03, 2020 1:31 PM
To: Mailing list for lwIP users <[hidden email]>
Subject: Re: [lwip-users] FreeRTOS + Lwip, transmit gets BLOCKED

 

Hi Marek

 

There is an automatic back-off mechanism designed to stop nodes flooding the network with small TCP messages called Nagle algorithm. Check if you are being blocked by that. You can turn it off - i think on a per connection basis.

 

There is also a similar thread that I found when i was looking at a similar problem http://lwip.100.n7.nabble.com/lwIP-hangs-on-transfers-with-many-short-packets-td11044.html

 

BR

 

Simon


From: lwip-users <[hidden email]> on behalf of mjanicek <[hidden email]>
Sent: 03 March 2020 08:46
To: [hidden email] <[hidden email]>
Subject: [lwip-users] FreeRTOS + Lwip, transmit gets BLOCKED

 

Hello,
 
I have STM32F407 running FreeRTOS + Lwip (netconn). I have several tasks.
Only one Task1 is transmitting continously small packets (85 bytes) every 5
miliseconds on ethernet.
Transmitting is randomly paused for a long time (cca 1-2 sec) then it is
resumed.
 
Task1 in function lwip_netconn_do_write() takes the semaphore by
sys_arch_sem_wait(LWIP_API_MSG_SEM(msg), 0) and Task1 gets BLOCKED. It
remains blocked for cca 1-2 seconds.
When tcpip_thread in function lwip_netconn_do_writemore() gives semaphore by
sys_sem_signal(op_completed_sem) then Task1 gets finally READY.
 
Please do you have idea why this is happening for such a long time?
 
Thanks
Marek




--
Sent from: http://lwip.100.n7.nabble.com/lwip-users-f3.html

_______________________________________________
lwip-users mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-users


_______________________________________________
lwip-users mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-users