From owner-svn-src-head@freebsd.org Fri Apr 29 01:53:46 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 83830B20AAC; Fri, 29 Apr 2016 01:53:46 +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 3A2051ED0; Fri, 29 Apr 2016 01:53:46 +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 u3T1rjoC069607; Fri, 29 Apr 2016 01:53:45 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u3T1rjUG069606; Fri, 29 Apr 2016 01:53:45 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201604290153.u3T1rjUG069606@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Fri, 29 Apr 2016 01:53:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r298762 - head/sys/dev/ath 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.21 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: Fri, 29 Apr 2016 01:53:46 -0000 Author: adrian Date: Fri Apr 29 01:53:45 2016 New Revision: 298762 URL: https://svnweb.freebsd.org/changeset/base/298762 Log: [ath] Add LDPC transmit support. LDPC adds better transmit reliability if both ends support it. You in theory can do both STBC and LDPC at the same time. If I see issues I'll disable it. * Only enable it if both ends of a connection negotiate it. * Disable it if any rate is non-11n. * Count both LDPC TX and STBC TX. Tested: * AR9380, STA mode Modified: head/sys/dev/ath/if_ath_tx_ht.c Modified: head/sys/dev/ath/if_ath_tx_ht.c ============================================================================== --- head/sys/dev/ath/if_ath_tx_ht.c Fri Apr 29 01:52:06 2016 (r298761) +++ head/sys/dev/ath/if_ath_tx_ht.c Fri Apr 29 01:53:45 2016 (r298762) @@ -227,6 +227,20 @@ ath_tx_rate_fill_rcflags(struct ath_soft struct ath_rc_series *rc = bf->bf_state.bfs_rc; uint8_t rate; int i; + int do_ldpc; + int do_stbc; + + /* + * We only do LDPC if the rate is 11n, both we and the + * receiver support LDPC and it's enabled. + * + * It's a global flag, not a per-try flag, so we clear + * it if any of the rate entries aren't 11n. + */ + if ((ni->ni_vap->iv_htcaps & IEEE80211_HTCAP_LDPC) && + (ni->ni_htcap & IEEE80211_HTCAP_LDPC)) + do_ldpc = 1; + do_stbc = 0; for (i = 0; i < ATH_RC_NUM; i++) { rc[i].flags = 0; @@ -250,6 +264,12 @@ ath_tx_rate_fill_rcflags(struct ath_soft (HAL_TXDESC_RTSENA | HAL_TXDESC_CTSENA)) rc[i].flags |= ATH_RC_RTSCTS_FLAG; + /* + * If we can't do LDPC, don't. + */ + if (! IS_HT_RATE(rate)) + do_ldpc = 0; + /* Only enable shortgi, 2040, dual-stream if HT is set */ if (IS_HT_RATE(rate)) { rc[i].flags |= ATH_RC_HT_FLAG; @@ -281,6 +301,7 @@ ath_tx_rate_fill_rcflags(struct ath_soft (sc->sc_cur_txchainmask > 1) && HT_RC_2_STREAMS(rate) == 1) { rc[i].flags |= ATH_RC_STBC_FLAG; + do_stbc = 1; } /* @@ -324,6 +345,18 @@ ath_tx_rate_fill_rcflags(struct ath_soft "%s: i=%d, rate=0x%x, flags=0x%x, max4ms=%d\n", __func__, i, rate, rc[i].flags, rc[i].max4msframelen); } + + /* + * LDPC is a global flag, so ... + */ + if (do_ldpc) { + bf->bf_state.bfs_txflags |= HAL_TXDESC_LDPC; + sc->sc_stats.ast_tx_ldpc++; + } + + if (do_stbc) { + sc->sc_stats.ast_tx_stbc++; + } } /*