netdev
[Top] [All Lists]

Re: tx_timeout and timer serialisation

To: Andrew Morton <andrewm@xxxxxxxxxx>
Subject: Re: tx_timeout and timer serialisation
From: jamal <hadi@xxxxxxxxxx>
Date: Mon, 1 May 2000 11:46:08 -0400 (EDT)
Cc: "netdev@xxxxxxxxxxx" <netdev@xxxxxxxxxxx>
In-reply-to: <390DA08D.8979B5B7@uow.edu.au>
Sender: owner-netdev@xxxxxxxxxxx

Andrew,
Hacking away those last minutes? ;->
Not Alexey, but i can give you some answers.

On Tue, 2 May 2000, Andrew Morton wrote:

> In 3c59x we have a timer routine for media selection.  It is set up with
> add_timer().  It is called from a BH (or whatever we call BH's in 2.3)
> 
> We also have the tx_timeout routine which is called from the netdev
> layer.  Another add_timer function.
> 
> We also have hard_start_xmit() which appears to be called from all sorts
> of contexts.
> 

you mean the dev->hard_start_xmit() ?
This is called only from the non interupt context; 
the only exception i can think of is the case of fast routing.

> These three functions can potentially tread upon each others toes and
> hence need serialisation.
> 
> 
> In 2.3, is the driver provided any serialisation guarantees, or do we go
> it alone?
> 

transmit is serialized from the toplevel by the device xmit_lock 

> 
> In 2.2: same question.
> 

BH Lock + dev->tbusy should protect the transmit.

For both 2.2 and 2.3:
- The timer routine for media selection should not trample on 
the transmit or anything else and usage tp->medialock should protect
things in both 2.2 and 2.3;
- The tx_timeout() as well is called only when the xmit_lock is grabbed.
 
> Am I correct in believing that in 2.2, BH handlers were serialised wrt
> SMP, but that in 2.3 they are not?
> 

It is just as serialized but more finer grained in 2.3;

I think the rules are simply:
- use  the tp->medialock for media selection timer
- Dont worry about the tx_timeout() it is serialized with respect to 
your drivers hard_start_xmit()

cheers,
jamal



<Prev in Thread] Current Thread [Next in Thread>