Skip to content

Commit 49edd6a

Browse files
liuyonglong86davem330
authored andcommitted
net: hns: fix soft lockup when there is not enough memory
When there is not enough memory and napi_alloc_skb() return NULL, the HNS driver will print error message, and than try again, if the memory is not enough for a while, huge error message and the retry operation will cause soft lockup. When napi_alloc_skb() return NULL because of no memory, we can get a warn_alloc() call trace, so this patch deletes the error message. We already use polling mode to handle irq, but the retry operation will render the polling weight inactive, this patch just return budget when the rx is not completed to avoid dead loop. Fixes: 36eedfd ("net: hns: Optimize hns_nic_common_poll for better performance") Fixes: b5996f1 ("net: add Hisilicon Network Subsystem basic ethernet support") Signed-off-by: Yonglong Liu <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 53d3749 commit 49edd6a

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

drivers/net/ethernet/hisilicon/hns/hns_enet.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -565,7 +565,6 @@ static int hns_nic_poll_rx_skb(struct hns_nic_ring_data *ring_data,
565565
skb = *out_skb = napi_alloc_skb(&ring_data->napi,
566566
HNS_RX_HEAD_SIZE);
567567
if (unlikely(!skb)) {
568-
netdev_err(ndev, "alloc rx skb fail\n");
569568
ring->stats.sw_err_cnt++;
570569
return -ENOMEM;
571570
}
@@ -1056,7 +1055,6 @@ static int hns_nic_common_poll(struct napi_struct *napi, int budget)
10561055
container_of(napi, struct hns_nic_ring_data, napi);
10571056
struct hnae_ring *ring = ring_data->ring;
10581057

1059-
try_again:
10601058
clean_complete += ring_data->poll_one(
10611059
ring_data, budget - clean_complete,
10621060
ring_data->ex_process);
@@ -1066,7 +1064,7 @@ static int hns_nic_common_poll(struct napi_struct *napi, int budget)
10661064
napi_complete(napi);
10671065
ring->q->handle->dev->ops->toggle_ring_irq(ring, 0);
10681066
} else {
1069-
goto try_again;
1067+
return budget;
10701068
}
10711069
}
10721070

0 commit comments

Comments
 (0)