Skip to content

Commit 8b147f6

Browse files
ShayAgrosdavem330
authored andcommitted
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: 548c494 ("net: ena: Implement XDP_TX action") Signed-off-by: Shay Agroskin <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 63d4a4c commit 8b147f6

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

drivers/net/ethernet/amazon/ena/ena_netdev.c

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2180,13 +2180,10 @@ static void ena_del_napi_in_range(struct ena_adapter *adapter,
21802180
int i;
21812181

21822182
for (i = first_index; i < first_index + count; i++) {
2183-
/* Check if napi was initialized before */
2184-
if (!ENA_IS_XDP_INDEX(adapter, i) ||
2185-
adapter->ena_napi[i].xdp_ring)
2186-
netif_napi_del(&adapter->ena_napi[i].napi);
2187-
else
2188-
WARN_ON(ENA_IS_XDP_INDEX(adapter, i) &&
2189-
adapter->ena_napi[i].xdp_ring);
2183+
netif_napi_del(&adapter->ena_napi[i].napi);
2184+
2185+
WARN_ON(!ENA_IS_XDP_INDEX(adapter, i) &&
2186+
adapter->ena_napi[i].xdp_ring);
21902187
}
21912188
}
21922189

0 commit comments

Comments
 (0)