aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/virtio
diff options
context:
space:
mode:
authorBryan Venteicher <bryanv@FreeBSD.org>2021-01-19 04:55:25 +0000
committerBryan Venteicher <bryanv@FreeBSD.org>2021-01-19 04:55:25 +0000
commit177761e4c4673612dd64793a31a90142d9a04e62 (patch)
tree5a8f0addcfe86179ffc36424c16e98c4bff6ee79 /sys/dev/virtio
parente36a6b1b1f390be3191d51c11bfcf1afbad55c41 (diff)
if_vtnet: Set the interface max TSO values
Reviewed by: grehan (mentor) Differential Revision: https://reviews.freebsd.org/D27917
Diffstat (limited to 'sys/dev/virtio')
-rw-r--r--sys/dev/virtio/network/if_vtnet.c17
1 files changed, 16 insertions, 1 deletions
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)) {