From nobody Tue Apr 7 04:33:41 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) From nobody Tue Apr 7 04:33:41 2026 Received: from mail-pf1-f181.google.com (mail-pf1-f181.google.com [209.85.210.181]) (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 4BBC133893D for ; Mon, 16 Mar 2026 04:27:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.181 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773635240; cv=none; b=m9DMUNNoxCsEm8zihQra9trql5Vq/6n+UyHvoZfBgn/B5420PEOy1PFRKF8tgyrvLRU6xA9/qMqhgCZq7KYe8WtNFeOmqbmu1k+IyIEKB2pahryLAuL5KSdMM87wDpTgZ6Wp3j1qaqSZDrXg3Qjwl4TNtzYw7fR8ScpYt7VXw1A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773635240; c=relaxed/simple; bh=uOA8Btfuyt1fRyZXJtbLTVld/QlqU0lmL5OyV/kUGLE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=lDFfZtuetV8uoNg9pbgC9e8cQSvdflSD/uKV+qS6iChbY+oXLIdlOXm2cT9Q1u1C7N+YrLcWPG4L3CUCzzb0CTu8rJQORvdpB40dOjrvH6vDHhMV93H9Zb4g1NHafbI38wAqTVGbi7bR0uTIt4pBngXCm9Afl7AoPKGtsaiMiHM= 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=HIZPvFKr; arc=none smtp.client-ip=209.85.210.181 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="HIZPvFKr" Received: by mail-pf1-f181.google.com with SMTP id d2e1a72fcca58-82735a41920so1478712b3a.2 for ; Sun, 15 Mar 2026 21:27:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1773635238; x=1774240038; 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=XZnXe6ZII/Ekwqx2euSYzckFZIl5gweSRd+FY9OyPQE=; b=HIZPvFKrMiyOBDcpqGDJWdzUUe78cH4cfpR70RZJpuVsqASDtD71qTeRuP5s0vMmKv rrThqggMs7ncy8nFhzeBcGrpyto36HF9q2Wy+w7MpWtEdUzS81LgwDu/CEkUoFpUd0Yc fpDraKN84z9KA3JftfK0eCXmGX14nmZlsZRbpTZM/p6IuEm4kL6UsuB1Io4hF7iZSvvp mCpN+jMBFNefte7y+8nK7hvdnx0kSuAeZ92VpzdS5ucvEuL/IcWLKd/BtRrBnilop8Yh 3650BIQ6JrfXn/TCvVUkd5C32NIGnneFuLci6aDsknrhPmeyvXuHHKdJhtsQ0ARXOe0N RwOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1773635238; x=1774240038; 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=XZnXe6ZII/Ekwqx2euSYzckFZIl5gweSRd+FY9OyPQE=; b=RPWLkBPtZ1Ej84oSyzS91buXHOnW6oLlIU4eNdPHRLI5Qx3OWPV2KyO3iAn79fjwjz VyPku9HvyMEdPG4Y6RL54XCSMJs/p3GnR9mPF5M4wYH75YuHDiCfLu6CHAl/Ri3BNBrw t5ODioTjy4l0brdsQPW4YyFnuCdnHUpQfIRS25C0QvNej4Bu9WMsA8wsAxQeYsVWKJUA hLneFrIL9J+Yj5QgdtPIrpwgjc5qsl/pgz/szJC4wVMSiJ7B8xIJWFutzOosa7sj9a/U uiKTdl7BNRDPrxarUWX93cC0aUIIoZlpLc4oOgKipa49rqoK+LAM85SdLqDGfIyfhSM1 +acA== X-Forwarded-Encrypted: i=1; AJvYcCXSr7Lwyk3RZ5lBT68NVOLwjCA21Y+3GQ80DeDOs6v93UXbZ4oMGR6Pbw7rx8HpwBeZCRRqe/XQOkAj6sY=@vger.kernel.org X-Gm-Message-State: AOJu0YwvJBQ7i6oypxAWgm/aV5uyztQe7ssA3pF55YLuTyFGhaIFhGgQ /5JenlGTmpcUKgJTlhWa5MQxqqeTfkznPdcmElKlxL9f9IKYVFZFdmyB X-Gm-Gg: ATEYQzxnHOeMf/NsPt+O9/xmGdikkZvYo04YNwqXQCVnQCGZNZoOGUQ2F6T+QvCDDBp HZPDBbbI2McDJwJYOJS31jUYVYQJobbAFhkQVWTrZCBxQ3B2zefocNBgUhIA7GENOkOcXUuCXvc uN2m+YkJVcvVA1C93t8gIsmw0Ck5ufiZOOpkgtTkwx2xlv1qm+aYszCO5wQYH7F43m0mXhHgV73 8BCHBjoMcvd/gXWL7LA+ezOnFEZhCeb/E36PhV3/OaL3EVHcUpfUAZLiDE2cScIx06ggYzqc8sm E+TgTpGpOaUnxPGJq1YvLMEzfPZPpnsO2BKK7mbvPn73Td1J7mojPwOwQ9+IP3yxef4tLFoxu45 +RUPWCReqxCDiLTzagCgz15aJnAEN5PnflA1QYY0K9pHBF+Og42ht16+HyKtmwaqYJisEHKkxJm 2snSMs3AKaN8Uomm/KYRwkiTXhY1pshpuZPY1Vj66dYQJvTvY16DX7eSotjg== X-Received: by 2002:a05:6a00:a803:b0:82a:8aa:cbb6 with SMTP id d2e1a72fcca58-82a19925747mr10091291b3a.55.1773635237584; Sun, 15 Mar 2026 21:27:17 -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.27.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 15 Mar 2026 21:27:17 -0700 (PDT) From: Hangbin Liu Date: Mon, 16 Mar 2026 12:26:10 +0800 Subject: [PATCH net-next v3 2/5] net: use ndo_update_offloads to set offload features for bonding/bridge/team 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-2-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 Convert bonding, bridge, and team drivers to use the new ndo_update_offloads callback instead of manually calling netdev_compute_master_upper_features() during port add/remove operations. This change centralizes the feature computation flow: Before: - netdev_master_upper_dev_link() - netdev_compute_master_upper_features() <- called manually - compute offload features - netdev_change_features() - __netdev_update_features() - update other features After: - netdev_master_upper_dev_link() - __netdev_upper_dev_link() - netdev_change_features() - __netdev_update_features() - ndo_update_offloads() - netdev_compute_master_upper_features() - update other features This ensures offload features are computed automatically when upper/lower device links change, removing the need for manual feature computation calls in the driver code. The netdev_change_features() call in team_uninit() is also removed since it calls team_port_del() for each port, which now triggers feature updates automatically. Signed-off-by: Hangbin Liu --- drivers/net/bonding/bond_main.c | 10 +++++++--- drivers/net/team/team_core.c | 11 +++++++---- net/bridge/br_device.c | 6 ++++++ net/bridge/br_if.c | 4 ---- net/core/dev.c | 8 ++++++-- 5 files changed, 26 insertions(+), 13 deletions(-) diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_mai= n.c index 90b71bd53040..ea6bb20f9348 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c @@ -1509,6 +1509,11 @@ static netdev_features_t bond_fix_features(struct ne= t_device *dev, return features; } =20 +static void bond_update_offloads(struct net_device *dev) +{ + netdev_compute_master_upper_features(dev, true); +} + static int bond_header_create(struct sk_buff *skb, struct net_device *bond= _dev, unsigned short type, const void *daddr, const void *saddr, unsigned int len) @@ -2273,7 +2278,6 @@ int bond_enslave(struct net_device *bond_dev, struct = net_device *slave_dev, } =20 bond->slave_cnt++; - netdev_compute_master_upper_features(bond->dev, true); bond_set_carrier(bond); =20 /* Needs to be called before bond_select_active_slave(), which will @@ -2528,7 +2532,6 @@ static int __bond_release_one(struct net_device *bond= _dev, call_netdevice_notifiers(NETDEV_RELEASE, bond->dev); } =20 - netdev_compute_master_upper_features(bond->dev, true); if (!(bond_dev->features & NETIF_F_VLAN_CHALLENGED) && (old_features & NETIF_F_VLAN_CHALLENGED)) slave_info(bond_dev, slave_dev, "last VLAN challenged slave left bond - = VLAN blocking is removed\n"); @@ -4026,7 +4029,7 @@ static int bond_slave_netdev_event(unsigned long even= t, case NETDEV_FEAT_CHANGE: if (!bond->notifier_ctx) { bond->notifier_ctx =3D true; - netdev_compute_master_upper_features(bond->dev, true); + netdev_change_features(bond->dev); bond->notifier_ctx =3D false; } break; @@ -5953,6 +5956,7 @@ static const struct net_device_ops bond_netdev_ops = =3D { .ndo_add_slave =3D bond_enslave, .ndo_del_slave =3D bond_release, .ndo_fix_features =3D bond_fix_features, + .ndo_update_offloads =3D bond_update_offloads, .ndo_features_check =3D passthru_features_check, .ndo_get_xmit_slave =3D bond_xmit_get_slave, .ndo_sk_get_lower_dev =3D bond_sk_get_lower_dev, diff --git a/drivers/net/team/team_core.c b/drivers/net/team/team_core.c index b7282f5c9632..affbcc6fc130 100644 --- a/drivers/net/team/team_core.c +++ b/drivers/net/team/team_core.c @@ -1247,7 +1247,6 @@ static int team_port_add(struct team *team, struct ne= t_device *port_dev, port->index =3D -1; list_add_tail_rcu(&port->list, &team->port_list); team_port_enable(team, port); - netdev_compute_master_upper_features(team->dev, true); __team_port_change_port_added(port, !!netif_oper_up(port_dev)); __team_options_change_check(team); =20 @@ -1337,7 +1336,6 @@ static int team_port_del(struct team *team, struct ne= t_device *port_dev, bool un } kfree_rcu(port, rcu); netdev_info(dev, "Port device %s removed\n", portname); - netdev_compute_master_upper_features(team->dev, true); =20 return 0; } @@ -1645,7 +1643,6 @@ static void team_uninit(struct net_device *dev) team_mcast_rejoin_fini(team); team_notify_peers_fini(team); team_queue_override_fini(team); - netdev_change_features(dev); } =20 static void team_destructor(struct net_device *dev) @@ -1972,6 +1969,11 @@ static netdev_features_t team_fix_features(struct ne= t_device *dev, return features; } =20 +static void team_update_offloads(struct net_device *dev) +{ + netdev_compute_master_upper_features(dev, true); +} + static int team_change_carrier(struct net_device *dev, bool new_carrier) { struct team *team =3D netdev_priv(dev); @@ -2007,6 +2009,7 @@ static const struct net_device_ops team_netdev_ops = =3D { .ndo_add_slave =3D team_add_slave, .ndo_del_slave =3D team_del_slave, .ndo_fix_features =3D team_fix_features, + .ndo_update_offloads =3D team_update_offloads, .ndo_change_carrier =3D team_change_carrier, .ndo_features_check =3D passthru_features_check, }; @@ -2944,7 +2947,7 @@ static int team_device_event(struct notifier_block *u= nused, case NETDEV_FEAT_CHANGE: if (!port->team->notifier_ctx) { port->team->notifier_ctx =3D true; - netdev_compute_master_upper_features(port->team->dev, true); + netdev_change_features(port->team->dev); port->team->notifier_ctx =3D false; } break; diff --git a/net/bridge/br_device.c b/net/bridge/br_device.c index f7502e62dd35..137cad13379b 100644 --- a/net/bridge/br_device.c +++ b/net/bridge/br_device.c @@ -289,6 +289,11 @@ static netdev_features_t br_fix_features(struct net_de= vice *dev, return br_features_recompute(br, features); } =20 +static void br_update_offloads(struct net_device *dev) +{ + netdev_compute_master_upper_features(dev, false); +} + #ifdef CONFIG_NET_POLL_CONTROLLER static void br_poll_controller(struct net_device *br_dev) { @@ -456,6 +461,7 @@ static const struct net_device_ops br_netdev_ops =3D { .ndo_add_slave =3D br_add_slave, .ndo_del_slave =3D br_del_slave, .ndo_fix_features =3D br_fix_features, + .ndo_update_offloads =3D br_update_offloads, .ndo_fdb_add =3D br_fdb_add, .ndo_fdb_del =3D br_fdb_delete, .ndo_fdb_del_bulk =3D br_fdb_delete_bulk, diff --git a/net/bridge/br_if.c b/net/bridge/br_if.c index d39571e13744..030248bc94c5 100644 --- a/net/bridge/br_if.c +++ b/net/bridge/br_if.c @@ -680,8 +680,6 @@ int br_add_if(struct net_bridge *br, struct net_device = *dev, =20 br_mtu_auto_adjust(br); =20 - netdev_compute_master_upper_features(br->dev, false); - kobject_uevent(&p->kobj, KOBJ_ADD); =20 return 0; @@ -734,8 +732,6 @@ int br_del_if(struct net_bridge *br, struct net_device = *dev) if (changed_addr) call_netdevice_notifiers(NETDEV_CHANGEADDR, br->dev); =20 - netdev_compute_master_upper_features(br->dev, false); - return 0; } =20 diff --git a/net/core/dev.c b/net/core/dev.c index bbd532aa6a1b..8bcbf7c22830 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -8923,6 +8923,9 @@ static int __netdev_upper_dev_link(struct net_device = *dev, __netdev_walk_all_upper_dev(upper_dev, __netdev_update_lower_level, priv); =20 + /* re-compute all features after adding link */ + netdev_change_features(upper_dev); + return 0; =20 rollback: @@ -9015,6 +9018,9 @@ static void __netdev_upper_dev_unlink(struct net_devi= ce *dev, __netdev_update_lower_level(upper_dev, priv); __netdev_walk_all_upper_dev(upper_dev, __netdev_update_lower_level, priv); + + /* re-compute all features after removing link */ + netdev_change_features(upper_dev); } =20 /** @@ -12880,8 +12886,6 @@ void netdev_compute_master_upper_features(struct ne= t_device *dev, bool update_he =20 netif_set_tso_max_segs(dev, tso_max_segs); netif_set_tso_max_size(dev, tso_max_size); - - netdev_change_features(dev); } EXPORT_SYMBOL(netdev_compute_master_upper_features); =20 --=20 Git-155) From nobody Tue Apr 7 04:33:42 2026 Received: from mail-pf1-f169.google.com (mail-pf1-f169.google.com [209.85.210.169]) (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 9AF4F339866 for ; Mon, 16 Mar 2026 04:27:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.169 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773635253; cv=none; b=ZCmHDIM/nAUxkT+iCvYeWmVofe+KgnOD/qYQJ1SGC105oRWsP7laor39CUURcqj2sJMiLlLOshp+CnU9z6bFiV5GwpRf+TZFaddXP/SV6x2HRyREWZzWW36/p3tf22h/PKD8yKShvi4dWxVOF9rdeyTxvekGgBKEV74sxJIZSEM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773635253; c=relaxed/simple; bh=pbtKIDznCvGEVtQHODrKsx+vVNFY8ZkNIx/vZ7lzIsQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=lvxaCH9SQIMWCFR/DdTUlpVyXrZW/3u1GDYbRN5wW+0cwpE7LmxfUNrIIM0Gh7AKfkPhBN9xliYP57qexLIpcMppV9wkTswHuIYt1YtW1RuABUTXPaNaNM1KyOChoJvgYsxVnzOSTuHuRUOq13Jqz1XsMsMwxnZ4eY/X9xGW0NI= 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=SRUbqmgC; arc=none smtp.client-ip=209.85.210.169 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="SRUbqmgC" Received: by mail-pf1-f169.google.com with SMTP id d2e1a72fcca58-82976220e97so2413256b3a.3 for ; Sun, 15 Mar 2026 21:27:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1773635250; x=1774240050; 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=JPGq7YNOGl3DkR8NTBoIGDJAXGD2GV5oTegfoP6i0Xk=; b=SRUbqmgCkNbCavGRvSw5aN03HhEmlPtqPTWYZmG/Ksx5ZmK5WHW0+6F95Xg/7x31Ra p2kos3qMmPlnEqrn9n4D4Lk1LDw+HQ1EqBt+q4axlc5pGZGlr6nRNVZM1DRAZT6yUD4q l4H5upzafiE6zyks24TE6DQcgDWzVhXQ+na3mO2Tw50eWonWHEvOsllP2p15N55AzMuC npvw9I24a/pMWPD3PigokPRIL5OAPfOy1KJIffMiQ4fZXaG/QLcDdtiwzcbZ8AeaQKER 9MOSoeBCduktbLEZT4jFwUr1YMNVYxlMOWV90DdmsXotnj9tT0jLWJn0+fxFm13NWU4h IgbA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1773635250; x=1774240050; 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=JPGq7YNOGl3DkR8NTBoIGDJAXGD2GV5oTegfoP6i0Xk=; b=L1UFuX9d+9gv+zGxpvKoqgp6EwevFjfI94IkVPCmggKpt4tjLHqXwiC8zCvKHg9yCu gi722NnoIwaeibPnSU+Zk0/zdMO3pub0Otgt1nyvIKFDFf7ASlK6YSEIfp02HYy9ntW5 +OrAOVYaToWul8+Ta0BS0F5cbfGIE1qBw5BCt4lhnsrqqdFa32q00WZ23x5g7cJ/Ojxn +3NUMkqDM9B/SqaLpszbBRs1Yr2i/3OmhPpaKxTmknIlRu+hoWLeNyQiAKWSM8xUdSFV +6iAkTi5N8Y/m5Jzu7rn+bkPQw6qVINTYHnb153WDLGDLB5WVIKyqbw3HgnJZ86Igbe1 FoIQ== X-Forwarded-Encrypted: i=1; AJvYcCVjNta5yEUInwgOIR3kYFyDaKqSPqSnIfS/sWnUxFdWu0HvRk/0FxEfNTD8PCFx1YCRALf2EzXFaZweZKo=@vger.kernel.org X-Gm-Message-State: AOJu0Yy+6zLWU8o4kJTrK3daBxx2u64ViOQlUy3bjlPPUYJ3yoAyYCZk dG3kqNUokd39jOJz5HVu4zsFRfib8EEVV4rIfLPrXflDadRQ81soYSBq X-Gm-Gg: ATEYQzwxjL2twsHUvfbX4ppv6Mvp0zXMclKbtdxE+pQwgWv1MFR4ahlMEtV8EOHNaVl k5qYjw90mfWRaz7KysMAi2Rtb8Zjkz0UQOK3ruJMa2VII+7516eBBtOlqxTUpxLRxiyGj1G1Flv zm2Pv4zBnJyd/eQFkyD5uQzdBcHlBrJAQJS2tKm3Qln8V3a6NbPtHZg39QpAfxBkx0ybtAjLVLm srpQg9iK+uTxRNRIsFqzxMhKfRapX8fRCNBORBg3s0BBF2UVvGj+4InHts/HzTbRUmaWpG1gbP6 sh1Ej2ocu0cy+zFSDeh6/EjZn5ekXFXpb/6+YnVcCLuZ5DhqQeURUGeOIotOFCot4jdJgF7eUma VJcVdZckbVgNYNK1KoUHtN6t3NlTIZmDVhXqMwcL5wl8QGG4/jolWPBA8C4z5ZIJ35ogGgQi+SX nQhPtRVw5IY5aluunRerPbsiC7JHbd4z4UpkU1lNgQ899Ksvv5LhJpBOli8jBhl85Z1nfE X-Received: by 2002:a05:6a00:981:b0:82a:110b:e22d with SMTP id d2e1a72fcca58-82a1971e6f9mr10199007b3a.24.1773635249914; Sun, 15 Mar 2026 21:27:29 -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.27.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 15 Mar 2026 21:27:29 -0700 (PDT) From: Hangbin Liu Date: Mon, 16 Mar 2026 12:26:11 +0800 Subject: [PATCH net-next v3 3/5] macsec: move netdev_upper_dev_link() after macsec_changelink_common() 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-3-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 After calling netdev_change_features() in __netdev_upper_dev_link(), the call stack looks like: - netdev_upper_dev_link - __netdev_upper_dev_link - netdev_change_features - notifier_call_chain - rtnetlink_event - rtmsg_ifinfo_event - rtmsg_ifinfo_build_skb In macsec, we call netdev_upper_dev_link() before macsec_changelink_common(), which causes the fields of the MACsec Security Entity to be uninitialized. Later, macsec_fill_info() returns -EMSGSIZE and triggers WARN_ON() in rtmsg_ifinfo_build_skb. Fix this by moving netdev_upper_dev_link() after macsec_changelink_common(), and return 0 if secy->key_len is not initialized yet. Suggested-by: Sabrina Dubroca Signed-off-by: Hangbin Liu Reviewed-by: Sabrina Dubroca --- drivers/net/macsec.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/drivers/net/macsec.c b/drivers/net/macsec.c index f6cad0746a02..6bb38084bc1e 100644 --- a/drivers/net/macsec.c +++ b/drivers/net/macsec.c @@ -4161,10 +4161,6 @@ static int macsec_newlink(struct net_device *dev, lockdep_set_class(&dev->addr_list_lock, &macsec_netdev_addr_lock_key); =20 - err =3D netdev_upper_dev_link(real_dev, dev, extack); - if (err < 0) - goto unregister; - /* need to be already registered so that ->init has run and * the MAC addr is set */ @@ -4177,12 +4173,12 @@ static int macsec_newlink(struct net_device *dev, =20 if (rx_handler && sci_exists(real_dev, sci)) { err =3D -EBUSY; - goto unlink; + goto unregister; } =20 err =3D macsec_add_dev(dev, sci, icv_len); if (err) - goto unlink; + goto unregister; =20 if (data) { err =3D macsec_changelink_common(dev, data); @@ -4190,6 +4186,10 @@ static int macsec_newlink(struct net_device *dev, goto del_dev; } =20 + err =3D netdev_upper_dev_link(real_dev, dev, extack); + if (err < 0) + goto del_dev; + /* If h/w offloading is available, propagate to the device */ if (macsec_is_offloaded(macsec)) { const struct macsec_ops *ops; @@ -4200,7 +4200,7 @@ static int macsec_newlink(struct net_device *dev, ctx.secy =3D &macsec->secy; err =3D macsec_offload(ops->mdo_add_secy, &ctx); if (err) - goto del_dev; + goto unlink; =20 macsec->insert_tx_tag =3D macsec_needs_tx_tag(macsec, ops); @@ -4209,7 +4209,7 @@ static int macsec_newlink(struct net_device *dev, =20 err =3D register_macsec_dev(real_dev, dev); if (err < 0) - goto del_dev; + goto unlink; =20 netdev_update_features(dev); netif_stacked_transfer_operstate(real_dev, dev); @@ -4219,10 +4219,10 @@ static int macsec_newlink(struct net_device *dev, =20 return 0; =20 -del_dev: - macsec_del_dev(macsec); unlink: netdev_upper_dev_unlink(real_dev, dev); +del_dev: + macsec_del_dev(macsec); unregister: unregister_netdevice(dev); return err; @@ -4337,7 +4337,8 @@ static int macsec_fill_info(struct sk_buff *skb, csid =3D secy->xpn ? MACSEC_CIPHER_ID_GCM_AES_XPN_256 : MACSEC_CIPHER_ID= _GCM_AES_256; break; default: - goto nla_put_failure; + WARN_ON_ONCE(1); + return 0; } =20 if (nla_put_sci(skb, IFLA_MACSEC_SCI, secy->sci, --=20 Git-155) From nobody Tue Apr 7 04:33:42 2026 Received: from mail-pf1-f182.google.com (mail-pf1-f182.google.com [209.85.210.182]) (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 984C62DCBF4 for ; Mon, 16 Mar 2026 04:27:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.182 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773635264; cv=none; b=Nia8xfZDMDooLsK742kUJvY3XCpfvNhXHrYkY1sUi7SfnS8B43W4h/CwC/e6dVjCyf6g8Hlv96DAveriSgsNBlnNHKf/9HWFGuRVb4zmew7Jn/bbDaBfTF5xUayF/E7I8kruY/i48AmY3q37F8PQbXkGskbzZBKeJLzJrkza9m4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773635264; c=relaxed/simple; bh=9i2xWCN02/6dWupq0qfGRAfhr3jgqrdA1Q8ElDVHmj4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=KMHBzwU7uMx7NRATNoxTsU/fFak5QqvNpdLD4O9+c+0O0UWZkWdqObajbDmby9H7ioPgftcG1RwHH18BdqzLOt9x9QRP38PY5fiE/GDXWU5HPDv5rnRvrifZsk6AvEmwaoDDpfaDmPzmBbt6KlfBsVWttGuwh8Q15dLWmMcM7BI= 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=kvdxzsxx; arc=none smtp.client-ip=209.85.210.182 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="kvdxzsxx" Received: by mail-pf1-f182.google.com with SMTP id d2e1a72fcca58-8296d553142so1746226b3a.3 for ; Sun, 15 Mar 2026 21:27:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1773635263; x=1774240063; 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=C7xj5ZZxKagQhRbiCtY39hgG05M7BNgG4UcL1mqFDwQ=; b=kvdxzsxxepySuOcY3WN8j+vyOkMJIolCyekYtNoLMfb3ZYkQ4KNWwckTK+rrcnOXlT z8B8zdRIIksMXHd/ofKz58ygDnMQX07x23hUnsI1iPrLzGS0vfy3eiGwABc4EPdOREvc 040cLmUP/0EVPliyzWS9olEa4FqCcP+j+yqDHfiqPpDfc1Jo5XusVR1jEBpiviFAg87R zuldpzkDdDGjOhKsTnNN/UAwh91Ohc057GLJg3UiQsZLj9LPQdjp27PNAuOV6XhnXXDw nI15whRefLZRBooyg8I8Q+OLFXJp0I8WUD9IDv9/SKb+efmMdghMy6w0GzVJHLAwf+xb 6THw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1773635263; x=1774240063; 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=C7xj5ZZxKagQhRbiCtY39hgG05M7BNgG4UcL1mqFDwQ=; b=K7MRX+B4zYpr+wjdAfUYpxfq7VRIgWffHV3c7l6iIYGZCP/KbAZ36wlqB2+fAjtuX+ Im183zYNR+8FLTXIazback+BwmdFj4JFIi4WXpPe8vtl+3cUdB5OqJZwdyMseFbnsr5s VHnG0XogKf0jk+7CsdTIxToqlVQ/IN9wNn+lsMWGYXfvpbeve/okC3y4Q6D4QJSfHCG/ 5hSYBXL90/f95qGQHvSbn1R2yYabojJEIi88D4DFQGmGyVedqylq6aNessQVIEJnP5p9 XT5v8znMhQ9+TYCIjg6CVsAGKO2V4QvfKooUcQfjtENW9HFYbPrb/qSQUgP1Ypc0Ctxs qGQw== X-Forwarded-Encrypted: i=1; AJvYcCU+3IBqQGJPzbjwHP9D2ROXejii7TbsyloHEUk1Pv9FKZZOb1+fhzYpGOi9JlgI4gMh39zztdPHvp91UZI=@vger.kernel.org X-Gm-Message-State: AOJu0Yx4zqiu5pryNDAGidOF0l7/lL5oWmmVYpf+wmBXolo49PizGWYK c+8Wf1xCAZHRiaZBgap27dWOJKcE4hy9loefkHZMjFEGeg80F48mpoJE X-Gm-Gg: ATEYQzwmaXPI1BbCQQsIbCepAsYWUxMDoHvYb3GNxzPOAiLOs1ciMWBhGFyJ544nl8m 2s2kNeXCBAxs88Z3m4F7cFgZ1yrZRE6oy8cwvFI94dmjGYcBXMIqKVVyjLzx0bYP+Tyj57BJIUT IE4RegRmV3daxLGWiHnezQ4rG4Mf4OgF8vOJTXpglfLiKPsVg6d/jzxE3373agXmzy2ByItCtmr UaLYNAZTbYUoGkGJ+qKClnFbP7nu8ADYyc/Kl++g6SlOaF3nkxP56JR9fLvW5+HP0iJcl20e58d kXCzRTN5G7RvnoAO+58Sa8ZqF4RDknb+BjKFC3uz3LE9IleQO2ENRcBWZM9ePrbJ4HcVyvZII55 9feltsq5SLlk3EAAb9eMTWWdDh/UvUH64/owgwkLmcYJYMND9tQr6r1swWc0RhBt97pUhL2+1Ez ZFHCeplrsgssMHhos6Tf1xZfQ8UHlVfNzRQBUTyCkIyCTlLE5DybdqIHpGkw== X-Received: by 2002:a05:6a00:4605:b0:829:8990:3f86 with SMTP id d2e1a72fcca58-82a198cf37fmr9979104b3a.35.1773635262976; Sun, 15 Mar 2026 21:27:42 -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.27.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 15 Mar 2026 21:27:42 -0700 (PDT) From: Hangbin Liu Date: Mon, 16 Mar 2026 12:26:12 +0800 Subject: [PATCH net-next v3 4/5] failover: use ndo_update_offloads for failover offload compute 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-4-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 Convert net_failover to use the ndo_update_offloads callback and calls netdev_compute_master_upper_features() to compute new offload flags during slave registration/unregistration. This simplifies the failover code significantly by removing the custom feature computation logic and relying on the centralized feature update mechanism. The callback is automatically invoked during feature updates when upper/lower device links change. Signed-off-by: Hangbin Liu --- drivers/net/net_failover.c | 66 +++++-------------------------------------= ---- include/net/net_failover.h | 7 ----- 2 files changed, 7 insertions(+), 66 deletions(-) diff --git a/drivers/net/net_failover.c b/drivers/net/net_failover.c index d0361aaf25ef..85c238b88b85 100644 --- a/drivers/net/net_failover.c +++ b/drivers/net/net_failover.c @@ -300,6 +300,11 @@ static int net_failover_vlan_rx_kill_vid(struct net_de= vice *dev, __be16 proto, return 0; } =20 +static void failover_update_offloads(struct net_device *dev) +{ + netdev_compute_master_upper_features(dev, true); +} + static const struct net_device_ops failover_dev_ops =3D { .ndo_open =3D net_failover_open, .ndo_stop =3D net_failover_close, @@ -312,6 +317,7 @@ static const struct net_device_ops failover_dev_ops =3D= { .ndo_vlan_rx_kill_vid =3D net_failover_vlan_rx_kill_vid, .ndo_validate_addr =3D eth_validate_addr, .ndo_features_check =3D passthru_features_check, + .ndo_update_offloads =3D failover_update_offloads, }; =20 #define FAILOVER_NAME "net_failover" @@ -373,61 +379,6 @@ static rx_handler_result_t net_failover_handle_frame(s= truct sk_buff **pskb) return RX_HANDLER_ANOTHER; } =20 -static void net_failover_compute_features(struct net_device *dev) -{ - netdev_features_t vlan_features =3D FAILOVER_VLAN_FEATURES & - NETIF_F_ALL_FOR_ALL; - netdev_features_t enc_features =3D FAILOVER_ENC_FEATURES; - unsigned short max_hard_header_len =3D ETH_HLEN; - unsigned int dst_release_flag =3D IFF_XMIT_DST_RELEASE | - IFF_XMIT_DST_RELEASE_PERM; - struct net_failover_info *nfo_info =3D netdev_priv(dev); - struct net_device *primary_dev, *standby_dev; - - primary_dev =3D rcu_dereference(nfo_info->primary_dev); - if (primary_dev) { - vlan_features =3D - netdev_increment_features(vlan_features, - primary_dev->vlan_features, - FAILOVER_VLAN_FEATURES); - enc_features =3D - netdev_increment_features(enc_features, - primary_dev->hw_enc_features, - FAILOVER_ENC_FEATURES); - - dst_release_flag &=3D primary_dev->priv_flags; - if (primary_dev->hard_header_len > max_hard_header_len) - max_hard_header_len =3D primary_dev->hard_header_len; - } - - standby_dev =3D rcu_dereference(nfo_info->standby_dev); - if (standby_dev) { - vlan_features =3D - netdev_increment_features(vlan_features, - standby_dev->vlan_features, - FAILOVER_VLAN_FEATURES); - enc_features =3D - netdev_increment_features(enc_features, - standby_dev->hw_enc_features, - FAILOVER_ENC_FEATURES); - - dst_release_flag &=3D standby_dev->priv_flags; - if (standby_dev->hard_header_len > max_hard_header_len) - max_hard_header_len =3D standby_dev->hard_header_len; - } - - dev->vlan_features =3D vlan_features; - dev->hw_enc_features =3D enc_features | NETIF_F_GSO_ENCAP_ALL; - dev->hard_header_len =3D max_hard_header_len; - - dev->priv_flags &=3D ~IFF_XMIT_DST_RELEASE; - if (dst_release_flag =3D=3D (IFF_XMIT_DST_RELEASE | - IFF_XMIT_DST_RELEASE_PERM)) - dev->priv_flags |=3D IFF_XMIT_DST_RELEASE; - - netdev_change_features(dev); -} - static void net_failover_lower_state_changed(struct net_device *slave_dev, struct net_device *primary_dev, struct net_device *standby_dev) @@ -550,7 +501,6 @@ static int net_failover_slave_register(struct net_devic= e *slave_dev, } =20 net_failover_lower_state_changed(slave_dev, primary_dev, standby_dev); - net_failover_compute_features(failover_dev); =20 call_netdevice_notifiers(NETDEV_JOIN, slave_dev); =20 @@ -621,8 +571,6 @@ static int net_failover_slave_unregister(struct net_dev= ice *slave_dev, =20 dev_put(slave_dev); =20 - net_failover_compute_features(failover_dev); - netdev_info(failover_dev, "failover %s slave:%s unregistered\n", slave_is_standby ? "standby" : "primary", slave_dev->name); =20 @@ -736,7 +684,7 @@ struct failover *net_failover_create(struct net_device = *standby_dev) /* Don't allow failover devices to change network namespaces. */ failover_dev->netns_immutable =3D true; =20 - failover_dev->hw_features =3D FAILOVER_VLAN_FEATURES | + failover_dev->hw_features =3D MASTER_UPPER_DEV_VLAN_FEATURES | NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_HW_VLAN_CTAG_FILTER; diff --git a/include/net/net_failover.h b/include/net/net_failover.h index b12a1c469d1c..f0f038d113a0 100644 --- a/include/net/net_failover.h +++ b/include/net/net_failover.h @@ -30,11 +30,4 @@ struct net_failover_info { struct failover *net_failover_create(struct net_device *standby_dev); void net_failover_destroy(struct failover *failover); =20 -#define FAILOVER_VLAN_FEATURES (NETIF_F_HW_CSUM | NETIF_F_SG | \ - NETIF_F_FRAGLIST | NETIF_F_ALL_TSO | \ - NETIF_F_HIGHDMA | NETIF_F_LRO) - -#define FAILOVER_ENC_FEATURES (NETIF_F_HW_CSUM | NETIF_F_SG | \ - NETIF_F_RXCSUM | NETIF_F_ALL_TSO) - #endif /* _NET_FAILOVER_H */ --=20 Git-155) From nobody Tue Apr 7 04:33:42 2026 Received: from mail-pf1-f177.google.com (mail-pf1-f177.google.com [209.85.210.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 B5110327BFC for ; Mon, 16 Mar 2026 04:27:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.177 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773635276; cv=none; b=lgWvYOVOztNcKICQ2kbuOKNQlOWOfLQD0b3fiubXKzOcxKcNm57Jt5s2IIE9zy6IYr8AcTgv7yXQsQK6Y17t58jaFeZZ+MEKA+moHWdnvUEMyFpqVDNtwDpie7ICLlfB/kvWKJmeXG4OzqO5/4WD0Iw5cx1+Ubt0PZF9wC5hZhg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773635276; c=relaxed/simple; bh=Pwe+hISXxf7UnQW3PsrYTHnib7m2N5HUUsdGQZrsYtM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=uda2VT+TvVolkNM2IlYPagOJ6r4Dd2fQ41NHeWVYcW7u0GPqEX3M99Cv5woa3/hgHPyV/PHReMmrWAojMYdac9Vk+3B0htnbJxNIFSLBY+6zEGHek/imr2Ykj5QEHrgu86wzbwdLEG9q8ax8RQupXRpGLwt9bIc6PoewM2hMAKw= 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=hO9jI0uR; arc=none smtp.client-ip=209.85.210.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="hO9jI0uR" Received: by mail-pf1-f177.google.com with SMTP id d2e1a72fcca58-82a3d3235c9so600986b3a.2 for ; Sun, 15 Mar 2026 21:27:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1773635275; x=1774240075; 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=AJCl7LHn28MJC1H9+y+noJgdFBK7VWHZCxMkHXcBrlc=; b=hO9jI0uR0s6EaCERseJJIoZtPDTsTQ9fFS9RSWq5ep4fhI3Oxe4Cx/eQwg/1vFlLvy SktrLB/bRodrnTv11slCZwT3obP0cjQmTSSE9apq4PbtnIdgm0cP3nXOLFDbLjRiJE7s pzXTgMugJITD3HZqfgxg0YfRzCG9AGgrgs9HZhEE+mYZElZx5qTFmh1gEUqYbOovAWJ4 ge8FqVr8fWrPAsGsZn9fFnzEXbDtLacL0BxNMOAyqniXm4uhh6uVe+al3E6HrHMK/eVf q/IAI4Zd2eiKkTBI1ITr+rvuXgScCyXO7yK7vzKlau8iwlJcI+lmXltdYc9R1MW0GdCM xmDA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1773635275; x=1774240075; 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=AJCl7LHn28MJC1H9+y+noJgdFBK7VWHZCxMkHXcBrlc=; b=o0O2IEtYQJV9K17wTpYPGfsvk3r4MP4J4ji5F4ELM+MqBEndOIghqMBBcAsbrecJwO leSTzGvY8jF5ZJz9AHPTmTG0H+VBXri4TPBOH0u1TZTLwfxW/JunwR1jrl/f5WqgzndQ 5LcV55kH0d0V0dT1HfZKBVhEoN+6XnV3d0wAjepU2dhktLfjNEO5euRlumeX6GH4z3PH s2+dCPkRuZkTGSFL+SgidDaOymVUiPpu7Oerw+ksQn5F+SNKrY3rZLrF/dqCJIXtFYeK nBhPNVL17wHaPFa0EsvlsLG4EZac8+9fmpZ7CbZKOnAixOpELTQ/7fgBAVRPHFQ1CFiN gqOg== X-Forwarded-Encrypted: i=1; AJvYcCXGAMlSuvJYl8Zw2NJLq9AV6M1tMjJn0ragK2eGv2dqS39d9BL4RCQsyYoByp0utLGt4eqaU3g0hFyUgMA=@vger.kernel.org X-Gm-Message-State: AOJu0Ywqj/mv3ZhVNIUeT/j10nK7lE6/SZ2ci79gnQHfuvepF42KOo3+ 59a/kuYOTJ+h93kmisxoQzO6mD4uL+bUMeFTA8cAYrTeVBORrbypIYgh X-Gm-Gg: ATEYQzzcr6pge23asbKqxF+aHgq+odFHAEbv9B0dHA8pfoC8bnYtDT8mw/WgZXXrvfR vNQI2wvSAwmBxIH6AO4P0pJSqoEy99F6D++lk9TSrmONjS3Mp8s/scAgfb6j/Mm13PSWEidQs/y HrXBC05ir8nBw1CmRLHRd9+yxPniwQK1Bg7oHGTLa0C8Gte6VEwn4xukYWEpD5korn10t9lPHnx le7dNEya+AzugwZtY/d1mze/vocuKxrNF+56eoyKXuUxmrwhbu6rAOJJpuWSrPMqekbtRKM2dP8 lH7iuHsUoO17O0kqBcBK7YcEM7LDZGhmmwOX8DBXNEaHK6H7LfZBNbe7dVwxBFVBrM4w0R6oced PGRm/GaiUZ8gAsUV1w1yqpc4q3uokOlUsCyOIY6kz5J3K3R/wvesQ704a1DvLki9qZIcexmzuN8 x3OXzBklgkj1Bt193q1GyI+QWhR3Y78pisaQHT153E2C/n23Vq8/CGOMDxxw== X-Received: by 2002:a05:6a00:929f:b0:829:822e:cdc9 with SMTP id d2e1a72fcca58-82a1970498amr10804962b3a.2.1773635275161; Sun, 15 Mar 2026 21:27:55 -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.27.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 15 Mar 2026 21:27:54 -0700 (PDT) From: Hangbin Liu Date: Mon, 16 Mar 2026 12:26:13 +0800 Subject: [PATCH net-next v3 5/5] net: no need to disable LRO specifically 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-5-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 In commit "net: use ndo_update_offloads to set offload features for bonding/bridge/team" we called netdev_change_features() in __netdev_upper_dev_link(), which will disable LRO automatically on lower device if upper device doesn't have LRO enabled. So we don't need to dev_disable_lro() again after netdev_upper_dev_link(). Signed-off-by: Hangbin Liu --- drivers/net/bonding/bond_main.c | 3 --- drivers/net/team/team_core.c | 3 --- net/8021q/vlan.c | 2 -- net/bridge/br_if.c | 2 -- net/hsr/hsr_slave.c | 1 - 5 files changed, 11 deletions(-) diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_mai= n.c index ea6bb20f9348..f4f6ae02f7ca 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c @@ -2221,9 +2221,6 @@ int bond_enslave(struct net_device *bond_dev, struct = net_device *slave_dev, } #endif =20 - if (!(bond_dev->features & NETIF_F_LRO)) - dev_disable_lro(slave_dev); - res =3D netdev_rx_handler_register(slave_dev, bond_handle_frame, new_slave); if (res) { diff --git a/drivers/net/team/team_core.c b/drivers/net/team/team_core.c index affbcc6fc130..4f18205dd30d 100644 --- a/drivers/net/team/team_core.c +++ b/drivers/net/team/team_core.c @@ -1191,9 +1191,6 @@ static int team_port_add(struct team *team, struct ne= t_device *port_dev, goto err_enable_netpoll; } =20 - if (!(dev->features & NETIF_F_LRO)) - dev_disable_lro(port_dev); - err =3D netdev_rx_handler_register(port_dev, team_handle_frame, port); if (err) { diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c index 2b74ed56eb16..fda3a80e9340 100644 --- a/net/8021q/vlan.c +++ b/net/8021q/vlan.c @@ -193,8 +193,6 @@ int register_vlan_dev(struct net_device *dev, struct ne= tlink_ext_ack *extack) vlan_group_set_device(grp, vlan->vlan_proto, vlan_id, dev); grp->nr_vlan_devs++; =20 - netdev_update_features(dev); - return 0; =20 out_unregister_netdev: diff --git a/net/bridge/br_if.c b/net/bridge/br_if.c index 030248bc94c5..0aa653a1e651 100644 --- a/net/bridge/br_if.c +++ b/net/bridge/br_if.c @@ -620,8 +620,6 @@ int br_add_if(struct net_bridge *br, struct net_device = *dev, if (err) goto err5; =20 - dev_disable_lro(dev); - list_add_rcu(&p->list, &br->port_list); =20 nbp_update_port_count(br); diff --git a/net/hsr/hsr_slave.c b/net/hsr/hsr_slave.c index 44f83c8c56a7..4b6ab185392b 100644 --- a/net/hsr/hsr_slave.c +++ b/net/hsr/hsr_slave.c @@ -169,7 +169,6 @@ static int hsr_portdev_setup(struct hsr_priv *hsr, stru= ct net_device *dev, res =3D netdev_rx_handler_register(dev, hsr_handle_frame, port); if (res) goto fail_rx_handler; - dev_disable_lro(dev); =20 return 0; =20 --=20 Git-155)