git: d3ca462c94b2 - stable/13 - gve: Simplify tx loop over buffer ring

From: Xin LI <delphij_at_FreeBSD.org>
Date: Fri, 18 Aug 2023 23:18:49 UTC
The branch stable/13 has been updated by delphij:

URL: https://cgit.FreeBSD.org/src/commit/?id=d3ca462c94b268cfa04cb66101fa41a3c752651d

commit d3ca462c94b268cfa04cb66101fa41a3c752651d
Author:     Shailend Chand <shailend@google.com>
AuthorDate: 2023-08-12 07:59:26 +0000
Commit:     Xin LI <delphij@FreeBSD.org>
CommitDate: 2023-08-18 23:18:16 +0000

    gve: Simplify tx loop over buffer ring
    
    Reviewed by:    markj
    Differential Revision: https://reviews.freebsd.org/D41281
    
    (cherry picked from commit 543cf924bcdcf064fed417ec3d66000ef66194d2)
---
 sys/dev/gve/gve_tx.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/sys/dev/gve/gve_tx.c b/sys/dev/gve/gve_tx.c
index db3f7415f412..1e62e1226be1 100644
--- a/sys/dev/gve/gve_tx.c
+++ b/sys/dev/gve/gve_tx.c
@@ -696,10 +696,9 @@ gve_xmit_br(struct gve_tx_ring *tx)
 	struct ifnet *ifp = priv->ifp;
 	struct mbuf *mbuf;
 
-	while (!drbr_empty(ifp, tx->br) &&
-	    (if_getdrvflags(ifp) & IFF_DRV_RUNNING) != 0) {
+	while ((if_getdrvflags(ifp) & IFF_DRV_RUNNING) != 0 &&
+	    (mbuf = drbr_peek(ifp, tx->br)) != NULL) {
 
-		mbuf = drbr_peek(ifp, tx->br);
 		if (__predict_false(gve_xmit(tx, mbuf) != 0)) {
 			drbr_putback(ifp, tx->br, mbuf);
 			taskqueue_enqueue(tx->xmit_tq, &tx->xmit_task);