[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [lwip-users] Feeding incoming packets to lwIP
From: |
Leon Woestenberg |
Subject: |
Re: [lwip-users] Feeding incoming packets to lwIP |
Date: |
Thu, 16 Jan 2003 01:14:13 +0100 |
Hello all,
these are my findings on using lwIP w/ pre-emptive scheduling:
- lwIP is not thread safe in many areas.
- use a global mutex to protect calls to any lwIP function.
- use a high priority 'network task' task that calls lwIP when packets are
received.
- leave interrupts enabled (often required in embedded applications) and
when
a network interface interrupt occurs, wake up the network task.
- do NOT call lwIP functions in the interrupt, but if you do, accept/try the
mutex
before that, unlock it afterwards.
- have the network task forward/accept packet data to/from applications.
I have used this approach successfully with uCOS-II on a pre-emptive
nesting interrupts microcontroller, where interrupts are on at all times
(except
for some uCOS internal cricitical sections).
I will release the code sometime when I find a few days time to decouple the
code from our applications.
Regards, Leon.