diff options
author | YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org> | 2007-02-09 09:25:25 -0500 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-02-11 02:20:20 -0500 |
commit | 4ba6122b4e0537858e8579716896f01acf55f745 (patch) | |
tree | 3527b20fd48769cd481671b382772053b3d1f704 | |
parent | ac7bfa62f3ad06a2a2ac3938b7e6fc4f318a762d (diff) |
[NET] WANROUTER: Fix whitespace errors.
Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | net/wanrouter/af_wanpipe.c | 514 | ||||
-rw-r--r-- | net/wanrouter/wanmain.c | 18 | ||||
-rw-r--r-- | net/wanrouter/wanproc.c | 4 |
3 files changed, 268 insertions, 268 deletions
diff --git a/net/wanrouter/af_wanpipe.c b/net/wanrouter/af_wanpipe.c index c2059733e15a..41d7e32be70d 100644 --- a/net/wanrouter/af_wanpipe.c +++ b/net/wanrouter/af_wanpipe.c | |||
@@ -11,11 +11,11 @@ | |||
11 | * 2 of the License, or (at your option) any later version. | 11 | * 2 of the License, or (at your option) any later version. |
12 | * ============================================================================ | 12 | * ============================================================================ |
13 | * Due Credit: | 13 | * Due Credit: |
14 | * Wanpipe socket layer is based on Packet and | 14 | * Wanpipe socket layer is based on Packet and |
15 | * the X25 socket layers. The above sockets were | 15 | * the X25 socket layers. The above sockets were |
16 | * used for the specific use of Sangoma Technologies | 16 | * used for the specific use of Sangoma Technologies |
17 | * API programs. | 17 | * API programs. |
18 | * Packet socket Authors: Ross Biro, Fred N. van Kempen and | 18 | * Packet socket Authors: Ross Biro, Fred N. van Kempen and |
19 | * Alan Cox. | 19 | * Alan Cox. |
20 | * X25 socket Author: Jonathan Naylor. | 20 | * X25 socket Author: Jonathan Naylor. |
21 | * ============================================================================ | 21 | * ============================================================================ |
@@ -28,7 +28,7 @@ | |||
28 | * Feb 29, 2000 Nenad Corbic o Added support for PVC protocols, such as | 28 | * Feb 29, 2000 Nenad Corbic o Added support for PVC protocols, such as |
29 | * CHDLC, Frame Relay and HDLC API. | 29 | * CHDLC, Frame Relay and HDLC API. |
30 | * Jan 17, 2000 Nenad Corbic o Initial version, based on AF_PACKET socket. | 30 | * Jan 17, 2000 Nenad Corbic o Initial version, based on AF_PACKET socket. |
31 | * X25API support only. | 31 | * X25API support only. |
32 | * | 32 | * |
33 | ******************************************************************************/ | 33 | ******************************************************************************/ |
34 | 34 | ||
@@ -71,33 +71,33 @@ | |||
71 | #define DBG_PRINTK(format, a...) printk(format, ## a) | 71 | #define DBG_PRINTK(format, a...) printk(format, ## a) |
72 | #else | 72 | #else |
73 | #define DBG_PRINTK(format, a...) | 73 | #define DBG_PRINTK(format, a...) |
74 | #endif | 74 | #endif |
75 | 75 | ||
76 | 76 | ||
77 | /* SECURE SOCKET IMPLEMENTATION | 77 | /* SECURE SOCKET IMPLEMENTATION |
78 | * | 78 | * |
79 | * TRANSMIT: | 79 | * TRANSMIT: |
80 | * | 80 | * |
81 | * When the user sends a packet via send() system call | 81 | * When the user sends a packet via send() system call |
82 | * the wanpipe_sendmsg() function is executed. | 82 | * the wanpipe_sendmsg() function is executed. |
83 | * | 83 | * |
84 | * Each packet is enqueud into sk->sk_write_queue transmit | 84 | * Each packet is enqueud into sk->sk_write_queue transmit |
85 | * queue. When the packet is enqueued, a delayed transmit | 85 | * queue. When the packet is enqueued, a delayed transmit |
86 | * timer is triggerd which acts as a Bottom Half hander. | 86 | * timer is triggerd which acts as a Bottom Half hander. |
87 | * | 87 | * |
88 | * wanpipe_delay_transmit() function (BH), dequeues packets | 88 | * wanpipe_delay_transmit() function (BH), dequeues packets |
89 | * from the sk->sk_write_queue transmit queue and sends it | 89 | * from the sk->sk_write_queue transmit queue and sends it |
90 | * to the deriver via dev->hard_start_xmit(skb, dev) function. | 90 | * to the deriver via dev->hard_start_xmit(skb, dev) function. |
91 | * Note, this function is actual a function pointer of if_send() | 91 | * Note, this function is actual a function pointer of if_send() |
92 | * routine in the wanpipe driver. | 92 | * routine in the wanpipe driver. |
93 | * | 93 | * |
94 | * X25API GUARANTEED DELIVERY: | 94 | * X25API GUARANTEED DELIVERY: |
95 | * | 95 | * |
96 | * In order to provide 100% guaranteed packet delivery, | 96 | * In order to provide 100% guaranteed packet delivery, |
97 | * an atomic 'packet_sent' counter is implemented. Counter | 97 | * an atomic 'packet_sent' counter is implemented. Counter |
98 | * is incremented for each packet enqueued | 98 | * is incremented for each packet enqueued |
99 | * into sk->sk_write_queue. Counter is decremented each | 99 | * into sk->sk_write_queue. Counter is decremented each |
100 | * time wanpipe_delayed_transmit() function successfuly | 100 | * time wanpipe_delayed_transmit() function successfuly |
101 | * passes the packet to the driver. Before each send(), a poll | 101 | * passes the packet to the driver. Before each send(), a poll |
102 | * routine checks the sock resources The maximum value of | 102 | * routine checks the sock resources The maximum value of |
103 | * packet sent counter is 1, thus if one packet is queued, the | 103 | * packet sent counter is 1, thus if one packet is queued, the |
@@ -110,11 +110,11 @@ | |||
110 | * function, wanpipe_rcv() to queue the incoming packets | 110 | * function, wanpipe_rcv() to queue the incoming packets |
111 | * into an AF_WANPIPE socket queue. Based on wanpipe_rcv() | 111 | * into an AF_WANPIPE socket queue. Based on wanpipe_rcv() |
112 | * return code, the driver knows whether the packet was | 112 | * return code, the driver knows whether the packet was |
113 | * successfully queued. If the socket queue is full, | 113 | * successfully queued. If the socket queue is full, |
114 | * protocol flow control is used by the driver, if any, | 114 | * protocol flow control is used by the driver, if any, |
115 | * to slow down the traffic until the sock queue is free. | 115 | * to slow down the traffic until the sock queue is free. |
116 | * | 116 | * |
117 | * Every time a packet arrives into a socket queue the | 117 | * Every time a packet arrives into a socket queue the |
118 | * socket wakes up processes which are waiting to receive | 118 | * socket wakes up processes which are waiting to receive |
119 | * data. | 119 | * data. |
120 | * | 120 | * |
@@ -122,12 +122,12 @@ | |||
122 | * bit which signals the socket to kick the wanpipe driver | 122 | * bit which signals the socket to kick the wanpipe driver |
123 | * bottom half hander when the socket queue is partialy | 123 | * bottom half hander when the socket queue is partialy |
124 | * empty. wanpipe_recvmsg() function performs this action. | 124 | * empty. wanpipe_recvmsg() function performs this action. |
125 | * | 125 | * |
126 | * In case of x25api, packets will never be dropped, since | 126 | * In case of x25api, packets will never be dropped, since |
127 | * flow control is available. | 127 | * flow control is available. |
128 | * | 128 | * |
129 | * In case of streaming protocols like CHDLC, packets will | 129 | * In case of streaming protocols like CHDLC, packets will |
130 | * be dropped but the statistics will be generated. | 130 | * be dropped but the statistics will be generated. |
131 | */ | 131 | */ |
132 | 132 | ||
133 | 133 | ||
@@ -170,11 +170,11 @@ struct wanpipe_opt | |||
170 | struct net_device *dev; /* Bounded device */ | 170 | struct net_device *dev; /* Bounded device */ |
171 | unsigned short lcn; /* Binded LCN */ | 171 | unsigned short lcn; /* Binded LCN */ |
172 | unsigned char svc; /* 0=pvc, 1=svc */ | 172 | unsigned char svc; /* 0=pvc, 1=svc */ |
173 | unsigned char timer; /* flag for delayed transmit*/ | 173 | unsigned char timer; /* flag for delayed transmit*/ |
174 | struct timer_list tx_timer; | 174 | struct timer_list tx_timer; |
175 | unsigned poll_cnt; | 175 | unsigned poll_cnt; |
176 | unsigned char force; /* Used to force sock release */ | 176 | unsigned char force; /* Used to force sock release */ |
177 | atomic_t packet_sent; | 177 | atomic_t packet_sent; |
178 | }; | 178 | }; |
179 | #endif | 179 | #endif |
180 | 180 | ||
@@ -215,8 +215,8 @@ static int check_driver_busy (struct sock *); | |||
215 | * | 215 | * |
216 | * Wanpipe socket bottom half handler. This function | 216 | * Wanpipe socket bottom half handler. This function |
217 | * is called by the WANPIPE device drivers to queue a | 217 | * is called by the WANPIPE device drivers to queue a |
218 | * incoming packet into the socket receive queue. | 218 | * incoming packet into the socket receive queue. |
219 | * Once the packet is queued, all processes waiting to | 219 | * Once the packet is queued, all processes waiting to |
220 | * read are woken up. | 220 | * read are woken up. |
221 | * | 221 | * |
222 | * During socket bind, this function is bounded into | 222 | * During socket bind, this function is bounded into |
@@ -245,13 +245,13 @@ static int wanpipe_rcv(struct sk_buff *skb, struct net_device *dev, | |||
245 | if (dev->hard_header_parse) | 245 | if (dev->hard_header_parse) |
246 | sll->sll_halen = dev->hard_header_parse(skb, sll->sll_addr); | 246 | sll->sll_halen = dev->hard_header_parse(skb, sll->sll_addr); |
247 | 247 | ||
248 | /* | 248 | /* |
249 | * WAN_PACKET_DATA : Data which should be passed up the receive queue. | 249 | * WAN_PACKET_DATA : Data which should be passed up the receive queue. |
250 | * WAN_PACKET_ASYC : Asynchronous data like place call, which should | 250 | * WAN_PACKET_ASYC : Asynchronous data like place call, which should |
251 | * be passed up the listening sock. | 251 | * be passed up the listening sock. |
252 | * WAN_PACKET_ERR : Asynchronous data like clear call or restart | 252 | * WAN_PACKET_ERR : Asynchronous data like clear call or restart |
253 | * which should go into an error queue. | 253 | * which should go into an error queue. |
254 | */ | 254 | */ |
255 | switch (skb->pkt_type){ | 255 | switch (skb->pkt_type){ |
256 | 256 | ||
257 | case WAN_PACKET_DATA: | 257 | case WAN_PACKET_DATA: |
@@ -261,10 +261,10 @@ static int wanpipe_rcv(struct sk_buff *skb, struct net_device *dev, | |||
261 | break; | 261 | break; |
262 | case WAN_PACKET_CMD: | 262 | case WAN_PACKET_CMD: |
263 | sk->sk_state = chan->state; | 263 | sk->sk_state = chan->state; |
264 | /* Bug fix: update Mar6. | 264 | /* Bug fix: update Mar6. |
265 | * Do not set the sock lcn number here, since | 265 | * Do not set the sock lcn number here, since |
266 | * cmd is not guaranteed to be executed on the | 266 | * cmd is not guaranteed to be executed on the |
267 | * board, thus Lcn could be wrong */ | 267 | * board, thus Lcn could be wrong */ |
268 | sk->sk_data_ready(sk, skb->len); | 268 | sk->sk_data_ready(sk, skb->len); |
269 | kfree_skb(skb); | 269 | kfree_skb(skb); |
270 | break; | 270 | break; |
@@ -276,7 +276,7 @@ static int wanpipe_rcv(struct sk_buff *skb, struct net_device *dev, | |||
276 | break; | 276 | break; |
277 | default: | 277 | default: |
278 | printk(KERN_INFO "wansock: BH Illegal Packet Type Dropping\n"); | 278 | printk(KERN_INFO "wansock: BH Illegal Packet Type Dropping\n"); |
279 | kfree_skb(skb); | 279 | kfree_skb(skb); |
280 | break; | 280 | break; |
281 | } | 281 | } |
282 | 282 | ||
@@ -297,20 +297,20 @@ static int wanpipe_rcv(struct sk_buff *skb, struct net_device *dev, | |||
297 | * | 297 | * |
298 | * Wanpipe LISTEN socket bottom half handler. This function | 298 | * Wanpipe LISTEN socket bottom half handler. This function |
299 | * is called by the WANPIPE device drivers to queue an | 299 | * is called by the WANPIPE device drivers to queue an |
300 | * incoming call into the socket listening queue. | 300 | * incoming call into the socket listening queue. |
301 | * Once the packet is queued, the waiting accept() process | 301 | * Once the packet is queued, the waiting accept() process |
302 | * is woken up. | 302 | * is woken up. |
303 | * | 303 | * |
304 | * During socket bind, this function is bounded into | 304 | * During socket bind, this function is bounded into |
305 | * WANPIPE driver private. | 305 | * WANPIPE driver private. |
306 | * | 306 | * |
307 | * IMPORTANT NOTE: | 307 | * IMPORTANT NOTE: |
308 | * The accept call() is waiting for an skb packet | 308 | * The accept call() is waiting for an skb packet |
309 | * which contains a pointer to a device structure. | 309 | * which contains a pointer to a device structure. |
310 | * | 310 | * |
311 | * When we do a bind to a device structre, we | 311 | * When we do a bind to a device structre, we |
312 | * bind a newly created socket into "chan->sk". Thus, | 312 | * bind a newly created socket into "chan->sk". Thus, |
313 | * when accept receives the skb packet, it will know | 313 | * when accept receives the skb packet, it will know |
314 | * from which dev it came form, and in turn it will know | 314 | * from which dev it came form, and in turn it will know |
315 | * the address of the new sock. | 315 | * the address of the new sock. |
316 | * | 316 | * |
@@ -322,31 +322,31 @@ static int wanpipe_listen_rcv (struct sk_buff *skb, struct sock *sk) | |||
322 | wanpipe_opt *wp = wp_sk(sk), *newwp; | 322 | wanpipe_opt *wp = wp_sk(sk), *newwp; |
323 | struct wan_sockaddr_ll *sll = (struct wan_sockaddr_ll*)skb->cb; | 323 | struct wan_sockaddr_ll *sll = (struct wan_sockaddr_ll*)skb->cb; |
324 | struct sock *newsk; | 324 | struct sock *newsk; |
325 | struct net_device *dev; | 325 | struct net_device *dev; |
326 | sdla_t *card; | 326 | sdla_t *card; |
327 | mbox_cmd_t *mbox_ptr; | 327 | mbox_cmd_t *mbox_ptr; |
328 | wanpipe_common_t *chan; | 328 | wanpipe_common_t *chan; |
329 | 329 | ||
330 | /* Find a free device, if none found, all svc's are busy | 330 | /* Find a free device, if none found, all svc's are busy |
331 | */ | 331 | */ |
332 | 332 | ||
333 | card = (sdla_t*)wp->card; | 333 | card = (sdla_t*)wp->card; |
334 | if (!card){ | 334 | if (!card){ |
335 | printk(KERN_INFO "wansock: LISTEN ERROR, No Card\n"); | 335 | printk(KERN_INFO "wansock: LISTEN ERROR, No Card\n"); |
336 | return -ENODEV; | 336 | return -ENODEV; |
337 | } | 337 | } |
338 | 338 | ||
339 | dev = wanpipe_find_free_dev(card); | 339 | dev = wanpipe_find_free_dev(card); |
340 | if (!dev){ | 340 | if (!dev){ |
341 | printk(KERN_INFO "wansock: LISTEN ERROR, No Free Device\n"); | 341 | printk(KERN_INFO "wansock: LISTEN ERROR, No Free Device\n"); |
342 | return -ENODEV; | 342 | return -ENODEV; |
343 | } | 343 | } |
344 | 344 | ||
345 | chan=dev->priv; | 345 | chan=dev->priv; |
346 | chan->state = WANSOCK_CONNECTING; | 346 | chan->state = WANSOCK_CONNECTING; |
347 | 347 | ||
348 | /* Allocate a new sock, which accept will bind | 348 | /* Allocate a new sock, which accept will bind |
349 | * and pass up to the user | 349 | * and pass up to the user |
350 | */ | 350 | */ |
351 | if ((newsk = wanpipe_make_new(sk)) == NULL){ | 351 | if ((newsk = wanpipe_make_new(sk)) == NULL){ |
352 | release_device(dev); | 352 | release_device(dev); |
@@ -354,33 +354,33 @@ static int wanpipe_listen_rcv (struct sk_buff *skb, struct sock *sk) | |||
354 | } | 354 | } |
355 | 355 | ||
356 | 356 | ||
357 | /* Initialize the new sock structure | 357 | /* Initialize the new sock structure |
358 | */ | 358 | */ |
359 | newsk->sk_bound_dev_if = dev->ifindex; | 359 | newsk->sk_bound_dev_if = dev->ifindex; |
360 | newwp = wp_sk(newsk); | 360 | newwp = wp_sk(newsk); |
361 | newwp->card = wp->card; | 361 | newwp->card = wp->card; |
362 | 362 | ||
363 | /* Insert the sock into the main wanpipe | 363 | /* Insert the sock into the main wanpipe |
364 | * sock list. | 364 | * sock list. |
365 | */ | 365 | */ |
366 | atomic_inc(&wanpipe_socks_nr); | 366 | atomic_inc(&wanpipe_socks_nr); |
367 | 367 | ||
368 | /* Allocate and fill in the new Mail Box. Then | 368 | /* Allocate and fill in the new Mail Box. Then |
369 | * bind the mail box to the sock. It will be | 369 | * bind the mail box to the sock. It will be |
370 | * used by the ioctl call to read call information | 370 | * used by the ioctl call to read call information |
371 | * and to execute commands. | 371 | * and to execute commands. |
372 | */ | 372 | */ |
373 | if ((mbox_ptr = kzalloc(sizeof(mbox_cmd_t), GFP_ATOMIC)) == NULL) { | 373 | if ((mbox_ptr = kzalloc(sizeof(mbox_cmd_t), GFP_ATOMIC)) == NULL) { |
374 | wanpipe_kill_sock_irq (newsk); | 374 | wanpipe_kill_sock_irq (newsk); |
375 | release_device(dev); | 375 | release_device(dev); |
376 | return -ENOMEM; | 376 | return -ENOMEM; |
377 | } | 377 | } |
378 | memcpy(mbox_ptr,skb->data,skb->len); | 378 | memcpy(mbox_ptr,skb->data,skb->len); |
379 | 379 | ||
380 | /* Register the lcn on which incoming call came | 380 | /* Register the lcn on which incoming call came |
381 | * from. Thus, if we have to clear it, we know | 381 | * from. Thus, if we have to clear it, we know |
382 | * which lcn to clear | 382 | * which lcn to clear |
383 | */ | 383 | */ |
384 | 384 | ||
385 | newwp->lcn = mbox_ptr->cmd.lcn; | 385 | newwp->lcn = mbox_ptr->cmd.lcn; |
386 | newwp->mbox = (void *)mbox_ptr; | 386 | newwp->mbox = (void *)mbox_ptr; |
@@ -416,20 +416,20 @@ static int wanpipe_listen_rcv (struct sk_buff *skb, struct sock *sk) | |||
416 | 416 | ||
417 | /* We must do this manually, since the sock_queue_rcv_skb() | 417 | /* We must do this manually, since the sock_queue_rcv_skb() |
418 | * function sets the skb->dev to NULL. However, we use | 418 | * function sets the skb->dev to NULL. However, we use |
419 | * the dev field in the accept function.*/ | 419 | * the dev field in the accept function.*/ |
420 | if (atomic_read(&sk->sk_rmem_alloc) + skb->truesize >= | 420 | if (atomic_read(&sk->sk_rmem_alloc) + skb->truesize >= |
421 | (unsigned)sk->sk_rcvbuf) { | 421 | (unsigned)sk->sk_rcvbuf) { |
422 | 422 | ||
423 | wanpipe_unlink_driver(newsk); | 423 | wanpipe_unlink_driver(newsk); |
424 | wanpipe_kill_sock_irq (newsk); | 424 | wanpipe_kill_sock_irq (newsk); |
425 | --sk->sk_ack_backlog; | 425 | --sk->sk_ack_backlog; |
426 | return -ENOMEM; | 426 | return -ENOMEM; |
427 | } | 427 | } |
428 | 428 | ||
429 | skb_set_owner_r(skb, sk); | 429 | skb_set_owner_r(skb, sk); |
430 | skb_queue_tail(&sk->sk_receive_queue, skb); | 430 | skb_queue_tail(&sk->sk_receive_queue, skb); |
431 | sk->sk_data_ready(sk, skb->len); | 431 | sk->sk_data_ready(sk, skb->len); |
432 | 432 | ||
433 | return 0; | 433 | return 0; |
434 | } | 434 | } |
435 | 435 | ||
@@ -474,7 +474,7 @@ static struct sock *wanpipe_make_new(struct sock *osk) | |||
474 | return sk; | 474 | return sk; |
475 | } | 475 | } |
476 | 476 | ||
477 | /* | 477 | /* |
478 | * FIXME: wanpipe_opt has to include a sock in its definition and stop using | 478 | * FIXME: wanpipe_opt has to include a sock in its definition and stop using |
479 | * sk_protinfo, but this code is not even compilable now, so lets leave it for | 479 | * sk_protinfo, but this code is not even compilable now, so lets leave it for |
480 | * later. | 480 | * later. |
@@ -489,12 +489,12 @@ static struct proto wanpipe_proto = { | |||
489 | * wanpipe_make_new | 489 | * wanpipe_make_new |
490 | * | 490 | * |
491 | * Allocate memory for the a new sock, and sock | 491 | * Allocate memory for the a new sock, and sock |
492 | * private data. | 492 | * private data. |
493 | * | 493 | * |
494 | * Increment the module use count. | 494 | * Increment the module use count. |
495 | * | 495 | * |
496 | * This function is used by wanpipe_create() and | 496 | * This function is used by wanpipe_create() and |
497 | * wanpipe_make_new() functions. | 497 | * wanpipe_make_new() functions. |
498 | * | 498 | * |
499 | *===========================================================*/ | 499 | *===========================================================*/ |
500 | 500 | ||
@@ -514,7 +514,7 @@ static struct sock *wanpipe_alloc_socket(void) | |||
514 | wp_sk(sk) = wan_opt; | 514 | wp_sk(sk) = wan_opt; |
515 | 515 | ||
516 | /* Use timer to send data to the driver. This will act | 516 | /* Use timer to send data to the driver. This will act |
517 | * as a BH handler for sendmsg functions */ | 517 | * as a BH handler for sendmsg functions */ |
518 | init_timer(&wan_opt->tx_timer); | 518 | init_timer(&wan_opt->tx_timer); |
519 | wan_opt->tx_timer.data = (unsigned long)sk; | 519 | wan_opt->tx_timer.data = (unsigned long)sk; |
520 | wan_opt->tx_timer.function = wanpipe_delayed_transmit; | 520 | wan_opt->tx_timer.function = wanpipe_delayed_transmit; |
@@ -528,14 +528,14 @@ static struct sock *wanpipe_alloc_socket(void) | |||
528 | * wanpipe_sendmsg | 528 | * wanpipe_sendmsg |
529 | * | 529 | * |
530 | * This function implements a sendto() system call, | 530 | * This function implements a sendto() system call, |
531 | * for AF_WANPIPE socket family. | 531 | * for AF_WANPIPE socket family. |
532 | * During socket bind() sk->sk_bound_dev_if is initialized | 532 | * During socket bind() sk->sk_bound_dev_if is initialized |
533 | * to a correct network device. This number is used | 533 | * to a correct network device. This number is used |
534 | * to find a network device to which the packet should | 534 | * to find a network device to which the packet should |
535 | * be passed to. | 535 | * be passed to. |
536 | * | 536 | * |
537 | * Each packet is queued into sk->sk_write_queue and | 537 | * Each packet is queued into sk->sk_write_queue and |
538 | * delayed transmit bottom half handler is marked for | 538 | * delayed transmit bottom half handler is marked for |
539 | * execution. | 539 | * execution. |
540 | * | 540 | * |
541 | * A socket must be in WANSOCK_CONNECTED state before | 541 | * A socket must be in WANSOCK_CONNECTED state before |
@@ -554,18 +554,18 @@ static int wanpipe_sendmsg(struct kiocb *iocb, struct socket *sock, | |||
554 | unsigned char *addr; | 554 | unsigned char *addr; |
555 | int ifindex, err, reserve = 0; | 555 | int ifindex, err, reserve = 0; |
556 | 556 | ||
557 | 557 | ||
558 | if (!sock_flag(sk, SOCK_ZAPPED)) | 558 | if (!sock_flag(sk, SOCK_ZAPPED)) |
559 | return -ENETDOWN; | 559 | return -ENETDOWN; |
560 | 560 | ||
561 | if (sk->sk_state != WANSOCK_CONNECTED) | 561 | if (sk->sk_state != WANSOCK_CONNECTED) |
562 | return -ENOTCONN; | 562 | return -ENOTCONN; |
563 | 563 | ||
564 | if (msg->msg_flags & ~(MSG_DONTWAIT|MSG_CMSG_COMPAT)) | 564 | if (msg->msg_flags & ~(MSG_DONTWAIT|MSG_CMSG_COMPAT)) |
565 | return(-EINVAL); | 565 | return(-EINVAL); |
566 | 566 | ||
567 | /* it was <=, now one can send | 567 | /* it was <=, now one can send |
568 | * zero length packets */ | 568 | * zero length packets */ |
569 | if (len < sizeof(x25api_hdr_t)) | 569 | if (len < sizeof(x25api_hdr_t)) |
570 | return -EINVAL; | 570 | return -EINVAL; |
571 | 571 | ||
@@ -577,7 +577,7 @@ static int wanpipe_sendmsg(struct kiocb *iocb, struct socket *sock, | |||
577 | addr = NULL; | 577 | addr = NULL; |
578 | 578 | ||
579 | }else{ | 579 | }else{ |
580 | if (msg->msg_namelen < sizeof(struct wan_sockaddr_ll)){ | 580 | if (msg->msg_namelen < sizeof(struct wan_sockaddr_ll)){ |
581 | return -EINVAL; | 581 | return -EINVAL; |
582 | } | 582 | } |
583 | 583 | ||
@@ -592,12 +592,12 @@ static int wanpipe_sendmsg(struct kiocb *iocb, struct socket *sock, | |||
592 | return -ENXIO; | 592 | return -ENXIO; |
593 | } | 593 | } |
594 | dev_put(dev); | 594 | dev_put(dev); |
595 | 595 | ||
596 | if (sock->type == SOCK_RAW) | 596 | if (sock->type == SOCK_RAW) |
597 | reserve = dev->hard_header_len; | 597 | reserve = dev->hard_header_len; |
598 | 598 | ||
599 | if (len > dev->mtu+reserve){ | 599 | if (len > dev->mtu+reserve){ |
600 | return -EMSGSIZE; | 600 | return -EMSGSIZE; |
601 | } | 601 | } |
602 | 602 | ||
603 | skb = sock_alloc_send_skb(sk, len + LL_RESERVED_SPACE(dev), | 603 | skb = sock_alloc_send_skb(sk, len + LL_RESERVED_SPACE(dev), |
@@ -606,7 +606,7 @@ static int wanpipe_sendmsg(struct kiocb *iocb, struct socket *sock, | |||
606 | if (skb==NULL){ | 606 | if (skb==NULL){ |
607 | goto out_unlock; | 607 | goto out_unlock; |
608 | } | 608 | } |
609 | 609 | ||
610 | skb_reserve(skb, LL_RESERVED_SPACE(dev)); | 610 | skb_reserve(skb, LL_RESERVED_SPACE(dev)); |
611 | skb->nh.raw = skb->data; | 611 | skb->nh.raw = skb->data; |
612 | 612 | ||
@@ -645,7 +645,7 @@ static int wanpipe_sendmsg(struct kiocb *iocb, struct socket *sock, | |||
645 | 645 | ||
646 | if (!(test_and_set_bit(0, &wp->timer))) | 646 | if (!(test_and_set_bit(0, &wp->timer))) |
647 | mod_timer(&wp->tx_timer, jiffies + 1); | 647 | mod_timer(&wp->tx_timer, jiffies + 1); |
648 | 648 | ||
649 | return(len); | 649 | return(len); |
650 | 650 | ||
651 | out_free: | 651 | out_free: |
@@ -658,12 +658,12 @@ out_unlock: | |||
658 | * wanpipe_delayed_tarnsmit | 658 | * wanpipe_delayed_tarnsmit |
659 | * | 659 | * |
660 | * Transmit bottom half handler. It dequeues packets | 660 | * Transmit bottom half handler. It dequeues packets |
661 | * from sk->sk_write_queue and passes them to the | 661 | * from sk->sk_write_queue and passes them to the |
662 | * driver. If the driver is busy, the packet is | 662 | * driver. If the driver is busy, the packet is |
663 | * re-enqueued. | 663 | * re-enqueued. |
664 | * | 664 | * |
665 | * Packet Sent counter is decremented on successful | 665 | * Packet Sent counter is decremented on successful |
666 | * transmission. | 666 | * transmission. |
667 | *===========================================================*/ | 667 | *===========================================================*/ |
668 | 668 | ||
669 | 669 | ||
@@ -680,17 +680,17 @@ static void wanpipe_delayed_transmit (unsigned long data) | |||
680 | DBG_PRINTK(KERN_INFO "wansock: Transmit delay, no dev or card\n"); | 680 | DBG_PRINTK(KERN_INFO "wansock: Transmit delay, no dev or card\n"); |
681 | return; | 681 | return; |
682 | } | 682 | } |
683 | 683 | ||
684 | if (sk->sk_state != WANSOCK_CONNECTED || !sock_flag(sk, SOCK_ZAPPED)) { | 684 | if (sk->sk_state != WANSOCK_CONNECTED || !sock_flag(sk, SOCK_ZAPPED)) { |
685 | clear_bit(0, &wp->timer); | 685 | clear_bit(0, &wp->timer); |
686 | DBG_PRINTK(KERN_INFO "wansock: Tx Timer, State not CONNECTED\n"); | 686 | DBG_PRINTK(KERN_INFO "wansock: Tx Timer, State not CONNECTED\n"); |
687 | return; | 687 | return; |
688 | } | 688 | } |
689 | 689 | ||
690 | /* If driver is executing command, we must offload | 690 | /* If driver is executing command, we must offload |
691 | * the board by not sending data. Otherwise a | 691 | * the board by not sending data. Otherwise a |
692 | * pending command will never get a free buffer | 692 | * pending command will never get a free buffer |
693 | * to execute */ | 693 | * to execute */ |
694 | if (atomic_read(&card->u.x.command_busy)){ | 694 | if (atomic_read(&card->u.x.command_busy)){ |
695 | wp->tx_timer.expires = jiffies + SLOW_BACKOFF; | 695 | wp->tx_timer.expires = jiffies + SLOW_BACKOFF; |
696 | add_timer(&wp->tx_timer); | 696 | add_timer(&wp->tx_timer); |
@@ -698,30 +698,30 @@ static void wanpipe_delayed_transmit (unsigned long data) | |||
698 | return; | 698 | return; |
699 | } | 699 | } |
700 | 700 | ||
701 | 701 | ||
702 | if (test_and_set_bit(0,&wanpipe_tx_critical)){ | 702 | if (test_and_set_bit(0,&wanpipe_tx_critical)){ |
703 | printk(KERN_INFO "WanSock: Tx timer critical %s\n",dev->name); | 703 | printk(KERN_INFO "WanSock: Tx timer critical %s\n",dev->name); |
704 | wp->tx_timer.expires = jiffies + SLOW_BACKOFF; | 704 | wp->tx_timer.expires = jiffies + SLOW_BACKOFF; |
705 | add_timer(&wp->tx_timer); | 705 | add_timer(&wp->tx_timer); |
706 | return; | 706 | return; |
707 | } | 707 | } |
708 | 708 | ||
709 | /* Check for a packet in the fifo and send */ | 709 | /* Check for a packet in the fifo and send */ |
710 | if ((skb = skb_dequeue(&sk->sk_write_queue)) != NULL){ | 710 | if ((skb = skb_dequeue(&sk->sk_write_queue)) != NULL){ |
711 | 711 | ||
712 | if (dev->hard_start_xmit(skb, dev) != 0){ | 712 | if (dev->hard_start_xmit(skb, dev) != 0){ |
713 | 713 | ||
714 | /* Driver failed to transmit, re-enqueue | 714 | /* Driver failed to transmit, re-enqueue |
715 | * the packet and retry again later */ | 715 | * the packet and retry again later */ |
716 | skb_queue_head(&sk->sk_write_queue,skb); | 716 | skb_queue_head(&sk->sk_write_queue,skb); |
717 | clear_bit(0,&wanpipe_tx_critical); | 717 | clear_bit(0,&wanpipe_tx_critical); |
718 | return; | 718 | return; |
719 | }else{ | 719 | }else{ |
720 | 720 | ||
721 | /* Packet Sent successful. Check for more packets | 721 | /* Packet Sent successful. Check for more packets |
722 | * if more packets, re-trigger the transmit routine | 722 | * if more packets, re-trigger the transmit routine |
723 | * other wise exit | 723 | * other wise exit |
724 | */ | 724 | */ |
725 | atomic_dec(&wp->packet_sent); | 725 | atomic_dec(&wp->packet_sent); |
726 | 726 | ||
727 | if (skb_peek(&sk->sk_write_queue) == NULL) { | 727 | if (skb_peek(&sk->sk_write_queue) == NULL) { |
@@ -741,18 +741,18 @@ static void wanpipe_delayed_transmit (unsigned long data) | |||
741 | } | 741 | } |
742 | 742 | ||
743 | /*============================================================ | 743 | /*============================================================ |
744 | * execute_command | 744 | * execute_command |
745 | * | 745 | * |
746 | * Execute x25api commands. The atomic variable | 746 | * Execute x25api commands. The atomic variable |
747 | * chan->command is used to indicate to the driver that | 747 | * chan->command is used to indicate to the driver that |
748 | * command is pending for execution. The acutal command | 748 | * command is pending for execution. The acutal command |
749 | * structure is placed into a sock mbox structure | 749 | * structure is placed into a sock mbox structure |
750 | * (wp_sk(sk)->mbox). | 750 | * (wp_sk(sk)->mbox). |
751 | * | 751 | * |
752 | * The sock private structure, mbox is | 752 | * The sock private structure, mbox is |
753 | * used as shared memory between sock and the driver. | 753 | * used as shared memory between sock and the driver. |
754 | * Driver uses the sock mbox to execute the command | 754 | * Driver uses the sock mbox to execute the command |
755 | * and return the result. | 755 | * and return the result. |
756 | * | 756 | * |
757 | * For all command except PLACE CALL, the function | 757 | * For all command except PLACE CALL, the function |
758 | * waits for the result. PLACE CALL can be ether | 758 | * waits for the result. PLACE CALL can be ether |
@@ -768,7 +768,7 @@ static int execute_command(struct sock *sk, unsigned char cmd, unsigned int fla | |||
768 | wanpipe_common_t *chan=NULL; | 768 | wanpipe_common_t *chan=NULL; |
769 | int err=0; | 769 | int err=0; |
770 | DECLARE_WAITQUEUE(wait, current); | 770 | DECLARE_WAITQUEUE(wait, current); |
771 | 771 | ||
772 | dev = dev_get_by_index(sk->sk_bound_dev_if); | 772 | dev = dev_get_by_index(sk->sk_bound_dev_if); |
773 | if (dev == NULL){ | 773 | if (dev == NULL){ |
774 | printk(KERN_INFO "wansock: Exec failed no dev %i\n", | 774 | printk(KERN_INFO "wansock: Exec failed no dev %i\n", |
@@ -793,7 +793,7 @@ static int execute_command(struct sock *sk, unsigned char cmd, unsigned int fla | |||
793 | return -EINVAL; | 793 | return -EINVAL; |
794 | } | 794 | } |
795 | 795 | ||
796 | ((mbox_cmd_t*)wp->mbox)->cmd.command = cmd; | 796 | ((mbox_cmd_t*)wp->mbox)->cmd.command = cmd; |
797 | ((mbox_cmd_t*)wp->mbox)->cmd.lcn = wp->lcn; | 797 | ((mbox_cmd_t*)wp->mbox)->cmd.lcn = wp->lcn; |
798 | ((mbox_cmd_t*)wp->mbox)->cmd.result = 0x7F; | 798 | ((mbox_cmd_t*)wp->mbox)->cmd.result = 0x7F; |
799 | 799 | ||
@@ -820,12 +820,12 @@ static int execute_command(struct sock *sk, unsigned char cmd, unsigned int fla | |||
820 | } | 820 | } |
821 | current->state = TASK_RUNNING; | 821 | current->state = TASK_RUNNING; |
822 | remove_wait_queue(sk->sk_sleep,&wait); | 822 | remove_wait_queue(sk->sk_sleep,&wait); |
823 | 823 | ||
824 | return err; | 824 | return err; |
825 | } | 825 | } |
826 | 826 | ||
827 | /*============================================================ | 827 | /*============================================================ |
828 | * wanpipe_destroy_timer | 828 | * wanpipe_destroy_timer |
829 | * | 829 | * |
830 | * Used by wanpipe_release, to delay release of | 830 | * Used by wanpipe_release, to delay release of |
831 | * the socket. | 831 | * the socket. |
@@ -846,7 +846,7 @@ static void wanpipe_destroy_timer(unsigned long data) | |||
846 | 846 | ||
847 | kfree(wp); | 847 | kfree(wp); |
848 | wp_sk(sk) = NULL; | 848 | wp_sk(sk) = NULL; |
849 | 849 | ||
850 | if (atomic_read(&sk->sk_refcnt) != 1) { | 850 | if (atomic_read(&sk->sk_refcnt) != 1) { |
851 | atomic_set(&sk->sk_refcnt, 1); | 851 | atomic_set(&sk->sk_refcnt, 1); |
852 | DBG_PRINTK(KERN_INFO "wansock: Error, wrong reference count: %i ! :delay.\n", | 852 | DBG_PRINTK(KERN_INFO "wansock: Error, wrong reference count: %i ! :delay.\n", |
@@ -865,9 +865,9 @@ static void wanpipe_destroy_timer(unsigned long data) | |||
865 | /*============================================================ | 865 | /*============================================================ |
866 | * wanpipe_unlink_driver | 866 | * wanpipe_unlink_driver |
867 | * | 867 | * |
868 | * When the socket is released, this function is | 868 | * When the socket is released, this function is |
869 | * used to remove links that bind the sock and the | 869 | * used to remove links that bind the sock and the |
870 | * driver together. | 870 | * driver together. |
871 | *===========================================================*/ | 871 | *===========================================================*/ |
872 | static void wanpipe_unlink_driver (struct sock *sk) | 872 | static void wanpipe_unlink_driver (struct sock *sk) |
873 | { | 873 | { |
@@ -882,7 +882,7 @@ static void wanpipe_unlink_driver (struct sock *sk) | |||
882 | if (!dev){ | 882 | if (!dev){ |
883 | printk(KERN_INFO "wansock: No dev on release\n"); | 883 | printk(KERN_INFO "wansock: No dev on release\n"); |
884 | return; | 884 | return; |
885 | } | 885 | } |
886 | dev_put(dev); | 886 | dev_put(dev); |
887 | 887 | ||
888 | if ((chan = dev->priv) == NULL){ | 888 | if ((chan = dev->priv) == NULL){ |
@@ -897,7 +897,7 @@ static void wanpipe_unlink_driver (struct sock *sk) | |||
897 | chan->tx_timer=NULL; | 897 | chan->tx_timer=NULL; |
898 | clear_bit(0,&chan->common_critical); | 898 | clear_bit(0,&chan->common_critical); |
899 | release_device(dev); | 899 | release_device(dev); |
900 | 900 | ||
901 | return; | 901 | return; |
902 | } | 902 | } |
903 | 903 | ||
@@ -931,7 +931,7 @@ static void wanpipe_link_driver(struct net_device *dev, struct sock *sk) | |||
931 | /*============================================================ | 931 | /*============================================================ |
932 | * release_device | 932 | * release_device |
933 | * | 933 | * |
934 | * During sock release, clear a critical bit, which | 934 | * During sock release, clear a critical bit, which |
935 | * marks the device a being taken. | 935 | * marks the device a being taken. |
936 | *===========================================================*/ | 936 | *===========================================================*/ |
937 | 937 | ||
@@ -945,8 +945,8 @@ static void release_device(struct net_device *dev) | |||
945 | /*============================================================ | 945 | /*============================================================ |
946 | * wanpipe_release | 946 | * wanpipe_release |
947 | * | 947 | * |
948 | * Close a PACKET socket. This is fairly simple. We | 948 | * Close a PACKET socket. This is fairly simple. We |
949 | * immediately go to 'closed' state and remove our | 949 | * immediately go to 'closed' state and remove our |
950 | * protocol entry in the device list. | 950 | * protocol entry in the device list. |
951 | *===========================================================*/ | 951 | *===========================================================*/ |
952 | 952 | ||
@@ -954,7 +954,7 @@ static int wanpipe_release(struct socket *sock) | |||
954 | { | 954 | { |
955 | wanpipe_opt *wp; | 955 | wanpipe_opt *wp; |
956 | struct sock *sk = sock->sk; | 956 | struct sock *sk = sock->sk; |
957 | 957 | ||
958 | if (!sk) | 958 | if (!sk) |
959 | return 0; | 959 | return 0; |
960 | 960 | ||
@@ -962,9 +962,9 @@ static int wanpipe_release(struct socket *sock) | |||
962 | check_write_queue(sk); | 962 | check_write_queue(sk); |
963 | 963 | ||
964 | /* Kill the tx timer, if we don't kill it now, the timer | 964 | /* Kill the tx timer, if we don't kill it now, the timer |
965 | * will run after we kill the sock. Timer code will | 965 | * will run after we kill the sock. Timer code will |
966 | * try to access the sock which has been killed and cause | 966 | * try to access the sock which has been killed and cause |
967 | * kernel panic */ | 967 | * kernel panic */ |
968 | 968 | ||
969 | del_timer(&wp->tx_timer); | 969 | del_timer(&wp->tx_timer); |
970 | 970 | ||
@@ -982,7 +982,7 @@ static int wanpipe_release(struct socket *sock) | |||
982 | DBG_PRINTK(KERN_INFO "wansock: Sending Clear Indication %i\n", | 982 | DBG_PRINTK(KERN_INFO "wansock: Sending Clear Indication %i\n", |
983 | sk->sk_state); | 983 | sk->sk_state); |
984 | dev_put(dev); | 984 | dev_put(dev); |
985 | } | 985 | } |
986 | } | 986 | } |
987 | 987 | ||
988 | set_bit(1,&wanpipe_tx_critical); | 988 | set_bit(1,&wanpipe_tx_critical); |
@@ -992,10 +992,10 @@ static int wanpipe_release(struct socket *sock) | |||
992 | clear_bit(1,&wanpipe_tx_critical); | 992 | clear_bit(1,&wanpipe_tx_critical); |
993 | 993 | ||
994 | 994 | ||
995 | 995 | ||
996 | release_driver(sk); | 996 | release_driver(sk); |
997 | 997 | ||
998 | 998 | ||
999 | /* | 999 | /* |
1000 | * Now the socket is dead. No more input will appear. | 1000 | * Now the socket is dead. No more input will appear. |
1001 | */ | 1001 | */ |
@@ -1040,9 +1040,9 @@ static int wanpipe_release(struct socket *sock) | |||
1040 | /*============================================================ | 1040 | /*============================================================ |
1041 | * check_write_queue | 1041 | * check_write_queue |
1042 | * | 1042 | * |
1043 | * During sock shutdown, if the sock state is | 1043 | * During sock shutdown, if the sock state is |
1044 | * WANSOCK_CONNECTED and there is transmit data | 1044 | * WANSOCK_CONNECTED and there is transmit data |
1045 | * pending. Wait until data is released | 1045 | * pending. Wait until data is released |
1046 | * before proceeding. | 1046 | * before proceeding. |
1047 | *===========================================================*/ | 1047 | *===========================================================*/ |
1048 | 1048 | ||
@@ -1062,7 +1062,7 @@ static void check_write_queue(struct sock *sk) | |||
1062 | /*============================================================ | 1062 | /*============================================================ |
1063 | * release_driver | 1063 | * release_driver |
1064 | * | 1064 | * |
1065 | * This function is called during sock shutdown, to | 1065 | * This function is called during sock shutdown, to |
1066 | * release any resources and links that bind the sock | 1066 | * release any resources and links that bind the sock |
1067 | * to the driver. It also changes the state of the | 1067 | * to the driver. It also changes the state of the |
1068 | * sock to WANSOCK_DISCONNECTED | 1068 | * sock to WANSOCK_DISCONNECTED |
@@ -1105,7 +1105,7 @@ static void release_driver(struct sock *sk) | |||
1105 | * start_cleanup_timer | 1105 | * start_cleanup_timer |
1106 | * | 1106 | * |
1107 | * If new incoming call's are pending but the socket | 1107 | * If new incoming call's are pending but the socket |
1108 | * is being released, start the timer which will | 1108 | * is being released, start the timer which will |
1109 | * envoke the kill routines for pending socks. | 1109 | * envoke the kill routines for pending socks. |
1110 | *===========================================================*/ | 1110 | *===========================================================*/ |
1111 | 1111 | ||
@@ -1125,7 +1125,7 @@ static void start_cleanup_timer (struct sock *sk) | |||
1125 | * | 1125 | * |
1126 | * This is a function which performs actual killing | 1126 | * This is a function which performs actual killing |
1127 | * of the sock. It releases socket resources, | 1127 | * of the sock. It releases socket resources, |
1128 | * and unlinks the sock from the driver. | 1128 | * and unlinks the sock from the driver. |
1129 | *===========================================================*/ | 1129 | *===========================================================*/ |
1130 | 1130 | ||
1131 | static void wanpipe_kill_sock_timer (unsigned long data) | 1131 | static void wanpipe_kill_sock_timer (unsigned long data) |
@@ -1139,13 +1139,13 @@ static void wanpipe_kill_sock_timer (unsigned long data) | |||
1139 | 1139 | ||
1140 | /* This function can be called from interrupt. We must use | 1140 | /* This function can be called from interrupt. We must use |
1141 | * appropriate locks */ | 1141 | * appropriate locks */ |
1142 | 1142 | ||
1143 | if (test_bit(1,&wanpipe_tx_critical)){ | 1143 | if (test_bit(1,&wanpipe_tx_critical)){ |
1144 | sk->sk_timer.expires = jiffies + 10; | 1144 | sk->sk_timer.expires = jiffies + 10; |
1145 | add_timer(&sk->sk_timer); | 1145 | add_timer(&sk->sk_timer); |
1146 | return; | 1146 | return; |
1147 | } | 1147 | } |
1148 | 1148 | ||
1149 | write_lock(&wanpipe_sklist_lock); | 1149 | write_lock(&wanpipe_sklist_lock); |
1150 | sk_del_node_init(sk); | 1150 | sk_del_node_init(sk); |
1151 | write_unlock(&wanpipe_sklist_lock); | 1151 | write_unlock(&wanpipe_sklist_lock); |
@@ -1159,7 +1159,7 @@ static void wanpipe_kill_sock_timer (unsigned long data) | |||
1159 | chan=dev->priv; | 1159 | chan=dev->priv; |
1160 | atomic_set(&chan->disconnect,1); | 1160 | atomic_set(&chan->disconnect,1); |
1161 | dev_put(dev); | 1161 | dev_put(dev); |
1162 | } | 1162 | } |
1163 | } | 1163 | } |
1164 | 1164 | ||
1165 | release_driver(sk); | 1165 | release_driver(sk); |
@@ -1170,7 +1170,7 @@ static void wanpipe_kill_sock_timer (unsigned long data) | |||
1170 | skb_queue_purge(&sk->sk_receive_queue); | 1170 | skb_queue_purge(&sk->sk_receive_queue); |
1171 | skb_queue_purge(&sk->sk_write_queue); | 1171 | skb_queue_purge(&sk->sk_write_queue); |
1172 | skb_queue_purge(&sk->sk_error_queue); | 1172 | skb_queue_purge(&sk->sk_error_queue); |
1173 | 1173 | ||
1174 | if (atomic_read(&sk->sk_rmem_alloc) || | 1174 | if (atomic_read(&sk->sk_rmem_alloc) || |
1175 | atomic_read(&sk->sk_wmem_alloc)) { | 1175 | atomic_read(&sk->sk_wmem_alloc)) { |
1176 | del_timer(&sk->sk_timer); | 1176 | del_timer(&sk->sk_timer); |
@@ -1205,7 +1205,7 @@ static void wanpipe_kill_sock_accept (struct sock *sk) | |||
1205 | 1205 | ||
1206 | /* This function can be called from interrupt. We must use | 1206 | /* This function can be called from interrupt. We must use |
1207 | * appropriate locks */ | 1207 | * appropriate locks */ |
1208 | 1208 | ||
1209 | write_lock(&wanpipe_sklist_lock); | 1209 | write_lock(&wanpipe_sklist_lock); |
1210 | sk_del_node_init(sk); | 1210 | sk_del_node_init(sk); |
1211 | write_unlock(&wanpipe_sklist_lock); | 1211 | write_unlock(&wanpipe_sklist_lock); |
@@ -1282,10 +1282,10 @@ static int wanpipe_do_bind(struct sock *sk, struct net_device *dev, | |||
1282 | chan=dev->priv; | 1282 | chan=dev->priv; |
1283 | sk->sk_state = chan->state; | 1283 | sk->sk_state = chan->state; |
1284 | 1284 | ||
1285 | if (wp->num == htons(X25_PROT) && | 1285 | if (wp->num == htons(X25_PROT) && |
1286 | sk->sk_state != WANSOCK_DISCONNECTED && | 1286 | sk->sk_state != WANSOCK_DISCONNECTED && |
1287 | sk->sk_state != WANSOCK_CONNECTING) { | 1287 | sk->sk_state != WANSOCK_CONNECTING) { |
1288 | DBG_PRINTK(KERN_INFO | 1288 | DBG_PRINTK(KERN_INFO |
1289 | "wansock: Binding to Device not DISCONNECTED %i\n", | 1289 | "wansock: Binding to Device not DISCONNECTED %i\n", |
1290 | sk->sk_state); | 1290 | sk->sk_state); |
1291 | release_device(dev); | 1291 | release_device(dev); |
@@ -1338,7 +1338,7 @@ static int wanpipe_bind(struct socket *sock, struct sockaddr *uaddr, int addr_le | |||
1338 | /* | 1338 | /* |
1339 | * Check legality | 1339 | * Check legality |
1340 | */ | 1340 | */ |
1341 | 1341 | ||
1342 | if (addr_len < sizeof(struct wan_sockaddr_ll)){ | 1342 | if (addr_len < sizeof(struct wan_sockaddr_ll)){ |
1343 | printk(KERN_INFO "wansock: Address length error\n"); | 1343 | printk(KERN_INFO "wansock: Address length error\n"); |
1344 | return -EINVAL; | 1344 | return -EINVAL; |
@@ -1358,12 +1358,12 @@ static int wanpipe_bind(struct socket *sock, struct sockaddr *uaddr, int addr_le | |||
1358 | 1358 | ||
1359 | if (!strcmp(sll->sll_device,"svc_listen")){ | 1359 | if (!strcmp(sll->sll_device,"svc_listen")){ |
1360 | 1360 | ||
1361 | /* Bind a sock to a card structure for listening | 1361 | /* Bind a sock to a card structure for listening |
1362 | */ | 1362 | */ |
1363 | int err=0; | 1363 | int err=0; |
1364 | 1364 | ||
1365 | /* This is x25 specific area if protocol doesn't | 1365 | /* This is x25 specific area if protocol doesn't |
1366 | * match, return error */ | 1366 | * match, return error */ |
1367 | if (sll->sll_protocol != htons(X25_PROT)) | 1367 | if (sll->sll_protocol != htons(X25_PROT)) |
1368 | return -EINVAL; | 1368 | return -EINVAL; |
1369 | 1369 | ||
@@ -1376,14 +1376,14 @@ static int wanpipe_bind(struct socket *sock, struct sockaddr *uaddr, int addr_le | |||
1376 | sk->sk_state = WANSOCK_BIND_LISTEN; | 1376 | sk->sk_state = WANSOCK_BIND_LISTEN; |
1377 | return 0; | 1377 | return 0; |
1378 | 1378 | ||
1379 | }else if (!strcmp(sll->sll_device,"svc_connect")){ | 1379 | }else if (!strcmp(sll->sll_device,"svc_connect")){ |
1380 | 1380 | ||
1381 | /* This is x25 specific area if protocol doesn't | 1381 | /* This is x25 specific area if protocol doesn't |
1382 | * match, return error */ | 1382 | * match, return error */ |
1383 | if (sll->sll_protocol != htons(X25_PROT)) | 1383 | if (sll->sll_protocol != htons(X25_PROT)) |
1384 | return -EINVAL; | 1384 | return -EINVAL; |
1385 | 1385 | ||
1386 | /* Find a free device | 1386 | /* Find a free device |
1387 | */ | 1387 | */ |
1388 | dev = wanpipe_find_free_dev(card); | 1388 | dev = wanpipe_find_free_dev(card); |
1389 | if (dev == NULL){ | 1389 | if (dev == NULL){ |
@@ -1392,9 +1392,9 @@ static int wanpipe_bind(struct socket *sock, struct sockaddr *uaddr, int addr_le | |||
1392 | return -EINVAL; | 1392 | return -EINVAL; |
1393 | } | 1393 | } |
1394 | }else{ | 1394 | }else{ |
1395 | /* Bind a socket to a interface name | 1395 | /* Bind a socket to a interface name |
1396 | * This is used by PVC mostly | 1396 | * This is used by PVC mostly |
1397 | */ | 1397 | */ |
1398 | strlcpy(name,sll->sll_device,sizeof(name)); | 1398 | strlcpy(name,sll->sll_device,sizeof(name)); |
1399 | dev = dev_get_by_name(name); | 1399 | dev = dev_get_by_name(name); |
1400 | if (dev == NULL){ | 1400 | if (dev == NULL){ |
@@ -1419,8 +1419,8 @@ static int wanpipe_bind(struct socket *sock, struct sockaddr *uaddr, int addr_le | |||
1419 | 1419 | ||
1420 | /*============================================================ | 1420 | /*============================================================ |
1421 | * get_atomic_device | 1421 | * get_atomic_device |
1422 | * | 1422 | * |
1423 | * Sets a bit atomically which indicates that | 1423 | * Sets a bit atomically which indicates that |
1424 | * the interface is taken. This avoids race conditions. | 1424 | * the interface is taken. This avoids race conditions. |
1425 | *===========================================================*/ | 1425 | *===========================================================*/ |
1426 | 1426 | ||
@@ -1436,7 +1436,7 @@ static inline int get_atomic_device(struct net_device *dev) | |||
1436 | 1436 | ||
1437 | /*============================================================ | 1437 | /*============================================================ |
1438 | * check_dev | 1438 | * check_dev |
1439 | * | 1439 | * |
1440 | * Check that device name belongs to a particular card. | 1440 | * Check that device name belongs to a particular card. |
1441 | *===========================================================*/ | 1441 | *===========================================================*/ |
1442 | 1442 | ||
@@ -1446,8 +1446,8 @@ static int check_dev(struct net_device *dev, sdla_t *card) | |||
1446 | 1446 | ||
1447 | for (tmp_dev = card->wandev.dev; tmp_dev; | 1447 | for (tmp_dev = card->wandev.dev; tmp_dev; |
1448 | tmp_dev = *((struct net_device **)tmp_dev->priv)) { | 1448 | tmp_dev = *((struct net_device **)tmp_dev->priv)) { |
1449 | if (tmp_dev->ifindex == dev->ifindex){ | 1449 | if (tmp_dev->ifindex == dev->ifindex){ |
1450 | return 0; | 1450 | return 0; |
1451 | } | 1451 | } |
1452 | } | 1452 | } |
1453 | return 1; | 1453 | return 1; |
@@ -1455,7 +1455,7 @@ static int check_dev(struct net_device *dev, sdla_t *card) | |||
1455 | 1455 | ||
1456 | /*============================================================ | 1456 | /*============================================================ |
1457 | * wanpipe_find_free_dev | 1457 | * wanpipe_find_free_dev |
1458 | * | 1458 | * |
1459 | * Find a free network interface. If found set atomic | 1459 | * Find a free network interface. If found set atomic |
1460 | * bit indicating that the interface is taken. | 1460 | * bit indicating that the interface is taken. |
1461 | * X25API Specific. | 1461 | * X25API Specific. |
@@ -1468,12 +1468,12 @@ struct net_device *wanpipe_find_free_dev(sdla_t *card) | |||
1468 | 1468 | ||
1469 | if (test_and_set_bit(0,&find_free_critical)){ | 1469 | if (test_and_set_bit(0,&find_free_critical)){ |
1470 | printk(KERN_INFO "CRITICAL in Find Free\n"); | 1470 | printk(KERN_INFO "CRITICAL in Find Free\n"); |
1471 | } | 1471 | } |
1472 | 1472 | ||
1473 | for (dev = card->wandev.dev; dev; | 1473 | for (dev = card->wandev.dev; dev; |
1474 | dev = *((struct net_device **)dev->priv)) { | 1474 | dev = *((struct net_device **)dev->priv)) { |
1475 | chan = dev->priv; | 1475 | chan = dev->priv; |
1476 | if (!chan) | 1476 | if (!chan) |
1477 | continue; | 1477 | continue; |
1478 | if (chan->usedby == API && chan->svc){ | 1478 | if (chan->usedby == API && chan->svc){ |
1479 | if (!get_atomic_device (dev)){ | 1479 | if (!get_atomic_device (dev)){ |
@@ -1492,16 +1492,16 @@ struct net_device *wanpipe_find_free_dev(sdla_t *card) | |||
1492 | 1492 | ||
1493 | /*============================================================ | 1493 | /*============================================================ |
1494 | * wanpipe_create | 1494 | * wanpipe_create |
1495 | * | 1495 | * |
1496 | * SOCKET() System call. It allocates a sock structure | 1496 | * SOCKET() System call. It allocates a sock structure |
1497 | * and adds the socket to the wanpipe_sk_list. | 1497 | * and adds the socket to the wanpipe_sk_list. |
1498 | * Crates AF_WANPIPE socket. | 1498 | * Crates AF_WANPIPE socket. |
1499 | *===========================================================*/ | 1499 | *===========================================================*/ |
1500 | 1500 | ||
1501 | static int wanpipe_create(struct socket *sock, int protocol) | 1501 | static int wanpipe_create(struct socket *sock, int protocol) |
1502 | { | 1502 | { |
1503 | struct sock *sk; | 1503 | struct sock *sk; |
1504 | 1504 | ||
1505 | //FIXME: This checks for root user, SECURITY ? | 1505 | //FIXME: This checks for root user, SECURITY ? |
1506 | //if (!capable(CAP_NET_RAW)) | 1506 | //if (!capable(CAP_NET_RAW)) |
1507 | // return -EPERM; | 1507 | // return -EPERM; |
@@ -1526,7 +1526,7 @@ static int wanpipe_create(struct socket *sock, int protocol) | |||
1526 | sk->sk_bound_dev_if = 0; | 1526 | sk->sk_bound_dev_if = 0; |
1527 | 1527 | ||
1528 | atomic_inc(&wanpipe_socks_nr); | 1528 | atomic_inc(&wanpipe_socks_nr); |
1529 | 1529 | ||
1530 | /* We must disable interrupts because the ISR | 1530 | /* We must disable interrupts because the ISR |
1531 | * can also change the list */ | 1531 | * can also change the list */ |
1532 | set_bit(1,&wanpipe_tx_critical); | 1532 | set_bit(1,&wanpipe_tx_critical); |
@@ -1541,8 +1541,8 @@ static int wanpipe_create(struct socket *sock, int protocol) | |||
1541 | 1541 | ||
1542 | /*============================================================ | 1542 | /*============================================================ |
1543 | * wanpipe_recvmsg | 1543 | * wanpipe_recvmsg |
1544 | * | 1544 | * |
1545 | * Pull a packet from our receive queue and hand it | 1545 | * Pull a packet from our receive queue and hand it |
1546 | * to the user. If necessary we block. | 1546 | * to the user. If necessary we block. |
1547 | *===========================================================*/ | 1547 | *===========================================================*/ |
1548 | 1548 | ||
@@ -1570,13 +1570,13 @@ static int wanpipe_recvmsg(struct kiocb *iocb, struct socket *sock, | |||
1570 | * but then it will block. | 1570 | * but then it will block. |
1571 | */ | 1571 | */ |
1572 | 1572 | ||
1573 | if (flags & MSG_OOB){ | 1573 | if (flags & MSG_OOB){ |
1574 | skb = skb_dequeue(&sk->sk_error_queue); | 1574 | skb = skb_dequeue(&sk->sk_error_queue); |
1575 | }else{ | 1575 | }else{ |
1576 | skb=skb_recv_datagram(sk,flags,1,&err); | 1576 | skb=skb_recv_datagram(sk,flags,1,&err); |
1577 | } | 1577 | } |
1578 | /* | 1578 | /* |
1579 | * An error occurred so return it. Because skb_recv_datagram() | 1579 | * An error occurred so return it. Because skb_recv_datagram() |
1580 | * handles the blocking we don't see and worry about blocking | 1580 | * handles the blocking we don't see and worry about blocking |
1581 | * retries. | 1581 | * retries. |
1582 | */ | 1582 | */ |
@@ -1602,9 +1602,9 @@ static int wanpipe_recvmsg(struct kiocb *iocb, struct socket *sock, | |||
1602 | err = memcpy_toiovec(msg->msg_iov, skb->data, copied); | 1602 | err = memcpy_toiovec(msg->msg_iov, skb->data, copied); |
1603 | if (err) | 1603 | if (err) |
1604 | goto out_free; | 1604 | goto out_free; |
1605 | 1605 | ||
1606 | sock_recv_timestamp(msg, sk, skb); | 1606 | sock_recv_timestamp(msg, sk, skb); |
1607 | 1607 | ||
1608 | if (msg->msg_name) | 1608 | if (msg->msg_name) |
1609 | memcpy(msg->msg_name, skb->cb, msg->msg_namelen); | 1609 | memcpy(msg->msg_name, skb->cb, msg->msg_namelen); |
1610 | 1610 | ||
@@ -1623,13 +1623,13 @@ out: | |||
1623 | 1623 | ||
1624 | /*============================================================ | 1624 | /*============================================================ |
1625 | * wanpipe_wakeup_driver | 1625 | * wanpipe_wakeup_driver |
1626 | * | 1626 | * |
1627 | * If socket receive buffer is full and driver cannot | 1627 | * If socket receive buffer is full and driver cannot |
1628 | * pass data up the sock, it sets a packet_block flag. | 1628 | * pass data up the sock, it sets a packet_block flag. |
1629 | * This function check that flag and if sock receive | 1629 | * This function check that flag and if sock receive |
1630 | * queue has room it kicks the driver BH handler. | 1630 | * queue has room it kicks the driver BH handler. |
1631 | * | 1631 | * |
1632 | * This way, driver doesn't have to poll the sock | 1632 | * This way, driver doesn't have to poll the sock |
1633 | * receive queue. | 1633 | * receive queue. |
1634 | *===========================================================*/ | 1634 | *===========================================================*/ |
1635 | 1635 | ||
@@ -1646,8 +1646,8 @@ static void wanpipe_wakeup_driver(struct sock *sk) | |||
1646 | 1646 | ||
1647 | if ((chan = dev->priv) == NULL) | 1647 | if ((chan = dev->priv) == NULL) |
1648 | return; | 1648 | return; |
1649 | 1649 | ||
1650 | if (atomic_read(&chan->receive_block)){ | 1650 | if (atomic_read(&chan->receive_block)){ |
1651 | if (atomic_read(&sk->sk_rmem_alloc) < | 1651 | if (atomic_read(&sk->sk_rmem_alloc) < |
1652 | ((unsigned)sk->sk_rcvbuf * 0.9)) { | 1652 | ((unsigned)sk->sk_rcvbuf * 0.9)) { |
1653 | printk(KERN_INFO "wansock: Queuing task for wanpipe\n"); | 1653 | printk(KERN_INFO "wansock: Queuing task for wanpipe\n"); |
@@ -1655,13 +1655,13 @@ static void wanpipe_wakeup_driver(struct sock *sk) | |||
1655 | wanpipe_queue_tq(&chan->wanpipe_task); | 1655 | wanpipe_queue_tq(&chan->wanpipe_task); |
1656 | wanpipe_mark_bh(); | 1656 | wanpipe_mark_bh(); |
1657 | } | 1657 | } |
1658 | } | 1658 | } |
1659 | } | 1659 | } |
1660 | 1660 | ||
1661 | /*============================================================ | 1661 | /*============================================================ |
1662 | * wanpipe_getname | 1662 | * wanpipe_getname |
1663 | * | 1663 | * |
1664 | * I don't know what to do with this yet. | 1664 | * I don't know what to do with this yet. |
1665 | * User can use this function to get sock address | 1665 | * User can use this function to get sock address |
1666 | * information. Not very useful for Sangoma's purposes. | 1666 | * information. Not very useful for Sangoma's purposes. |
1667 | *===========================================================*/ | 1667 | *===========================================================*/ |
@@ -1687,17 +1687,17 @@ static int wanpipe_getname(struct socket *sock, struct sockaddr *uaddr, | |||
1687 | sll->sll_halen = 0; | 1687 | sll->sll_halen = 0; |
1688 | } | 1688 | } |
1689 | *uaddr_len = sizeof(*sll); | 1689 | *uaddr_len = sizeof(*sll); |
1690 | 1690 | ||
1691 | dev_put(dev); | 1691 | dev_put(dev); |
1692 | 1692 | ||
1693 | return 0; | 1693 | return 0; |
1694 | } | 1694 | } |
1695 | 1695 | ||
1696 | /*============================================================ | 1696 | /*============================================================ |
1697 | * wanpipe_notifier | 1697 | * wanpipe_notifier |
1698 | * | 1698 | * |
1699 | * If driver turns off network interface, this function | 1699 | * If driver turns off network interface, this function |
1700 | * will be envoked. Currently I treate it as a | 1700 | * will be envoked. Currently I treate it as a |
1701 | * call disconnect. More thought should go into this | 1701 | * call disconnect. More thought should go into this |
1702 | * function. | 1702 | * function. |
1703 | * | 1703 | * |
@@ -1718,7 +1718,7 @@ static int wanpipe_notifier(struct notifier_block *this, unsigned long msg, void | |||
1718 | continue; | 1718 | continue; |
1719 | if (dev == NULL) | 1719 | if (dev == NULL) |
1720 | continue; | 1720 | continue; |
1721 | 1721 | ||
1722 | switch (msg) { | 1722 | switch (msg) { |
1723 | case NETDEV_DOWN: | 1723 | case NETDEV_DOWN: |
1724 | case NETDEV_UNREGISTER: | 1724 | case NETDEV_UNREGISTER: |
@@ -1732,7 +1732,7 @@ static int wanpipe_notifier(struct notifier_block *this, unsigned long msg, void | |||
1732 | 1732 | ||
1733 | if (msg == NETDEV_UNREGISTER) { | 1733 | if (msg == NETDEV_UNREGISTER) { |
1734 | printk(KERN_INFO "wansock: Unregistering Device: %s\n", | 1734 | printk(KERN_INFO "wansock: Unregistering Device: %s\n", |
1735 | dev->name); | 1735 | dev->name); |
1736 | wanpipe_unlink_driver(sk); | 1736 | wanpipe_unlink_driver(sk); |
1737 | sk->sk_bound_dev_if = 0; | 1737 | sk->sk_bound_dev_if = 0; |
1738 | } | 1738 | } |
@@ -1753,7 +1753,7 @@ static int wanpipe_notifier(struct notifier_block *this, unsigned long msg, void | |||
1753 | 1753 | ||
1754 | /*============================================================ | 1754 | /*============================================================ |
1755 | * wanpipe_ioctl | 1755 | * wanpipe_ioctl |
1756 | * | 1756 | * |
1757 | * Execute a user commands, and set socket options. | 1757 | * Execute a user commands, and set socket options. |
1758 | * | 1758 | * |
1759 | * FIXME: More thought should go into this function. | 1759 | * FIXME: More thought should go into this function. |
@@ -1765,7 +1765,7 @@ static int wanpipe_ioctl(struct socket *sock, unsigned int cmd, unsigned long ar | |||
1765 | struct sock *sk = sock->sk; | 1765 | struct sock *sk = sock->sk; |
1766 | int err; | 1766 | int err; |
1767 | 1767 | ||
1768 | switch(cmd) | 1768 | switch(cmd) |
1769 | { | 1769 | { |
1770 | case SIOCGSTAMP: | 1770 | case SIOCGSTAMP: |
1771 | return sock_get_timestamp(sk, (struct timeval __user *)arg); | 1771 | return sock_get_timestamp(sk, (struct timeval __user *)arg); |
@@ -1778,7 +1778,7 @@ static int wanpipe_ioctl(struct socket *sock, unsigned int cmd, unsigned long ar | |||
1778 | 1778 | ||
1779 | if (sk->sk_state == WANSOCK_CONNECTED) | 1779 | if (sk->sk_state == WANSOCK_CONNECTED) |
1780 | return 0; | 1780 | return 0; |
1781 | 1781 | ||
1782 | return 1; | 1782 | return 1; |
1783 | 1783 | ||
1784 | 1784 | ||
@@ -1804,7 +1804,7 @@ static int wanpipe_ioctl(struct socket *sock, unsigned int cmd, unsigned long ar | |||
1804 | case SIOC_WANPIPE_DEBUG: | 1804 | case SIOC_WANPIPE_DEBUG: |
1805 | 1805 | ||
1806 | return wanpipe_debug(sk,(void*)arg); | 1806 | return wanpipe_debug(sk,(void*)arg); |
1807 | 1807 | ||
1808 | case SIOC_WANPIPE_SET_NONBLOCK: | 1808 | case SIOC_WANPIPE_SET_NONBLOCK: |
1809 | 1809 | ||
1810 | if (sk->sk_state != WANSOCK_DISCONNECTED) | 1810 | if (sk->sk_state != WANSOCK_DISCONNECTED) |
@@ -1812,7 +1812,7 @@ static int wanpipe_ioctl(struct socket *sock, unsigned int cmd, unsigned long ar | |||
1812 | 1812 | ||
1813 | sock->file->f_flags |= O_NONBLOCK; | 1813 | sock->file->f_flags |= O_NONBLOCK; |
1814 | return 0; | 1814 | return 0; |
1815 | 1815 | ||
1816 | #ifdef CONFIG_INET | 1816 | #ifdef CONFIG_INET |
1817 | case SIOCADDRT: | 1817 | case SIOCADDRT: |
1818 | case SIOCDELRT: | 1818 | case SIOCDELRT: |
@@ -1842,7 +1842,7 @@ static int wanpipe_ioctl(struct socket *sock, unsigned int cmd, unsigned long ar | |||
1842 | 1842 | ||
1843 | /*============================================================ | 1843 | /*============================================================ |
1844 | * wanpipe_debug | 1844 | * wanpipe_debug |
1845 | * | 1845 | * |
1846 | * This function will pass up information about all | 1846 | * This function will pass up information about all |
1847 | * active sockets. | 1847 | * active sockets. |
1848 | * | 1848 | * |
@@ -1893,49 +1893,49 @@ static int wanpipe_debug (struct sock *origsk, void *arg) | |||
1893 | 1893 | ||
1894 | if (sk->sk_bound_dev_if) { | 1894 | if (sk->sk_bound_dev_if) { |
1895 | dev = dev_get_by_index(sk->sk_bound_dev_if); | 1895 | dev = dev_get_by_index(sk->sk_bound_dev_if); |
1896 | if (!dev) | 1896 | if (!dev) |
1897 | continue; | 1897 | continue; |
1898 | 1898 | ||
1899 | chan=dev->priv; | 1899 | chan=dev->priv; |
1900 | dev_put(dev); | 1900 | dev_put(dev); |
1901 | 1901 | ||
1902 | if ((err=put_user(chan->state, &dbg_data->debug[cnt].d_state))) | 1902 | if ((err=put_user(chan->state, &dbg_data->debug[cnt].d_state))) |
1903 | return err; | 1903 | return err; |
1904 | if ((err=put_user(chan->svc, &dbg_data->debug[cnt].svc))) | 1904 | if ((err=put_user(chan->svc, &dbg_data->debug[cnt].svc))) |
1905 | return err; | 1905 | return err; |
1906 | 1906 | ||
1907 | if ((err=put_user(atomic_read(&chan->command), | 1907 | if ((err=put_user(atomic_read(&chan->command), |
1908 | &dbg_data->debug[cnt].command))) | 1908 | &dbg_data->debug[cnt].command))) |
1909 | return err; | 1909 | return err; |
1910 | 1910 | ||
1911 | 1911 | ||
1912 | if (wp){ | 1912 | if (wp){ |
1913 | sdla_t *card = (sdla_t*)wp->card; | 1913 | sdla_t *card = (sdla_t*)wp->card; |
1914 | 1914 | ||
1915 | if (card){ | 1915 | if (card){ |
1916 | if ((err=put_user(atomic_read(&card->u.x.command_busy), | 1916 | if ((err=put_user(atomic_read(&card->u.x.command_busy), |
1917 | &dbg_data->debug[cnt].cmd_busy))) | 1917 | &dbg_data->debug[cnt].cmd_busy))) |
1918 | return err; | 1918 | return err; |
1919 | } | 1919 | } |
1920 | 1920 | ||
1921 | if ((err=put_user(wp->lcn, | 1921 | if ((err=put_user(wp->lcn, |
1922 | &dbg_data->debug[cnt].lcn))) | 1922 | &dbg_data->debug[cnt].lcn))) |
1923 | return err; | 1923 | return err; |
1924 | 1924 | ||
1925 | if (wp->mbox) { | 1925 | if (wp->mbox) { |
1926 | if ((err=put_user(1, &dbg_data->debug[cnt].mbox))) | 1926 | if ((err=put_user(1, &dbg_data->debug[cnt].mbox))) |
1927 | return err; | 1927 | return err; |
1928 | } | 1928 | } |
1929 | } | 1929 | } |
1930 | 1930 | ||
1931 | if ((err=put_user(atomic_read(&chan->receive_block), | 1931 | if ((err=put_user(atomic_read(&chan->receive_block), |
1932 | &dbg_data->debug[cnt].rblock))) | 1932 | &dbg_data->debug[cnt].rblock))) |
1933 | return err; | 1933 | return err; |
1934 | 1934 | ||
1935 | if (copy_to_user(dbg_data->debug[cnt].name, dev->name, strlen(dev->name))) | 1935 | if (copy_to_user(dbg_data->debug[cnt].name, dev->name, strlen(dev->name))) |
1936 | return -EFAULT; | 1936 | return -EFAULT; |
1937 | } | 1937 | } |
1938 | 1938 | ||
1939 | if (++cnt == MAX_NUM_DEBUG) | 1939 | if (++cnt == MAX_NUM_DEBUG) |
1940 | break; | 1940 | break; |
1941 | } | 1941 | } |
@@ -1944,7 +1944,7 @@ static int wanpipe_debug (struct sock *origsk, void *arg) | |||
1944 | 1944 | ||
1945 | /*============================================================ | 1945 | /*============================================================ |
1946 | * get_ioctl_cmd | 1946 | * get_ioctl_cmd |
1947 | * | 1947 | * |
1948 | * Pass up the contents of socket MBOX to the user. | 1948 | * Pass up the contents of socket MBOX to the user. |
1949 | *===========================================================*/ | 1949 | *===========================================================*/ |
1950 | 1950 | ||
@@ -1974,7 +1974,7 @@ static int get_ioctl_cmd (struct sock *sk, void *arg) | |||
1974 | if ((err=put_user(mbox_ptr->cmd.result, &usr_data->hdr.result))) | 1974 | if ((err=put_user(mbox_ptr->cmd.result, &usr_data->hdr.result))) |
1975 | return err; | 1975 | return err; |
1976 | if ((err=put_user(mbox_ptr->cmd.lcn, &usr_data->hdr.lcn))) | 1976 | if ((err=put_user(mbox_ptr->cmd.lcn, &usr_data->hdr.lcn))) |
1977 | return err; | 1977 | return err; |
1978 | 1978 | ||
1979 | if (mbox_ptr->cmd.length > 0){ | 1979 | if (mbox_ptr->cmd.length > 0){ |
1980 | if (mbox_ptr->cmd.length > X25_MAX_DATA) | 1980 | if (mbox_ptr->cmd.length > X25_MAX_DATA) |
@@ -1986,13 +1986,13 @@ static int get_ioctl_cmd (struct sock *sk, void *arg) | |||
1986 | } | 1986 | } |
1987 | } | 1987 | } |
1988 | return 0; | 1988 | return 0; |
1989 | } | 1989 | } |
1990 | 1990 | ||
1991 | /*============================================================ | 1991 | /*============================================================ |
1992 | * set_ioctl_cmd | 1992 | * set_ioctl_cmd |
1993 | * | 1993 | * |
1994 | * Before command can be execute, socket MBOX must | 1994 | * Before command can be execute, socket MBOX must |
1995 | * be created, and initialized with user data. | 1995 | * be created, and initialized with user data. |
1996 | *===========================================================*/ | 1996 | *===========================================================*/ |
1997 | 1997 | ||
1998 | static int set_ioctl_cmd (struct sock *sk, void *arg) | 1998 | static int set_ioctl_cmd (struct sock *sk, void *arg) |
@@ -2008,7 +2008,7 @@ static int set_ioctl_cmd (struct sock *sk, void *arg) | |||
2008 | return -ENODEV; | 2008 | return -ENODEV; |
2009 | 2009 | ||
2010 | dev_put(dev); | 2010 | dev_put(dev); |
2011 | 2011 | ||
2012 | if ((mbox_ptr = kzalloc(sizeof(mbox_cmd_t), GFP_ATOMIC)) == NULL) | 2012 | if ((mbox_ptr = kzalloc(sizeof(mbox_cmd_t), GFP_ATOMIC)) == NULL) |
2013 | return -ENOMEM; | 2013 | return -ENOMEM; |
2014 | 2014 | ||
@@ -2092,12 +2092,12 @@ unsigned int wanpipe_poll(struct file * file, struct socket *sock, poll_table *w | |||
2092 | return mask; | 2092 | return mask; |
2093 | } | 2093 | } |
2094 | 2094 | ||
2095 | /* This check blocks the user process if there is | 2095 | /* This check blocks the user process if there is |
2096 | * a packet already queued in the socket write queue. | 2096 | * a packet already queued in the socket write queue. |
2097 | * This option is only for X25API protocol, for other | 2097 | * This option is only for X25API protocol, for other |
2098 | * protocol like chdlc enable streaming mode, | 2098 | * protocol like chdlc enable streaming mode, |
2099 | * where multiple packets can be pending in the socket | 2099 | * where multiple packets can be pending in the socket |
2100 | * transmit queue */ | 2100 | * transmit queue */ |
2101 | 2101 | ||
2102 | if (wp_sk(sk)->num == htons(X25_PROT)) { | 2102 | if (wp_sk(sk)->num == htons(X25_PROT)) { |
2103 | if (atomic_read(&wp_sk(sk)->packet_sent)) | 2103 | if (atomic_read(&wp_sk(sk)->packet_sent)) |
@@ -2110,7 +2110,7 @@ unsigned int wanpipe_poll(struct file * file, struct socket *sock, poll_table *w | |||
2110 | }else{ | 2110 | }else{ |
2111 | set_bit(SOCK_ASYNC_NOSPACE, &sk->sk_socket->flags); | 2111 | set_bit(SOCK_ASYNC_NOSPACE, &sk->sk_socket->flags); |
2112 | } | 2112 | } |
2113 | 2113 | ||
2114 | return mask; | 2114 | return mask; |
2115 | } | 2115 | } |
2116 | 2116 | ||
@@ -2125,8 +2125,8 @@ static int wanpipe_listen(struct socket *sock, int backlog) | |||
2125 | { | 2125 | { |
2126 | struct sock *sk = sock->sk; | 2126 | struct sock *sk = sock->sk; |
2127 | 2127 | ||
2128 | /* This is x25 specific area if protocol doesn't | 2128 | /* This is x25 specific area if protocol doesn't |
2129 | * match, return error */ | 2129 | * match, return error */ |
2130 | if (wp_sk(sk)->num != htons(X25_PROT)) | 2130 | if (wp_sk(sk)->num != htons(X25_PROT)) |
2131 | return -EINVAL; | 2131 | return -EINVAL; |
2132 | 2132 | ||
@@ -2163,7 +2163,7 @@ static int wanpipe_link_card (struct sock *sk) | |||
2163 | card->sk=sk; | 2163 | card->sk=sk; |
2164 | card->func=wanpipe_listen_rcv; | 2164 | card->func=wanpipe_listen_rcv; |
2165 | sock_set_flag(sk, SOCK_ZAPPED); | 2165 | sock_set_flag(sk, SOCK_ZAPPED); |
2166 | 2166 | ||
2167 | return 0; | 2167 | return 0; |
2168 | } | 2168 | } |
2169 | 2169 | ||
@@ -2176,7 +2176,7 @@ static int wanpipe_link_card (struct sock *sk) | |||
2176 | 2176 | ||
2177 | static void wanpipe_unlink_card (struct sock *sk) | 2177 | static void wanpipe_unlink_card (struct sock *sk) |
2178 | { | 2178 | { |
2179 | sdla_t *card = (sdla_t*)wp_sk(sk)->card; | 2179 | sdla_t *card = (sdla_t*)wp_sk(sk)->card; |
2180 | 2180 | ||
2181 | if (card){ | 2181 | if (card){ |
2182 | card->sk=NULL; | 2182 | card->sk=NULL; |
@@ -2202,9 +2202,9 @@ static int wanpipe_exec_cmd(struct sock *sk, int cmd, unsigned int flags) | |||
2202 | printk(KERN_INFO "NO MBOX PTR !!!!!\n"); | 2202 | printk(KERN_INFO "NO MBOX PTR !!!!!\n"); |
2203 | return -EINVAL; | 2203 | return -EINVAL; |
2204 | } | 2204 | } |
2205 | 2205 | ||
2206 | /* This is x25 specific area if protocol doesn't | 2206 | /* This is x25 specific area if protocol doesn't |
2207 | * match, return error */ | 2207 | * match, return error */ |
2208 | if (wp->num != htons(X25_PROT)) | 2208 | if (wp->num != htons(X25_PROT)) |
2209 | return -EINVAL; | 2209 | return -EINVAL; |
2210 | 2210 | ||
@@ -2217,17 +2217,17 @@ static int wanpipe_exec_cmd(struct sock *sk, int cmd, unsigned int flags) | |||
2217 | err = -EHOSTDOWN; | 2217 | err = -EHOSTDOWN; |
2218 | break; | 2218 | break; |
2219 | } | 2219 | } |
2220 | 2220 | ||
2221 | err = execute_command(sk,X25_ACCEPT_CALL,0); | 2221 | err = execute_command(sk,X25_ACCEPT_CALL,0); |
2222 | if (err < 0) | 2222 | if (err < 0) |
2223 | break; | 2223 | break; |
2224 | 2224 | ||
2225 | /* Update. Mar6 2000. | 2225 | /* Update. Mar6 2000. |
2226 | * Do not set the sock lcn number here, since | 2226 | * Do not set the sock lcn number here, since |
2227 | * it is done in wanpipe_listen_rcv(). | 2227 | * it is done in wanpipe_listen_rcv(). |
2228 | */ | 2228 | */ |
2229 | if (sk->sk_state == WANSOCK_CONNECTED) { | 2229 | if (sk->sk_state == WANSOCK_CONNECTED) { |
2230 | wp->lcn = ((mbox_cmd_t*)wp->mbox)->cmd.lcn; | 2230 | wp->lcn = ((mbox_cmd_t*)wp->mbox)->cmd.lcn; |
2231 | DBG_PRINTK(KERN_INFO "\nwansock: Accept OK %i\n", | 2231 | DBG_PRINTK(KERN_INFO "\nwansock: Accept OK %i\n", |
2232 | wp->lcn); | 2232 | wp->lcn); |
2233 | err = 0; | 2233 | err = 0; |
@@ -2249,15 +2249,15 @@ static int wanpipe_exec_cmd(struct sock *sk, int cmd, unsigned int flags) | |||
2249 | 2249 | ||
2250 | 2250 | ||
2251 | /* Check if data buffers are pending for transmission, | 2251 | /* Check if data buffers are pending for transmission, |
2252 | * if so, check whether user wants to wait until data | 2252 | * if so, check whether user wants to wait until data |
2253 | * is transmitted, or clear a call and drop packets */ | 2253 | * is transmitted, or clear a call and drop packets */ |
2254 | 2254 | ||
2255 | if (atomic_read(&sk->sk_wmem_alloc) || | 2255 | if (atomic_read(&sk->sk_wmem_alloc) || |
2256 | check_driver_busy(sk)) { | 2256 | check_driver_busy(sk)) { |
2257 | mbox_cmd_t *mbox = wp->mbox; | 2257 | mbox_cmd_t *mbox = wp->mbox; |
2258 | if (mbox->cmd.qdm & 0x80){ | 2258 | if (mbox->cmd.qdm & 0x80){ |
2259 | mbox->cmd.result = 0x35; | 2259 | mbox->cmd.result = 0x35; |
2260 | err = -EAGAIN; | 2260 | err = -EAGAIN; |
2261 | break; | 2261 | break; |
2262 | } | 2262 | } |
2263 | } | 2263 | } |
@@ -2286,15 +2286,15 @@ static int wanpipe_exec_cmd(struct sock *sk, int cmd, unsigned int flags) | |||
2286 | 2286 | ||
2287 | 2287 | ||
2288 | /* Check if data buffers are pending for transmission, | 2288 | /* Check if data buffers are pending for transmission, |
2289 | * if so, check whether user wants to wait until data | 2289 | * if so, check whether user wants to wait until data |
2290 | * is transmitted, or reset a call and drop packets */ | 2290 | * is transmitted, or reset a call and drop packets */ |
2291 | 2291 | ||
2292 | if (atomic_read(&sk->sk_wmem_alloc) || | 2292 | if (atomic_read(&sk->sk_wmem_alloc) || |
2293 | check_driver_busy(sk)) { | 2293 | check_driver_busy(sk)) { |
2294 | mbox_cmd_t *mbox = wp->mbox; | 2294 | mbox_cmd_t *mbox = wp->mbox; |
2295 | if (mbox->cmd.qdm & 0x80){ | 2295 | if (mbox->cmd.qdm & 0x80){ |
2296 | mbox->cmd.result = 0x35; | 2296 | mbox->cmd.result = 0x35; |
2297 | err = -EAGAIN; | 2297 | err = -EAGAIN; |
2298 | break; | 2298 | break; |
2299 | } | 2299 | } |
2300 | } | 2300 | } |
@@ -2316,7 +2316,7 @@ static int wanpipe_exec_cmd(struct sock *sk, int cmd, unsigned int flags) | |||
2316 | 2316 | ||
2317 | if (sk->sk_state == WANSOCK_CONNECTED) { | 2317 | if (sk->sk_state == WANSOCK_CONNECTED) { |
2318 | 2318 | ||
2319 | wp->lcn = ((mbox_cmd_t*)wp->mbox)->cmd.lcn; | 2319 | wp->lcn = ((mbox_cmd_t*)wp->mbox)->cmd.lcn; |
2320 | 2320 | ||
2321 | DBG_PRINTK(KERN_INFO "\nwansock: PLACE CALL OK %i\n", | 2321 | DBG_PRINTK(KERN_INFO "\nwansock: PLACE CALL OK %i\n", |
2322 | wp->lcn); | 2322 | wp->lcn); |
@@ -2337,7 +2337,7 @@ static int wanpipe_exec_cmd(struct sock *sk, int cmd, unsigned int flags) | |||
2337 | 2337 | ||
2338 | break; | 2338 | break; |
2339 | 2339 | ||
2340 | default: | 2340 | default: |
2341 | return -EINVAL; | 2341 | return -EINVAL; |
2342 | } | 2342 | } |
2343 | 2343 | ||
@@ -2364,9 +2364,9 @@ static int check_driver_busy (struct sock *sk) | |||
2364 | /*====================================================================== | 2364 | /*====================================================================== |
2365 | * wanpipe_accept | 2365 | * wanpipe_accept |
2366 | * | 2366 | * |
2367 | * ACCEPT() System call. X25API Specific function. | 2367 | * ACCEPT() System call. X25API Specific function. |
2368 | * For each incoming call, create a new socket and | 2368 | * For each incoming call, create a new socket and |
2369 | * return it to the user. | 2369 | * return it to the user. |
2370 | *=====================================================================*/ | 2370 | *=====================================================================*/ |
2371 | 2371 | ||
2372 | static int wanpipe_accept(struct socket *sock, struct socket *newsock, int flags) | 2372 | static int wanpipe_accept(struct socket *sock, struct socket *newsock, int flags) |
@@ -2378,10 +2378,10 @@ static int wanpipe_accept(struct socket *sock, struct socket *newsock, int flags | |||
2378 | int err=0; | 2378 | int err=0; |
2379 | 2379 | ||
2380 | if (newsock->sk != NULL){ | 2380 | if (newsock->sk != NULL){ |
2381 | wanpipe_kill_sock_accept(newsock->sk); | 2381 | wanpipe_kill_sock_accept(newsock->sk); |
2382 | newsock->sk=NULL; | 2382 | newsock->sk=NULL; |
2383 | } | 2383 | } |
2384 | 2384 | ||
2385 | if ((sk = sock->sk) == NULL) | 2385 | if ((sk = sock->sk) == NULL) |
2386 | return -EINVAL; | 2386 | return -EINVAL; |
2387 | 2387 | ||
@@ -2410,10 +2410,10 @@ static int wanpipe_accept(struct socket *sock, struct socket *newsock, int flags | |||
2410 | } | 2410 | } |
2411 | current->state = TASK_RUNNING; | 2411 | current->state = TASK_RUNNING; |
2412 | remove_wait_queue(sk->sk_sleep,&wait); | 2412 | remove_wait_queue(sk->sk_sleep,&wait); |
2413 | 2413 | ||
2414 | if (err != 0) | 2414 | if (err != 0) |
2415 | return err; | 2415 | return err; |
2416 | 2416 | ||
2417 | newsk = get_newsk_from_skb(skb); | 2417 | newsk = get_newsk_from_skb(skb); |
2418 | if (!newsk){ | 2418 | if (!newsk){ |
2419 | return -EINVAL; | 2419 | return -EINVAL; |
@@ -2431,7 +2431,7 @@ static int wanpipe_accept(struct socket *sock, struct socket *newsock, int flags | |||
2431 | /* Now attach up the new socket */ | 2431 | /* Now attach up the new socket */ |
2432 | sk->sk_ack_backlog--; | 2432 | sk->sk_ack_backlog--; |
2433 | newsock->sk = newsk; | 2433 | newsock->sk = newsk; |
2434 | 2434 | ||
2435 | kfree_skb(skb); | 2435 | kfree_skb(skb); |
2436 | 2436 | ||
2437 | DBG_PRINTK(KERN_INFO "\nwansock: ACCEPT Got LCN %i\n", | 2437 | DBG_PRINTK(KERN_INFO "\nwansock: ACCEPT Got LCN %i\n", |
@@ -2449,16 +2449,16 @@ static int wanpipe_accept(struct socket *sock, struct socket *newsock, int flags | |||
2449 | struct sock * get_newsk_from_skb (struct sk_buff *skb) | 2449 | struct sock * get_newsk_from_skb (struct sk_buff *skb) |
2450 | { | 2450 | { |
2451 | struct net_device *dev = skb->dev; | 2451 | struct net_device *dev = skb->dev; |
2452 | wanpipe_common_t *chan; | 2452 | wanpipe_common_t *chan; |
2453 | 2453 | ||
2454 | if (!dev){ | 2454 | if (!dev){ |
2455 | return NULL; | 2455 | return NULL; |
2456 | } | 2456 | } |
2457 | 2457 | ||
2458 | if ((chan = dev->priv) == NULL){ | 2458 | if ((chan = dev->priv) == NULL){ |
2459 | return NULL; | 2459 | return NULL; |
2460 | } | 2460 | } |
2461 | 2461 | ||
2462 | if (!chan->sk){ | 2462 | if (!chan->sk){ |
2463 | return NULL; | 2463 | return NULL; |
2464 | } | 2464 | } |
@@ -2470,7 +2470,7 @@ struct sock * get_newsk_from_skb (struct sk_buff *skb) | |||
2470 | * | 2470 | * |
2471 | * CONNECT() System Call. X25API specific function | 2471 | * CONNECT() System Call. X25API specific function |
2472 | * Check the state of the sock, and execute PLACE_CALL command. | 2472 | * Check the state of the sock, and execute PLACE_CALL command. |
2473 | * Connect can ether block or return without waiting for connection, | 2473 | * Connect can ether block or return without waiting for connection, |
2474 | * if specified by user. | 2474 | * if specified by user. |
2475 | *=====================================================================*/ | 2475 | *=====================================================================*/ |
2476 | 2476 | ||
@@ -2492,7 +2492,7 @@ static int wanpipe_connect(struct socket *sock, struct sockaddr *uaddr, int addr | |||
2492 | return -ECONNREFUSED; | 2492 | return -ECONNREFUSED; |
2493 | } | 2493 | } |
2494 | 2494 | ||
2495 | sk->sk_state = WANSOCK_DISCONNECTED; | 2495 | sk->sk_state = WANSOCK_DISCONNECTED; |
2496 | sock->state = SS_UNCONNECTED; | 2496 | sock->state = SS_UNCONNECTED; |
2497 | 2497 | ||
2498 | if (addr_len != sizeof(struct wan_sockaddr_ll)) | 2498 | if (addr_len != sizeof(struct wan_sockaddr_ll)) |
@@ -2505,7 +2505,7 @@ static int wanpipe_connect(struct socket *sock, struct sockaddr *uaddr, int addr | |||
2505 | return -ENETUNREACH; | 2505 | return -ENETUNREACH; |
2506 | 2506 | ||
2507 | dev_put(dev); | 2507 | dev_put(dev); |
2508 | 2508 | ||
2509 | if (!sock_flag(sk, SOCK_ZAPPED)) /* Must bind first - autobinding does not work */ | 2509 | if (!sock_flag(sk, SOCK_ZAPPED)) /* Must bind first - autobinding does not work */ |
2510 | return -EINVAL; | 2510 | return -EINVAL; |
2511 | 2511 | ||
@@ -2534,7 +2534,7 @@ static int wanpipe_connect(struct socket *sock, struct sockaddr *uaddr, int addr | |||
2534 | 2534 | ||
2535 | if (sk->sk_state != WANSOCK_CONNECTED) { | 2535 | if (sk->sk_state != WANSOCK_CONNECTED) { |
2536 | sock->state = SS_UNCONNECTED; | 2536 | sock->state = SS_UNCONNECTED; |
2537 | return -ECONNREFUSED; | 2537 | return -ECONNREFUSED; |
2538 | } | 2538 | } |
2539 | 2539 | ||
2540 | sock->state = SS_CONNECTED; | 2540 | sock->state = SS_CONNECTED; |
@@ -2549,10 +2549,10 @@ const struct proto_ops wanpipe_ops = { | |||
2549 | .connect = wanpipe_connect, | 2549 | .connect = wanpipe_connect, |
2550 | .socketpair = sock_no_socketpair, | 2550 | .socketpair = sock_no_socketpair, |
2551 | .accept = wanpipe_accept, | 2551 | .accept = wanpipe_accept, |
2552 | .getname = wanpipe_getname, | 2552 | .getname = wanpipe_getname, |
2553 | .poll = wanpipe_poll, | 2553 | .poll = wanpipe_poll, |
2554 | .ioctl = wanpipe_ioctl, | 2554 | .ioctl = wanpipe_ioctl, |
2555 | .listen = wanpipe_listen, | 2555 | .listen = wanpipe_listen, |
2556 | .shutdown = sock_no_shutdown, | 2556 | .shutdown = sock_no_shutdown, |
2557 | .setsockopt = sock_no_setsockopt, | 2557 | .setsockopt = sock_no_setsockopt, |
2558 | .getsockopt = sock_no_getsockopt, | 2558 | .getsockopt = sock_no_getsockopt, |
diff --git a/net/wanrouter/wanmain.c b/net/wanrouter/wanmain.c index 4d90a179aeda..5d2d93dc0837 100644 --- a/net/wanrouter/wanmain.c +++ b/net/wanrouter/wanmain.c | |||
@@ -314,10 +314,10 @@ __be16 wanrouter_type_trans(struct sk_buff *skb, struct net_device *dev) | |||
314 | cnt += 1; | 314 | cnt += 1; |
315 | break; | 315 | break; |
316 | 316 | ||
317 | case NLPID_SNAP: /* SNAP encapsulation */ | 317 | case NLPID_SNAP: /* SNAP encapsulation */ |
318 | if (memcmp(&skb->data[cnt + 1], wanrouter_oui_ether, | 318 | if (memcmp(&skb->data[cnt + 1], wanrouter_oui_ether, |
319 | sizeof(wanrouter_oui_ether))){ | 319 | sizeof(wanrouter_oui_ether))){ |
320 | printk(KERN_INFO | 320 | printk(KERN_INFO |
321 | "%s: unsupported SNAP OUI %02X-%02X-%02X " | 321 | "%s: unsupported SNAP OUI %02X-%02X-%02X " |
322 | "on interface %s!\n", wanrouter_modname, | 322 | "on interface %s!\n", wanrouter_modname, |
323 | skb->data[cnt+1], skb->data[cnt+2], | 323 | skb->data[cnt+1], skb->data[cnt+2], |
@@ -450,7 +450,7 @@ static int wanrouter_device_setup(struct wan_device *wandev, | |||
450 | kfree(conf); | 450 | kfree(conf); |
451 | printk(KERN_INFO "%s: ERROR, Invalid MAGIC Number\n", | 451 | printk(KERN_INFO "%s: ERROR, Invalid MAGIC Number\n", |
452 | wandev->name); | 452 | wandev->name); |
453 | return -EINVAL; | 453 | return -EINVAL; |
454 | } | 454 | } |
455 | 455 | ||
456 | if (conf->data_size && conf->data) { | 456 | if (conf->data_size && conf->data) { |
@@ -459,13 +459,13 @@ static int wanrouter_device_setup(struct wan_device *wandev, | |||
459 | "%s: ERROR, Invalid firmware data size %i !\n", | 459 | "%s: ERROR, Invalid firmware data size %i !\n", |
460 | wandev->name, conf->data_size); | 460 | wandev->name, conf->data_size); |
461 | kfree(conf); | 461 | kfree(conf); |
462 | return -EINVAL; | 462 | return -EINVAL; |
463 | } | 463 | } |
464 | 464 | ||
465 | data = vmalloc(conf->data_size); | 465 | data = vmalloc(conf->data_size); |
466 | if (!data) { | 466 | if (!data) { |
467 | printk(KERN_INFO | 467 | printk(KERN_INFO |
468 | "%s: ERROR, Faild allocate kernel memory !\n", | 468 | "%s: ERROR, Faild allocate kernel memory !\n", |
469 | wandev->name); | 469 | wandev->name); |
470 | kfree(conf); | 470 | kfree(conf); |
471 | return -ENOBUFS; | 471 | return -ENOBUFS; |
@@ -686,7 +686,7 @@ out: | |||
686 | static int wanrouter_device_del_if(struct wan_device *wandev, char __user *u_name) | 686 | static int wanrouter_device_del_if(struct wan_device *wandev, char __user *u_name) |
687 | { | 687 | { |
688 | char name[WAN_IFNAME_SZ + 1]; | 688 | char name[WAN_IFNAME_SZ + 1]; |
689 | int err = 0; | 689 | int err = 0; |
690 | 690 | ||
691 | if (wandev->state == WAN_UNCONFIGURED) | 691 | if (wandev->state == WAN_UNCONFIGURED) |
692 | return -ENODEV; | 692 | return -ENODEV; |
@@ -709,8 +709,8 @@ static int wanrouter_device_del_if(struct wan_device *wandev, char __user *u_nam | |||
709 | * interfaces are deleted and the link irrecoverably disconnected. | 709 | * interfaces are deleted and the link irrecoverably disconnected. |
710 | */ | 710 | */ |
711 | 711 | ||
712 | if (!wandev->ndev && wandev->shutdown) | 712 | if (!wandev->ndev && wandev->shutdown) |
713 | err = wandev->shutdown(wandev); | 713 | err = wandev->shutdown(wandev); |
714 | 714 | ||
715 | return err; | 715 | return err; |
716 | } | 716 | } |
@@ -804,7 +804,7 @@ static int wanrouter_delete_interface(struct wan_device *wandev, char *name) | |||
804 | 804 | ||
805 | static void lock_adapter_irq(spinlock_t *lock, unsigned long *smp_flags) | 805 | static void lock_adapter_irq(spinlock_t *lock, unsigned long *smp_flags) |
806 | { | 806 | { |
807 | spin_lock_irqsave(lock, *smp_flags); | 807 | spin_lock_irqsave(lock, *smp_flags); |
808 | } | 808 | } |
809 | 809 | ||
810 | 810 | ||
diff --git a/net/wanrouter/wanproc.c b/net/wanrouter/wanproc.c index 930ea59463ad..abce82873604 100644 --- a/net/wanrouter/wanproc.c +++ b/net/wanrouter/wanproc.c | |||
@@ -37,10 +37,10 @@ | |||
37 | 37 | ||
38 | #define PROT_DECODE(prot) ((prot == WANCONFIG_FR) ? " FR" :\ | 38 | #define PROT_DECODE(prot) ((prot == WANCONFIG_FR) ? " FR" :\ |
39 | (prot == WANCONFIG_X25) ? " X25" : \ | 39 | (prot == WANCONFIG_X25) ? " X25" : \ |
40 | (prot == WANCONFIG_PPP) ? " PPP" : \ | 40 | (prot == WANCONFIG_PPP) ? " PPP" : \ |
41 | (prot == WANCONFIG_CHDLC) ? " CHDLC": \ | 41 | (prot == WANCONFIG_CHDLC) ? " CHDLC": \ |
42 | (prot == WANCONFIG_MPPP) ? " MPPP" : \ | 42 | (prot == WANCONFIG_MPPP) ? " MPPP" : \ |
43 | " Unknown" ) | 43 | " Unknown" ) |
44 | 44 | ||
45 | /****** Function Prototypes *************************************************/ | 45 | /****** Function Prototypes *************************************************/ |
46 | 46 | ||