Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/pci vioif(4): prepare slot before dequeuing
details: https://anonhg.NetBSD.org/src/rev/e60e9fa606c6
branches: trunk
changeset: 373965:e60e9fa606c6
user: yamaguchi <yamaguchi%NetBSD.org@localhost>
date: Thu Mar 23 02:30:14 2023 +0000
description:
vioif(4): prepare slot before dequeuing
diffstat:
sys/dev/pci/if_vioif.c | 21 +++++++++------------
1 files changed, 9 insertions(+), 12 deletions(-)
diffs (50 lines):
diff -r 87ec6e0ee541 -r e60e9fa606c6 sys/dev/pci/if_vioif.c
--- a/sys/dev/pci/if_vioif.c Thu Mar 23 02:26:43 2023 +0000
+++ b/sys/dev/pci/if_vioif.c Thu Mar 23 02:30:14 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_vioif.c,v 1.95 2023/03/23 02:26:43 yamaguchi Exp $ */
+/* $NetBSD: if_vioif.c,v 1.96 2023/03/23 02:30:14 yamaguchi Exp $ */
/*
* Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_vioif.c,v 1.95 2023/03/23 02:26:43 yamaguchi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_vioif.c,v 1.96 2023/03/23 02:30:14 yamaguchi Exp $");
#ifdef _KERNEL_OPT
#include "opt_net_mpsafe.h"
@@ -1307,24 +1307,21 @@
for (;;) {
int slot, r;
+ r = virtio_enqueue_prep(vsc, vq, &slot);
+ if (r == EAGAIN)
+ break;
+ if (__predict_false(r != 0))
+ panic("enqueue_prep for tx buffers");
if (is_transmit)
m = pcq_get(txq->txq_intrq);
else
IFQ_DEQUEUE(&ifp->if_snd, m);
- if (m == NULL)
- break;
-
- r = virtio_enqueue_prep(vsc, vq, &slot);
- if (r == EAGAIN) {
- ifp->if_flags |= IFF_OACTIVE;
- m_freem(m);
- if_statinc(ifp, if_oerrors);
+ if (m == NULL) {
+ virtio_enqueue_abort(vsc, vq, slot);
break;
}
- if (r != 0)
- panic("enqueue_prep for a tx buffer");
map = &txq->txq_maps[slot];
KASSERT(map->vnm_mbuf == NULL);
Home |
Main Index |
Thread Index |
Old Index