[TG3]: Set minimal hw interrupt mitigation.
[linux-2.6/verdex.git] / arch / um / drivers / net_kern.c
blob4eeaf88c1e97ba3bac425ff55b5cc904b4ee6d29
1 /*
2 * Copyright (C) 2001 Lennert Buytenhek (buytenh@gnu.org) and
3 * James Leu (jleu@mindspring.net).
4 * Copyright (C) 2001 by various other people who didn't put their name here.
5 * Licensed under the GPL.
6 */
8 #include "linux/config.h"
9 #include "linux/kernel.h"
10 #include "linux/netdevice.h"
11 #include "linux/rtnetlink.h"
12 #include "linux/skbuff.h"
13 #include "linux/socket.h"
14 #include "linux/spinlock.h"
15 #include "linux/module.h"
16 #include "linux/init.h"
17 #include "linux/etherdevice.h"
18 #include "linux/list.h"
19 #include "linux/inetdevice.h"
20 #include "linux/ctype.h"
21 #include "linux/bootmem.h"
22 #include "linux/ethtool.h"
23 #include "asm/uaccess.h"
24 #include "user_util.h"
25 #include "kern_util.h"
26 #include "net_kern.h"
27 #include "net_user.h"
28 #include "mconsole_kern.h"
29 #include "init.h"
30 #include "irq_user.h"
31 #include "irq_kern.h"
33 #define DRIVER_NAME "uml-netdev"
35 static DEFINE_SPINLOCK(opened_lock);
36 LIST_HEAD(opened);
38 static int uml_net_rx(struct net_device *dev)
40 struct uml_net_private *lp = dev->priv;
41 int pkt_len;
42 struct sk_buff *skb;
44 /* If we can't allocate memory, try again next round. */
45 skb = dev_alloc_skb(dev->mtu);
46 if (skb == NULL) {
47 lp->stats.rx_dropped++;
48 return 0;
51 skb->dev = dev;
52 skb_put(skb, dev->mtu);
53 skb->mac.raw = skb->data;
54 pkt_len = (*lp->read)(lp->fd, &skb, lp);
56 if (pkt_len > 0) {
57 skb_trim(skb, pkt_len);
58 skb->protocol = (*lp->protocol)(skb);
59 netif_rx(skb);
61 lp->stats.rx_bytes += skb->len;
62 lp->stats.rx_packets++;
63 return pkt_len;
66 kfree_skb(skb);
67 return pkt_len;
70 irqreturn_t uml_net_interrupt(int irq, void *dev_id, struct pt_regs *regs)
72 struct net_device *dev = dev_id;
73 struct uml_net_private *lp = dev->priv;
74 int err;
76 if(!netif_running(dev))
77 return(IRQ_NONE);
79 spin_lock(&lp->lock);
80 while((err = uml_net_rx(dev)) > 0) ;
81 if(err < 0) {
82 printk(KERN_ERR
83 "Device '%s' read returned %d, shutting it down\n",
84 dev->name, err);
85 dev_close(dev);
86 goto out;
88 reactivate_fd(lp->fd, UM_ETH_IRQ);
90 out:
91 spin_unlock(&lp->lock);
92 return(IRQ_HANDLED);
95 static int uml_net_open(struct net_device *dev)
97 struct uml_net_private *lp = dev->priv;
98 char addr[sizeof("255.255.255.255\0")];
99 int err;
101 spin_lock(&lp->lock);
103 if(lp->fd >= 0){
104 err = -ENXIO;
105 goto out;
108 if(!lp->have_mac){
109 dev_ip_addr(dev, addr, &lp->mac[2]);
110 set_ether_mac(dev, lp->mac);
113 lp->fd = (*lp->open)(&lp->user);
114 if(lp->fd < 0){
115 err = lp->fd;
116 goto out;
119 err = um_request_irq(dev->irq, lp->fd, IRQ_READ, uml_net_interrupt,
120 SA_INTERRUPT | SA_SHIRQ, dev->name, dev);
121 if(err != 0){
122 printk(KERN_ERR "uml_net_open: failed to get irq(%d)\n", err);
123 if(lp->close != NULL) (*lp->close)(lp->fd, &lp->user);
124 lp->fd = -1;
125 err = -ENETUNREACH;
128 lp->tl.data = (unsigned long) &lp->user;
129 netif_start_queue(dev);
131 /* clear buffer - it can happen that the host side of the interface
132 * is full when we get here. In this case, new data is never queued,
133 * SIGIOs never arrive, and the net never works.
135 while((err = uml_net_rx(dev)) > 0) ;
137 out:
138 spin_unlock(&lp->lock);
139 return(err);
142 static int uml_net_close(struct net_device *dev)
144 struct uml_net_private *lp = dev->priv;
146 netif_stop_queue(dev);
147 spin_lock(&lp->lock);
149 free_irq_by_irq_and_dev(dev->irq, dev);
150 free_irq(dev->irq, dev);
151 if(lp->close != NULL)
152 (*lp->close)(lp->fd, &lp->user);
153 lp->fd = -1;
155 spin_unlock(&lp->lock);
156 return 0;
159 static int uml_net_start_xmit(struct sk_buff *skb, struct net_device *dev)
161 struct uml_net_private *lp = dev->priv;
162 unsigned long flags;
163 int len;
165 netif_stop_queue(dev);
167 spin_lock_irqsave(&lp->lock, flags);
169 len = (*lp->write)(lp->fd, &skb, lp);
171 if(len == skb->len) {
172 lp->stats.tx_packets++;
173 lp->stats.tx_bytes += skb->len;
174 dev->trans_start = jiffies;
175 netif_start_queue(dev);
177 /* this is normally done in the interrupt when tx finishes */
178 netif_wake_queue(dev);
180 else if(len == 0){
181 netif_start_queue(dev);
182 lp->stats.tx_dropped++;
184 else {
185 netif_start_queue(dev);
186 printk(KERN_ERR "uml_net_start_xmit: failed(%d)\n", len);
189 spin_unlock_irqrestore(&lp->lock, flags);
191 dev_kfree_skb(skb);
193 return 0;
196 static struct net_device_stats *uml_net_get_stats(struct net_device *dev)
198 struct uml_net_private *lp = dev->priv;
199 return &lp->stats;
202 static void uml_net_set_multicast_list(struct net_device *dev)
204 if (dev->flags & IFF_PROMISC) return;
205 else if (dev->mc_count) dev->flags |= IFF_ALLMULTI;
206 else dev->flags &= ~IFF_ALLMULTI;
209 static void uml_net_tx_timeout(struct net_device *dev)
211 dev->trans_start = jiffies;
212 netif_wake_queue(dev);
215 static int uml_net_set_mac(struct net_device *dev, void *addr)
217 struct uml_net_private *lp = dev->priv;
218 struct sockaddr *hwaddr = addr;
220 spin_lock(&lp->lock);
221 memcpy(dev->dev_addr, hwaddr->sa_data, ETH_ALEN);
222 spin_unlock(&lp->lock);
224 return(0);
227 static int uml_net_change_mtu(struct net_device *dev, int new_mtu)
229 struct uml_net_private *lp = dev->priv;
230 int err = 0;
232 spin_lock(&lp->lock);
234 new_mtu = (*lp->set_mtu)(new_mtu, &lp->user);
235 if(new_mtu < 0){
236 err = new_mtu;
237 goto out;
240 dev->mtu = new_mtu;
242 out:
243 spin_unlock(&lp->lock);
244 return err;
247 static int uml_net_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
249 static const struct ethtool_drvinfo info = {
250 .cmd = ETHTOOL_GDRVINFO,
251 .driver = DRIVER_NAME,
252 .version = "42",
254 void *useraddr;
255 u32 ethcmd;
257 switch (cmd) {
258 case SIOCETHTOOL:
259 useraddr = ifr->ifr_data;
260 if (copy_from_user(&ethcmd, useraddr, sizeof(ethcmd)))
261 return -EFAULT;
262 switch (ethcmd) {
263 case ETHTOOL_GDRVINFO:
264 if (copy_to_user(useraddr, &info, sizeof(info)))
265 return -EFAULT;
266 return 0;
267 default:
268 return -EOPNOTSUPP;
270 default:
271 return -EINVAL;
275 void uml_net_user_timer_expire(unsigned long _conn)
277 #ifdef undef
278 struct connection *conn = (struct connection *)_conn;
280 dprintk(KERN_INFO "uml_net_user_timer_expire [%p]\n", conn);
281 do_connect(conn);
282 #endif
285 static DEFINE_SPINLOCK(devices_lock);
286 static struct list_head devices = LIST_HEAD_INIT(devices);
288 static struct device_driver uml_net_driver = {
289 .name = DRIVER_NAME,
290 .bus = &platform_bus_type,
292 static int driver_registered;
294 static int eth_configure(int n, void *init, char *mac,
295 struct transport *transport)
297 struct uml_net *device;
298 struct net_device *dev;
299 struct uml_net_private *lp;
300 int save, err, size;
302 size = transport->private_size + sizeof(struct uml_net_private) +
303 sizeof(((struct uml_net_private *) 0)->user);
305 device = kmalloc(sizeof(*device), GFP_KERNEL);
306 if (device == NULL) {
307 printk(KERN_ERR "eth_configure failed to allocate uml_net\n");
308 return(1);
311 memset(device, 0, sizeof(*device));
312 INIT_LIST_HEAD(&device->list);
313 device->index = n;
315 spin_lock(&devices_lock);
316 list_add(&device->list, &devices);
317 spin_unlock(&devices_lock);
319 if (setup_etheraddr(mac, device->mac))
320 device->have_mac = 1;
322 printk(KERN_INFO "Netdevice %d ", n);
323 if (device->have_mac)
324 printk("(%02x:%02x:%02x:%02x:%02x:%02x) ",
325 device->mac[0], device->mac[1],
326 device->mac[2], device->mac[3],
327 device->mac[4], device->mac[5]);
328 printk(": ");
329 dev = alloc_etherdev(size);
330 if (dev == NULL) {
331 printk(KERN_ERR "eth_configure: failed to allocate device\n");
332 return 1;
335 /* sysfs register */
336 if (!driver_registered) {
337 driver_register(&uml_net_driver);
338 driver_registered = 1;
340 device->pdev.id = n;
341 device->pdev.name = DRIVER_NAME;
342 platform_device_register(&device->pdev);
343 SET_NETDEV_DEV(dev,&device->pdev.dev);
345 /* If this name ends up conflicting with an existing registered
346 * netdevice, that is OK, register_netdev{,ice}() will notice this
347 * and fail.
349 snprintf(dev->name, sizeof(dev->name), "eth%d", n);
350 device->dev = dev;
352 (*transport->kern->init)(dev, init);
354 dev->mtu = transport->user->max_packet;
355 dev->open = uml_net_open;
356 dev->hard_start_xmit = uml_net_start_xmit;
357 dev->stop = uml_net_close;
358 dev->get_stats = uml_net_get_stats;
359 dev->set_multicast_list = uml_net_set_multicast_list;
360 dev->tx_timeout = uml_net_tx_timeout;
361 dev->set_mac_address = uml_net_set_mac;
362 dev->change_mtu = uml_net_change_mtu;
363 dev->do_ioctl = uml_net_ioctl;
364 dev->watchdog_timeo = (HZ >> 1);
365 dev->irq = UM_ETH_IRQ;
367 rtnl_lock();
368 err = register_netdevice(dev);
369 rtnl_unlock();
370 if (err) {
371 device->dev = NULL;
372 /* XXX: should we call ->remove() here? */
373 free_netdev(dev);
374 return 1;
376 lp = dev->priv;
378 /* lp.user is the first four bytes of the transport data, which
379 * has already been initialized. This structure assignment will
380 * overwrite that, so we make sure that .user gets overwritten with
381 * what it already has.
383 save = lp->user[0];
384 *lp = ((struct uml_net_private)
385 { .list = LIST_HEAD_INIT(lp->list),
386 .dev = dev,
387 .fd = -1,
388 .mac = { 0xfe, 0xfd, 0x0, 0x0, 0x0, 0x0},
389 .have_mac = device->have_mac,
390 .protocol = transport->kern->protocol,
391 .open = transport->user->open,
392 .close = transport->user->close,
393 .remove = transport->user->remove,
394 .read = transport->kern->read,
395 .write = transport->kern->write,
396 .add_address = transport->user->add_address,
397 .delete_address = transport->user->delete_address,
398 .set_mtu = transport->user->set_mtu,
399 .user = { save } });
401 init_timer(&lp->tl);
402 spin_lock_init(&lp->lock);
403 lp->tl.function = uml_net_user_timer_expire;
404 if (lp->have_mac)
405 memcpy(lp->mac, device->mac, sizeof(lp->mac));
407 if (transport->user->init)
408 (*transport->user->init)(&lp->user, dev);
410 if (device->have_mac)
411 set_ether_mac(dev, device->mac);
413 spin_lock(&opened_lock);
414 list_add(&lp->list, &opened);
415 spin_unlock(&opened_lock);
417 return(0);
420 static struct uml_net *find_device(int n)
422 struct uml_net *device;
423 struct list_head *ele;
425 spin_lock(&devices_lock);
426 list_for_each(ele, &devices){
427 device = list_entry(ele, struct uml_net, list);
428 if(device->index == n)
429 goto out;
431 device = NULL;
432 out:
433 spin_unlock(&devices_lock);
434 return(device);
437 static int eth_parse(char *str, int *index_out, char **str_out)
439 char *end;
440 int n;
442 n = simple_strtoul(str, &end, 0);
443 if(end == str){
444 printk(KERN_ERR "eth_setup: Failed to parse '%s'\n", str);
445 return(1);
447 if(n < 0){
448 printk(KERN_ERR "eth_setup: device %d is negative\n", n);
449 return(1);
451 str = end;
452 if(*str != '='){
453 printk(KERN_ERR
454 "eth_setup: expected '=' after device number\n");
455 return(1);
457 str++;
458 if(find_device(n)){
459 printk(KERN_ERR "eth_setup: Device %d already configured\n",
461 return(1);
463 if(index_out) *index_out = n;
464 *str_out = str;
465 return(0);
468 struct eth_init {
469 struct list_head list;
470 char *init;
471 int index;
474 /* Filled in at boot time. Will need locking if the transports become
475 * modular.
477 struct list_head transports = LIST_HEAD_INIT(transports);
479 /* Filled in during early boot */
480 struct list_head eth_cmd_line = LIST_HEAD_INIT(eth_cmd_line);
482 static int check_transport(struct transport *transport, char *eth, int n,
483 void **init_out, char **mac_out)
485 int len;
487 len = strlen(transport->name);
488 if(strncmp(eth, transport->name, len))
489 return(0);
491 eth += len;
492 if(*eth == ',')
493 eth++;
494 else if(*eth != '\0')
495 return(0);
497 *init_out = kmalloc(transport->setup_size, GFP_KERNEL);
498 if(*init_out == NULL)
499 return(1);
501 if(!transport->setup(eth, mac_out, *init_out)){
502 kfree(*init_out);
503 *init_out = NULL;
505 return(1);
508 void register_transport(struct transport *new)
510 struct list_head *ele, *next;
511 struct eth_init *eth;
512 void *init;
513 char *mac = NULL;
514 int match;
516 list_add(&new->list, &transports);
518 list_for_each_safe(ele, next, &eth_cmd_line){
519 eth = list_entry(ele, struct eth_init, list);
520 match = check_transport(new, eth->init, eth->index, &init,
521 &mac);
522 if(!match)
523 continue;
524 else if(init != NULL){
525 eth_configure(eth->index, init, mac, new);
526 kfree(init);
528 list_del(&eth->list);
532 static int eth_setup_common(char *str, int index)
534 struct list_head *ele;
535 struct transport *transport;
536 void *init;
537 char *mac = NULL;
539 list_for_each(ele, &transports){
540 transport = list_entry(ele, struct transport, list);
541 if(!check_transport(transport, str, index, &init, &mac))
542 continue;
543 if(init != NULL){
544 eth_configure(index, init, mac, transport);
545 kfree(init);
547 return(1);
549 return(0);
552 static int eth_setup(char *str)
554 struct eth_init *new;
555 int n, err;
557 err = eth_parse(str, &n, &str);
558 if(err) return(1);
560 new = alloc_bootmem(sizeof(new));
561 if (new == NULL){
562 printk("eth_init : alloc_bootmem failed\n");
563 return(1);
566 INIT_LIST_HEAD(&new->list);
567 new->index = n;
568 new->init = str;
570 list_add_tail(&new->list, &eth_cmd_line);
571 return(1);
574 __setup("eth", eth_setup);
575 __uml_help(eth_setup,
576 "eth[0-9]+=<transport>,<options>\n"
577 " Configure a network device.\n\n"
580 #if 0
581 static int eth_init(void)
583 struct list_head *ele, *next;
584 struct eth_init *eth;
586 list_for_each_safe(ele, next, &eth_cmd_line){
587 eth = list_entry(ele, struct eth_init, list);
589 if(eth_setup_common(eth->init, eth->index))
590 list_del(&eth->list);
593 return(1);
595 __initcall(eth_init);
596 #endif
598 static int net_config(char *str)
600 int n, err;
602 err = eth_parse(str, &n, &str);
603 if(err) return(err);
605 str = uml_strdup(str);
606 if(str == NULL){
607 printk(KERN_ERR "net_config failed to strdup string\n");
608 return(-1);
610 err = !eth_setup_common(str, n);
611 if(err)
612 kfree(str);
613 return(err);
616 static int net_remove(char *str)
618 struct uml_net *device;
619 struct net_device *dev;
620 struct uml_net_private *lp;
621 char *end;
622 int n;
624 n = simple_strtoul(str, &end, 0);
625 if((*end != '\0') || (end == str))
626 return(-1);
628 device = find_device(n);
629 if(device == NULL)
630 return(0);
632 dev = device->dev;
633 lp = dev->priv;
634 if(lp->fd > 0) return(-1);
635 if(lp->remove != NULL) (*lp->remove)(&lp->user);
636 unregister_netdev(dev);
637 platform_device_unregister(&device->pdev);
639 list_del(&device->list);
640 kfree(device);
641 free_netdev(dev);
642 return(0);
645 static struct mc_device net_mc = {
646 .name = "eth",
647 .config = net_config,
648 .get_config = NULL,
649 .remove = net_remove,
652 static int uml_inetaddr_event(struct notifier_block *this, unsigned long event,
653 void *ptr)
655 struct in_ifaddr *ifa = ptr;
656 u32 addr = ifa->ifa_address;
657 u32 netmask = ifa->ifa_mask;
658 struct net_device *dev = ifa->ifa_dev->dev;
659 struct uml_net_private *lp;
660 void (*proc)(unsigned char *, unsigned char *, void *);
661 unsigned char addr_buf[4], netmask_buf[4];
663 if(dev->open != uml_net_open) return(NOTIFY_DONE);
665 lp = dev->priv;
667 proc = NULL;
668 switch (event){
669 case NETDEV_UP:
670 proc = lp->add_address;
671 break;
672 case NETDEV_DOWN:
673 proc = lp->delete_address;
674 break;
676 if(proc != NULL){
677 addr_buf[0] = addr & 0xff;
678 addr_buf[1] = (addr >> 8) & 0xff;
679 addr_buf[2] = (addr >> 16) & 0xff;
680 addr_buf[3] = addr >> 24;
681 netmask_buf[0] = netmask & 0xff;
682 netmask_buf[1] = (netmask >> 8) & 0xff;
683 netmask_buf[2] = (netmask >> 16) & 0xff;
684 netmask_buf[3] = netmask >> 24;
685 (*proc)(addr_buf, netmask_buf, &lp->user);
687 return(NOTIFY_DONE);
690 struct notifier_block uml_inetaddr_notifier = {
691 .notifier_call = uml_inetaddr_event,
694 static int uml_net_init(void)
696 struct list_head *ele;
697 struct uml_net_private *lp;
698 struct in_device *ip;
699 struct in_ifaddr *in;
701 mconsole_register_dev(&net_mc);
702 register_inetaddr_notifier(&uml_inetaddr_notifier);
704 /* Devices may have been opened already, so the uml_inetaddr_notifier
705 * didn't get a chance to run for them. This fakes it so that
706 * addresses which have already been set up get handled properly.
708 list_for_each(ele, &opened){
709 lp = list_entry(ele, struct uml_net_private, list);
710 ip = lp->dev->ip_ptr;
711 if(ip == NULL) continue;
712 in = ip->ifa_list;
713 while(in != NULL){
714 uml_inetaddr_event(NULL, NETDEV_UP, in);
715 in = in->ifa_next;
719 return(0);
722 __initcall(uml_net_init);
724 static void close_devices(void)
726 struct list_head *ele;
727 struct uml_net_private *lp;
729 list_for_each(ele, &opened){
730 lp = list_entry(ele, struct uml_net_private, list);
731 if((lp->close != NULL) && (lp->fd >= 0))
732 (*lp->close)(lp->fd, &lp->user);
733 if(lp->remove != NULL) (*lp->remove)(&lp->user);
737 __uml_exitcall(close_devices);
739 int setup_etheraddr(char *str, unsigned char *addr)
741 char *end;
742 int i;
744 if(str == NULL)
745 return(0);
746 for(i=0;i<6;i++){
747 addr[i] = simple_strtoul(str, &end, 16);
748 if((end == str) ||
749 ((*end != ':') && (*end != ',') && (*end != '\0'))){
750 printk(KERN_ERR
751 "setup_etheraddr: failed to parse '%s' "
752 "as an ethernet address\n", str);
753 return(0);
755 str = end + 1;
757 if(addr[0] & 1){
758 printk(KERN_ERR
759 "Attempt to assign a broadcast ethernet address to a "
760 "device disallowed\n");
761 return(0);
763 return(1);
766 void dev_ip_addr(void *d, char *buf, char *bin_buf)
768 struct net_device *dev = d;
769 struct in_device *ip = dev->ip_ptr;
770 struct in_ifaddr *in;
771 u32 addr;
773 if((ip == NULL) || ((in = ip->ifa_list) == NULL)){
774 printk(KERN_WARNING "dev_ip_addr - device not assigned an "
775 "IP address\n");
776 return;
778 addr = in->ifa_address;
779 sprintf(buf, "%d.%d.%d.%d", addr & 0xff, (addr >> 8) & 0xff,
780 (addr >> 16) & 0xff, addr >> 24);
781 if(bin_buf){
782 bin_buf[0] = addr & 0xff;
783 bin_buf[1] = (addr >> 8) & 0xff;
784 bin_buf[2] = (addr >> 16) & 0xff;
785 bin_buf[3] = addr >> 24;
789 void set_ether_mac(void *d, unsigned char *addr)
791 struct net_device *dev = d;
793 memcpy(dev->dev_addr, addr, ETH_ALEN);
796 struct sk_buff *ether_adjust_skb(struct sk_buff *skb, int extra)
798 if((skb != NULL) && (skb_tailroom(skb) < extra)){
799 struct sk_buff *skb2;
801 skb2 = skb_copy_expand(skb, 0, extra, GFP_ATOMIC);
802 dev_kfree_skb(skb);
803 skb = skb2;
805 if(skb != NULL) skb_put(skb, extra);
806 return(skb);
809 void iter_addresses(void *d, void (*cb)(unsigned char *, unsigned char *,
810 void *),
811 void *arg)
813 struct net_device *dev = d;
814 struct in_device *ip = dev->ip_ptr;
815 struct in_ifaddr *in;
816 unsigned char address[4], netmask[4];
818 if(ip == NULL) return;
819 in = ip->ifa_list;
820 while(in != NULL){
821 address[0] = in->ifa_address & 0xff;
822 address[1] = (in->ifa_address >> 8) & 0xff;
823 address[2] = (in->ifa_address >> 16) & 0xff;
824 address[3] = in->ifa_address >> 24;
825 netmask[0] = in->ifa_mask & 0xff;
826 netmask[1] = (in->ifa_mask >> 8) & 0xff;
827 netmask[2] = (in->ifa_mask >> 16) & 0xff;
828 netmask[3] = in->ifa_mask >> 24;
829 (*cb)(address, netmask, arg);
830 in = in->ifa_next;
834 int dev_netmask(void *d, void *m)
836 struct net_device *dev = d;
837 struct in_device *ip = dev->ip_ptr;
838 struct in_ifaddr *in;
839 __u32 *mask_out = m;
841 if(ip == NULL)
842 return(1);
844 in = ip->ifa_list;
845 if(in == NULL)
846 return(1);
848 *mask_out = in->ifa_mask;
849 return(0);
852 void *get_output_buffer(int *len_out)
854 void *ret;
856 ret = (void *) __get_free_pages(GFP_KERNEL, 0);
857 if(ret) *len_out = PAGE_SIZE;
858 else *len_out = 0;
859 return(ret);
862 void free_output_buffer(void *buffer)
864 free_pages((unsigned long) buffer, 0);
867 int tap_setup_common(char *str, char *type, char **dev_name, char **mac_out,
868 char **gate_addr)
870 char *remain;
872 remain = split_if_spec(str, dev_name, mac_out, gate_addr, NULL);
873 if(remain != NULL){
874 printk("tap_setup_common - Extra garbage on specification : "
875 "'%s'\n", remain);
876 return(1);
879 return(0);
882 unsigned short eth_protocol(struct sk_buff *skb)
884 return(eth_type_trans(skb, skb->dev));
888 * Overrides for Emacs so that we follow Linus's tabbing style.
889 * Emacs will notice this stuff at the end of the file and automatically
890 * adjust the settings for this buffer only. This must remain at the end
891 * of the file.
892 * ---------------------------------------------------------------------------
893 * Local variables:
894 * c-file-style: "linux"
895 * End: