[net] protecting interfaces from races between control and data ?

Bryan Venteicher bryanv at daemoninthecloset.org
Mon Aug 5 21:01:54 UTC 2013



----- Original Message -----
> On Mon, Aug 5, 2013 at 8:19 PM, Adrian Chadd <adrian at freebsd.org> wrote:
> 
> > No, brian said two things:
> >
> > * the flag, protected by the core lock
> > * per-queue flags
> >
> 
> i see no mentions on per-queue flags on his email.
> This is the relevant part
> 

Right, I just use the IFF_DRV_RUNNING flag. I think Adrian meant
'per-queue locks' here? 

> ------------
> 
> What I've done in my drivers is:
>   * Lock the core mutex
>   * Clear IFF_DRV_RUNNING
>   * Lock/unlock each queue's lock
> 
> The various Rx/Tx queue functions check for IFF_DRV_RUNNING after
> (re)acquiring their queue lock. See at vtnet_stop_rendezvous() at
> [1] for an example.
> 
> [1]
> http://svnweb.freebsd.org/base/user/bryanv/vtnetmq/sys/dev/virtio/network/if_vtnet.c?revision=252451&view=markup
> 
> -----------------
> 
> 
> >
> >
> >
> > -adrian
> >
> 
> 
> 
> --
> -----------------------------------------+-------------------------------
>  Prof. Luigi RIZZO, rizzo at iet.unipi.it  . Dip. di Ing. dell'Informazione
>  http://www.iet.unipi.it/~luigi/        . Universita` di Pisa
>  TEL      +39-050-2211611               . via Diotisalvi 2
>  Mobile   +39-338-6809875               . 56122 PISA (Italy)
> -----------------------------------------+-------------------------------
> 


More information about the freebsd-current mailing list