Wed Jul 7 08:32:51 2021 UTC ()
Set rxr->next_to_refresh correctly in ixgbe_setup_receive_ring().

 ixgbe_setup_receive_ring() fully allocates rx buffers. When a
descriptor ring is full, rxr->next_to_refresh should point to
rxr_next_to_check -1. Before this change, rxr->next_to_refresh
is set to 0 and ixgbe_refresh_mbufs() wastefully loops in
ixgbe_refresh_mbufs() because it means the ring is empty.


(msaitoh)
diff -r1.79 -r1.80 src/sys/dev/pci/ixgbe/ix_txrx.c

cvs diff -r1.79 -r1.80 src/sys/dev/pci/ixgbe/ix_txrx.c (expand / switch to context diff)
--- src/sys/dev/pci/ixgbe/ix_txrx.c 2021/05/27 06:11:34 1.79
+++ src/sys/dev/pci/ixgbe/ix_txrx.c 2021/07/07 08:32:51 1.80
@@ -1,4 +1,4 @@
-/* $NetBSD: ix_txrx.c,v 1.79 2021/05/27 06:11:34 msaitoh Exp $ */
+/* $NetBSD: ix_txrx.c,v 1.80 2021/07/07 08:32:51 msaitoh Exp $ */
 
 /******************************************************************************
 
@@ -64,7 +64,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ix_txrx.c,v 1.79 2021/05/27 06:11:34 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ix_txrx.c,v 1.80 2021/07/07 08:32:51 msaitoh Exp $");
 
 #include "opt_inet.h"
 #include "opt_inet6.h"
@@ -1577,7 +1577,7 @@
 
 	/* Setup our descriptor indices */
 	rxr->next_to_check = 0;
-	rxr->next_to_refresh = 0;
+	rxr->next_to_refresh = adapter->num_rx_desc - 1; /* Fully allocated */
 	rxr->lro_enabled = FALSE;
 	rxr->rx_copies.ev_count = 0;
 #if 0 /* NetBSD */