{"id":818420,"url":"http://patchwork.ozlabs.org/api/patches/818420/?format=json","web_url":"http://patchwork.ozlabs.org/project/netdev/patch/1506392718-50463-10-git-send-email-linyunsheng@huawei.com/","project":{"id":7,"url":"http://patchwork.ozlabs.org/api/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":"<1506392718-50463-10-git-send-email-linyunsheng@huawei.com>","list_archive_url":null,"date":"2017-09-26T02:25:17","name":"[v2,net-next,09/10] net: hns3: Setting for fc_mode and dcb enable flag in TM module","commit_ref":null,"pull_url":null,"state":"superseded","archived":true,"hash":"f41a81cb685ec88d016af95ead1ec84012d13898","submitter":{"id":71804,"url":"http://patchwork.ozlabs.org/api/people/71804/?format=json","name":"Yunsheng Lin","email":"linyunsheng@huawei.com"},"delegate":{"id":34,"url":"http://patchwork.ozlabs.org/api/users/34/?format=json","username":"davem","first_name":"David","last_name":"Miller","email":"davem@davemloft.net"},"mbox":"http://patchwork.ozlabs.org/project/netdev/patch/1506392718-50463-10-git-send-email-linyunsheng@huawei.com/mbox/","series":[{"id":5045,"url":"http://patchwork.ozlabs.org/api/series/5045/?format=json","web_url":"http://patchwork.ozlabs.org/project/netdev/list/?series=5045","date":"2017-09-26T02:25:17","name":"Add support for DCB feature in hns3 driver","version":2,"mbox":"http://patchwork.ozlabs.org/series/5045/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/818420/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/818420/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 3y1Pvj09hsz9sPk\n\tfor <patchwork-incoming@ozlabs.org>;\n\tTue, 26 Sep 2017 12:26:09 +1000 (AEST)","(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S967218AbdIZCZ4 (ORCPT <rfc822;patchwork-incoming@ozlabs.org>);\n\tMon, 25 Sep 2017 22:25:56 -0400","from szxga05-in.huawei.com ([45.249.212.191]:7013 \"EHLO\n\tszxga05-in.huawei.com\" rhost-flags-OK-OK-OK-OK) by vger.kernel.org\n\twith ESMTP id S967186AbdIZCZu (ORCPT\n\t<rfc822;netdev@vger.kernel.org>); Mon, 25 Sep 2017 22:25:50 -0400","from 172.30.72.59 (EHLO DGGEMS408-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 DIA54160; Tue, 26 Sep 2017 10:25:48 +0800 (CST)","from localhost.localdomain (10.67.212.75) by\n\tDGGEMS408-HUB.china.huawei.com (10.3.19.208) with Microsoft SMTP\n\tServer id 14.3.301.0; Tue, 26 Sep 2017 10:25:37 +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 v2 net-next 09/10] net: hns3: Setting for fc_mode and dcb\n\tenable flag in TM module","Date":"Tue, 26 Sep 2017 10:25:17 +0800","Message-ID":"<1506392718-50463-10-git-send-email-linyunsheng@huawei.com>","X-Mailer":"git-send-email 1.9.1","In-Reply-To":"<1506392718-50463-1-git-send-email-linyunsheng@huawei.com>","References":"<1506392718-50463-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.0A090205.59C9BAAC.0119, 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":"d3ee0ad98c90bc4b622edf4a5a8a9381","Sender":"netdev-owner@vger.kernel.org","Precedence":"bulk","List-ID":"<netdev.vger.kernel.org>","X-Mailing-List":"netdev@vger.kernel.org"},"content":"After the DCB feature is supported, fc_mode and dcb enable flag\nmust be set according to the DCB parameter.\n\nSigned-off-by: Yunsheng Lin <linyunsheng@huawei.com>\n---\n .../net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c  | 34 +++++++++++++++++++---\n 1 file changed, 30 insertions(+), 4 deletions(-)","diff":"diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c\nindex 8295684..359ee67 100644\n--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c\n+++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c\n@@ -486,7 +486,11 @@ static void hclge_tm_tc_info_init(struct hclge_dev *hdev)\n \t\thdev->tm_info.prio_tc[i] =\n \t\t\t(i >= hdev->tm_info.num_tc) ? 0 : i;\n \n-\thdev->flag &= ~HCLGE_FLAG_DCB_ENABLE;\n+\t/* DCB is enabled if we have more than 1 TC */\n+\tif (hdev->tm_info.num_tc > 1)\n+\t\thdev->flag |= HCLGE_FLAG_DCB_ENABLE;\n+\telse\n+\t\thdev->flag &= ~HCLGE_FLAG_DCB_ENABLE;\n }\n \n static void hclge_tm_pg_info_init(struct hclge_dev *hdev)\n@@ -512,6 +516,24 @@ static void hclge_tm_pg_info_init(struct hclge_dev *hdev)\n \t}\n }\n \n+static void hclge_pfc_info_init(struct hclge_dev *hdev)\n+{\n+\tif (!(hdev->flag & HCLGE_FLAG_DCB_ENABLE)) {\n+\t\tif (hdev->fc_mode_last_time == HCLGE_FC_PFC)\n+\t\t\tdev_warn(&hdev->pdev->dev,\n+\t\t\t\t \"DCB is disable, but last mode is FC_PFC\\n\");\n+\n+\t\thdev->tm_info.fc_mode = hdev->fc_mode_last_time;\n+\t} else if (hdev->tm_info.fc_mode != HCLGE_FC_PFC) {\n+\t\t/* fc_mode_last_time record the last fc_mode when\n+\t\t * DCB is enabled, so that fc_mode can be set to\n+\t\t * the correct value when DCB is disabled.\n+\t\t */\n+\t\thdev->fc_mode_last_time = hdev->tm_info.fc_mode;\n+\t\thdev->tm_info.fc_mode = HCLGE_FC_PFC;\n+\t}\n+}\n+\n static int hclge_tm_schd_info_init(struct hclge_dev *hdev)\n {\n \tif ((hdev->tx_sch_mode != HCLGE_FLAG_TC_BASE_SCH_MODE) &&\n@@ -524,8 +546,7 @@ static int hclge_tm_schd_info_init(struct hclge_dev *hdev)\n \n \thclge_tm_vport_info_update(hdev);\n \n-\thdev->tm_info.fc_mode = HCLGE_FC_NONE;\n-\thdev->fc_mode_last_time = hdev->tm_info.fc_mode;\n+\thclge_pfc_info_init(hdev);\n \n \treturn 0;\n }\n@@ -1158,8 +1179,13 @@ int hclge_tm_init_hw(struct hclge_dev *hdev)\n \n int hclge_tm_schd_init(struct hclge_dev *hdev)\n {\n-\tint ret = hclge_tm_schd_info_init(hdev);\n+\tint ret;\n+\n+\t/* fc_mode is HCLGE_FC_FULL on reset */\n+\thdev->tm_info.fc_mode = HCLGE_FC_FULL;\n+\thdev->fc_mode_last_time = hdev->tm_info.fc_mode;\n \n+\tret = hclge_tm_schd_info_init(hdev);\n \tif (ret)\n \t\treturn ret;\n \n","prefixes":["v2","net-next","09/10"]}