aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/a2065.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/a2065.c')
-rw-r--r--drivers/net/a2065.c43
1 files changed, 21 insertions, 22 deletions
diff --git a/drivers/net/a2065.c b/drivers/net/a2065.c
index 71165ac0257a..5f7258fea19d 100644
--- a/drivers/net/a2065.c
+++ b/drivers/net/a2065.c
@@ -48,7 +48,6 @@
48#include <linux/skbuff.h> 48#include <linux/skbuff.h>
49#include <linux/slab.h> 49#include <linux/slab.h>
50#include <linux/string.h> 50#include <linux/string.h>
51#include <linux/config.h>
52#include <linux/init.h> 51#include <linux/init.h>
53#include <linux/crc32.h> 52#include <linux/crc32.h>
54#include <linux/zorro.h> 53#include <linux/zorro.h>
@@ -94,7 +93,7 @@ struct lance_init_block {
94 unsigned short rx_len; /* receive len and high addr */ 93 unsigned short rx_len; /* receive len and high addr */
95 unsigned short tx_ptr; /* transmit descriptor addr */ 94 unsigned short tx_ptr; /* transmit descriptor addr */
96 unsigned short tx_len; /* transmit len and high addr */ 95 unsigned short tx_len; /* transmit len and high addr */
97 96
98 /* The Tx and Rx ring entries must aligned on 8-byte boundaries. */ 97 /* The Tx and Rx ring entries must aligned on 8-byte boundaries. */
99 struct lance_rx_desc brx_ring[RX_RING_SIZE]; 98 struct lance_rx_desc brx_ring[RX_RING_SIZE];
100 struct lance_tx_desc btx_ring[TX_RING_SIZE]; 99 struct lance_tx_desc btx_ring[TX_RING_SIZE];
@@ -116,7 +115,7 @@ struct lance_private {
116 115
117 int rx_new, tx_new; 116 int rx_new, tx_new;
118 int rx_old, tx_old; 117 int rx_old, tx_old;
119 118
120 int lance_log_rx_bufs, lance_log_tx_bufs; 119 int lance_log_rx_bufs, lance_log_tx_bufs;
121 int rx_ring_mod_mask, tx_ring_mod_mask; 120 int rx_ring_mod_mask, tx_ring_mod_mask;
122 121
@@ -191,7 +190,7 @@ static void lance_init_ring (struct net_device *dev)
191 190
192 if (ZERO) 191 if (ZERO)
193 printk(KERN_DEBUG "TX rings:\n"); 192 printk(KERN_DEBUG "TX rings:\n");
194 193
195 /* Setup the Tx ring entries */ 194 /* Setup the Tx ring entries */
196 for (i = 0; i <= (1<<lp->lance_log_tx_bufs); i++) { 195 for (i = 0; i <= (1<<lp->lance_log_tx_bufs); i++) {
197 leptr = LANCE_ADDR(&aib->tx_buf[i][0]); 196 leptr = LANCE_ADDR(&aib->tx_buf[i][0]);
@@ -220,14 +219,14 @@ static void lance_init_ring (struct net_device *dev)
220 } 219 }
221 220
222 /* Setup the initialization block */ 221 /* Setup the initialization block */
223 222
224 /* Setup rx descriptor pointer */ 223 /* Setup rx descriptor pointer */
225 leptr = LANCE_ADDR(&aib->brx_ring); 224 leptr = LANCE_ADDR(&aib->brx_ring);
226 ib->rx_len = (lp->lance_log_rx_bufs << 13) | (leptr >> 16); 225 ib->rx_len = (lp->lance_log_rx_bufs << 13) | (leptr >> 16);
227 ib->rx_ptr = leptr; 226 ib->rx_ptr = leptr;
228 if (ZERO) 227 if (ZERO)
229 printk(KERN_DEBUG "RX ptr: %8.8x\n", leptr); 228 printk(KERN_DEBUG "RX ptr: %8.8x\n", leptr);
230 229
231 /* Setup tx descriptor pointer */ 230 /* Setup tx descriptor pointer */
232 leptr = LANCE_ADDR(&aib->btx_ring); 231 leptr = LANCE_ADDR(&aib->btx_ring);
233 ib->tx_len = (lp->lance_log_tx_bufs << 13) | (leptr >> 16); 232 ib->tx_len = (lp->lance_log_tx_bufs << 13) | (leptr >> 16);
@@ -287,7 +286,7 @@ static int lance_rx (struct net_device *dev)
287 } 286 }
288 printk ("]\n"); 287 printk ("]\n");
289#endif 288#endif
290 289
291 ll->rdp = LE_C0_RINT|LE_C0_INEA; 290 ll->rdp = LE_C0_RINT|LE_C0_INEA;
292 for (rd = &ib->brx_ring [lp->rx_new]; 291 for (rd = &ib->brx_ring [lp->rx_new];
293 !((bits = rd->rmd1_bits) & LE_R1_OWN); 292 !((bits = rd->rmd1_bits) & LE_R1_OWN);
@@ -320,7 +319,7 @@ static int lance_rx (struct net_device *dev)
320 lp->rx_new = (lp->rx_new + 1) & lp->rx_ring_mod_mask; 319 lp->rx_new = (lp->rx_new + 1) & lp->rx_ring_mod_mask;
321 return 0; 320 return 0;
322 } 321 }
323 322
324 skb->dev = dev; 323 skb->dev = dev;
325 skb_reserve (skb, 2); /* 16 byte align */ 324 skb_reserve (skb, 2); /* 16 byte align */
326 skb_put (skb, len); /* make room */ 325 skb_put (skb, len); /* make room */
@@ -362,10 +361,10 @@ static int lance_tx (struct net_device *dev)
362 /* If we hit a packet not owned by us, stop */ 361 /* If we hit a packet not owned by us, stop */
363 if (td->tmd1_bits & LE_T1_OWN) 362 if (td->tmd1_bits & LE_T1_OWN)
364 break; 363 break;
365 364
366 if (td->tmd1_bits & LE_T1_ERR) { 365 if (td->tmd1_bits & LE_T1_ERR) {
367 status = td->misc; 366 status = td->misc;
368 367
369 lp->stats.tx_errors++; 368 lp->stats.tx_errors++;
370 if (status & LE_T3_RTY) lp->stats.tx_aborted_errors++; 369 if (status & LE_T3_RTY) lp->stats.tx_aborted_errors++;
371 if (status & LE_T3_LCOL) lp->stats.tx_window_errors++; 370 if (status & LE_T3_LCOL) lp->stats.tx_window_errors++;
@@ -418,7 +417,7 @@ static int lance_tx (struct net_device *dev)
418 417
419 lp->stats.tx_packets++; 418 lp->stats.tx_packets++;
420 } 419 }
421 420
422 j = (j + 1) & lp->tx_ring_mod_mask; 421 j = (j + 1) & lp->tx_ring_mod_mask;
423 } 422 }
424 lp->tx_old = j; 423 lp->tx_old = j;
@@ -453,7 +452,7 @@ lance_interrupt (int irq, void *dev_id, struct pt_regs *regs)
453 /* Clear the error condition */ 452 /* Clear the error condition */
454 ll->rdp = LE_C0_BABL|LE_C0_ERR|LE_C0_MISS|LE_C0_INEA; 453 ll->rdp = LE_C0_BABL|LE_C0_ERR|LE_C0_MISS|LE_C0_INEA;
455 } 454 }
456 455
457 if (csr0 & LE_C0_RINT) 456 if (csr0 & LE_C0_RINT)
458 lance_rx (dev); 457 lance_rx (dev);
459 458
@@ -496,7 +495,7 @@ static int lance_open (struct net_device *dev)
496 ll->rdp = LE_C0_STOP; 495 ll->rdp = LE_C0_STOP;
497 496
498 /* Install the Interrupt handler */ 497 /* Install the Interrupt handler */
499 ret = request_irq(IRQ_AMIGA_PORTS, lance_interrupt, SA_SHIRQ, 498 ret = request_irq(IRQ_AMIGA_PORTS, lance_interrupt, IRQF_SHARED,
500 dev->name, dev); 499 dev->name, dev);
501 if (ret) return ret; 500 if (ret) return ret;
502 501
@@ -529,7 +528,7 @@ static inline int lance_reset (struct net_device *dev)
529 struct lance_private *lp = netdev_priv(dev); 528 struct lance_private *lp = netdev_priv(dev);
530 volatile struct lance_regs *ll = lp->ll; 529 volatile struct lance_regs *ll = lp->ll;
531 int status; 530 int status;
532 531
533 /* Stop the lance */ 532 /* Stop the lance */
534 ll->rap = LE_CSR0; 533 ll->rap = LE_CSR0;
535 ll->rdp = LE_C0_STOP; 534 ll->rdp = LE_C0_STOP;
@@ -570,7 +569,7 @@ static int lance_start_xmit (struct sk_buff *skb, struct net_device *dev)
570 569
571 skblen = skb->len; 570 skblen = skb->len;
572 len = skblen; 571 len = skblen;
573 572
574 if (len < ETH_ZLEN) { 573 if (len < ETH_ZLEN) {
575 len = ETH_ZLEN; 574 len = ETH_ZLEN;
576 if (skb_padto(skb, ETH_ZLEN)) 575 if (skb_padto(skb, ETH_ZLEN))
@@ -588,7 +587,7 @@ static int lance_start_xmit (struct sk_buff *skb, struct net_device *dev)
588 /* dump the packet */ 587 /* dump the packet */
589 { 588 {
590 int i; 589 int i;
591 590
592 for (i = 0; i < 64; i++) { 591 for (i = 0; i < 64; i++) {
593 if ((i % 16) == 0) 592 if ((i % 16) == 0)
594 printk("\n" KERN_DEBUG); 593 printk("\n" KERN_DEBUG);
@@ -600,13 +599,13 @@ static int lance_start_xmit (struct sk_buff *skb, struct net_device *dev)
600 entry = lp->tx_new & lp->tx_ring_mod_mask; 599 entry = lp->tx_new & lp->tx_ring_mod_mask;
601 ib->btx_ring [entry].length = (-len) | 0xf000; 600 ib->btx_ring [entry].length = (-len) | 0xf000;
602 ib->btx_ring [entry].misc = 0; 601 ib->btx_ring [entry].misc = 0;
603 602
604 memcpy ((char *)&ib->tx_buf [entry][0], skb->data, skblen); 603 memcpy ((char *)&ib->tx_buf [entry][0], skb->data, skblen);
605 604
606 /* Clear the slack of the packet, do I need this? */ 605 /* Clear the slack of the packet, do I need this? */
607 if (len != skblen) 606 if (len != skblen)
608 memset ((char *) &ib->tx_buf [entry][skblen], 0, len - skblen); 607 memset ((char *) &ib->tx_buf [entry][skblen], 0, len - skblen);
609 608
610 /* Now, give the packet to the lance */ 609 /* Now, give the packet to the lance */
611 ib->btx_ring [entry].tmd1_bits = (LE_T1_POK|LE_T1_OWN); 610 ib->btx_ring [entry].tmd1_bits = (LE_T1_POK|LE_T1_OWN);
612 lp->tx_new = (lp->tx_new+1) & lp->tx_ring_mod_mask; 611 lp->tx_new = (lp->tx_new+1) & lp->tx_ring_mod_mask;
@@ -620,7 +619,7 @@ static int lance_start_xmit (struct sk_buff *skb, struct net_device *dev)
620 ll->rdp = LE_C0_INEA | LE_C0_TDMD; 619 ll->rdp = LE_C0_INEA | LE_C0_TDMD;
621 dev->trans_start = jiffies; 620 dev->trans_start = jiffies;
622 dev_kfree_skb (skb); 621 dev_kfree_skb (skb);
623 622
624 local_irq_restore(flags); 623 local_irq_restore(flags);
625 624
626 return status; 625 return status;
@@ -643,9 +642,9 @@ static void lance_load_multicast (struct net_device *dev)
643 char *addrs; 642 char *addrs;
644 int i; 643 int i;
645 u32 crc; 644 u32 crc;
646 645
647 /* set all multicast bits */ 646 /* set all multicast bits */
648 if (dev->flags & IFF_ALLMULTI){ 647 if (dev->flags & IFF_ALLMULTI){
649 ib->filter [0] = 0xffffffff; 648 ib->filter [0] = 0xffffffff;
650 ib->filter [1] = 0xffffffff; 649 ib->filter [1] = 0xffffffff;
651 return; 650 return;
@@ -662,7 +661,7 @@ static void lance_load_multicast (struct net_device *dev)
662 /* multicast address? */ 661 /* multicast address? */
663 if (!(*addrs & 1)) 662 if (!(*addrs & 1))
664 continue; 663 continue;
665 664
666 crc = ether_crc_le(6, addrs); 665 crc = ether_crc_le(6, addrs);
667 crc = crc >> 26; 666 crc = crc >> 26;
668 mcast_table [crc >> 4] |= 1 << (crc & 0xf); 667 mcast_table [crc >> 4] |= 1 << (crc & 0xf);