net: hns3: Fix for rx_priv_buf_alloc not setting rx shared buffer
authorYunsheng Lin <linyunsheng@huawei.com>
Wed, 20 Sep 2017 10:52:54 +0000 (18:52 +0800)
committerDavid S. Miller <davem@davemloft.net>
Wed, 20 Sep 2017 23:15:39 +0000 (16:15 -0700)
rx_priv_buf_alloc is used to tell hardware how much buffer is
used for rx direction, right now only the private buffer is
assigned.
For ae_dev that doesn't support DCB, private rx buffer is assigned
to zero, only shared rx buffer is used. So not setting the shared
rx buffer cause dropping of packet in SSU.

Fixes: 46a3df9f9718 ("net: hns3: Add HNS3 Acceleration Engine & Compatibility Layer Support")
Signed-off-by: Yunsheng Lin <linyunsheng@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.h
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c

index 30e2ad5..758cf39 100644 (file)
@@ -270,7 +270,8 @@ struct hclge_tx_buff_alloc {
 
 struct hclge_rx_priv_buff {
        __le16 buf_num[HCLGE_TC_NUM];
-       u8 rsv[8];
+       __le16 shared_buf;
+       u8 rsv[6];
 };
 
 struct hclge_query_version {
index a7d8fb1..e313552 100644 (file)
@@ -1622,6 +1622,10 @@ static int hclge_rx_priv_buf_alloc(struct hclge_dev *hdev)
                        cpu_to_le16(true << HCLGE_TC0_PRI_BUF_EN_B);
        }
 
+       req->shared_buf =
+               cpu_to_le16((hdev->s_buf.buf_size >> HCLGE_BUF_UNIT_S) |
+                           (1 << HCLGE_TC0_PRI_BUF_EN_B));
+
        ret = hclge_cmd_send(&hdev->hw, &desc, 1);
        if (ret) {
                dev_err(&hdev->pdev->dev,