Commit b4c8998b authored by David S. Miller's avatar David S. Miller

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: default avatarDavid S. Miller <davem@davemloft.net>
parents ad664118 ccd143e5
...@@ -2180,13 +2180,10 @@ static void ena_del_napi_in_range(struct ena_adapter *adapter, ...@@ -2180,13 +2180,10 @@ static void ena_del_napi_in_range(struct ena_adapter *adapter,
int i; int i;
for (i = first_index; i < first_index + count; i++) { for (i = first_index; i < first_index + count; i++) {
/* Check if napi was initialized before */ netif_napi_del(&adapter->ena_napi[i].napi);
if (!ENA_IS_XDP_INDEX(adapter, i) ||
adapter->ena_napi[i].xdp_ring) WARN_ON(!ENA_IS_XDP_INDEX(adapter, i) &&
netif_napi_del(&adapter->ena_napi[i].napi); adapter->ena_napi[i].xdp_ring);
else
WARN_ON(ENA_IS_XDP_INDEX(adapter, i) &&
adapter->ena_napi[i].xdp_ring);
} }
} }
...@@ -3601,16 +3598,14 @@ static void ena_fw_reset_device(struct work_struct *work) ...@@ -3601,16 +3598,14 @@ static void ena_fw_reset_device(struct work_struct *work)
{ {
struct ena_adapter *adapter = struct ena_adapter *adapter =
container_of(work, struct ena_adapter, reset_task); container_of(work, struct ena_adapter, reset_task);
struct pci_dev *pdev = adapter->pdev;
if (unlikely(!test_bit(ENA_FLAG_TRIGGER_RESET, &adapter->flags))) {
dev_err(&pdev->dev,
"device reset schedule while reset bit is off\n");
return;
}
rtnl_lock(); rtnl_lock();
ena_destroy_device(adapter, false);
ena_restore_device(adapter); if (likely(test_bit(ENA_FLAG_TRIGGER_RESET, &adapter->flags))) {
ena_destroy_device(adapter, false);
ena_restore_device(adapter);
}
rtnl_unlock(); rtnl_unlock();
} }
...@@ -3692,7 +3687,7 @@ static int check_missing_comp_in_tx_queue(struct ena_adapter *adapter, ...@@ -3692,7 +3687,7 @@ static int check_missing_comp_in_tx_queue(struct ena_adapter *adapter,
} }
u64_stats_update_begin(&tx_ring->syncp); u64_stats_update_begin(&tx_ring->syncp);
tx_ring->tx_stats.missed_tx = missed_tx; tx_ring->tx_stats.missed_tx += missed_tx;
u64_stats_update_end(&tx_ring->syncp); u64_stats_update_end(&tx_ring->syncp);
return rc; return rc;
...@@ -4389,8 +4384,11 @@ static void __ena_shutoff(struct pci_dev *pdev, bool shutdown) ...@@ -4389,8 +4384,11 @@ static void __ena_shutoff(struct pci_dev *pdev, bool shutdown)
netdev->rx_cpu_rmap = NULL; netdev->rx_cpu_rmap = NULL;
} }
#endif /* CONFIG_RFS_ACCEL */ #endif /* CONFIG_RFS_ACCEL */
del_timer_sync(&adapter->timer_service);
/* Make sure timer and reset routine won't be called after
* freeing device resources.
*/
del_timer_sync(&adapter->timer_service);
cancel_work_sync(&adapter->reset_task); cancel_work_sync(&adapter->reset_task);
rtnl_lock(); /* lock released inside the below if-else block */ rtnl_lock(); /* lock released inside the below if-else block */
...@@ -4558,6 +4556,9 @@ static void ena_keep_alive_wd(void *adapter_data, ...@@ -4558,6 +4556,9 @@ static void ena_keep_alive_wd(void *adapter_data,
tx_drops = ((u64)desc->tx_drops_high << 32) | desc->tx_drops_low; tx_drops = ((u64)desc->tx_drops_high << 32) | desc->tx_drops_low;
u64_stats_update_begin(&adapter->syncp); u64_stats_update_begin(&adapter->syncp);
/* These stats are accumulated by the device, so the counters indicate
* all drops since last reset.
*/
adapter->dev_stats.rx_drops = rx_drops; adapter->dev_stats.rx_drops = rx_drops;
adapter->dev_stats.tx_drops = tx_drops; adapter->dev_stats.tx_drops = tx_drops;
u64_stats_update_end(&adapter->syncp); u64_stats_update_end(&adapter->syncp);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment