Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp7131883imm; Wed, 27 Jun 2018 21:11:06 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLhNiDUD6xpK4VCA9gO6zTEvjxPMnjD16Nz81XIQ+izpQ9zbkULwTRbEt2iTg89PraNGHs1 X-Received: by 2002:a17:902:8308:: with SMTP id bd8-v6mr8871535plb.329.1530159066923; Wed, 27 Jun 2018 21:11:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530159066; cv=none; d=google.com; s=arc-20160816; b=TZPiVDLzXlUTpGdR9ZpwBZHTCZScc3hStmE45wzTOpKAx9SNmg5QZz88uYz794lmlc HKQEd2j2lAqLl9Sj0BZNOT54UEntRpQpeiOfxfMczx/dla0bAfhzFmoXcx3BoXLU1qDV YCeDMkqbePEloCfQFeFOplWDqIp4ckozUxvBCLNJPM/LY2XzD0iujgSxflY00r6xhPxh 71fgiaO3aSpjo/1cI2KCCa5UgJBvgrJZzFp20KUQvECMTMImj58UBv8cU0aJV/yXZDHp S/qUgFLCQj9h8LfvTemLGsMNSNry3dV6utiKci3riepMN1VgTCaTdYIQDWsk7wd9NYz7 5T6g== 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=NL9kkqRgoC4gzjMbeHhSiJPDEd6+TlpfgDYWDMMj3B8=; b=nk9CiTt1gA5XSQuJtW22flP+rQ4kAjAMCuaRMxY+H/+iFkzc7mKPAvUIlHYULWvJGB cL7owt5DEVO3bGFJ4KN6eA8JpYjTDfIe9GF/Ie+MrF22TTiXGiK6ATtZ7qcwrweX/zE3 uZDPR+2uZxukSDOyRwkVe0cx5rMlrr/h2U2J6RlBXcq+NuX4PtozUvO9ogU/EV2iQ3cn vOwXCoJ5AushDchV0lkIm4GGkh6qFN/J9qhSr8UP65iDljnReQCntvqNlAFSU2RGsfuQ 7ehzNj4sccGlbppdRDQj7ZEpyTBRxylBTESDXPeYpKzjxrUXie0yxmIbliUiUqhgyMEv 2biQ== 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 b9-v6si6467783plk.111.2018.06.27.21.10.42; Wed, 27 Jun 2018 21:11:06 -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 S1753333AbeF1DlT (ORCPT + 99 others); Wed, 27 Jun 2018 23:41:19 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:9179 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753199AbeF1DlO (ORCPT ); Wed, 27 Jun 2018 23:41:14 -0400 Received: from DGGEMS407-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 8B297641A989; Thu, 28 Jun 2018 11:40:58 +0800 (CST) Received: from linux-ioko.site (10.71.200.31) by DGGEMS407-HUB.china.huawei.com (10.3.19.207) with Microsoft SMTP Server id 14.3.382.0; Thu, 28 Jun 2018 11:40:52 +0800 From: Peng Li To: CC: , , , , , Subject: [PATCH net-next 01/11] net: hns3: remove hclge_get_vector_index from hclge_bind_ring_with_vector Date: Thu, 28 Jun 2018 12:12:19 +0800 Message-ID: <1530159149-122284-2-git-send-email-lipeng321@huawei.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1530159149-122284-1-git-send-email-lipeng321@huawei.com> References: <1530159149-122284-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 In hclge_unmap_ring_frm_vector, there are 2 steps: step 1: get vector index. step 2 unbind ring with vector. But it gets vector id again in step 2 interface. This patch removes hclge_get_vector_index from hclge_bind_ring_with_vector, and make the step the same with hns3 PF driver. Signed-off-by: Peng Li --- .../ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c | 24 +++++++++++++--------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c index a17872a..b3d8237 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c @@ -547,24 +547,18 @@ static int hclgevf_get_tc_size(struct hnae3_handle *handle) } static int hclgevf_bind_ring_to_vector(struct hnae3_handle *handle, bool en, - int vector, + int vector_id, struct hnae3_ring_chain_node *ring_chain) { struct hclgevf_dev *hdev = hclgevf_ae_get_hdev(handle); struct hnae3_ring_chain_node *node; struct hclge_mbx_vf_to_pf_cmd *req; struct hclgevf_desc desc; - int i = 0, vector_id; + int i = 0; int status; u8 type; req = (struct hclge_mbx_vf_to_pf_cmd *)desc.data; - vector_id = hclgevf_get_vector_index(hdev, vector); - if (vector_id < 0) { - dev_err(&handle->pdev->dev, - "Get vector index fail. ret =%d\n", vector_id); - return vector_id; - } for (node = ring_chain; node; node = node->next) { int idx_offset = HCLGE_MBX_RING_MAP_BASIC_MSG_NUM + @@ -617,7 +611,17 @@ static int hclgevf_bind_ring_to_vector(struct hnae3_handle *handle, bool en, static int hclgevf_map_ring_to_vector(struct hnae3_handle *handle, int vector, struct hnae3_ring_chain_node *ring_chain) { - return hclgevf_bind_ring_to_vector(handle, true, vector, ring_chain); + struct hclgevf_dev *hdev = hclgevf_ae_get_hdev(handle); + int vector_id; + + vector_id = hclgevf_get_vector_index(hdev, vector); + if (vector_id < 0) { + dev_err(&handle->pdev->dev, + "Get vector index fail. ret =%d\n", vector_id); + return vector_id; + } + + return hclgevf_bind_ring_to_vector(handle, true, vector_id, ring_chain); } static int hclgevf_unmap_ring_from_vector( @@ -635,7 +639,7 @@ static int hclgevf_unmap_ring_from_vector( return vector_id; } - ret = hclgevf_bind_ring_to_vector(handle, false, vector, ring_chain); + ret = hclgevf_bind_ring_to_vector(handle, false, vector_id, ring_chain); if (ret) dev_err(&handle->pdev->dev, "Unmap ring from vector fail. vector=%d, ret =%d\n", -- 2.9.3