This commit was manufactured by cvs2svn to create branch 'vserver'.
[linux-2.6.git] / arch / xtensa / platform-iss / network.c
1 /*
2  *
3  * arch/xtensa/platform-iss/network.c
4  *
5  * Platform specific initialization.
6  *
7  * Authors: Chris Zankel <chris@zankel.net>
8  * Based on work form the UML team.
9  *
10  * Copyright 2005 Tensilica Inc.
11  *
12  * This program is free software; you can redistribute  it and/or modify it
13  * under  the terms of  the GNU General  Public License as published by the
14  * Free Software Foundation;  either version 2 of the  License, or (at your
15  * option) any later version.
16  *
17  */
18
19 #include <linux/config.h>
20 #include <linux/list.h>
21 #include <linux/irq.h>
22 #include <linux/spinlock.h>
23 #include <linux/slab.h>
24 #include <linux/timer.h>
25 #include <linux/if_ether.h>
26 #include <linux/inetdevice.h>
27 #include <linux/init.h>
28 #include <linux/if_tun.h>
29 #include <linux/etherdevice.h>
30 #include <linux/interrupt.h>
31 #include <linux/ioctl.h>
32 #include <linux/bootmem.h>
33 #include <linux/ethtool.h>
34 #include <linux/rtnetlink.h>
35 #include <linux/timer.h>
36 #include <linux/platform_device.h>
37
38 #include <xtensa/simcall.h>
39
40 #define DRIVER_NAME "iss-netdev"
41 #define ETH_MAX_PACKET 1500
42 #define ETH_HEADER_OTHER 14
43 #define ISS_NET_TIMER_VALUE (2 * HZ)
44
45
46 static DEFINE_SPINLOCK(opened_lock);
47 static LIST_HEAD(opened);
48
49 static DEFINE_SPINLOCK(devices_lock);
50 static LIST_HEAD(devices);
51
52 /* ------------------------------------------------------------------------- */
53
54 /* We currently only support the TUNTAP transport protocol. */
55
56 #define TRANSPORT_TUNTAP_NAME "tuntap"
57 #define TRANSPORT_TUNTAP_MTU ETH_MAX_PACKET
58
59 struct tuntap_info {
60         char dev_name[IFNAMSIZ];
61         int fixed_config;
62         unsigned char gw[ETH_ALEN];
63         int fd;
64 };
65
66 /* ------------------------------------------------------------------------- */
67
68
69 /* This structure contains out private information for the driver. */
70
71 struct iss_net_private {
72
73         struct list_head device_list;
74         struct list_head opened_list;
75
76         spinlock_t lock;
77         struct net_device *dev;
78         struct platform_device pdev;
79         struct timer_list tl;
80         struct net_device_stats stats;
81
82         struct timer_list timer;
83         unsigned int timer_val;
84
85         int index;
86         int mtu;
87
88         unsigned char mac[ETH_ALEN];
89         int have_mac;
90
91         struct {
92                 union {
93                         struct tuntap_info tuntap;
94                 } info;
95
96                 int (*open)(struct iss_net_private *lp);
97                 void (*close)(struct iss_net_private *lp);
98                 int (*read)(struct iss_net_private *lp, struct sk_buff **skb);
99                 int (*write)(struct iss_net_private *lp, struct sk_buff **skb);
100                 unsigned short (*protocol)(struct sk_buff *skb);
101                 int (*poll)(struct iss_net_private *lp);
102         } tp;
103
104 };
105
106 /* ======================= ISS SIMCALL INTERFACE =========================== */
107
108 /* Note: __simc must _not_ be declared inline! */
109
110 static int errno;
111
112 static int __simc (int a, int b, int c, int d, int e, int f)
113 {
114         int ret;
115         __asm__ __volatile__ ("simcall\n"
116                               "mov %0, a2\n"
117                               "mov %1, a3\n" : "=a" (ret), "=a" (errno)
118                               : : "a2", "a3");
119         return ret;
120 }
121
122 static int inline simc_open(char *file, int flags, int mode)
123 {
124         return __simc(SYS_open, (int) file, flags, mode, 0, 0);
125 }
126
127 static int inline simc_close(int fd)
128 {
129         return __simc(SYS_close, fd, 0, 0, 0, 0);
130 }
131
132 static int inline simc_ioctl(int fd, int request, void *arg)
133 {
134         return __simc(SYS_ioctl, fd, request, (int) arg, 0, 0);
135 }
136
137 static int inline simc_read(int fd, void *buf, size_t count)
138 {
139         return __simc(SYS_read, fd, (int) buf, count, 0, 0);
140 }
141
142 static int inline simc_write(int fd, void *buf, size_t count)
143 {
144         return __simc(SYS_write, fd, (int) buf, count, 0, 0);
145 }
146
147 static int inline simc_poll(int fd)
148 {
149         struct timeval tv = { .tv_sec = 0, .tv_usec = 0 };
150
151         return __simc(SYS_select_one, fd, XTISS_SELECT_ONE_READ, (int)&tv,0,0);
152 }
153
154 /* ================================ HELPERS ================================ */
155
156
157 static char *split_if_spec(char *str, ...)
158 {
159         char **arg, *end;
160         va_list ap;
161
162         va_start(ap, str);
163         while ((arg = va_arg(ap, char**)) != NULL) {
164                 if (*str == '\0')
165                         return NULL;
166                 end = strchr(str, ',');
167                 if (end != str)
168                         *arg = str;
169                 if (end == NULL)
170                         return NULL;
171                 *end ++ = '\0';
172                 str = end;
173         }
174         va_end(ap);
175         return str;
176 }
177
178
179 #if 0
180 /* Adjust SKB. */
181
182 struct sk_buff *ether_adjust_skb(struct sk_buff *skb, int extra)
183 {
184         if ((skb != NULL) && (skb_tailroom(skb) < extra)) {
185                 struct sk_buff *skb2;
186
187                 skb2 = skb_copy_expand(skb, 0, extra, GFP_ATOMIC);
188                 dev_kfree_skb(skb);
189                 skb = skb2;
190         }
191         if (skb != NULL)
192                 skb_put(skb, extra);
193
194         return skb;
195 }
196 #endif
197
198 /* Return the IP address as a string for a given device. */
199
200 static void dev_ip_addr(void *d, char *buf, char *bin_buf)
201 {
202         struct net_device *dev = d;
203         struct in_device *ip = dev->ip_ptr;
204         struct in_ifaddr *in;
205         u32 addr;
206
207         if ((ip == NULL) || ((in = ip->ifa_list) == NULL)) {
208                 printk(KERN_WARNING "Device not assigned an IP address!\n");
209                 return;
210         }
211
212         addr = in->ifa_address;
213         sprintf(buf, "%d.%d.%d.%d", addr & 0xff, (addr >> 8) & 0xff,
214                 (addr >> 16) & 0xff, addr >> 24);
215
216         if (bin_buf) {
217                 bin_buf[0] = addr & 0xff;
218                 bin_buf[1] = (addr >> 8) & 0xff;
219                 bin_buf[2] = (addr >> 16) & 0xff;
220                 bin_buf[3] = addr >> 24;
221         }
222 }
223
224 /* Set Ethernet address of the specified device. */
225
226 static void inline set_ether_mac(void *d, unsigned char *addr)
227 {
228         struct net_device *dev = d;
229         memcpy(dev->dev_addr, addr, ETH_ALEN);
230 }
231
232
233 /* ======================= TUNTAP TRANSPORT INTERFACE ====================== */
234
235 static int tuntap_open(struct iss_net_private *lp)
236 {
237         struct ifreq ifr;
238         char *dev_name = lp->tp.info.tuntap.dev_name;
239         int err = -EINVAL;
240         int fd;
241
242         /* We currently only support a fixed configuration. */
243
244         if (!lp->tp.info.tuntap.fixed_config)
245                 return -EINVAL;
246
247         if ((fd = simc_open("/dev/net/tun", 02, 0)) < 0) {      /* O_RDWR */
248                 printk("Failed to open /dev/net/tun, returned %d "
249                        "(errno = %d)\n", fd, errno);
250                 return fd;
251         }
252
253         memset(&ifr, 0, sizeof ifr);
254         ifr.ifr_flags = IFF_TAP | IFF_NO_PI;
255         strlcpy(ifr.ifr_name, dev_name, sizeof ifr.ifr_name - 1);
256
257         if ((err = simc_ioctl(fd, TUNSETIFF, (void*) &ifr)) < 0) {
258                 printk("Failed to set interface, returned %d "
259                        "(errno = %d)\n", err, errno);
260                 simc_close(fd);
261                 return err;
262         }
263
264         lp->tp.info.tuntap.fd = fd;
265         return err;
266 }
267
268 static void tuntap_close(struct iss_net_private *lp)
269 {
270 #if 0
271         if (lp->tp.info.tuntap.fixed_config)
272                 iter_addresses(lp->tp.info.tuntap.dev, close_addr, lp->host.dev_name);
273 #endif
274         simc_close(lp->tp.info.tuntap.fd);
275         lp->tp.info.tuntap.fd = -1;
276 }
277
278 static int tuntap_read (struct iss_net_private *lp, struct sk_buff **skb)
279 {
280 #if 0
281         *skb = ether_adjust_skb(*skb, ETH_HEADER_OTHER);
282         if (*skb == NULL)
283                 return -ENOMEM;
284 #endif
285
286         return simc_read(lp->tp.info.tuntap.fd,
287                         (*skb)->data, (*skb)->dev->mtu + ETH_HEADER_OTHER);
288 }
289
290 static int tuntap_write (struct iss_net_private *lp, struct sk_buff **skb)
291 {
292         return simc_write(lp->tp.info.tuntap.fd, (*skb)->data, (*skb)->len);
293 }
294
295 unsigned short tuntap_protocol(struct sk_buff *skb)
296 {
297         return eth_type_trans(skb, skb->dev);
298 }
299
300 static int tuntap_poll(struct iss_net_private *lp)
301 {
302         return simc_poll(lp->tp.info.tuntap.fd);
303 }
304
305 /*
306  * Currently only a device name is supported.
307  * ethX=tuntap[,[mac address][,[device name]]]
308  */
309
310 static int tuntap_probe(struct iss_net_private *lp, int index, char *init)
311 {
312         const int len = strlen(TRANSPORT_TUNTAP_NAME);
313         char *dev_name = NULL, *mac_str = NULL, *rem = NULL;
314
315         /* Transport should be 'tuntap': ethX=tuntap,mac,dev_name */
316
317         if (strncmp(init, TRANSPORT_TUNTAP_NAME, len))
318                 return 0;
319
320         if (*(init += strlen(TRANSPORT_TUNTAP_NAME)) == ',') {
321                 if ((rem=split_if_spec(init+1, &mac_str, &dev_name)) != NULL) {
322                         printk("Extra garbage on specification : '%s'\n", rem);
323                         return 0;
324                 }
325         } else if (*init != '\0') {
326                 printk("Invalid argument: %s. Skipping device!\n", init);
327                 return 0;
328         }
329
330         if (dev_name) {
331                 strncpy(lp->tp.info.tuntap.dev_name, dev_name,
332                          sizeof lp->tp.info.tuntap.dev_name);
333                 lp->tp.info.tuntap.fixed_config = 1;
334         } else
335                 strcpy(lp->tp.info.tuntap.dev_name, TRANSPORT_TUNTAP_NAME);
336
337
338 #if 0
339         if (setup_etheraddr(mac_str, lp->mac))
340                 lp->have_mac = 1;
341 #endif
342         lp->mtu = TRANSPORT_TUNTAP_MTU;
343
344         //lp->info.tuntap.gate_addr = gate_addr;
345
346         lp->tp.info.tuntap.fd = -1;
347
348         lp->tp.open = tuntap_open;
349         lp->tp.close = tuntap_close;
350         lp->tp.read = tuntap_read;
351         lp->tp.write = tuntap_write;
352         lp->tp.protocol = tuntap_protocol;
353         lp->tp.poll = tuntap_poll;
354
355         printk("TUN/TAP backend - ");
356 #if 0
357         if (lp->host.gate_addr != NULL)
358                 printk("IP = %s", lp->host.gate_addr);
359 #endif
360         printk("\n");
361
362         return 1;
363 }
364
365 /* ================================ ISS NET ================================ */
366
367 static int iss_net_rx(struct net_device *dev)
368 {
369         struct iss_net_private *lp = dev->priv;
370         int pkt_len;
371         struct sk_buff *skb;
372
373         /* Check if there is any new data. */
374
375         if (lp->tp.poll(lp) == 0)
376                 return 0;
377
378         /* Try to allocate memory, if it fails, try again next round. */
379
380         if ((skb = dev_alloc_skb(dev->mtu + 2 + ETH_HEADER_OTHER)) == NULL) {
381                 lp->stats.rx_dropped++;
382                 return 0;
383         }
384
385         skb_reserve(skb, 2);
386
387         /* Setup skb */
388
389         skb->dev = dev;
390         skb->mac.raw = skb->data;
391         pkt_len = lp->tp.read(lp, &skb);
392         skb_put(skb, pkt_len);
393
394         if (pkt_len > 0) {
395                 skb_trim(skb, pkt_len);
396                 skb->protocol = lp->tp.protocol(skb);
397         //      netif_rx(skb);
398                 netif_rx_ni(skb);
399
400                 lp->stats.rx_bytes += skb->len;
401                 lp->stats.rx_packets++;
402                 return pkt_len;
403         }
404         kfree_skb(skb);
405         return pkt_len;
406 }
407
408 static int iss_net_poll(void)
409 {
410         struct list_head *ele;
411         int err, ret = 0;
412
413         spin_lock(&opened_lock);
414
415         list_for_each(ele, &opened) {
416                 struct iss_net_private *lp;
417
418                 lp = list_entry(ele, struct iss_net_private, opened_list);
419
420                 if (!netif_running(lp->dev))
421                         break;
422
423                 spin_lock(&lp->lock);
424
425                 while ((err = iss_net_rx(lp->dev)) > 0)
426                         ret++;
427
428                 spin_unlock(&lp->lock);
429
430                 if (err < 0) {
431                         printk(KERN_ERR "Device '%s' read returned %d, "
432                                "shutting it down\n", lp->dev->name, err);
433                         dev_close(lp->dev);
434                 } else {
435                         // FIXME reactivate_fd(lp->fd, ISS_ETH_IRQ);
436                 }
437         }
438
439         spin_unlock(&opened_lock);
440         return ret;
441 }
442
443
444 static void iss_net_timer(unsigned long priv)
445 {
446         struct iss_net_private* lp = (struct iss_net_private*) priv;
447
448         spin_lock(&lp->lock);
449
450         iss_net_poll();
451
452         mod_timer(&lp->timer, jiffies + lp->timer_val);
453
454         spin_unlock(&lp->lock);
455 }
456
457
458 static int iss_net_open(struct net_device *dev)
459 {
460         struct iss_net_private *lp = dev->priv;
461         char addr[sizeof "255.255.255.255\0"];
462         int err;
463
464         spin_lock(&lp->lock);
465
466         if ((err = lp->tp.open(lp)) < 0)
467                 goto out;
468
469         if (!lp->have_mac) {
470                 dev_ip_addr(dev, addr, &lp->mac[2]);
471                 set_ether_mac(dev, lp->mac);
472         }
473
474         netif_start_queue(dev);
475
476         /* clear buffer - it can happen that the host side of the interface
477          * is full when we gethere. In this case, new data is never queued,
478          * SIGIOs never arrive, and the net never works.
479          */
480         while ((err = iss_net_rx(dev)) > 0)
481                 ;
482
483         spin_lock(&opened_lock);
484         list_add(&lp->opened_list, &opened);
485         spin_unlock(&opened_lock);
486
487         init_timer(&lp->timer);
488         lp->timer_val = ISS_NET_TIMER_VALUE;
489         lp->timer.data = (unsigned long) lp;
490         lp->timer.function = iss_net_timer;
491         mod_timer(&lp->timer, jiffies + lp->timer_val);
492
493 out:
494         spin_unlock(&lp->lock);
495         return err;
496 }
497
498 static int iss_net_close(struct net_device *dev)
499 {
500         struct iss_net_private *lp = dev->priv;
501 printk("iss_net_close!\n");
502         netif_stop_queue(dev);
503         spin_lock(&lp->lock);
504
505         spin_lock(&opened_lock);
506         list_del(&opened);
507         spin_unlock(&opened_lock);
508
509         del_timer_sync(&lp->timer);
510
511         lp->tp.close(lp);
512
513         spin_unlock(&lp->lock);
514         return 0;
515 }
516
517 static int iss_net_start_xmit(struct sk_buff *skb, struct net_device *dev)
518 {
519         struct iss_net_private *lp = dev->priv;
520         unsigned long flags;
521         int len;
522
523         netif_stop_queue(dev);
524         spin_lock_irqsave(&lp->lock, flags);
525
526         len = lp->tp.write(lp, &skb);
527
528         if (len == skb->len) {
529                 lp->stats.tx_packets++;
530                 lp->stats.tx_bytes += skb->len;
531                 dev->trans_start = jiffies;
532                 netif_start_queue(dev);
533
534                 /* this is normally done in the interrupt when tx finishes */
535                 netif_wake_queue(dev);
536
537         } else if (len == 0) {
538                 netif_start_queue(dev);
539                 lp->stats.tx_dropped++;
540
541         } else {
542                 netif_start_queue(dev);
543                 printk(KERN_ERR "iss_net_start_xmit: failed(%d)\n", len);
544         }
545
546         spin_unlock_irqrestore(&lp->lock, flags);
547
548         dev_kfree_skb(skb);
549         return 0;
550 }
551
552
553 static struct net_device_stats *iss_net_get_stats(struct net_device *dev)
554 {
555         struct iss_net_private *lp = dev->priv;
556         return &lp->stats;
557 }
558
559 static void iss_net_set_multicast_list(struct net_device *dev)
560 {
561 #if 0
562         if (dev->flags & IFF_PROMISC)
563                 return;
564         else if (dev->mc_count)
565                 dev->flags |= IFF_ALLMULTI;
566         else
567                 dev->flags &= ~IFF_ALLMULTI;
568 #endif
569 }
570
571 static void iss_net_tx_timeout(struct net_device *dev)
572 {
573 #if 0
574         dev->trans_start = jiffies;
575         netif_wake_queue(dev);
576 #endif
577 }
578
579 static int iss_net_set_mac(struct net_device *dev, void *addr)
580 {
581 #if 0
582         struct iss_net_private *lp = dev->priv;
583         struct sockaddr *hwaddr = addr;
584
585         spin_lock(&lp->lock);
586         memcpy(dev->dev_addr, hwaddr->sa_data, ETH_ALEN);
587         spin_unlock(&lp->lock);
588 #endif
589
590         return 0;
591 }
592
593 static int iss_net_change_mtu(struct net_device *dev, int new_mtu)
594 {
595 #if 0
596         struct iss_net_private *lp = dev->priv;
597         int err = 0;
598
599         spin_lock(&lp->lock);
600
601         // FIXME not needed new_mtu = transport_set_mtu(new_mtu, &lp->user);
602
603         if (new_mtu < 0)
604                 err = new_mtu;
605         else
606                 dev->mtu = new_mtu;
607
608         spin_unlock(&lp->lock);
609         return err;
610 #endif
611         return -EINVAL;
612 }
613
614 void iss_net_user_timer_expire(unsigned long _conn)
615 {
616 }
617
618
619 static struct platform_driver iss_net_driver = {
620         .driver = {
621                 .name  = DRIVER_NAME,
622         },
623 };
624
625 static int driver_registered;
626
627 static int iss_net_configure(int index, char *init)
628 {
629         struct net_device *dev;
630         struct iss_net_private *lp;
631         int err;
632
633         if ((dev = alloc_etherdev(sizeof *lp)) == NULL) {
634                 printk(KERN_ERR "eth_configure: failed to allocate device\n");
635                 return 1;
636         }
637
638         /* Initialize private element. */
639
640         lp = dev->priv;
641         *lp = ((struct iss_net_private) {
642                 .device_list            = LIST_HEAD_INIT(lp->device_list),
643                 .opened_list            = LIST_HEAD_INIT(lp->opened_list),
644                 .lock                   = SPIN_LOCK_UNLOCKED,
645                 .dev                    = dev,
646                 .index                  = index,
647                 //.fd                   = -1,
648                 .mac                    = { 0xfe, 0xfd, 0x0, 0x0, 0x0, 0x0 },
649                 .have_mac               = 0,
650                 });
651
652         /*
653          * Try all transport protocols.
654          * Note: more protocols can be added by adding '&& !X_init(lp, eth)'.
655          */
656
657         if (!tuntap_probe(lp, index, init)) {
658                 printk("Invalid arguments. Skipping device!\n");
659                 goto errout;
660         }
661
662         printk(KERN_INFO "Netdevice %d ", index);
663         if (lp->have_mac)
664                 printk("(%02x:%02x:%02x:%02x:%02x:%02x) ",
665                                 lp->mac[0], lp->mac[1],
666                                 lp->mac[2], lp->mac[3],
667                                 lp->mac[4], lp->mac[5]);
668         printk(": ");
669
670         /* sysfs register */
671
672         if (!driver_registered) {
673                 platform_driver_register(&iss_net_driver);
674                 driver_registered = 1;
675         }
676
677         spin_lock(&devices_lock);
678         list_add(&lp->device_list, &devices);
679         spin_unlock(&devices_lock);
680
681         lp->pdev.id = index;
682         lp->pdev.name = DRIVER_NAME;
683         platform_device_register(&lp->pdev);
684         SET_NETDEV_DEV(dev,&lp->pdev.dev);
685
686         /*
687          * If this name ends up conflicting with an existing registered
688          * netdevice, that is OK, register_netdev{,ice}() will notice this
689          * and fail.
690          */
691         snprintf(dev->name, sizeof dev->name, "eth%d", index);
692
693         dev->mtu = lp->mtu;
694         dev->open = iss_net_open;
695         dev->hard_start_xmit = iss_net_start_xmit;
696         dev->stop = iss_net_close;
697         dev->get_stats = iss_net_get_stats;
698         dev->set_multicast_list = iss_net_set_multicast_list;
699         dev->tx_timeout = iss_net_tx_timeout;
700         dev->set_mac_address = iss_net_set_mac;
701         dev->change_mtu = iss_net_change_mtu;
702         dev->watchdog_timeo = (HZ >> 1);
703         dev->irq = -1;
704
705         rtnl_lock();
706         err = register_netdevice(dev);
707         rtnl_unlock();
708
709         if (err) {
710                 printk("Error registering net device!\n");
711                 /* XXX: should we call ->remove() here? */
712                 free_netdev(dev);
713                 return 1;
714         }
715
716         init_timer(&lp->tl);
717         lp->tl.function = iss_net_user_timer_expire;
718
719 #if 0
720         if (lp->have_mac)
721                 set_ether_mac(dev, lp->mac);
722 #endif
723         return 0;
724
725 errout:
726         // FIXME: unregister; free, etc..
727         return -EIO;
728
729 }
730
731 /* ------------------------------------------------------------------------- */
732
733 /* Filled in during early boot */
734
735 struct list_head eth_cmd_line = LIST_HEAD_INIT(eth_cmd_line);
736
737 struct iss_net_init {
738         struct list_head list;
739         char *init;             /* init string */
740         int index;
741 };
742
743 /*
744  * Parse the command line and look for 'ethX=...' fields, and register all
745  * those fields. They will be later initialized in iss_net_init.
746  */
747
748 #define ERR KERN_ERR "iss_net_setup: "
749
750 static int iss_net_setup(char *str)
751 {
752         struct iss_net_private *device = NULL;
753         struct iss_net_init *new;
754         struct list_head *ele;
755         char *end;
756         int n;
757
758         n = simple_strtoul(str, &end, 0);
759         if (end == str) {
760                 printk(ERR "Failed to parse '%s'\n", str);
761                 return 1;
762         }
763         if (n < 0) {
764                 printk(ERR "Device %d is negative\n", n);
765                 return 1;
766         }
767         if (*(str = end) != '=') {
768                 printk(ERR "Expected '=' after device number\n");
769                 return 1;
770         }
771
772         spin_lock(&devices_lock);
773
774         list_for_each(ele, &devices) {
775                 device = list_entry(ele, struct iss_net_private, device_list);
776                 if (device->index == n)
777                         break;
778         }
779
780         spin_unlock(&devices_lock);
781
782         if (device && device->index == n) {
783                 printk(ERR "Device %d already configured\n", n);
784                 return 1;
785         }
786
787         if ((new = alloc_bootmem(sizeof new)) == NULL) {
788                 printk("Alloc_bootmem failed\n");
789                 return 1;
790         }
791
792         INIT_LIST_HEAD(&new->list);
793         new->index = n;
794         new->init = str + 1;
795
796         list_add_tail(&new->list, &eth_cmd_line);
797         return 1;
798 }
799
800 #undef ERR
801
802 __setup("eth", iss_net_setup);
803
804 /*
805  * Initialize all ISS Ethernet devices previously registered in iss_net_setup.
806  */
807
808 static int iss_net_init(void)
809 {
810         struct list_head *ele, *next;
811
812         /* Walk through all Ethernet devices specified in the command line. */
813
814         list_for_each_safe(ele, next, &eth_cmd_line) {
815                 struct iss_net_init *eth;
816                 eth = list_entry(ele, struct iss_net_init, list);
817                 iss_net_configure(eth->index, eth->init);
818         }
819
820         return 1;
821 }
822
823 module_init(iss_net_init);
824