aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/slip.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/slip.c')
-rw-r--r--drivers/net/slip.c33
1 files changed, 16 insertions, 17 deletions
diff --git a/drivers/net/slip.c b/drivers/net/slip.c
index b2e18d28850d..39c2152a07f4 100644
--- a/drivers/net/slip.c
+++ b/drivers/net/slip.c
@@ -55,7 +55,6 @@
55 */ 55 */
56 56
57#define SL_CHECK_TRANSMIT 57#define SL_CHECK_TRANSMIT
58#include <linux/config.h>
59#include <linux/module.h> 58#include <linux/module.h>
60#include <linux/moduleparam.h> 59#include <linux/moduleparam.h>
61 60
@@ -114,7 +113,7 @@ static int sl_ioctl(struct net_device *dev,struct ifreq *rq,int cmd);
114* on actively running device. 113* on actively running device.
115*********************************/ 114*********************************/
116 115
117/* 116/*
118 Allocate channel buffers. 117 Allocate channel buffers.
119 */ 118 */
120 119
@@ -208,7 +207,7 @@ sl_free_bufs(struct slip *sl)
208#endif 207#endif
209} 208}
210 209
211/* 210/*
212 Reallocate slip channel buffers. 211 Reallocate slip channel buffers.
213 */ 212 */
214 213
@@ -355,7 +354,7 @@ sl_bump(struct slip *sl)
355#endif /* SL_INCLUDE_CSLIP */ 354#endif /* SL_INCLUDE_CSLIP */
356 355
357 sl->rx_bytes+=count; 356 sl->rx_bytes+=count;
358 357
359 skb = dev_alloc_skb(count); 358 skb = dev_alloc_skb(count);
360 if (skb == NULL) { 359 if (skb == NULL) {
361 printk(KERN_WARNING "%s: memory squeeze, dropping packet.\n", sl->dev->name); 360 printk(KERN_WARNING "%s: memory squeeze, dropping packet.\n", sl->dev->name);
@@ -603,7 +602,7 @@ static int sl_init(struct net_device *dev)
603 struct slip *sl = netdev_priv(dev); 602 struct slip *sl = netdev_priv(dev);
604 603
605 /* 604 /*
606 * Finish setting up the DEVICE info. 605 * Finish setting up the DEVICE info.
607 */ 606 */
608 607
609 dev->mtu = sl->mtu; 608 dev->mtu = sl->mtu;
@@ -659,7 +658,7 @@ static void sl_setup(struct net_device *dev)
659 * be re-entered while running but other ldisc functions may be called 658 * be re-entered while running but other ldisc functions may be called
660 * in parallel 659 * in parallel
661 */ 660 */
662 661
663static void slip_receive_buf(struct tty_struct *tty, const unsigned char *cp, char *fp, int count) 662static void slip_receive_buf(struct tty_struct *tty, const unsigned char *cp, char *fp, int count)
664{ 663{
665 struct slip *sl = (struct slip *) tty->disc_data; 664 struct slip *sl = (struct slip *) tty->disc_data;
@@ -721,7 +720,7 @@ sl_alloc(dev_t line)
721 struct net_device *dev = NULL; 720 struct net_device *dev = NULL;
722 struct slip *sl; 721 struct slip *sl;
723 722
724 if (slip_devs == NULL) 723 if (slip_devs == NULL)
725 return NULL; /* Master array missing ! */ 724 return NULL; /* Master array missing ! */
726 725
727 for (i = 0; i < slip_maxdev; i++) { 726 for (i = 0; i < slip_maxdev; i++) {
@@ -789,7 +788,7 @@ sl_alloc(dev_t line)
789 slip_devs[i] = NULL; 788 slip_devs[i] = NULL;
790 } 789 }
791 } 790 }
792 791
793 if (!dev) { 792 if (!dev) {
794 char name[IFNAMSIZ]; 793 char name[IFNAMSIZ];
795 sprintf(name, "sl%d", i); 794 sprintf(name, "sl%d", i);
@@ -816,7 +815,7 @@ sl_alloc(dev_t line)
816 sl->outfill_timer.function=sl_outfill; 815 sl->outfill_timer.function=sl_outfill;
817#endif 816#endif
818 slip_devs[i] = dev; 817 slip_devs[i] = dev;
819 818
820 return sl; 819 return sl;
821} 820}
822 821
@@ -837,7 +836,7 @@ static int slip_open(struct tty_struct *tty)
837 836
838 if(!capable(CAP_NET_ADMIN)) 837 if(!capable(CAP_NET_ADMIN))
839 return -EPERM; 838 return -EPERM;
840 839
841 /* RTnetlink lock is misused here to serialize concurrent 840 /* RTnetlink lock is misused here to serialize concurrent
842 opens of slip channels. There are better ways, but it is 841 opens of slip channels. There are better ways, but it is
843 the simplest one. 842 the simplest one.
@@ -863,7 +862,7 @@ static int slip_open(struct tty_struct *tty)
863 tty->disc_data = sl; 862 tty->disc_data = sl;
864 sl->line = tty_devnum(tty); 863 sl->line = tty_devnum(tty);
865 sl->pid = current->pid; 864 sl->pid = current->pid;
866 865
867 if (!test_bit(SLF_INUSE, &sl->flags)) { 866 if (!test_bit(SLF_INUSE, &sl->flags)) {
868 /* Perform the low-level SLIP initialization. */ 867 /* Perform the low-level SLIP initialization. */
869 if ((err = sl_alloc_bufs(sl, SL_MTU)) != 0) 868 if ((err = sl_alloc_bufs(sl, SL_MTU)) != 0)
@@ -909,7 +908,7 @@ err_exit:
909/* 908/*
910 909
911 FIXME: 1,2 are fixed 3 was never true anyway. 910 FIXME: 1,2 are fixed 3 was never true anyway.
912 911
913 Let me to blame a bit. 912 Let me to blame a bit.
914 1. TTY module calls this funstion on soft interrupt. 913 1. TTY module calls this funstion on soft interrupt.
915 2. TTY module calls this function WITH MASKED INTERRUPTS! 914 2. TTY module calls this function WITH MASKED INTERRUPTS!
@@ -921,7 +920,7 @@ err_exit:
921 920
922 By-product (not desired): sl? does not feel hangups and remains open. 921 By-product (not desired): sl? does not feel hangups and remains open.
923 It is supposed, that user level program (dip, diald, slattach...) 922 It is supposed, that user level program (dip, diald, slattach...)
924 will catch SIGHUP and make the rest of work. 923 will catch SIGHUP and make the rest of work.
925 924
926 I see no way to make more with current tty code. --ANK 925 I see no way to make more with current tty code. --ANK
927 */ 926 */
@@ -1292,7 +1291,7 @@ static int sl_ioctl(struct net_device *dev,struct ifreq *rq,int cmd)
1292 break; 1291 break;
1293 1292
1294 case SIOCSLEASE: 1293 case SIOCSLEASE:
1295 /* Resolve race condition, when ioctl'ing hanged up 1294 /* Resolve race condition, when ioctl'ing hanged up
1296 and opened by another process device. 1295 and opened by another process device.
1297 */ 1296 */
1298 if (sl->tty != current->signal->tty && sl->pid != current->pid) { 1297 if (sl->tty != current->signal->tty && sl->pid != current->pid) {
@@ -1351,7 +1350,7 @@ static int __init slip_init(void)
1351 } 1350 }
1352 1351
1353 /* Clear the pointer array, we allocate devices when we need them */ 1352 /* Clear the pointer array, we allocate devices when we need them */
1354 memset(slip_devs, 0, sizeof(struct net_device *)*slip_maxdev); 1353 memset(slip_devs, 0, sizeof(struct net_device *)*slip_maxdev);
1355 1354
1356 /* Fill in our line protocol discipline, and register it */ 1355 /* Fill in our line protocol discipline, and register it */
1357 if ((status = tty_register_ldisc(N_SLIP, &sl_ldisc)) != 0) { 1356 if ((status = tty_register_ldisc(N_SLIP, &sl_ldisc)) != 0) {
@@ -1369,7 +1368,7 @@ static void __exit slip_exit(void)
1369 unsigned long timeout = jiffies + HZ; 1368 unsigned long timeout = jiffies + HZ;
1370 int busy = 0; 1369 int busy = 0;
1371 1370
1372 if (slip_devs == NULL) 1371 if (slip_devs == NULL)
1373 return; 1372 return;
1374 1373
1375 /* First of all: check for active disciplines and hangup them. 1374 /* First of all: check for active disciplines and hangup them.
@@ -1406,7 +1405,7 @@ static void __exit slip_exit(void)
1406 dev->name); 1405 dev->name);
1407 /* Intentionally leak the control block. */ 1406 /* Intentionally leak the control block. */
1408 dev->destructor = NULL; 1407 dev->destructor = NULL;
1409 } 1408 }
1410 1409
1411 unregister_netdev(dev); 1410 unregister_netdev(dev);
1412 } 1411 }