Date: Thu, 6 Apr 2017 01:35:43 +0000 (UTC) From: Adrian Chadd <adrian@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r316547 - head/sys/net80211 Message-ID: <201704060135.v361ZhY3080900@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
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); } /*
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201704060135.v361ZhY3080900>