Skip to content

Commit d602a52

Browse files
Yunsheng Lindavem330
authored andcommitted
net: hns3: Fix for rx priv buf allocation when DCB is not supported
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: 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 b8c8bf4 commit d602a52

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1489,6 +1489,16 @@ int hclge_rx_buffer_calc(struct hclge_dev *hdev, u32 tx_size)
14891489
struct hclge_priv_buf *priv;
14901490
int i;
14911491

1492+
/* When DCB is not supported, rx private
1493+
* buffer is not allocated.
1494+
*/
1495+
if (!hnae3_dev_dcb_supported(hdev)) {
1496+
if (!hclge_is_rx_buf_ok(hdev, rx_all))
1497+
return -ENOMEM;
1498+
1499+
return 0;
1500+
}
1501+
14921502
/* step 1, try to alloc private buffer for all enabled tc */
14931503
for (i = 0; i < HCLGE_MAX_TC_NUM; i++) {
14941504
priv = &hdev->priv_buf[i];

0 commit comments

Comments
 (0)