From patchwork Thu Mar 22 14:28:55 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Salil Mehta X-Patchwork-Id: 132285 Delivered-To: patch@linaro.org Received: by 10.46.84.29 with SMTP id i29csp919557ljb; Thu, 22 Mar 2018 07:30:24 -0700 (PDT) X-Google-Smtp-Source: AG47ELspWDb/kiJflALLTLRmRTmxG+c8mNV1FpidGV6PQKieJGvbQO0YypR99AJjc10uSciITQSB X-Received: by 10.98.104.71 with SMTP id d68mr11310783pfc.116.1521729024763; Thu, 22 Mar 2018 07:30:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521729024; cv=none; d=google.com; s=arc-20160816; b=y01+7uj8F9kO3o3VqtY8teLPhnyp5tuz+bqpbPu/SABjPJuiI6H0fgTaLD3Nnl8cNf wz8fBvZYRdc+WIAo1KYXosHbiIDCUBY8TKfsArDCToQxmbcfBtgnITSVZx8xKjVwBdaK mEvf/6Gk7mmfLH7ShOfsAmnvrdTpKDRG3Y/8nqaU+qZbQfI23yzbegc2KzQppZ0Mym28 OCpc8R/5mwDChYBNfTanD3SmTBfx6EiMdnHQnQeANYDOIukC4ttcDnT3Z3+OBykL0fEe 1VjB3fjawVX6xMUOb967DdBJaBWoTLexmVITnTcn6ne9xWJEb0cuQ5qagRHwbzVirkLh CzaA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:arc-authentication-results; bh=FIoyOErJ9OYOCEni8E9FG5YKiFlB276NaL4ZoI47Kyc=; b=d1flu/DmgB8ICPexmisMHbLTiFq8QcEgCbJNzdOM3y14kHDjGQCIY0rppexqxwe5oj mDu27S9K1RCFLs/CiCpQ8o8Dmi2HNJXmLSTAUNVRHPRMhpam39QLPnD/PLWuLR8Fc6T5 n8YGPxvd6C3IGfit3fsyFyNIAvdR6ez0KRyFa8dmoeFsUE5qU4/CJuuzzIhhxbny54AD GWJrITxuw0OPa8JDCopLSp2jl8w0P5RvZsMkN2xdXZh2pq+BGRiTsXqU8ye5nLYRITHP 8WHESOFhjH0hTef32THlaVN7YyZu1GBMlIO9+5ep5hqwTlZMEkiWIKkXmi0AuH0PUTY5 hZ5w== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z61-v6si3565224plb.200.2018.03.22.07.30.24; Thu, 22 Mar 2018 07:30:24 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756048AbeCVOaW (ORCPT + 28 others); Thu, 22 Mar 2018 10:30:22 -0400 Received: from szxga06-in.huawei.com ([45.249.212.32]:45602 "EHLO huawei.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1754649AbeCVOaR (ORCPT ); Thu, 22 Mar 2018 10:30:17 -0400 Received: from DGGEMS401-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 835301BC9712D; Thu, 22 Mar 2018 22:30:02 +0800 (CST) Received: from S00293818-DELL1.china.huawei.com (10.202.226.47) by DGGEMS401-HUB.china.huawei.com (10.3.19.201) with Microsoft SMTP Server id 14.3.361.1; Thu, 22 Mar 2018 22:29:52 +0800 From: Salil Mehta To: CC: , , , , , Subject: [PATCH net-next 4/9] net: hns3: Add support to request VF Reset to PF Date: Thu, 22 Mar 2018 14:28:55 +0000 Message-ID: <20180322142900.22860-5-salil.mehta@huawei.com> X-Mailer: git-send-email 2.8.3 In-Reply-To: <20180322142900.22860-1-salil.mehta@huawei.com> References: <20180322142900.22860-1-salil.mehta@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.202.226.47] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org VF driver depends upon PF to eventually reset the hardware. This request is made using the mailbox command. This patch adds the required function to acheive above. Signed-off-by: Salil Mehta --- .../net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) -- 2.7.4 diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c index 0d204e2..b648311 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c @@ -832,6 +832,20 @@ static void hclgevf_reset_tqp(struct hnae3_handle *handle, u16 queue_id) 2, true, NULL, 0); } +static int hclgevf_do_reset(struct hclgevf_dev *hdev) +{ + int status; + u8 respmsg; + + status = hclgevf_send_mbx_msg(hdev, HCLGE_MBX_RESET, 0, NULL, + 0, false, &respmsg, sizeof(u8)); + if (status) + dev_err(&hdev->pdev->dev, + "VF reset request to PF failed(=%d)\n", status); + + return status; +} + static void hclgevf_reset_event(struct hnae3_handle *handle) { struct hclgevf_dev *hdev = hclgevf_ae_get_hdev(handle); @@ -910,6 +924,7 @@ static void hclgevf_reset_service_task(struct work_struct *work) { struct hclgevf_dev *hdev = container_of(work, struct hclgevf_dev, rst_service_task); + int ret; if (test_and_set_bit(HCLGEVF_STATE_RST_HANDLING, &hdev->state)) return; @@ -965,6 +980,10 @@ static void hclgevf_reset_service_task(struct work_struct *work) hdev->reset_attempts++; /* request PF for resetting this VF via mailbox */ + ret = hclgevf_do_reset(hdev); + if (ret) + dev_warn(&hdev->pdev->dev, + "VF rst fail, stack will call\n"); } }