aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/emulex
diff options
context:
space:
mode:
authorKalesh AP <kalesh.purayil@emulex.com>2015-02-23 04:20:12 -0500
committerDavid S. Miller <davem@davemloft.net>2015-02-23 15:08:32 -0500
commitd0e1b319bbf345e8b8cc8bd7702cc6c33db074d9 (patch)
tree25e410f113ab6c28bf7f2870232e983a934714d1 /drivers/net/ethernet/emulex
parenteb7dd46c634fa5b2f2039791bd2e79343318d6e5 (diff)
be2net: refactor error detect/recovery function
Currently when an error is detected, the queue resources are being cleaned up in the recovery routine. The resources are better cleaned up in the error detection routine itself (similar to EEH code.) So, this patch re-factors error processing logic to follow the following sequence: - check if there is an error in adapter - if error, - cleanup resources - attempt recovery The patch renames lancer_recover_func() to be_err_recover() as this routine will be used in the future for error recovery on Skyhawk too. Signed-off-by: Kalesh AP <kalesh.purayil@emulex.com> Signed-off-by: Sathya Perla <sathya.perla@emulex.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/emulex')
-rw-r--r--drivers/net/ethernet/emulex/benet/be_main.c31
1 files changed, 17 insertions, 14 deletions
diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c
index 74ba99577bf8..034ce7031ce2 100644
--- a/drivers/net/ethernet/emulex/benet/be_main.c
+++ b/drivers/net/ethernet/emulex/benet/be_main.c
@@ -2844,12 +2844,12 @@ void be_detect_error(struct be_adapter *adapter)
2844 sliport_err2 = ioread32(adapter->db + 2844 sliport_err2 = ioread32(adapter->db +
2845 SLIPORT_ERROR2_OFFSET); 2845 SLIPORT_ERROR2_OFFSET);
2846 adapter->hw_error = true; 2846 adapter->hw_error = true;
2847 error_detected = true;
2847 /* Do not log error messages if its a FW reset */ 2848 /* Do not log error messages if its a FW reset */
2848 if (sliport_err1 == SLIPORT_ERROR_FW_RESET1 && 2849 if (sliport_err1 == SLIPORT_ERROR_FW_RESET1 &&
2849 sliport_err2 == SLIPORT_ERROR_FW_RESET2) { 2850 sliport_err2 == SLIPORT_ERROR_FW_RESET2) {
2850 dev_info(dev, "Firmware update in progress\n"); 2851 dev_info(dev, "Firmware update in progress\n");
2851 } else { 2852 } else {
2852 error_detected = true;
2853 dev_err(dev, "Error detected in the card\n"); 2853 dev_err(dev, "Error detected in the card\n");
2854 dev_err(dev, "ERR: sliport status 0x%x\n", 2854 dev_err(dev, "ERR: sliport status 0x%x\n",
2855 sliport_status); 2855 sliport_status);
@@ -4903,8 +4903,9 @@ static void be_netdev_init(struct net_device *netdev)
4903 netdev->ethtool_ops = &be_ethtool_ops; 4903 netdev->ethtool_ops = &be_ethtool_ops;
4904} 4904}
4905 4905
4906static int lancer_recover_func(struct be_adapter *adapter) 4906static int be_err_recover(struct be_adapter *adapter)
4907{ 4907{
4908 struct net_device *netdev = adapter->netdev;
4908 struct device *dev = &adapter->pdev->dev; 4909 struct device *dev = &adapter->pdev->dev;
4909 int status; 4910 int status;
4910 4911
@@ -4912,23 +4913,20 @@ static int lancer_recover_func(struct be_adapter *adapter)
4912 if (status) 4913 if (status)
4913 goto err; 4914 goto err;
4914 4915
4915 if (netif_running(adapter->netdev))
4916 be_close(adapter->netdev);
4917
4918 be_clear(adapter);
4919
4920 be_clear_all_error(adapter); 4916 be_clear_all_error(adapter);
4921 4917
4922 status = be_setup(adapter); 4918 status = be_setup(adapter);
4923 if (status) 4919 if (status)
4924 goto err; 4920 goto err;
4925 4921
4926 if (netif_running(adapter->netdev)) { 4922 if (netif_running(netdev)) {
4927 status = be_open(adapter->netdev); 4923 status = be_open(netdev);
4928 if (status) 4924 if (status)
4929 goto err; 4925 goto err;
4930 } 4926 }
4931 4927
4928 netif_device_attach(netdev);
4929
4932 dev_err(dev, "Adapter recovery successful\n"); 4930 dev_err(dev, "Adapter recovery successful\n");
4933 return 0; 4931 return 0;
4934err: 4932err:
@@ -4945,18 +4943,23 @@ static void be_err_detection_task(struct work_struct *work)
4945 struct be_adapter *adapter = 4943 struct be_adapter *adapter =
4946 container_of(work, struct be_adapter, 4944 container_of(work, struct be_adapter,
4947 be_err_detection_work.work); 4945 be_err_detection_work.work);
4946 struct net_device *netdev = adapter->netdev;
4948 int status = 0; 4947 int status = 0;
4949 4948
4950 be_detect_error(adapter); 4949 be_detect_error(adapter);
4951 4950
4952 if (adapter->hw_error && lancer_chip(adapter)) { 4951 if (adapter->hw_error) {
4953 rtnl_lock(); 4952 rtnl_lock();
4954 netif_device_detach(adapter->netdev); 4953 netif_device_detach(netdev);
4954 if (netif_running(netdev))
4955 be_close(netdev);
4955 rtnl_unlock(); 4956 rtnl_unlock();
4956 4957
4957 status = lancer_recover_func(adapter); 4958 be_clear(adapter);
4958 if (!status) 4959
4959 netif_device_attach(adapter->netdev); 4960 /* As of now error recovery support is in Lancer only */
4961 if (lancer_chip(adapter))
4962 status = be_err_recover(adapter);
4960 } 4963 }
4961 4964
4962 /* In Lancer, for all errors other than provisioning error (-EAGAIN), 4965 /* In Lancer, for all errors other than provisioning error (-EAGAIN),