Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/pci ale_encap(): Fix error logic in previous change ...



details:   https://anonhg.NetBSD.org/src/rev/492a57109f43
branches:  trunk
changeset: 369590:492a57109f43
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Mon Aug 22 15:59:42 2022 +0000

description:
ale_encap(): Fix error logic in previous change for when the defrag works,
but DMA mapping fails to use DMA resource shortage.

diffstat:

 sys/dev/pci/if_ale.c |  21 +++++++++++++--------
 1 files changed, 13 insertions(+), 8 deletions(-)

diffs (44 lines):

diff -r cb822c879e75 -r 492a57109f43 sys/dev/pci/if_ale.c
--- a/sys/dev/pci/if_ale.c      Mon Aug 22 15:43:49 2022 +0000
+++ b/sys/dev/pci/if_ale.c      Mon Aug 22 15:59:42 2022 +0000
@@ -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@localhost>
@@ -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 @@
                        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;
        }
 



Home | Main Index | Thread Index | Old Index