From bb2d16182b7723679b4bbff1aae1952b87d967ee Mon Sep 17 00:00:00 2001 From: jan Date: Fri, 27 Oct 2023 20:56:47 +0000 Subject: [PATCH] Forward TCP LRO disabling to parent devices. Also disable TCP LRO on bridged vlan(4) and default for bpe(4), nvgre(4) and vxlan(4). ok bluhm@ --- sys/net/if.c | 13 ++++++++++++- sys/net/if_bpe.c | 4 +++- sys/net/if_gre.c | 4 +++- sys/net/if_vlan.c | 5 ++++- sys/net/if_vxlan.c | 4 +++- 5 files changed, 25 insertions(+), 5 deletions(-) diff --git a/sys/net/if.c b/sys/net/if.c index 94ebb42744a..351a600e8ba 100644 --- a/sys/net/if.c +++ b/sys/net/if.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if.c,v 1.708 2023/09/16 09:33:27 mpi Exp $ */ +/* $OpenBSD: if.c,v 1.709 2023/10/27 20:56:47 jan Exp $ */ /* $NetBSD: if.c,v 1.35 1996/05/07 05:26:04 thorpej Exp $ */ /* @@ -3243,6 +3243,17 @@ ifsetlro(struct ifnet *ifp, int on) struct ifreq ifrq; int error = 0; int s = splnet(); + struct if_parent parent; + + memset(&parent, 0, sizeof(parent)); + if ((*ifp->if_ioctl)(ifp, SIOCGIFPARENT, (caddr_t)&parent) != -1) { + struct ifnet *ifp0 = if_unit(parent.ifp_parent); + + if (ifp0 != NULL) { + ifsetlro(ifp0, on); + if_put(ifp0); + } + } if (!ISSET(ifp->if_capabilities, IFCAP_LRO)) { error = ENOTSUP; diff --git a/sys/net/if_bpe.c b/sys/net/if_bpe.c index def3c124b67..ec3c758f7f4 100644 --- a/sys/net/if_bpe.c +++ b/sys/net/if_bpe.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_bpe.c,v 1.19 2021/11/08 04:54:44 dlg Exp $ */ +/* $OpenBSD: if_bpe.c,v 1.20 2023/10/27 20:56:47 jan Exp $ */ /* * Copyright (c) 2018 David Gwynne * @@ -631,6 +631,8 @@ bpe_set_parent(struct bpe_softc *sc, const struct if_parent *p) goto put; } + ifsetlro(ifp0, 0); + /* commit */ sc->sc_key.k_if = ifp0->if_index; etherbridge_flush(&sc->sc_eb, IFBF_FLUSHALL); diff --git a/sys/net/if_gre.c b/sys/net/if_gre.c index cac48bb8f3d..6204ed40a74 100644 --- a/sys/net/if_gre.c +++ b/sys/net/if_gre.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_gre.c,v 1.174 2023/05/13 13:35:17 bluhm Exp $ */ +/* $OpenBSD: if_gre.c,v 1.175 2023/10/27 20:56:47 jan Exp $ */ /* $NetBSD: if_gre.c,v 1.9 1999/10/25 19:18:11 drochner Exp $ */ /* @@ -3544,6 +3544,8 @@ nvgre_set_parent(struct nvgre_softc *sc, const char *parent) return (EPROTONOSUPPORT); } + ifsetlro(ifp0, 0); + /* commit */ sc->sc_ifp0 = ifp0->if_index; if_put(ifp0); diff --git a/sys/net/if_vlan.c b/sys/net/if_vlan.c index d660232deb4..efcdac41f33 100644 --- a/sys/net/if_vlan.c +++ b/sys/net/if_vlan.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_vlan.c,v 1.215 2023/05/16 14:32:54 jan Exp $ */ +/* $OpenBSD: if_vlan.c,v 1.216 2023/10/27 20:56:47 jan Exp $ */ /* * Copyright 1998 Massachusetts Institute of Technology @@ -937,6 +937,9 @@ vlan_set_parent(struct vlan_softc *sc, const char *parent) if (error != 0) goto put; + if (ether_brport_isset(ifp)) + ifsetlro(ifp0, 0); + /* commit */ sc->sc_ifidx0 = ifp0->if_index; if (!ISSET(sc->sc_flags, IFVF_LLADDR)) diff --git a/sys/net/if_vxlan.c b/sys/net/if_vxlan.c index 37311eb90b2..156d1cba553 100644 --- a/sys/net/if_vxlan.c +++ b/sys/net/if_vxlan.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_vxlan.c,v 1.93 2023/08/03 09:49:08 mvs Exp $ */ +/* $OpenBSD: if_vxlan.c,v 1.94 2023/10/27 20:56:48 jan Exp $ */ /* * Copyright (c) 2021 David Gwynne @@ -1582,6 +1582,8 @@ vxlan_set_parent(struct vxlan_softc *sc, const struct if_parent *p) goto put; } + ifsetlro(ifp0, 0); + /* commit */ sc->sc_if_index0 = ifp0->if_index; etherbridge_flush(&sc->sc_eb, IFBF_FLUSHALL); -- 2.20.1