From 9193516e94f72903673be31743e463ee1e1811bd Mon Sep 17 00:00:00 2001 From: Adrian Chadd Date: Sat, 14 May 2016 23:27:55 +0000 Subject: [PATCH] [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) --- sys/dev/bwn/if_bwn.c | 45 ++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 41 insertions(+), 4 deletions(-) diff --git a/sys/dev/bwn/if_bwn.c b/sys/dev/bwn/if_bwn.c index 3a2439555d40..562914e94093 100644 --- a/sys/dev/bwn/if_bwn.c +++ b/sys/dev/bwn/if_bwn.c @@ -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 :