Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp3835897ybb; Mon, 6 Apr 2020 17:09:22 -0700 (PDT) X-Google-Smtp-Source: APiQypLQTAGajuG9kJw/FmoRcUZQhM0O2F8vQCQaaHKwcpXnjN6njRlLEzElRAhB6PGPGqWfp5Rj X-Received: by 2002:a05:6808:abc:: with SMTP id r28mr1479302oij.161.1586218162775; Mon, 06 Apr 2020 17:09:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586218162; cv=none; d=google.com; s=arc-20160816; b=XbGqOBfZ4ohxM1Ap5wINsLagMTlx9QkhnoOpMub+4M+kiD08g0rX9BalP0F9I5ddrK qQbmdESfABxlLRd2DL4ac0BZkm2hG28gNigdM6K9wpGU8QmrKglc4aVehxepF6MdkmT1 bm1iFcDTowOWYnqnkqa/4GSIGlVXRqbt3wQIOvfowau/dFryqSTZKPOpvbSxe5ru9Tzm bOTMcjiQ1EAPTeOfcn1i2ef8hvwTkdnkZk0Btvkk/65w/JSiC8VVZTWism3V9pogLm79 wTN1GxXG2fHnwgTAmzVgn/bU6OjLFLq2/gLvq6uZQgQWWxW6HIcDubzfKFvtvFwpC+fG NG2g== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=/Klz+Xs8PF3e4QJPZvEXVy0/KCG4tuyny83vV4nKyqU=; b=XLDwsMW9/kK1mHSdi1DImSUmhIZOu0hzQ6T94N8hescBPOK+n8xoSqn19X+hamyJi6 mxbVvbN4T4xxR4HPjDUtxwTDGoeiFbiavKbAEtQrOaH2850zreVBDRi3OFB7hNnFZ/av NJAKg5m6kA8JnI6+p0M6wBA0J6nVJCs/vdYyXrKVZPsitv3TjzSoV1mDRxkxRtpn6HSe fwRUgHhYl4FJ2z8I7hsgSNHTHtpZWFeThH6EBhgmr7zg1fxEYEyY+TC4OqvP/JFUSLt5 d/F0mi6LMYfqipnU6lpj6JH1gCTGbaK5G4g+p4KZ8tglJM4V+STAi1GYTgbgtl9G4hT+ VifQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=pfW+VS4s; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u191si7743612oia.148.2020.04.06.17.09.10; Mon, 06 Apr 2020 17:09:22 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=pfW+VS4s; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S1726469AbgDGAIp (ORCPT + 99 others); Mon, 6 Apr 2020 20:08:45 -0400 Received: from mail.kernel.org ([198.145.29.99]:34304 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726795AbgDGABZ (ORCPT ); Mon, 6 Apr 2020 20:01:25 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id DA61720857; Tue, 7 Apr 2020 00:01:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1586217684; bh=uCDUcXmEwX5SSUfpabvQs8S1gdekkxZT6ihr0BNLMug=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pfW+VS4sMb8Ipvjb61jX0bbHN5aL12raeeSS0aTdXpQCt3SEhtRJKtr9PvwCwvqrj WOCr2G2xYqprl+gC8Ynx/ZfxD+PxV01oGY/B77yZ4HXs+Fs8R/MpHKfFcNBV4cDB8q CNE7NiQiXT1N7afgHl43Ihqu91u3Rle/BuK76gSA= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Luo bin , "David S . Miller" , Sasha Levin , netdev@vger.kernel.org Subject: [PATCH AUTOSEL 5.5 20/35] hinic: fix a bug of waitting for IO stopped Date: Mon, 6 Apr 2020 20:00:42 -0400 Message-Id: <20200407000058.16423-20-sashal@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200407000058.16423-1-sashal@kernel.org> References: <20200407000058.16423-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore 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