From 8fa830ce32fc0c8e70f0a744a9c3fb184db7b1c9 Mon Sep 17 00:00:00 2001 From: sephe Date: Sun, 16 Sep 2007 08:25:41 +0000 Subject: [PATCH] For bwi(4) parts that use TX status ring: - Extract frame's TX count and whether the frame has been acknowledged. - If the TX status indicates that the frame is pending, don't do any further processing (this probably will not happen in the current TX model). --- sys/dev/netif/bwi/if_bwi.c | 21 ++++++++++++++++----- sys/dev/netif/bwi/if_bwivar.h | 13 +++++++++---- 2 files changed, 25 insertions(+), 9 deletions(-) diff --git a/sys/dev/netif/bwi/if_bwi.c b/sys/dev/netif/bwi/if_bwi.c index 1b8e07af31..0d203e0e0c 100644 --- a/sys/dev/netif/bwi/if_bwi.c +++ b/sys/dev/netif/bwi/if_bwi.c @@ -31,7 +31,7 @@ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $DragonFly: src/sys/dev/netif/bwi/if_bwi.c,v 1.4 2007/09/16 04:24:30 sephe Exp $ + * $DragonFly: src/sys/dev/netif/bwi/if_bwi.c,v 1.5 2007/09/16 08:25:41 sephe Exp $ */ #include @@ -130,7 +130,7 @@ static void bwi_txeof_status64(struct bwi_softc *); static void bwi_intr(void *); static void bwi_rxeof(struct bwi_softc *, int); -static void _bwi_txeof(struct bwi_softc *, uint16_t); +static void _bwi_txeof(struct bwi_softc *, uint16_t, int, int); static void bwi_txeof(struct bwi_softc *); static void bwi_txeof_status(struct bwi_softc *, int); static void bwi_enable_intrs(struct bwi_softc *, uint32_t); @@ -3043,7 +3043,7 @@ bwi_txeof_status64(struct bwi_softc *sc) } static void -_bwi_txeof(struct bwi_softc *sc, uint16_t tx_id) +_bwi_txeof(struct bwi_softc *sc, uint16_t tx_id, int acked, int data_txcnt) { struct ifnet *ifp = &sc->sc_ic.ic_if; struct bwi_txbuf_data *tbd; @@ -3075,6 +3075,7 @@ _bwi_txeof(struct bwi_softc *sc, uint16_t tx_id) tb->tb_mbuf = NULL; if (tb->tb_ni != NULL) { + /* Feed back 'acked and data_txcnt' */ ieee80211_free_node(tb->tb_ni); tb->tb_ni = NULL; } @@ -3095,7 +3096,17 @@ bwi_txeof_status(struct bwi_softc *sc, int end_idx) idx = st->stats_idx; while (idx != end_idx) { - _bwi_txeof(sc, le16toh(st->stats[idx].txs_id)); + const struct bwi_txstats *stats = &st->stats[idx]; + + if ((stats->txs_flags & BWI_TXS_F_PENDING) == 0) { + int data_txcnt; + + data_txcnt = __SHIFTOUT(stats->txs_txcnt, + BWI_TXS_TXCNT_DATA); + _bwi_txeof(sc, le16toh(stats->txs_id), + stats->txs_flags & BWI_TXS_F_ACKED, + data_txcnt); + } idx = (idx + 1) % BWI_TXSTATS_NDESC; } st->stats_idx = idx; @@ -3121,7 +3132,7 @@ bwi_txeof(struct bwi_softc *sc) if (tx_info & 0x30) /* XXX */ continue; - _bwi_txeof(sc, tx_id); + _bwi_txeof(sc, tx_id, 0, 0); } if ((ifp->if_flags & IFF_OACTIVE) == 0) diff --git a/sys/dev/netif/bwi/if_bwivar.h b/sys/dev/netif/bwi/if_bwivar.h index 747603acfa..0558e8add6 100644 --- a/sys/dev/netif/bwi/if_bwivar.h +++ b/sys/dev/netif/bwi/if_bwivar.h @@ -31,7 +31,7 @@ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $DragonFly: src/sys/dev/netif/bwi/if_bwivar.h,v 1.4 2007/09/16 04:24:30 sephe Exp $ + * $DragonFly: src/sys/dev/netif/bwi/if_bwivar.h,v 1.5 2007/09/16 08:25:41 sephe Exp $ */ #ifndef _IF_BWIVAR_H @@ -181,14 +181,19 @@ struct bwi_txstats { /* Little endian */ uint8_t txs_pad1[4]; uint16_t txs_id; - uint8_t txs_flags; - uint8_t txs_retry_cnt; + uint8_t txs_flags; /* BWI_TXS_F_ */ + uint8_t txs_txcnt; /* BWI_TXS_TXCNT_ */ uint8_t txs_pad2[2]; uint16_t txs_seq; uint16_t txs_unknown; - uint8_t txs_pad3[2]; /* Padded to 16bytes */ + uint8_t txs_pad3[2]; /* Padded to 16bytes */ } __packed; +#define BWI_TXS_TXCNT_DATA __BITS(7, 4) + +#define BWI_TXS_F_ACKED __BIT(0) +#define BWI_TXS_F_PENDING __BIT(5) + struct bwi_ring_data { uint32_t rdata_txrx_ctrl; bus_dmamap_t rdata_dmap; -- 2.11.4.GIT