aboutsummaryrefslogtreecommitdiffstats
path: root/net/bluetooth/bnep/core.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/bluetooth/bnep/core.c')
-rw-r--r--net/bluetooth/bnep/core.c52
1 files changed, 26 insertions, 26 deletions
diff --git a/net/bluetooth/bnep/core.c b/net/bluetooth/bnep/core.c
index 7ba6470dc50..b85d1492c35 100644
--- a/net/bluetooth/bnep/core.c
+++ b/net/bluetooth/bnep/core.c
@@ -1,4 +1,4 @@
1/* 1/*
2 BNEP implementation for Linux Bluetooth stack (BlueZ). 2 BNEP implementation for Linux Bluetooth stack (BlueZ).
3 Copyright (C) 2001-2002 Inventel Systemes 3 Copyright (C) 2001-2002 Inventel Systemes
4 Written 2001-2002 by 4 Written 2001-2002 by
@@ -15,19 +15,19 @@
15 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. 16 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS.
17 IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY 17 IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY
18 CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES 18 CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES
19 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 19 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
20 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 20 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
21 OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 21 OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
22 22
23 ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, 23 ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS,
24 COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS 24 COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS
25 SOFTWARE IS DISCLAIMED. 25 SOFTWARE IS DISCLAIMED.
26*/ 26*/
27 27
28/* 28/*
29 * $Id: core.c,v 1.20 2002/08/04 21:23:58 maxk Exp $ 29 * $Id: core.c,v 1.20 2002/08/04 21:23:58 maxk Exp $
30 */ 30 */
31 31
32#include <linux/module.h> 32#include <linux/module.h>
33 33
@@ -74,7 +74,7 @@ static struct bnep_session *__bnep_get_session(u8 *dst)
74 BT_DBG(""); 74 BT_DBG("");
75 75
76 list_for_each(p, &bnep_session_list) { 76 list_for_each(p, &bnep_session_list) {
77 s = list_entry(p, struct bnep_session, list); 77 s = list_entry(p, struct bnep_session, list);
78 if (!compare_ether_addr(dst, s->eh.h_source)) 78 if (!compare_ether_addr(dst, s->eh.h_source))
79 return s; 79 return s;
80 } 80 }
@@ -87,7 +87,7 @@ static void __bnep_link_session(struct bnep_session *s)
87 by the socket layer which has to hold the refference to this module. 87 by the socket layer which has to hold the refference to this module.
88 */ 88 */
89 __module_get(THIS_MODULE); 89 __module_get(THIS_MODULE);
90 list_add(&s->list, &bnep_session_list); 90 list_add(&s->list, &bnep_session_list);
91} 91}
92 92
93static void __bnep_unlink_session(struct bnep_session *s) 93static void __bnep_unlink_session(struct bnep_session *s)
@@ -203,7 +203,7 @@ static int bnep_ctrl_set_mcfilter(struct bnep_session *s, u8 *data, int len)
203 203
204 memcpy(a1, data, ETH_ALEN); data += ETH_ALEN; 204 memcpy(a1, data, ETH_ALEN); data += ETH_ALEN;
205 a2 = data; data += ETH_ALEN; 205 a2 = data; data += ETH_ALEN;
206 206
207 BT_DBG("mc filter %s -> %s", 207 BT_DBG("mc filter %s -> %s",
208 batostr((void *) a1), batostr((void *) a2)); 208 batostr((void *) a1), batostr((void *) a2));
209 209
@@ -277,7 +277,7 @@ static int bnep_rx_extension(struct bnep_session *s, struct sk_buff *skb)
277 } 277 }
278 278
279 BT_DBG("type 0x%x len %d", h->type, h->len); 279 BT_DBG("type 0x%x len %d", h->type, h->len);
280 280
281 switch (h->type & BNEP_TYPE_MASK) { 281 switch (h->type & BNEP_TYPE_MASK) {
282 case BNEP_EXT_CONTROL: 282 case BNEP_EXT_CONTROL:
283 bnep_rx_control(s, skb->data, skb->len); 283 bnep_rx_control(s, skb->data, skb->len);
@@ -293,7 +293,7 @@ static int bnep_rx_extension(struct bnep_session *s, struct sk_buff *skb)
293 break; 293 break;
294 } 294 }
295 } while (!err && (h->type & BNEP_EXT_HEADER)); 295 } while (!err && (h->type & BNEP_EXT_HEADER));
296 296
297 return err; 297 return err;
298} 298}
299 299
@@ -319,7 +319,7 @@ static inline int bnep_rx_frame(struct bnep_session *s, struct sk_buff *skb)
319 319
320 if ((type & BNEP_TYPE_MASK) > BNEP_RX_TYPES) 320 if ((type & BNEP_TYPE_MASK) > BNEP_RX_TYPES)
321 goto badframe; 321 goto badframe;
322 322
323 if ((type & BNEP_TYPE_MASK) == BNEP_CONTROL) { 323 if ((type & BNEP_TYPE_MASK) == BNEP_CONTROL) {
324 bnep_rx_control(s, skb->data, skb->len); 324 bnep_rx_control(s, skb->data, skb->len);
325 kfree_skb(skb); 325 kfree_skb(skb);
@@ -345,7 +345,7 @@ static inline int bnep_rx_frame(struct bnep_session *s, struct sk_buff *skb)
345 goto badframe; 345 goto badframe;
346 s->eh.h_proto = get_unaligned((__be16 *) (skb->data - 2)); 346 s->eh.h_proto = get_unaligned((__be16 *) (skb->data - 2));
347 } 347 }
348 348
349 /* We have to alloc new skb and copy data here :(. Because original skb 349 /* We have to alloc new skb and copy data here :(. Because original skb
350 * may not be modified and because of the alignment requirements. */ 350 * may not be modified and because of the alignment requirements. */
351 nskb = alloc_skb(2 + ETH_HLEN + skb->len, GFP_KERNEL); 351 nskb = alloc_skb(2 + ETH_HLEN + skb->len, GFP_KERNEL);
@@ -361,7 +361,7 @@ static inline int bnep_rx_frame(struct bnep_session *s, struct sk_buff *skb)
361 case BNEP_COMPRESSED: 361 case BNEP_COMPRESSED:
362 memcpy(__skb_put(nskb, ETH_HLEN), &s->eh, ETH_HLEN); 362 memcpy(__skb_put(nskb, ETH_HLEN), &s->eh, ETH_HLEN);
363 break; 363 break;
364 364
365 case BNEP_COMPRESSED_SRC_ONLY: 365 case BNEP_COMPRESSED_SRC_ONLY:
366 memcpy(__skb_put(nskb, ETH_ALEN), s->eh.h_dest, ETH_ALEN); 366 memcpy(__skb_put(nskb, ETH_ALEN), s->eh.h_dest, ETH_ALEN);
367 memcpy(__skb_put(nskb, ETH_ALEN), skb->mac.raw, ETH_ALEN); 367 memcpy(__skb_put(nskb, ETH_ALEN), skb->mac.raw, ETH_ALEN);
@@ -381,7 +381,7 @@ static inline int bnep_rx_frame(struct bnep_session *s, struct sk_buff *skb)
381 381
382 memcpy(__skb_put(nskb, skb->len), skb->data, skb->len); 382 memcpy(__skb_put(nskb, skb->len), skb->data, skb->len);
383 kfree_skb(skb); 383 kfree_skb(skb);
384 384
385 s->stats.rx_packets++; 385 s->stats.rx_packets++;
386 nskb->dev = dev; 386 nskb->dev = dev;
387 nskb->ip_summed = CHECKSUM_NONE; 387 nskb->ip_summed = CHECKSUM_NONE;
@@ -435,7 +435,7 @@ static inline int bnep_tx_frame(struct bnep_session *s, struct sk_buff *skb)
435 iv[il++] = (struct kvec) { eh->h_source, ETH_ALEN }; 435 iv[il++] = (struct kvec) { eh->h_source, ETH_ALEN };
436 len += ETH_ALEN; 436 len += ETH_ALEN;
437 break; 437 break;
438 438
439 case BNEP_COMPRESSED_DST_ONLY: 439 case BNEP_COMPRESSED_DST_ONLY:
440 iv[il++] = (struct kvec) { eh->h_dest, ETH_ALEN }; 440 iv[il++] = (struct kvec) { eh->h_dest, ETH_ALEN };
441 len += ETH_ALEN; 441 len += ETH_ALEN;
@@ -445,7 +445,7 @@ static inline int bnep_tx_frame(struct bnep_session *s, struct sk_buff *skb)
445send: 445send:
446 iv[il++] = (struct kvec) { skb->data, skb->len }; 446 iv[il++] = (struct kvec) { skb->data, skb->len };
447 len += skb->len; 447 len += skb->len;
448 448
449 /* FIXME: linearize skb */ 449 /* FIXME: linearize skb */
450 { 450 {
451 len = kernel_sendmsg(sock, &s->msg, iv, il, len); 451 len = kernel_sendmsg(sock, &s->msg, iv, il, len);
@@ -471,7 +471,7 @@ static int bnep_session(void *arg)
471 471
472 BT_DBG(""); 472 BT_DBG("");
473 473
474 daemonize("kbnepd %s", dev->name); 474 daemonize("kbnepd %s", dev->name);
475 set_user_nice(current, -15); 475 set_user_nice(current, -15);
476 current->flags |= PF_NOFREEZE; 476 current->flags |= PF_NOFREEZE;
477 477
@@ -488,13 +488,13 @@ static int bnep_session(void *arg)
488 488
489 if (sk->sk_state != BT_CONNECTED) 489 if (sk->sk_state != BT_CONNECTED)
490 break; 490 break;
491 491
492 // TX 492 // TX
493 while ((skb = skb_dequeue(&sk->sk_write_queue))) 493 while ((skb = skb_dequeue(&sk->sk_write_queue)))
494 if (bnep_tx_frame(s, skb)) 494 if (bnep_tx_frame(s, skb))
495 break; 495 break;
496 netif_wake_queue(dev); 496 netif_wake_queue(dev);
497 497
498 schedule(); 498 schedule();
499 } 499 }
500 set_current_state(TASK_RUNNING); 500 set_current_state(TASK_RUNNING);
@@ -573,7 +573,7 @@ int bnep_add_connection(struct bnep_connadd_req *req, struct socket *sock)
573 s->sock = sock; 573 s->sock = sock;
574 s->role = req->role; 574 s->role = req->role;
575 s->state = BT_CONNECTED; 575 s->state = BT_CONNECTED;
576 576
577 s->msg.msg_flags = MSG_NOSIGNAL; 577 s->msg.msg_flags = MSG_NOSIGNAL;
578 578
579#ifdef CONFIG_BT_BNEP_MC_FILTER 579#ifdef CONFIG_BT_BNEP_MC_FILTER
@@ -594,7 +594,7 @@ int bnep_add_connection(struct bnep_connadd_req *req, struct socket *sock)
594 } 594 }
595 595
596 __bnep_link_session(s); 596 __bnep_link_session(s);
597 597
598 err = kernel_thread(bnep_session, s, CLONE_KERNEL); 598 err = kernel_thread(bnep_session, s, CLONE_KERNEL);
599 if (err < 0) { 599 if (err < 0) {
600 /* Session thread start failed, gotta cleanup. */ 600 /* Session thread start failed, gotta cleanup. */
@@ -627,7 +627,7 @@ int bnep_del_connection(struct bnep_conndel_req *req)
627 /* Wakeup user-space which is polling for socket errors. 627 /* Wakeup user-space which is polling for socket errors.
628 * This is temporary hack untill we have shutdown in L2CAP */ 628 * This is temporary hack untill we have shutdown in L2CAP */
629 s->sock->sk->sk_err = EUNATCH; 629 s->sock->sk->sk_err = EUNATCH;
630 630
631 /* Kill session thread */ 631 /* Kill session thread */
632 atomic_inc(&s->killed); 632 atomic_inc(&s->killed);
633 wake_up_interruptible(s->sock->sk->sk_sleep); 633 wake_up_interruptible(s->sock->sk->sk_sleep);
@@ -661,7 +661,7 @@ int bnep_get_connlist(struct bnep_connlist_req *req)
661 s = list_entry(p, struct bnep_session, list); 661 s = list_entry(p, struct bnep_session, list);
662 662
663 __bnep_copy_ci(&ci, s); 663 __bnep_copy_ci(&ci, s);
664 664
665 if (copy_to_user(req->ci, &ci, sizeof(ci))) { 665 if (copy_to_user(req->ci, &ci, sizeof(ci))) {
666 err = -EFAULT; 666 err = -EFAULT;
667 break; 667 break;
@@ -696,7 +696,7 @@ int bnep_get_conninfo(struct bnep_conninfo *ci)
696} 696}
697 697
698static int __init bnep_init(void) 698static int __init bnep_init(void)
699{ 699{
700 char flt[50] = ""; 700 char flt[50] = "";
701 701
702 l2cap_load(); 702 l2cap_load();