From owner-p4-projects@FreeBSD.ORG Thu Feb 14 17:29:14 2008 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 4248916A418; Thu, 14 Feb 2008 17:29:14 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E38B116A469 for ; Thu, 14 Feb 2008 17:29:13 +0000 (UTC) (envelope-from sam@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id CBE5713C467 for ; Thu, 14 Feb 2008 17:29:13 +0000 (UTC) (envelope-from sam@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.1/8.14.1) with ESMTP id m1EHTDTM001191 for ; Thu, 14 Feb 2008 17:29:13 GMT (envelope-from sam@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.1/8.14.1/Submit) id m1EHTDZj001188 for perforce@freebsd.org; Thu, 14 Feb 2008 17:29:13 GMT (envelope-from sam@freebsd.org) Date: Thu, 14 Feb 2008 17:29:13 GMT Message-Id: <200802141729.m1EHTDZj001188@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to sam@freebsd.org using -f From: Sam Leffler To: Perforce Change Reviews Cc: Subject: PERFORCE change 135389 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Feb 2008 17:29:14 -0000 http://perforce.freebsd.org/chv.cgi?CH=135389 Change 135389 by sam@sam_ebb on 2008/02/14 17:28:58 o fix mbuf leak: some clients send ADDBA to reset a BA stream so we cannot blindly zero the state block, use IEEE80211_AGGR_RUNNING to mark if we've been running and purge the reorder buffer o while here add an assert to codify an obscure assumption Affected files ... .. //depot/projects/vap/sys/net80211/ieee80211_ht.c#15 edit Differences ... ==== //depot/projects/vap/sys/net80211/ieee80211_ht.c#15 (text+ko) ==== @@ -283,19 +283,6 @@ } /* - * Start A-MPDU rx/re-order processing for the specified TID. - */ -static void -ampdu_rx_start(struct ieee80211_rx_ampdu *rap, int bufsiz, int start) -{ - memset(rap, 0, sizeof(*rap)); - rap->rxa_wnd = (bufsiz == 0) ? - IEEE80211_AGGR_BAWMAX : min(bufsiz, IEEE80211_AGGR_BAWMAX); - rap->rxa_start = start; - rap->rxa_flags |= IEEE80211_AGGR_XCHGPEND; -} - -/* * Purge all frames in the A-MPDU re-order queue. */ static void @@ -320,13 +307,33 @@ } /* + * Start A-MPDU rx/re-order processing for the specified TID. + */ +static void +ampdu_rx_start(struct ieee80211_rx_ampdu *rap, int bufsiz, int start) +{ + if (rap->rxa_flags & IEEE80211_AGGR_RUNNING) { + /* + * AMPDU previously setup and not terminated with a DELBA, + * flush the reorder q's in case anything remains. + */ + ampdu_rx_purge(rap); + } + memset(rap, 0, sizeof(*rap)); + rap->rxa_wnd = (bufsiz == 0) ? + IEEE80211_AGGR_BAWMAX : min(bufsiz, IEEE80211_AGGR_BAWMAX); + rap->rxa_start = start; + rap->rxa_flags |= IEEE80211_AGGR_RUNNING | IEEE80211_AGGR_XCHGPEND; +} + +/* * Stop A-MPDU rx processing for the specified TID. */ static void ampdu_rx_stop(struct ieee80211_rx_ampdu *rap) { - rap->rxa_flags &= ~IEEE80211_AGGR_XCHGPEND; ampdu_rx_purge(rap); + rap->rxa_flags &= ~(IEEE80211_AGGR_RUNNING | IEEE80211_AGGR_XCHGPEND); } /* @@ -464,6 +471,10 @@ */ if (rap->rxa_qframes != 0) { int n = rap->rxa_qframes, j; + + /* NB: this loop assumes i > 0 and/or rxa_m[0] is NULL */ + KASSERT(rap->rxa_m[0] == NULL, + ("%s: BA window slot 0 occupied", __func__)); for (j = i+1; j < rap->rxa_wnd; j++) { if (rap->rxa_m[j] != NULL) { rap->rxa_m[j-i] = rap->rxa_m[j];