summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorthorpej <thorpej@NetBSD.org>2022-08-22 15:59:42 +0000
committerthorpej <thorpej@NetBSD.org>2022-08-22 15:59:42 +0000
commit20719ab530be2bc256eef10fbe9d37796a171aeb (patch)
tree2c9a80090466fe1e8ffde0821d4d3e345a14d6b7 /sys/dev
parent668c93ceb9da33ba0c8d163f0cab409a09e5d97d (diff)
ale_encap(): Fix error logic in previous change for when the defrag works,
but DMA mapping fails to use DMA resource shortage.
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/pci/if_ale.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/sys/dev/pci/if_ale.c b/sys/dev/pci/if_ale.c
index 31f0b32b802..3c4e43ceb58 100644
--- a/sys/dev/pci/if_ale.c
+++ b/sys/dev/pci/if_ale.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_ale.c,v 1.42 2022/08/22 15:43:49 thorpej Exp $ */
+/* $NetBSD: if_ale.c,v 1.43 2022/08/22 15:59:42 thorpej Exp $ */
/*-
* Copyright (c) 2008, Pyun YongHyeon <yongari@FreeBSD.org>
@@ -32,7 +32,7 @@
/* Driver for Atheros AR8121/AR8113/AR8114 PCIe Ethernet. */
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_ale.c,v 1.42 2022/08/22 15:43:49 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ale.c,v 1.43 2022/08/22 15:59:42 thorpej Exp $");
#include "vlan.h"
@@ -931,14 +931,19 @@ ale_encap(struct ale_softc *sc, struct mbuf * const m)
KASSERT(m == mnew);
error = bus_dmamap_load_mbuf(sc->sc_dmat, map, mnew,
BUS_DMA_NOWAIT);
+ } else {
+ /* Just drop if we can't defrag. */
+ error = EFBIG;
}
- if (mnew == NULL || error == EFBIG) {
- printf("%s: Tx packet consumes too many "
- "DMA segments, dropping...\n",
- device_xname(sc->sc_dev));
- return EFBIG;
+ if (error) {
+ if (error == EFBIG) {
+ printf("%s: Tx packet consumes too many "
+ "DMA segments, dropping...\n",
+ device_xname(sc->sc_dev));
+ }
+ return error;
}
- } else if (error != 0) {
+ } else if (error) {
return error;
}