Received: by 10.223.185.116 with SMTP id b49csp6179707wrg; Thu, 8 Mar 2018 03:13:46 -0800 (PST) X-Google-Smtp-Source: AG47ELu6VwLsz9Pyym34+c4aALpllzjcrfFZTF2w+3CStPqnwQX4FuIqWyNPkzFA8/Y/39885aZY X-Received: by 10.98.73.89 with SMTP id w86mr25789964pfa.227.1520507626068; Thu, 08 Mar 2018 03:13:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520507626; cv=none; d=google.com; s=arc-20160816; b=M3b5h7Vr+8yhHaozeDdjwaPUTtPVHqxzs7+5WHMtSQClDFsvb+yyerdPAeO1lCvPmL zGy/cMt69XFoY27IN7zQ2dNCt4nYdTJh1WM4qFuOC/aXgmV/Ytq2jKQph0v4PWL9gWoP K1L8dVxtV+JFc2bSARhubN/wlvUIHSNdanbehXnZa7a1CJytBPaf751NhdG8hukvWaJN nMDhNxsoVXjhh0CABdeCHs9CBSS5VDryIMUrQc9gEvBHf1UmIFhl0EWkwQs6ZRlOH0va wR/A7VcdSqV/RJaaMBRLFhWZA/f0wYTgQ0tu39QDVOlMKKA0Y/EOJQ7OO7JT+UTNP7iq /YlA== 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=phrcTZZKCb/Mx4IIWeP8JpPAC9xYSIkZ8wn7sXv+EBE=; b=IrtoXT+CZtaMk0nvpDy4GEYjI9E/9Ntshu/oxcSVlwQ9kSXLsMDMjl7bkUayURwQPL KDXmhM8ScJzKErcUiVasBtHlN48NS557H5wqwEfpM5tvd/pg7BuPC/gAkeIBCoOT1gqH oPKWsKSBspffgwNbIXqfposbDv1SBZ0cjipJfu4SO9gjI0/VF9garZ5NnnHsCiZs2KPu MeH634N2b2uWsthHYdzjgzpskYU+lxrHS7SG63tjCV5xkeS24I4QzhBGgz75TBic6cd9 5K0dk1wzT8jMqgudMiSfh0a5zXyDPEtI7+eP+dQLqE6m3wP1DDzNcosquTbkqF1/H+d6 1mxg== 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 43-v6si14667003plb.548.2018.03.08.03.13.31; Thu, 08 Mar 2018 03:13:46 -0800 (PST) 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 S965077AbeCHLMA (ORCPT + 99 others); Thu, 8 Mar 2018 06:12:00 -0500 Received: from szxga05-in.huawei.com ([45.249.212.191]:5766 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1755135AbeCHLKT (ORCPT ); Thu, 8 Mar 2018 06:10:19 -0500 Received: from DGGEMS414-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id B66379784B598; Thu, 8 Mar 2018 19:10:02 +0800 (CST) Received: from linux-ioko.site (10.71.200.31) by DGGEMS414-HUB.china.huawei.com (10.3.19.214) with Microsoft SMTP Server id 14.3.361.1; Thu, 8 Mar 2018 19:09:54 +0800 From: Peng Li To: CC: , , , , Subject: [Patch net-next 4/6] net: hns3: fix the queue id for tqp enable&&reset Date: Thu, 8 Mar 2018 19:41:53 +0800 Message-ID: <1520509315-40895-5-git-send-email-lipeng321@huawei.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1520509315-40895-1-git-send-email-lipeng321@huawei.com> References: <1520509315-40895-1-git-send-email-lipeng321@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.71.200.31] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Command HCLGE_OPC_CFG_COM_TQP_QUEUE should use queue id in the function, but command HCLGE_OPC_RESET_TQP_QUEUE should use global queue id. This patch fixes the queue id about queue enable/disable/reset. Signed-off-by: Peng Li --- .../ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 50 +++++++++++----------- 1 file changed, 24 insertions(+), 26 deletions(-) diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c index 32bc6f6..39bc0e6 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c @@ -3717,20 +3717,11 @@ static int hclge_ae_start(struct hnae3_handle *handle) { struct hclge_vport *vport = hclge_get_vport(handle); struct hclge_dev *hdev = vport->back; - int i, queue_id, ret; + int i, ret; - for (i = 0; i < vport->alloc_tqps; i++) { - /* todo clear interrupt */ - /* ring enable */ - queue_id = hclge_get_queue_id(handle->kinfo.tqp[i]); - if (queue_id < 0) { - dev_warn(&hdev->pdev->dev, - "Get invalid queue id, ignore it\n"); - continue; - } + for (i = 0; i < vport->alloc_tqps; i++) + hclge_tqp_enable(hdev, i, 0, true); - hclge_tqp_enable(hdev, queue_id, 0, true); - } /* mac enable */ hclge_cfg_mac_mode(hdev, true); clear_bit(HCLGE_STATE_DOWN, &hdev->state); @@ -3750,19 +3741,11 @@ static void hclge_ae_stop(struct hnae3_handle *handle) { struct hclge_vport *vport = hclge_get_vport(handle); struct hclge_dev *hdev = vport->back; - int i, queue_id; + int i; - for (i = 0; i < vport->alloc_tqps; i++) { - /* Ring disable */ - queue_id = hclge_get_queue_id(handle->kinfo.tqp[i]); - if (queue_id < 0) { - dev_warn(&hdev->pdev->dev, - "Get invalid queue id, ignore it\n"); - continue; - } + for (i = 0; i < vport->alloc_tqps; i++) + hclge_tqp_enable(hdev, i, 0, false); - hclge_tqp_enable(hdev, queue_id, 0, false); - } /* Mac disable */ hclge_cfg_mac_mode(hdev, false); @@ -4848,21 +4831,36 @@ static int hclge_get_reset_status(struct hclge_dev *hdev, u16 queue_id) return hnae_get_bit(req->ready_to_reset, HCLGE_TQP_RESET_B); } +static u16 hclge_covert_handle_qid_global(struct hnae3_handle *handle, + u16 queue_id) +{ + struct hnae3_queue *queue; + struct hclge_tqp *tqp; + + queue = handle->kinfo.tqp[queue_id]; + tqp = container_of(queue, struct hclge_tqp, q); + + return tqp->index; +} + void hclge_reset_tqp(struct hnae3_handle *handle, u16 queue_id) { struct hclge_vport *vport = hclge_get_vport(handle); struct hclge_dev *hdev = vport->back; int reset_try_times = 0; int reset_status; + u16 queue_gid; int ret; + queue_gid = hclge_covert_handle_qid_global(handle, queue_id); + ret = hclge_tqp_enable(hdev, queue_id, 0, false); if (ret) { dev_warn(&hdev->pdev->dev, "Disable tqp fail, ret = %d\n", ret); return; } - ret = hclge_send_reset_tqp_cmd(hdev, queue_id, true); + ret = hclge_send_reset_tqp_cmd(hdev, queue_gid, true); if (ret) { dev_warn(&hdev->pdev->dev, "Send reset tqp cmd fail, ret = %d\n", ret); @@ -4873,7 +4871,7 @@ void hclge_reset_tqp(struct hnae3_handle *handle, u16 queue_id) while (reset_try_times++ < HCLGE_TQP_RESET_TRY_TIMES) { /* Wait for tqp hw reset */ msleep(20); - reset_status = hclge_get_reset_status(hdev, queue_id); + reset_status = hclge_get_reset_status(hdev, queue_gid); if (reset_status) break; } @@ -4883,7 +4881,7 @@ void hclge_reset_tqp(struct hnae3_handle *handle, u16 queue_id) return; } - ret = hclge_send_reset_tqp_cmd(hdev, queue_id, false); + ret = hclge_send_reset_tqp_cmd(hdev, queue_gid, false); if (ret) { dev_warn(&hdev->pdev->dev, "Deassert the soft reset fail, ret = %d\n", ret); -- 2.9.3