From: Yunsheng Lin <linyunsheng@huawei.com>
To: <davem@davemloft.net>
Cc: <huangdaode@hisilicon.com>, <xuwei5@hisilicon.com>,
<liguozhu@hisilicon.com>, <Yisen.Zhuang@huawei.com>,
<gabriele.paoloni@huawei.com>, <john.garry@huawei.com>,
<linuxarm@huawei.com>, <yisen.zhuang@huawei.com>,
<salil.mehta@huawei.com>, <lipeng321@huawei.com>,
<netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: [PATCH v3 net-next 09/10] net: hns3: Setting for fc_mode and dcb enable flag in TM module
Date: Wed, 27 Sep 2017 09:45:31 +0800 [thread overview]
Message-ID: <1506476732-128130-10-git-send-email-linyunsheng@huawei.com> (raw)
In-Reply-To: <1506476732-128130-1-git-send-email-linyunsheng@huawei.com>
After the DCB feature is supported, fc_mode and dcb enable flag
must be set according to the DCB parameter.
Signed-off-by: Yunsheng Lin <linyunsheng@huawei.com>
---
.../net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c | 34 +++++++++++++++++++---
1 file changed, 30 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c
index 8295684..359ee67 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c
@@ -486,7 +486,11 @@ static void hclge_tm_tc_info_init(struct hclge_dev *hdev)
hdev->tm_info.prio_tc[i] =
(i >= hdev->tm_info.num_tc) ? 0 : i;
- hdev->flag &= ~HCLGE_FLAG_DCB_ENABLE;
+ /* DCB is enabled if we have more than 1 TC */
+ if (hdev->tm_info.num_tc > 1)
+ hdev->flag |= HCLGE_FLAG_DCB_ENABLE;
+ else
+ hdev->flag &= ~HCLGE_FLAG_DCB_ENABLE;
}
static void hclge_tm_pg_info_init(struct hclge_dev *hdev)
@@ -512,6 +516,24 @@ static void hclge_tm_pg_info_init(struct hclge_dev *hdev)
}
}
+static void hclge_pfc_info_init(struct hclge_dev *hdev)
+{
+ if (!(hdev->flag & HCLGE_FLAG_DCB_ENABLE)) {
+ if (hdev->fc_mode_last_time == HCLGE_FC_PFC)
+ dev_warn(&hdev->pdev->dev,
+ "DCB is disable, but last mode is FC_PFC\n");
+
+ hdev->tm_info.fc_mode = hdev->fc_mode_last_time;
+ } else if (hdev->tm_info.fc_mode != HCLGE_FC_PFC) {
+ /* fc_mode_last_time record the last fc_mode when
+ * DCB is enabled, so that fc_mode can be set to
+ * the correct value when DCB is disabled.
+ */
+ hdev->fc_mode_last_time = hdev->tm_info.fc_mode;
+ hdev->tm_info.fc_mode = HCLGE_FC_PFC;
+ }
+}
+
static int hclge_tm_schd_info_init(struct hclge_dev *hdev)
{
if ((hdev->tx_sch_mode != HCLGE_FLAG_TC_BASE_SCH_MODE) &&
@@ -524,8 +546,7 @@ static int hclge_tm_schd_info_init(struct hclge_dev *hdev)
hclge_tm_vport_info_update(hdev);
- hdev->tm_info.fc_mode = HCLGE_FC_NONE;
- hdev->fc_mode_last_time = hdev->tm_info.fc_mode;
+ hclge_pfc_info_init(hdev);
return 0;
}
@@ -1158,8 +1179,13 @@ int hclge_tm_init_hw(struct hclge_dev *hdev)
int hclge_tm_schd_init(struct hclge_dev *hdev)
{
- int ret = hclge_tm_schd_info_init(hdev);
+ int ret;
+
+ /* fc_mode is HCLGE_FC_FULL on reset */
+ hdev->tm_info.fc_mode = HCLGE_FC_FULL;
+ hdev->fc_mode_last_time = hdev->tm_info.fc_mode;
+ ret = hclge_tm_schd_info_init(hdev);
if (ret)
return ret;
--
1.9.1
next prev parent reply other threads:[~2017-09-27 1:46 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-27 1:45 [PATCH v3 net-next 00/10] Add support for DCB feature in hns3 driver Yunsheng Lin
2017-09-27 1:45 ` [PATCH v3 net-next 01/10] net: hns3: Support for dynamically assigning tx buffer to TC Yunsheng Lin
2017-09-27 1:45 ` [PATCH v3 net-next 02/10] net: hns3: Add support for dynamically buffer reallocation Yunsheng Lin
2017-09-27 1:45 ` [PATCH v3 net-next 03/10] net: hns3: Add support for PFC setting in TM module Yunsheng Lin
2017-09-27 1:45 ` [PATCH v3 net-next 04/10] net: hns3: Add support for port shaper " Yunsheng Lin
2017-09-27 1:45 ` [PATCH v3 net-next 05/10] net: hns3: Add tc-based TM support for sriov enabled port Yunsheng Lin
2017-09-27 1:45 ` [PATCH v3 net-next 06/10] net: hns3: Add some interface for the support of DCB feature Yunsheng Lin
2017-09-27 1:45 ` [PATCH v3 net-next 07/10] net: hns3: Add hclge_dcb module " Yunsheng Lin
2017-09-27 1:45 ` [PATCH v3 net-next 08/10] net: hns3: Add dcb netlink interface " Yunsheng Lin
2017-09-27 1:45 ` Yunsheng Lin [this message]
2017-09-27 1:45 ` [PATCH v3 net-next 10/10] net: hns3: Add DCB support when interacting with network stack Yunsheng Lin
2017-09-28 17:35 ` [PATCH v3 net-next 00/10] Add support for DCB feature in hns3 driver David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1506476732-128130-10-git-send-email-linyunsheng@huawei.com \
--to=linyunsheng@huawei.com \
--cc=Yisen.Zhuang@huawei.com \
--cc=davem@davemloft.net \
--cc=gabriele.paoloni@huawei.com \
--cc=huangdaode@hisilicon.com \
--cc=john.garry@huawei.com \
--cc=liguozhu@hisilicon.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxarm@huawei.com \
--cc=lipeng321@huawei.com \
--cc=netdev@vger.kernel.org \
--cc=salil.mehta@huawei.com \
--cc=xuwei5@hisilicon.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).