Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 5 Aug 2013 18:15:00 +0200
From:      Luigi Rizzo <rizzo@iet.unipi.it>
To:        Adrian Chadd <adrian@freebsd.org>
Cc:        Giuseppe Lettieri <g.lettieri@iet.unipi.it>, Bryan Venteicher <bryanv@daemoninthecloset.org>, current@freebsd.org, net@freebsd.org
Subject:   Re: [net] protecting interfaces from races between control and data ?
Message-ID:  <CA%2BhQ2%2BhuoCCweq7fjoYmH3nyhmhb5DzukEdPSMtaJEWa8Ft0JQ@mail.gmail.com>
In-Reply-To: <CAJ-VmokT6YKPR7CXsoCavEmWv3W8urZu4eBVgKWaj9iMaVJFZg@mail.gmail.com>
References:  <20130805082307.GA35162@onelab2.iet.unipi.it> <2034715395.855.1375714772487.JavaMail.root@daemoninthecloset.org> <CAJ-VmokT6YKPR7CXsoCavEmWv3W8urZu4eBVgKWaj9iMaVJFZg@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, Aug 5, 2013 at 5:46 PM, Adrian Chadd <adrian@freebsd.org> wrote:

> On 5 August 2013 07:59, Bryan Venteicher <bryanv@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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CA%2BhQ2%2BhuoCCweq7fjoYmH3nyhmhb5DzukEdPSMtaJEWa8Ft0JQ>