From owner-svn-src-head@freebsd.org Thu Apr 6 01:35:44 2017 Return-Path: Delivered-To: svn-src-head@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 10B95D31B2B; Thu, 6 Apr 2017 01:35:44 +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 DF743177; Thu, 6 Apr 2017 01:35:43 +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 v361ZhLR080901; Thu, 6 Apr 2017 01:35:43 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v361ZhY3080900; Thu, 6 Apr 2017 01:35:43 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201704060135.v361ZhY3080900@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Thu, 6 Apr 2017 01:35:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r316547 - 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-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Apr 2017 01:35:44 -0000 Author: adrian Date: Thu Apr 6 01:35:42 2017 New Revision: 316547 URL: https://svnweb.freebsd.org/changeset/base/316547 Log: [net80211] refactor out the A-MPDU dispatch routine. The "dispatch a frame from the A-MPDU reorder buffer" code is essentially duplicated in a couple of places. This refactors it out into a single place in preparation for A-MSDU in A-MPDU offload support, where multiple A-MSDUs are decap'ed in hardware to 802.3/802.11 frames, but with the same sequence number. Reviewed by: avos Differential Revision: https://reviews.freebsd.org/D10240 Modified: head/sys/net80211/ieee80211_ht.c Modified: head/sys/net80211/ieee80211_ht.c ============================================================================== --- head/sys/net80211/ieee80211_ht.c Thu Apr 6 00:15:18 2017 (r316546) +++ head/sys/net80211/ieee80211_ht.c Thu Apr 6 01:35:42 2017 (r316547) @@ -644,6 +644,25 @@ ampdu_dispatch(struct ieee80211_node *ni (void) ieee80211_input(ni, m, 0, 0); } +static int +ampdu_dispatch_slot(struct ieee80211_rx_ampdu *rap, struct ieee80211_node *ni, + int i) +{ + struct mbuf *m; + + if (rap->rxa_m[i] == NULL) + return (0); + + m = rap->rxa_m[i]; + rap->rxa_m[i] = NULL; + rap->rxa_qbytes -= m->m_pkthdr.len; + rap->rxa_qframes--; + + ampdu_dispatch(ni, m); + + return (1); +} + static void ampdu_rx_moveup(struct ieee80211_rx_ampdu *rap, struct ieee80211_node *ni, int i, int winstart) @@ -690,20 +709,14 @@ static void ampdu_rx_dispatch(struct ieee80211_rx_ampdu *rap, struct ieee80211_node *ni) { struct ieee80211vap *vap = ni->ni_vap; - struct mbuf *m; int i; /* flush run of frames */ for (i = 1; i < rap->rxa_wnd; i++) { - m = rap->rxa_m[i]; - if (m == NULL) + if (ampdu_dispatch_slot(rap, ni, i) == 0) break; - rap->rxa_m[i] = NULL; - rap->rxa_qbytes -= m->m_pkthdr.len; - rap->rxa_qframes--; - - ampdu_dispatch(ni, m); } + /* * If frames remain, copy the mbuf pointers down so * they correspond to the offsets in the new window. @@ -725,19 +738,14 @@ static void ampdu_rx_flush(struct ieee80211_node *ni, struct ieee80211_rx_ampdu *rap) { struct ieee80211vap *vap = ni->ni_vap; - struct mbuf *m; - int i; + int i, r; for (i = 0; i < rap->rxa_wnd; i++) { - m = rap->rxa_m[i]; - if (m == NULL) + r = ampdu_dispatch_slot(rap, ni, i); + if (r == 0) continue; - rap->rxa_m[i] = NULL; - rap->rxa_qbytes -= m->m_pkthdr.len; - rap->rxa_qframes--; - vap->iv_stats.is_ampdu_rx_oor++; + vap->iv_stats.is_ampdu_rx_oor += r; - ampdu_dispatch(ni, m); if (rap->rxa_qframes == 0) break; } @@ -753,9 +761,8 @@ ampdu_rx_flush_upto(struct ieee80211_nod struct ieee80211_rx_ampdu *rap, ieee80211_seq winstart) { struct ieee80211vap *vap = ni->ni_vap; - struct mbuf *m; ieee80211_seq seqno; - int i; + int i, r; /* * Flush any complete MSDU's with a sequence number lower @@ -766,18 +773,12 @@ ampdu_rx_flush_upto(struct ieee80211_nod */ seqno = rap->rxa_start; for (i = 0; i < rap->rxa_wnd; i++) { - m = rap->rxa_m[i]; - if (m != NULL) { - rap->rxa_m[i] = NULL; - rap->rxa_qbytes -= m->m_pkthdr.len; - rap->rxa_qframes--; - vap->iv_stats.is_ampdu_rx_oor++; - - ampdu_dispatch(ni, m); - } else { + r = ampdu_dispatch_slot(rap, ni, i); + if (r == 0) { if (!IEEE80211_SEQ_BA_BEFORE(seqno, winstart)) break; } + vap->iv_stats.is_ampdu_rx_oor += r; seqno = IEEE80211_SEQ_INC(seqno); } /*