• Shay Agroskin's avatar
    net: ena: Change WARN_ON expression in ena_del_napi_in_range() · 8b147f6f
    Shay Agroskin authored
    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: 548c4940 ("net: ena: Implement XDP_TX action")
    Signed-off-by: default avatarShay Agroskin <shayagr@amazon.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    8b147f6f
ena_netdev.c 123 KB