From patchwork Fri Feb 7 21:36:16 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Long Li X-Patchwork-Id: 13965962 Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 170151DED59; Fri, 7 Feb 2025 21:36:29 +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=1738964191; cv=none; b=s5VAm4UVZLQPCIpdnRKrE91FFJ0Ai3Xtt6ot5PcLLw+SKdJu4ICOjI0rfiqVGBePHdPh2DXLL+fPcA6sDM/gxZseHHTy5ATpljVo69f8teD/GVBpSkzHrUzuINgeVNU0M9ahvmmGYFo8mP137Z586FqqfPSQQnlkww5oGUqaUVk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738964191; c=relaxed/simple; bh=fUqDe7cZ8thgwnV6PvYj/xBO91HIMA9ZeF/Fs78UA8s=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=HzFJx+9NKg7JIm6tOxtaSA06bWFozKdQCCfSRXJPZh1qi+4XrEBm4oesnR50D6LOtRw32CWqA/vI4+YbeDSYlA52izba6L8S2YekAzc8S5dBUtlnYbUeXLvI7bUkDNPDmNRSqt/6B+0CNP8gjhOAOqA5sqmUVlORopjfchVjhwo= 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=QLnsWFc9; 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="QLnsWFc9" Received: by linux.microsoft.com (Postfix, from userid 1202) id B82C42107309; Fri, 7 Feb 2025 13:36:29 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com B82C42107309 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxonhyperv.com; s=default; t=1738964189; bh=S5jAkLUptiFKhzApn3CtSlg4k9H2uw5xSxtSyuCu5d4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QLnsWFc9jyw/fhewq+PwXSrnOqkC2xlMWkmGmyzuQPwc0zMWYkyc6PgO8tIY47O3g 9N8/SJLMJVTdw6uDfaiLQ1hd0S+dQI9jZAESaSy2/UzTuPwBWIOtk9KWcUyXLa0zkq cWQeBqiFhiLkk7V3brQYwloC/IVdbb/fwYSHMyF8= 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 v2 1/3] IB/core: Do not use netdev IP if it is a bonded slave Date: Fri, 7 Feb 2025 13:36:16 -0800 Message-Id: <1738964178-18836-2-git-send-email-longli@linuxonhyperv.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1738964178-18836-1-git-send-email-longli@linuxonhyperv.com> References: <1738964178-18836-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 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 Fri Feb 7 21:36:17 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Long Li X-Patchwork-Id: 13965963 Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by smtp.subspace.kernel.org (Postfix) with ESMTP id EA1F21DE8BE; Fri, 7 Feb 2025 21:36:30 +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=1738964192; cv=none; b=VKc20oxZFJKI+oZAM6Qhews+qexUSxURDq7GaaRW2emSwGD42jGEObD+lArRDIS3L0EGAKlfZl74HQrJFfsHoEAnf51+YAL7hZsrYvQfq8TWrBQw1PVtCVfELkOX0rl8Z9cfIqt0GIPmGkE+mSQ5VuKoPhaD7/4UAuemV+sRnnw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738964192; c=relaxed/simple; bh=Y7JShV87JQui8z8Kq0zo04B7QAsEUBHZ8lK3Bey/muM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=O0Jdvil1/5W2Vv/FvcsqRSBO4V8Izhb9GbCfcWy6R8g9Gd9wgWOe+24rPs402F9MtO+ZO4lxM+2/612GTy0JqgpsytbCaHo+zmCt2UQURz49fOM7xSN/mtuGt7+0NMF68uSH1Bv1T4jTl8zFr2B4x2yloP6160OYGoAQZUiqf+g= 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=kxhJqypL; 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="kxhJqypL" Received: by linux.microsoft.com (Postfix, from userid 1202) id 99EF5210730B; Fri, 7 Feb 2025 13:36:30 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 99EF5210730B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxonhyperv.com; s=default; t=1738964190; bh=VAlHqRuRE25gELVSBtg9v7fPPGM97BHmG3MoyZtc4mA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kxhJqypLbKEVeqmTA+DrpV05WekEdic3XZZQJxvhEQ1as1Mq6ahUwnMx5gZvyNONk wNcDQybVqHllhpraO3M7ojw0HeTiQaI7cIct9Tobt7rR/hcNYMv9qbVEk6rg2DN2Jm QEWukpT7FLRVSCRlTwDPIzD070gaMUUkcJm+G81M= 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 v2 2/3] IB/core: Use upper_device_filter to add upper ips Date: Fri, 7 Feb 2025 13:36:17 -0800 Message-Id: <1738964178-18836-3-git-send-email-longli@linuxonhyperv.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1738964178-18836-1-git-send-email-longli@linuxonhyperv.com> References: <1738964178-18836-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() in ndev_event_link() 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 ndev_event_unlink, in that they both look 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 Fri Feb 7 21:36:18 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Long Li X-Patchwork-Id: 13965964 Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A333D1DEFC5; Fri, 7 Feb 2025 21:36:31 +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=1738964193; cv=none; b=YLPCjTOofcGLSNomglTKTv7uUE384+oLotBPwPwtbdUbUbSHan9eCCmziHnQGibnGEgm+oBSfb5Gebce839sMgyj4V55RrE6gMAQsXr0t6NyBUDiDxj+SNX2vrviMjSWeHMaxTjVi4G24ydsDnHJxCSpegcHcrENu78G7BTl5QQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738964193; c=relaxed/simple; bh=kBk5n7e7YJCpfbGRhK9SaKPheVXPph07wJ/EAM2JhEE=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=pD0evOmTwX37HfjDE3/6pbdnIQw9zhCzPglsG8fZdSfVW5Mj5m9w65RUWa3uxk8+kNRRfHTav0zR3/EBUHHfih0mrvvr9W82sy8lqvvSYWMyRnwwZDYVPDTGuitUogcfQp7ib9cs8T6kZhZ4M5vFqz7oNEHp10Kh/f17aCY38E0= 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=qMFRJrRt; 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="qMFRJrRt" Received: by linux.microsoft.com (Postfix, from userid 1202) id 51F60210730A; Fri, 7 Feb 2025 13:36:31 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 51F60210730A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxonhyperv.com; s=default; t=1738964191; bh=S2tBTsh8o3n5q7814riIx8uxj6+JAvTpQ4Ij2rHolYE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qMFRJrRtSTypiO6DnFUMFLldt9lp0LJN/QwtwebqRQTQWXP1YRsy93vmMx73/OKzp jc8cqd9vV4/JQmtSZ0LQy3R/KLrzQ7Mm1rbXXOvFKmnPSx2SQE3gXDlGRVFz4yuyp1 ms+Q/QR1ftsnbPcmMhtq16vkFVDEnFuVMdSMxsUo= 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 v2 3/3] IB/core: Add default IP when a slave is unlinked Date: Fri, 7 Feb 2025 13:36:18 -0800 Message-Id: <1738964178-18836-4-git-send-email-longli@linuxonhyperv.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1738964178-18836-1-git-send-email-longli@linuxonhyperv.com> References: <1738964178-18836-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 unlinked, 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) {