forked from mirrors/linux
		
	bnx2: Add PCI Advanced Error Reporting support.
Signed-off-by: John Feeney <jfeeney@redhat.com> Signed-off-by: Michael Chan <mchan@broadcom.com> Signed-off-by: Benjamin Li <benli@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
		
							parent
							
								
									05532121da
								
							
						
					
					
						commit
						cd709aa906
					
				
					 1 changed files with 35 additions and 11 deletions
				
			
		| 
						 | 
					@ -49,6 +49,7 @@
 | 
				
			||||||
#include <linux/cache.h>
 | 
					#include <linux/cache.h>
 | 
				
			||||||
#include <linux/firmware.h>
 | 
					#include <linux/firmware.h>
 | 
				
			||||||
#include <linux/log2.h>
 | 
					#include <linux/log2.h>
 | 
				
			||||||
 | 
					#include <linux/aer.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if defined(CONFIG_CNIC) || defined(CONFIG_CNIC_MODULE)
 | 
					#if defined(CONFIG_CNIC) || defined(CONFIG_CNIC_MODULE)
 | 
				
			||||||
#define BCM_CNIC 1
 | 
					#define BCM_CNIC 1
 | 
				
			||||||
| 
						 | 
					@ -7890,6 +7891,7 @@ bnx2_init_board(struct pci_dev *pdev, struct net_device *dev)
 | 
				
			||||||
	int rc, i, j;
 | 
						int rc, i, j;
 | 
				
			||||||
	u32 reg;
 | 
						u32 reg;
 | 
				
			||||||
	u64 dma_mask, persist_dma_mask;
 | 
						u64 dma_mask, persist_dma_mask;
 | 
				
			||||||
 | 
						int err;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	SET_NETDEV_DEV(dev, &pdev->dev);
 | 
						SET_NETDEV_DEV(dev, &pdev->dev);
 | 
				
			||||||
	bp = netdev_priv(dev);
 | 
						bp = netdev_priv(dev);
 | 
				
			||||||
| 
						 | 
					@ -7925,6 +7927,14 @@ bnx2_init_board(struct pci_dev *pdev, struct net_device *dev)
 | 
				
			||||||
		goto err_out_disable;
 | 
							goto err_out_disable;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						/* AER (Advanced Error Reporting) hooks */
 | 
				
			||||||
 | 
						err = pci_enable_pcie_error_reporting(pdev);
 | 
				
			||||||
 | 
						if (err) {
 | 
				
			||||||
 | 
							dev_err(&pdev->dev, "pci_enable_pcie_error_reporting failed "
 | 
				
			||||||
 | 
									    "0x%x\n", err);
 | 
				
			||||||
 | 
							/* non-fatal, continue */
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pci_set_master(pdev);
 | 
						pci_set_master(pdev);
 | 
				
			||||||
	pci_save_state(pdev);
 | 
						pci_save_state(pdev);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -8246,6 +8256,7 @@ bnx2_init_board(struct pci_dev *pdev, struct net_device *dev)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
err_out_release:
 | 
					err_out_release:
 | 
				
			||||||
 | 
						pci_disable_pcie_error_reporting(pdev);
 | 
				
			||||||
	pci_release_regions(pdev);
 | 
						pci_release_regions(pdev);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
err_out_disable:
 | 
					err_out_disable:
 | 
				
			||||||
| 
						 | 
					@ -8436,6 +8447,9 @@ bnx2_remove_one(struct pci_dev *pdev)
 | 
				
			||||||
	kfree(bp->temp_stats_blk);
 | 
						kfree(bp->temp_stats_blk);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	free_netdev(dev);
 | 
						free_netdev(dev);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						pci_disable_pcie_error_reporting(pdev);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pci_release_regions(pdev);
 | 
						pci_release_regions(pdev);
 | 
				
			||||||
	pci_disable_device(pdev);
 | 
						pci_disable_device(pdev);
 | 
				
			||||||
	pci_set_drvdata(pdev, NULL);
 | 
						pci_set_drvdata(pdev, NULL);
 | 
				
			||||||
| 
						 | 
					@ -8527,14 +8541,15 @@ static pci_ers_result_t bnx2_io_slot_reset(struct pci_dev *pdev)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct net_device *dev = pci_get_drvdata(pdev);
 | 
						struct net_device *dev = pci_get_drvdata(pdev);
 | 
				
			||||||
	struct bnx2 *bp = netdev_priv(dev);
 | 
						struct bnx2 *bp = netdev_priv(dev);
 | 
				
			||||||
 | 
						pci_ers_result_t result;
 | 
				
			||||||
 | 
						int err;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	rtnl_lock();
 | 
						rtnl_lock();
 | 
				
			||||||
	if (pci_enable_device(pdev)) {
 | 
						if (pci_enable_device(pdev)) {
 | 
				
			||||||
		dev_err(&pdev->dev,
 | 
							dev_err(&pdev->dev,
 | 
				
			||||||
			"Cannot re-enable PCI device after reset\n");
 | 
								"Cannot re-enable PCI device after reset\n");
 | 
				
			||||||
		rtnl_unlock();
 | 
							result = PCI_ERS_RESULT_DISCONNECT;
 | 
				
			||||||
		return PCI_ERS_RESULT_DISCONNECT;
 | 
						} else {
 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
		pci_set_master(pdev);
 | 
							pci_set_master(pdev);
 | 
				
			||||||
		pci_restore_state(pdev);
 | 
							pci_restore_state(pdev);
 | 
				
			||||||
		pci_save_state(pdev);
 | 
							pci_save_state(pdev);
 | 
				
			||||||
| 
						 | 
					@ -8543,9 +8558,18 @@ static pci_ers_result_t bnx2_io_slot_reset(struct pci_dev *pdev)
 | 
				
			||||||
			bnx2_set_power_state(bp, PCI_D0);
 | 
								bnx2_set_power_state(bp, PCI_D0);
 | 
				
			||||||
			bnx2_init_nic(bp, 1);
 | 
								bnx2_init_nic(bp, 1);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
							result = PCI_ERS_RESULT_RECOVERED;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
	rtnl_unlock();
 | 
						rtnl_unlock();
 | 
				
			||||||
	return PCI_ERS_RESULT_RECOVERED;
 | 
					
 | 
				
			||||||
 | 
						err = pci_cleanup_aer_uncorrect_error_status(pdev);
 | 
				
			||||||
 | 
						if (err) {
 | 
				
			||||||
 | 
							dev_err(&pdev->dev,
 | 
				
			||||||
 | 
								"pci_cleanup_aer_uncorrect_error_status failed 0x%0x\n",
 | 
				
			||||||
 | 
								 err); /* non-fatal, continue */
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						return result;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue