aboutsummaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorEmmanuel Vadot <manu@FreeBSD.org>2017-11-18 20:38:05 +0000
committerEmmanuel Vadot <manu@FreeBSD.org>2017-11-18 20:38:05 +0000
commit1ee5a3d3b279c03d295a844e8c7c0770353b67b7 (patch)
tree28e868b14b913b46e7218d1699ac5ae1fc1566ff /sys
parentb108f35740525ab97aae4ff79dca5f7d289f47b5 (diff)
downloadsrc-1ee5a3d3b279c03d295a844e8c7c0770353b67b7.tar.gz
src-1ee5a3d3b279c03d295a844e8c7c0770353b67b7.zip
if_awg: only request completion interrupt on the last descriptor of a tx frame
The hardware will not issue a completion interrupt for a descriptor with TX_INT_CTL set if it doesn't also have TX_LAST_DESC set. Submitted by: Guy Yur <guyyur_gmail.com> Differential Revision: https://reviews.freebsd.org/D13029
Notes
Notes: svn path=/head/; revision=325977
Diffstat (limited to 'sys')
-rw-r--r--sys/arm/allwinner/if_awg.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/sys/arm/allwinner/if_awg.c b/sys/arm/allwinner/if_awg.c
index d254b37e3cdd..3c61e93faeb5 100644
--- a/sys/arm/allwinner/if_awg.c
+++ b/sys/arm/allwinner/if_awg.c
@@ -169,6 +169,7 @@ struct awg_txring {
bus_dma_tag_t buf_tag;
struct awg_bufmap buf_map[TX_DESC_COUNT];
u_int cur, next, queued;
+ u_int segs;
};
struct awg_rxring {
@@ -399,8 +400,6 @@ awg_setup_txdesc(struct awg_softc *sc, int index, int flags, bus_addr_t paddr,
} else {
status = TX_DESC_CTL;
size = flags | len;
- if ((index & (awg_tx_interval - 1)) == 0)
- size |= TX_INT_CTL;
++sc->tx.queued;
}
@@ -449,8 +448,18 @@ awg_setup_txbuf(struct awg_softc *sc, int index, struct mbuf **mp)
for (cur = index, i = 0; i < nsegs; i++) {
sc->tx.buf_map[cur].mbuf = (i == 0 ? m : NULL);
- if (i == nsegs - 1)
+ sc->tx.segs++;
+ if (i == nsegs - 1) {
flags |= TX_LAST_DESC;
+ /*
+ * Can only request TX completion
+ * interrupt on last descriptor.
+ */
+ if (sc->tx.segs >= awg_tx_interval) {
+ sc->tx.segs = 0;
+ flags |= TX_INT_CTL;
+ }
+ }
awg_setup_txdesc(sc, cur, flags, segs[i].ds_addr,
segs[i].ds_len);
flags &= ~TX_FIR_DESC;