From owner-svn-src-head@freebsd.org Sun May 22 19:43:42 2016 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 59AC5B466F8; Sun, 22 May 2016 19:43:42 +0000 (UTC) (envelope-from avos@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 0AA7E1AA3; Sun, 22 May 2016 19:43:41 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4MJhfLB004645; Sun, 22 May 2016 19:43:41 GMT (envelope-from avos@FreeBSD.org) Received: (from avos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4MJhftZ004642; Sun, 22 May 2016 19:43:41 GMT (envelope-from avos@FreeBSD.org) Message-Id: <201605221943.u4MJhftZ004642@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avos set sender to avos@FreeBSD.org using -f From: Andriy Voskoboinyk Date: Sun, 22 May 2016 19:43:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300433 - head/sys/dev/urtwn 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.22 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: Sun, 22 May 2016 19:43:42 -0000 Author: avos Date: Sun May 22 19:43:40 2016 New Revision: 300433 URL: https://svnweb.freebsd.org/changeset/base/300433 Log: urtwn: setup per-frame retry limit. Override global retry limit (which is set in R92C_RL) via per-frame TX descriptor field. Obsoletes D3840 (should work better with 2+ vaps). Tested with RTL8188EU and RTL8192CUS in STA mode (maxretry = [3-9]). Modified: head/sys/dev/urtwn/if_urtwn.c head/sys/dev/urtwn/if_urtwnreg.h Modified: head/sys/dev/urtwn/if_urtwn.c ============================================================================== --- head/sys/dev/urtwn/if_urtwn.c Sun May 22 19:25:53 2016 (r300432) +++ head/sys/dev/urtwn/if_urtwn.c Sun May 22 19:43:40 2016 (r300433) @@ -2838,7 +2838,7 @@ urtwn_tx_data(struct urtwn_softc *sc, st struct ieee80211_channel *chan; struct ieee80211_frame *wh; struct r92c_tx_desc *txd; - uint8_t macid, raid, rate, ridx, subtype, type, tid, qsel; + uint8_t macid, raid, rate, ridx, subtype, type, tid, qos, qsel; int hasqos, ismcast; URTWN_ASSERT_LOCKED(sc); @@ -2854,10 +2854,12 @@ urtwn_tx_data(struct urtwn_softc *sc, st /* Select TX ring for this frame. */ if (hasqos) { - tid = ((const struct ieee80211_qosframe *)wh)->i_qos[0]; - tid &= IEEE80211_QOS_TID; - } else + qos = ((const struct ieee80211_qosframe *)wh)->i_qos[0]; + tid = qos & IEEE80211_QOS_TID; + } else { + qos = 0; tid = 0; + } chan = (ni->ni_chan != IEEE80211_CHAN_ANYC) ? ni->ni_chan : ic->ic_curchan; @@ -2923,6 +2925,14 @@ urtwn_tx_data(struct urtwn_softc *sc, st txd->txdw0 |= htole32(R92C_TXDW0_BMCAST); if (!ismcast) { + /* Unicast frame, check if an ACK is expected. */ + if (!qos || (qos & IEEE80211_QOS_ACKPOLICY) != + IEEE80211_QOS_ACKPOLICY_NOACK) { + txd->txdw5 |= htole32(R92C_TXDW5_RTY_LMT_ENA); + txd->txdw5 |= htole32(SM(R92C_TXDW5_RTY_LMT, + tp->maxretry)); + } + if (sc->chip & URTWN_CHIP_88E) { struct urtwn_node *un = URTWN_NODE(ni); macid = un->id; @@ -3102,6 +3112,11 @@ urtwn_tx_raw(struct urtwn_softc *sc, str if (IEEE80211_IS_MULTICAST(wh->i_addr1)) txd->txdw0 |= htole32(R92C_TXDW0_BMCAST); + if ((params->ibp_flags & IEEE80211_BPF_NOACK) == 0) { + txd->txdw5 |= htole32(R92C_TXDW5_RTY_LMT_ENA); + txd->txdw5 |= htole32(SM(R92C_TXDW5_RTY_LMT, + params->ibp_try0)); + } if (params->ibp_flags & IEEE80211_BPF_RTS) txd->txdw4 |= htole32(R92C_TXDW4_RTSEN); if (params->ibp_flags & IEEE80211_BPF_CTS) Modified: head/sys/dev/urtwn/if_urtwnreg.h ============================================================================== --- head/sys/dev/urtwn/if_urtwnreg.h Sun May 22 19:25:53 2016 (r300432) +++ head/sys/dev/urtwn/if_urtwnreg.h Sun May 22 19:43:40 2016 (r300433) @@ -1198,6 +1198,9 @@ struct r92c_tx_desc { #define R92C_TXDW5_DATARATE_M 0x0000003f #define R92C_TXDW5_DATARATE_S 0 #define R92C_TXDW5_SGI 0x00000040 +#define R92C_TXDW5_RTY_LMT_ENA 0x00020000 +#define R92C_TXDW5_RTY_LMT_M 0x00fc0000 +#define R92C_TXDW5_RTY_LMT_S 18 #define R92C_TXDW5_AGGNUM_M 0xff000000 #define R92C_TXDW5_AGGNUM_S 24