From owner-svn-src-head@freebsd.org Sat Nov 4 23:28:03 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 D74B7E59838; Sat, 4 Nov 2017 23:28:03 +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 mx1.freebsd.org (Postfix) with ESMTPS id A490736D0; Sat, 4 Nov 2017 23:28:03 +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 vA4NS2tG026065; Sat, 4 Nov 2017 23:28:02 GMT (envelope-from gonzo@FreeBSD.org) Received: (from gonzo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vA4NS2DE026064; Sat, 4 Nov 2017 23:28:02 GMT (envelope-from gonzo@FreeBSD.org) Message-Id: <201711042328.vA4NS2DE026064@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gonzo set sender to gonzo@FreeBSD.org using -f From: Oleksandr Tymoshenko Date: Sat, 4 Nov 2017 23:28:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r325410 - head/sys/arm/allwinner X-SVN-Group: head X-SVN-Commit-Author: gonzo X-SVN-Commit-Paths: head/sys/arm/allwinner X-SVN-Commit-Revision: 325410 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.23 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, 04 Nov 2017 23:28:04 -0000 Author: gonzo Date: Sat Nov 4 23:28:02 2017 New Revision: 325410 URL: https://svnweb.freebsd.org/changeset/base/325410 Log: 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 MFC after: 2 weeks 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 4 22:23:41 2017 (r325409) +++ head/sys/arm/allwinner/if_awg.c Sat Nov 4 23:28:02 2017 (r325410) @@ -92,7 +92,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 @@ -192,6 +192,7 @@ struct awg_softc { struct resource *res[_RES_NITEMS]; struct mtx mtx; if_t ifp; + device_t dev; device_t miibus; struct callout stat_ch; struct task link_task; @@ -421,14 +422,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); @@ -1613,6 +1618,7 @@ awg_attach(device_t dev) int error; sc = device_get_softc(dev); + sc->dev = dev; sc->type = ofw_bus_search_compatible(dev, compat_data)->ocd_data; node = ofw_bus_get_node(dev);