From: Alexander Duyck <aduyck@mirantis.com>
To: intel-wired-lan@osuosl.org
Subject: [Intel-wired-lan] [next PATCH 3/5] fm10k: Cleanup exception handling for changing queues
Date: Tue, 27 Oct 2015 16:59:24 -0700 [thread overview]
Message-ID: <20151027235924.30048.24399.stgit@localhost.localdomain> (raw)
In-Reply-To: <20151027235341.30048.46286.stgit@localhost.localdomain>
This patch is meant to cleanup the exception handling for the paths where
we reset the interrupts and then reconfigure them. In all of these paths
we had very different levels of exception handling. I have updated the
driver so that all of the paths should result in a similar state if we
fail.
Specifically the driver will now unload the mailbox interrupt, free the
queue vectors and MSI-X, and then detach the interface.
In addition for any of the PCIe related resets I have added a check with
the hw_ready function to just make sure the registers are in a readable
state prior to reopening the interface.
Signed-off-by: Alexander Duyck <aduyck@mirantis.com>
---
drivers/net/ethernet/intel/fm10k/fm10k_netdev.c | 17 +++++--
drivers/net/ethernet/intel/fm10k/fm10k_pci.c | 55 ++++++++++++++++++-----
2 files changed, 55 insertions(+), 17 deletions(-)
diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_netdev.c b/drivers/net/ethernet/intel/fm10k/fm10k_netdev.c
index 38fe2d8c8388..4855686d2b4e 100644
--- a/drivers/net/ethernet/intel/fm10k/fm10k_netdev.c
+++ b/drivers/net/ethernet/intel/fm10k/fm10k_netdev.c
@@ -1176,19 +1176,28 @@ int fm10k_setup_tc(struct net_device *dev, u8 tc)
err = fm10k_init_queueing_scheme(interface);
if (err)
- return err;
+ goto err_queueing_scheme;
err = fm10k_mbx_request_irq(interface);
if (err)
- return err;
+ goto err_mbx_irq;
- if (netif_running(dev))
- fm10k_open(dev);
+ err = netif_running(dev) ? fm10k_open(dev) : 0;
+ if (err)
+ goto err_open;
/* flag to indicate SWPRI has yet to be updated */
interface->flags |= FM10K_FLAG_SWPRI_CONFIG;
return 0;
+err_open:
+ fm10k_mbx_free_irq(interface);
+err_mbx_irq:
+ fm10k_clear_queueing_scheme(interface);
+err_queueing_scheme:
+ netif_device_detach(dev);
+
+ return err;
}
static int fm10k_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd)
diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_pci.c b/drivers/net/ethernet/intel/fm10k/fm10k_pci.c
index 15327d274d72..7b33cddfc6be 100644
--- a/drivers/net/ethernet/intel/fm10k/fm10k_pci.c
+++ b/drivers/net/ethernet/intel/fm10k/fm10k_pci.c
@@ -185,7 +185,13 @@ static void fm10k_reinit(struct fm10k_intfc *interface)
}
/* reassociate interrupts */
- fm10k_mbx_request_irq(interface);
+ err = fm10k_mbx_request_irq(interface);
+ if (err)
+ goto err_mbx_irq;
+
+ err = fm10k_hw_ready(interface);
+ if (err)
+ goto err_open;
/* update hardware address for VFs if perm_addr has changed */
if (hw->mac.type == fm10k_mac_vf) {
@@ -205,14 +211,23 @@ static void fm10k_reinit(struct fm10k_intfc *interface)
/* reset clock */
fm10k_ts_reset(interface);
- if (netif_running(netdev))
- fm10k_open(netdev);
-
+ err = netif_running(netdev) ? fm10k_open(netdev) : 0;
+ if (err)
+ goto err_open;
+
fm10k_iov_resume(interface->pdev);
+ rtnl_unlock();
+
+ clear_bit(__FM10K_RESETTING, &interface->state);
+
+ return;
+err_open:
+ fm10k_mbx_free_irq(interface);
+err_mbx_irq:
+ fm10k_clear_queueing_scheme(interface);
reinit_err:
- if (err)
- netif_device_detach(netdev);
+ netif_device_detach(netdev);
rtnl_unlock();
@@ -2130,16 +2145,22 @@ static int fm10k_resume(struct pci_dev *pdev)
rtnl_lock();
err = fm10k_init_queueing_scheme(interface);
- if (!err) {
- fm10k_mbx_request_irq(interface);
- if (netif_running(netdev))
- err = fm10k_open(netdev);
- }
+ if (err)
+ goto err_queueing_scheme;
- rtnl_unlock();
+ err = fm10k_mbx_request_irq(interface);
+ if (err)
+ goto err_mbx_irq;
+ err = fm10k_hw_ready(interface);
if (err)
- return err;
+ goto err_open;
+
+ err = netif_running(netdev) ? fm10k_open(netdev) : 0;
+ if (err)
+ goto err_open;
+
+ rtnl_unlock();
/* assume host is not ready, to prevent race with watchdog in case we
* actually don't have connection to the switch
@@ -2157,6 +2178,14 @@ static int fm10k_resume(struct pci_dev *pdev)
netif_device_attach(netdev);
return 0;
+err_open:
+ fm10k_mbx_free_irq(interface);
+err_mbx_irq:
+ fm10k_clear_queueing_scheme(interface);
+err_queueing_scheme:
+ rtnl_unlock();
+
+ return err;
}
/**
next prev parent reply other threads:[~2015-10-27 23:59 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-27 23:59 [Intel-wired-lan] [next PATCH 0/5] Misc Intel driver cleanups Alexander Duyck
2015-10-27 23:59 ` [Intel-wired-lan] [next PATCH 1/5] fm10k: Cleanup MSI-X interrupts in case of failure Alexander Duyck
2015-10-28 16:11 ` Allan, Bruce W
2015-11-03 20:45 ` Singh, Krishneil K
2015-10-27 23:59 ` [Intel-wired-lan] [next PATCH 2/5] fm10k: Cleanup exception handling for mailbox interrupt Alexander Duyck
2015-10-28 16:11 ` Allan, Bruce W
2015-11-03 20:47 ` Singh, Krishneil K
2015-10-27 23:59 ` Alexander Duyck [this message]
2015-10-28 16:11 ` [Intel-wired-lan] [next PATCH 3/5] fm10k: Cleanup exception handling for changing queues Allan, Bruce W
2015-10-29 19:12 ` Allan, Bruce W
2015-10-29 19:39 ` Alexander Duyck
2015-11-03 23:20 ` Allan, Bruce W
2015-11-10 16:46 ` Allan, Bruce W
2015-11-10 17:30 ` Jeff Kirsher
2015-11-03 20:48 ` Singh, Krishneil K
2015-10-27 23:59 ` [Intel-wired-lan] [next PATCH 4/5] e1000e: Switch e1000e_up to void, drop code checking for error result Alexander Duyck
2015-11-20 4:48 ` Brown, Aaron F
2015-10-27 23:59 ` [Intel-wired-lan] [next PATCH 5/5] igb: Fix unused variable warning Alexander Duyck
2015-11-20 4:50 ` Brown, Aaron F
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=20151027235924.30048.24399.stgit@localhost.localdomain \
--to=aduyck@mirantis.com \
--cc=intel-wired-lan@osuosl.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.