From patchwork Thu Mar 22 14:28:59 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Salil Mehta X-Patchwork-Id: 132286 Delivered-To: patch@linaro.org Received: by 10.46.84.29 with SMTP id i29csp919693ljb; Thu, 22 Mar 2018 07:30:29 -0700 (PDT) X-Google-Smtp-Source: AG47ELsjjvIh09f7yH9VebhcN/3NygEH6s+xFvGcBc16+5YZz/tTMDqVImWbRT/78dTZO5I58/Lc X-Received: by 2002:a17:902:529:: with SMTP id 38-v6mr25615830plf.64.1521729029795; Thu, 22 Mar 2018 07:30:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521729029; cv=none; d=google.com; s=arc-20160816; b=RtvgrTvjJuL8E796AqR1eqQRY+ahMp7OXXIT1rXt/UyyWnE+DxwxQQ3/r74xjkmtDR 1JjkErmg2uXj7LQ0XYpRNAiuSjdg1QB8RAas5z46PYTymFHNpRocFJIKCvE5pW78SuM3 T7JMu+rh2vYrvYb4Z8T8axL0cxV0jeKJj8Ak0Hn187ECrKJ4gYLfFzqjIH6kVIRdHZXf uXOC8O5mim98HKItM8KHi2rj97gbljrvl6N/eMTHcxDr+5yLY57aaGO/QDvgra7oo9b8 8yE/MzOowbYYdHJVASz3hno//Ox27/UiqIESXKZ/oE+m+Su6F4UAPlORzkCoIKgvesJu cy0Q== 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=aFX6yljQgthFosMDd19x+ag3oNXTSy0kY58EI0g2aQ0=; b=lUZj6nAuSOzZrq4w9OzYAPwlyj2ter1v5V/NrNr06HqBRZV5PbnptX8zEFqzMC8BQH hkabX9tVYkQxp96Tt4N09e08SUplzuudKaiGz0uOVQFJNSYaHla4avGa1ZhFTu4Zptzp 3fprifRcB3k2QaJTw1MFLTykwa8AHfOB28IWZHX5uRdWt2fsGhmIs0vNpaKtR0HDQdi+ o4n1E9rj3ljX1448n3h2g9x/N73q9sQfySJZ8h0sqS2fJRUUGwoeNwQS4fcAv9Hl//QL c1B9RWaVIz8sO22SdAQUyNh8CiyPGG6LqaWKMbu6MGmb5qU2YbWPeGizdrT+hJznJwtA cXHg== 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.29; Thu, 22 Mar 2018 07:30:29 -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 S1756066AbeCVOa1 (ORCPT + 28 others); Thu, 22 Mar 2018 10:30:27 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:6261 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753729AbeCVOaX (ORCPT ); Thu, 22 Mar 2018 10:30:23 -0400 Received: from DGGEMS401-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 45D17F9DA1AF9; Thu, 22 Mar 2018 22:30:07 +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:30:02 +0800 From: Salil Mehta To: CC: , , , , , Subject: [PATCH net-next 8/9] net: hns3: Add *Asserting Reset* mailbox message & handling in VF Date: Thu, 22 Mar 2018 14:28:59 +0000 Message-ID: <20180322142900.22860-9-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 Reset Asserting message is forwarded by PF to inform VF about the hardware reset which is about to happen. This might be due to the earlier VF reset request received by the PF or because PF for any reason decides to undergo reset. This message results in VF to go in pending state in which it polls the hardware to complete the reset and then further resets/tears its own stack. Signed-off-by: Salil Mehta --- drivers/net/ethernet/hisilicon/hns3/hclge_mbx.h | 1 + drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_mbx.c | 12 ++++++++++++ 2 files changed, 13 insertions(+) -- 2.7.4 diff --git a/drivers/net/ethernet/hisilicon/hns3/hclge_mbx.h b/drivers/net/ethernet/hisilicon/hns3/hclge_mbx.h index f3e90c2..519e2bd 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hclge_mbx.h +++ b/drivers/net/ethernet/hisilicon/hns3/hclge_mbx.h @@ -11,6 +11,7 @@ enum HCLGE_MBX_OPCODE { HCLGE_MBX_RESET = 0x01, /* (VF -> PF) assert reset */ + HCLGE_MBX_ASSERTING_RESET, /* (PF -> VF) PF is asserting reset*/ HCLGE_MBX_SET_UNICAST, /* (VF -> PF) set UC addr */ HCLGE_MBX_SET_MULTICAST, /* (VF -> PF) set MC addr */ HCLGE_MBX_SET_VLAN, /* (VF -> PF) set VLAN */ diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_mbx.c b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_mbx.c index 7687911..a286184 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_mbx.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_mbx.c @@ -170,6 +170,7 @@ void hclgevf_mbx_handler(struct hclgevf_dev *hdev) } break; case HCLGE_MBX_LINK_STAT_CHANGE: + case HCLGE_MBX_ASSERTING_RESET: /* set this mbx event as pending. This is required as we * might loose interrupt event when mbx task is busy * handling. This shall be cleared when mbx task just @@ -242,6 +243,17 @@ void hclgevf_mbx_async_handler(struct hclgevf_dev *hdev) hclgevf_update_speed_duplex(hdev, speed, duplex); break; + case HCLGE_MBX_ASSERTING_RESET: + /* PF has asserted reset hence VF should go in pending + * state and poll for the hardware reset status till it + * has been completely reset. After this stack should + * eventually be re-initialized. + */ + hdev->nic.reset_level = HNAE3_VF_RESET; + set_bit(HCLGEVF_RESET_PENDING, &hdev->reset_state); + hclgevf_reset_task_schedule(hdev); + + break; default: dev_err(&hdev->pdev->dev, "fetched unsupported(%d) message from arq\n",