Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 4 Nov 2017 23:28:02 +0000 (UTC)
From:      Oleksandr Tymoshenko <gonzo@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r325410 - head/sys/arm/allwinner
Message-ID:  <201711042328.vA4NS2DE026064@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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 <tvijlbrief@gmail.com>
  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);
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201711042328.vA4NS2DE026064>