splimp, splx locks in network code - cause of my vanished buffers ?

Eric Norum eric at cls.usask.ca
Wed Mar 15 14:53:05 UTC 2000


Nick.SIMON at syntegra.bt.co.uk wrote:
> 
> Using rtems 4.0.0, I have two ethernet ports, one running the normal BSD
> stack and one with a special raw ethernet stack.  The latter uses the same
> pool of mbufs and clusters as the bsd stack, and all the usual macros like
> MGETHDR and MFREE.
> 
> Unfortunately, with both networks whizzing away merrily, it eventually dies
> from lack of mbufs (and there are plenty to start with).  I see that in
> rtems_bsdnet_internal.h the macros splimp and splx are defined to do
> nothing, which allows certain timing hits an opportunity to screw up the
> free chain.
> 
> Questions:
> 
> (1) Can I use rtems_interrupt_disable() for splimp, ...enable for splx?
> (2) What about splnet?
> (3) Am I barking up the wrong tree?
> 

(3) -- assuming your driver interrupt handler has been written properly.
Yes, splimp and splx are empty.  This is neither an error nor an
oversight.

The network code in RTEMS use a mutex to ensure that only one task is
active in the code.  A properly-written network interrupt handler should
do little more than some minimal hardware housekeeping (to prevent the
same interrupt request from being handled more than once) and wake up
the receive and/or transmit driver daemons.  Since the receive and
transmit daemons must obtain the network mutex before running, they can
not preempt any critical network code -- so the critical network code
does not need to be protected by splimp/splx.

However, I am not surprised that you are having problems when you push
hard on the 4.0.0 network stack.  There have been a *lot* of fixes to
the network and driver code since 4.0.0.  RTEMS 4.5.0, which
incorporates these changes, should be out very soon.  I expect that it
would have already been released but for a family crisis in the J.
Sherril household.

-- 
Eric Norum                                 eric at cls.usask.ca
Canadian Light Source                      Phone: (306) 966-6308
University of Saskatchewan                 FAX:   (306) 966-6058
Saskatoon, Canada.



More information about the users mailing list