/** * et131x_tx_timeout - Timeout handler * @netdev: a pointer to a net_device struct representing the device * * The handler called when a Tx request times out. The timeout period is * specified by the 'tx_timeo" element in the net_device structure (see * et131x_alloc_device() to see how this value is set). */ void et131x_tx_timeout(struct net_device *netdev) { struct et131x_adapter *etdev = netdev_priv(netdev); struct tcb *tcb; unsigned long flags; /* Just skip this part if the adapter is doing link detection */ if (etdev->Flags & fMP_ADAPTER_LINK_DETECTION) return; /* Any nonrecoverable hardware error? * Checks adapter->flags for any failure in phy reading */ if (etdev->Flags & fMP_ADAPTER_NON_RECOVER_ERROR) return; /* Hardware failure? */ if (etdev->Flags & fMP_ADAPTER_HARDWARE_ERROR) { dev_err(&etdev->pdev->dev, "hardware error - reset\n"); return; } /* Is send stuck? */ spin_lock_irqsave(&etdev->TCBSendQLock, flags); tcb = etdev->tx_ring.send_head; if (tcb != NULL) { tcb->count++; if (tcb->count > NIC_SEND_HANG_THRESHOLD) { spin_unlock_irqrestore(&etdev->TCBSendQLock, flags); dev_warn(&etdev->pdev->dev, "Send stuck - reset. tcb->WrIndex %x, Flags 0x%08x\n", tcb->index, tcb->flags); et131x_close(netdev); et131x_open(netdev); return; } } spin_unlock_irqrestore(&etdev->TCBSendQLock, flags); }
/** * et131x_tx_timeout - Timeout handler * @netdev: a pointer to a net_device struct representing the device * * The handler called when a Tx request times out. The timeout period is * specified by the 'tx_timeo" element in the net_device structure (see * et131x_alloc_device() to see how this value is set). */ void et131x_tx_timeout(struct net_device *netdev) { struct et131x_adapter *pAdapter = netdev_priv(netdev); PMP_TCB pMpTcb; unsigned long lockflags; DBG_WARNING(et131x_dbginfo, "TX TIMEOUT\n"); /* Just skip this part if the adapter is doing link detection */ if (MP_TEST_FLAG(pAdapter, fMP_ADAPTER_LINK_DETECTION)) { DBG_ERROR(et131x_dbginfo, "Still doing link detection\n"); return; } /* Any nonrecoverable hardware error? * Checks adapter->flags for any failure in phy reading */ if (MP_TEST_FLAG(pAdapter, fMP_ADAPTER_NON_RECOVER_ERROR)) { DBG_WARNING(et131x_dbginfo, "Non recoverable error - remove\n"); return; } /* Hardware failure? */ if (MP_TEST_FLAG(pAdapter, fMP_ADAPTER_HARDWARE_ERROR)) { DBG_WARNING(et131x_dbginfo, "hardware error - reset\n"); return; } /* Is send stuck? */ spin_lock_irqsave(&pAdapter->TCBSendQLock, lockflags); pMpTcb = pAdapter->TxRing.CurrSendHead; if (pMpTcb != NULL) { pMpTcb->Count++; if (pMpTcb->Count > NIC_SEND_HANG_THRESHOLD) { #ifdef CONFIG_ET131X_DEBUG TX_STATUS_BLOCK_t txDmaComplete = *(pAdapter->TxRing.pTxStatusVa); PTX_DESC_ENTRY_t pDesc = pAdapter->TxRing.pTxDescRingVa + pMpTcb->WrIndex.bits.val; #endif TX_DESC_ENTRY_t StuckDescriptors[10]; if (pMpTcb->WrIndex.bits.val > 7) { memcpy(StuckDescriptors, pAdapter->TxRing.pTxDescRingVa + pMpTcb->WrIndex.bits.val - 6, sizeof(TX_DESC_ENTRY_t) * 10); } spin_unlock_irqrestore(&pAdapter->TCBSendQLock, lockflags); DBG_WARNING(et131x_dbginfo, "Send stuck - reset. pMpTcb->WrIndex %x, Flags 0x%08x\n", pMpTcb->WrIndex.bits.val, pMpTcb->Flags); DBG_WARNING(et131x_dbginfo, "pDesc 0x%08x, 0x%08x, 0x%08x, 0x%08x\n", pDesc->DataBufferPtrHigh, pDesc->DataBufferPtrLow, pDesc->word2.value, pDesc->word3.value); DBG_WARNING(et131x_dbginfo, "WbStatus 0x%08x\n", txDmaComplete.value); #ifdef CONFIG_ET131X_DEBUG DumpDeviceBlock(DBG_WARNING_ON, pAdapter, 0); DumpDeviceBlock(DBG_WARNING_ON, pAdapter, 1); DumpDeviceBlock(DBG_WARNING_ON, pAdapter, 3); DumpDeviceBlock(DBG_WARNING_ON, pAdapter, 5); #endif et131x_close(netdev); et131x_open(netdev); return; } } spin_unlock_irqrestore(&pAdapter->TCBSendQLock, lockflags); }