Commit 15ffde4d authored by Mark Einon's avatar Mark Einon Committed by Greg Kroah-Hartman

staging: et131x: Refactor et131x_isr() to remove indenting

By negating a 'status' variable check in et131x_isr(), we can remove
the indenting of a large block of code, increasing the readability.

This patch does exactly that.
Signed-off-by: default avatarMark Einon <mark.einon@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 0b5e4092
...@@ -4234,182 +4234,169 @@ static void et131x_isr_handler(struct work_struct *work) ...@@ -4234,182 +4234,169 @@ static void et131x_isr_handler(struct work_struct *work)
status &= 0xffffffd7; status &= 0xffffffd7;
if (status) { if (!status)
/* Handle the TXDMA Error interrupt */ goto out;
if (status & ET_INTR_TXDMA_ERR) {
u32 txdma_err;
/* Following read also clears the register (COR) */ /* Handle the TXDMA Error interrupt */
txdma_err = readl(&iomem->txdma.tx_dma_error); if (status & ET_INTR_TXDMA_ERR) {
u32 txdma_err;
dev_warn(&adapter->pdev->dev, /* Following read also clears the register (COR) */
"TXDMA_ERR interrupt, error = %d\n", txdma_err = readl(&iomem->txdma.tx_dma_error);
txdma_err);
}
/* Handle Free Buffer Ring 0 and 1 Low interrupt */ dev_warn(&adapter->pdev->dev,
if (status & "TXDMA_ERR interrupt, error = %d\n",
(ET_INTR_RXDMA_FB_R0_LOW | ET_INTR_RXDMA_FB_R1_LOW)) { txdma_err);
/* }
* This indicates the number of unused buffers in
* RXDMA free buffer ring 0 is <= the limit you
* programmed. Free buffer resources need to be
* returned. Free buffers are consumed as packets
* are passed from the network to the host. The host
* becomes aware of the packets from the contents of
* the packet status ring. This ring is queried when
* the packet done interrupt occurs. Packets are then
* passed to the OS. When the OS is done with the
* packets the resources can be returned to the
* ET1310 for re-use. This interrupt is one method of
* returning resources.
*/
/* If the user has flow control on, then we will
* send a pause packet, otherwise just exit
*/
if (adapter->flowcontrol == FLOW_TXONLY ||
adapter->flowcontrol == FLOW_BOTH) {
u32 pm_csr;
/* Tell the device to send a pause packet via /* Handle Free Buffer Ring 0 and 1 Low interrupt */
* the back pressure register (bp req and if (status & (ET_INTR_RXDMA_FB_R0_LOW | ET_INTR_RXDMA_FB_R1_LOW)) {
* bp xon/xoff) /*
*/ * This indicates the number of unused buffers in RXDMA free
pm_csr = readl(&iomem->global.pm_csr); * buffer ring 0 is <= the limit you programmed. Free buffer
if (!et1310_in_phy_coma(adapter)) * resources need to be returned. Free buffers are consumed as
writel(3, &iomem->txmac.bp_ctrl); * packets are passed from the network to the host. The host
} * becomes aware of the packets from the contents of the packet
} * status ring. This ring is queried when the packet done
* interrupt occurs. Packets are then passed to the OS. When
* the OS is done with the packets the resources can be
* returned to the ET1310 for re-use. This interrupt is one
* method of returning resources.
*/
/* Handle Packet Status Ring Low Interrupt */ /*
if (status & ET_INTR_RXDMA_STAT_LOW) { * If the user has flow control on, then we will
* send a pause packet, otherwise just exit
*/
if (adapter->flowcontrol == FLOW_TXONLY ||
adapter->flowcontrol == FLOW_BOTH) {
u32 pm_csr;
/* /*
* Same idea as with the two Free Buffer Rings. * Tell the device to send a pause packet via the back
* Packets going from the network to the host each * pressure register (bp req and bp xon/xoff)
* consume a free buffer resource and a packet status
* resource. These resoures are passed to the OS.
* When the OS is done with the resources, they need
* to be returned to the ET1310. This is one method
* of returning the resources.
*/ */
pm_csr = readl(&iomem->global.pm_csr);
if (!et1310_in_phy_coma(adapter))
writel(3, &iomem->txmac.bp_ctrl);
} }
}
/* Handle RXDMA Error Interrupt */ /* Handle Packet Status Ring Low Interrupt */
if (status & ET_INTR_RXDMA_ERR) { if (status & ET_INTR_RXDMA_STAT_LOW) {
/* /*
* The rxdma_error interrupt is sent when a time-out * Same idea as with the two Free Buffer Rings. Packets going
* on a request issued by the JAGCore has occurred or * from the network to the host each consume a free buffer
* a completion is returned with an un-successful * resource and a packet status resource. These resoures are
* status. In both cases the request is considered * passed to the OS. When the OS is done with the resources,
* complete. The JAGCore will automatically re-try the * they need to be returned to the ET1310. This is one method
* request in question. Normally information on events * of returning the resources.
* like these are sent to the host using the "Advanced */
* Error Reporting" capability. This interrupt is }
* another way of getting similar information. The
* only thing required is to clear the interrupt by
* reading the ISR in the global resources. The
* JAGCore will do a re-try on the request. Normally
* you should never see this interrupt. If you start
* to see this interrupt occurring frequently then
* something bad has occurred. A reset might be the
* thing to do.
*/
/* TRAP();*/
dev_warn(&adapter->pdev->dev, /* Handle RXDMA Error Interrupt */
"RxDMA_ERR interrupt, error %x\n", if (status & ET_INTR_RXDMA_ERR) {
readl(&iomem->txmac.tx_test)); /*
} * The rxdma_error interrupt is sent when a time-out on a
* request issued by the JAGCore has occurred or a completion is
* returned with an un-successful status. In both cases the
* request is considered complete. The JAGCore will
* automatically re-try the request in question. Normally
* information on events like these are sent to the host using
* the "Advanced Error Reporting" capability. This interrupt is
* another way of getting similar information. The only thing
* required is to clear the interrupt by reading the ISR in the
* global resources. The JAGCore will do a re-try on the
* request. Normally you should never see this interrupt. If
* you start to see this interrupt occurring frequently then
* something bad has occurred. A reset might be the thing to do.
*/
/* TRAP();*/
/* Handle the Wake on LAN Event */ dev_warn(&adapter->pdev->dev,
if (status & ET_INTR_WOL) { "RxDMA_ERR interrupt, error %x\n",
/* readl(&iomem->txmac.tx_test));
* This is a secondary interrupt for wake on LAN. }
* The driver should never see this, if it does,
* something serious is wrong. We will TRAP the
* message when we are in DBG mode, otherwise we
* will ignore it.
*/
dev_err(&adapter->pdev->dev, "WAKE_ON_LAN interrupt\n");
}
/* Let's move on to the TxMac */ /* Handle the Wake on LAN Event */
if (status & ET_INTR_TXMAC) { if (status & ET_INTR_WOL) {
u32 err = readl(&iomem->txmac.err); /*
* This is a secondary interrupt for wake on LAN. The driver
* should never see this, if it does, something serious is
* wrong. We will TRAP the message when we are in DBG mode,
* otherwise we will ignore it.
*/
dev_err(&adapter->pdev->dev, "WAKE_ON_LAN interrupt\n");
}
/* /* Let's move on to the TxMac */
* When any of the errors occur and TXMAC generates if (status & ET_INTR_TXMAC) {
* an interrupt to report these errors, it usually u32 err = readl(&iomem->txmac.err);
* means that TXMAC has detected an error in the data
* stream retrieved from the on-chip Tx Q. All of
* these errors are catastrophic and TXMAC won't be
* able to recover data when these errors occur. In
* a nutshell, the whole Tx path will have to be reset
* and re-configured afterwards.
*/
dev_warn(&adapter->pdev->dev,
"TXMAC interrupt, error 0x%08x\n",
err);
/* If we are debugging, we want to see this error, /*
* otherwise we just want the device to be reset and * When any of the errors occur and TXMAC generates an
* continue * interrupt to report these errors, it usually means that
*/ * TXMAC has detected an error in the data stream retrieved
} * from the on-chip Tx Q. All of these errors are catastrophic
* and TXMAC won't be able to recover data when these errors
* occur. In a nutshell, the whole Tx path will have to be reset
* and re-configured afterwards.
*/
dev_warn(&adapter->pdev->dev,
"TXMAC interrupt, error 0x%08x\n",
err);
/* Handle RXMAC Interrupt */ /*
if (status & ET_INTR_RXMAC) { * If we are debugging, we want to see this error, otherwise we
/* * just want the device to be reset and continue
* These interrupts are catastrophic to the device, */
* what we need to do is disable the interrupts and }
* set the flag to cause us to reset so we can solve
* this issue.
*/
/* MP_SET_FLAG( adapter,
fMP_ADAPTER_HARDWARE_ERROR); */
dev_warn(&adapter->pdev->dev, /* Handle RXMAC Interrupt */
"RXMAC interrupt, error 0x%08x. Requesting reset\n", if (status & ET_INTR_RXMAC) {
readl(&iomem->rxmac.err_reg)); /*
* These interrupts are catastrophic to the device, what we need
* to do is disable the interrupts and set the flag to cause us
* to reset so we can solve this issue.
*/
/* MP_SET_FLAG( adapter, fMP_ADAPTER_HARDWARE_ERROR); */
dev_warn(&adapter->pdev->dev, dev_warn(&adapter->pdev->dev,
"Enable 0x%08x, Diag 0x%08x\n", "RXMAC interrupt, error 0x%08x. Requesting reset\n",
readl(&iomem->rxmac.ctrl), readl(&iomem->rxmac.err_reg));
readl(&iomem->rxmac.rxq_diag));
/* dev_warn(&adapter->pdev->dev,
* If we are debugging, we want to see this error, "Enable 0x%08x, Diag 0x%08x\n",
* otherwise we just want the device to be reset and readl(&iomem->rxmac.ctrl),
* continue readl(&iomem->rxmac.rxq_diag));
*/
}
/* Handle MAC_STAT Interrupt */ /*
if (status & ET_INTR_MAC_STAT) { * If we are debugging, we want to see this error, otherwise we
/* * just want the device to be reset and continue
* This means at least one of the un-masked counters */
* in the MAC_STAT block has rolled over. Use this }
* to maintain the top, software managed bits of the
* counter(s).
*/
et1310_handle_macstat_interrupt(adapter);
}
/* Handle SLV Timeout Interrupt */ /* Handle MAC_STAT Interrupt */
if (status & ET_INTR_SLV_TIMEOUT) { if (status & ET_INTR_MAC_STAT) {
/* /*
* This means a timeout has occurred on a read or * This means at least one of the un-masked counters in the
* write request to one of the JAGCore registers. The * MAC_STAT block has rolled over. Use this to maintain the top,
* Global Resources block has terminated the request * software managed bits of the counter(s).
* and on a read request, returned a "fake" value. */
* The most likely reasons are: Bad Address or the et1310_handle_macstat_interrupt(adapter);
* addressed module is in a power-down state and
* can't respond.
*/
}
} }
/* Handle SLV Timeout Interrupt */
if (status & ET_INTR_SLV_TIMEOUT) {
/*
* This means a timeout has occurred on a read or write request
* to one of the JAGCore registers. The Global Resources block
* has terminated the request and on a read request, returned a
* "fake" value. The most likely reasons are: Bad Address or the
* addressed module is in a power-down state and can't respond.
*/
}
out:
et131x_enable_interrupts(adapter); et131x_enable_interrupts(adapter);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment