2 * sgiseeq.c: Seeq8003 ethernet driver for SGI machines.
4 * Copyright (C) 1996 David S. Miller (dm@engr.sgi.com)
9 #include <linux/kernel.h>
10 #include <linux/module.h>
11 #include <linux/errno.h>
12 #include <linux/init.h>
13 #include <linux/types.h>
14 #include <linux/interrupt.h>
15 #include <linux/slab.h>
16 #include <linux/string.h>
17 #include <linux/delay.h>
18 #include <linux/netdevice.h>
19 #include <linux/etherdevice.h>
20 #include <linux/skbuff.h>
22 #include <asm/sgi/hpc3.h>
23 #include <asm/sgi/ip22.h>
27 static char *sgiseeqstr = "SGI Seeq8003";
30 * If you want speed, you do something silly, it always has worked for me. So,
31 * with that in mind, I've decided to make this driver look completely like a
32 * stupid Lance from a driver architecture perspective. Only difference is that
33 * here our "ring buffer" looks and acts like a real Lance one does but is
34 * layed out like how the HPC DMA and the Seeq want it to. You'd be surprised
35 * how a stupid idea like this can pay off in performance, not to mention
36 * making this driver 2,000 times easier to write. ;-)
39 /* Tune these if we tend to run out often etc. */
40 #define SEEQ_RX_BUFFERS 16
41 #define SEEQ_TX_BUFFERS 16
43 #define PKT_BUF_SZ 1584
45 #define NEXT_RX(i) (((i) + 1) & (SEEQ_RX_BUFFERS - 1))
46 #define NEXT_TX(i) (((i) + 1) & (SEEQ_TX_BUFFERS - 1))
47 #define PREV_RX(i) (((i) - 1) & (SEEQ_RX_BUFFERS - 1))
48 #define PREV_TX(i) (((i) - 1) & (SEEQ_TX_BUFFERS - 1))
50 #define TX_BUFFS_AVAIL(sp) ((sp->tx_old <= sp->tx_new) ? \
51 sp->tx_old + (SEEQ_TX_BUFFERS - 1) - sp->tx_new : \
52 sp->tx_old - sp->tx_new - 1)
54 struct sgiseeq_rx_desc {
55 volatile struct hpc_dma_desc rdma;
56 volatile signed int buf_vaddr;
59 struct sgiseeq_tx_desc {
60 volatile struct hpc_dma_desc tdma;
61 volatile signed int buf_vaddr;
65 * Warning: This structure is layed out in a certain way because HPC dma
66 * descriptors must be 8-byte aligned. So don't touch this without
69 struct sgiseeq_init_block { /* Note the name ;-) */
70 struct sgiseeq_rx_desc rxvector[SEEQ_RX_BUFFERS];
71 struct sgiseeq_tx_desc txvector[SEEQ_TX_BUFFERS];
74 struct sgiseeq_private {
75 struct sgiseeq_init_block *srings;
77 /* Ptrs to the descriptors in uncached space. */
78 struct sgiseeq_rx_desc *rx_desc;
79 struct sgiseeq_tx_desc *tx_desc;
82 struct hpc3_ethregs *hregs;
83 struct sgiseeq_regs *sregs;
85 /* Ring entry counters. */
86 unsigned int rx_new, tx_new;
87 unsigned int rx_old, tx_old;
90 unsigned char control;
93 struct net_device_stats stats;
95 struct net_device *next_module;
99 /* A list of all installed seeq devices, for removing the driver module. */
100 static struct net_device *root_sgiseeq_dev;
102 static inline void hpc3_eth_reset(struct hpc3_ethregs *hregs)
104 hregs->reset = HPC3_ERST_CRESET | HPC3_ERST_CLRIRQ;
109 static inline void reset_hpc3_and_seeq(struct hpc3_ethregs *hregs,
110 struct sgiseeq_regs *sregs)
112 hregs->rx_ctrl = hregs->tx_ctrl = 0;
113 hpc3_eth_reset(hregs);
116 #define RSTAT_GO_BITS (SEEQ_RCMD_IGOOD | SEEQ_RCMD_IEOF | SEEQ_RCMD_ISHORT | \
117 SEEQ_RCMD_IDRIB | SEEQ_RCMD_ICRC)
119 static inline void seeq_go(struct sgiseeq_private *sp,
120 struct hpc3_ethregs *hregs,
121 struct sgiseeq_regs *sregs)
123 sregs->rstat = sp->mode | RSTAT_GO_BITS;
124 hregs->rx_ctrl = HPC3_ERXCTRL_ACTIVE;
127 static inline void __sgiseeq_set_mac_address(struct net_device *dev)
129 struct sgiseeq_private *sp = netdev_priv(dev);
130 struct sgiseeq_regs *sregs = sp->sregs;
133 sregs->tstat = SEEQ_TCMD_RB0;
134 for (i = 0; i < 6; i++)
135 sregs->rw.eth_addr[i] = dev->dev_addr[i];
138 static int sgiseeq_set_mac_address(struct net_device *dev, void *addr)
140 struct sgiseeq_private *sp = netdev_priv(dev);
141 struct sockaddr *sa = addr;
143 memcpy(dev->dev_addr, sa->sa_data, dev->addr_len);
145 spin_lock_irq(&sp->tx_lock);
146 __sgiseeq_set_mac_address(dev);
147 spin_unlock_irq(&sp->tx_lock);
152 #define TCNTINFO_INIT (HPCDMA_EOX | HPCDMA_ETXD)
153 #define RCNTCFG_INIT (HPCDMA_OWN | HPCDMA_EORP | HPCDMA_XIE)
154 #define RCNTINFO_INIT (RCNTCFG_INIT | (PKT_BUF_SZ & HPCDMA_BCNT))
156 static int seeq_init_ring(struct net_device *dev)
158 struct sgiseeq_private *sp = netdev_priv(dev);
161 netif_stop_queue(dev);
162 sp->rx_new = sp->tx_new = 0;
163 sp->rx_old = sp->tx_old = 0;
165 __sgiseeq_set_mac_address(dev);
168 for(i = 0; i < SEEQ_TX_BUFFERS; i++) {
169 if (!sp->tx_desc[i].tdma.pbuf) {
170 unsigned long buffer;
172 buffer = (unsigned long) kmalloc(PKT_BUF_SZ, GFP_KERNEL);
175 sp->tx_desc[i].buf_vaddr = CKSEG1ADDR(buffer);
176 sp->tx_desc[i].tdma.pbuf = CPHYSADDR(buffer);
178 sp->tx_desc[i].tdma.cntinfo = TCNTINFO_INIT;
181 /* And now the rx ring. */
182 for (i = 0; i < SEEQ_RX_BUFFERS; i++) {
183 if (!sp->rx_desc[i].rdma.pbuf) {
184 unsigned long buffer;
186 buffer = (unsigned long) kmalloc(PKT_BUF_SZ, GFP_KERNEL);
189 sp->rx_desc[i].buf_vaddr = CKSEG1ADDR(buffer);
190 sp->rx_desc[i].rdma.pbuf = CPHYSADDR(buffer);
192 sp->rx_desc[i].rdma.cntinfo = RCNTINFO_INIT;
194 sp->rx_desc[i - 1].rdma.cntinfo |= HPCDMA_EOR;
199 static struct sgiseeq_private *gpriv;
200 static struct net_device *gdev;
202 static void sgiseeq_dump_rings(void)
205 struct sgiseeq_rx_desc *r = gpriv->rx_desc;
206 struct sgiseeq_tx_desc *t = gpriv->tx_desc;
207 struct hpc3_ethregs *hregs = gpriv->hregs;
213 printk("RING DUMP:\n");
214 for (i = 0; i < SEEQ_RX_BUFFERS; i++) {
215 printk("RX [%d]: @(%p) [%08x,%08x,%08x] ",
216 i, (&r[i]), r[i].rdma.pbuf, r[i].rdma.cntinfo,
219 printk("-- [%d]: @(%p) [%08x,%08x,%08x]\n",
220 i, (&r[i]), r[i].rdma.pbuf, r[i].rdma.cntinfo,
223 for (i = 0; i < SEEQ_TX_BUFFERS; i++) {
224 printk("TX [%d]: @(%p) [%08x,%08x,%08x] ",
225 i, (&t[i]), t[i].tdma.pbuf, t[i].tdma.cntinfo,
228 printk("-- [%d]: @(%p) [%08x,%08x,%08x]\n",
229 i, (&t[i]), t[i].tdma.pbuf, t[i].tdma.cntinfo,
232 printk("INFO: [rx_new = %d rx_old=%d] [tx_new = %d tx_old = %d]\n",
233 gpriv->rx_new, gpriv->rx_old, gpriv->tx_new, gpriv->tx_old);
234 printk("RREGS: rx_cbptr[%08x] rx_ndptr[%08x] rx_ctrl[%08x]\n",
235 hregs->rx_cbptr, hregs->rx_ndptr, hregs->rx_ctrl);
236 printk("TREGS: tx_cbptr[%08x] tx_ndptr[%08x] tx_ctrl[%08x]\n",
237 hregs->tx_cbptr, hregs->tx_ndptr, hregs->tx_ctrl);
241 #define TSTAT_INIT_SEEQ (SEEQ_TCMD_IPT|SEEQ_TCMD_I16|SEEQ_TCMD_IC|SEEQ_TCMD_IUF)
242 #define TSTAT_INIT_EDLC ((TSTAT_INIT_SEEQ) | SEEQ_TCMD_RB2)
244 static int init_seeq(struct net_device *dev, struct sgiseeq_private *sp,
245 struct sgiseeq_regs *sregs)
247 struct hpc3_ethregs *hregs = sp->hregs;
250 reset_hpc3_and_seeq(hregs, sregs);
251 err = seeq_init_ring(dev);
255 /* Setup to field the proper interrupt types. */
257 sregs->tstat = TSTAT_INIT_EDLC;
258 sregs->rw.wregs.control = sp->control;
259 sregs->rw.wregs.frame_gap = 0;
261 sregs->tstat = TSTAT_INIT_SEEQ;
264 hregs->rx_ndptr = CPHYSADDR(sp->rx_desc);
265 hregs->tx_ndptr = CPHYSADDR(sp->tx_desc);
267 seeq_go(sp, hregs, sregs);
271 static inline void record_rx_errors(struct sgiseeq_private *sp,
272 unsigned char status)
274 if (status & SEEQ_RSTAT_OVERF ||
275 status & SEEQ_RSTAT_SFRAME)
276 sp->stats.rx_over_errors++;
277 if (status & SEEQ_RSTAT_CERROR)
278 sp->stats.rx_crc_errors++;
279 if (status & SEEQ_RSTAT_DERROR)
280 sp->stats.rx_frame_errors++;
281 if (status & SEEQ_RSTAT_REOF)
282 sp->stats.rx_errors++;
285 static inline void rx_maybe_restart(struct sgiseeq_private *sp,
286 struct hpc3_ethregs *hregs,
287 struct sgiseeq_regs *sregs)
289 if (!(hregs->rx_ctrl & HPC3_ERXCTRL_ACTIVE)) {
290 hregs->rx_ndptr = CPHYSADDR(sp->rx_desc + sp->rx_new);
291 seeq_go(sp, hregs, sregs);
295 #define for_each_rx(rd, sp) for((rd) = &(sp)->rx_desc[(sp)->rx_new]; \
296 !((rd)->rdma.cntinfo & HPCDMA_OWN); \
297 (rd) = &(sp)->rx_desc[(sp)->rx_new])
299 static inline void sgiseeq_rx(struct net_device *dev, struct sgiseeq_private *sp,
300 struct hpc3_ethregs *hregs,
301 struct sgiseeq_regs *sregs)
303 struct sgiseeq_rx_desc *rd;
304 struct sk_buff *skb = NULL;
305 unsigned char pkt_status;
306 unsigned char *pkt_pointer = NULL;
308 unsigned int orig_end = PREV_RX(sp->rx_new);
310 /* Service every received packet. */
311 for_each_rx(rd, sp) {
312 len = PKT_BUF_SZ - (rd->rdma.cntinfo & HPCDMA_BCNT) - 3;
313 pkt_pointer = (unsigned char *)(long)rd->buf_vaddr;
314 pkt_status = pkt_pointer[len + 2];
316 if (pkt_status & SEEQ_RSTAT_FIG) {
318 skb = dev_alloc_skb(len + 2);
325 /* Copy out of kseg1 to avoid silly cache flush. */
326 eth_copy_and_sum(skb, pkt_pointer + 2, len, 0);
327 skb->protocol = eth_type_trans(skb, dev);
329 /* We don't want to receive our own packets */
330 if (memcmp(eth_hdr(skb)->h_source, dev->dev_addr, ETH_ALEN)) {
332 dev->last_rx = jiffies;
333 sp->stats.rx_packets++;
334 sp->stats.rx_bytes += len;
336 /* Silently drop my own packets */
337 dev_kfree_skb_irq(skb);
340 printk (KERN_NOTICE "%s: Memory squeeze, deferring packet.\n",
342 sp->stats.rx_dropped++;
345 record_rx_errors(sp, pkt_status);
348 /* Return the entry to the ring pool. */
349 rd->rdma.cntinfo = RCNTINFO_INIT;
350 sp->rx_new = NEXT_RX(sp->rx_new);
352 sp->rx_desc[orig_end].rdma.cntinfo &= ~(HPCDMA_EOR);
353 sp->rx_desc[PREV_RX(sp->rx_new)].rdma.cntinfo |= HPCDMA_EOR;
354 rx_maybe_restart(sp, hregs, sregs);
357 static inline void tx_maybe_reset_collisions(struct sgiseeq_private *sp,
358 struct sgiseeq_regs *sregs)
361 sregs->rw.wregs.control = sp->control & ~(SEEQ_CTRL_XCNT);
362 sregs->rw.wregs.control = sp->control;
366 static inline void kick_tx(struct sgiseeq_tx_desc *td,
367 struct hpc3_ethregs *hregs)
369 /* If the HPC aint doin nothin, and there are more packets
370 * with ETXD cleared and XIU set we must make very certain
371 * that we restart the HPC else we risk locking up the
372 * adapter. The following code is only safe iff the HPCDMA
375 while ((td->tdma.cntinfo & (HPCDMA_XIU | HPCDMA_ETXD)) ==
376 (HPCDMA_XIU | HPCDMA_ETXD))
377 td = (struct sgiseeq_tx_desc *)(long) CKSEG1ADDR(td->tdma.pnext);
378 if (td->tdma.cntinfo & HPCDMA_XIU) {
379 hregs->tx_ndptr = CPHYSADDR(td);
380 hregs->tx_ctrl = HPC3_ETXCTRL_ACTIVE;
384 static inline void sgiseeq_tx(struct net_device *dev, struct sgiseeq_private *sp,
385 struct hpc3_ethregs *hregs,
386 struct sgiseeq_regs *sregs)
388 struct sgiseeq_tx_desc *td;
389 unsigned long status = hregs->tx_ctrl;
392 tx_maybe_reset_collisions(sp, sregs);
394 if (!(status & (HPC3_ETXCTRL_ACTIVE | SEEQ_TSTAT_PTRANS))) {
395 /* Oops, HPC detected some sort of error. */
396 if (status & SEEQ_TSTAT_R16)
397 sp->stats.tx_aborted_errors++;
398 if (status & SEEQ_TSTAT_UFLOW)
399 sp->stats.tx_fifo_errors++;
400 if (status & SEEQ_TSTAT_LCLS)
401 sp->stats.collisions++;
405 for (j = sp->tx_old; j != sp->tx_new; j = NEXT_TX(j)) {
406 td = &sp->tx_desc[j];
408 if (!(td->tdma.cntinfo & (HPCDMA_XIU)))
410 if (!(td->tdma.cntinfo & (HPCDMA_ETXD))) {
411 if (!(status & HPC3_ETXCTRL_ACTIVE)) {
412 hregs->tx_ndptr = CPHYSADDR(td);
413 hregs->tx_ctrl = HPC3_ETXCTRL_ACTIVE;
417 sp->stats.tx_packets++;
418 sp->tx_old = NEXT_TX(sp->tx_old);
419 td->tdma.cntinfo &= ~(HPCDMA_XIU | HPCDMA_XIE);
420 td->tdma.cntinfo |= HPCDMA_EOX;
424 static irqreturn_t sgiseeq_interrupt(int irq, void *dev_id)
426 struct net_device *dev = (struct net_device *) dev_id;
427 struct sgiseeq_private *sp = netdev_priv(dev);
428 struct hpc3_ethregs *hregs = sp->hregs;
429 struct sgiseeq_regs *sregs = sp->sregs;
431 spin_lock(&sp->tx_lock);
433 /* Ack the IRQ and set software state. */
434 hregs->reset = HPC3_ERST_CLRIRQ;
436 /* Always check for received packets. */
437 sgiseeq_rx(dev, sp, hregs, sregs);
439 /* Only check for tx acks if we have something queued. */
440 if (sp->tx_old != sp->tx_new)
441 sgiseeq_tx(dev, sp, hregs, sregs);
443 if ((TX_BUFFS_AVAIL(sp) > 0) && netif_queue_stopped(dev)) {
444 netif_wake_queue(dev);
446 spin_unlock(&sp->tx_lock);
451 static int sgiseeq_open(struct net_device *dev)
453 struct sgiseeq_private *sp = netdev_priv(dev);
454 struct sgiseeq_regs *sregs = sp->sregs;
455 unsigned int irq = dev->irq;
458 if (request_irq(irq, sgiseeq_interrupt, 0, sgiseeqstr, dev)) {
459 printk(KERN_ERR "Seeq8003: Can't get irq %d\n", dev->irq);
463 err = init_seeq(dev, sp, sregs);
467 netif_start_queue(dev);
477 static int sgiseeq_close(struct net_device *dev)
479 struct sgiseeq_private *sp = netdev_priv(dev);
480 struct sgiseeq_regs *sregs = sp->sregs;
481 unsigned int irq = dev->irq;
483 netif_stop_queue(dev);
485 /* Shutdown the Seeq. */
486 reset_hpc3_and_seeq(sp->hregs, sregs);
492 static inline int sgiseeq_reset(struct net_device *dev)
494 struct sgiseeq_private *sp = netdev_priv(dev);
495 struct sgiseeq_regs *sregs = sp->sregs;
498 err = init_seeq(dev, sp, sregs);
502 dev->trans_start = jiffies;
503 netif_wake_queue(dev);
508 static int sgiseeq_start_xmit(struct sk_buff *skb, struct net_device *dev)
510 struct sgiseeq_private *sp = netdev_priv(dev);
511 struct hpc3_ethregs *hregs = sp->hregs;
513 struct sgiseeq_tx_desc *td;
514 int skblen, len, entry;
516 spin_lock_irqsave(&sp->tx_lock, flags);
520 len = (skblen <= ETH_ZLEN) ? ETH_ZLEN : skblen;
521 sp->stats.tx_bytes += len;
523 td = &sp->tx_desc[entry];
525 /* Create entry. There are so many races with adding a new
526 * descriptor to the chain:
527 * 1) Assume that the HPC is off processing a DMA chain while
528 * we are changing all of the following.
529 * 2) Do no allow the HPC to look at a new descriptor until
530 * we have completely set up it's state. This means, do
531 * not clear HPCDMA_EOX in the current last descritptor
532 * until the one we are adding looks consistent and could
533 * be processes right now.
534 * 3) The tx interrupt code must notice when we've added a new
535 * entry and the HPC got to the end of the chain before we
536 * added this new entry and restarted it.
538 memcpy((char *)(long)td->buf_vaddr, skb->data, skblen);
540 memset((char *)(long)td->buf_vaddr + skb->len, 0, len-skblen);
541 td->tdma.cntinfo = (len & HPCDMA_BCNT) |
542 HPCDMA_XIU | HPCDMA_EOXP | HPCDMA_XIE | HPCDMA_EOX;
543 if (sp->tx_old != sp->tx_new) {
544 struct sgiseeq_tx_desc *backend;
546 backend = &sp->tx_desc[PREV_TX(sp->tx_new)];
547 backend->tdma.cntinfo &= ~HPCDMA_EOX;
549 sp->tx_new = NEXT_TX(sp->tx_new); /* Advance. */
551 /* Maybe kick the HPC back into motion. */
552 if (!(hregs->tx_ctrl & HPC3_ETXCTRL_ACTIVE))
553 kick_tx(&sp->tx_desc[sp->tx_old], hregs);
555 dev->trans_start = jiffies;
558 if (!TX_BUFFS_AVAIL(sp))
559 netif_stop_queue(dev);
560 spin_unlock_irqrestore(&sp->tx_lock, flags);
565 static void timeout(struct net_device *dev)
567 printk(KERN_NOTICE "%s: transmit timed out, resetting\n", dev->name);
570 dev->trans_start = jiffies;
571 netif_wake_queue(dev);
574 static struct net_device_stats *sgiseeq_get_stats(struct net_device *dev)
576 struct sgiseeq_private *sp = netdev_priv(dev);
581 static void sgiseeq_set_multicast(struct net_device *dev)
583 struct sgiseeq_private *sp = (struct sgiseeq_private *) dev->priv;
584 unsigned char oldmode = sp->mode;
586 if(dev->flags & IFF_PROMISC)
587 sp->mode = SEEQ_RCMD_RANY;
588 else if ((dev->flags & IFF_ALLMULTI) || dev->mc_count)
589 sp->mode = SEEQ_RCMD_RBMCAST;
591 sp->mode = SEEQ_RCMD_RBCAST;
593 /* XXX I know this sucks, but is there a better way to reprogram
594 * XXX the receiver? At least, this shouldn't happen too often.
597 if (oldmode != sp->mode)
601 static inline void setup_tx_ring(struct sgiseeq_tx_desc *buf, int nbufs)
605 while (i < (nbufs - 1)) {
606 buf[i].tdma.pnext = CPHYSADDR(buf + i + 1);
607 buf[i].tdma.pbuf = 0;
610 buf[i].tdma.pnext = CPHYSADDR(buf);
613 static inline void setup_rx_ring(struct sgiseeq_rx_desc *buf, int nbufs)
617 while (i < (nbufs - 1)) {
618 buf[i].rdma.pnext = CPHYSADDR(buf + i + 1);
619 buf[i].rdma.pbuf = 0;
622 buf[i].rdma.pbuf = 0;
623 buf[i].rdma.pnext = CPHYSADDR(buf);
626 #define ALIGNED(x) ((((unsigned long)(x)) + 0xf) & ~(0xf))
628 static int sgiseeq_init(struct hpc3_regs* hpcregs, int irq)
630 struct sgiseeq_init_block *sr;
631 struct sgiseeq_private *sp;
632 struct net_device *dev;
635 dev = alloc_etherdev(sizeof (struct sgiseeq_private));
637 printk(KERN_ERR "Sgiseeq: Etherdev alloc failed, aborting.\n");
641 sp = netdev_priv(dev);
643 /* Make private data page aligned */
644 sr = (struct sgiseeq_init_block *) get_zeroed_page(GFP_KERNEL);
646 printk(KERN_ERR "Sgiseeq: Page alloc failed, aborting.\n");
648 goto err_out_free_dev;
652 #define EADDR_NVOFS 250
653 for (i = 0; i < 3; i++) {
654 unsigned short tmp = ip22_nvram_read(EADDR_NVOFS / 2 + i);
656 dev->dev_addr[2 * i] = tmp >> 8;
657 dev->dev_addr[2 * i + 1] = tmp & 0xff;
664 sp->sregs = (struct sgiseeq_regs *) &hpcregs->eth_ext[0];
665 sp->hregs = &hpcregs->ethregs;
666 sp->name = sgiseeqstr;
667 sp->mode = SEEQ_RCMD_RBCAST;
669 sp->rx_desc = (struct sgiseeq_rx_desc *)
670 CKSEG1ADDR(ALIGNED(&sp->srings->rxvector[0]));
671 dma_cache_wback_inv((unsigned long)&sp->srings->rxvector,
672 sizeof(sp->srings->rxvector));
673 sp->tx_desc = (struct sgiseeq_tx_desc *)
674 CKSEG1ADDR(ALIGNED(&sp->srings->txvector[0]));
675 dma_cache_wback_inv((unsigned long)&sp->srings->txvector,
676 sizeof(sp->srings->txvector));
678 /* A couple calculations now, saves many cycles later. */
679 setup_rx_ring(sp->rx_desc, SEEQ_RX_BUFFERS);
680 setup_tx_ring(sp->tx_desc, SEEQ_TX_BUFFERS);
682 /* Setup PIO and DMA transfer timing */
683 sp->hregs->pconfig = 0x161;
684 sp->hregs->dconfig = HPC3_EDCFG_FIRQ | HPC3_EDCFG_FEOP |
685 HPC3_EDCFG_FRXDC | HPC3_EDCFG_PTO | 0x026;
687 /* Reset the chip. */
688 hpc3_eth_reset(sp->hregs);
690 sp->is_edlc = !(sp->sregs->rw.rregs.collision_tx[0] & 0xff);
692 sp->control = SEEQ_CTRL_XCNT | SEEQ_CTRL_ACCNT |
693 SEEQ_CTRL_SFLAG | SEEQ_CTRL_ESHORT |
696 dev->open = sgiseeq_open;
697 dev->stop = sgiseeq_close;
698 dev->hard_start_xmit = sgiseeq_start_xmit;
699 dev->tx_timeout = timeout;
700 dev->watchdog_timeo = (200 * HZ) / 1000;
701 dev->get_stats = sgiseeq_get_stats;
702 dev->set_multicast_list = sgiseeq_set_multicast;
703 dev->set_mac_address = sgiseeq_set_mac_address;
706 if (register_netdev(dev)) {
707 printk(KERN_ERR "Sgiseeq: Cannot register net device, "
710 goto err_out_free_page;
713 printk(KERN_INFO "%s: %s ", dev->name, sgiseeqstr);
714 for (i = 0; i < 6; i++)
715 printk("%2.2x%c", dev->dev_addr[i], i == 5 ? '\n' : ':');
717 sp->next_module = root_sgiseeq_dev;
718 root_sgiseeq_dev = dev;
723 free_page((unsigned long) sp->srings);
731 static int __init sgiseeq_probe(void)
733 /* On board adapter on 1st HPC is always present */
734 return sgiseeq_init(hpc3c0, SGI_ENET_IRQ);
737 static void __exit sgiseeq_exit(void)
739 struct net_device *next, *dev;
740 struct sgiseeq_private *sp;
742 for (dev = root_sgiseeq_dev; dev; dev = next) {
743 sp = (struct sgiseeq_private *) netdev_priv(dev);
744 next = sp->next_module;
745 unregister_netdev(dev);
746 free_page((unsigned long) sp->srings);
751 module_init(sgiseeq_probe);
752 module_exit(sgiseeq_exit);
754 MODULE_DESCRIPTION("SGI Seeq 8003 driver");
755 MODULE_AUTHOR("Linux/MIPS Mailing List <linux-mips@linux-mips.org>");
756 MODULE_LICENSE("GPL");