From owner-dev-commits-src-main@freebsd.org Tue Jan 19 05:08:29 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 880444E535B; Tue, 19 Jan 2021 05:08:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DKcB452xcz4XR2; Tue, 19 Jan 2021 05:08:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6873E206E7; Tue, 19 Jan 2021 05:08:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10J58OoB085994; Tue, 19 Jan 2021 05:08:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10J58OaU085993; Tue, 19 Jan 2021 05:08:24 GMT (envelope-from git) Date: Tue, 19 Jan 2021 05:08:24 GMT Message-Id: <202101190508.10J58OaU085993@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Bryan Venteicher Subject: git: 177761e4c467 - main - if_vtnet: Set the interface max TSO values MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bryanv X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 177761e4c4673612dd64793a31a90142d9a04e62 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jan 2021 05:08:30 -0000 The branch main has been updated by bryanv: URL: https://cgit.FreeBSD.org/src/commit/?id=177761e4c4673612dd64793a31a90142d9a04e62 commit 177761e4c4673612dd64793a31a90142d9a04e62 Author: Bryan Venteicher AuthorDate: 2021-01-19 04:55:25 +0000 Commit: Bryan Venteicher CommitDate: 2021-01-19 04:55:25 +0000 if_vtnet: Set the interface max TSO values Reviewed by: grehan (mentor) Differential Revision: https://reviews.freebsd.org/D27917 --- sys/dev/virtio/network/if_vtnet.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/sys/dev/virtio/network/if_vtnet.c b/sys/dev/virtio/network/if_vtnet.c index 642c513ff0b3..2447f29a8820 100644 --- a/sys/dev/virtio/network/if_vtnet.c +++ b/sys/dev/virtio/network/if_vtnet.c @@ -289,6 +289,11 @@ TUNABLE_INT("hw.vtnet.mq_max_pairs", &vtnet_mq_max_pairs); SYSCTL_INT(_hw_vtnet, OID_AUTO, mq_max_pairs, CTLFLAG_RDTUN, &vtnet_mq_max_pairs, 0, "Sets the maximum number of multiqueue pairs"); +static int vtnet_tso_maxlen = IP_MAXPACKET; +TUNABLE_INT("hw.vtnet.tso_maxlen", &vtnet_tso_maxlen); +SYSCTL_INT(_hw_vtnet, OID_AUTO, tso_maxlen, CTLFLAG_RDTUN, + &vtnet_tso_maxlen, 0, "TSO burst limit"); + static int vtnet_rx_process_limit = 1024; TUNABLE_INT("hw.vtnet.rx_process_limit", &vtnet_rx_process_limit); SYSCTL_INT(_hw_vtnet, OID_AUTO, rx_process_limit, CTLFLAG_RDTUN, @@ -1042,8 +1047,18 @@ vtnet_setup_interface(struct vtnet_softc *sc) if (gso || virtio_with_feature(dev, VIRTIO_NET_F_HOST_ECN)) sc->vtnet_flags |= VTNET_FLAG_TSO_ECN; - if (ifp->if_capabilities & (IFCAP_TSO4 | IFCAP_TSO6)) + if (ifp->if_capabilities & (IFCAP_TSO4 | IFCAP_TSO6)) { + int tso_maxlen; + ifp->if_capabilities |= IFCAP_VLAN_HWTSO; + + tso_maxlen = vtnet_tunable_int(sc, "tso_maxlen", + vtnet_tso_maxlen); + ifp->if_hw_tsomax = tso_maxlen - + (ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN); + ifp->if_hw_tsomaxsegcount = sc->vtnet_tx_nsegs - 1; + ifp->if_hw_tsomaxsegsize = PAGE_SIZE; + } } if (virtio_with_feature(dev, VIRTIO_NET_F_GUEST_CSUM)) {