Skip to content

Commit b4c8998

Browse files
committed
Merge branch 'Bug-fixes-for-ENA-ethernet-driver'
Shay Agroskin says: ==================== Bug fixes for ENA ethernet driver This series adds the following: - Fix undesired call to ena_restore after returning from suspend - Fix condition inside a WARN_ON - Fix overriding previous value when updating missed_tx statistic v1->v2: - fix bug when calling reset routine after device resources are freed (Jakub) v2->v3: - fix wrong hash in 'Fixes' tag ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents ad66411 + ccd143e commit b4c8998

File tree

1 file changed

+18
-17
lines changed

1 file changed

+18
-17
lines changed

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

Lines changed: 18 additions & 17 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

@@ -3601,16 +3598,14 @@ static void ena_fw_reset_device(struct work_struct *work)
36013598
{
36023599
struct ena_adapter *adapter =
36033600
container_of(work, struct ena_adapter, reset_task);
3604-
struct pci_dev *pdev = adapter->pdev;
36053601

3606-
if (unlikely(!test_bit(ENA_FLAG_TRIGGER_RESET, &adapter->flags))) {
3607-
dev_err(&pdev->dev,
3608-
"device reset schedule while reset bit is off\n");
3609-
return;
3610-
}
36113602
rtnl_lock();
3612-
ena_destroy_device(adapter, false);
3613-
ena_restore_device(adapter);
3603+
3604+
if (likely(test_bit(ENA_FLAG_TRIGGER_RESET, &adapter->flags))) {
3605+
ena_destroy_device(adapter, false);
3606+
ena_restore_device(adapter);
3607+
}
3608+
36143609
rtnl_unlock();
36153610
}
36163611

@@ -3692,7 +3687,7 @@ static int check_missing_comp_in_tx_queue(struct ena_adapter *adapter,
36923687
}
36933688

36943689
u64_stats_update_begin(&tx_ring->syncp);
3695-
tx_ring->tx_stats.missed_tx = missed_tx;
3690+
tx_ring->tx_stats.missed_tx += missed_tx;
36963691
u64_stats_update_end(&tx_ring->syncp);
36973692

36983693
return rc;
@@ -4389,8 +4384,11 @@ static void __ena_shutoff(struct pci_dev *pdev, bool shutdown)
43894384
netdev->rx_cpu_rmap = NULL;
43904385
}
43914386
#endif /* CONFIG_RFS_ACCEL */
4392-
del_timer_sync(&adapter->timer_service);
43934387

4388+
/* Make sure timer and reset routine won't be called after
4389+
* freeing device resources.
4390+
*/
4391+
del_timer_sync(&adapter->timer_service);
43944392
cancel_work_sync(&adapter->reset_task);
43954393

43964394
rtnl_lock(); /* lock released inside the below if-else block */
@@ -4558,6 +4556,9 @@ static void ena_keep_alive_wd(void *adapter_data,
45584556
tx_drops = ((u64)desc->tx_drops_high << 32) | desc->tx_drops_low;
45594557

45604558
u64_stats_update_begin(&adapter->syncp);
4559+
/* These stats are accumulated by the device, so the counters indicate
4560+
* all drops since last reset.
4561+
*/
45614562
adapter->dev_stats.rx_drops = rx_drops;
45624563
adapter->dev_stats.tx_drops = tx_drops;
45634564
u64_stats_update_end(&adapter->syncp);

0 commit comments

Comments
 (0)