From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=52.101.53.51 ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1796214646; b=k/B5oQcWvjkOIY7fAZT6JpuXQE9vBeX1fAC1x/ii00lNXy7nqIG9IlXthAdPpuHKo8ps cKV4MXxUaivm5bba1tuADtGLxQPGhe8pcYS+K8J9PtM2qYXyYrC0K7EIO1RxVWJdBO/lc Z4PwmdS9r97ZXDFIUsBTnYt3B4vp9DZSUwMy7DqPUdRe6H2IpF8vOEAMn7EPGahH8PGE2 dNM9Xgm6TsQ3ogEe2WWsDtoUxy6eGgqIABoeVLgCZ2AI5cRS1tSdtmCOWPUnynsRmmMys eFJEMvhRMsBI7RC5TuCqnoZEIIXw4j5LUUERIeJB5WVAxLeUBtxMikuHPBlUQYHTRgA== ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796214646; h=DMARC-Filter:DKIM-Signature:Received:Received: X-MS-Exchange-Authentication-Results:Received-SPF:Received:Received: Received:Received:From:To:CC:Subject:Date:Message-ID:X-Mailer: MIME-Version:Content-Transfer-Encoding:Content-Type: X-NV-OnPremToCloud:X-EOPAttributedMessage:X-MS-PublicTrafficType: X-MS-TrafficTypeDiagnostic:X-MS-Office365-Filtering-Correlation-Id: X-MS-Exchange-SenderADCheck:X-MS-Exchange-AntiSpam-Relay: X-Microsoft-Antispam:X-Microsoft-Antispam-Message-Info: X-Forefront-Antispam-Report: X-MS-Exchange-AntiSpam-MessageData-ChunkCount: X-MS-Exchange-AntiSpam-MessageData-0:X-OriginatorOrg: X-MS-Exchange-CrossTenant-OriginalArrivalTime: X-MS-Exchange-CrossTenant-Network-Message-Id: X-MS-Exchange-CrossTenant-Id: X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: X-MS-Exchange-CrossTenant-AuthSource:X-MS-Exchange-CrossTenant-AuthAs: X-MS-Exchange-CrossTenant-FromEntityHeader: X-MS-Exchange-Transport-CrossTenantHeadersStamped; bh=WBkynSG65+0IcnIWXRosfxrV8/3jLWLa7CtWLq8tTHU=; b=J2g3VYYb4mqzzjrJxUU+Wt0mBIU7pX2G6A/vLGZRuZXKrCoPaSg39zIdNI5PoG1wcuxH JP86tndofZtUssSleXwvpHKxbj26Dgh0TefQCO3yKeooiukRXkgRstHdCoxc6jESurIi8 /ABxXdMyRXjuUHsD6H8klmUDgC1xgka/9frkv8r2bFBSycbXCgDXIjrah0Jx4VWhaUKTu M2XTVci6SA0P1l8rvUN3Z6xtFD1f2ylzplfX56l4yeexwvgxAKyoLMcOKa5x5FO4Kb7Um v63sX6FiROxZ4aQS8PKcMlPbJMXLePsfDJy1JMQZzhMFkhmrrOa/WCFf1M0jhYI2WmQ== ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass header.d=Nvidia.com header.i=@Nvidia.com header.a=rsa-sha256 header.s=selector2 header.b="Hcu7/rot"; arc=pass header.oldest-pass=0 smtp.remote-ip=52.101.53.51 Received: from BL0PR03CU003.outbound.protection.outlook.com (mail-eastusazon11012051.outbound.protection.outlook.com [52.101.53.51]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (secp384r1) server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 68D24606A331; Wed, 2 Dec 2026 12:30:44 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 68D24606A331 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=Nvidia.com header.i=@Nvidia.com header.a=rsa-sha256 header.s=selector2 header.b=Hcu7/rot ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=WpPUSFgC3Z4lCf7ee6jz5QA2ZKOvo7jttu5iv8SYaC9HmeFEW0+t+akDyOk4Q/p2YgQVovHw1xbMuRJ6QG+lrb6JLbnB4GeAD6RSrNawmyAM+Kgc5IL0BhEIL8JNY8hUYJWZAo+N4WmEWQMuFMKjX83zrpE3xJBa/ZdonsG4TAMnZD1WNmbX23/C5x41TMUC2eKVtdsPmZj7hqLPEzVfMqm48/fgh5JJGyivS282n3akjamzXO4XHsBOAfUKZcGDGVr9kNJQnd1r/CPxFyXYwMpIbd0Q8pITJvnWokFXq8scdIbksAlWWahH7SSm/X7QChnEH6a7e6qVVbr1+EBLpg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=WBkynSG65+0IcnIWXRosfxrV8/3jLWLa7CtWLq8tTHU=; b=ENINTBwE/WCZTmPdkgl5owmEg3QwYoP+Jgnsl8xmUD/cMuQLPxLnALMd0vNmi5aNqaGcSYg9VtD6i8R8gswLTmXzTGBtcq/fQGHLuOOnPHPeLM9wouhDmfVQFo/tWAunE1K+t6TgBDQ10Nv/LTR+bbjrErn1Hxq0z9xD2jn0f+nj35qg45u2p5wSHMOIygN2nWSsMU/Pg5Emt2T3YMFrRixOcYpBnrkHLWbvvGkoM80jDdW9mMqa18shKg0WnZZOy1l9AVerWFUAeEHv54KngGHAHBXayl/nbJbXhj/OBIyBSkwajUUm5Cs+E34Gu2IjX840SzODyq6vNS7QPvbKuA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=ziepe.ca smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=WBkynSG65+0IcnIWXRosfxrV8/3jLWLa7CtWLq8tTHU=; b=Hcu7/roty/NMOYA+vfbwn8T0xbfuYRHMTESsdom0VlceuxYSCycb61psk82OHzZSbrHdOUe9NcyegA6+Bgpa/yy/jpi5c93AEHF5e+9noc2p++f/w9/egcucRMxMNZslXp9G/dbQt9zCZkpmTpunqd1MqaOkHjjBXhiLIY3xceVdH5KJWLgU/R6H09Zf6fBn/1yaccqKVdVTG9GUJgNeuCtFJt/eJAaN+djJWi05EwtZLd+5eEFCYIkL0nuuk7ExDw3s6ogYWZUYQ+BRDJwms3bGq+8ISngWgs9vex/pyrDf+84EKJerCjt1vOECK+8rCA4hx5w63fBofdrjuZLv7w== Received: from BL1P223CA0030.NAMP223.PROD.OUTLOOK.COM (2603:10b6:208:2c4::35) by BL3PR12MB6523.namprd12.prod.outlook.com (2603:10b6:208:3bf::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.688.10; Wed, 2 Dec 2026 12:30:39 +0000 Received: from BN7PEPF0000009E.namprd04.prod.outlook.com (2603:10b6:208:2c4:cafe::79) by BL1P223CA0030.outlook.office365.com (2603:10b6:208:2c4::35) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.688.11 via Frontend Transport; Wed, 2 Dec 2026 12:30:38 +0000 X-MS-Exchange-Authentication-Results: mx.microsoft.com 1; spf=pass (sender IP is 216.228.117.160) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by BN7PEPF0000009E.mail.protection.outlook.com (10.167.248.150) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.688.5 via Frontend Transport; Wed, 2 Dec 2026 12:30:38 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.57; Wed, 2 Dec 2026 04:30:18 -0800 Received: from rnnvmail202.nvidia.com (10.129.68.7) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.57; Wed, 2 Dec 2026 04:30:17 -0800 Received: from vdi.nvidia.com (10.127.8.10) by mail.nvidia.com (10.129.68.7) with Microsoft SMTP Server id 15.2.2562.57 via Frontend Transport; Wed, 2 Dec 2026 04:30:15 -0800 From: Mark Bloch To: Jason Gunthorpe , Leon Romanovsky CC: Jay Vosburgh , , Mark Bloch , Or Gerlitz , Junxian Huang , Maher Sanalla , , Subject: [PATCH rdma-next] RDMA: Preserve fixed-MAC bond GIDs across failover Date: Wed, 2 Dec 2026 14:30:05 +0200 Message-ID: <20261202123010.3914123-1-mbloch@nvidia.com> X-Mailer: git-send-email 2.43.0 X-Mailing-List: linux-rdma@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN7PEPF0000009E:EE_|BL3PR12MB6523:EE_ X-MS-Office365-Filtering-Correlation-Id: 25f7818c-c0bc-4ff9-8f0a-08df50701294 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|23010399003|82310400026|36860700016|1800799024|376014|11063799006|5023799004|18002099003|261009223027099003|56012099006|10067099003|261021121427099003|261026121527099003|261028144727099003|261021123027099003|261102123227099003|261026140227099003|261022105027099003; X-Microsoft-Antispam-Message-Info: grCGTY3lECoQCVDWrEjUJDmrWo/36XmbN7lN/aV+M/51RY0leoaLtF9469er153+yVRBGxDXnowH4Sr10s4TzqCDOtZB7ZPQ2k3dXprVwL0V/UavUUqlShnQpthfFnTMZvk7IUjA2g2UJENj8e+d7Sr8gSzpsWzLrcZfpuF/b2iy5jgc8/bG+vVZ4x7Ry2xTvahKl33TTsX7mlB+d7OQjLBjKq+5y3HYit3jRRmRW3IERDCaAvjkqEpEY1bL599lvULz+bwfkI5DGTHvjvzYW/7tTCkIY3K9hCn6t9He8UqNV/ZPyg6Km+iDAxyp5H6oIK2PAU6BFJXctlYmj1zwkByRRWgxD4gUJLUpW5fSNLI1KOXjZ9puOH8sUEb7K5fs16TUz4q1DFKgsB+HJG7KbiR7gz7envzE483YRix/wUh62n4li7rX8we4V2Acx3O7ZzEKtVxNu2+QlNOtvhutsyAhws1gmoEfdtr2VQY6F8wMcMvHyj2Txfghk52k6clUVzlk7E1A/D1BQJ26O5S3aXfmyysK/uWgBuCCBf5mVwsNpwgQyvET4qTXG66sMiU4GQshsE7+8r8GyLb356OehaRH1trDR5XM+4NKTk3Yt1JCmAQk7+3IqWW9v6hFO6acp1oH866rHxvbhnNDtwN/wCx+wOgRslVABOQ9dwyACfss2TeQ8vV7GFWJJxxnhXjLZiVHhf9ZcDomTG5fz1Qh7Q== X-Forefront-Antispam-Report: CIP:216.228.117.160;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge1.nvidia.com;CAT:NONE;SFS:(13230040)(23010399003)(82310400026)(36860700016)(1800799024)(376014)(11063799006)(5023799004)(18002099003)(261009223027099003)(56012099006)(10067099003)(261021121427099003)(261026121527099003)(261028144727099003)(261021123027099003)(261102123227099003)(261026140227099003)(261022105027099003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: lsPW4O0e4wz4mO+BtFwGa/TWhk2vFvt4Svq9dIsUwWYI99bD7FJOY5/PqkJsB3WRodiiSiGi6RqUtSrmZNqTlUysLN9jC6fjQJ5NrPKb0AiN2efKOcvK7m2T0YA7ISQENqTRt8kHhq7wDYfSprubBBrcvuKueyIdO5eT8dtDNTLh9w17+YL62fFwEeslbYBgAloLhZiYTdkMYPna92jp408t8a49wcEVvhbVpiGXeXF9Ce2ZGU4xodSVsevUeSvGB1GKlWXjCJ3/b/7305K33PG+93RcTgXZg5PD/gPGRfscFctUexGdDTbsRhmYr07tIReL7OtdT/vn9gL+s2PCq4zqO/B8cxJI6f+QstZ5ZMwZ5VTyJM0X3+Et43l4Nxno2ScFzhi64wMwIjF2odGHJuqPj8iZNCS9v00AG/kOscPOGwVHfNw0wUauvpQFobAK X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Dec 2026 12:30:38.6424 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 25f7818c-c0bc-4ff9-8f0a-08df50701294 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.160];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN7PEPF0000009E.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL3PR12MB6523 NETDEV_BONDING_FAILOVER deletes the bond's GIDs and adds them back. The delete clears the hardware entry even if a live QP still holds a reference to the GID. That reference keeps the old slot occupied, so re-adding the GID cannot restore the entry used by the QP. Some providers can move existing QPs to the new physical port without replacing their GIDs. Add RDMA_CORE_CAP_BONDING_FAILOVER so providers can advertise this, and set it for mlx5 RoCE LAG. Skip the failover purge for ports with this capability when their associated netdevice belongs to an active-backup bond using fail_over_mac=none. The source MAC stays the same, so the GIDs remain valid. Check the direct bond master, since the capability does not cover failover further up the netdevice hierarchy, such as when the bond itself is enslaved to another bond. Only GIDs that belong to the bond netdevice itself are preserved. NETDEV_BONDING_FAILOVER is also propagated to devices stacked on the bond, such as VLAN, macvlan and ipvlan, and for those events the purge still runs, so their GIDs are deleted and added back as before. This is intentional: keep the initial support minimal and extend it to stacked devices later if needed. Also stop requiring the port's netdevice to be the active member when handling address events for the bond or for a VLAN on top of it. The provider switches the port to the new active member asynchronously, so the GID work can run while the port still points at the old one, and an address added or removed in that window would be missed. With the purge skipped, nothing would later remove a GID whose address deletion was missed. Cc: Or Gerlitz Signed-off-by: Mark Bloch Tested-by: Junxian Huang Reviewed-by: Maher Sanalla --- drivers/infiniband/core/roce_gid_mgmt.c | 46 +++++++++++++++++++++++-- drivers/infiniband/hw/mlx5/main.c | 2 ++ include/rdma/ib_verbs.h | 2 ++ 3 files changed, 47 insertions(+), 3 deletions(-) diff --git a/drivers/infiniband/core/roce_gid_mgmt.c b/drivers/infiniband/core/roce_gid_mgmt.c index 4a2a4638b476..59a504b648d5 100644 --- a/drivers/infiniband/core/roce_gid_mgmt.c +++ b/drivers/infiniband/core/roce_gid_mgmt.c @@ -141,6 +141,29 @@ static enum bonding_slave_state is_eth_active_slave_of_bonding_rcu(struct net_de return BONDING_SLAVE_STATE_NA; } +static bool bond_preserves_gids(struct ib_device *ib_dev, u32 port, + struct net_device *rdma_ndev, + struct net_device *ndev) +{ + const struct ib_port_immutable *immutable; + struct bonding *bond; + bool preserves; + + immutable = ib_port_immutable_read(ib_dev, port); + if (!(immutable->core_cap_flags & RDMA_CORE_CAP_BONDING_FAILOVER) || + !netif_is_bond_master(ndev)) + return false; + + rcu_read_lock(); + bond = netdev_priv(ndev); + preserves = netdev_master_upper_dev_get_rcu(rdma_ndev) == ndev && + READ_ONCE(bond->params.mode) == BOND_MODE_ACTIVEBACKUP && + READ_ONCE(bond->params.fail_over_mac) == BOND_FOM_NONE; + rcu_read_unlock(); + + return preserves; +} + #define REQUIRED_BOND_STATES (BONDING_SLAVE_STATE_ACTIVE | \ BONDING_SLAVE_STATE_NA) static bool @@ -159,8 +182,9 @@ is_eth_port_of_netdev_filter(struct ib_device *ib_dev, u32 port, real_dev = cookie; res = ((rdma_is_upper_dev_rcu(rdma_ndev, cookie) && - (is_eth_active_slave_of_bonding_rcu(rdma_ndev, real_dev) & - REQUIRED_BOND_STATES)) || + (bond_preserves_gids(ib_dev, port, rdma_ndev, real_dev) || + (is_eth_active_slave_of_bonding_rcu(rdma_ndev, real_dev) & + REQUIRED_BOND_STATES))) || real_dev == rdma_ndev); rcu_read_unlock(); @@ -248,6 +272,22 @@ static bool upper_device_filter(struct ib_device *ib_dev, u32 port, return res; } +static bool bonding_failover_filter(struct ib_device *ib_dev, u32 port, + struct net_device *rdma_ndev, void *cookie) +{ + /* + * Skip deletion when the provider moves existing QPs to the new + * active member and preserves the bond's GIDs. Deleting them would + * clear hardware entries still used by live QPs. + * + * This can run before the provider associates the RDMA port with the + * new active member, so check bond membership without requiring the + * associated member to be active. + */ + return upper_device_filter(ib_dev, port, rdma_ndev, cookie) && + !bond_preserves_gids(ib_dev, port, rdma_ndev, cookie); +} + /** * is_upper_ndev_bond_master_filter - Check if a given netdevice * is bond master device of netdevice of the RDMA device of port. @@ -771,7 +811,7 @@ static int netdevice_event(struct notifier_block *this, unsigned long event, .filter = is_eth_port_of_netdev_filter }; static const struct netdev_event_work_cmd bonding_event_ips_del_cmd = { - .cb = del_netdev_upper_ips, .filter = upper_device_filter}; + .cb = del_netdev_upper_ips, .filter = bonding_failover_filter}; struct net_device *ndev = netdev_notifier_info_to_dev(ptr); struct netdev_event_work_cmd cmds[ROCE_NETDEV_CALLBACK_SZ] = { {NULL} }; diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c index 81f8498a9246..0a19d9eb9e78 100644 --- a/drivers/infiniband/hw/mlx5/main.c +++ b/drivers/infiniband/hw/mlx5/main.c @@ -3664,6 +3664,8 @@ static int mlx5_port_immutable(struct ib_device *ibdev, u32 port_num, immutable->pkey_tbl_len = attr.pkey_tbl_len; immutable->gid_tbl_len = attr.gid_tbl_len; immutable->core_cap_flags = get_core_cap_flags(ibdev, &rep); + if (mlx5_lag_is_roce(dev->mdev)) + immutable->core_cap_flags |= RDMA_CORE_CAP_BONDING_FAILOVER; immutable->max_mad_size = IB_MGMT_MAD_SIZE; return 0; diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h index ab6b9af1a6d3..24c15e7bb586 100644 --- a/include/rdma/ib_verbs.h +++ b/include/rdma/ib_verbs.h @@ -650,6 +650,8 @@ void rdma_free_hw_stats_struct(struct rdma_hw_stats *stats); #define RDMA_CORE_CAP_IW_CM 0x00000008 #define RDMA_CORE_CAP_IB_SA 0x00000010 #define RDMA_CORE_CAP_OPA_MAD 0x00000020 +/* Existing QPs can switch bond members without replacing their GIDs. */ +#define RDMA_CORE_CAP_BONDING_FAILOVER 0x00000040 /* Address format 0x000FF000 */ #define RDMA_CORE_CAP_AF_IB 0x00001000 -- 2.43.0