Date: Sat, 14 Mar 2020 20:11:46 +0000 (UTC) From: Patrick Kelsey <pkelsey@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r359001 - head/sys/dev/vmware/vmxnet3 Message-ID: <202003142011.02EKBkuX011813@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: pkelsey Date: Sat Mar 14 20:11:46 2020 New Revision: 359001 URL: https://svnweb.freebsd.org/changeset/base/359001 Log: Adjust if_vmx default receive parameters for better out-of-box performance These adjustments improve performance with jumbo frames and/or LRO enabled (i.e., when there may be multiple descriptors per packet) by increasing the default size of the receive queues and by always using page-sized buffers for the body type receive ring. This patch also adjust the initialization of the max frame size to remove cases where certain configuration sequences would result in 2K receive buffers being used instead of 4K ones when jumbo frames were enabled. Reviewed by: gallatin MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D23950 Modified: head/sys/dev/vmware/vmxnet3/if_vmx.c head/sys/dev/vmware/vmxnet3/if_vmxvar.h Modified: head/sys/dev/vmware/vmxnet3/if_vmx.c ============================================================================== --- head/sys/dev/vmware/vmxnet3/if_vmx.c Sat Mar 14 20:08:04 2020 (r359000) +++ head/sys/dev/vmware/vmxnet3/if_vmx.c Sat Mar 14 20:11:46 2020 (r359001) @@ -381,6 +381,12 @@ vmxnet3_attach_pre(if_ctx_t ctx) scctx->isc_rxqsizes[2] = sizeof(struct vmxnet3_rxdesc) * scctx->isc_nrxd[2]; + /* + * Initialize the max frame size and descriptor queue buffer + * sizes. + */ + vmxnet3_mtu_set(ctx, if_getmtu(sc->vmx_ifp)); + scctx->isc_rss_table_size = UPT1_RSS_MAX_IND_TABLE_SIZE; /* Map PCI BARs */ @@ -1943,14 +1949,9 @@ static void vmxnet3_init(if_ctx_t ctx) { struct vmxnet3_softc *sc; - if_softc_ctx_t scctx; sc = iflib_get_softc(ctx); - scctx = sc->vmx_scctx; - scctx->isc_max_frame_size = if_getmtu(iflib_get_ifp(ctx)) + - ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN + ETHER_CRC_LEN; - /* Use the current MAC address. */ bcopy(IF_LLADDR(sc->vmx_ifp), sc->vmx_lladdr, ETHER_ADDR_LEN); vmxnet3_set_lladdr(sc); @@ -1975,10 +1976,36 @@ vmxnet3_multi_set(if_ctx_t ctx) static int vmxnet3_mtu_set(if_ctx_t ctx, uint32_t mtu) { + struct vmxnet3_softc *sc; + if_softc_ctx_t scctx; + sc = iflib_get_softc(ctx); + scctx = sc->vmx_scctx; + if (mtu > VMXNET3_TX_MAXSIZE - (ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN + ETHER_CRC_LEN)) return (EINVAL); + + /* + * Update the max frame size so that the rx mbuf size is + * chosen based on the new mtu during the interface init that + * will occur after this routine returns. + */ + scctx->isc_max_frame_size = mtu + + ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN + ETHER_CRC_LEN; + /* RX completion queue - n/a */ + scctx->isc_rxd_buf_size[0] = 0; + /* + * For header-type descriptors (used for first segment of + * packet), let iflib determine the buffer size based on the + * max frame size. + */ + scctx->isc_rxd_buf_size[1] = 0; + /* + * For body-type descriptors (used for jumbo frames and LRO), + * always use page-sized buffers. + */ + scctx->isc_rxd_buf_size[2] = MJUMPAGESIZE; return (0); } Modified: head/sys/dev/vmware/vmxnet3/if_vmxvar.h ============================================================================== --- head/sys/dev/vmware/vmxnet3/if_vmxvar.h Sat Mar 14 20:08:04 2020 (r359000) +++ head/sys/dev/vmware/vmxnet3/if_vmxvar.h Sat Mar 14 20:11:46 2020 (r359001) @@ -41,7 +41,7 @@ struct vmxnet3_softc; #define VMXNET3_MAX_TX_NDESC 4096 #define VMXNET3_MIN_TX_NDESC 32 #define VMXNET3_MASK_TX_NDESC 0x1F -#define VMXNET3_DEF_RX_NDESC 256 +#define VMXNET3_DEF_RX_NDESC 512 #define VMXNET3_MAX_RX_NDESC 2048 #define VMXNET3_MIN_RX_NDESC 32 #define VMXNET3_MASK_RX_NDESC 0x1F
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202003142011.02EKBkuX011813>