From owner-svn-src-all@freebsd.org Sun Apr 2 20:59:13 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A9FB4D2B769; Sun, 2 Apr 2017 20:59:13 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 84FE5EFB; Sun, 2 Apr 2017 20:59:13 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v32KxCRA088881; Sun, 2 Apr 2017 20:59:12 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v32KxC78088880; Sun, 2 Apr 2017 20:59:12 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201704022059.v32KxC78088880@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Sun, 2 Apr 2017 20:59:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r316429 - head/sys/net80211 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 02 Apr 2017 20:59:13 -0000 Author: adrian Date: Sun Apr 2 20:59:12 2017 New Revision: 316429 URL: https://svnweb.freebsd.org/changeset/base/316429 Log: [net80211] refactor the A-MPDU RX window code The RX window update code is effectively the same in both locations. Reviewed by: avos Differential Revision: https://reviews.freebsd.org/D10208 Modified: head/sys/net80211/ieee80211_ht.c Modified: head/sys/net80211/ieee80211_ht.c ============================================================================== --- head/sys/net80211/ieee80211_ht.c Sun Apr 2 20:57:59 2017 (r316428) +++ head/sys/net80211/ieee80211_ht.c Sun Apr 2 20:59:12 2017 (r316429) @@ -644,6 +644,40 @@ ampdu_dispatch(struct ieee80211_node *ni (void) ieee80211_input(ni, m, 0, 0); } +static void +ampdu_rx_moveup(struct ieee80211_rx_ampdu *rap, struct ieee80211_node *ni, + int i, int winstart) +{ + struct ieee80211vap *vap = ni->ni_vap; + + if (rap->rxa_qframes != 0) { + int n = rap->rxa_qframes, j; + + if (winstart != -1) { + /* + * NB: in window-sliding mode, 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]; + rap->rxa_m[j] = NULL; + if (--n == 0) + break; + } + } + KASSERT(n == 0, ("%s: lost %d frames, qframes %d off %d " + "BA win <%d:%d> winstart %d", + __func__, n, rap->rxa_qframes, i, rap->rxa_start, + IEEE80211_SEQ_ADD(rap->rxa_start, rap->rxa_wnd-1), + winstart)); + vap->iv_stats.is_ampdu_rx_copy += rap->rxa_qframes; + } +} + /* * Dispatch as many frames as possible from the re-order queue. * Frames will always be "at the front"; we process all frames @@ -674,19 +708,8 @@ ampdu_rx_dispatch(struct ieee80211_rx_am * If frames remain, copy the mbuf pointers down so * they correspond to the offsets in the new window. */ - if (rap->rxa_qframes != 0) { - int n = rap->rxa_qframes, j; - for (j = i+1; j < rap->rxa_wnd; j++) { - if (rap->rxa_m[j] != NULL) { - rap->rxa_m[j-i] = rap->rxa_m[j]; - rap->rxa_m[j] = NULL; - if (--n == 0) - break; - } - } - KASSERT(n == 0, ("lost %d frames", n)); - vap->iv_stats.is_ampdu_rx_copy += rap->rxa_qframes; - } + ampdu_rx_moveup(rap, ni, i, -1); + /* * Adjust the start of the BA window to * reflect the frames just dispatched. @@ -761,27 +784,8 @@ ampdu_rx_flush_upto(struct ieee80211_nod * If frames remain, copy the mbuf pointers down so * they correspond to the offsets in the new window. */ - if (rap->rxa_qframes != 0) { - int n = rap->rxa_qframes, j; + ampdu_rx_moveup(rap, ni, i, winstart); - /* 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]; - rap->rxa_m[j] = NULL; - if (--n == 0) - break; - } - } - KASSERT(n == 0, ("%s: lost %d frames, qframes %d off %d " - "BA win <%d:%d> winstart %d", - __func__, n, rap->rxa_qframes, i, rap->rxa_start, - IEEE80211_SEQ_ADD(rap->rxa_start, rap->rxa_wnd-1), - winstart)); - vap->iv_stats.is_ampdu_rx_copy += rap->rxa_qframes; - } /* * Move the start of the BA window; we use the * sequence number of the last MSDU that was