Fix a cleanup hang if cleanup gets called _during_ an active cleanup.

During power save testing I noticed that the cleanup code is being
called during a RUN->RUN state transition.  It's because the net80211
stack is treating that (for reasons I don't quitey know yet) as a
reassociation and this calls the node cleanup code.  The reason it's
seeing a RUN->RUN transition is because during active power save
stuff it's possible that the RUN->SLEEP and SLEEP->RUN transitions
happen so quickly that the deferred net80211 vap state code
"loses" a transition, namely the intermediary SLEEP transition.

So, this was causing the node reassociation code to sometimes be called
twice in quick succession and this would result in ath_tx_tid_cleanup()
to be called again.  The code calling it would always call pause, and
then only call resume if the TID didn't have "cleanup_inprogress" set.
Unfortunately it didn't check if it was already set on entry, so it
would pause but not call resume.  Thus, paused would be called more
than once (once before each entry into ath-tx_tid_cleanup()) but resume
would only be called once when the cleanup state was finished.

This doesn't entirely fix all of the issues seen in the cleanup path
but it's a necessary first step.

Since this is a stability fix, it should be merged to stable/10 at some
point.

Tested:

* AR5416, STA mode

MFC after:	7 days


git-svn-id: svn+ssh://svn.freebsd.org/base/head@264708 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
bsd-family-tree: Add missing releases

- NetBSD 6.0.4
- DragonFly 3.6.2


git-svn-id: svn+ssh://svn.freebsd.org/base/head@264709 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Make sure bf_next is NULL'ed out when we're completing up an aggregate
frame through the cleanup path.

Whilst here, fix the indenting for something I messed up.

Tested:

* AR5416, STA mode


git-svn-id: svn+ssh://svn.freebsd.org/base/head@264710 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
* Modify the debugging output from pause/resume to note the TID and STA
  MAC
* Now that the paused < 0 bugs have been identified, make the DPRINTF()
  a device_printf() again.  Anything else that shows up here needs to be
  fixed immediately.

Tested:

* AR5416, STA mode

MFC after:	7 days


git-svn-id: svn+ssh://svn.freebsd.org/base/head@264711 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Rewrite the cleanup code to, well, actually work right.

The existing cleanup code was based on the Atheros reference driver
from way back and stuff that was in Linux ath9k.  It turned out to be ..
rather silly.

Specifically:

* The whole method of determining whether there's hardware-queued frames
  was fragile and the BAW would never quite work right afterwards.

* The cleanup path wouldn't correctly pull apart aggregate frames in the
  queue, so frames would not be freed and the BAW wouldn't be correctly
  updated.

So to implement this:

* Pull the aggregate frames apart correctly and handle each separately;
* Make the atid->incomp counter just track the number of hardware queued
  frames rather than try to figure it out from the BAW;
* Modify the aggregate completion path to handle it as a single frame
  (atid->incomp tracks the one frame now, not the subframes) and
  remove the frames from the BAW before completing them as normal frames;
* Make sure bf->bf_next is NULled out correctly;
* Make both aggregate session and non-aggregate path frames now be
  handled via the incompletion path.

TODO:

* kill atid->incomp; the driver tracks the hardware queued frames
  for each TID and so we can just use that.

This is a stability fix that should be merged back to stable/10.

Tested:

* AR5416, STA

MFC after:	7 days


git-svn-id: svn+ssh://svn.freebsd.org/base/head@264720 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Rename the fp{get,set}* files so they no longer conflict with the softfloat
version of these files. Keep them within this directory so they can be used
to implement the armv6 version of these functions.


git-svn-id: svn+ssh://svn.freebsd.org/base/head@264721 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
libc: Add fopen() test to regression Makefile.


git-svn-id: svn+ssh://svn.freebsd.org/base/head@264725 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
urndis(4) will first appear in 9.3-RELEASE.

MFC after:	3 days
Sponsored by:	The FreeBSD Foundation


git-svn-id: svn+ssh://svn.freebsd.org/base/head@264731 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
libc/stdio: Fail fdopen() on an execute-only fd.

An execute-only fd (opened with O_EXEC) allows neither read() nor write()
and is therefore incompatible with all stdio modes. Therefore, the [EINVAL]
error applies.

Also adjust the similar check in freopen() with a NULL path, even though
this checks an fd which is already from a FILE.


git-svn-id: svn+ssh://svn.freebsd.org/base/head@264737 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
For an NFSv4 mount with the "nocto" option, don't get the
up to date file attributes upon close. This reduces the
Getattr RPC count by about 65% for software builds.

MFC after:	2 weeks


git-svn-id: svn+ssh://svn.freebsd.org/base/head@264738 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Add {} braces so that the code conforms to the indentation.
Fortunately, I don't think doing the assignment of cap->tsomax
unconditionally causes any problem.

Reviewed by:	glebius
MFC after:	2 weeks


git-svn-id: svn+ssh://svn.freebsd.org/base/head@264739 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Use case insensitive match in portsnap.

PR:		bin/186510
Submitted by:	olli
MFC after:	2 weeks


git-svn-id: svn+ssh://svn.freebsd.org/base/head@264740 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Add placeholder Kyuafiles for various top-level hierarchies.

This change adds tests/ directories in the source tree to create various
subdirectories in /usr/tests/ and to install placeholder Kyuafiles for
them.

the relevant hierarchies are: cddl, etc, games, gnu and secure.

The reason for this is to simplify the addition of new test programs for
utilities or libraries under any of these directories.  Doing so on a
case by case basis is unnecessary and is quite an obscure process.


git-svn-id: svn+ssh://svn.freebsd.org/base/head@264741 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Prevent building tests when bootstrapping make.

Should fix the breakage reported by tinderbox when WITHOUT_BMAKE is set,
which was probably introduced in r263346..


git-svn-id: svn+ssh://svn.freebsd.org/base/head@264742 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Add parameterized position handling to printf(1).

Add a new %n$ option to change the order of the parameters as
done in the ksh93 builtin printf (among others).

For example:
%printf '%2$1d %1$s\n' one 2 three 4
2 one
4 three

The feature was written by Garret D'Amore under a
BSD license for Nexenta/illumos.

Reference:
http://garrett.damore.org/2010/10/new-implementation-of-printf.html

PR:		bin/152934
Obtained from:	Illumos
MFC after:	2 weeks


git-svn-id: svn+ssh://svn.freebsd.org/base/head@264743 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Various style(9) fixes and typos in grep, sort and patch.

MFC after:	3 days


git-svn-id: svn+ssh://svn.freebsd.org/base/head@264744 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Fixes mkdir for the NFSv2 client that was broken by r264705.

Reported by:	bdrewery
MFC after:	2 weeks


git-svn-id: svn+ssh://svn.freebsd.org/base/head@264749 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Don't claim the adapter is idle if it is clearing a drive.

MFC after:	1 week


git-svn-id: svn+ssh://svn.freebsd.org/base/head@264765 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
- Fix an off by one error when checking for the stop event.  This resulted
  in not showing the most recent event by default.
- When the stop even is hit, break out of the outer loop to stop fetching
  more events.

MFC after:	1 week


git-svn-id: svn+ssh://svn.freebsd.org/base/head@264766 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Factor out common ioport handler code for better hygiene -- pointed
out by neel@.

Approved by:	neel (co-mentor)


git-svn-id: svn+ssh://svn.freebsd.org/base/head@264768 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f