🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #26046

[PATCH net v6 5/5] net: qualcomm: rmnet: Resize endpoints with dev_set_mtu() and restore on failure

#26046
From: Subash Abhinov Kasiviswanathan
Date: Thu, 03 Dec 2026 00:01
91 lines
15078 bytes
When a data format change requires a smaller MTU, existing endpoints
are shrunk by writing dev->mtu directly. No MTU notifiers run and
userspace gets no link notification.

Resize the endpoints with dev_set_mtu() so that the normal notifiers
and link notifications are delivered. Notifiers may veto the change, in
which case the request now fails. If resizing an endpoint fails,
restore the endpoints which were already resized, ignoring any errors
from the restore, so that a failed request does not leave their MTUs
shrunk. Restoring the MTU does not recreate state which a notifier may
have torn down while the endpoint was shrunk, such as IPv6 addresses.
The data format is not yet published while the endpoints are resized,
so the restore is validated against the format the endpoints were sized
for. The error from the failing dev_set_mtu() call is returned to the
caller.

Fixes: b7f5eb6ba21b ("net: qualcomm: rmnet: Update rmnet device MTU based on real device")
Co-developed-by: Sean Tranchetti <sean.tranchetti@oss.qualcomm.com>
Signed-off-by: Sean Tranchetti <sean.tranchetti@oss.qualcomm.com>
Signed-off-by: Subash Abhinov Kasiviswanathan <subash.a.kasiviswanathan@oss.qualcomm.com>
---
v6: Update the coding style in rmnet_vnd_update_dev_mtu() to align
better with Networking code as mentioned by Simon Horman.
v5: https://lore.kernel.org/all/20261117060737.2764327-6-subash.a.kasiviswanathan@oss.qualcomm.com/

 .../ethernet/qualcomm/rmnet/rmnet_config.h    |  1 +
 .../net/ethernet/qualcomm/rmnet/rmnet_vnd.c   | 26 ++++++++++++++++---
 2 files changed, 23 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/qualcomm/rmnet/rmnet_config.h b/drivers/net/ethernet/qualcomm/rmnet/rmnet_config.h
index 5adda0323dda..47b8db3206b9 100644
--- a/drivers/net/ethernet/qualcomm/rmnet/rmnet_config.h
+++ b/drivers/net/ethernet/qualcomm/rmnet/rmnet_config.h
@@ -19,6 +19,7 @@ struct rmnet_endpoint {
 	struct net_device *egress_dev;
 	struct hlist_node hlnode;
 	struct rcu_head rcu;
+	int saved_mtu;
 };
 
 struct rmnet_egress_agg_params {
diff --git a/drivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.c b/drivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.c
index defad78ff598..ea08c71e0e35 100644
--- a/drivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.c
+++ b/drivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.c
@@ -433,6 +433,7 @@ int rmnet_vnd_validate_real_dev_mtu(struct net_device *real_dev)
 int rmnet_vnd_update_dev_mtu(struct rmnet_port *port,
 			     struct net_device *real_dev, u32 data_format)
 {
+	struct rmnet_endpoint *fail_ep;
 	struct hlist_node *tmp_ep;
 	struct rmnet_endpoint *ep;
 	unsigned long bkt_ep;
@@ -444,13 +445,30 @@ int rmnet_vnd_update_dev_mtu(struct rmnet_port *port,
 		return new_mtu;
 
 	hash_for_each_safe(port->muxed_ep, bkt_ep, tmp_ep, ep, hlnode) {
-		if (ep->egress_dev->mtu <= new_mtu)
+		ep->saved_mtu = ep->egress_dev->mtu;
+		if (ep->saved_mtu <= new_mtu)
 			continue;
 
-		err = rmnet_vnd_change_mtu(ep->egress_dev, new_mtu);
-		if (err)
-			return err;
+		err = dev_set_mtu(ep->egress_dev, new_mtu);
+		if (err) {
+			fail_ep = ep;
+			goto restore_mtu;
+		}
 	}
 
 	return 0;
+
+restore_mtu:
+	/* Restore the endpoints which were already resized. Failures here
+	 * are ignored since the original error is the one to report.
+	 */
+	hash_for_each_safe(port->muxed_ep, bkt_ep, tmp_ep, ep, hlnode) {
+		if (ep == fail_ep)
+			break;
+
+		if (ep->egress_dev->mtu != ep->saved_mtu)
+			dev_set_mtu(ep->egress_dev, ep->saved_mtu);
+	}
+
+	return err;
 }
-- 
2.34.1
Technical Details
Message-ID: <20261203000152.2083717-6-subash.a.kasiviswanathan@oss.qualcomm.com>
Path: mbox-mo1.pugleaf.net!news-can.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-376146-linux-kernel-netdev=dewy.ru
References: <20261203000152.2083717-1-subash.a.kasiviswanathan@oss.qualcomm.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-can.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-376146-linux-kernel-netdev=dewy.ru
From: subash.a.kasiviswanathan@oss.qualcomm.com (Subash Abhinov Kasiviswanathan)
Newsgroups: linux.kernel.netdev
Subject: [PATCH net v6 5/5] net: qualcomm: rmnet: Resize endpoints with dev_set_mtu() and restore on failure
Date: Wed,  2 Dec 2026 16:01:52 -0800
Organization: Usenet Network
Message-ID: <20261203000152.2083717-6-subash.a.kasiviswanathan@oss.qualcomm.com>
References: <20261203000152.2083717-1-subash.a.kasiviswanathan@oss.qualcomm.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="2093083"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:DGPCrmJSZRzA9xEzak4V0jPmIEI= sha256:1OXov1G20yNr9ykmB/tU87mFXgCmprRvNQBxwWWhMV0=
	sha1:3MIVz9meH7AGwB4+RC0hCmVx8SY= sha256:Jjz1glcIVIgRKfK78yoyAKJswz620+V4tHd5BmY3Dd0=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id 4AFB31177AC; Thu,  3 Dec 2026 03:03:30 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -2.951
X-Spam-Status: No, score=-2.951 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
	HEADER_FROM_DIFFERENT_DOMAINS=0.249, MAILING_LIST_MULTI=-1,
	RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001]
	autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=qualcomm.com
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id oXYjV6hIH2cT;
	Thu,  3 Dec 2026 03:03:27 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-376146-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=oss.qualcomm.com
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id F18241177AA; Thu,  3 Dec 2026 03:03:17 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sea.lore.kernel.org (Postfix) with ESMTP id 643B02DC4E; Thu,  3 Dec 2026 00:02:47 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1796256161;
	b=0NgiB+wEVRtZBPnHbzeCZLYm6amebcM5BD2uT7Sx9MFufshIPwtEdLv2tP1MhDvVCLN9
	 Q9XqBvI+mLlljybBvbLtIsgTN4reO/YGIt5rPfYIOmSzCGz1dhJbzH2oGbyIveL/WDOEw
	 t91gIQeJVGKkEgVQpQQphBEPotQvfjuzKreDaR+TIIwJfEH5OvoCOv0sk4QdrrpzRXvVA
	 oybpT5D+0biTs3eLVWIeMzDqbcf56ynFt10YyRYiyn/8CoLuiNP4Lj3lGqotDJ+4TAIb+
	 +lZ8mAtRA2Ef8jS9aF5ZcijxWyxlUvomyuHjbVce0UscAYDolW8mazPZ1QXjNMiRUtg==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796256161;
	h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature:Received:
	 Received:Received:Received:From:To:Cc:Subject:Date:Message-Id:
	 X-Mailer:In-Reply-To:References:X-Mailing-List:List-Id:List-Post:
	 List-Help:List-Subscribe:List-Unsubscribe:List-Owner:Precedence:
	 MIME-Version:Content-Transfer-Encoding:X-Proofpoint-Reinject:
	 X-QCInternal:X-QCInternal:X-Authority-Analysis:X-Proofpoint-GUID:
	 X-Proofpoint-ORIG-GUID:X-Proofpoint-Spam-Info:
	 X-Proofpoint-Spam-Details-Enc:X-Proofpoint-Virus-Version:
	 X-Proofpoint-Spam-Details;
	bh=kJyns9+d5jA6aiU2S2vvS7t241iRuaUS5pGWdLrEzik=;
	b=TWB7Twlv8HNXwzTH1dcWZrfr4BEs15Pqy81LsjMFJ2XTVQoUY011y056DEZkpJP8YSQo
	 cilxjwa/dXuyWw9JwtWXuJ/OJECCMcONZMLoJ9ph+sahvyMfYdiTn4G0PvhZxNRu8UBe5
	 qsjT+ufIuXNImcsPUufuS2ZbIAel5MIn20QEYrP9Xz+akuUH5JSffF5kESu18FgDaPikO
	 CCTwhVmwlNOjA45KCb20thw4lrtapza1c7oFveIyMdr256Wiuv+TsTagE4S/L7b96zTfg
	 kyGlWtYzocqQqJOs994HFCrcTJ4DBIP8kFLlKYDKz+KAnuIohjAlSMXqucvaDWEVkpw==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=qualcomm.com header.i=@qualcomm.com header.a=rsa-sha256 header.s=qcppdkim1 header.b=AhsDUYTb;
	dmarc=pass header.from=oss.qualcomm.com;
	spf=pass smtp.mailfrom=qualcomm.com;
	arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id 08EBE60A2607;
	Thu,  3 Dec 2026 00:02:41 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.a=rsa-sha256 header.s=qcppdkim1 header.b=AhsDUYTb
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=205.220.168.131
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1796256155;
	b=zHC8ob98+eb3tKwhrc/N7eAd0vI8RPvylhgF3KsrfBU+Rph8nuvPqlj0Ld4ixrYGwAR/
	 SeDYQqhchRAQJfdRpTerjHNou7zol8W8n1TkfuQJtZyxM3ADpp9+9E9G+G9t1KhJp+JDg
	 voU2w1JKhSGBa76jg1DWCSE+HdEbePeeChb/a5V3vt/Gbv3oNiGTHOw5qFmgX61rahF89
	 ig5ch3MRZovUwUNvDows6LThwXNdLWMudgXZwKkARZe5HpKDurrMsJSzuaIGD6zY9RZnL
	 M8OsNlgfkLuKpp82j6efR3HlQDRtugZ9RFnrc6yG3INWz3XaGN5o6elyPsZD4zv9qlQ==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796256155;
	h=DMARC-Filter:Received:DKIM-Signature:Received:Received:Received:
	 Received:From:To:Cc:Subject:Date:Message-Id:X-Mailer:In-Reply-To:
	 References:MIME-Version:Content-Transfer-Encoding:
	 X-Proofpoint-Reinject:X-QCInternal:X-QCInternal:X-Authority-Analysis:
	 X-Proofpoint-GUID:X-Proofpoint-ORIG-GUID:X-Proofpoint-Spam-Info:
	 X-Proofpoint-Spam-Details-Enc:X-Proofpoint-Virus-Version:
	 X-Proofpoint-Spam-Details;
	bh=kJyns9+d5jA6aiU2S2vvS7t241iRuaUS5pGWdLrEzik=;
	b=wSy9zmLruK1R6eBABtu3OOG4qoCrULdvK7fcNg+PRs3tnvW1s/zfiqE7sqUqRb1o22n5
	 Ef+ns+0ermjJBt2iSNtgOMV8I3IS9Zekjg5VLJLfkWcnjNpR4cHKywT8ek+e8qKi51H+F
	 OAF96XJ6/731RqrGQelNKIZjWu+Ts+b2qzhNgwLEfqQlOlGfLKAhjjxMNGnM3chu7BVwp
	 ZU3/pD295FIZ+7OZQau8anrvaVPysqK6We0XIsq1fS+dlR1U2Ss0MbFAS1FsH3QBIE+oI
	 bitmbyeX8eIXT9/Gjo9BrUSiA+dZJeV6saCc+Kc4UiOZEy104uNkD7FMhRwM6WKQqZw==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dmarc=pass header.from=oss.qualcomm.com;
	spf=pass smtp.mailfrom=qualcomm.com;
	dkim=pass header.d=qualcomm.com header.i=@qualcomm.com header.a=rsa-sha256 header.s=qcppdkim1 header.b=AhsDUYTb;
	arc=none smtp.remote-ip=205.220.168.131
X-Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256)
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3C87C606A336;
	Thu,  3 Dec 2026 00:02:33 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 3C87C606A336
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oss.qualcomm.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=qualcomm.com
X-Received: from pps.filterd (m0279866.ppops.net [127.0.0.1])
	by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 6B2LGbTY944251;
	Thu, 3 Dec 2026 00:02:25 GMT
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h=
	cc:content-transfer-encoding:date:from:in-reply-to:message-id
	:mime-version:references:subject:to; s=qcppdkim1; bh=kJyns9+d5jA
	6aiU2S2vvS7t241iRuaUS5pGWdLrEzik=; b=AhsDUYTb9viIRT3eWc4ZkwFJ155
	VHNsX07V6smhKqht/89WxzNyDZypIKeTTnRuaEoZjBnu8rlDaWhppvIW9lWUn6tu
	36+CxCrcC6lvut1Wr0Nf+McOkf0bLt8/RkoClM3aEJXAX/tAVNDut1RpQhl+Y5np
	f22kXwvi1zIlMMwb7zuLad459El/LpN3Z/gHrZxS7a0+6IwKUYkMcyyFEw+U8M1H
	/Pn31+uQI8KPMrZQawFeXsS6scw0lyuWf8gjGjB6QrcSceuVI6slPbwwPwjVqu2E
	bicJBToC3+t0FLQBH97/+i+iF5SqZipA/64hvQJfDHWfJFtTs2qdmr6UHrA==
X-Received: from nalasppmta03.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20])
	by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4jahbx367s-1
	(version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT);
	Thu, 03 Dec 2026 00:02:25 +0000 (GMT)
X-Received: from pps.filterd (nalasppmta03.qualcomm.com [127.0.0.1])
	by NALASPPMTA03.qualcomm.com (8.18.1.11/8.18.1.11) with ESMTP id 6B302P0L4171250;
	Thu, 3 Dec 2026 00:02:25 GMT
X-Received: from hu-devc-lv-u22-c.qualcomm.com (hu-subashab-lv.qualcomm.com [10.81.24.15])
	by NALASPPMTA03.qualcomm.com (PPS) with ESMTPS id 6B302OJA4171229
	(version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT);
	Thu, 03 Dec 2026 00:02:24 +0000 (GMT)
X-Received: by hu-devc-lv-u22-c.qualcomm.com (Postfix, from userid 212624)
	id 82C0AAD9; Wed,  2 Dec 2026 16:02:24 -0800 (PST)
X-Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, horms@kernel.org,
        Subash Abhinov Kasiviswanathan <subash.a.kasiviswanathan@oss.qualcomm.com>
X-Mailer: git-send-email 2.34.1
X-In-Reply-To: <20261203000152.2083717-1-subash.a.kasiviswanathan@oss.qualcomm.com>
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list
X-Proofpoint-Reinject: loops=2 maxloops=12
X-QCInternal: smtphost
X-QCInternal: smtphost
X-Authority-Analysis: v=2.4 cv=K5+3jCWI c=1 sm=1 tr=0 ts=6b10b191 cx=c_pps
 a=ouPCqIW2jiPt+lZRy3xVPw==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17
 a=pUM-KoujPXoA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22
 a=YMgV9FUhrdKAYTUUvYB2:22 a=VwQbUJbxAAAA:8 a=EUspDBNiAAAA:8
 a=0lpeYnUDUzbK5HhQ34UA:9
X-Proofpoint-GUID: gK-ze9Mivj2otz9M-0q7O_K_b0NIndc_
X-Proofpoint-ORIG-GUID: gK-ze9Mivj2otz9M-0q7O_K_b0NIndc_
X-Proofpoint-Spam-Info: AW1haW4tMjYxMjAyMDA5NSBTYWx0ZWRfXy3y5lCapReL9
 im/RKBjCPDuGB3XOnqcIAY4C7L3hRVui9FKEvizJqSFovAO8Vhk3qfEozM7/XuQhZNF6ROi+vJP
 rMqh0yogjZFGzjEzALwA//JFaweaJXI=
X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMjAyMDA5NSBTYWx0ZWRfX9rT758OznKsA
 zWcPUj+CuflkMtgv9PxQqKc6W0z/H7Yy1/67xcd4aWwcNSDOuEU0lfo8L2g87upsiStnRYWMael
 vTK9oiLWrFWAi6XBFxj2DX8G56u+rrW9XysTsWSXXgDsndEpEbSDSqGpYje8qm9Dnshf6vHdTqL
 SYllCGo7EKg17nDjpl/2e4k6ZlVW98oMQ8Fx0fufgswVgfGY1N73nW3/iXevtXr45c7dfM14ZNP
 NIEWDWfRKl3fDFG3BV6DLrqvMDpor8lseatu/dPOITM9sXtX7/QDaL08u8PXSkXgV+G4WOLvrLP
 COWFivzMg0gT0ZqEpM74gJ310sRvpOkLibGYajTTH8OSM/yTRCHl1hL4DzBP3xCx2o7722Z/u06
 kGYX0kXl2XEqvwVpZkmKRise7giCG8XVapcfw0zXRyoSH0smPSwBa1OzfIg3JhZ22Bc9CVlpNVp
 hbmhuQq55HzlGxSVzeA==
X-Proofpoint-Virus-Version: vendor=baseguard
 engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.138,FMLib:17.12.100.49
 definitions=2026-12-02_06,2026-12-02_07,2025-10-01_01
X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0
 priorityscore=1501 clxscore=1015 phishscore=0 spamscore=0 impostorscore=0
 malwarescore=0 adultscore=0 bulkscore=0 lowpriorityscore=0 suspectscore=0
 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0
 reason=mlx scancount=1 engine=8.22.0-2611040001 definitions=main-2612020095