FreeBSD/src dab6156 (r343213)sys/net80211 ieee80211_freebsd.c ieee80211_ioctl.c, sys/sys param.h

net80211: resolve ioctl <-> detach race for ieee80211com structure

Since r287197 ieee80211com is a part of drivers softc; as a result,
after detach all pointers to it (iv_ic, ni_ic) are invalid. Most
possible users (tasks, interrupt handlers) are blocked / removed
when device is stopped; however, ioctl handlers were not tracked
and may crash if ieee80211com structure is accessed.

Since ieee80211com pointer access from ieee80211vap structure is not
protected by lock (constant after interface creation) and used in
many other places just use reference counting for ioctl handlers;
on detach set 'detached' flag and wait until reference counter goes to 0.

For HEAD ieee80211vap size was changed (__FreeBSD_version bumped);
however, in stable branches I'm going to split / reuse the last
iv_spare field for KBI stability.

Tested with:
 - rsu(4), SIOCSIFCAP (-rxcsum) ioctl;
 - rtwn_pci(4), SIOCG80211 / IEEE80211_IOC_HTPROTMODE ioctl.

MFC after:      1 week
DeltaFile
+49-0sys/net80211/ieee80211_freebsd.c
+9-1sys/net80211/ieee80211_ioctl.c
+7-0sys/net80211/ieee80211_var.h
+5-1sys/net80211/ieee80211_freebsd.h
+3-1sys/net80211/ieee80211.c
+1-1sys/sys/param.h
+74-46 files

UnifiedSplitRaw