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

Adrian Chadd adrian at freebsd.org
Mon Aug 5 15:46:07 UTC 2013


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.

I'm going to (soon) propose something similar for cxgbe/ixgbe as we
use these NICs at work, then feed this experiment back into the
network stack so we can have a unified way of doing this.

You may also want to synchronize against the driver TX/RX/core locks
and state when doing things like, say, halting DMA in preparation for
multicast reprogramming on some hardware; or even doing a chip reset.

I had to hand-roll this for ath(4) to make it completely correct - any
kind of overlapping reset, reset during TX, reset during RX etc would
cause all kinds of instability and random-crap-scribbled-everywhere
issues. So yes, this is a larger scale issue that needs to be solved.


-adrian


More information about the freebsd-current mailing list