aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/benet
diff options
context:
space:
mode:
authorAjit Khaparde <ajitk@serverengines.com>2010-09-03 02:23:30 -0400
committerDavid S. Miller <davem@davemloft.net>2010-09-03 12:52:46 -0400
commitd053de911bff69ba7cdda36d3107c1da0fba7ccd (patch)
tree4b15644f3e1ebe9b4e09629739b7515f142c7de0 /drivers/net/benet
parent1ef78abec6b5e9e3062e3ae6660eabaf055a718d (diff)
be2net: fix a bug in UE detection logic
The ONLINE registers can return 0xFFFFFFFF on more than one occassion. On systems that care, reading these registers could lead to problems. So the new code decides that the ASIC has encountered and error by reading the UE_STATUS_LOW/HIGH registers. AND them with the mask values and a non-zero result indicates an error. Signed-off-by: Ajit Khaparde <ajitk@serverengines.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/benet')
-rw-r--r--drivers/net/benet/be_cmds.c2
-rw-r--r--drivers/net/benet/be_cmds.h2
-rw-r--r--drivers/net/benet/be_main.c32
3 files changed, 10 insertions, 26 deletions
diff --git a/drivers/net/benet/be_cmds.c b/drivers/net/benet/be_cmds.c
index 3d305494a606..78f32fe68c0e 100644
--- a/drivers/net/benet/be_cmds.c
+++ b/drivers/net/benet/be_cmds.c
@@ -207,7 +207,7 @@ static int be_mbox_db_ready_wait(struct be_adapter *adapter, void __iomem *db)
207 207
208 if (msecs > 4000) { 208 if (msecs > 4000) {
209 dev_err(&adapter->pdev->dev, "mbox poll timed out\n"); 209 dev_err(&adapter->pdev->dev, "mbox poll timed out\n");
210 be_dump_ue(adapter); 210 be_detect_dump_ue(adapter);
211 return -1; 211 return -1;
212 } 212 }
213 213
diff --git a/drivers/net/benet/be_cmds.h b/drivers/net/benet/be_cmds.h
index bdc10a28cfda..ad1e6fac60c5 100644
--- a/drivers/net/benet/be_cmds.h
+++ b/drivers/net/benet/be_cmds.h
@@ -992,5 +992,5 @@ extern int be_cmd_set_loopback(struct be_adapter *adapter, u8 port_num,
992extern int be_cmd_get_phy_info(struct be_adapter *adapter, 992extern int be_cmd_get_phy_info(struct be_adapter *adapter,
993 struct be_dma_mem *cmd); 993 struct be_dma_mem *cmd);
994extern int be_cmd_set_qos(struct be_adapter *adapter, u32 bps, u32 domain); 994extern int be_cmd_set_qos(struct be_adapter *adapter, u32 bps, u32 domain);
995extern void be_dump_ue(struct be_adapter *adapter); 995extern void be_detect_dump_ue(struct be_adapter *adapter);
996 996
diff --git a/drivers/net/benet/be_main.c b/drivers/net/benet/be_main.c
index a5a24e6c773e..6eda7a022256 100644
--- a/drivers/net/benet/be_main.c
+++ b/drivers/net/benet/be_main.c
@@ -1750,26 +1750,7 @@ static int be_poll_tx_mcc(struct napi_struct *napi, int budget)
1750 return 1; 1750 return 1;
1751} 1751}
1752 1752
1753static inline bool be_detect_ue(struct be_adapter *adapter) 1753void be_detect_dump_ue(struct be_adapter *adapter)
1754{
1755 u32 online0 = 0, online1 = 0;
1756
1757 pci_read_config_dword(adapter->pdev, PCICFG_ONLINE0, &online0);
1758
1759 pci_read_config_dword(adapter->pdev, PCICFG_ONLINE1, &online1);
1760
1761 if (!online0 || !online1) {
1762 adapter->ue_detected = true;
1763 dev_err(&adapter->pdev->dev,
1764 "UE Detected!! online0=%d online1=%d\n",
1765 online0, online1);
1766 return true;
1767 }
1768
1769 return false;
1770}
1771
1772void be_dump_ue(struct be_adapter *adapter)
1773{ 1754{
1774 u32 ue_status_lo, ue_status_hi, ue_status_lo_mask, ue_status_hi_mask; 1755 u32 ue_status_lo, ue_status_hi, ue_status_lo_mask, ue_status_hi_mask;
1775 u32 i; 1756 u32 i;
@@ -1786,6 +1767,11 @@ void be_dump_ue(struct be_adapter *adapter)
1786 ue_status_lo = (ue_status_lo & (~ue_status_lo_mask)); 1767 ue_status_lo = (ue_status_lo & (~ue_status_lo_mask));
1787 ue_status_hi = (ue_status_hi & (~ue_status_hi_mask)); 1768 ue_status_hi = (ue_status_hi & (~ue_status_hi_mask));
1788 1769
1770 if (ue_status_lo || ue_status_hi) {
1771 adapter->ue_detected = true;
1772 dev_err(&adapter->pdev->dev, "UE Detected!!\n");
1773 }
1774
1789 if (ue_status_lo) { 1775 if (ue_status_lo) {
1790 for (i = 0; ue_status_lo; ue_status_lo >>= 1, i++) { 1776 for (i = 0; ue_status_lo; ue_status_lo >>= 1, i++) {
1791 if (ue_status_lo & 1) 1777 if (ue_status_lo & 1)
@@ -1821,10 +1807,8 @@ static void be_worker(struct work_struct *work)
1821 adapter->rx_post_starved = false; 1807 adapter->rx_post_starved = false;
1822 be_post_rx_frags(adapter); 1808 be_post_rx_frags(adapter);
1823 } 1809 }
1824 if (!adapter->ue_detected) { 1810 if (!adapter->ue_detected)
1825 if (be_detect_ue(adapter)) 1811 be_detect_dump_ue(adapter);
1826 be_dump_ue(adapter);
1827 }
1828 1812
1829 schedule_delayed_work(&adapter->work, msecs_to_jiffies(1000)); 1813 schedule_delayed_work(&adapter->work, msecs_to_jiffies(1000));
1830} 1814}