From: bluhm Date: Tue, 18 Jul 2023 16:01:20 +0000 (+0000) Subject: Enable LRO for TCP per default in the network drivers. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=3e1926f859efd008e94373bdb5bd5e8d9fb98874;p=openbsd Enable LRO for TCP per default in the network drivers. Large Receive Offload allows to receive aggregated packets larger than the MTU. Receiving TCP streams becomes much faster. As the network hardware is not aware whether a packet is received locally or to be forwarded, everything is aggregated. In case of forwarding it is split on output to packets not larger than the original packets. So path MTU discovery should still work. If the outgoing interface supports TSO, the packet is chopped in hardware by TCP Segmentation Offload. Currently only ix(4) and lo(4) devices support LRO, and ix(4) is limited to IPv4 and hardware newer than the old 82598 model. If the interface is added to a tpmr(4), bridge(4) or veb(4), LRO is automatically disabled. All ix(4) devices support outgoing TSO for IPv4 and IPv6. Enabling LRO on lo(4) automatically enables TSO and TCP packets larger than the MTU pass the loopback interface. LRO can be turned off per interface with ifconfig -tcplro. OK jan@ --- diff --git a/sbin/ifconfig/ifconfig.8 b/sbin/ifconfig/ifconfig.8 index 944823793fd..52192356ddd 100644 --- a/sbin/ifconfig/ifconfig.8 +++ b/sbin/ifconfig/ifconfig.8 @@ -1,4 +1,4 @@ -.\" $OpenBSD: ifconfig.8,v 1.397 2023/06/07 18:42:40 bluhm Exp $ +.\" $OpenBSD: ifconfig.8,v 1.398 2023/07/18 16:01:20 bluhm Exp $ .\" $NetBSD: ifconfig.8,v 1.11 1996/01/04 21:27:29 pk Exp $ .\" $FreeBSD: ifconfig.8,v 1.16 1998/02/01 07:03:29 steve Exp $ .\" @@ -31,7 +31,7 @@ .\" .\" @(#)ifconfig.8 8.4 (Berkeley) 6/1/94 .\" -.Dd $Mdocdate: June 7 2023 $ +.Dd $Mdocdate: July 18 2023 $ .Dt IFCONFIG 8 .Os .Sh NAME @@ -519,7 +519,6 @@ or Changing this option will re-initialize the network interface. .It Cm -tcplro Disable LRO. -LRO is disabled by default. .It Cm up Mark an interface .Dq up . diff --git a/sys/dev/pci/if_ix.c b/sys/dev/pci/if_ix.c index 92b384bb7e0..3610ed92a26 100644 --- a/sys/dev/pci/if_ix.c +++ b/sys/dev/pci/if_ix.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ix.c,v 1.199 2023/07/10 19:36:54 jan Exp $ */ +/* $OpenBSD: if_ix.c,v 1.200 2023/07/18 16:01:20 bluhm Exp $ */ /****************************************************************************** @@ -1931,8 +1931,10 @@ ixgbe_setup_interface(struct ix_softc *sc) ifp->if_capabilities |= IFCAP_CSUM_IPv4; ifp->if_capabilities |= IFCAP_TSOv4 | IFCAP_TSOv6; - if (sc->hw.mac.type != ixgbe_mac_82598EB) + if (sc->hw.mac.type != ixgbe_mac_82598EB) { + ifp->if_xflags |= IFXF_LRO; ifp->if_capabilities |= IFCAP_LRO; + } /* * Specify the media types supported by this sc and register diff --git a/sys/net/if_loop.c b/sys/net/if_loop.c index 112fda79f21..7610ac61c33 100644 --- a/sys/net/if_loop.c +++ b/sys/net/if_loop.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_loop.c,v 1.95 2023/07/02 19:59:15 bluhm Exp $ */ +/* $OpenBSD: if_loop.c,v 1.96 2023/07/18 16:01:20 bluhm Exp $ */ /* $NetBSD: if_loop.c,v 1.15 1996/05/07 02:40:33 thorpej Exp $ */ /* @@ -172,11 +172,11 @@ loop_clone_create(struct if_clone *ifc, int unit) ifp->if_softc = NULL; ifp->if_mtu = LOMTU; ifp->if_flags = IFF_LOOPBACK | IFF_MULTICAST; - ifp->if_xflags = IFXF_CLONED; + ifp->if_xflags = IFXF_CLONED | IFXF_LRO; ifp->if_capabilities = IFCAP_CSUM_IPv4 | IFCAP_CSUM_TCPv4 | IFCAP_CSUM_UDPv4 | IFCAP_CSUM_TCPv6 | IFCAP_CSUM_UDPv6 | - IFCAP_LRO; + IFCAP_LRO | IFCAP_TSOv4 | IFCAP_TSOv6; ifp->if_rtrequest = lortrequest; ifp->if_ioctl = loioctl; ifp->if_input = loinput;