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 6/9] net: hns3: Fix for rx priv buf allocation when DCB is not supported
Date: Wed, 20 Sep 2017 18:52:55 +0800 [thread overview]
Message-ID: <1505904778-53217-7-git-send-email-linyunsheng@huawei.com> (raw)
In-Reply-To: <1505904778-53217-1-git-send-email-linyunsheng@huawei.com>
When hdev doesn't support DCB, rx private buffer is not allocated,
otherwise there is not enough buffer for rx shared buffer, causing
buffer allocation process to fail.
This patch fixes by checking the dcb capability in
hclge_rx_buffer_calc.
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_main.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
index c08c41f..1e15ce1 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
@@ -1489,6 +1489,16 @@ int hclge_rx_buffer_calc(struct hclge_dev *hdev, u32 tx_size)
struct hclge_priv_buf *priv;
int i;
+ /* When DCB is not supported, rx private
+ * buffer is not allocated.
+ */
+ if (!hnae3_dev_dcb_supported(hdev)) {
+ if (!hclge_is_rx_buf_ok(hdev, rx_all))
+ return -ENOMEM;
+
+ return 0;
+ }
+
/* step 1, try to alloc private buffer for all enabled tc */
for (i = 0; i < HCLGE_MAX_TC_NUM; i++) {
priv = &hdev->priv_buf[i];
--
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 ` [PATCH net 3/9] net: hns3: Fix for DEFAULT_DV when dev doesn't support DCB Yunsheng Lin
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 ` Yunsheng Lin [this message]
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-7-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