Skip to content

Commit 06aa040

Browse files
Avinash DayanandJeff Kirsher
authored andcommitted
i40evf: Don't schedule reset_task when device is being removed
When a host disables and enables a PF device, all the associated VFs are removed and added back in. It also generates a PFR which in turn resets all the connected VFs. This behaviour is different from that of Linux guest on Linux host. Hence we end up in a situation where there's a PFR and device removal at the same time. And watchdog doesn't have a clue about this and schedules a reset_task. This patch adds code to send signal to reset_task that the device is currently being removed. Signed-off-by: Avinash Dayanand <[email protected]> Tested-by: Andrew Bowers <[email protected]> Signed-off-by: Jeff Kirsher <[email protected]>
1 parent a558566 commit 06aa040

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

drivers/net/ethernet/intel/i40evf/i40evf.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,7 @@ enum i40evf_state_t {
187187
enum i40evf_critical_section_t {
188188
__I40EVF_IN_CRITICAL_TASK, /* cannot be interrupted */
189189
__I40EVF_IN_CLIENT_TASK,
190+
__I40EVF_IN_REMOVE_TASK, /* device being removed */
190191
};
191192

192193
/* board specific private data structure */

drivers/net/ethernet/intel/i40evf/i40evf_main.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1803,6 +1803,12 @@ static void i40evf_reset_task(struct work_struct *work)
18031803
int i = 0, err;
18041804
bool running;
18051805

1806+
/* When device is being removed it doesn't make sense to run the reset
1807+
* task, just return in such a case.
1808+
*/
1809+
if (test_bit(__I40EVF_IN_REMOVE_TASK, &adapter->crit_section))
1810+
return;
1811+
18061812
while (test_and_set_bit(__I40EVF_IN_CLIENT_TASK,
18071813
&adapter->crit_section))
18081814
usleep_range(500, 1000);
@@ -3053,7 +3059,8 @@ static void i40evf_remove(struct pci_dev *pdev)
30533059
struct i40evf_mac_filter *f, *ftmp;
30543060
struct i40e_hw *hw = &adapter->hw;
30553061
int err;
3056-
3062+
/* Indicate we are in remove and not to run reset_task */
3063+
set_bit(__I40EVF_IN_REMOVE_TASK, &adapter->crit_section);
30573064
cancel_delayed_work_sync(&adapter->init_task);
30583065
cancel_work_sync(&adapter->reset_task);
30593066
cancel_delayed_work_sync(&adapter->client_task);

0 commit comments

Comments
 (0)