networking driver implementation question

Efren Serra efren.serra at Sun.COM
Wed Oct 17 00:58:51 UTC 2001


Till,

> Hi.
>
> I am porting Donald Beckers linux driver for the yellowfin/Symbios
> 53C885
> to RTEMS.
>
> When I look at the ethernet drivers in 'libchip' I can see that a common
>
> scheme is to create driver tasks. The TX task doing something like
>
> for (;;) {
>    wait_on_event();
>    IF_DEQUEUE(&ifp->if_snd, m);
>    sendpacket(m);
> }
>
> Note that this loop is running in the context of the network _driver's_
> task.
>
> A close look at IF_DEQUEUE() [which normally is only used in the context
>
> of the BSD networking task] reveals that the queue data structure is not
>
> protected by any kind of mutex.
>
> Can somebody explain how the queue is protected from being corrupted
> (other than by good karma)??
>
> -- Regards, Till.

IF_DEQUEUE is a C macro; there is another C macro of the form MBUFLOCK.  If
you really want to understand this, take a look at TCP/IP Illustrated Volume
2 by Stevens et.al.  It is all about mbufs.




More information about the users mailing list