]> git.baikalelectronics.ru Git - kernel.git/commit
net: ena: fix napi handler misbehavior when the napi budget is zero
authorNetanel Belgazal <netanel@amazon.com>
Tue, 10 Dec 2019 11:27:44 +0000 (11:27 +0000)
committerDavid S. Miller <davem@davemloft.net>
Wed, 11 Dec 2019 01:54:55 +0000 (17:54 -0800)
commitbbc39bbe1f3b6e9998ecd061bf5447a92ea880bc
tree821daa97021894df332802ff84c8e543bfcbebbf
parenta02e4230ea74a590a4ddb81ab396ea4e6a779de3
net: ena: fix napi handler misbehavior when the napi budget is zero

In netpoll the napi handler could be called with budget equal to zero.
Current ENA napi handler doesn't take that into consideration.

The napi handler handles Rx packets in a do-while loop.
Currently, the budget check happens only after decrementing the
budget, therefore the napi handler, in rare cases, could run over
MAX_INT packets.

In addition to that, this moves all budget related variables to int
calculation and stop mixing u32 to avoid ambiguity

Fixes: 42904aea461f ("net: ena: Add a driver for Amazon Elastic Network Adapters (ENA)")
Signed-off-by: Netanel Belgazal <netanel@amazon.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/amazon/ena/ena_netdev.c