From owner-svn-src-stable-11@freebsd.org Tue Feb 20 18:12:08 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C4BFCF1B80E; Tue, 20 Feb 2018 18:12:07 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 74518841DC; Tue, 20 Feb 2018 18:12:07 +0000 (UTC) (envelope-from gonzo@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6F311530D; Tue, 20 Feb 2018 18:12:07 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1KIC7lA079316; Tue, 20 Feb 2018 18:12:07 GMT (envelope-from gonzo@FreeBSD.org) Received: (from gonzo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1KIC7xv079315; Tue, 20 Feb 2018 18:12:07 GMT (envelope-from gonzo@FreeBSD.org) Message-Id: <201802201812.w1KIC7xv079315@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gonzo set sender to gonzo@FreeBSD.org using -f From: Oleksandr Tymoshenko Date: Tue, 20 Feb 2018 18:12:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r329648 - stable/11/sys/arm/allwinner X-SVN-Group: stable-11 X-SVN-Commit-Author: gonzo X-SVN-Commit-Paths: stable/11/sys/arm/allwinner X-SVN-Commit-Revision: 329648 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Feb 2018 18:12:08 -0000 Author: gonzo Date: Tue Feb 20 18:12:07 2018 New Revision: 329648 URL: https://svnweb.freebsd.org/changeset/base/329648 Log: MFC r325410: Increase TX_MAX_SEGS from 10 to 20 for the if_awg.c driver Under certain traffic pattern awg driver does not recover from TX queue full condition. The actual source of the problem is not identified yet but jmcneill@ agreed that bumping TX_MAX_SEGS to 20 is OK as a workaround for the problem (NetBSD has it set to 128). Also add some diagnostic printfs to prevent silent failure of bus_dma functions in the future PR will be kept open until root cause of the issue is identified and fixed PR: 219927 Submitted by: Tom Vijlbrief Approved by: jmcneill Modified: stable/11/sys/arm/allwinner/if_awg.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/arm/allwinner/if_awg.c ============================================================================== --- stable/11/sys/arm/allwinner/if_awg.c Tue Feb 20 18:08:57 2018 (r329647) +++ stable/11/sys/arm/allwinner/if_awg.c Tue Feb 20 18:12:07 2018 (r329648) @@ -87,7 +87,7 @@ __FBSDID("$FreeBSD$"); #define TX_SKIP(n, o) (((n) + (o)) & (TX_DESC_COUNT - 1)) #define RX_NEXT(n) (((n) + 1) & (RX_DESC_COUNT - 1)) -#define TX_MAX_SEGS 10 +#define TX_MAX_SEGS 20 #define SOFT_RST_RETRY 1000 #define MII_BUSY_RETRY 1000 @@ -148,6 +148,7 @@ struct awg_softc { struct resource *res[2]; struct mtx mtx; if_t ifp; + device_t dev; device_t miibus; struct callout stat_ch; struct task link_task; @@ -375,14 +376,18 @@ awg_setup_txbuf(struct awg_softc *sc, int index, struc sc->tx.buf_map[index].map, m, segs, &nsegs, BUS_DMA_NOWAIT); if (error == EFBIG) { m = m_collapse(m, M_NOWAIT, TX_MAX_SEGS); - if (m == NULL) + if (m == NULL) { + device_printf(sc->dev, "awg_setup_txbuf: m_collapse failed\n"); return (0); + } *mp = m; error = bus_dmamap_load_mbuf_sg(sc->tx.buf_tag, sc->tx.buf_map[index].map, m, segs, &nsegs, BUS_DMA_NOWAIT); } - if (error != 0) + if (error != 0) { + device_printf(sc->dev, "awg_setup_txbuf: bus_dmamap_load_mbuf_sg failed\n"); return (0); + } bus_dmamap_sync(sc->tx.buf_tag, sc->tx.buf_map[index].map, BUS_DMASYNC_PREWRITE); @@ -1324,6 +1329,7 @@ awg_attach(device_t dev) int error; sc = device_get_softc(dev); + sc->dev = dev; node = ofw_bus_get_node(dev); if (bus_alloc_resources(dev, awg_spec, sc->res) != 0) {