Waiting for mbufs

Chris Johns cjohns at cybertec.com.au
Wed Mar 12 21:19:22 UTC 2003

gregory.menke at gsfc.nasa.gov wrote:

> Is there a task-id sensitivity built into the stack?  When I had 2
> daemons per unit, the mbuf problem didn't occur.  I'm kind of
> wondering if it could be some kind of effect related to
> event_receive/semaphore timing.  Calling
> rtems_bsdnet_show_mbuf_stats() shows 400+ mbufs free.  Any hints are
> appreciated.

How many clusters do you have and how many are pending in the drivers (I am 
assuming the device supports scatter/gather operation) ?

The mbuf stat command lists the clusters as well as the numbre free. Clusters 
are different to mbufs.

If you run short or are running low, the two task design will allow a driver to 
block, and let the other run. The other running receive task can receive data, 
pass to the stack some clusters which are freed, releasing the blocked recieve 
task. In a single task design the second card cannot service its receive chain 
so you block.

You could use a NO_WAIT design with scatter/gather hardware where low cluster 
counts result in less receive buffers queued in hardware. If you run out the MAC 
should report missed receives but what is received is passed to the stack in a 
timely manner.

  Chris Johns, cjohns at cybertec.com.au

More information about the users mailing list