From patchwork Sun Aug 13 14:51:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Pavlu X-Patchwork-Id: 135058 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b824:0:b0:3f2:4152:657d with SMTP id z4csp2269170vqi; Sun, 13 Aug 2023 09:05:06 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHAnVPaMM7UIKO5uYt/3dn8GrEW63c0UPPW0bzv0QlCThEenJymgvPC+gwHJAc9CKDkTKom X-Received: by 2002:a05:6a21:7189:b0:140:7b6a:6910 with SMTP id wq9-20020a056a21718900b001407b6a6910mr8360275pzb.34.1691942705962; Sun, 13 Aug 2023 09:05:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691942705; cv=none; d=google.com; s=arc-20160816; b=KgWgiRdH7fn9Mwzg7UvTkvoTrP9K9laznjQwGtWsqfrUAzAvjreRkvuYbQ0diSBn/9 hlqz+9eddXizKJLFFNR5U6IEPrrfZFj+0R7C81K49b7gMAO3JHNGcxloCjgEX/GbU87C vPr26KyOy2FBM5K+IycadZg30AoHnDuGkl76qrM5jkBj+/wwaDgACCzrAJKQwXV0KDsV uFzU6BcHnqRAyyOdSNUsVj/7926Ay/owb/WqHTOzgJVB+XvhLdEzma6tD8jtvO8Wun6H pS1Xdi6u5rj7OGfJZbeOTSqPtcxzPn2lKIHGIUjkC0KB9olsYtNwBhAmtj0X0IuhjJR5 czTQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=O9Q66lEIFKkRcUzjXIAp7yKb9m2EclBPlOJJKm5nUB4=; fh=thUxDq4m5D3FQct5425V7h171/dEmaHUwwAlFhAMPtU=; b=zgNLgsPoEYgxRL7xEPmrBEfnSyr2cGnRYTpJRnr+ujBHAkEnqOwAj0REcqgwvCPeEr /4q8+9ebNpInAl4QejAfEN+P0SRoaB17lz3N56tGpezdBS09PnZuStedYB+xlnBg5Fho m9ST8bn8dpcz6y1Om9Uf6Ue1R0sNpRskZmMB6x2ZToUu1eMs7KB9+pdwyJMq2bAKFWDk M39C0gxV1rfFSC3uFO6yB/P2nigw3bCnjo4auwsE7SUaAgJ4nUa6Fv7Gy0MWIRztf83b GpSNv57wz3yEuX4mMXphjalchYs8jv4Xcch55pVWqN4m4ERliswg0pxRa6F1v9oHWaOC rCXw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=vSobd0sP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a7-20020a634d07000000b00563e0e86f17si6814151pgb.573.2023.08.13.09.04.52; Sun, 13 Aug 2023 09:05:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=vSobd0sP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231443AbjHMOwi (ORCPT + 99 others); Sun, 13 Aug 2023 10:52:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59962 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231312AbjHMOwH (ORCPT ); Sun, 13 Aug 2023 10:52:07 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AC15F170D; Sun, 13 Aug 2023 07:52:08 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 691691F8D5; Sun, 13 Aug 2023 14:52:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1691938325; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=O9Q66lEIFKkRcUzjXIAp7yKb9m2EclBPlOJJKm5nUB4=; b=vSobd0sP/xXfZQBlkq7rVosb8E8cggVOWqNUGH+NY+5Y4IwjB5kFb1VWTaGQ6hGPhlmS4+ TWivho1Kiu/eolnKcgwfnik2cYET8NQkPIJq6ljgbsvgqHpPX3YwGsV2cX96DdohGVUMEr 70+v8KuYVCTIva1xGcJxeZ1ghk8V0/E= Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 325F71322C; Sun, 13 Aug 2023 14:52:05 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id EEeJCxXu2GSDFAAAMHmgww (envelope-from ); Sun, 13 Aug 2023 14:52:05 +0000 From: Petr Pavlu To: tariqt@nvidia.com, yishaih@nvidia.com, leon@kernel.org Cc: davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, jgg@ziepe.ca, netdev@vger.kernel.org, linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org, Petr Pavlu , Leon Romanovsky Subject: [PATCH net-next v2 06/10] mlx4: Avoid resetting MLX4_INTFF_BONDING per driver Date: Sun, 13 Aug 2023 16:51:23 +0200 Message-Id: <20230813145127.10653-7-petr.pavlu@suse.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20230813145127.10653-1-petr.pavlu@suse.com> References: <20230813145127.10653-1-petr.pavlu@suse.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1774130514783463714 X-GMAIL-MSGID: 1774130514783463714 The mlx4_core driver has a logic that allows a sub-driver to set the MLX4_INTFF_BONDING flag which then causes that function mlx4_do_bond() asks the sub-driver to fully re-probe a device when its bonding configuration changes. Performing this operation is disallowed in mlx4_register_interface() when it is detected that any mlx4 device is multifunction (SRIOV). The code then resets MLX4_INTFF_BONDING in the driver flags. Move this check directly into mlx4_do_bond(). It provides a better separation as mlx4_core no longer directly modifies the sub-driver flags and it will allow to get rid of explicitly keeping track of all mlx4 devices by the intf.c code when it is switched to an auxiliary bus. Signed-off-by: Petr Pavlu Tested-by: Leon Romanovsky Reviewed-by: Leon Romanovsky Acked-by: Tariq Toukan --- drivers/net/ethernet/mellanox/mlx4/intf.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx4/intf.c b/drivers/net/ethernet/mellanox/mlx4/intf.c index 8b2c1404cb66..30aead34ce08 100644 --- a/drivers/net/ethernet/mellanox/mlx4/intf.c +++ b/drivers/net/ethernet/mellanox/mlx4/intf.c @@ -96,11 +96,6 @@ int mlx4_register_interface(struct mlx4_interface *intf) list_add_tail(&intf->list, &intf_list); list_for_each_entry(priv, &dev_list, dev_list) { - if (mlx4_is_mfunc(&priv->dev) && (intf->flags & MLX4_INTFF_BONDING)) { - mlx4_dbg(&priv->dev, - "SRIOV, disabling HA mode for intf proto %d\n", intf->protocol); - intf->flags &= ~MLX4_INTFF_BONDING; - } mlx4_add_device(intf, priv); } @@ -155,10 +150,18 @@ int mlx4_do_bond(struct mlx4_dev *dev, bool enable) spin_lock_irqsave(&priv->ctx_lock, flags); list_for_each_entry_safe(dev_ctx, temp_dev_ctx, &priv->ctx_list, list) { - if (dev_ctx->intf->flags & MLX4_INTFF_BONDING) { - list_add_tail(&dev_ctx->bond_list, &bond_list); - list_del(&dev_ctx->list); + if (!(dev_ctx->intf->flags & MLX4_INTFF_BONDING)) + continue; + + if (mlx4_is_mfunc(dev)) { + mlx4_dbg(dev, + "SRIOV, disabled HA mode for intf proto %d\n", + dev_ctx->intf->protocol); + continue; } + + list_add_tail(&dev_ctx->bond_list, &bond_list); + list_del(&dev_ctx->list); } spin_unlock_irqrestore(&priv->ctx_lock, flags);