git: 3ca4a3390356 - main - bge: tell debugnet there are 2 rx rings, not 1,024
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 18 Jul 2022 21:07:57 UTC
The branch main has been updated by vangyzen:
URL: https://cgit.FreeBSD.org/src/commit/?id=3ca4a3390356d72ae4f3be9400b23c52279694e6
commit 3ca4a3390356d72ae4f3be9400b23c52279694e6
Author: Eric van Gyzen <vangyzen@FreeBSD.org>
AuthorDate: 2022-07-18 18:07:20 +0000
Commit: Eric van Gyzen <vangyzen@FreeBSD.org>
CommitDate: 2022-07-18 21:05:18 +0000
bge: tell debugnet there are 2 rx rings, not 1,024
debugnet provides the network stack for netgdb and netdump. Since it
must operate under panic/debugger conditions and can't rely on dynamic
memory allocation, it preallocates mbufs during boot or network
configuration. At that time, it does not yet know which interface
will be used for debugging, so it does not know the required size and
quantity of mbufs to allocate. It takes the worst-case approach by
calculating its requirements from the largest MTU and largest number
of receive queues across all interfaces that support debugnet.
Unfortunately, the bge NIC driver told debugnet that it supports 1,024
receive queues. It actually supports only 2 queues (with 1,024 slots,
thus the error). This greatly exaggerated debugnet's preallocation,
so with an MTU of 9000 on any interface, it allocated 600 MB of memory.
A tiny fraction of this memory would be used if netgdb or netdump were
invoked; the rest is completely wasted.
Reviewed by: markj, rlibby
MFC after: 1 week
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D35845
---
sys/dev/bge/if_bge.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/sys/dev/bge/if_bge.c b/sys/dev/bge/if_bge.c
index ef1674783441..7133e1b7d002 100644
--- a/sys/dev/bge/if_bge.c
+++ b/sys/dev/bge/if_bge.c
@@ -6781,7 +6781,14 @@ bge_debugnet_init(if_t ifp, int *nrxr, int *ncl, int *clsize)
sc = if_getsoftc(ifp);
BGE_LOCK(sc);
- *nrxr = sc->bge_return_ring_cnt;
+ /*
+ * There is only one logical receive ring, but it is backed
+ * by two actual rings, for cluster- and jumbo-sized mbufs.
+ * Debugnet expects only one size, so if jumbo is in use,
+ * this says we have two rings of jumbo mbufs, but that's
+ * only a little wasteful.
+ */
+ *nrxr = 2;
*ncl = DEBUGNET_MAX_IN_FLIGHT;
if ((sc->bge_flags & BGE_FLAG_JUMBO_STD) != 0 &&
(if_getmtu(sc->bge_ifp) + ETHER_HDR_LEN + ETHER_CRC_LEN +