Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src Use MCLGET() instead of homegrown cluster (jcl) allocation m...
details: https://anonhg.NetBSD.org/src/rev/79b84dd10d5d
branches: trunk
changeset: 1023112:79b84dd10d5d
user: msaitoh <msaitoh%NetBSD.org@localhost>
date: Wed Aug 25 09:06:02 2021 +0000
description:
Use MCLGET() instead of homegrown cluster (jcl) allocation mechanism.
- Before this commit, resource shortage was easily occurred because the total
number of the clusters is small.
- Reviewed by knakahara and ryo.
diffstat:
share/man/man4/ixg.4 | 24 +----
share/man/man4/ixv.4 | 24 +----
sys/dev/pci/files.pci | 3 +-
sys/dev/pci/ixgbe/ix_txrx.c | 29 +----
sys/dev/pci/ixgbe/ixgbe.c | 21 +---
sys/dev/pci/ixgbe/ixgbe.h | 9 +-
sys/dev/pci/ixgbe/ixgbe_netbsd.c | 185 +-------------------------------------
sys/dev/pci/ixgbe/ixgbe_netbsd.h | 38 +-------
sys/dev/pci/ixgbe/ixgbe_osdep.h | 3 +-
sys/dev/pci/ixgbe/ixv.c | 24 +----
10 files changed, 29 insertions(+), 331 deletions(-)
diffs (truncated from 652 to 300 lines):
diff -r f55d662387fa -r 79b84dd10d5d share/man/man4/ixg.4
--- a/share/man/man4/ixg.4 Wed Aug 25 04:13:41 2021 +0000
+++ b/share/man/man4/ixg.4 Wed Aug 25 09:06:02 2021 +0000
@@ -1,4 +1,4 @@
-.\" $NetBSD: ixg.4,v 1.14 2021/03/09 12:02:24 wiz Exp $
+.\" $NetBSD: ixg.4,v 1.15 2021/08/25 09:06:02 msaitoh Exp $
.\"
.\" Copyright (c) 2001-2008, Intel Corporation
.\" All rights reserved.
@@ -33,7 +33,7 @@
.\"
.\" $FreeBSD: src/share/man/man4/ixgbe.4,v 1.3 2010/12/19 23:54:31 yongari Exp $
.\"
-.Dd March 9, 2021
+.Dd August 25, 2021
.Dt IXG 4
.Os
.Sh NAME
@@ -83,26 +83,6 @@
.\" with a supported adapter, email the specific information related to the
.\" issue to
.\" .Aq freebsdnic%mailbox.intel.com@localhost .
-.Sh OPTIONS
-The
-.Nm
-driver doesn't use the common
-.Xr MCLGET 9
-interface and use the driver specific cluster allocation mechanism.
-If it's exhausted, the
-.Xr evcnt 9
-counter "ixgX qY Rx no jumbo mbuf" is incremented.
-If this is observed,
-the number can be changed by the following config parameter:
-.Bl -tag -width IXGBE_JCLNUM_MULTI -offset 3n
-.It Dv IXGBE_JCLNUM_MULTI
-The number of RX jumbo buffers (clusters) per queue is calculated by
-.Dv IXGBE_JCLNUM_MULTI
-* (number of rx descriptors).
-The total number of clusters per queue is available via the
-.Li hw.ixgN.num_jcl_per_queue
-.Xr sysctl 7 .
-.El
.Sh SEE ALSO
.Xr arp 4 ,
.Xr ixv 4 ,
diff -r f55d662387fa -r 79b84dd10d5d share/man/man4/ixv.4
--- a/share/man/man4/ixv.4 Wed Aug 25 04:13:41 2021 +0000
+++ b/share/man/man4/ixv.4 Wed Aug 25 09:06:02 2021 +0000
@@ -1,4 +1,4 @@
-.\" $NetBSD: ixv.4,v 1.7 2021/03/09 12:02:24 wiz Exp $
+.\" $NetBSD: ixv.4,v 1.8 2021/08/25 09:06:02 msaitoh Exp $
.\"
.\" Copyright (c) 2018 The NetBSD Foundation, Inc.
.\" All rights reserved.
@@ -27,7 +27,7 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.Dd March 9, 2021
+.Dd August 25, 2021
.Dt IXV 4
.Os
.Sh NAME
@@ -43,26 +43,6 @@
It can be used on a
.Nx
guest that the host supports SR-IOV.
-.Sh OPTIONS
-The
-.Nm
-driver doesn't use the common
-.Xr MCLGET 9
-interface and use the driver specific cluster allocation mechanism.
-If it's exhausted, the
-.Xr evcnt 9
-counter "ixgX qY Rx no jumbo mbuf" is incremented.
-If this is observed,
-the number can be changed by the following config parameter:
-.Bl -tag -width IXGBE_JCLNUM_MULTI -offset 3n
-.It Dv IXGBE_JCLNUM_MULTI
-The number of RX jumbo buffers (clusters) per queue is calculated by
-.Dv IXGBE_JCLNUM_MULTI
-* (number of rx descriptors).
-The total number of clusters per queue is available with the
-.Li hw.ixgN.num_jcl_per_queue
-.Xr sysctl 7 .
-.El
.Sh SEE ALSO
.Xr arp 4 ,
.Xr ixg 4 ,
diff -r f55d662387fa -r 79b84dd10d5d sys/dev/pci/files.pci
--- a/sys/dev/pci/files.pci Wed Aug 25 04:13:41 2021 +0000
+++ b/sys/dev/pci/files.pci Wed Aug 25 09:06:02 2021 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: files.pci,v 1.437 2021/04/26 19:28:24 thorpej Exp $
+# $NetBSD: files.pci,v 1.438 2021/08/25 09:06:02 msaitoh Exp $
#
# Config file and device description for machine-independent PCI code.
# Included by ports that need it. Requires that the SCSI files be
@@ -664,7 +664,6 @@
file dev/pci/ixgbe/ixgbe_vf.c ixg | ixv
file dev/pci/ixgbe/if_bypass.c ixg | ixv
file dev/pci/ixgbe/if_fdir.c ixg | ixv
-defparam opt_ixgbe.h IXGBE_JCLNUM_MULTI
# This appears to be the driver for virtual instances of i82599.
device ixv: ether, ifnet, arp, mii, mii_phy
diff -r f55d662387fa -r 79b84dd10d5d sys/dev/pci/ixgbe/ix_txrx.c
--- a/sys/dev/pci/ixgbe/ix_txrx.c Wed Aug 25 04:13:41 2021 +0000
+++ b/sys/dev/pci/ixgbe/ix_txrx.c Wed Aug 25 09:06:02 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ix_txrx.c,v 1.86 2021/08/19 10:18:13 msaitoh Exp $ */
+/* $NetBSD: ix_txrx.c,v 1.87 2021/08/25 09:06:02 msaitoh Exp $ */
/******************************************************************************
@@ -64,7 +64,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ix_txrx.c,v 1.86 2021/08/19 10:18:13 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ix_txrx.c,v 1.87 2021/08/25 09:06:02 msaitoh Exp $");
#include "opt_inet.h"
#include "opt_inet6.h"
@@ -1330,7 +1330,7 @@
* be recalled to try again.
*
* XXX NetBSD TODO:
- * - The ixgbe_rxeof() function always preallocates mbuf cluster (jcl),
+ * - The ixgbe_rxeof() function always preallocates mbuf cluster,
* so the ixgbe_refresh_mbufs() function can be simplified.
*
************************************************************************/
@@ -1351,8 +1351,7 @@
while (i != limit) {
rxbuf = &rxr->rx_buffers[i];
if (rxbuf->buf == NULL) {
- mp = ixgbe_getjcl(&rxr->jcl_head, M_NOWAIT,
- MT_DATA, M_PKTHDR, rxr->mbuf_sz);
+ mp = ixgbe_getcl();
if (mp == NULL) {
rxr->no_jmbuf.ev_count++;
goto update;
@@ -1506,17 +1505,6 @@
/* Free current RX buffer structs and their mbufs */
ixgbe_free_receive_ring(rxr);
- IXGBE_RX_UNLOCK(rxr);
- /*
- * Now reinitialize our supply of jumbo mbufs. The number
- * or size of jumbo mbufs may have changed.
- * Assume all of rxr->ptag are the same.
- */
- ixgbe_jcl_reinit(adapter, rxr->ptag->dt_dmat, rxr,
- adapter->num_jcl, adapter->rx_mbuf_sz);
-
- IXGBE_RX_LOCK(rxr);
-
/* Now replenish the mbufs */
for (int j = 0; j != rxr->num_desc; ++j) {
struct mbuf *mp;
@@ -1546,8 +1534,7 @@
#endif /* DEV_NETMAP */
rxbuf->flags = 0;
- rxbuf->buf = ixgbe_getjcl(&rxr->jcl_head, M_NOWAIT,
- MT_DATA, M_PKTHDR, adapter->rx_mbuf_sz);
+ rxbuf->buf = ixgbe_getcl();
if (rxbuf->buf == NULL) {
rxr->no_jmbuf.ev_count++;
error = ENOBUFS;
@@ -1702,9 +1689,6 @@
}
}
- /* NetBSD specific. See ixgbe_netbsd.c */
- ixgbe_jcl_destroy(adapter, rxr);
-
if (rxr->rx_buffers != NULL) {
free(rxr->rx_buffers, M_DEVBUF);
rxr->rx_buffers = NULL;
@@ -1893,8 +1877,7 @@
/* pre-alloc new mbuf */
if (!discard_multidesc)
- newmp = ixgbe_getjcl(&rxr->jcl_head, M_NOWAIT, MT_DATA,
- M_PKTHDR, rxr->mbuf_sz);
+ newmp = ixgbe_getcl();
else
newmp = NULL;
if (newmp == NULL) {
diff -r f55d662387fa -r 79b84dd10d5d sys/dev/pci/ixgbe/ixgbe.c
--- a/sys/dev/pci/ixgbe/ixgbe.c Wed Aug 25 04:13:41 2021 +0000
+++ b/sys/dev/pci/ixgbe/ixgbe.c Wed Aug 25 09:06:02 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.288 2021/08/20 20:25:28 andvar Exp $ */
+/* $NetBSD: ixgbe.c,v 1.289 2021/08/25 09:06:02 msaitoh Exp $ */
/******************************************************************************
@@ -64,13 +64,12 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ixgbe.c,v 1.288 2021/08/20 20:25:28 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ixgbe.c,v 1.289 2021/08/25 09:06:02 msaitoh Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
#include "opt_inet6.h"
#include "opt_net_mpsafe.h"
-#include "opt_ixgbe.h"
#endif
#include "ixgbe.h"
@@ -991,8 +990,6 @@
/* Set default high limit of copying mbuf in rxeof */
adapter->rx_copy_len = IXGBE_RX_COPY_LEN_MAX;
- adapter->num_jcl = adapter->num_rx_desc * IXGBE_JCLNUM_MULTI;
-
/* Allocate our TX/RX Queues */
if (ixgbe_allocate_queues(adapter)) {
error = ENOMEM;
@@ -3419,13 +3416,6 @@
aprint_error_dev(dev, "could not create sysctl\n");
if (sysctl_createv(log, 0, &rnode, &cnode,
- CTLFLAG_READONLY, CTLTYPE_INT, "num_jcl_per_queue",
- SYSCTL_DESCR("Number of jumbo buffers per queue"),
- NULL, 0, &adapter->num_jcl, 0, CTL_CREATE,
- CTL_EOL) != 0)
- aprint_error_dev(dev, "could not create sysctl\n");
-
- if (sysctl_createv(log, 0, &rnode, &cnode,
CTLFLAG_READONLY, CTLTYPE_INT,
"num_queues", SYSCTL_DESCR("Number of queues"),
NULL, 0, &adapter->num_queues, 0, CTL_CREATE, CTL_EOL) != 0)
@@ -4076,11 +4066,8 @@
/* Setup Multicast table */
ixgbe_set_rxfilter(adapter);
- /* Determine the correct mbuf pool, based on frame size */
- if (adapter->max_frame_size <= MCLBYTES)
- adapter->rx_mbuf_sz = MCLBYTES;
- else
- adapter->rx_mbuf_sz = MJUMPAGESIZE;
+ /* Use fixed buffer size, even for jumbo frames */
+ adapter->rx_mbuf_sz = MCLBYTES;
/* Prepare receive descriptors and buffers */
error = ixgbe_setup_receive_structures(adapter);
diff -r f55d662387fa -r 79b84dd10d5d sys/dev/pci/ixgbe/ixgbe.h
--- a/sys/dev/pci/ixgbe/ixgbe.h Wed Aug 25 04:13:41 2021 +0000
+++ b/sys/dev/pci/ixgbe/ixgbe.h Wed Aug 25 09:06:02 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.h,v 1.77 2021/08/19 22:17:56 msaitoh Exp $ */
+/* $NetBSD: ixgbe.h,v 1.78 2021/08/25 09:06:02 msaitoh Exp $ */
/******************************************************************************
SPDX-License-Identifier: BSD-3-Clause
@@ -416,9 +416,6 @@
#endif
struct ixgbe_rx_buf *rx_buffers;
ixgbe_dma_tag_t *ptag;
- u16 last_rx_mbuf_sz;
- u32 last_num_rx_desc;
- ixgbe_extmem_head_t jcl_head;
u64 bytes; /* Used for AIM calc */
u64 packets;
@@ -566,7 +563,6 @@
u32 num_rx_desc;
u32 rx_process_limit;
u32 rx_copy_len;
- int num_jcl;
/* Multicast array memory */
struct ixgbe_mc_addr *mta;
@@ -778,9 +774,6 @@
/* For NetBSD */
const struct sysctlnode *ixgbe_sysctl_instance(struct adapter *);
-void ixgbe_jcl_reinit(struct adapter *, bus_dma_tag_t, struct rx_ring *,
- int, size_t);
-void ixgbe_jcl_destroy(struct adapter *, struct rx_ring *);
#include "ixgbe_bypass.h"
#include "ixgbe_fdir.h"
diff -r f55d662387fa -r 79b84dd10d5d sys/dev/pci/ixgbe/ixgbe_netbsd.c
--- a/sys/dev/pci/ixgbe/ixgbe_netbsd.c Wed Aug 25 04:13:41 2021 +0000
+++ b/sys/dev/pci/ixgbe/ixgbe_netbsd.c Wed Aug 25 09:06:02 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe_netbsd.c,v 1.16 2021/04/30 06:55:32 msaitoh Exp $ */
+/* $NetBSD: ixgbe_netbsd.c,v 1.17 2021/08/25 09:06:02 msaitoh Exp $ */
/*
* Copyright (c) 2011 The NetBSD Foundation, Inc.
* All rights reserved.
@@ -29,7 +29,7 @@
Home |
Main Index |
Thread Index |
Old Index