From patchwork Wed Nov 27 19:43:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Long Li X-Patchwork-Id: 13887336 Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BEF08140E38; Wed, 27 Nov 2024 19:43:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=13.77.154.182 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732736627; cv=none; b=VBQOQLawLanTyS0p+krB4YlzydUAgMFzXmDEqGY0jlyf//4Ciz2RCnmetG0q+RdgIWYENvhC2NL2g7h5K/y6yB8rTs2G0eDVYv9me3dXhp0CZ4f7Z/PN/PkLo12v68LRU5ylgZjEWhEzGTe7pRVDlYJNI/5fCmTNpLUAVn5hzsk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732736627; c=relaxed/simple; bh=B/qu1WrdEwSkKI4jj4obY/PvsecyApEC/RL44xsaADk=; h=From:To:Cc:Subject:Date:Message-Id; b=HwaRQHyB8BqVnl+VMGGVRN+gHb2kIr6YU+eqtLO2QGOzO0jIAhZdJSbqXd1Ls+mx4Ci5s7/VQzY29iRBFnEt2zuJXT2VVoTOSUjwgxP6nMsSL1Gqg4+9qfqLD7vayPU4cwUHCUd4Zf3YHo3fooZbGKm3m9BorYJ//75IydcozPM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linuxonhyperv.com; spf=pass smtp.mailfrom=linux.microsoft.com; dkim=pass (1024-bit key) header.d=linuxonhyperv.com header.i=@linuxonhyperv.com header.b=HkPep5Ah; arc=none smtp.client-ip=13.77.154.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linuxonhyperv.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.microsoft.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxonhyperv.com header.i=@linuxonhyperv.com header.b="HkPep5Ah" Received: by linux.microsoft.com (Postfix, from userid 1202) id 7F6DC2064AE8; Wed, 27 Nov 2024 11:43:45 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 7F6DC2064AE8 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxonhyperv.com; s=default; t=1732736625; bh=jkI17VqvzA8ChaHeNeFWrLsb7si+GzmH/qVd0R1oknw=; h=From:To:Cc:Subject:Date:From; b=HkPep5AhZSlUVxAwwQaaQe3/zEJsTcHF3CoyKhxNzbOn0DQuuDX7BzoQORaaP8Qt9 6uwxuZTqA948BXaGysVJkqzwdCGReRnhKdL5YBKVAxk1da0ucke2OVaDX+pS8aVIQU F06V3Dsb1VPZHUW049INNV3l/fjLebpA1TDE4Lek= From: longli@linuxonhyperv.com To: Jason Gunthorpe , Leon Romanovsky , Ajay Sharma , Konstantin Taranov , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: linux-rdma@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hyperv@vger.kernel.org, Long Li Subject: [PATCH 1/3] RDMA/core: Do not use netdev if it is a bonded slave Date: Wed, 27 Nov 2024 11:43:36 -0800 Message-Id: <1732736619-19941-1-git-send-email-longli@linuxonhyperv.com> X-Mailer: git-send-email 1.8.3.1 Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: From: Long Li Filter function is_eth_port_of_netdev_filter() is used to determine if a netdev should be used for assigning its IP to GID cache. This function should filter out bonded slave netdevs. For bonded slaves, their master netdevs should be used to cache GIDs. Signed-off-by: Long Li --- drivers/infiniband/core/roce_gid_mgmt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/infiniband/core/roce_gid_mgmt.c b/drivers/infiniband/core/roce_gid_mgmt.c index a9f2c6b1b29e..27a3ffed11b9 100644 --- a/drivers/infiniband/core/roce_gid_mgmt.c +++ b/drivers/infiniband/core/roce_gid_mgmt.c @@ -161,7 +161,7 @@ is_eth_port_of_netdev_filter(struct ib_device *ib_dev, u32 port, res = ((rdma_is_upper_dev_rcu(rdma_ndev, cookie) && (is_eth_active_slave_of_bonding_rcu(rdma_ndev, real_dev) & REQUIRED_BOND_STATES)) || - real_dev == rdma_ndev); + (real_dev == rdma_ndev && !netif_is_bond_slave(rdma_ndev))); rcu_read_unlock(); return res; From patchwork Wed Nov 27 19:43:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Long Li X-Patchwork-Id: 13887338 Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6040D20127A; Wed, 27 Nov 2024 19:43:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=13.77.154.182 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732736634; cv=none; b=roXIsahTRKJ0B1Z/+2a70QJajiK5llT6/6/Zi9qBGxZ0P6v9C/09TBvZekieJ4jihz4llDqnaEYwTep3BqTEVh/Up9uZaDRuDAB6rSKBtQ8irDlft1F5dd6ePyNZ0g32SnFD/RjBnTl1M0ihrWt7+6fxTHFMVpx897s4LhLj7nQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732736634; c=relaxed/simple; bh=VjdZMSBTqQmt8MS8VcgzWUrywQMhF+ejjUTwAdLn8g8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=CYQkNtnJnSEu0Jo52LJWvA90Zw45FTxmwGaEpYvyoB3Tp8FMVuur8S/wtgNlentE9Opf6mISNgyGS2IuWxbzqM/7xV50SGLb22tEdWlDnM2yK/ykeLReKY8Ab5ZgHK/PT4xwIA1Ybtcy6HX5OzrXQNAtcSukN9IFbI2yAXI5qKs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linuxonhyperv.com; spf=pass smtp.mailfrom=linux.microsoft.com; dkim=pass (1024-bit key) header.d=linuxonhyperv.com header.i=@linuxonhyperv.com header.b=MA1D0sOD; arc=none smtp.client-ip=13.77.154.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linuxonhyperv.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.microsoft.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxonhyperv.com header.i=@linuxonhyperv.com header.b="MA1D0sOD" Received: by linux.microsoft.com (Postfix, from userid 1202) id 24A512053044; Wed, 27 Nov 2024 11:43:53 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 24A512053044 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxonhyperv.com; s=default; t=1732736633; bh=+ReGDBRQsglb0WbCjD6PRcmDNwnpaJULXY2QpsVOiw4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MA1D0sODyVYYwKU5Jg+AGPAaESDYsj7UtZWJJebWZh6kdtJ9foPhgWANrfq6RMOp9 VXJqAJv7dMZ6yKwHMZ8W5XJX7H/hfQyQhdRM6V2HIE6DgJYb6SPhOVPyVzRJTwTY1n sqMEAUrYJ+bYYQd0aX7Q0yi0lGVoBbPoOkgL+Ti0= From: longli@linuxonhyperv.com To: Jason Gunthorpe , Leon Romanovsky , Ajay Sharma , Konstantin Taranov , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: linux-rdma@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hyperv@vger.kernel.org, Long Li Subject: [PATCH 2/3] RDMA/core: Use upper_device_filter() to add upper IPs Date: Wed, 27 Nov 2024 11:43:38 -0800 Message-Id: <1732736619-19941-3-git-send-email-longli@linuxonhyperv.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1732736619-19941-1-git-send-email-longli@linuxonhyperv.com> References: <1732736619-19941-1-git-send-email-longli@linuxonhyperv.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: From: Long Li add_cmd_upper_ips() is used to add upper IPs on a bonded slave. Its filter function should be set to the same as upper_ips_del_cmd() in that it looks for upper netdevs for GIDs. Signed-off-by: Long Li --- drivers/infiniband/core/roce_gid_mgmt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/infiniband/core/roce_gid_mgmt.c b/drivers/infiniband/core/roce_gid_mgmt.c index 27a3ffed11b9..827a50dbd308 100644 --- a/drivers/infiniband/core/roce_gid_mgmt.c +++ b/drivers/infiniband/core/roce_gid_mgmt.c @@ -689,7 +689,7 @@ static const struct netdev_event_work_cmd add_cmd = { static const struct netdev_event_work_cmd add_cmd_upper_ips = { .cb = add_netdev_upper_ips, - .filter = is_eth_port_of_netdev_filter + .filter = upper_device_filter }; static void From patchwork Wed Nov 27 19:43:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Long Li X-Patchwork-Id: 13887339 Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 222E62036E6; Wed, 27 Nov 2024 19:43:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=13.77.154.182 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732736635; cv=none; b=P85bPC1u8SHUPn5Yn5045XdqASrylVGD1IbJlbpH4KHREDygFJ/ZfYkhCFhgQiKxzSISo/uBw5Vz0883Cmor3YFrbHVvNqjf5Q++hkNdLNLrOi+MYOh4zEd8XvwlxYX6XuKQxuavm4/n9TrbEYDPqCIO2NQQ54YQiGvqVAGAArw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732736635; c=relaxed/simple; bh=amMeqmNncw4zHhFLJX1U/wYVj/cTe9YiRbOJPdQevvM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=TgS2iB1Ml5ZtNN4LaTCv1J+0NtN0F5Mm8XM+/aujIEj5bP3xbd57LkB/fympscvezoVUIgCyxcJ/34uX3k4XyTfiOf0usI8tJrpYZR1pfymOFPioh/kpgLW4UaQsA4Ct+V/HkhXMCskxUpl41iSkDUciGkp16AAxwoRazhDyA5k= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linuxonhyperv.com; spf=pass smtp.mailfrom=linux.microsoft.com; dkim=pass (1024-bit key) header.d=linuxonhyperv.com header.i=@linuxonhyperv.com header.b=ZCFj8yN/; arc=none smtp.client-ip=13.77.154.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linuxonhyperv.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.microsoft.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxonhyperv.com header.i=@linuxonhyperv.com header.b="ZCFj8yN/" Received: by linux.microsoft.com (Postfix, from userid 1202) id F01092053040; Wed, 27 Nov 2024 11:43:53 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com F01092053040 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxonhyperv.com; s=default; t=1732736633; bh=NYZtFCtgQTLWuJKAyORzm41pdlgZLp3R3Mvc0/Z+xms=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZCFj8yN/I+MnnJRrLrIOF4qHOrvZntNbPxccTPPCuyX21zsK6ugv0ReiVCEdisVqD 9PrDOGXzaG8qDEOiXiMl8LaOoHkyzTogcYAHm3PyO2h5qeIC+XmTcDUuPcZJxyWVM1 pp0fX3mXF60sWKsGTU8nbwQMcixeJSbIisZLp0OM= From: longli@linuxonhyperv.com To: Jason Gunthorpe , Leon Romanovsky , Ajay Sharma , Konstantin Taranov , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: linux-rdma@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hyperv@vger.kernel.org, Long Li Subject: [PATCH 3/3] RDMA/core: Add default IP when a bonded slave is unlinked Date: Wed, 27 Nov 2024 11:43:39 -0800 Message-Id: <1732736619-19941-4-git-send-email-longli@linuxonhyperv.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1732736619-19941-1-git-send-email-longli@linuxonhyperv.com> References: <1732736619-19941-1-git-send-email-longli@linuxonhyperv.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: From: Long Li When a bonded slave is unlikned, the current code doesn't add a default GID for the new unlinked netdev. Add a default GID for the netdev. Signed-off-by: Long Li --- drivers/infiniband/core/roce_gid_mgmt.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/infiniband/core/roce_gid_mgmt.c b/drivers/infiniband/core/roce_gid_mgmt.c index 827a50dbd308..3fa2740fa0d2 100644 --- a/drivers/infiniband/core/roce_gid_mgmt.c +++ b/drivers/infiniband/core/roce_gid_mgmt.c @@ -692,6 +692,11 @@ static const struct netdev_event_work_cmd add_cmd_upper_ips = { .filter = upper_device_filter }; +static const struct netdev_event_work_cmd add_default_gid_cmd = { + .cb = add_default_gids, + .filter = is_ndev_for_default_gid_filter, +}; + static void ndev_event_unlink(struct netdev_notifier_changeupper_info *changeupper_info, struct netdev_event_work_cmd *cmds) @@ -704,7 +709,8 @@ ndev_event_unlink(struct netdev_notifier_changeupper_info *changeupper_info, cmds[0] = upper_ips_del_cmd; cmds[0].ndev = changeupper_info->upper_dev; - cmds[1] = add_cmd; + cmds[1] = add_default_gid_cmd; + cmds[2] = add_cmd; } static const struct netdev_event_work_cmd bonding_default_add_cmd = { @@ -751,11 +757,6 @@ static void netdevice_event_changeupper(struct net_device *event_ndev, ndev_event_unlink(changeupper_info, cmds); } -static const struct netdev_event_work_cmd add_default_gid_cmd = { - .cb = add_default_gids, - .filter = is_ndev_for_default_gid_filter, -}; - static int netdevice_event(struct notifier_block *this, unsigned long event, void *ptr) {