{"id":832952,"url":"http://patchwork.ozlabs.org/api/1.2/patches/832952/?format=json","web_url":"http://patchwork.ozlabs.org/project/netdev/patch/1509547642-51110-2-git-send-email-lipeng321@huawei.com/","project":{"id":7,"url":"http://patchwork.ozlabs.org/api/1.2/projects/7/?format=json","name":"Linux network development","link_name":"netdev","list_id":"netdev.vger.kernel.org","list_email":"netdev@vger.kernel.org","web_url":null,"scm_url":null,"webscm_url":null,"list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<1509547642-51110-2-git-send-email-lipeng321@huawei.com>","list_archive_url":null,"date":"2017-11-01T14:47:14","name":"[net-next,1/9] net: hns3: Refactor the mapping of tqp to vport","commit_ref":null,"pull_url":null,"state":"changes-requested","archived":true,"hash":"4bf0a79e87d2f5dc3f34977f9688c50e43459ca6","submitter":{"id":71468,"url":"http://patchwork.ozlabs.org/api/1.2/people/71468/?format=json","name":"lipeng (Y)","email":"lipeng321@huawei.com"},"delegate":{"id":34,"url":"http://patchwork.ozlabs.org/api/1.2/users/34/?format=json","username":"davem","first_name":"David","last_name":"Miller","email":"davem@davemloft.net"},"mbox":"http://patchwork.ozlabs.org/project/netdev/patch/1509547642-51110-2-git-send-email-lipeng321@huawei.com/mbox/","series":[{"id":11334,"url":"http://patchwork.ozlabs.org/api/1.2/series/11334/?format=json","web_url":"http://patchwork.ozlabs.org/project/netdev/list/?series=11334","date":"2017-11-01T14:47:14","name":"net: hns3: add support for reset","version":1,"mbox":"http://patchwork.ozlabs.org/series/11334/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/832952/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/832952/checks/","tags":{},"related":[],"headers":{"Return-Path":"<netdev-owner@vger.kernel.org>","X-Original-To":"patchwork-incoming@ozlabs.org","Delivered-To":"patchwork-incoming@ozlabs.org","Authentication-Results":"ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=vger.kernel.org\n\t(client-ip=209.132.180.67; helo=vger.kernel.org;\n\tenvelope-from=netdev-owner@vger.kernel.org;\n\treceiver=<UNKNOWN>)","Received":["from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3yRr3861HYz9sPs\n\tfor <patchwork-incoming@ozlabs.org>;\n\tThu,  2 Nov 2017 01:20:20 +1100 (AEDT)","(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1754778AbdKAOUF (ORCPT <rfc822;patchwork-incoming@ozlabs.org>);\n\tWed, 1 Nov 2017 10:20:05 -0400","from szxga05-in.huawei.com ([45.249.212.191]:9990 \"EHLO\n\tszxga05-in.huawei.com\" rhost-flags-OK-OK-OK-OK) by vger.kernel.org\n\twith ESMTP id S1751832AbdKAOT6 (ORCPT\n\t<rfc822;netdev@vger.kernel.org>); Wed, 1 Nov 2017 10:19:58 -0400","from 172.30.72.60 (EHLO DGGEMS412-HUB.china.huawei.com)\n\t([172.30.72.60])\n\tby dggrg05-dlp.huawei.com (MOS 4.4.6-GA FastPath queued)\n\twith ESMTP id DKF95325; Wed, 01 Nov 2017 22:19:56 +0800 (CST)","from linux-ioko.site (10.71.200.31) by\n\tDGGEMS412-HUB.china.huawei.com (10.3.19.212) with Microsoft SMTP\n\tServer id 14.3.361.1; Wed, 1 Nov 2017 22:19:49 +0800"],"From":"Lipeng <lipeng321@huawei.com>","To":"<davem@davemloft.net>","CC":"<netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>,\n\t<linuxarm@huawei.com>, <yisen.zhuang@huawei.com>,\n\t<salil.mehta@huawei.com>, <lipeng321@huawei.com>","Subject":"[PATCH net-next 1/9] net: hns3: Refactor the mapping of tqp to vport","Date":"Wed, 1 Nov 2017 22:47:14 +0800","Message-ID":"<1509547642-51110-2-git-send-email-lipeng321@huawei.com>","X-Mailer":"git-send-email 1.9.1","In-Reply-To":"<1509547642-51110-1-git-send-email-lipeng321@huawei.com>","References":"<1509547642-51110-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","X-Mirapoint-Virus-RAPID-Raw":"score=unknown(0),\n\trefid=str=0001.0A020203.59F9D80C.0106, ss=1, re=0.000, recu=0.000,\n\treip=0.000, cl=1, cld=1, fgs=0, ip=0.0.0.0,\n\tso=2014-11-16 11:51:01, dmn=2013-03-21 17:37:32","X-Mirapoint-Loop-Id":"3553ea0137fc7df301ded533df59e935","Sender":"netdev-owner@vger.kernel.org","Precedence":"bulk","List-ID":"<netdev.vger.kernel.org>","X-Mailing-List":"netdev@vger.kernel.org"},"content":"From: qumingguang <qumingguang@huawei.com>\n\nThis patch refactor the mapping of tqp to vport, making the maping function\ncan be used both in the reset process and initialization process.\n\nSigned-off-by: qumingguang <qumingguang@huawei.com>\nSigned-off-by: Lipeng <lipeng321@huawei.com>\n---\n .../ethernet/hisilicon/hns3/hns3pf/hclge_main.c    | 61 ++++++++++++++++++----\n 1 file changed, 50 insertions(+), 11 deletions(-)","diff":"diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c\nindex 0b95fbe..a56d878 100644\n--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c\n+++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c\n@@ -1184,11 +1184,7 @@ static int  hclge_assign_tqp(struct hclge_vport *vport,\n \t\t\t     struct hnae3_queue **tqp, u16 num_tqps)\n {\n \tstruct hclge_dev *hdev = vport->back;\n-\tint i, alloced, func_id, ret;\n-\tbool is_pf;\n-\n-\tfunc_id = vport->vport_id;\n-\tis_pf = (vport->vport_id == 0) ? true : false;\n+\tint i, alloced;\n \n \tfor (i = 0, alloced = 0; i < hdev->num_tqps &&\n \t     alloced < num_tqps; i++) {\n@@ -1197,12 +1193,6 @@ static int  hclge_assign_tqp(struct hclge_vport *vport,\n \t\t\thdev->htqp[i].q.tqp_index = alloced;\n \t\t\ttqp[alloced] = &hdev->htqp[i].q;\n \t\t\thdev->htqp[i].alloced = true;\n-\t\t\tret = hclge_map_tqps_to_func(hdev, func_id,\n-\t\t\t\t\t\t     hdev->htqp[i].index,\n-\t\t\t\t\t\t     alloced, is_pf);\n-\t\t\tif (ret)\n-\t\t\t\treturn ret;\n-\n \t\t\talloced++;\n \t\t}\n \t}\n@@ -1254,6 +1244,49 @@ static int hclge_knic_setup(struct hclge_vport *vport, u16 num_tqps)\n \treturn 0;\n }\n \n+static int hclge_map_tqp_to_vport(struct hclge_dev *hdev,\n+\t\t\t\t  struct hclge_vport *vport)\n+{\n+\tstruct hnae3_handle *nic = &vport->nic;\n+\tstruct hnae3_knic_private_info *kinfo;\n+\tu16 i;\n+\n+\tkinfo = &nic->kinfo;\n+\tfor (i = 0; i < kinfo->num_tqps; i++) {\n+\t\tstruct hclge_tqp *q =\n+\t\t\tcontainer_of(kinfo->tqp[i], struct hclge_tqp, q);\n+\t\tbool is_pf;\n+\t\tint ret;\n+\n+\t\tis_pf = (vport->vport_id == 0) ? true : false;\n+\t\tret = hclge_map_tqps_to_func(hdev, vport->vport_id, q->index,\n+\t\t\t\t\t     i, is_pf);\n+\t\tif (ret)\n+\t\t\treturn ret;\n+\t}\n+\n+\treturn 0;\n+}\n+\n+static int hclge_map_tqp(struct hclge_dev *hdev)\n+{\n+\tstruct hclge_vport *vport = hdev->vport;\n+\tu16 i, num_vport;\n+\n+\tnum_vport = hdev->num_vmdq_vport + hdev->num_req_vfs + 1;\n+\tfor (i = 0; i < num_vport; i++)\t{\n+\t\tint ret;\n+\n+\t\tret = hclge_map_tqp_to_vport(hdev, vport);\n+\t\tif (ret)\n+\t\t\treturn ret;\n+\n+\t\tvport++;\n+\t}\n+\n+\treturn 0;\n+}\n+\n static void hclge_unic_setup(struct hclge_vport *vport, u16 num_tqps)\n {\n \t/* this would be initialized later */\n@@ -4459,6 +4492,12 @@ static int hclge_init_ae_dev(struct hnae3_ae_dev *ae_dev)\n \t\treturn ret;\n \t}\n \n+\tret = hclge_map_tqp(hdev);\n+\tif (ret) {\n+\t\tdev_err(&pdev->dev, \"Map tqp error, ret = %d.\\n\", ret);\n+\t\treturn ret;\n+\t}\n+\n \tret = hclge_mac_init(hdev);\n \tif (ret) {\n \t\tdev_err(&pdev->dev, \"Mac init error, ret = %d\\n\", ret);\n","prefixes":["net-next","1/9"]}