提交 ac833bbf 编写于 作者: M Mitch Williams 提交者: Jeff Kirsher

i40evf: refactor reset

A recent change to the shutdown flow messed up the reset flow. Since
i40evf_down now holds the critical section lock, we cannot call it from
the reset handler, which also holds the lock. To do so causes a deadlock
accompanied by wailing and gnashing of teeth. This is easily triggered
by running an ethtool self-test on the PF device.

Instead, we move the relevant portions of i40evf_down into the reset
handler and bend them to our will. Additionally, we can optimize the
reinit path by not deleting the MAC and VLAN filters and then adding
them back again. Instead, we just set the 'add' flag and let the
watchdog resynchronize the filter list with the PF driver. We also
reword a few messages to make them more consistent with the rest of the
driver.

Change-ID: I03dd92ae736f7719fca3564b12a2cf9b98c6cb18
Signed-off-by: NMitch Williams <mitch.a.williams@intel.com>
Tested-by: NJim Young <james.m.young@intel.com>
Signed-off-by: NJeff Kirsher <jeffrey.t.kirsher@intel.com>
上级 748c434b
...@@ -1480,9 +1480,11 @@ static void i40evf_reset_task(struct work_struct *work) ...@@ -1480,9 +1480,11 @@ static void i40evf_reset_task(struct work_struct *work)
struct i40evf_adapter *adapter = container_of(work, struct i40evf_adapter *adapter = container_of(work,
struct i40evf_adapter, struct i40evf_adapter,
reset_task); reset_task);
struct net_device *netdev = adapter->netdev;
struct i40e_hw *hw = &adapter->hw; struct i40e_hw *hw = &adapter->hw;
int i = 0, err; struct i40evf_mac_filter *f;
uint32_t rstat_val; uint32_t rstat_val;
int i = 0, err;
while (test_and_set_bit(__I40EVF_IN_CRITICAL_TASK, while (test_and_set_bit(__I40EVF_IN_CRITICAL_TASK,
&adapter->crit_section)) &adapter->crit_section))
...@@ -1527,7 +1529,11 @@ static void i40evf_reset_task(struct work_struct *work) ...@@ -1527,7 +1529,11 @@ static void i40evf_reset_task(struct work_struct *work)
if (netif_running(adapter->netdev)) { if (netif_running(adapter->netdev)) {
set_bit(__I40E_DOWN, &adapter->vsi.state); set_bit(__I40E_DOWN, &adapter->vsi.state);
i40evf_down(adapter); i40evf_irq_disable(adapter);
i40evf_napi_disable_all(adapter);
netif_tx_disable(netdev);
netif_tx_stop_all_queues(netdev);
netif_carrier_off(netdev);
i40evf_free_traffic_irqs(adapter); i40evf_free_traffic_irqs(adapter);
i40evf_free_all_tx_resources(adapter); i40evf_free_all_tx_resources(adapter);
i40evf_free_all_rx_resources(adapter); i40evf_free_all_rx_resources(adapter);
...@@ -1559,22 +1565,37 @@ static void i40evf_reset_task(struct work_struct *work) ...@@ -1559,22 +1565,37 @@ static void i40evf_reset_task(struct work_struct *work)
continue_reset: continue_reset:
adapter->flags &= ~I40EVF_FLAG_RESET_PENDING; adapter->flags &= ~I40EVF_FLAG_RESET_PENDING;
i40evf_down(adapter); i40evf_irq_disable(adapter);
i40evf_napi_disable_all(adapter);
netif_tx_disable(netdev);
netif_tx_stop_all_queues(netdev);
netif_carrier_off(netdev);
adapter->state = __I40EVF_RESETTING; adapter->state = __I40EVF_RESETTING;
/* kill and reinit the admin queue */ /* kill and reinit the admin queue */
if (i40evf_shutdown_adminq(hw)) if (i40evf_shutdown_adminq(hw))
dev_warn(&adapter->pdev->dev, dev_warn(&adapter->pdev->dev, "Failed to shut down adminq\n");
"%s: Failed to destroy the Admin Queue resources\n", adapter->current_op = I40E_VIRTCHNL_OP_UNKNOWN;
__func__);
err = i40evf_init_adminq(hw); err = i40evf_init_adminq(hw);
if (err) if (err)
dev_info(&adapter->pdev->dev, "%s: init_adminq failed: %d\n", dev_info(&adapter->pdev->dev, "Failed to init adminq: %d\n",
__func__, err); err);
adapter->aq_pending = 0;
adapter->aq_required = 0;
i40evf_map_queues(adapter); i40evf_map_queues(adapter);
/* re-add all MAC filters */
list_for_each_entry(f, &adapter->mac_filter_list, list) {
f->add = true;
}
/* re-add all VLAN filters */
list_for_each_entry(f, &adapter->vlan_filter_list, list) {
f->add = true;
}
adapter->aq_required = I40EVF_FLAG_AQ_ADD_MAC_FILTER;
adapter->aq_required |= I40EVF_FLAG_AQ_ADD_VLAN_FILTER;
clear_bit(__I40EVF_IN_CRITICAL_TASK, &adapter->crit_section); clear_bit(__I40EVF_IN_CRITICAL_TASK, &adapter->crit_section);
mod_timer(&adapter->watchdog_timer, jiffies + 2); mod_timer(&adapter->watchdog_timer, jiffies + 2);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册