From cd9491eaad462092c77a9455f5bfeaf31b25d949 Mon Sep 17 00:00:00 2001 From: dlg Date: Fri, 18 Jul 2014 07:11:04 +0000 Subject: [PATCH] implement EFBIG handling for heavily fragmented packets on the tx path. ok claudio@ --- sys/dev/pci/if_bnx.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/sys/dev/pci/if_bnx.c b/sys/dev/pci/if_bnx.c index 0ed224d8de8..ce035556ef4 100644 --- a/sys/dev/pci/if_bnx.c +++ b/sys/dev/pci/if_bnx.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_bnx.c,v 1.106 2014/07/12 18:48:51 tedu Exp $ */ +/* $OpenBSD: if_bnx.c,v 1.107 2014/07/18 07:11:04 dlg Exp $ */ /*- * Copyright (c) 2006 Broadcom Corporation @@ -4882,9 +4882,18 @@ bnx_tx_encap(struct bnx_softc *sc, struct mbuf *m) /* Map the mbuf into our DMA address space. */ error = bus_dmamap_load_mbuf(sc->bnx_dmatag, map, m, BUS_DMA_NOWAIT); - if (error != 0) { - printf("%s: Error mapping mbuf into TX chain!\n", - sc->bnx_dev.dv_xname); + switch (error) { + case 0: + break; + + case EFBIG: + if ((error = m_defrag(m, M_DONTWAIT)) == 0 && + (error = bus_dmamap_load_mbuf(sc->bnx_dmatag, map, m, + BUS_DMA_NOWAIT)) == 0) + break; + + /* FALLTHROUGH */ + default: sc->tx_dma_map_failures++; goto maperr; } -- 2.20.1