aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/8390/axnet_cs.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/ethernet/8390/axnet_cs.c')
-rw-r--r--drivers/net/ethernet/8390/axnet_cs.c119
1 files changed, 57 insertions, 62 deletions
diff --git a/drivers/net/ethernet/8390/axnet_cs.c b/drivers/net/ethernet/8390/axnet_cs.c
index d801c1410fb0..5698a4c85d8e 100644
--- a/drivers/net/ethernet/8390/axnet_cs.c
+++ b/drivers/net/ethernet/8390/axnet_cs.c
@@ -105,6 +105,7 @@ static void AX88190_init(struct net_device *dev, int startp);
105static int ax_open(struct net_device *dev); 105static int ax_open(struct net_device *dev);
106static int ax_close(struct net_device *dev); 106static int ax_close(struct net_device *dev);
107static irqreturn_t ax_interrupt(int irq, void *dev_id); 107static irqreturn_t ax_interrupt(int irq, void *dev_id);
108static u32 axnet_msg_enable;
108 109
109/*====================================================================*/ 110/*====================================================================*/
110 111
@@ -152,6 +153,7 @@ static int axnet_probe(struct pcmcia_device *link)
152 return -ENOMEM; 153 return -ENOMEM;
153 154
154 ei_local = netdev_priv(dev); 155 ei_local = netdev_priv(dev);
156 ei_local->msg_enable = axnet_msg_enable;
155 spin_lock_init(&ei_local->page_lock); 157 spin_lock_init(&ei_local->page_lock);
156 158
157 info = PRIV(dev); 159 info = PRIV(dev);
@@ -650,11 +652,12 @@ static void block_input(struct net_device *dev, int count,
650 struct sk_buff *skb, int ring_offset) 652 struct sk_buff *skb, int ring_offset)
651{ 653{
652 unsigned int nic_base = dev->base_addr; 654 unsigned int nic_base = dev->base_addr;
655 struct ei_device *ei_local = netdev_priv(dev);
653 int xfer_count = count; 656 int xfer_count = count;
654 char *buf = skb->data; 657 char *buf = skb->data;
655 658
656 if ((ei_debug > 4) && (count != 4)) 659 if ((netif_msg_rx_status(ei_local)) && (count != 4))
657 pr_debug("%s: [bi=%d]\n", dev->name, count+4); 660 netdev_dbg(dev, "[bi=%d]\n", count+4);
658 outb_p(ring_offset & 0xff, nic_base + EN0_RSARLO); 661 outb_p(ring_offset & 0xff, nic_base + EN0_RSARLO);
659 outb_p(ring_offset >> 8, nic_base + EN0_RSARHI); 662 outb_p(ring_offset >> 8, nic_base + EN0_RSARHI);
660 outb_p(E8390_RREAD+E8390_START, nic_base + AXNET_CMD); 663 outb_p(E8390_RREAD+E8390_START, nic_base + AXNET_CMD);
@@ -810,11 +813,6 @@ module_pcmcia_driver(axnet_cs_driver);
810#define ei_block_input (ei_local->block_input) 813#define ei_block_input (ei_local->block_input)
811#define ei_get_8390_hdr (ei_local->get_8390_hdr) 814#define ei_get_8390_hdr (ei_local->get_8390_hdr)
812 815
813/* use 0 for production, 1 for verification, >2 for debug */
814#ifndef ei_debug
815int ei_debug = 1;
816#endif
817
818/* Index to functions. */ 816/* Index to functions. */
819static void ei_tx_intr(struct net_device *dev); 817static void ei_tx_intr(struct net_device *dev);
820static void ei_tx_err(struct net_device *dev); 818static void ei_tx_err(struct net_device *dev);
@@ -925,11 +923,10 @@ static void axnet_tx_timeout(struct net_device *dev)
925 isr = inb(e8390_base+EN0_ISR); 923 isr = inb(e8390_base+EN0_ISR);
926 spin_unlock_irqrestore(&ei_local->page_lock, flags); 924 spin_unlock_irqrestore(&ei_local->page_lock, flags);
927 925
928 netdev_printk(KERN_DEBUG, dev, 926 netdev_dbg(dev, "Tx timed out, %s TSR=%#2x, ISR=%#2x, t=%d.\n",
929 "Tx timed out, %s TSR=%#2x, ISR=%#2x, t=%d.\n", 927 (txsr & ENTSR_ABT) ? "excess collisions." :
930 (txsr & ENTSR_ABT) ? "excess collisions." : 928 (isr) ? "lost interrupt?" : "cable problem?",
931 (isr) ? "lost interrupt?" : "cable problem?", 929 txsr, isr, tickssofar);
932 txsr, isr, tickssofar);
933 930
934 if (!isr && !dev->stats.tx_packets) 931 if (!isr && !dev->stats.tx_packets)
935 { 932 {
@@ -998,29 +995,30 @@ static netdev_tx_t axnet_start_xmit(struct sk_buff *skb,
998 { 995 {
999 output_page = ei_local->tx_start_page; 996 output_page = ei_local->tx_start_page;
1000 ei_local->tx1 = send_length; 997 ei_local->tx1 = send_length;
1001 if (ei_debug && ei_local->tx2 > 0) 998 if ((netif_msg_tx_queued(ei_local)) &&
1002 netdev_printk(KERN_DEBUG, dev, 999 ei_local->tx2 > 0)
1003 "idle transmitter tx2=%d, lasttx=%d, txing=%d\n", 1000 netdev_dbg(dev,
1004 ei_local->tx2, ei_local->lasttx, 1001 "idle transmitter tx2=%d, lasttx=%d, txing=%d\n",
1005 ei_local->txing); 1002 ei_local->tx2, ei_local->lasttx,
1003 ei_local->txing);
1006 } 1004 }
1007 else if (ei_local->tx2 == 0) 1005 else if (ei_local->tx2 == 0)
1008 { 1006 {
1009 output_page = ei_local->tx_start_page + TX_PAGES/2; 1007 output_page = ei_local->tx_start_page + TX_PAGES/2;
1010 ei_local->tx2 = send_length; 1008 ei_local->tx2 = send_length;
1011 if (ei_debug && ei_local->tx1 > 0) 1009 if ((netif_msg_tx_queued(ei_local)) &&
1012 netdev_printk(KERN_DEBUG, dev, 1010 ei_local->tx1 > 0)
1013 "idle transmitter, tx1=%d, lasttx=%d, txing=%d\n", 1011 netdev_dbg(dev,
1014 ei_local->tx1, ei_local->lasttx, 1012 "idle transmitter, tx1=%d, lasttx=%d, txing=%d\n",
1015 ei_local->txing); 1013 ei_local->tx1, ei_local->lasttx,
1014 ei_local->txing);
1016 } 1015 }
1017 else 1016 else
1018 { /* We should never get here. */ 1017 { /* We should never get here. */
1019 if (ei_debug) 1018 netif_dbg(ei_local, tx_err, dev,
1020 netdev_printk(KERN_DEBUG, dev, 1019 "No Tx buffers free! tx1=%d tx2=%d last=%d\n",
1021 "No Tx buffers free! tx1=%d tx2=%d last=%d\n", 1020 ei_local->tx1, ei_local->tx2,
1022 ei_local->tx1, ei_local->tx2, 1021 ei_local->lasttx);
1023 ei_local->lasttx);
1024 ei_local->irqlock = 0; 1022 ei_local->irqlock = 0;
1025 netif_stop_queue(dev); 1023 netif_stop_queue(dev);
1026 outb_p(ENISR_ALL, e8390_base + EN0_IMR); 1024 outb_p(ENISR_ALL, e8390_base + EN0_IMR);
@@ -1124,10 +1122,9 @@ static irqreturn_t ax_interrupt(int irq, void *dev_id)
1124 spin_unlock_irqrestore(&ei_local->page_lock, flags); 1122 spin_unlock_irqrestore(&ei_local->page_lock, flags);
1125 return IRQ_NONE; 1123 return IRQ_NONE;
1126 } 1124 }
1127 1125
1128 if (ei_debug > 3) 1126 netif_dbg(ei_local, intr, dev, "interrupt(isr=%#2.2x)\n",
1129 netdev_printk(KERN_DEBUG, dev, "interrupt(isr=%#2.2x)\n", 1127 inb_p(e8390_base + EN0_ISR));
1130 inb_p(e8390_base + EN0_ISR));
1131 1128
1132 outb_p(0x00, e8390_base + EN0_ISR); 1129 outb_p(0x00, e8390_base + EN0_ISR);
1133 ei_local->irqlock = 1; 1130 ei_local->irqlock = 1;
@@ -1137,9 +1134,8 @@ static irqreturn_t ax_interrupt(int irq, void *dev_id)
1137 ++nr_serviced < MAX_SERVICE) 1134 ++nr_serviced < MAX_SERVICE)
1138 { 1135 {
1139 if (!netif_running(dev) || (interrupts == 0xff)) { 1136 if (!netif_running(dev) || (interrupts == 0xff)) {
1140 if (ei_debug > 1) 1137 netif_warn(ei_local, intr, dev,
1141 netdev_warn(dev, 1138 "interrupt from stopped card\n");
1142 "interrupt from stopped card\n");
1143 outb_p(interrupts, e8390_base + EN0_ISR); 1139 outb_p(interrupts, e8390_base + EN0_ISR);
1144 interrupts = 0; 1140 interrupts = 0;
1145 break; 1141 break;
@@ -1175,14 +1171,15 @@ static irqreturn_t ax_interrupt(int irq, void *dev_id)
1175 } 1171 }
1176 } 1172 }
1177 1173
1178 if (interrupts && ei_debug > 3) 1174 if (interrupts && (netif_msg_intr(ei_local)))
1179 { 1175 {
1180 handled = 1; 1176 handled = 1;
1181 if (nr_serviced >= MAX_SERVICE) 1177 if (nr_serviced >= MAX_SERVICE)
1182 { 1178 {
1183 /* 0xFF is valid for a card removal */ 1179 /* 0xFF is valid for a card removal */
1184 if(interrupts!=0xFF) 1180 if (interrupts != 0xFF)
1185 netdev_warn(dev, "Too much work at interrupt, status %#2.2x\n", 1181 netdev_warn(dev,
1182 "Too much work at interrupt, status %#2.2x\n",
1186 interrupts); 1183 interrupts);
1187 outb_p(ENISR_ALL, e8390_base + EN0_ISR); /* Ack. most intrs. */ 1184 outb_p(ENISR_ALL, e8390_base + EN0_ISR); /* Ack. most intrs. */
1188 } else { 1185 } else {
@@ -1221,8 +1218,7 @@ static void ei_tx_err(struct net_device *dev)
1221 unsigned char tx_was_aborted = txsr & (ENTSR_ABT+ENTSR_FU); 1218 unsigned char tx_was_aborted = txsr & (ENTSR_ABT+ENTSR_FU);
1222 1219
1223#ifdef VERBOSE_ERROR_DUMP 1220#ifdef VERBOSE_ERROR_DUMP
1224 netdev_printk(KERN_DEBUG, dev, 1221 netdev_dbg(dev, "transmitter error (%#2x):", txsr);
1225 "transmitter error (%#2x):", txsr);
1226 if (txsr & ENTSR_ABT) 1222 if (txsr & ENTSR_ABT)
1227 pr_cont(" excess-collisions"); 1223 pr_cont(" excess-collisions");
1228 if (txsr & ENTSR_ND) 1224 if (txsr & ENTSR_ND)
@@ -1287,9 +1283,9 @@ static void ei_tx_intr(struct net_device *dev)
1287 else if (ei_local->tx2 < 0) 1283 else if (ei_local->tx2 < 0)
1288 { 1284 {
1289 if (ei_local->lasttx != 2 && ei_local->lasttx != -2) 1285 if (ei_local->lasttx != 2 && ei_local->lasttx != -2)
1290 netdev_info(dev, "%s: bogus last_tx_buffer %d, tx2=%d\n", 1286 netdev_err(dev, "%s: bogus last_tx_buffer %d, tx2=%d\n",
1291 ei_local->name, ei_local->lasttx, 1287 ei_local->name, ei_local->lasttx,
1292 ei_local->tx2); 1288 ei_local->tx2);
1293 ei_local->tx2 = 0; 1289 ei_local->tx2 = 0;
1294 if (ei_local->tx1 > 0) 1290 if (ei_local->tx1 > 0)
1295 { 1291 {
@@ -1366,9 +1362,11 @@ static void ei_receive(struct net_device *dev)
1366 Keep quiet if it looks like a card removal. One problem here 1362 Keep quiet if it looks like a card removal. One problem here
1367 is that some clones crash in roughly the same way. 1363 is that some clones crash in roughly the same way.
1368 */ 1364 */
1369 if (ei_debug > 0 && this_frame != ei_local->current_page && (this_frame!=0x0 || rxing_page!=0xFF)) 1365 if ((netif_msg_rx_err(ei_local)) &&
1370 netdev_err(dev, "mismatched read page pointers %2x vs %2x\n", 1366 this_frame != ei_local->current_page &&
1371 this_frame, ei_local->current_page); 1367 (this_frame != 0x0 || rxing_page != 0xFF))
1368 netdev_err(dev, "mismatched read page pointers %2x vs %2x\n",
1369 this_frame, ei_local->current_page);
1372 1370
1373 if (this_frame == rxing_page) /* Read all the frames? */ 1371 if (this_frame == rxing_page) /* Read all the frames? */
1374 break; /* Done for now */ 1372 break; /* Done for now */
@@ -1383,11 +1381,10 @@ static void ei_receive(struct net_device *dev)
1383 1381
1384 if (pkt_len < 60 || pkt_len > 1518) 1382 if (pkt_len < 60 || pkt_len > 1518)
1385 { 1383 {
1386 if (ei_debug) 1384 netif_err(ei_local, rx_err, dev,
1387 netdev_printk(KERN_DEBUG, dev, 1385 "bogus packet size: %d, status=%#2x nxpg=%#2x\n",
1388 "bogus packet size: %d, status=%#2x nxpg=%#2x\n", 1386 rx_frame.count, rx_frame.status,
1389 rx_frame.count, rx_frame.status, 1387 rx_frame.next);
1390 rx_frame.next);
1391 dev->stats.rx_errors++; 1388 dev->stats.rx_errors++;
1392 dev->stats.rx_length_errors++; 1389 dev->stats.rx_length_errors++;
1393 } 1390 }
@@ -1398,10 +1395,9 @@ static void ei_receive(struct net_device *dev)
1398 skb = netdev_alloc_skb(dev, pkt_len + 2); 1395 skb = netdev_alloc_skb(dev, pkt_len + 2);
1399 if (skb == NULL) 1396 if (skb == NULL)
1400 { 1397 {
1401 if (ei_debug > 1) 1398 netif_err(ei_local, rx_err, dev,
1402 netdev_printk(KERN_DEBUG, dev, 1399 "Couldn't allocate a sk_buff of size %d\n",
1403 "Couldn't allocate a sk_buff of size %d\n", 1400 pkt_len);
1404 pkt_len);
1405 dev->stats.rx_dropped++; 1401 dev->stats.rx_dropped++;
1406 break; 1402 break;
1407 } 1403 }
@@ -1420,11 +1416,10 @@ static void ei_receive(struct net_device *dev)
1420 } 1416 }
1421 else 1417 else
1422 { 1418 {
1423 if (ei_debug) 1419 netif_err(ei_local, rx_err, dev,
1424 netdev_printk(KERN_DEBUG, dev, 1420 "bogus packet: status=%#2x nxpg=%#2x size=%d\n",
1425 "bogus packet: status=%#2x nxpg=%#2x size=%d\n", 1421 rx_frame.status, rx_frame.next,
1426 rx_frame.status, rx_frame.next, 1422 rx_frame.count);
1427 rx_frame.count);
1428 dev->stats.rx_errors++; 1423 dev->stats.rx_errors++;
1429 /* NB: The NIC counts CRC, frame and missed errors. */ 1424 /* NB: The NIC counts CRC, frame and missed errors. */
1430 if (pkt_stat & ENRSR_FO) 1425 if (pkt_stat & ENRSR_FO)
@@ -1461,6 +1456,7 @@ static void ei_rx_overrun(struct net_device *dev)
1461 axnet_dev_t *info = PRIV(dev); 1456 axnet_dev_t *info = PRIV(dev);
1462 long e8390_base = dev->base_addr; 1457 long e8390_base = dev->base_addr;
1463 unsigned char was_txing, must_resend = 0; 1458 unsigned char was_txing, must_resend = 0;
1459 struct ei_device *ei_local = netdev_priv(dev);
1464 1460
1465 /* 1461 /*
1466 * Record whether a Tx was in progress and then issue the 1462 * Record whether a Tx was in progress and then issue the
@@ -1468,9 +1464,8 @@ static void ei_rx_overrun(struct net_device *dev)
1468 */ 1464 */
1469 was_txing = inb_p(e8390_base+E8390_CMD) & E8390_TRANS; 1465 was_txing = inb_p(e8390_base+E8390_CMD) & E8390_TRANS;
1470 outb_p(E8390_NODMA+E8390_PAGE0+E8390_STOP, e8390_base+E8390_CMD); 1466 outb_p(E8390_NODMA+E8390_PAGE0+E8390_STOP, e8390_base+E8390_CMD);
1471 1467
1472 if (ei_debug > 1) 1468 netif_dbg(ei_local, rx_err, dev, "Receiver overrun\n");
1473 netdev_printk(KERN_DEBUG, dev, "Receiver overrun\n");
1474 dev->stats.rx_over_errors++; 1469 dev->stats.rx_over_errors++;
1475 1470
1476 /* 1471 /*