Received: by 10.223.185.116 with SMTP id b49csp5785570wrg; Wed, 7 Mar 2018 18:38:37 -0800 (PST) X-Google-Smtp-Source: AG47ELux+IsGunfU4Hxd0Lz9jpLaIlf7BFlu+FhW2+nkDMiMFVZzdoLjJBCLDxXOeMt+lqANzFps X-Received: by 10.101.92.6 with SMTP id u6mr19843869pgr.440.1520476716919; Wed, 07 Mar 2018 18:38:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520476716; cv=none; d=google.com; s=arc-20160816; b=DiJ0VRoTIKBkudlypvOli8cw55VoHevnLA0oWtWfjJpsmQW983dXFLALbyNz3t/f32 61HtZbwKWjKhv+h07rRiZ1u+xf7aZKfcyP8TyUiDstlNcG5FCZ+4SQiYdmBvF4e17hal OYHpRYjmngSSCO8Q/SYUnL1VzEnLEBV2RAs3CxBd3uX3W2+cc3MDK/76E38SruS5Mb7Z 699+TUzE6HqWr9mu3aWZu85jQHqvA3QgO3erTmkJ0NdR+FZ0YziaiLrU+d0hKZKoE+DR QCbfbkMSiDVUCVF4cfb8mHveAf4uTEX+76AbeMB9JXlT6tOYchQk/YO3jgS/0DvzSQ02 c3ow== 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=QzefXk9bI4R3j3UtNV6+a8ekWgfHrONFu3NjmklbGIU=; b=hOgt+SpmSKuUgUuPvDlwyOfrZ9mhD30wt/VvylO3s5+QFuP6V2dxm8nosvB3aO2Zi2 /Y8/kRAPGpamtwe7IreX6h0xchVQQpipxqV5SnQa3HL1Mf4OuDaFMVSgeEHDENnWVoRQ P6eLNml8QuG2VojKUbZsyJEDCjfpuM4WMWVfx2LdtT/JnE86FNciYboTVtcj8S24ok3d V+yt5lnZKvh6fK6m2KJRpqe0qj9D5B1WDK89xRPn5L8vPDuTNRDo9wswB5Dq3OKl/i2s L0ShbXgEwRW5Z9658BoB9L5oHi5gv3wSnGKrqS7FGFL+3lG86JOg/CR5FAB72I1FDT2E Y94w== 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 o4si12089952pgp.285.2018.03.07.18.38.22; Wed, 07 Mar 2018 18:38:36 -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 S964813AbeCHCfS (ORCPT + 99 others); Wed, 7 Mar 2018 21:35:18 -0500 Received: from szxga05-in.huawei.com ([45.249.212.191]:5760 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S934903AbeCHCfD (ORCPT ); Wed, 7 Mar 2018 21:35:03 -0500 Received: from DGGEMS408-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id E60554CA4DB88; Thu, 8 Mar 2018 10:34:48 +0800 (CST) Received: from linux-ioko.site (10.71.200.31) by DGGEMS408-HUB.china.huawei.com (10.3.19.208) with Microsoft SMTP Server id 14.3.361.1; Thu, 8 Mar 2018 10:34:42 +0800 From: Peng Li To: CC: , , , , Subject: [PATCH net-next 21/23] {topost} net: hns3: fix the queue id for tqp enable&&reset Date: Thu, 8 Mar 2018 11:06:46 +0800 Message-ID: <1520478408-116992-22-git-send-email-lipeng321@huawei.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1520478408-116992-1-git-send-email-lipeng321@huawei.com> References: <1520478408-116992-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 323f95b..ea33cc5 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c @@ -3720,20 +3720,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); @@ -3753,19 +3744,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); @@ -4851,21 +4834,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); @@ -4876,7 +4874,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; } @@ -4886,7 +4884,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