From owner-svn-src-head@FreeBSD.ORG  Sat Apr  7 03:22:12 2012
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 01A2C106566C;
	Sat,  7 Apr 2012 03:22:12 +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 C75EF8FC08;
	Sat,  7 Apr 2012 03:22:11 +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 q373MBiE039516;
	Sat, 7 Apr 2012 03:22:11 GMT (envelope-from adrian@svn.freebsd.org)
Received: (from adrian@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id q373MBH5039514;
	Sat, 7 Apr 2012 03:22:11 GMT (envelope-from adrian@svn.freebsd.org)
Message-Id: <201204070322.q373MBH5039514@svn.freebsd.org>
From: Adrian Chadd <adrian@FreeBSD.org>
Date: Sat, 7 Apr 2012 03:22:11 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r233970 - head/sys/dev/ath
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	<svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
	<mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sat, 07 Apr 2012 03:22:12 -0000

Author: adrian
Date: Sat Apr  7 03:22:11 2012
New Revision: 233970
URL: http://svn.freebsd.org/changeset/base/233970

Log:
  Enforce the RTS aggregation limit if RTS/CTS protection is enabled;
  if any subframes in an aggregate have different protection from the
  first frame in the formed aggregate, don't add that frame to the
  aggregate.
  
  This is likely a suboptimal method (I think we'll mostly be OK marking
  frames that have seqno's with the same protection as normal data frames)
  but I'll just be cautious for now.

Modified:
  head/sys/dev/ath/if_ath_tx_ht.c

Modified: head/sys/dev/ath/if_ath_tx_ht.c
==============================================================================
--- head/sys/dev/ath/if_ath_tx_ht.c	Sat Apr  7 03:20:14 2012	(r233969)
+++ head/sys/dev/ath/if_ath_tx_ht.c	Sat Apr  7 03:22:11 2012	(r233970)
@@ -707,14 +707,6 @@ ath_tx_form_aggr(struct ath_softc *sc, s
 		 */
 
 		/*
-		 * XXX TODO: AR5416 has an 8K aggregation size limit
-		 * when RTS is enabled, and RTS is required for dual-stream
-		 * rates.
-		 *
-		 * For now, limit all aggregates for the AR5416 to be 8K.
-		 */
-
-		/*
 		 * do not exceed aggregation limit
 		 */
 		al_delta = ATH_AGGR_DELIM_SZ + bf->bf_state.bfs_pktlen;
@@ -725,6 +717,20 @@ ath_tx_form_aggr(struct ath_softc *sc, s
 		}
 
 		/*
+		 * If RTS/CTS is set on the first frame, enforce
+		 * the RTS aggregate limit.
+		 */
+		if (bf_first->bf_state.bfs_txflags &
+		    (HAL_TXDESC_CTSENA | HAL_TXDESC_RTSENA)) {
+			if (nframes &&
+			   (sc->sc_rts_aggr_limit <
+			     (al + bpad + al_delta + prev_al))) {
+				status = ATH_AGGR_8K_LIMITED;
+				break;
+			}
+		}
+
+		/*
 		 * Do not exceed subframe limit.
 		 */
 		if ((nframes + prev_frames) >= MIN((h_baw),
@@ -734,7 +740,24 @@ ath_tx_form_aggr(struct ath_softc *sc, s
 		}
 
 		/*
-		 * TODO: If it's _before_ the BAW left edge, complain very loudly.
+		 * If the current frame has an RTS/CTS configuration
+		 * that differs from the first frame, don't include
+		 * this in the aggregate.  It's possible that the
+		 * "right" thing to do here is enforce the aggregate
+		 * configuration.
+		 */
+		if ((bf_first->bf_state.bfs_txflags &
+		    (HAL_TXDESC_RTSENA | HAL_TXDESC_CTSENA)) !=
+		   (bf->bf_state.bfs_txflags &
+		    (HAL_TXDESC_RTSENA | HAL_TXDESC_CTSENA))) {
+			status = ATH_AGGR_NONAGGR;
+			break;
+		}
+
+		/*
+		 * TODO: If it's _before_ the BAW left edge, complain very
+		 * loudly.
+		 *
 		 * This means something (else) has slid the left edge along
 		 * before we got a chance to be TXed.
 		 */
@@ -814,11 +837,6 @@ ath_tx_form_aggr(struct ath_softc *sc, s
 		bf->bf_state.bfs_addedbaw = 1;
 
 		/*
-		 * XXX TODO: If any frame in the aggregate requires RTS/CTS,
-		 * set the first frame.
-		 */
-
-		/*
 		 * XXX enforce ACK for aggregate frames (this needs to be
 		 * XXX handled more gracefully?
 		 */