{"id":833321,"url":"http://patchwork.ozlabs.org/api/1.2/patches/833321/?format=json","web_url":"http://patchwork.ozlabs.org/project/netdev/patch/1509626723-18619-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":"<1509626723-18619-2-git-send-email-lipeng321@huawei.com>","list_archive_url":null,"date":"2017-11-02T12:45:15","name":"[V2,net-next,1/9] net: hns3: Refactor the mapping of tqp to vport","commit_ref":null,"pull_url":null,"state":"accepted","archived":true,"hash":"7971242db52bccf4d8c1ca256d609252a575c4e1","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/1509626723-18619-2-git-send-email-lipeng321@huawei.com/mbox/","series":[{"id":11493,"url":"http://patchwork.ozlabs.org/api/1.2/series/11493/?format=json","web_url":"http://patchwork.ozlabs.org/project/netdev/list/?series=11493","date":"2017-11-02T12:45:16","name":"net: hns3: add support for reset","version":2,"mbox":"http://patchwork.ozlabs.org/series/11493/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/833321/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/833321/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 3ySPLH2Q2sz9t30\n\tfor <patchwork-incoming@ozlabs.org>;\n\tThu,  2 Nov 2017 23:20:23 +1100 (AEDT)","(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1755172AbdKBMTH (ORCPT <rfc822;patchwork-incoming@ozlabs.org>);\n\tThu, 2 Nov 2017 08:19:07 -0400","from szxga06-in.huawei.com ([45.249.212.32]:51480 \"EHLO huawei.com\"\n\trhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP\n\tid S1752607AbdKBMTE (ORCPT <rfc822;netdev@vger.kernel.org>);\n\tThu, 2 Nov 2017 08:19:04 -0400","from DGGEMS406-HUB.china.huawei.com (unknown [172.30.72.59])\n\tby Forcepoint Email with ESMTP id 85848E9B79238;\n\tThu,  2 Nov 2017 20:18:50 +0800 (CST)","from linux-ioko.site (10.71.200.31) by\n\tDGGEMS406-HUB.china.huawei.com (10.3.19.206) with Microsoft SMTP\n\tServer id 14.3.361.1; Thu, 2 Nov 2017 20:17:46 +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>, <salil.mehta@huawei.com>, <lipeng321@huawei.com>","Subject":"[PATCH V2 net-next 1/9] net: hns3: Refactor the mapping of tqp to\n\tvport","Date":"Thu, 2 Nov 2017 20:45:15 +0800","Message-ID":"<1509626723-18619-2-git-send-email-lipeng321@huawei.com>","X-Mailer":"git-send-email 1.9.1","In-Reply-To":"<1509626723-18619-1-git-send-email-lipeng321@huawei.com>","References":"<1509626723-18619-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":"netdev-owner@vger.kernel.org","Precedence":"bulk","List-ID":"<netdev.vger.kernel.org>","X-Mailing-List":"netdev@vger.kernel.org"},"content":"This 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>\nSigned-off-by: Yunsheng Lin <linyunsheng@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..404757a 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);\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":["V2","net-next","1/9"]}