Module Name: src Committed By: msaitoh Date: Wed Aug 25 09:06:03 UTC 2021
Modified Files: src/share/man/man4: ixg.4 ixv.4 src/sys/dev/pci: files.pci src/sys/dev/pci/ixgbe: ix_txrx.c ixgbe.c ixgbe.h ixgbe_netbsd.c ixgbe_netbsd.h ixgbe_osdep.h ixv.c Log Message: 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. To generate a diff of this commit: cvs rdiff -u -r1.14 -r1.15 src/share/man/man4/ixg.4 cvs rdiff -u -r1.7 -r1.8 src/share/man/man4/ixv.4 cvs rdiff -u -r1.437 -r1.438 src/sys/dev/pci/files.pci cvs rdiff -u -r1.86 -r1.87 src/sys/dev/pci/ixgbe/ix_txrx.c cvs rdiff -u -r1.288 -r1.289 src/sys/dev/pci/ixgbe/ixgbe.c cvs rdiff -u -r1.77 -r1.78 src/sys/dev/pci/ixgbe/ixgbe.h cvs rdiff -u -r1.16 -r1.17 src/sys/dev/pci/ixgbe/ixgbe_netbsd.c cvs rdiff -u -r1.13 -r1.14 src/sys/dev/pci/ixgbe/ixgbe_netbsd.h cvs rdiff -u -r1.29 -r1.30 src/sys/dev/pci/ixgbe/ixgbe_osdep.h cvs rdiff -u -r1.164 -r1.165 src/sys/dev/pci/ixgbe/ixv.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/share/man/man4/ixg.4 diff -u src/share/man/man4/ixg.4:1.14 src/share/man/man4/ixg.4:1.15 --- src/share/man/man4/ixg.4:1.14 Tue Mar 9 12:02:24 2021 +++ src/share/man/man4/ixg.4 Wed Aug 25 09:06:02 2021 @@ -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 @@ go to the Intel support website at: .\" with a supported adapter, email the specific information related to the .\" issue to .\" .Aq freebsd...@mailbox.intel.com . -.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 , Index: src/share/man/man4/ixv.4 diff -u src/share/man/man4/ixv.4:1.7 src/share/man/man4/ixv.4:1.8 --- src/share/man/man4/ixv.4:1.7 Tue Mar 9 12:02:24 2021 +++ src/share/man/man4/ixv.4 Wed Aug 25 09:06:02 2021 @@ -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 @@ newer chips support. 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 , Index: src/sys/dev/pci/files.pci diff -u src/sys/dev/pci/files.pci:1.437 src/sys/dev/pci/files.pci:1.438 --- src/sys/dev/pci/files.pci:1.437 Mon Apr 26 19:28:24 2021 +++ src/sys/dev/pci/files.pci Wed Aug 25 09:06:02 2021 @@ -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_phy.c ixg | ixv 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 Index: src/sys/dev/pci/ixgbe/ix_txrx.c diff -u src/sys/dev/pci/ixgbe/ix_txrx.c:1.86 src/sys/dev/pci/ixgbe/ix_txrx.c:1.87 --- src/sys/dev/pci/ixgbe/ix_txrx.c:1.86 Thu Aug 19 10:18:13 2021 +++ src/sys/dev/pci/ixgbe/ix_txrx.c Wed Aug 25 09:06:02 2021 @@ -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 @@ ixgbe_setup_hw_rsc(struct rx_ring *rxr) * 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 @@ ixgbe_refresh_mbufs(struct rx_ring *rxr, 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 @@ ixgbe_setup_receive_ring(struct rx_ring /* 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 @@ ixgbe_setup_receive_ring(struct rx_ring #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 @@ ixgbe_free_receive_buffers(struct rx_rin } } - /* 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 @@ ixgbe_rxeof(struct ix_queue *que) /* 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) { Index: src/sys/dev/pci/ixgbe/ixgbe.c diff -u src/sys/dev/pci/ixgbe/ixgbe.c:1.288 src/sys/dev/pci/ixgbe/ixgbe.c:1.289 --- src/sys/dev/pci/ixgbe/ixgbe.c:1.288 Fri Aug 20 20:25:28 2021 +++ src/sys/dev/pci/ixgbe/ixgbe.c Wed Aug 25 09:06:02 2021 @@ -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 @@ ixgbe_attach(device_t parent, device_t d /* 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 @@ ixgbe_add_device_sysctls(struct adapter 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 @@ ixgbe_init_locked(struct adapter *adapte /* 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); Index: src/sys/dev/pci/ixgbe/ixgbe.h diff -u src/sys/dev/pci/ixgbe/ixgbe.h:1.77 src/sys/dev/pci/ixgbe/ixgbe.h:1.78 --- src/sys/dev/pci/ixgbe/ixgbe.h:1.77 Thu Aug 19 22:17:56 2021 +++ src/sys/dev/pci/ixgbe/ixgbe.h Wed Aug 25 09:06:02 2021 @@ -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 @@ struct rx_ring { #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 @@ struct adapter { 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 @@ bool ixgbe_rxeof(struct ix_queue *); /* 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" Index: src/sys/dev/pci/ixgbe/ixgbe_netbsd.c diff -u src/sys/dev/pci/ixgbe/ixgbe_netbsd.c:1.16 src/sys/dev/pci/ixgbe/ixgbe_netbsd.c:1.17 --- src/sys/dev/pci/ixgbe/ixgbe_netbsd.c:1.16 Fri Apr 30 06:55:32 2021 +++ src/sys/dev/pci/ixgbe/ixgbe_netbsd.c Wed Aug 25 09:06:02 2021 @@ -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 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: ixgbe_netbsd.c,v 1.16 2021/04/30 06:55:32 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ixgbe_netbsd.c,v 1.17 2021/08/25 09:06:02 msaitoh Exp $"); #include <sys/param.h> @@ -99,192 +99,19 @@ ixgbe_dmamap_create(ixgbe_dma_tag_t *dt, dt->dt_maxsegsize, dt->dt_boundary, flags, dmamp); } -static void -ixgbe_putext(ixgbe_extmem_t *em) -{ - ixgbe_extmem_head_t *eh = em->em_head; - - mutex_enter(&eh->eh_mtx); - - TAILQ_INSERT_HEAD(&eh->eh_freelist, em, em_link); - - mutex_exit(&eh->eh_mtx); - - return; -} - -static ixgbe_extmem_t * -ixgbe_getext(ixgbe_extmem_head_t *eh, size_t size) -{ - ixgbe_extmem_t *em; - - mutex_enter(&eh->eh_mtx); - - TAILQ_FOREACH(em, &eh->eh_freelist, em_link) { - if (em->em_size >= size) - break; - } - - if (em != NULL) - TAILQ_REMOVE(&eh->eh_freelist, em, em_link); - - mutex_exit(&eh->eh_mtx); - - return em; -} - -static ixgbe_extmem_t * -ixgbe_newext(ixgbe_extmem_head_t *eh, bus_dma_tag_t dmat, size_t size) -{ - ixgbe_extmem_t *em; - int nseg, rc; - - em = kmem_zalloc(sizeof(*em), KM_SLEEP); - - rc = bus_dmamem_alloc(dmat, size, PAGE_SIZE, 0, &em->em_seg, 1, &nseg, - BUS_DMA_WAITOK); - - if (rc != 0) - goto post_zalloc_err; - - rc = bus_dmamem_map(dmat, &em->em_seg, 1, size, &em->em_vaddr, - BUS_DMA_WAITOK); - - if (rc != 0) - goto post_dmamem_err; - - em->em_dmat = dmat; - em->em_size = size; - em->em_head = eh; - - return em; -post_dmamem_err: - bus_dmamem_free(dmat, &em->em_seg, 1); -post_zalloc_err: - kmem_free(em, sizeof(*em)); - return NULL; -} - -static void -ixgbe_jcl_freeall(struct adapter *adapter, struct rx_ring *rxr) -{ - ixgbe_extmem_head_t *eh = &rxr->jcl_head; - ixgbe_extmem_t *em; - bus_dma_tag_t dmat = rxr->ptag->dt_dmat; - - while ((em = ixgbe_getext(eh, 0)) != NULL) { - KASSERT(em->em_vaddr != NULL); - bus_dmamem_unmap(dmat, em->em_vaddr, em->em_size); - bus_dmamem_free(dmat, &em->em_seg, 1); - memset(em, 0, sizeof(*em)); - kmem_free(em, sizeof(*em)); - } -} -void -ixgbe_jcl_reinit(struct adapter *adapter, bus_dma_tag_t dmat, - struct rx_ring *rxr, int nbuf, size_t size) -{ - ixgbe_extmem_head_t *eh = &rxr->jcl_head; - ixgbe_extmem_t *em; - int i; - - if (!eh->eh_initialized) { - TAILQ_INIT(&eh->eh_freelist); - mutex_init(&eh->eh_mtx, MUTEX_DEFAULT, IPL_NET); - eh->eh_initialized = true; - } - - /* - * Check previous parameters. If it's not required to reinit, just - * return. - * - * Note that the num_rx_desc is currently fixed value. It's never - * changed after device is attached. - */ - if ((rxr->last_rx_mbuf_sz == rxr->mbuf_sz) - && (rxr->last_num_rx_desc == adapter->num_rx_desc)) - return; - - /* Free all dmamem */ - ixgbe_jcl_freeall(adapter, rxr); - - for (i = 0; i < nbuf; i++) { - if ((em = ixgbe_newext(eh, dmat, size)) == NULL) { - device_printf(adapter->dev, - "%s: only %d of %d jumbo buffers allocated\n", - __func__, i, nbuf); - break; - } - ixgbe_putext(em); - } - - /* Keep current parameters */ - rxr->last_rx_mbuf_sz = adapter->rx_mbuf_sz; - rxr->last_num_rx_desc = adapter->num_rx_desc; -} - -void -ixgbe_jcl_destroy(struct adapter *adapter, struct rx_ring *rxr) -{ - ixgbe_extmem_head_t *eh = &rxr->jcl_head; - - if (eh->eh_initialized) { - /* Free all dmamem */ - ixgbe_jcl_freeall(adapter, rxr); - - mutex_destroy(&eh->eh_mtx); - eh->eh_initialized = false; - } -} - - -static void -ixgbe_jcl_free(struct mbuf *m, void *buf, size_t size, void *arg) -{ - ixgbe_extmem_t *em = arg; - - KASSERT(em->em_size == size); - - ixgbe_putext(em); - /* this is an abstraction violation, but it does not lead to a - * double-free - */ - if (__predict_true(m != NULL)) { - KASSERT(m->m_type != MT_FREE); - m->m_type = MT_FREE; - pool_cache_put(mb_cache, m); - } -} - -/* XXX need to wait for the system to finish with each jumbo mbuf and - * free it before detaching the driver from the device. - */ struct mbuf * -ixgbe_getjcl(ixgbe_extmem_head_t *eh, int nowait /* M_DONTWAIT */, - int type /* MT_DATA */, int flags /* M_PKTHDR */, size_t size) +ixgbe_getcl(void) { - ixgbe_extmem_t *em; struct mbuf *m; - if ((flags & M_PKTHDR) != 0) - m = m_gethdr(nowait, type); - else - m = m_get(nowait, type); + MGETHDR(m, M_DONTWAIT, MT_DATA); if (m == NULL) return NULL; - em = ixgbe_getext(eh, size); - if (em == NULL) { - m_freem(m); - return NULL; - } - - MEXTADD(m, em->em_vaddr, em->em_size, M_DEVBUF, &ixgbe_jcl_free, em); - + MCLGET(m, M_DONTWAIT); if ((m->m_flags & M_EXT) == 0) { - ixgbe_putext(em); m_freem(m); return NULL; } Index: src/sys/dev/pci/ixgbe/ixgbe_netbsd.h diff -u src/sys/dev/pci/ixgbe/ixgbe_netbsd.h:1.13 src/sys/dev/pci/ixgbe/ixgbe_netbsd.h:1.14 --- src/sys/dev/pci/ixgbe/ixgbe_netbsd.h:1.13 Wed May 19 08:19:20 2021 +++ src/sys/dev/pci/ixgbe/ixgbe_netbsd.h Wed Aug 25 09:06:02 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: ixgbe_netbsd.h,v 1.13 2021/05/19 08:19:20 msaitoh Exp $ */ +/* $NetBSD: ixgbe_netbsd.h,v 1.14 2021/08/25 09:06:02 msaitoh Exp $ */ /* * Copyright (c) 2011 The NetBSD Foundation, Inc. * All rights reserved. @@ -40,20 +40,6 @@ #define MJUM16BYTES (16 * 1024) #define MJUMPAGESIZE PAGE_SIZE -/* - * Number of jcl per queue is calculated by - * adapter->num_rx_desc * IXGBE_JCLNUM_MULTI. The lower limit is 2. - */ -#define IXGBE_JCLNUM_MULTI_LOWLIM 2 -#define IXGBE_JCLNUM_MULTI_DEFAULT 3 -#if !defined(IXGBE_JCLNUM_MULTI) -# define IXGBE_JCLNUM_MULTI IXGBE_JCLNUM_MULTI_DEFAULT -#else -# if (IXGBE_JCLNUM_MULTI < IXGBE_JCLNUM_MULTI_LOWLIM) -# error IXGBE_JCLNUM_MULTI is too low. -# endif -#endif - #define IFCAP_RXCSUM \ (IFCAP_CSUM_IPv4_Rx|IFCAP_CSUM_TCPv4_Rx|IFCAP_CSUM_UDPv4_Rx|\ IFCAP_CSUM_TCPv6_Rx|IFCAP_CSUM_UDPv6_Rx) @@ -76,26 +62,6 @@ struct ixgbe_dma_tag { typedef struct ixgbe_dma_tag ixgbe_dma_tag_t; -struct ixgbe_extmem_head; -typedef struct ixgbe_extmem_head ixgbe_extmem_head_t; - -struct ixgbe_extmem { - ixgbe_extmem_head_t *em_head; - bus_dma_tag_t em_dmat; - bus_size_t em_size; - bus_dma_segment_t em_seg; - void *em_vaddr; - TAILQ_ENTRY(ixgbe_extmem) em_link; -}; - -typedef struct ixgbe_extmem ixgbe_extmem_t; - -struct ixgbe_extmem_head { - TAILQ_HEAD(, ixgbe_extmem) eh_freelist; - kmutex_t eh_mtx; - bool eh_initialized; -}; - int ixgbe_dma_tag_create(bus_dma_tag_t, bus_size_t, bus_size_t, bus_size_t, int, bus_size_t, int, ixgbe_dma_tag_t **); void ixgbe_dma_tag_destroy(ixgbe_dma_tag_t *); @@ -104,7 +70,7 @@ void ixgbe_dmamap_destroy(ixgbe_dma_tag_ void ixgbe_dmamap_sync(ixgbe_dma_tag_t *, bus_dmamap_t, int); void ixgbe_dmamap_unload(ixgbe_dma_tag_t *, bus_dmamap_t); -struct mbuf *ixgbe_getjcl(ixgbe_extmem_head_t *, int, int, int, size_t); +struct mbuf *ixgbe_getcl(void); void ixgbe_pci_enable_busmaster(pci_chipset_tag_t, pcitag_t); u_int atomic_load_acq_uint(volatile u_int *); Index: src/sys/dev/pci/ixgbe/ixgbe_osdep.h diff -u src/sys/dev/pci/ixgbe/ixgbe_osdep.h:1.29 src/sys/dev/pci/ixgbe/ixgbe_osdep.h:1.30 --- src/sys/dev/pci/ixgbe/ixgbe_osdep.h:1.29 Thu Aug 19 10:18:13 2021 +++ src/sys/dev/pci/ixgbe/ixgbe_osdep.h Wed Aug 25 09:06:02 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: ixgbe_osdep.h,v 1.29 2021/08/19 10:18:13 msaitoh Exp $ */ +/* $NetBSD: ixgbe_osdep.h,v 1.30 2021/08/25 09:06:02 msaitoh Exp $ */ /****************************************************************************** SPDX-License-Identifier: BSD-3-Clause @@ -176,7 +176,6 @@ struct ixgbe_osdep bus_space_handle_t mem_bus_space_handle; bus_size_t mem_size; bus_dma_tag_t dmat; - u16 last_rx_mbuf_sz; pci_intr_handle_t *intrs; int nintrs; void *ihs[IXG_MAX_NINTR]; Index: src/sys/dev/pci/ixgbe/ixv.c diff -u src/sys/dev/pci/ixgbe/ixv.c:1.164 src/sys/dev/pci/ixgbe/ixv.c:1.165 --- src/sys/dev/pci/ixgbe/ixv.c:1.164 Thu Jul 15 08:09:31 2021 +++ src/sys/dev/pci/ixgbe/ixv.c Wed Aug 25 09:06:02 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: ixv.c,v 1.164 2021/07/15 08:09:31 msaitoh Exp $ */ +/* $NetBSD: ixv.c,v 1.165 2021/08/25 09:06:02 msaitoh Exp $ */ /****************************************************************************** @@ -35,13 +35,12 @@ /*$FreeBSD: head/sys/dev/ixgbe/if_ixv.c 331224 2018-03-19 20:55:05Z erj $*/ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: ixv.c,v 1.164 2021/07/15 08:09:31 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ixv.c,v 1.165 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" @@ -521,8 +520,6 @@ ixv_attach(device_t parent, device_t dev /* 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; - /* Setup MSI-X */ error = ixv_configure_interrupts(adapter); if (error) @@ -751,14 +748,8 @@ ixv_init_locked(struct adapter *adapter) /* Setup Multicast table */ ixv_set_rxfilter(adapter); - /* - * Determine the correct mbuf pool - * for doing jumbo/headersplit - */ - 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); @@ -2599,13 +2590,6 @@ ixv_add_device_sysctls(struct adapter *a 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_READWRITE, CTLTYPE_BOOL, "enable_aim", SYSCTL_DESCR("Interrupt Moderation"), NULL, 0, &adapter->enable_aim, 0, CTL_CREATE, CTL_EOL) != 0)