summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordlg <dlg@openbsd.org>2014-07-18 07:11:04 +0000
committerdlg <dlg@openbsd.org>2014-07-18 07:11:04 +0000
commitcd9491eaad462092c77a9455f5bfeaf31b25d949 (patch)
tree83b097b6d1f1d8ef0aecf65de4b4888460bbacc3
parentzap trailing whitespace; (diff)
downloadwireguard-openbsd-cd9491eaad462092c77a9455f5bfeaf31b25d949.tar.xz
wireguard-openbsd-cd9491eaad462092c77a9455f5bfeaf31b25d949.zip
implement EFBIG handling for heavily fragmented packets on the tx path.
ok claudio@
-rw-r--r--sys/dev/pci/if_bnx.c17
1 files 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;
}