public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
To: davem@davemloft.net
Cc: Mitch Williams <mitch.a.williams@intel.com>,
	netdev@vger.kernel.org, nhorman@redhat.com, sassmann@redhat.com,
	jogreene@redhat.com, Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Subject: [net-next v2 15/16] i40evf: refactor reset
Date: Mon, 23 Feb 2015 18:11:20 -0800	[thread overview]
Message-ID: <1424743881-30485-16-git-send-email-jeffrey.t.kirsher@intel.com> (raw)
In-Reply-To: <1424743881-30485-1-git-send-email-jeffrey.t.kirsher@intel.com>

From: Mitch Williams <mitch.a.williams@intel.com>

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: Mitch Williams <mitch.a.williams@intel.com>
Tested-by: Jim Young <james.m.young@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
 drivers/net/ethernet/intel/i40evf/i40evf_main.c | 41 +++++++++++++++++++------
 1 file changed, 31 insertions(+), 10 deletions(-)

diff --git a/drivers/net/ethernet/intel/i40evf/i40evf_main.c b/drivers/net/ethernet/intel/i40evf/i40evf_main.c
index eb1ac22..1257577 100644
--- a/drivers/net/ethernet/intel/i40evf/i40evf_main.c
+++ b/drivers/net/ethernet/intel/i40evf/i40evf_main.c
@@ -1480,9 +1480,11 @@ static void i40evf_reset_task(struct work_struct *work)
 	struct i40evf_adapter *adapter = container_of(work,
 						      struct i40evf_adapter,
 						      reset_task);
+	struct net_device *netdev = adapter->netdev;
 	struct i40e_hw *hw = &adapter->hw;
-	int i = 0, err;
+	struct i40evf_mac_filter *f;
 	uint32_t rstat_val;
+	int i = 0, err;
 
 	while (test_and_set_bit(__I40EVF_IN_CRITICAL_TASK,
 				&adapter->crit_section))
@@ -1527,7 +1529,11 @@ static void i40evf_reset_task(struct work_struct *work)
 
 		if (netif_running(adapter->netdev)) {
 			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_all_tx_resources(adapter);
 			i40evf_free_all_rx_resources(adapter);
@@ -1559,22 +1565,37 @@ static void i40evf_reset_task(struct work_struct *work)
 continue_reset:
 	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;
 
 	/* kill and reinit the admin queue */
 	if (i40evf_shutdown_adminq(hw))
-		dev_warn(&adapter->pdev->dev,
-			 "%s: Failed to destroy the Admin Queue resources\n",
-			 __func__);
+		dev_warn(&adapter->pdev->dev, "Failed to shut down adminq\n");
+	adapter->current_op = I40E_VIRTCHNL_OP_UNKNOWN;
 	err = i40evf_init_adminq(hw);
 	if (err)
-		dev_info(&adapter->pdev->dev, "%s: init_adminq failed: %d\n",
-			 __func__, err);
+		dev_info(&adapter->pdev->dev, "Failed to init adminq: %d\n",
+			 err);
 
-	adapter->aq_pending = 0;
-	adapter->aq_required = 0;
 	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);
 
 	mod_timer(&adapter->watchdog_timer, jiffies + 2);
-- 
1.9.3

  parent reply	other threads:[~2015-02-24  2:11 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-24  2:11 [net-next v2 00/16][pull request] Intel Wired LAN Driver Updates 2015-02-23 Jeff Kirsher
2015-02-24  2:11 ` [net-next v2 01/16] e1000e: initial support for i219 Jeff Kirsher
2015-02-24  2:11 ` [net-next v2 02/16] igbvf: Fix code comments and whitespace Jeff Kirsher
2015-02-24  2:11 ` [net-next v2 03/16] igbvf: cleanup msleep() and min/max() usage Jeff Kirsher
2015-02-24  2:11 ` [net-next v2 04/16] i40e: update Shadow RAM read/write functions Jeff Kirsher
2015-02-24  2:11 ` [net-next v2 05/16] i40e: rename debugfs clear_stats option Jeff Kirsher
2015-02-24  2:11 ` [net-next v2 06/16] i40e/i40evf: Refactor the receive routines Jeff Kirsher
2015-02-24  2:11 ` [net-next v2 07/16] i40e/i40evf: restrict VC opcodes to their initial values Jeff Kirsher
2015-02-24  2:11 ` [net-next v2 08/16] i40e: Use #define for the VSI connection type Jeff Kirsher
2015-02-24  2:11 ` [net-next v2 09/16] i40e/i40evf: i40e_register.h updates Jeff Kirsher
2015-02-24  2:11 ` [net-next v2 10/16] i40e: Fix the EMPR interrupt received handling Jeff Kirsher
2015-02-24  2:11 ` [net-next v2 11/16] i40e/i40evf: Remove unused variable an_enable and function update_link_info Jeff Kirsher
2015-02-24  2:11 ` [net-next v2 12/16] i40e/i40evf: Bump Driver Versions Jeff Kirsher
2015-02-24  2:11 ` [net-next v2 13/16] i40e: Fix i40e_ndo_set_vf_spoofchk Jeff Kirsher
2015-02-24  2:11 ` [net-next v2 14/16] i40evf: disable NAPI polling sooner Jeff Kirsher
2015-02-24  2:11 ` Jeff Kirsher [this message]
2015-02-24  2:11 ` [net-next v2 16/16] i40evf: don't wait forever Jeff Kirsher
2015-02-24  2:58 ` [net-next v2 00/16][pull request] Intel Wired LAN Driver Updates 2015-02-23 David Miller
2015-02-24  6:50   ` Jeff Kirsher
2015-02-24 16:49     ` David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1424743881-30485-16-git-send-email-jeffrey.t.kirsher@intel.com \
    --to=jeffrey.t.kirsher@intel.com \
    --cc=davem@davemloft.net \
    --cc=jogreene@redhat.com \
    --cc=mitch.a.williams@intel.com \
    --cc=netdev@vger.kernel.org \
    --cc=nhorman@redhat.com \
    --cc=sassmann@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox