Module Name: src Committed By: riastradh Date: Fri Aug 4 18:41:01 UTC 2023
Modified Files: src/sys/arch/xen/xen: xennetback_xenbus.c Log Message: Revert "xennetback(4): Fix xennetback_evthandler loop." PR kern/57560 To generate a diff of this commit: cvs rdiff -u -r1.114 -r1.115 src/sys/arch/xen/xen/xennetback_xenbus.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/arch/xen/xen/xennetback_xenbus.c diff -u src/sys/arch/xen/xen/xennetback_xenbus.c:1.114 src/sys/arch/xen/xen/xennetback_xenbus.c:1.115 --- src/sys/arch/xen/xen/xennetback_xenbus.c:1.114 Fri Aug 4 18:40:49 2023 +++ src/sys/arch/xen/xen/xennetback_xenbus.c Fri Aug 4 18:41:01 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: xennetback_xenbus.c,v 1.114 2023/08/04 18:40:49 riastradh Exp $ */ +/* $NetBSD: xennetback_xenbus.c,v 1.115 2023/08/04 18:41:01 riastradh Exp $ */ /* * Copyright (c) 2006 Manuel Bouyer. @@ -25,7 +25,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: xennetback_xenbus.c,v 1.114 2023/08/04 18:40:49 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: xennetback_xenbus.c,v 1.115 2023/08/04 18:41:01 riastradh Exp $"); #include <sys/types.h> #include <sys/param.h> @@ -805,7 +805,7 @@ xennetback_evthandler(void *arg) netif_tx_request_t txreq; struct mbuf *m, *m0 = NULL, *mlast = NULL; int receive_pending; - RING_IDX req_cons, req_prod; + RING_IDX req_cons; int queued = 0, m0_len = 0; struct xnetback_xstate *xst; const bool discard = ((ifp->if_flags & (IFF_UP | IFF_RUNNING)) != @@ -813,12 +813,17 @@ xennetback_evthandler(void *arg) XENPRINTF(("xennetback_evthandler ")); req_cons = xneti->xni_txring.req_cons; -again: - req_prod = xneti->xni_txring.sring->req_prod; - xen_rmb(); - while (req_cons != req_prod) { + while (1) { + xen_rmb(); /* be sure to read the request before updating */ + xneti->xni_txring.req_cons = req_cons; + xen_wmb(); + RING_FINAL_CHECK_FOR_REQUESTS(&xneti->xni_txring, + receive_pending); + if (receive_pending == 0) + break; RING_COPY_REQUEST(&xneti->xni_txring, req_cons, &txreq); + xen_rmb(); XENPRINTF(("%s pkt size %d\n", xneti->xni_if.if_xname, txreq.size)); req_cons++; @@ -957,12 +962,6 @@ mbuf_fail: queued = 0; } } - xen_wmb(); - RING_FINAL_CHECK_FOR_REQUESTS(&xneti->xni_txring, receive_pending); - if (receive_pending) - goto again; - xneti->xni_txring.req_cons = req_cons; - if (m0) { /* Queue empty, and still unfinished multi-fragment request */ printf("%s: dropped unfinished multi-fragment\n",