Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/pci jme_ifstart(): Replace "IFQ_DEQUEUE() -> IF_PREP...



details:   https://anonhg.NetBSD.org/src/rev/7d4710186bdd
branches:  trunk
changeset: 369560:7d4710186bdd
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Sun Aug 21 14:42:24 2022 +0000

description:
jme_ifstart(): Replace "IFQ_DEQUEUE() -> IF_PREPEND() on failure" with
"IFQ_POLL() -> IFQ_DEQUEUE() on success (and fatal-to-packet errors)".

diffstat:

 sys/dev/pci/if_jme.c |  10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diffs (46 lines):

diff -r d8bfc8310ce5 -r 7d4710186bdd sys/dev/pci/if_jme.c
--- a/sys/dev/pci/if_jme.c      Sun Aug 21 14:36:15 2022 +0000
+++ b/sys/dev/pci/if_jme.c      Sun Aug 21 14:42:24 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_jme.c,v 1.53 2022/08/21 14:36:15 thorpej Exp $      */
+/*     $NetBSD: if_jme.c,v 1.54 2022/08/21 14:42:24 thorpej Exp $      */
 
 /*
  * Copyright (c) 2008 Manuel Bouyer.  All rights reserved.
@@ -58,7 +58,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_jme.c,v 1.53 2022/08/21 14:36:15 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_jme.c,v 1.54 2022/08/21 14:42:24 thorpej Exp $");
 
 
 #include <sys/param.h>
@@ -1636,7 +1636,7 @@
        for (enq = 0;; enq++) {
 nexttx:
                /* Grab a paquet for output */
-               IFQ_DEQUEUE(&ifp->if_snd, mb_head);
+               IFQ_POLL(&ifp->if_snd, mb_head);
                if (mb_head == NULL) {
 #ifdef JMEDEBUG_TX
                        printf("%s: nothing to send\n", __func__);
@@ -1647,15 +1647,17 @@
                if ((error = jme_encap(sc, mb_head)) != 0) {
                        if (error == EFBIG) {
                                /* This error is fatal to the packet. */
+                               IFQ_DEQUEUE(&ifp->if_snd, mb_head);
                                m_freem(mb_head);
                                if_statinc(ifp, if_oerrors);
                                goto nexttx;
                        }
                        /* resource shortage, try again later */
-                       IF_PREPEND(&ifp->if_snd, mb_head);
                        ifp->if_flags |= IFF_OACTIVE;
                        break;
                }
+               IFQ_DEQUEUE(&ifp->if_snd, mb_head);
+
                /* Pass packet to bpf if there is a listener */
                bpf_mtap(ifp, mb_head, BPF_D_OUT);
        }



Home | Main Index | Thread Index | Old Index