From nobody Tue Apr 7 17:12:33 2026 Received: from mail-pl1-f177.google.com (mail-pl1-f177.google.com [209.85.214.177]) (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 E1374377540 for ; Thu, 26 Feb 2026 11:43:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.177 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772106201; cv=none; b=GfeXzTOVCZzrvS5dRA9vIfnDt4QbDRcUprI/IhmrMZzT5VjMr8vl6tqcrKZp+NyZusSpPBbfvkht5MKRB9pOj+eNEOoPVks3TFHlyPRvB/0MY9m2svbKH62PlxO2nh3LbLH+KpUY08+3CV3yb2N3BZU5GhbJdrbs3zIsODeXtuQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772106201; c=relaxed/simple; bh=GzjQ1QrmncB3M8ZZh2gze1EuHsDImbS4oU69hNkTzxU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=WejnHCQ/TzoSoJWDis9lBwgJDnfv1VN9qCxiBAkzLGknW7YCLPInjRUAlpqIDBInDPcHoXXeParM2HkUy+uAnzeLWATq3Vo9PnweD+xBdHHcQnwOUkCDGlfwiMGTtk4VbuqY554Uh9pwl620Ez4dGMruGd7vnxrw/fCZl1ffvnI= 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=N7kXG/zL; arc=none smtp.client-ip=209.85.214.177 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="N7kXG/zL" Received: by mail-pl1-f177.google.com with SMTP id d9443c01a7336-2adcede372cso2983125ad.0 for ; Thu, 26 Feb 2026 03:43:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1772106199; x=1772710999; 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; bh=4ciG01gWGaVHVP/mcZG8G3rAKieiLmIPuwLg8daH8Bc=; b=N7kXG/zLaNi1ZAQ7AJAqUJQxOVdwfK0I8LmmvNRfdxaEIybICnPjxHdN5HcT3A02HY oM2iVro0BLsp/WKWiGiwM4iOEHntbmvEGHUFbwmlFY8BEsrB30DEidmWOn3LuYlnJVkw dMMAXEnMRDu3grtp3+HJ8O9Id/ZIiofDu+2e3m4s4MISTCpR749peJb6VZrn+IQ40I5v qkQp5ZIJVmEMyHPmAKGMWmHrcw080Ylfc4t+BIL3Cyt81zaz6cUP3M8gRLQtXUP8AyDs 7tC1XCUOUkd8sSfe+6juDnhdA8f5XEH+uDljxFyWg41bp6xMMQpkxJceoU6rx5XpMKa4 zVIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1772106199; x=1772710999; 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; bh=4ciG01gWGaVHVP/mcZG8G3rAKieiLmIPuwLg8daH8Bc=; b=aGwmpYuW7Yv4oqk/1jMmYy1KKCLGrsM7KBxuUOOTXUYDEkwuBXrHiOrxug10N8BkyC pov0Ysafh7T/p5M7kpXAwGslCDA1rIZDk41RP4Ftq0AGCrNvcn/3YYUgPmhvNdjvv6c6 fnm1/F/FkqsHLcmw/qydbfmN1e97ui2wX9JipGhVOEemS645H3881bIENgILDhBZ6VAf isFnx8I863Fc/mXZLmwh+yx2alh9g4EjPSM2lMHQbUUinoXFtpFP4Dy5AUUFpO5PMTDv h+dPhiHl4glQte8LVmXG8kfpY6dCd2RX8B1oJ5iUim7HX3Ec70Yi/ifUzyHLf+0pG/vM sApA== X-Forwarded-Encrypted: i=1; AJvYcCVgRwIXD2AIAhxr1PphsOmwXFBaA3PzuFViTRACYM35MLiymhPvp302tftxj9hpXZvjRV8uiHlhnfnU/Sc=@vger.kernel.org X-Gm-Message-State: AOJu0Yyb4SyicR/+lzXP99QcKw4pJZ6hIhF7WOe0s24RIGqNMI+bKsPn tryEKknBXcp/gNfin+x06f5obFr8P/AmByMHuUGjioSh31N3WR59+btF X-Gm-Gg: ATEYQzwmYxDU4AJXNmQ1TCnv4Az1JicZpvTyjYruPUQNxhMWPGac9M1uoBLK5tbi7Rs tSO+Xbng+/8fuZDMqGh2pjrRmU1Xy94FGdg7S2qMBdGb2SLff9dCnoIwmBLer3hfzSRIw9GT/zM 8yQXdm1fIte/xLuzRwuBBUW5Cgcz+s9QFzW6H2/KwqMULv5CSE0/k1Yk64QCUhAzQ+cc+wiW1Wv 8715fuadEGoqiQbk1gSucBnKZBv95RE3EGRQOo47VURefPeTTTWkfkhGDFqao6WezQwBXUV1uJI ThowC+xShRpjVVf1UboTzWQ/lL8eQS9DSWDEtZF2ehE207CFVsfr3WwgkHovsYGJ+GK4B3EX+KU 45CGTLLBZh1ql1LGqu55FjLt1/UJSNFaEyGI5yGgcCH0Kxh0fQglvmBIJYT2qY6J9HjMQcZmqUa rRV1aerZlpHKdga8naCn8LnnHglQc= X-Received: by 2002:a17:903:32d2:b0:2aa:f2f3:bcb0 with SMTP id d9443c01a7336-2ae036e631amr24181285ad.47.1772106199007; Thu, 26 Feb 2026 03:43:19 -0800 (PST) Received: from fedora ([209.132.188.88]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2adfb5dbac7sm34131545ad.37.2026.02.26.03.43.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Feb 2026 03:43:18 -0800 (PST) From: Hangbin Liu To: netdev@vger.kernel.org Cc: Jay Vosburgh , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Sridhar Samudrala , Jiri Pirko , Simon Horman , Nikolay Aleksandrov , Ido Schimmel , Stanislav Fomichev , Kuniyuki Iwashima , Samiullah Khawaja , Ahmed Zaki , Alexander Lobakin , linux-kernel@vger.kernel.org, bridge@lists.linux.dev, Hangbin Liu Subject: [RFC PATCH net-next 1/3] net: add ndo_update_offloads Date: Thu, 26 Feb 2026 11:42:06 +0000 Message-ID: <20260226114208.27774-2-liuhangbin@gmail.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20260226114208.27774-1-liuhangbin@gmail.com> References: <20260226114208.27774-1-liuhangbin@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Add a new ndo_update_offloads callback to net_device_ops that allows devices to compute and update their offload features during feature updates. This callback enabling master devices to recompute their features based on current slave device configuration. This is particularly useful for bonding, bridging, team, and failover devices that need to aggregate features from their lower devices. The callback is optional and only implemented by devices that need dynamic offload feature computation. Signed-off-by: Hangbin Liu --- include/linux/netdevice.h | 7 +++++++ net/core/dev.c | 3 +++ 2 files changed, 10 insertions(+) diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index d4e6e00bb90a..1169091ccb9a 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h @@ -1281,6 +1281,12 @@ struct netdev_net_notifier { * constraints, and returns the resulting flags. Must not modify * the device state. * + * void (*ndo_update_offloads)(struct net_device *dev); + * Called during feature update to allow device to compute and update + * offload features (like vlan_features, hw_enc_features) based on + * current lower device configuration. Typically used by master + * devices to aggregate features from slave devices. + * * int (*ndo_set_features)(struct net_device *dev, netdev_features_t featu= res); * Called to update device configuration to new features. Passed * feature set might be less than what was returned by ndo_fix_features()). @@ -1558,6 +1564,7 @@ struct net_device_ops { struct sock *sk); netdev_features_t (*ndo_fix_features)(struct net_device *dev, netdev_features_t features); + void (*ndo_update_offloads)(struct net_device *dev); int (*ndo_set_features)(struct net_device *dev, netdev_features_t features); int (*ndo_neigh_construct)(struct net_device *dev, diff --git a/net/core/dev.c b/net/core/dev.c index 096b3ff13f6b..d05837c0713a 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -10982,6 +10982,9 @@ int __netdev_update_features(struct net_device *dev) ASSERT_RTNL(); netdev_ops_assert_locked(dev); =20 + if (dev->netdev_ops->ndo_update_offloads) + dev->netdev_ops->ndo_update_offloads(dev); + features =3D netdev_get_wanted_features(dev); =20 if (dev->netdev_ops->ndo_fix_features) --=20 2.50.1