Skip to content

Commit bb1fe9e

Browse files
Yunsheng Lindavem330
authored andcommitted
net: hns3: Fix for not setting rx private buffer size to zero
When rx private buffer is disabled, there may be some case that the rx private buffer is not set to zero, which may cause buffer allocation process to fail. This patch fixes this problem by setting priv->enable to 0 and priv->buf_size to zero when rx private buffer is disabled. Fixes: 46a3df9 ("net: hns3: Add HNS3 Acceleration Engine & Compatibility Layer Support") Signed-off-by: Yunsheng Lin <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent d221df4 commit bb1fe9e

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1504,6 +1504,11 @@ int hclge_rx_buffer_calc(struct hclge_dev *hdev, u32 tx_size)
15041504
priv->wl.high = 2 * hdev->mps;
15051505
priv->buf_size = priv->wl.high;
15061506
}
1507+
} else {
1508+
priv->enable = 0;
1509+
priv->wl.low = 0;
1510+
priv->wl.high = 0;
1511+
priv->buf_size = 0;
15071512
}
15081513
}
15091514

@@ -1516,8 +1521,15 @@ int hclge_rx_buffer_calc(struct hclge_dev *hdev, u32 tx_size)
15161521
for (i = 0; i < HCLGE_MAX_TC_NUM; i++) {
15171522
priv = &hdev->priv_buf[i];
15181523

1519-
if (hdev->hw_tc_map & BIT(i))
1520-
priv->enable = 1;
1524+
priv->enable = 0;
1525+
priv->wl.low = 0;
1526+
priv->wl.high = 0;
1527+
priv->buf_size = 0;
1528+
1529+
if (!(hdev->hw_tc_map & BIT(i)))
1530+
continue;
1531+
1532+
priv->enable = 1;
15211533

15221534
if (hdev->tm_info.hw_pfc_map & BIT(i)) {
15231535
priv->wl.low = 128;

0 commit comments

Comments
 (0)