buglwIP - A Lightweight TCP/IP stack - Bugs: bug #50698, Need separate sys_arch functions...


You are not allowed to post comments on this tracker with your current authentication level.

bug #50698: Need separate sys_arch functions for interrupt context

Submitted by:  Daniel Elstner <danielk>
Submitted on:  Sat 01 Apr 2017 07:28:36 PM UTC  
Category: Platform portsSeverity: 1 - Wish
Item Group: Feature RequestStatus: None
Privacy: PublicAssigned to: None
Open/Closed: OpenPlanned Release: None
lwIP version: git head

Wed 05 Apr 2017 07:22:09 PM UTC, comment #1:

I'm aware of that freaky interrupt context interface FreeRTOS has. I don't know of any other OS doing it like that and honestly can't follow the argumentation of people telling me that doing it the FreeRTOS way is a performance improvement.

I do use FreeRTOS and like you, I don't need a change in lwIP (although it's fixed in a different way, not using DSRs, at least not on all platforms).

Nevertheless, since FreeRTOS seems to be often bundled with lwIP, I'm open for suggestions here.

Simon Goldschmidt <goldsimon>
Project Administrator
Sat 01 Apr 2017 07:28:36 PM UTC, original submission:

Depending on the configuration, lwIP allows some operations to be executed from interrupt context. E.g. the static callback mechanism is intended to allow posting messages to the TCP/IP thread via tcpip_trycallback() directly from an interrupt handler.

However, I noticed that tcpip_trycallback() calls into the same sys_arch function -- sys_mbox_trypost() -- as tcpip_callback_with_block() does. Unfortunately, this makes it impossible to use this feature on systems which have separate API calls for user context and interrupt context, such as FreeRTOS.

Thus I think the sys_arch API needs to be extended with a new function, say sys_mbox_trypost_from_isr(). It would be optional and simply alias to sys_mbox_trypost() by default. On the public API side, a corresponding tcpip_trycallback_from_isr() would need to be added. Alternatively, tcpip_trycallback() could be changed to use the new function and documented as being callable from interrupt context only.

In order to support LWIP_ALLOW_MEM_FREE_FROM_OTHER_CONTEXT, there would also have to be separate versions of SYS_ARCH_(UN)PROTECT for use from interrupt context, as some FreeRTOS ports also require different calls for these. This would in turn also require separate ISR variants of memp_free() and pbuf_free(), so it may not be worth the effort.

Caveat: In my own design I delegate most interrupt work to high-priority threads which then in turn post messages to the lwIP thread. So I personally don't have any immediate need for this, and wouldn't be eating my own dog food if I contribute a patch.

Daniel Elstner <danielk>


No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -unavailable- added by goldsimon (Posted a comment)
  • -unavailable- added by danielk (Submitted the item)

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.


    Please enter the title of George Orwell's famous dystopian book (it's a date):



    Follows 1 latest change.

    Date Changed By Updated Field Previous Value => Replaced By
    Wed 05 Apr 2017 07:22:09 PM UTCgoldsimonSeverity3 - Normal=>1 - Wish

    Back to the top

    Powered by Savane 3.1-cleanup1