From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f43.google.com (mail-wm1-f43.google.com [209.85.128.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0CD5B4446FB for ; Fri, 24 Jul 2026 16:13:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.43 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784909588; cv=none; b=Ego9uXFlPrxrSf2ExVFWZsT5V6fBkj1qrpeKJzvlaJguk7/lwyRxR+3e6O4GoHaGWdp9jo5Pp6jqt+xTl4dN0S2s+Q9edU9cgDiw9UgPORw7GsUuj0NhShX+kMvM93HjXimiooMrhey0PKPZXRVu6mhGhOMDNRM0G1OKbQo4Yh4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784909588; c=relaxed/simple; bh=LKbFUDhj3VWhwQaESnH2NVyncH+CR8IBlzH7bYjPfDQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=M5ENrejCXAhGy1ZnDoDCQKsVMNaLU5NWsgNRNIi2XRONEBYYPG/NCGNWpVTpIhh8r9/4e0lujEpBR3ri4oSRGpqkJw0asDFUOuQ3z0kXYQuUq3m4ukRahQIf9jD8WULL+o/szLiE/3O1uCxN7uPJcfmDhYPivKtZ4JYqmfS9QCc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=sgx2Y+bE; arc=none smtp.client-ip=209.85.128.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="sgx2Y+bE" Received: by mail-wm1-f43.google.com with SMTP id 5b1f17b1804b1-495773ee3edso630295e9.3 for ; Fri, 24 Jul 2026 09:12:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1784909577; x=1785514377; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=g5QCk+t6gnqXj6DEKChexCyjlhSd215AVJ6Z8sL7eXs=; b=sgx2Y+bETIngYbB+KU9LklzffUhbsct07z/XF3f/xANDZQCdTxDRC9BOFhIDdjqIHK OPj0SfWwW8jgQYIN9aS43y+OZMwmV/HjibOICRkzOxFXvV80ot46bdyLLy5/79L2DeeS Edxn4G2zKcTp88DNABmGweRJNo6CSGwP2n2curwbP9tjaiqj0+L+slzJn7l/S1RAHtzJ Jp1ZHhGMCiqr8R+mP08g0ymDyzN8b2YTiS8fWdbdrgbE/U7C8dm7u74SoKayJ0kFP3bo GWhMi/GM23JG1cAEjgtc+KK4Oz00ntFfFZHl2EDDNDEDfsstaidgz/KUPXOaZPQEQPK1 6XDQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784909577; x=1785514377; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=g5QCk+t6gnqXj6DEKChexCyjlhSd215AVJ6Z8sL7eXs=; b=ky/fgxDDJTQgQgU++XRMRzJObth3mHf0Q5YmNF+X3VkI/hUbp/rGtywqlUilFs6uyt HdbsLSf14qsild8GTwKf1TzU9L0IhQLZDNzyFZoOott0D8RKN1VtyeMf1qqtjaHAEB31 feNOM+hTzKBXfgpDI86OPRoIlEDR67thy+NKWQz3ahY6MTC/3VqMO6ZM/WjMngre0Miw eWQdW4mMArmo47iDRl2ncwmOPkSoAmay9lYiQjl3/l5R06HX0D0WgpxcL/0LOq+LBpk3 f+ZGMZVR32j9DKQiVJi1/NHtfIqAzVBmP/Nn/9mzLoTKdd9482TcZ4GT3/sbL8uYBIn9 C1PQ== X-Forwarded-Encrypted: i=1; AHgh+Ro/TN7J93K91Kqo644e1AB5CiXv/kyEZwCf7+pjWkImBNJJOuHlr4Quawv24pY0YNwFOS/bzpU3mFAaCAZOIPY=@vger.kernel.org X-Gm-Message-State: AOJu0YwXQi0BTm8Wi6UuG3UVqcyq7TlNeN/frb+Wr/mh8ShtZ0aqjcYf gb0MnjMPPIZaVpKL71jlSFq+h14yxoFjInVx+a+OAfzQhZwylGxT5TM+ X-Gm-Gg: AR+sD11/4hs9r/eB2ZbNb8qf/S/8KM7kxZF/uhJD6gnxDSsq47c+rtBZTqB6MR8EuVR 79y9HXXNN2vF9FyMoRvzR9IgrhxyKoo634u/TGlb9xFHhTZZCQwisaxq6QYlR7vYiMIU4K64VQj E+ymlQIEi2TqBLw4DZD3N+54+xzLu3keIXHr0Efmg7xXQhIYpvzLBnFnkGWNbyqGrUvL/fHz0Tr cYv/cawMw7VW7xBfhpzPC5U2v1cQZgKV0Q+O5xugF66th40TW6O4824FJQna2hmELeCXgKHgz4S 3xsgDA6OfngdtwlHv98cIC8yQh8tE3dOnuMT+3sKCpi4K3c6qeQhOpQyyBhOqln2p/iqqzrGSgb +RZkMkV43jwZ4DvT5zOXubE5hkb0MlBBPpSO3MyXWLH7W6PH79CjOfLT2GlsfymRwQzGrAmz9ya N83+Zh9vSv7XOAGbxqm4wDcW9nVv9KedB9DGRUPmRrnTGaP87Lvd+bYnBw8B7WajhjAAHS1W/zf Rz71FBtzLGmHDp9Fb3CChN/bV03uN9DW0Y1ybk= X-Received: by 2002:a05:600c:190b:b0:495:4840:c6b with SMTP id 5b1f17b1804b1-4957a7e9131mr33384715e9.1.1784909576912; Fri, 24 Jul 2026 09:12:56 -0700 (PDT) Received: from L-022584.energy.envision.com (dynamic-077-181-161-038.77.181.pool.telefonica.de. [77.181.161.38]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4957f9928fdsm40969655e9.1.2026.07.24.09.12.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jul 2026 09:12:56 -0700 (PDT) From: Xin Xie To: netdev@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Cc: davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, horms@kernel.org, andrew+netdev@lunn.ch, shuah@kernel.org, kees@kernel.org, petr.wozniak@gmail.com, qingfang.deng@linux.dev, fmaurer@redhat.com, luka.gejak@linux.dev, bigeasy@linutronix.de, xiaoliang.yang_1@nxp.com, skhawaja@google.com, Xin Xie , stable@vger.kernel.org Subject: [PATCH net v2 1/4] net: hsr: fix packet drops caused by GRO superpackets Date: Fri, 24 Jul 2026 18:12:50 +0200 Message-ID: <20260724161253.79-2-xiexinet@gmail.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260724161253.79-1-xiexinet@gmail.com> References: <20260724161253.79-1-xiexinet@gmail.com> Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit HSR/PRP append a 6-byte tag/RCT to every forwarded frame and process each frame individually (sequence numbering, duplicate discard). When a lower device aggregates received frames into a GRO super-packet -- in software, or in hardware on GRO_HW-capable NICs -- the HSR receive/forward path mishandles it: frames are dropped and, on memory-constrained devices, processing super-skbs in softirq context can also pressure atomic memory allocation. The HSR/PRP stack already disables LRO on enslaved devices for the same reason. Extend that treatment to GRO: add netif_disable_gro() and dev_disable_gro() mirroring netif_disable_lro()/dev_disable_lro(), and call dev_disable_gro() from hsr_portdev_setup() so enslavement to an HSR/PRP master automatically strips NETIF_F_GRO and NETIF_F_GRO_HW on the lower device (recursively on its own lowers, as with LRO). Fixes: f421436a591d ("net/hsr: Add support for the High-availability Seamless Redundancy protocol (HSRv0)") Cc: stable@vger.kernel.org Signed-off-by: Xin Xie --- include/linux/netdevice.h | 2 ++ net/core/dev.c | 18 ++++++++++++++++++ net/core/dev_api.c | 16 ++++++++++++++++ net/hsr/hsr_slave.c | 1 + 4 files changed, 37 insertions(+) diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 9981d637f8b..eba2c26a49b 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h @@ -3434,6 +3434,8 @@ void dev_close(struct net_device *dev); void netif_close_many(struct list_head *head, bool unlink); void netif_disable_lro(struct net_device *dev); void dev_disable_lro(struct net_device *dev); +void netif_disable_gro(struct net_device *dev); +void dev_disable_gro(struct net_device *dev); int dev_loopback_xmit(struct net *net, struct sock *sk, struct sk_buff *newskb); u16 dev_pick_tx_zero(struct net_device *dev, struct sk_buff *skb, struct net_device *sb_dev); diff --git a/net/core/dev.c b/net/core/dev.c index 5933c5dab09..a6cf2adc862 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -1840,6 +1840,24 @@ void netif_disable_lro(struct net_device *dev) } } +void netif_disable_gro(struct net_device *dev) +{ + struct net_device *lower_dev; + struct list_head *iter; + + dev->wanted_features &= ~(NETIF_F_GRO | NETIF_F_GRO_HW); + netdev_update_features(dev); + + if (unlikely(dev->features & (NETIF_F_GRO | NETIF_F_GRO_HW))) + netdev_WARN(dev, "failed to disable GRO!\n"); + + netdev_for_each_lower_dev(dev, lower_dev, iter) { + netdev_lock_ops(lower_dev); + netif_disable_gro(lower_dev); + netdev_unlock_ops(lower_dev); + } +} + /** * dev_disable_gro_hw - disable HW Generic Receive Offload on a device * @dev: device diff --git a/net/core/dev_api.c b/net/core/dev_api.c index 437947dd08e..02fb2162951 100644 --- a/net/core/dev_api.c +++ b/net/core/dev_api.c @@ -269,6 +269,22 @@ void dev_disable_lro(struct net_device *dev) } EXPORT_SYMBOL(dev_disable_lro); +/** + * dev_disable_gro() - disable Generic Receive Offload on a device + * @dev: device + * + * Disable Generic Receive Offload (GRO) on a net device. Must be + * called under RTNL. This is needed if received packets may be + * forwarded to another interface. + */ +void dev_disable_gro(struct net_device *dev) +{ + netdev_lock_ops(dev); + netif_disable_gro(dev); + netdev_unlock_ops(dev); +} +EXPORT_SYMBOL(dev_disable_gro); + /** * dev_set_promiscuity() - update promiscuity count on a device * @dev: device diff --git a/net/hsr/hsr_slave.c b/net/hsr/hsr_slave.c index d9af9e65f72..cefbbfbd5ef 100644 --- a/net/hsr/hsr_slave.c +++ b/net/hsr/hsr_slave.c @@ -170,6 +170,7 @@ static int hsr_portdev_setup(struct hsr_priv *hsr, struct net_device *dev, if (res) goto fail_rx_handler; dev_disable_lro(dev); + dev_disable_gro(dev); return 0; -- 2.43.0