Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 17a402a0 authored by Carolyn Wyborny's avatar Carolyn Wyborny Committed by David S. Miller
Browse files

igb: Fixes needed for surprise removal support



This patch adds some checks in order to prevent panic's on surprise
removal of devices during S0, S3, S4.  Without this patch, Thunderbolt
type device removal will panic the system.

Signed-off-by: default avatarYanir Lubetkin <yanirx.lubetkin@intel.com>
Signed-off-by: default avatarCarolyn Wyborny <carolyn.wyborny@intel.com>
Tested-by: default avatarAaron Brown <aaron.f.brown@intel.com>
Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent b5b2ffc0
Loading
Loading
Loading
Loading
+16 −7
Original line number Diff line number Diff line
@@ -1012,6 +1012,7 @@ static void igb_free_q_vector(struct igb_adapter *adapter, int v_idx)
	/* igb_get_stats64() might access the rings on this vector,
	 * we must wait a grace period before freeing it.
	 */
	if (q_vector)
		kfree_rcu(q_vector, rcu);
}

@@ -1792,8 +1793,10 @@ void igb_down(struct igb_adapter *adapter)
	adapter->flags &= ~IGB_FLAG_NEED_LINK_UPDATE;

	for (i = 0; i < adapter->num_q_vectors; i++) {
		napi_synchronize(&(adapter->q_vector[i]->napi));
		napi_disable(&(adapter->q_vector[i]->napi));
		if (adapter->q_vector[i]) {
			napi_synchronize(&adapter->q_vector[i]->napi);
			napi_disable(&adapter->q_vector[i]->napi);
		}
	}


@@ -3717,6 +3720,7 @@ static void igb_free_all_tx_resources(struct igb_adapter *adapter)
	int i;

	for (i = 0; i < adapter->num_tx_queues; i++)
		if (adapter->tx_ring[i])
			igb_free_tx_resources(adapter->tx_ring[i]);
}

@@ -3782,6 +3786,7 @@ static void igb_clean_all_tx_rings(struct igb_adapter *adapter)
	int i;

	for (i = 0; i < adapter->num_tx_queues; i++)
		if (adapter->tx_ring[i])
			igb_clean_tx_ring(adapter->tx_ring[i]);
}

@@ -3819,6 +3824,7 @@ static void igb_free_all_rx_resources(struct igb_adapter *adapter)
	int i;

	for (i = 0; i < adapter->num_rx_queues; i++)
		if (adapter->rx_ring[i])
			igb_free_rx_resources(adapter->rx_ring[i]);
}

@@ -3874,6 +3880,7 @@ static void igb_clean_all_rx_rings(struct igb_adapter *adapter)
	int i;

	for (i = 0; i < adapter->num_rx_queues; i++)
		if (adapter->rx_ring[i])
			igb_clean_rx_ring(adapter->rx_ring[i]);
}

@@ -7404,6 +7411,8 @@ static int igb_resume(struct device *dev)
	pci_restore_state(pdev);
	pci_save_state(pdev);

	if (!pci_device_is_present(pdev))
		return -ENODEV;
	err = pci_enable_device_mem(pdev);
	if (err) {
		dev_err(&pdev->dev,