Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp1403474ybz; Thu, 16 Apr 2020 08:34:04 -0700 (PDT) X-Google-Smtp-Source: APiQypJ3fe+QhqC9c0jualjlxOR+GUfN/R2s/1Q9qVOSqc0PQ6fZd5VYntM27ldmkT/Fsdzxr6oC X-Received: by 2002:a05:6402:16da:: with SMTP id r26mr15764641edx.375.1587051244289; Thu, 16 Apr 2020 08:34:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587051244; cv=none; d=google.com; s=arc-20160816; b=h6ic2YxRVwksuMSQeTqSWkXjYrLWLzNWFBm5ZF/Blhl7cadVby8E+fZIc8W3GDif/Z WiLRkYqdj0K+8J9xWUItZVBwT/gVLAPB7BSnQ0AsBmHjKCzlsWYF1ViyexRDNJfx0C8t G6A6xTH3NfwuTO9L+d5q3OFUr3fdyn3oruCKZnQZhHH7MZ1UBOyR5DA0Q6xcdWM/c3DI AGmd01euHnIEaeXTLE2t99gDooBue8B/3sjqHKqo0f8i5bVjbAQyUGxAh5fSZPJ3v3YT phFfsj5xfmCcnTmsNnCL/ok6q1/rDejCV8UFO7n2zkXYWKj+x0Q47zjl7stpWEKzWHw3 Oxaw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=/Klz+Xs8PF3e4QJPZvEXVy0/KCG4tuyny83vV4nKyqU=; b=lDwA9qxtR3p0NJbM2+VMfZ1TR/42nm7gO+3nDLF1zazzMuttYjr6FOTqYH/u60E0l5 carwCi4heruOYRDZu3rCVBZNc2yPberjwnktMs8gmP6JR7sza792dJGv9isI50wu3xmA sdmeaU0bj4vzm6ARmYOpc3TW/1Dt6iqcGLnN94Nh0hwtt0xAKGjv1dC0SfHiOQYhjJxE jBI21dgK12lMCwtKiYDqb9iF4LnAcyL3bJhr/p3ZL5Atg22oiRLBB+X0gYn4Ko08ov1n PHTe0/QClWxcKdPIYLX2LtkGTe6QuYyQR1+yy/oL4SQVlYDHoDDhbTPGOpUl4RxLsmDE wv4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=slN9vmpO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j2si11478571ejs.138.2020.04.16.08.33.40; Thu, 16 Apr 2020 08:34:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=slN9vmpO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2633363AbgDPPbk (ORCPT + 99 others); Thu, 16 Apr 2020 11:31:40 -0400 Received: from mail.kernel.org ([198.145.29.99]:55862 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2441564AbgDPNmp (ORCPT ); Thu, 16 Apr 2020 09:42:45 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 6479D218AC; Thu, 16 Apr 2020 13:42:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1587044564; bh=uCDUcXmEwX5SSUfpabvQs8S1gdekkxZT6ihr0BNLMug=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=slN9vmpOhHpCeV3fINcEZKNSoCojIbLACAe5snWkP65CfkStwyxUnTNNfjbnBYaK8 hSrU15pMUnZ5UugxWKVK733dMWh7IPNF0fkwn6OP7pnz91lsoLm0Eu+IGrShaUYbS7 OcrPPqNg7HadKZd5Anipk9Gs2eyNE8FRgoQwodd4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Luo bin , "David S. Miller" , Sasha Levin Subject: [PATCH 5.4 012/232] hinic: fix a bug of waitting for IO stopped Date: Thu, 16 Apr 2020 15:21:46 +0200 Message-Id: <20200416131317.942485260@linuxfoundation.org> X-Mailer: git-send-email 2.26.1 In-Reply-To: <20200416131316.640996080@linuxfoundation.org> References: <20200416131316.640996080@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Luo bin [ Upstream commit 96758117dc528e6d84bd23d205e8cf7f31eda029 ] it's unreliable for fw to check whether IO is stopped, so driver wait for enough time to ensure IO process is done in hw before freeing resources Signed-off-by: Luo bin Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- .../net/ethernet/huawei/hinic/hinic_hw_dev.c | 51 +------------------ 1 file changed, 2 insertions(+), 49 deletions(-) diff --git a/drivers/net/ethernet/huawei/hinic/hinic_hw_dev.c b/drivers/net/ethernet/huawei/hinic/hinic_hw_dev.c index 79b3d53f2fbfa..c7c75b772a866 100644 --- a/drivers/net/ethernet/huawei/hinic/hinic_hw_dev.c +++ b/drivers/net/ethernet/huawei/hinic/hinic_hw_dev.c @@ -360,50 +360,6 @@ static int wait_for_db_state(struct hinic_hwdev *hwdev) return -EFAULT; } -static int wait_for_io_stopped(struct hinic_hwdev *hwdev) -{ - struct hinic_cmd_io_status cmd_io_status; - struct hinic_hwif *hwif = hwdev->hwif; - struct pci_dev *pdev = hwif->pdev; - struct hinic_pfhwdev *pfhwdev; - unsigned long end; - u16 out_size; - int err; - - if (!HINIC_IS_PF(hwif) && !HINIC_IS_PPF(hwif)) { - dev_err(&pdev->dev, "Unsupported PCI Function type\n"); - return -EINVAL; - } - - pfhwdev = container_of(hwdev, struct hinic_pfhwdev, hwdev); - - cmd_io_status.func_idx = HINIC_HWIF_FUNC_IDX(hwif); - - end = jiffies + msecs_to_jiffies(IO_STATUS_TIMEOUT); - do { - err = hinic_msg_to_mgmt(&pfhwdev->pf_to_mgmt, HINIC_MOD_COMM, - HINIC_COMM_CMD_IO_STATUS_GET, - &cmd_io_status, sizeof(cmd_io_status), - &cmd_io_status, &out_size, - HINIC_MGMT_MSG_SYNC); - if ((err) || (out_size != sizeof(cmd_io_status))) { - dev_err(&pdev->dev, "Failed to get IO status, ret = %d\n", - err); - return err; - } - - if (cmd_io_status.status == IO_STOPPED) { - dev_info(&pdev->dev, "IO stopped\n"); - return 0; - } - - msleep(20); - } while (time_before(jiffies, end)); - - dev_err(&pdev->dev, "Wait for IO stopped - Timeout\n"); - return -ETIMEDOUT; -} - /** * clear_io_resource - set the IO resources as not active in the NIC * @hwdev: the NIC HW device @@ -423,11 +379,8 @@ static int clear_io_resources(struct hinic_hwdev *hwdev) return -EINVAL; } - err = wait_for_io_stopped(hwdev); - if (err) { - dev_err(&pdev->dev, "IO has not stopped yet\n"); - return err; - } + /* sleep 100ms to wait for firmware stopping I/O */ + msleep(100); cmd_clear_io_res.func_idx = HINIC_HWIF_FUNC_IDX(hwif); -- 2.20.1