From owner-svn-src-user@FreeBSD.ORG  Wed Oct 26 15:01:04 2011
Return-Path: <owner-svn-src-user@FreeBSD.ORG>
Delivered-To: svn-src-user@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id A211D106566C;
	Wed, 26 Oct 2011 15:01:04 +0000 (UTC)
	(envelope-from adrian@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 926CF8FC1E;
	Wed, 26 Oct 2011 15:01:04 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p9QF14eY055217;
	Wed, 26 Oct 2011 15:01:04 GMT (envelope-from adrian@svn.freebsd.org)
Received: (from adrian@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id p9QF14su055215;
	Wed, 26 Oct 2011 15:01:04 GMT (envelope-from adrian@svn.freebsd.org)
Message-Id: <201110261501.p9QF14su055215@svn.freebsd.org>
From: Adrian Chadd <adrian@FreeBSD.org>
Date: Wed, 26 Oct 2011 15:01:04 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-user@freebsd.org
X-SVN-Group: user
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r226792 - user/adrian/if_ath_tx/sys/dev/ath
X-BeenThere: svn-src-user@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the experimental &quot; user&quot;
	src tree" <svn-src-user.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-user>,
	<mailto:svn-src-user-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-user>
List-Post: <mailto:svn-src-user@freebsd.org>
List-Help: <mailto:svn-src-user-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-user>,
	<mailto:svn-src-user-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Wed, 26 Oct 2011 15:01:04 -0000

Author: adrian
Date: Wed Oct 26 15:01:04 2011
New Revision: 226792
URL: http://svn.freebsd.org/changeset/base/226792

Log:
  When returning a cloned/busy buffer, a failed DMA setup should
  stuff the buffer on the front of the list, not the tail. That
  way it won't interfere with busy buffer logic.

Modified:
  user/adrian/if_ath_tx/sys/dev/ath/if_ath_tx.c

Modified: user/adrian/if_ath_tx/sys/dev/ath/if_ath_tx.c
==============================================================================
--- user/adrian/if_ath_tx/sys/dev/ath/if_ath_tx.c	Wed Oct 26 14:56:09 2011	(r226791)
+++ user/adrian/if_ath_tx/sys/dev/ath/if_ath_tx.c	Wed Oct 26 15:01:04 2011	(r226792)
@@ -2645,8 +2645,15 @@ ath_tx_retry_clone(struct ath_softc *sc,
 		device_printf(sc->sc_dev,
 		    "%s: failed to setup dma for clone\n",
 		    __func__);
-		/* XXX this frees the dmasetup that failed above? */
-		ath_freebuf(sc, nbf);
+		/*
+		 * Put this at the head of the list, not tail;
+		 * that way it doesn't interfere with the
+		 * busy buffer logic (which uses the tail of
+		 * the list.)
+		 */
+		ATH_TXBUF_LOCK(sc);
+		TAILQ_INSERT_HEAD(&sc->sc_txbuf, nbf, bf_list);
+		ATH_TXBUF_UNLOCK(sc);
 		return NULL;
 	}