Module Name: src
Committed By: thorpej
Date: Sun Aug 21 14:42:24 UTC 2022
Modified Files:
src/sys/dev/pci: if_jme.c
Log Message:
jme_ifstart(): Replace "IFQ_DEQUEUE() -> IF_PREPEND() on failure" with
"IFQ_POLL() -> IFQ_DEQUEUE() on success (and fatal-to-packet errors)".
To generate a diff of this commit:
cvs rdiff -u -r1.53 -r1.54 src/sys/dev/pci/if_jme.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/dev/pci/if_jme.c
diff -u src/sys/dev/pci/if_jme.c:1.53 src/sys/dev/pci/if_jme.c:1.54
--- src/sys/dev/pci/if_jme.c:1.53 Sun Aug 21 14:36:15 2022
+++ src/sys/dev/pci/if_jme.c Sun Aug 21 14:42:24 2022
@@ -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 @@ jme_ifstart(struct ifnet *ifp)
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 @@ nexttx:
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);
}