From owner-svn-src-head@freebsd.org Sat Nov 18 20:38:06 2017 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 7B01FDDBAE5; Sat, 18 Nov 2017 20:38:06 +0000 (UTC) (envelope-from manu@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 47E617C437; Sat, 18 Nov 2017 20:38:06 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id vAIKc5NY017619; Sat, 18 Nov 2017 20:38:05 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vAIKc5rr017618; Sat, 18 Nov 2017 20:38:05 GMT (envelope-from manu@FreeBSD.org) Message-Id: <201711182038.vAIKc5rr017618@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Sat, 18 Nov 2017 20:38:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r325977 - head/sys/arm/allwinner X-SVN-Group: head X-SVN-Commit-Author: manu X-SVN-Commit-Paths: head/sys/arm/allwinner X-SVN-Commit-Revision: 325977 X-SVN-Commit-Repository: base 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.25 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: Sat, 18 Nov 2017 20:38:06 -0000 Author: manu Date: Sat Nov 18 20:38:05 2017 New Revision: 325977 URL: https://svnweb.freebsd.org/changeset/base/325977 Log: 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 Differential Revision: https://reviews.freebsd.org/D13029 Modified: head/sys/arm/allwinner/if_awg.c Modified: head/sys/arm/allwinner/if_awg.c ============================================================================== --- head/sys/arm/allwinner/if_awg.c Sat Nov 18 20:32:09 2017 (r325976) +++ head/sys/arm/allwinner/if_awg.c Sat Nov 18 20:38:05 2017 (r325977) @@ -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 } 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, struc 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;