Module Name:    src
Committed By:   ozaki-r
Date:           Wed May 15 02:56:48 UTC 2019

Modified Files:
        src/sys/dev/ic: dwc_gmac.c
        src/sys/dev/pci: if_wm.c
        src/sys/dev/pci/ixgbe: ixgbe.c
        src/sys/net: if.c if_ether.h if_ethersubr.c

Log Message:
Store IFF_ALLMULTI in ec_flags instead of if_flags to avoid data races

IFF_ALLMULTI is set/unset to if_flags via if_mcast_op.  To avoid data races on
if_flags, IFNET_LOCK was added for if_mcast_op.  Unfortunately it produces
a deadlock so we want to remove added IFNET_LOCK by avoiding the data races by
another approach.

This fix introduces ec_flags to struct ethercom and stores IFF_ALLMULTI to it.
ec_flags is protected by ETHER_LOCK and thus IFNET_LOCK is no longer necessary
for if_mcast_op.  Note that the fix is applied only to MP-safe drivers that
the data races matter.

In the kernel, IFF_ALLMULTI is set by a driver and used by the driver itself.
So changing the storing place doesn't break anything.  One exception is
ioctl(SIOCGIFFLAGS); we have to include IFF_ALLMULTI in a result if needed to
export the flag as well as before.

A upcoming commit will remove IFNET_LOCK.

PR kern/54189


To generate a diff of this commit:
cvs rdiff -u -r1.59 -r1.60 src/sys/dev/ic/dwc_gmac.c
cvs rdiff -u -r1.635 -r1.636 src/sys/dev/pci/if_wm.c
cvs rdiff -u -r1.182 -r1.183 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.451 -r1.452 src/sys/net/if.c
cvs rdiff -u -r1.77 -r1.78 src/sys/net/if_ether.h
cvs rdiff -u -r1.273 -r1.274 src/sys/net/if_ethersubr.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Reply via email to