mirror of
https://github.com/torvalds/linux.git
synced 2024-11-24 05:02:12 +00:00
net: hns3: add max order judgement for tx spare buffer
Add max order judgement for tx spare buffer to avoid triggering
call trace, print related fail information instead, when user
set tx spare buf size to a large value which causes order
exceeding 10.
Fixes: e445f08af2
("net: hns3: add support to set/get tx copybreak buf size via ethtool for hns3 driver")
Signed-off-by: Hao Chen <chenhao288@hisilicon.com>
Signed-off-by: Guangbin Huang <huangguangbin2@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
8778372118
commit
a89cbb1699
@ -1038,6 +1038,12 @@ static void hns3_init_tx_spare_buffer(struct hns3_enet_ring *ring)
|
||||
return;
|
||||
|
||||
order = get_order(alloc_size);
|
||||
if (order >= MAX_ORDER) {
|
||||
if (net_ratelimit())
|
||||
dev_warn(ring_to_dev(ring), "failed to allocate tx spare buffer, exceed to max order\n");
|
||||
return;
|
||||
}
|
||||
|
||||
tx_spare = devm_kzalloc(ring_to_dev(ring), sizeof(*tx_spare),
|
||||
GFP_KERNEL);
|
||||
if (!tx_spare) {
|
||||
|
Loading…
Reference in New Issue
Block a user