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
This commit is contained in:
parent
d949e92a9c
commit
031d577716
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=325410
@ -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, struct mbuf **mp)
|
||||
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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user