lwip-users
[Top][All Lists]
Advanced

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

Re: [lwip-users] TCPIP and MAC thread task priorities


From: Sylvain Rochet
Subject: Re: [lwip-users] TCPIP and MAC thread task priorities
Date: Mon, 27 Feb 2017 12:02:04 +0100
User-agent: Mutt/1.5.23 (2014-03-12)

Hi Wayne,

On Mon, Feb 27, 2017 at 01:56:24PM +1000, Wayne Uroda wrote:
> I was looking through my codebase recently (a mix of code from LPC Open,
> and also a project I inherited) and I saw a comment which I want to fact
> check:
> 
> /* TCPIP thread must run at higher priority than MAC threads! */
> 
> My software is using FreeRTOS. The Ethernet interrupt only signals a
> semaphore which wakes up the "MAC" thread. This thread handles incoming and
> outgoing packets on the ethernet hardware.
> 
> The comment implies that this MAC thread must run at a lower priority than
> the TCPIP thread. I don't know who wrote the comment, or if it is correct.
> This posting

"must" is wrong, there is no such requirement.


> http://lists.nongnu.org/archive/html/lwip-users/2010-03/msg00148.html
> 
> indicates that there may not be such a stringent requirement, and it might
> even be advantageous to have the Ethernet task run at a higher priority
> than the TCPIP thread, but I'm not sure if the same applies to a MAC thread.

At first sight, if your TCPIP thread is busy handling packets from the 
message box there is little value of pushing more packets into it. But 
(there is always a but), if you do otherwise, if the TCPIP message box 
is full, you will enter a priority inversion condition and your RX 
thread will wait for a little while to queue the message or drop the 
packet.

It means having your RX thread with a higher priority helps your system 
to fill the TCPIP thread message box, this is not the case if your RX 
thread have a lower priority than the TCPIP thread.

So, I'm with Simon on that, your RX thread *should* have a higher 
priority than the TCPIP thread. Anyway, this is always the case for RX 
interrupt based systems.


Sylvain

Attachment: signature.asc
Description: Digital signature


reply via email to

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