Skip to content

Commit 3e5bfb1

Browse files
Sameeh Jubrandavem330
authored andcommitted
net: ena: Fix bug where ring allocation backoff stopped too late
The current code of create_queues_with_size_backoff() allows the ring size to become as small as ENA_MIN_RING_SIZE/2. This is a bug since we don't want the queue ring to be smaller than ENA_MIN_RING_SIZE In this commit we change the loop's termination condition to look at the queue size of the next iteration instead of that of the current one, so that the minimal queue size again becomes ENA_MIN_RING_SIZE. Fixes: eece4d2 ("net: ena: add ethtool function for changing io queue sizes") Signed-off-by: Arthur Kiyanovski <[email protected]> Signed-off-by: Sameeh Jubran <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 137e4e1 commit 3e5bfb1

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1839,8 +1839,8 @@ static int create_queues_with_size_backoff(struct ena_adapter *adapter)
18391839
if (cur_rx_ring_size >= cur_tx_ring_size)
18401840
new_rx_ring_size = cur_rx_ring_size / 2;
18411841

1842-
if (cur_tx_ring_size < ENA_MIN_RING_SIZE ||
1843-
cur_rx_ring_size < ENA_MIN_RING_SIZE) {
1842+
if (new_tx_ring_size < ENA_MIN_RING_SIZE ||
1843+
new_rx_ring_size < ENA_MIN_RING_SIZE) {
18441844
netif_err(adapter, ifup, adapter->netdev,
18451845
"Queue creation failed with the smallest possible queue size of %d for both queues. Not retrying with smaller queues\n",
18461846
ENA_MIN_RING_SIZE);

0 commit comments

Comments
 (0)