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 net 3/9] net: hns3: Fix for DEFAULT_DV when dev doesn't support DCB
Date: Wed, 20 Sep 2017 18:52:52 +0800 [thread overview]
Message-ID: <1505904778-53217-4-git-send-email-linyunsheng@huawei.com> (raw)
In-Reply-To: <1505904778-53217-1-git-send-email-linyunsheng@huawei.com>
When ae_dev doesn't support DCB, DEFAULT_DV must be set to
a lower value, otherwise the buffer allocation process will
fail.
This patch fix it by setting it to 30K bytes.
Fixes: 46a3df9f9718 ("net: hns3: Add HNS3 Acceleration Engine & Compatibility Layer Support")
Signed-off-by: Yunsheng Lin <linyunsheng@huawei.com>
---
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.h | 1 +
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 6 +++++-
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.h b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.h
index c2b613b..30e2ad5 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.h
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.h
@@ -688,6 +688,7 @@ struct hclge_reset_tqp_queue {
#define HCLGE_DEFAULT_TX_BUF 0x4000 /* 16k bytes */
#define HCLGE_TOTAL_PKT_BUF 0x108000 /* 1.03125M bytes */
#define HCLGE_DEFAULT_DV 0xA000 /* 40k byte */
+#define HCLGE_DEFAULT_NON_DCB_DV 0x7800 /* 30K byte */
#define HCLGE_TYPE_CRQ 0
#define HCLGE_TYPE_CSQ 1
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
index c515b84..1876418 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
@@ -1444,7 +1444,11 @@ static bool hclge_is_rx_buf_ok(struct hclge_dev *hdev, u32 rx_all)
tc_num = hclge_get_tc_num(hdev);
pfc_enable_num = hclge_get_pfc_enalbe_num(hdev);
- shared_buf_min = 2 * hdev->mps + HCLGE_DEFAULT_DV;
+ if (hnae3_dev_dcb_supported(hdev))
+ shared_buf_min = 2 * hdev->mps + HCLGE_DEFAULT_DV;
+ else
+ shared_buf_min = 2 * hdev->mps + HCLGE_DEFAULT_NON_DCB_DV;
+
shared_buf_tc = pfc_enable_num * hdev->mps +
(tc_num - pfc_enable_num) * hdev->mps / 2 +
hdev->mps;
--
1.9.1
next prev parent reply other threads:[~2017-09-20 10:52 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-20 10:52 [PATCH net 0/9] TM related bugfixes for the HNS3 Ethernet Driver Yunsheng Lin
2017-09-20 10:52 ` [PATCH net 1/9] net: hns3: Cleanup for ROCE capability flag in ae_dev Yunsheng Lin
2017-09-20 10:52 ` [PATCH net 2/9] net: hns3: Fix initialization when cmd is not supported Yunsheng Lin
2017-09-20 10:52 ` Yunsheng Lin [this message]
2017-09-20 10:52 ` [PATCH net 4/9] net: hns3: Fix for not setting rx private buffer size to zero Yunsheng Lin
2017-09-20 10:52 ` [PATCH net 5/9] net: hns3: Fix for rx_priv_buf_alloc not setting rx shared buffer Yunsheng Lin
2017-09-20 10:52 ` [PATCH net 6/9] net: hns3: Fix for rx priv buf allocation when DCB is not supported Yunsheng Lin
2017-09-20 10:52 ` [PATCH net 7/9] net: hns3: Fix typo error for feild in hclge_tm Yunsheng Lin
2017-09-20 10:52 ` [PATCH net 8/9] net: hns3: Fix for setting rss_size incorrectly Yunsheng Lin
2017-09-20 10:52 ` [PATCH net 9/9] net: hns3: Fix for pri to tc mapping in TM Yunsheng Lin
2017-09-20 23:15 ` [PATCH net 0/9] TM related bugfixes for the HNS3 Ethernet 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=1505904778-53217-4-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