From nobody Tue Apr 7 06:19:21 2026 Received: from mail-pf1-f170.google.com (mail-pf1-f170.google.com [209.85.210.170]) (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 E44BD7080E for ; Mon, 16 Mar 2026 04:27:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.170 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773635227; cv=none; b=Y9ubCkpnToELh475UMtD+akivSiUJ8LF7S2z5ZhlLwbKUffpNNGpahDTW6ohuAwZyWCPYB91gGoTCEsmngXttUPC3QTZuiJWl5TqNqHR+yuUltTl4R0zoOrmkDh+WZWG2nlkK5zNK/nwnipQMhYwLp5F0aB8Gt4/bOIPt3mXJ24= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773635227; c=relaxed/simple; bh=qNPeHvHZTZR/YyNb7PrqwI9kz5RD4rqaFT50tFfTL2s=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=jj5V0psaDFbarg/bUFavZy0sNEsQjBCjTAmMJTQk+ALzfQQf+IiW0xfK0fiwTL3jSl7eeJv6qzTg70y/P/hvz2PUxYaw0s277QRsAXMqOsv4UKxj7DwxdXIRIckrcmj11fu3TyJoH8efWNOg6yvMlNCX4axpFChTUTUJfBYHKrY= 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=jZvO6i2V; arc=none smtp.client-ip=209.85.210.170 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="jZvO6i2V" Received: by mail-pf1-f170.google.com with SMTP id d2e1a72fcca58-829a27414a3so2366359b3a.3 for ; Sun, 15 Mar 2026 21:27:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1773635225; x=1774240025; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=S4NrMDbk24kpM0xeU9hz073wyfuICysoD9kSVFILYB4=; b=jZvO6i2VjvTNQLj7jQhlHotf15/TQ6gCpjSrOGaZfGKs0mDVJflUYhHHtV+XLfFgHD oAp/sk7cwtK+1kkllYzQmRwssgsl5kPb78NktIESS6dbfJpHqsntUhkr2l08xmEtVVm6 bKrJjX97qvlEXXuCRG+XExWXA7GkFTVjzj20deGAxVYRmo2mGvROBHBLxmBLi40xkhIS W50bKiSpQ3PAX16AMwZSRXSgyFTqEyiAV1ABPVPzX+BcaW0N5ZnDyt209NayQ3anF2tF WueI+fitOalDoubU1R80QlMOAdrlKSfC+/u++9FO5ORC40T1m6GTGiYvlI1UtNytu03L BTtg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1773635225; x=1774240025; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=S4NrMDbk24kpM0xeU9hz073wyfuICysoD9kSVFILYB4=; b=kdGEy+a8/08UKzHpqtXTD4eDzDysnnOXMSMkeuP+el6caxjUhZrhNJFOoFXbzg/VN6 yRicBB+7kllSSmSC8iSsDAruli1cDotN9eGcMgXJXVeh0OYP2aEIMLzD3hCSF8xzYkPv hOtgqQu5AiBGtiV+wdOAImzI6M/QJ34SrHejEi7WGpVw4cfIqZrFRcaZgzZrJ8faMC7P hT/GSWUQ4O4JYpGCsayaiNqwwU5JyzFcB6uh0avM8wL4huNpgTfC6dbVVvgSoOnT6mX7 x7J0VaH0K4jsXu1ERkTUcERIVu21h0UmbWuZk3nt4FDXDmlei9rdZ+9SfimDrcEANXHe broA== X-Forwarded-Encrypted: i=1; AJvYcCVRZJrcUh8nzHjrfUxTTTTdMXBSdRq8dNfnY+RNcmYVL/LAqN/MH/YHcRq/tbB0Z20LoPxvZQxPiWHYeH0=@vger.kernel.org X-Gm-Message-State: AOJu0YwChjjqtqay7QUK3PX2Vvbml6xE3Lz6IIYug7He77pG3S0ztEPF Z0Gq6WkYlsrsp2JHYyX7BimrZ/2NncJOtMvsMWY3koFoYFBmx5EIdMp7 X-Gm-Gg: ATEYQzxK/VNBA6piJAEiVZPzYS5v5+Lxx0Q3Jxl6zVDhbv0JN20Gs/HsLX3wRVCdU94 HOhUq0VSLbzbP2/le3b5WWqwV0+HKqNc3eItf12LQv0+GaP6s+K+fdY7bECEHI7dFEhWYiZR/Z4 iauM9sZhfAqMoURf65ri9XJLN8v2B0nXswZ/E8Pp9Dp3Qs1ArXVBJ7ihb/e8Uf7ZaG6tsEt/hNw jLbmaTi1+8urImBc9gQmXGJifTHIRgIt59mGadxde4hfeEjD3vHeFRTvJbuCNhh0yzhdIyOYg3w vQvzYEs+MG0WAiPjL4m+HVqWL/Pf01ICtBcVof+vt9FGELXhRdG388aITbwlpMKDXz3jiNOEjTQ aCyxLQY5ccTNyl10lEPIAFNfDZo4vXDxO1LbUTK8Bb1wCgXIjgXf8ZQFhVG7+JNjoYtY83encyo VkwYr+dOIdN+97BNT11X0kPFfB1g5hjgmbFxp4nqAoka7jnF5twg2QnMQkYQ== X-Received: by 2002:a05:6a21:d83:b0:398:98ab:71a9 with SMTP id adf61e73a8af0-398eccd8644mr10815982637.44.1773635225270; Sun, 15 Mar 2026 21:27:05 -0700 (PDT) Received: from 1.0.0.127.in-addr.arpa ([240e:34c:5760:3860:bc29:deed:92d0:823c]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-82a0738422esm12180267b3a.55.2026.03.15.21.26.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 15 Mar 2026 21:27:04 -0700 (PDT) From: Hangbin Liu Date: Mon, 16 Mar 2026 12:26:09 +0800 Subject: [PATCH net-next v3 1/5] net: add ndo_update_offloads for offload computation Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260316-offload_compute-v3-1-a5d4a07d86d3@gmail.com> References: <20260316-offload_compute-v3-0-a5d4a07d86d3@gmail.com> In-Reply-To: <20260316-offload_compute-v3-0-a5d4a07d86d3@gmail.com> To: Jay Vosburgh , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Jiri Pirko , Nikolay Aleksandrov , Ido Schimmel , Simon Horman , Sabrina Dubroca , Sridhar Samudrala Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, bridge@lists.linux.dev, Hangbin Liu X-Mailer: b4 0.14.3 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 enables 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 ae269a2e7f4d..acaec0340266 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 200d44883fc1..bbd532aa6a1b 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -11011,6 +11011,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 Git-155)