be2net: Log a kernel message when UE is detected in BE & Skyhawk

This patch logs a kernel message when a HW error(SLIPORT_ERROR in Lancer and UE
in BEx/Skyhawk) is detected. The log message for BE3 was missing earlier.
This patch also refactors the code by segregating error-detection and reporting
code for Lancer and BEx/SH.

Signed-off-by: Somnath Kotur <somnath.kotur@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Somnath Kotur 2014-02-12 16:07:54 +05:30 committed by David S. Miller
parent 886ab57c84
commit eb0eecc136

View File

@ -2423,6 +2423,9 @@ void be_detect_error(struct be_adapter *adapter)
u32 ue_lo = 0, ue_hi = 0, ue_lo_mask = 0, ue_hi_mask = 0;
u32 sliport_status = 0, sliport_err1 = 0, sliport_err2 = 0;
u32 i;
bool error_detected = false;
struct device *dev = &adapter->pdev->dev;
struct net_device *netdev = adapter->netdev;
if (be_hw_error(adapter))
return;
@ -2434,6 +2437,21 @@ void be_detect_error(struct be_adapter *adapter)
SLIPORT_ERROR1_OFFSET);
sliport_err2 = ioread32(adapter->db +
SLIPORT_ERROR2_OFFSET);
adapter->hw_error = true;
/* Do not log error messages if its a FW reset */
if (sliport_err1 == SLIPORT_ERROR_FW_RESET1 &&
sliport_err2 == SLIPORT_ERROR_FW_RESET2) {
dev_info(dev, "Firmware update in progress\n");
} else {
error_detected = true;
dev_err(dev, "Error detected in the card\n");
dev_err(dev, "ERR: sliport status 0x%x\n",
sliport_status);
dev_err(dev, "ERR: sliport error1 0x%x\n",
sliport_err1);
dev_err(dev, "ERR: sliport error2 0x%x\n",
sliport_err2);
}
}
} else {
pci_read_config_dword(adapter->pdev,
@ -2447,51 +2465,33 @@ void be_detect_error(struct be_adapter *adapter)
ue_lo = (ue_lo & ~ue_lo_mask);
ue_hi = (ue_hi & ~ue_hi_mask);
}
/* On certain platforms BE hardware can indicate spurious UEs.
* Allow the h/w to stop working completely in case of a real UE.
* Hence not setting the hw_error for UE detection.
*/
if (sliport_status & SLIPORT_STATUS_ERR_MASK) {
adapter->hw_error = true;
/* Do not log error messages if its a FW reset */
if (sliport_err1 == SLIPORT_ERROR_FW_RESET1 &&
sliport_err2 == SLIPORT_ERROR_FW_RESET2) {
dev_info(&adapter->pdev->dev,
"Firmware update in progress\n");
return;
} else {
dev_err(&adapter->pdev->dev,
"Error detected in the card\n");
/* On certain platforms BE hardware can indicate spurious UEs.
* Allow HW to stop working completely in case of a real UE.
* Hence not setting the hw_error for UE detection.
*/
if (ue_lo || ue_hi) {
error_detected = true;
dev_err(dev,
"Unrecoverable Error detected in the adapter");
dev_err(dev, "Please reboot server to recover");
if (skyhawk_chip(adapter))
adapter->hw_error = true;
for (i = 0; ue_lo; ue_lo >>= 1, i++) {
if (ue_lo & 1)
dev_err(dev, "UE: %s bit set\n",
ue_status_low_desc[i]);
}
for (i = 0; ue_hi; ue_hi >>= 1, i++) {
if (ue_hi & 1)
dev_err(dev, "UE: %s bit set\n",
ue_status_hi_desc[i]);
}
}
}
if (sliport_status & SLIPORT_STATUS_ERR_MASK) {
dev_err(&adapter->pdev->dev,
"ERR: sliport status 0x%x\n", sliport_status);
dev_err(&adapter->pdev->dev,
"ERR: sliport error1 0x%x\n", sliport_err1);
dev_err(&adapter->pdev->dev,
"ERR: sliport error2 0x%x\n", sliport_err2);
}
if (ue_lo) {
for (i = 0; ue_lo; ue_lo >>= 1, i++) {
if (ue_lo & 1)
dev_err(&adapter->pdev->dev,
"UE: %s bit set\n", ue_status_low_desc[i]);
}
}
if (ue_hi) {
for (i = 0; ue_hi; ue_hi >>= 1, i++) {
if (ue_hi & 1)
dev_err(&adapter->pdev->dev,
"UE: %s bit set\n", ue_status_hi_desc[i]);
}
}
if (error_detected)
netif_carrier_off(netdev);
}
static void be_msix_disable(struct be_adapter *adapter)