aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/pasemi_mac.c
diff options
context:
space:
mode:
authorOlof Johansson <olof@lixom.net>2007-10-02 17:24:51 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-10-10 19:54:22 -0400
commit69c29d89185dc1de7224f5f98588ddc061f1fad2 (patch)
treec54768100a3f6300ca93667de2f3776d135fe29c /drivers/net/pasemi_mac.c
parent5ecc2a5d3e3c39535d2cc10dad15853e9e9b072d (diff)
pasemi_mac: basic error checking
pasemi_mac: basic error checking Add some rudimentary error checking to pasemi_mac. Signed-off-by: Olof Johansson <olof@lixom.net> Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/net/pasemi_mac.c')
-rw-r--r--drivers/net/pasemi_mac.c46
1 files changed, 41 insertions, 5 deletions
diff --git a/drivers/net/pasemi_mac.c b/drivers/net/pasemi_mac.c
index c2d34a804d40..b297a67d2fbe 100644
--- a/drivers/net/pasemi_mac.c
+++ b/drivers/net/pasemi_mac.c
@@ -445,6 +445,38 @@ static void pasemi_mac_restart_tx_intr(struct pasemi_mac *mac)
445} 445}
446 446
447 447
448static inline void pasemi_mac_rx_error(struct pasemi_mac *mac, u64 macrx)
449{
450 unsigned int rcmdsta, ccmdsta;
451
452 if (!netif_msg_rx_err(mac))
453 return;
454
455 rcmdsta = read_dma_reg(mac, PAS_DMA_RXINT_RCMDSTA(mac->dma_if));
456 ccmdsta = read_dma_reg(mac, PAS_DMA_RXCHAN_CCMDSTA(mac->dma_rxch));
457
458 printk(KERN_ERR "pasemi_mac: rx error. macrx %016lx, rx status %lx\n",
459 macrx, *mac->rx_status);
460
461 printk(KERN_ERR "pasemi_mac: rcmdsta %08x ccmdsta %08x\n",
462 rcmdsta, ccmdsta);
463}
464
465static inline void pasemi_mac_tx_error(struct pasemi_mac *mac, u64 mactx)
466{
467 unsigned int cmdsta;
468
469 if (!netif_msg_tx_err(mac))
470 return;
471
472 cmdsta = read_dma_reg(mac, PAS_DMA_TXCHAN_TCMDSTA(mac->dma_txch));
473
474 printk(KERN_ERR "pasemi_mac: tx error. mactx 0x%016lx, "\
475 "tx status 0x%016lx\n", mactx, *mac->tx_status);
476
477 printk(KERN_ERR "pasemi_mac: tcmdsta 0x%08x\n", cmdsta);
478}
479
448static int pasemi_mac_clean_rx(struct pasemi_mac *mac, int limit) 480static int pasemi_mac_clean_rx(struct pasemi_mac *mac, int limit)
449{ 481{
450 unsigned int n; 482 unsigned int n;
@@ -468,10 +500,13 @@ static int pasemi_mac_clean_rx(struct pasemi_mac *mac, int limit)
468 prefetchw(dp); 500 prefetchw(dp);
469 macrx = dp->macrx; 501 macrx = dp->macrx;
470 502
503 if ((macrx & XCT_MACRX_E) ||
504 (*mac->rx_status & PAS_STATUS_ERROR))
505 pasemi_mac_rx_error(mac, macrx);
506
471 if (!(macrx & XCT_MACRX_O)) 507 if (!(macrx & XCT_MACRX_O))
472 break; 508 break;
473 509
474
475 info = NULL; 510 info = NULL;
476 511
477 /* We have to scan for our skb since there's no way 512 /* We have to scan for our skb since there's no way
@@ -563,6 +598,10 @@ restart:
563 for (i = start; i < limit; i++) { 598 for (i = start; i < limit; i++) {
564 dp = &TX_DESC(mac, i); 599 dp = &TX_DESC(mac, i);
565 600
601 if ((dp->mactx & XCT_MACTX_E) ||
602 (*mac->tx_status & PAS_STATUS_ERROR))
603 pasemi_mac_tx_error(mac, dp->mactx);
604
566 if (unlikely(dp->mactx & XCT_MACTX_O)) 605 if (unlikely(dp->mactx & XCT_MACTX_O))
567 /* Not yet transmitted */ 606 /* Not yet transmitted */
568 break; 607 break;
@@ -607,9 +646,6 @@ static irqreturn_t pasemi_mac_rx_intr(int irq, void *data)
607 if (!(*mac->rx_status & PAS_STATUS_CAUSE_M)) 646 if (!(*mac->rx_status & PAS_STATUS_CAUSE_M))
608 return IRQ_NONE; 647 return IRQ_NONE;
609 648
610 if (*mac->rx_status & PAS_STATUS_ERROR)
611 printk("rx_status reported error\n");
612
613 /* Don't reset packet count so it won't fire again but clear 649 /* Don't reset packet count so it won't fire again but clear
614 * all others. 650 * all others.
615 */ 651 */
@@ -1230,7 +1266,7 @@ pasemi_mac_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
1230 dev_err(&mac->pdev->dev, "register_netdev failed with error %d\n", 1266 dev_err(&mac->pdev->dev, "register_netdev failed with error %d\n",
1231 err); 1267 err);
1232 goto out; 1268 goto out;
1233 } else 1269 } else if netif_msg_probe(mac)
1234 printk(KERN_INFO "%s: PA Semi %s: intf %d, txch %d, rxch %d, " 1270 printk(KERN_INFO "%s: PA Semi %s: intf %d, txch %d, rxch %d, "
1235 "hw addr %s\n", 1271 "hw addr %s\n",
1236 dev->name, mac->type == MAC_TYPE_GMAC ? "GMAC" : "XAUI", 1272 dev->name, mac->type == MAC_TYPE_GMAC ? "GMAC" : "XAUI",