Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/818889/?format=api
{ "id": 818889, "url": "http://patchwork.ozlabs.org/api/patches/818889/?format=api", "web_url": "http://patchwork.ozlabs.org/project/netdev/patch/1506476732-128130-11-git-send-email-linyunsheng@huawei.com/", "project": { "id": 7, "url": "http://patchwork.ozlabs.org/api/projects/7/?format=api", "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": "<1506476732-128130-11-git-send-email-linyunsheng@huawei.com>", "list_archive_url": null, "date": "2017-09-27T01:45:32", "name": "[v3,net-next,10/10] net: hns3: Add DCB support when interacting with network stack", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": true, "hash": "2c50a4b9b0b5dd68439e421c086dcdcda8e02116", "submitter": { "id": 71804, "url": "http://patchwork.ozlabs.org/api/people/71804/?format=api", "name": "Yunsheng Lin", "email": "linyunsheng@huawei.com" }, "delegate": { "id": 34, "url": "http://patchwork.ozlabs.org/api/users/34/?format=api", "username": "davem", "first_name": "David", "last_name": "Miller", "email": "davem@davemloft.net" }, "mbox": "http://patchwork.ozlabs.org/project/netdev/patch/1506476732-128130-11-git-send-email-linyunsheng@huawei.com/mbox/", "series": [ { "id": 5263, "url": "http://patchwork.ozlabs.org/api/series/5263/?format=api", "web_url": "http://patchwork.ozlabs.org/project/netdev/list/?series=5263", "date": "2017-09-27T01:45:23", "name": "Add support for DCB feature in hns3 driver", "version": 3, "mbox": "http://patchwork.ozlabs.org/series/5263/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/818889/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/818889/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 3y21135lxQz9t3m\n\tfor <patchwork-incoming@ozlabs.org>;\n\tWed, 27 Sep 2017 11:47:51 +1000 (AEST)", "(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1033216AbdI0BrV (ORCPT <rfc822;patchwork-incoming@ozlabs.org>);\n\tTue, 26 Sep 2017 21:47:21 -0400", "from szxga05-in.huawei.com ([45.249.212.191]:7030 \"EHLO\n\tszxga05-in.huawei.com\" rhost-flags-OK-OK-OK-OK) by vger.kernel.org\n\twith ESMTP id S1033064AbdI0BqE (ORCPT\n\t<rfc822;netdev@vger.kernel.org>); Tue, 26 Sep 2017 21:46:04 -0400", "from 172.30.72.59 (EHLO DGGEMS402-HUB.china.huawei.com)\n\t([172.30.72.59])\n\tby dggrg05-dlp.huawei.com (MOS 4.4.6-GA FastPath queued)\n\twith ESMTP id DIC26234; Wed, 27 Sep 2017 09:46:01 +0800 (CST)", "from localhost.localdomain (10.67.212.75) by\n\tDGGEMS402-HUB.china.huawei.com (10.3.19.202) with Microsoft SMTP\n\tServer id 14.3.301.0; Wed, 27 Sep 2017 09:45:53 +0800" ], "From": "Yunsheng Lin <linyunsheng@huawei.com>", "To": "<davem@davemloft.net>", "CC": "<huangdaode@hisilicon.com>, <xuwei5@hisilicon.com>,\n\t<liguozhu@hisilicon.com>, <Yisen.Zhuang@huawei.com>,\n\t<gabriele.paoloni@huawei.com>, <john.garry@huawei.com>,\n\t<linuxarm@huawei.com>, <yisen.zhuang@huawei.com>,\n\t<salil.mehta@huawei.com>, <lipeng321@huawei.com>,\n\t<netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>", "Subject": "[PATCH v3 net-next 10/10] net: hns3: Add DCB support when\n\tinteracting with network stack", "Date": "Wed, 27 Sep 2017 09:45:32 +0800", "Message-ID": "<1506476732-128130-11-git-send-email-linyunsheng@huawei.com>", "X-Mailer": "git-send-email 1.9.1", "In-Reply-To": "<1506476732-128130-1-git-send-email-linyunsheng@huawei.com>", "References": "<1506476732-128130-1-git-send-email-linyunsheng@huawei.com>", "MIME-Version": "1.0", "Content-Type": "text/plain", "X-Originating-IP": "[10.67.212.75]", "X-CFilter-Loop": "Reflected", "X-Mirapoint-Virus-RAPID-Raw": "score=unknown(0),\n\trefid=str=0001.0A020204.59CB02D9.00AE, 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": "3350a52b32ff23549d935bd73fdb9742", "Sender": "netdev-owner@vger.kernel.org", "Precedence": "bulk", "List-ID": "<netdev.vger.kernel.org>", "X-Mailing-List": "netdev@vger.kernel.org" }, "content": "When using lldptool to configure DCB parameter, hclge_dcb module\ncall the client_ops->setup_tc to tell network stack which queue\nand priority is using for specific tc.\n\nSigned-off-by: Yunsheng Lin <linyunsheng@huawei.com>\n---\nV2:\n\tDrop mqprio support.\n\nV1:\n\tInitial submit.\n---\n .../net/ethernet/hisilicon/hns3/hns3pf/hns3_enet.c | 102 ++++++++++++++++++---\n 1 file changed, 87 insertions(+), 15 deletions(-)", "diff": "diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hns3_enet.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hns3_enet.c\nindex 11dab26..4a0890f9 100644\n--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hns3_enet.c\n+++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hns3_enet.c\n@@ -196,6 +196,32 @@ static void hns3_vector_gl_rl_init(struct hns3_enet_tqp_vector *tqp_vector)\n \ttqp_vector->tx_group.flow_level = HNS3_FLOW_LOW;\n }\n \n+static int hns3_nic_set_real_num_queue(struct net_device *netdev)\n+{\n+\tstruct hns3_nic_priv *priv = netdev_priv(netdev);\n+\tstruct hnae3_handle *h = priv->ae_handle;\n+\tstruct hnae3_knic_private_info *kinfo = &h->kinfo;\n+\tunsigned int queue_size = kinfo->rss_size * kinfo->num_tc;\n+\tint ret;\n+\n+\tret = netif_set_real_num_tx_queues(netdev, queue_size);\n+\tif (ret) {\n+\t\tnetdev_err(netdev,\n+\t\t\t \"netif_set_real_num_tx_queues fail, ret=%d!\\n\",\n+\t\t\t ret);\n+\t\treturn ret;\n+\t}\n+\n+\tret = netif_set_real_num_rx_queues(netdev, queue_size);\n+\tif (ret) {\n+\t\tnetdev_err(netdev,\n+\t\t\t \"netif_set_real_num_rx_queues fail, ret=%d!\\n\", ret);\n+\t\treturn ret;\n+\t}\n+\n+\treturn 0;\n+}\n+\n static int hns3_nic_net_up(struct net_device *netdev)\n {\n \tstruct hns3_nic_priv *priv = netdev_priv(netdev);\n@@ -232,26 +258,13 @@ static int hns3_nic_net_up(struct net_device *netdev)\n \n static int hns3_nic_net_open(struct net_device *netdev)\n {\n-\tstruct hns3_nic_priv *priv = netdev_priv(netdev);\n-\tstruct hnae3_handle *h = priv->ae_handle;\n \tint ret;\n \n \tnetif_carrier_off(netdev);\n \n-\tret = netif_set_real_num_tx_queues(netdev, h->kinfo.num_tqps);\n-\tif (ret) {\n-\t\tnetdev_err(netdev,\n-\t\t\t \"netif_set_real_num_tx_queues fail, ret=%d!\\n\",\n-\t\t\t ret);\n-\t\treturn ret;\n-\t}\n-\n-\tret = netif_set_real_num_rx_queues(netdev, h->kinfo.num_tqps);\n-\tif (ret) {\n-\t\tnetdev_err(netdev,\n-\t\t\t \"netif_set_real_num_rx_queues fail, ret=%d!\\n\", ret);\n+\tret = hns3_nic_set_real_num_queue(netdev);\n+\tif (ret)\n \t\treturn ret;\n-\t}\n \n \tret = hns3_nic_net_up(netdev);\n \tif (ret) {\n@@ -2848,10 +2861,69 @@ static void hns3_link_status_change(struct hnae3_handle *handle, bool linkup)\n \t}\n }\n \n+static int hns3_client_setup_tc(struct hnae3_handle *handle, u8 tc)\n+{\n+\tstruct hnae3_knic_private_info *kinfo = &handle->kinfo;\n+\tstruct net_device *ndev = kinfo->netdev;\n+\tbool if_running = netif_running(ndev);\n+\tint ret;\n+\tu8 i;\n+\n+\tif (tc > HNAE3_MAX_TC)\n+\t\treturn -EINVAL;\n+\n+\tif (!ndev)\n+\t\treturn -ENODEV;\n+\n+\tret = netdev_set_num_tc(ndev, tc);\n+\tif (ret)\n+\t\treturn ret;\n+\n+\tif (if_running) {\n+\t\t(void)hns3_nic_net_stop(ndev);\n+\t\tmsleep(100);\n+\t}\n+\n+\tret = (kinfo->dcb_ops && kinfo->dcb_ops->map_update) ?\n+\t\tkinfo->dcb_ops->map_update(handle) : -EOPNOTSUPP;\n+\tif (ret)\n+\t\tgoto err_out;\n+\n+\tif (tc <= 1) {\n+\t\tnetdev_reset_tc(ndev);\n+\t\tgoto out;\n+\t}\n+\n+\tfor (i = 0; i < HNAE3_MAX_TC; i++) {\n+\t\tstruct hnae3_tc_info *tc_info = &kinfo->tc_info[i];\n+\n+\t\tif (tc_info->enable)\n+\t\t\tnetdev_set_tc_queue(ndev,\n+\t\t\t\t\t tc_info->tc,\n+\t\t\t\t\t tc_info->tqp_count,\n+\t\t\t\t\t tc_info->tqp_offset);\n+\t}\n+\n+\tfor (i = 0; i < HNAE3_MAX_USER_PRIO; i++) {\n+\t\tnetdev_set_prio_tc_map(ndev, i,\n+\t\t\t\t kinfo->prio_tc[i]);\n+\t}\n+\n+out:\n+\tret = hns3_nic_set_real_num_queue(ndev);\n+\n+err_out:\n+\tif (if_running)\n+\t\t(void)hns3_nic_net_open(ndev);\n+\n+\treturn ret;\n+}\n+\n const struct hnae3_client_ops client_ops = {\n \t.init_instance = hns3_client_init,\n \t.uninit_instance = hns3_client_uninit,\n \t.link_status_change = hns3_link_status_change,\n+\t.setup_tc = hns3_client_setup_tc,\n };\n \n /* hns3_init_module - Driver registration routine\n", "prefixes": [ "v3", "net-next", "10/10" ] }