Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp4918777rwl; Mon, 3 Apr 2023 11:28:05 -0700 (PDT) X-Google-Smtp-Source: AKy350ZiDXimZ2oNQWquUwH1tmZp0JJuAVzOyvWiPY25LL6FE/ez9I3rC3s20KOLIQzc/MNBT1Aq X-Received: by 2002:a17:907:986c:b0:946:2fa6:3b85 with SMTP id ko12-20020a170907986c00b009462fa63b85mr21571357ejc.36.1680546485459; Mon, 03 Apr 2023 11:28:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680546485; cv=none; d=google.com; s=arc-20160816; b=y8dSgg7f2ad7ILQuAXx4llH6M5hajEoZbFrCRMXKNx/PhLwjTwwAzuRtT+2SS02bHj yRjRP+2xqO4UQJMaU8KRxrLTf00KEo/VLNchfYuiT5qi/QHCiVIMfkyQ3AtN/3c1QkCx SaD9WEw6aJa36Fi+gZdhj09duPxIxuEImRiWhdly2lZ1TdLns7X9C7N7JXz+nFMWzU5H b20fL7oJUjsmsjsxE+RtHvtkbTKFAEVTw85t+9pd8dndBxkupEm7OkpE3GjX+ViySwmt gXaJkT3avWxl2Dgg0AMAZMGcVSLTkowkLgbx2RUpRgt/BzBmwGqYt4WaalIOO9LaGxLG sZbg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=OGfGoZJ6MsFWxEwUxuivllDL6l2EA8Qap2i8MzaXHiY=; b=KVIM+IDBRTpYwdhGvWbrpXdVWMtcFxyTvxaiyXoL1rQ3dC09qLVzl6OiL/fdLqSXWF lrXiURmLVYpJWbLX/Al5eRBuCmFjEQRHseJFQ8Yy3TDu5xr+RvyyIRa+OfpESWez27Sx ZppAt/hxV7wQedWRIwr6tb+bWWfvbB5ZMNpbGyCTAmAHjp2bVlE4C2k9BnoMjPv7iam+ GVryZz2iabnIj4zhQ5bzU7rMaycgISxYmmMYrwwzRXtfP3HGSKwU5OVHZEfCo7s93juw L36mHZtkJIoIHDy4moccRUr9prkhKc791JcyjRoEJhKhbuZ9Mn+D/beOVqz/h2RF6iPg 9o7Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=mlFtLysx; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id pv4-20020a170907208400b0093ad46081fdsi3411715ejb.6.2023.04.03.11.27.40; Mon, 03 Apr 2023 11:28: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=@kernel.org header.s=k20201202 header.b=mlFtLysx; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232241AbjDCSVN (ORCPT + 99 others); Mon, 3 Apr 2023 14:21:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45188 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229689AbjDCSVM (ORCPT ); Mon, 3 Apr 2023 14:21:12 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 63EC71FD0; Mon, 3 Apr 2023 11:21:11 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E427D6259F; Mon, 3 Apr 2023 18:21:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 80A31C433D2; Mon, 3 Apr 2023 18:21:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1680546070; bh=hS/VW/TmI+v9QWd3BkT134CkMeiHYQz/F42CtU77k/M=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=mlFtLysxR/1n/VdHAV3icMCupfxFR65LyXMYSMwKqCe6l+LADE+L7gN5AmBIrOMVM cpihKXbrJsAxJ1GG70v9/Amx9j1UCvMEhehd9KfyNvzNEFkxCq0ZttpP/GJe7zMLRT 7sPljFIXVjwyBwynzHaOklVv17QGvz0on7TXi9Zax4OLVeFoDupHyjC9pXlioTV2eJ I6E/X1q+bDT3BVZCywPU6DVKgZwYhJBrk8CUK6HjR+Ns9vqfCJMpOKVb1/yE5vPlEz RAi+AzAHk9hGLMBwYOQnIAJ6tQwn3IpoICAWL37rl8rem2rqZXh3nBDB39nlYJ4PP8 ZttOWWK1r875w== Date: Mon, 3 Apr 2023 21:21:05 +0300 From: Leon Romanovsky To: Niklas Schnelle Cc: Saeed Mahameed , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Gerd Bayer , Alexander Schmidt , netdev@vger.kernel.org, linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] net/mlx5: stop waiting for PCI link if reset is required Message-ID: <20230403182105.GC4514@unreal> References: <20230403075657.168294-1-schnelle@linux.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230403075657.168294-1-schnelle@linux.ibm.com> X-Spam-Status: No, score=-2.5 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS autolearn=unavailable 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 On Mon, Apr 03, 2023 at 09:56:56AM +0200, Niklas Schnelle wrote: > after an error on the PCI link, the driver does not need to wait > for the link to become functional again as a reset is required. Stop > the wait loop in this case to accelerate the recovery flow. > > Co-developed-by: Alexander Schmidt > Signed-off-by: Alexander Schmidt > Signed-off-by: Niklas Schnelle > --- > drivers/net/ethernet/mellanox/mlx5/core/health.c | 12 ++++++++++-- > 1 file changed, 10 insertions(+), 2 deletions(-) > > diff --git a/drivers/net/ethernet/mellanox/mlx5/core/health.c b/drivers/net/ethernet/mellanox/mlx5/core/health.c > index f9438d4e43ca..81ca44e0705a 100644 > --- a/drivers/net/ethernet/mellanox/mlx5/core/health.c > +++ b/drivers/net/ethernet/mellanox/mlx5/core/health.c > @@ -325,6 +325,8 @@ int mlx5_health_wait_pci_up(struct mlx5_core_dev *dev) > while (sensor_pci_not_working(dev)) { According to the comment in sensor_pci_not_working(), this loop is supposed to wait till PCI will be ready again. Otherwise, already in first iteration, we will bail out with pci_channel_offline() error. Thanks > if (time_after(jiffies, end)) > return -ETIMEDOUT; > + if (pci_channel_offline(dev->pdev)) > + return -EIO; > msleep(100); > } > return 0; > @@ -332,10 +334,16 @@ int mlx5_health_wait_pci_up(struct mlx5_core_dev *dev) > > static int mlx5_health_try_recover(struct mlx5_core_dev *dev) > { > + int rc; > + > mlx5_core_warn(dev, "handling bad device here\n"); > mlx5_handle_bad_state(dev); > - if (mlx5_health_wait_pci_up(dev)) { > - mlx5_core_err(dev, "health recovery flow aborted, PCI reads still not working\n"); > + rc = mlx5_health_wait_pci_up(dev); > + if (rc) { > + if (rc == -ETIMEDOUT) > + mlx5_core_err(dev, "health recovery flow aborted, PCI reads still not working\n"); > + else > + mlx5_core_err(dev, "health recovery flow aborted, PCI channel offline\n"); > return -EIO; > } > mlx5_core_err(dev, "starting health recovery flow\n"); > > base-commit: 7e364e56293bb98cae1b55fd835f5991c4e96e7d > -- > 2.37.2 >