From owner-svn-src-all@freebsd.org Sat May 14 23:27:56 2016 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 8D03EB3BA8B; Sat, 14 May 2016 23:27:56 +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 40B3118C7; Sat, 14 May 2016 23:27:56 +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 u4ENRtdh084233; Sat, 14 May 2016 23:27:55 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4ENRtmx084232; Sat, 14 May 2016 23:27:55 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201605142327.u4ENRtmx084232@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Sat, 14 May 2016 23:27:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r299782 - head/sys/dev/bwn 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.22 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: Sat, 14 May 2016 23:27:56 -0000 Author: adrian Date: Sat May 14 23:27:55 2016 New Revision: 299782 URL: https://svnweb.freebsd.org/changeset/base/299782 Log: [bwn] TX logging / completion fixes * Log the per-completion status out if requested * If we get a PHY failure, the retrycnt is set to 0 and ack=0, so the logic was incorrect. So, for ack=0, ensure we don't log a retrycnt of 0 (or rate control breaks) or a negative retrycnt (or rate control also breaks.) Tested: * BCM4321 (11abgn N-PHY), BCM4312 (LP-PHY) Modified: head/sys/dev/bwn/if_bwn.c Modified: head/sys/dev/bwn/if_bwn.c ============================================================================== --- head/sys/dev/bwn/if_bwn.c Sat May 14 23:27:54 2016 (r299781) +++ head/sys/dev/bwn/if_bwn.c Sat May 14 23:27:55 2016 (r299782) @@ -5097,6 +5097,21 @@ bwn_intr_txeof(struct bwn_mac *mac) stat.ampdu = (tmp & 0x0020) ? 1 : 0; stat.ack = (tmp & 0x0002) ? 1 : 0; + DPRINTF(mac->mac_sc, BWN_DEBUG_XMIT, + "%s: cookie=%d, seq=%d, phystat=0x%02x, framecnt=%d, " + "rtscnt=%d, sreason=%d, pm=%d, im=%d, ampdu=%d, ack=%d\n", + __func__, + stat.cookie, + stat.seq, + stat.phy_stat, + stat.framecnt, + stat.rtscnt, + stat.sreason, + stat.pm, + stat.im, + stat.ampdu, + stat.ack); + bwn_handle_txeof(mac, &stat); } } @@ -5733,8 +5748,19 @@ bwn_dma_handle_txeof(struct bwn_mac *mac KASSERT(meta->mt_m != NULL, ("%s:%d: fail", __func__, __LINE__)); - /* Just count full frame retries for now */ - retrycnt = status->framecnt - 1; + /* + * If we don't get an ACK, then we should log the + * full framecnt. That may be 0 if it's a PHY + * failure, so ensure that gets logged as some + * retry attempt. + */ + if (status->ack) { + retrycnt = status->framecnt - 1; + } else { + retrycnt = status->framecnt; + if (retrycnt == 0) + retrycnt = 1; + } ieee80211_ratectl_tx_complete(meta->mt_ni->ni_vap, meta->mt_ni, status->ack ? IEEE80211_RATECTL_TX_SUCCESS : @@ -5784,8 +5810,19 @@ bwn_pio_handle_txeof(struct bwn_mac *mac * be done before releasing the node reference. */ - /* Just count full frame retries for now */ - retrycnt = status->framecnt - 1; + /* + * If we don't get an ACK, then we should log the + * full framecnt. That may be 0 if it's a PHY + * failure, so ensure that gets logged as some + * retry attempt. + */ + if (status->ack) { + retrycnt = status->framecnt - 1; + } else { + retrycnt = status->framecnt; + if (retrycnt == 0) + retrycnt = 1; + } ieee80211_ratectl_tx_complete(tp->tp_ni->ni_vap, tp->tp_ni, status->ack ? IEEE80211_RATECTL_TX_SUCCESS :