]> git.baikalelectronics.ru Git - kernel.git/commit
net: ena: Change WARN_ON expression in ena_del_napi_in_range()
authorShay Agroskin <shayagr@amazon.com>
Wed, 19 Aug 2020 17:28:37 +0000 (20:28 +0300)
committerDavid S. Miller <davem@davemloft.net>
Wed, 19 Aug 2020 22:32:58 +0000 (15:32 -0700)
commit716609d04b46fd586bfdffeaeda9fd0dc7aa51a4
tree533562150d20ce2f93ee16acb4d6b4e654bee647
parenta5cbdef8bed52acc6840b4e039b95e0d103199d5
net: ena: Change WARN_ON expression in ena_del_napi_in_range()

The ena_del_napi_in_range() function unregisters the napi handler for
rings in a given range.
This function had the following WARN_ON macro:

    WARN_ON(ENA_IS_XDP_INDEX(adapter, i) &&
    adapter->ena_napi[i].xdp_ring);

This macro prints the call stack if the expression inside of it is
true [1], but the expression inside of it is the wanted situation.
The expression checks whether the ring has an XDP queue and its index
corresponds to a XDP one.

This patch changes the expression to
    !ENA_IS_XDP_INDEX(adapter, i) && adapter->ena_napi[i].xdp_ring
which indicates an unwanted situation.

Also, change the structure of the function. The napi handler is
unregistered for all rings, and so there's no need to check whether the
index is an XDP index or not. By removing this check the code becomes
much more readable.

Fixes: 27938dd2da07 ("net: ena: Implement XDP_TX action")
Signed-off-by: Shay Agroskin <shayagr@amazon.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/amazon/ena/ena_netdev.c