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

Luigi Rizzo rizzo at iet.unipi.it
Mon Aug 5 16:15:03 UTC 2013


On Mon, Aug 5, 2013 at 5:46 PM, Adrian Chadd <adrian at freebsd.org> wrote:

> On 5 August 2013 07:59, Bryan Venteicher <bryanv at daemoninthecloset.org>
> wrote:
>
> > What I've done in my drivers is:
> >   * Lock the core mutex
> >   * Clear IFF_DRV_RUNNING
> >   * Lock/unlock each queue's lock
>
> .. and I think that's the only sane way of doing it.
>

yeah, this was also the solution we had in mind, i was surprised
not find this pattern in the drivers i have looked at.

Also there are drivers (chelsio ?) which do not seem to have locks on the
receive interrupt handlers ?

Does anyone know how linux copes with the same problem ?

They seem to have an rtnl_lock() which is a global lock for all
configuration
of netdevices (would replace our per-interface 'core lock' above),
but i am totally unclear on how individual tx threads and interrupt handlers
acknowledge that they have read the change in status.

cheers
luigi


More information about the freebsd-current mailing list