aboutsummaryrefslogtreecommitdiffstats
path: root/net/irda/irlan/irlan_common.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/irda/irlan/irlan_common.c')
-rw-r--r--net/irda/irlan/irlan_common.c82
1 files changed, 36 insertions, 46 deletions
diff --git a/net/irda/irlan/irlan_common.c b/net/irda/irlan/irlan_common.c
index 1eb4bbcb1c9e..9a1cd87e7142 100644
--- a/net/irda/irlan/irlan_common.c
+++ b/net/irda/irlan/irlan_common.c
@@ -54,13 +54,6 @@
54#include <net/irda/irlan_filter.h> 54#include <net/irda/irlan_filter.h>
55 55
56 56
57/*
58 * Send gratuitous ARP when connected to a new AP or not. May be a clever
59 * thing to do, but for some reason the machine crashes if you use DHCP. So
60 * lets not use it by default.
61 */
62#undef CONFIG_IRLAN_SEND_GRATUITOUS_ARP
63
64/* extern char sysctl_devname[]; */ 57/* extern char sysctl_devname[]; */
65 58
66/* 59/*
@@ -124,7 +117,7 @@ static int __init irlan_init(void)
124 struct irlan_cb *new; 117 struct irlan_cb *new;
125 __u16 hints; 118 __u16 hints;
126 119
127 IRDA_DEBUG(2, "%s()\n", __FUNCTION__ ); 120 IRDA_DEBUG(2, "%s()\n", __func__ );
128 121
129#ifdef CONFIG_PROC_FS 122#ifdef CONFIG_PROC_FS
130 { struct proc_dir_entry *proc; 123 { struct proc_dir_entry *proc;
@@ -136,7 +129,7 @@ static int __init irlan_init(void)
136 } 129 }
137#endif /* CONFIG_PROC_FS */ 130#endif /* CONFIG_PROC_FS */
138 131
139 IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); 132 IRDA_DEBUG(4, "%s()\n", __func__ );
140 hints = irlmp_service_to_hint(S_LAN); 133 hints = irlmp_service_to_hint(S_LAN);
141 134
142 /* Register with IrLMP as a client */ 135 /* Register with IrLMP as a client */
@@ -179,7 +172,7 @@ static void __exit irlan_cleanup(void)
179{ 172{
180 struct irlan_cb *self, *next; 173 struct irlan_cb *self, *next;
181 174
182 IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); 175 IRDA_DEBUG(4, "%s()\n", __func__ );
183 176
184 irlmp_unregister_client(ckey); 177 irlmp_unregister_client(ckey);
185 irlmp_unregister_service(skey); 178 irlmp_unregister_service(skey);
@@ -207,7 +200,7 @@ static struct irlan_cb *irlan_open(__u32 saddr, __u32 daddr)
207 struct net_device *dev; 200 struct net_device *dev;
208 struct irlan_cb *self; 201 struct irlan_cb *self;
209 202
210 IRDA_DEBUG(2, "%s()\n", __FUNCTION__ ); 203 IRDA_DEBUG(2, "%s()\n", __func__ );
211 204
212 /* Create network device with irlan */ 205 /* Create network device with irlan */
213 dev = alloc_irlandev(eth ? "eth%d" : "irlan%d"); 206 dev = alloc_irlandev(eth ? "eth%d" : "irlan%d");
@@ -252,7 +245,7 @@ static struct irlan_cb *irlan_open(__u32 saddr, __u32 daddr)
252 245
253 if (register_netdev(dev)) { 246 if (register_netdev(dev)) {
254 IRDA_DEBUG(2, "%s(), register_netdev() failed!\n", 247 IRDA_DEBUG(2, "%s(), register_netdev() failed!\n",
255 __FUNCTION__ ); 248 __func__ );
256 self = NULL; 249 self = NULL;
257 free_netdev(dev); 250 free_netdev(dev);
258 } else { 251 } else {
@@ -272,7 +265,7 @@ static struct irlan_cb *irlan_open(__u32 saddr, __u32 daddr)
272 */ 265 */
273static void __irlan_close(struct irlan_cb *self) 266static void __irlan_close(struct irlan_cb *self)
274{ 267{
275 IRDA_DEBUG(2, "%s()\n", __FUNCTION__ ); 268 IRDA_DEBUG(2, "%s()\n", __func__ );
276 269
277 ASSERT_RTNL(); 270 ASSERT_RTNL();
278 IRDA_ASSERT(self != NULL, return;); 271 IRDA_ASSERT(self != NULL, return;);
@@ -320,7 +313,7 @@ static void irlan_connect_indication(void *instance, void *sap,
320 struct irlan_cb *self; 313 struct irlan_cb *self;
321 struct tsap_cb *tsap; 314 struct tsap_cb *tsap;
322 315
323 IRDA_DEBUG(2, "%s()\n", __FUNCTION__ ); 316 IRDA_DEBUG(2, "%s()\n", __func__ );
324 317
325 self = (struct irlan_cb *) instance; 318 self = (struct irlan_cb *) instance;
326 tsap = (struct tsap_cb *) sap; 319 tsap = (struct tsap_cb *) sap;
@@ -332,7 +325,7 @@ static void irlan_connect_indication(void *instance, void *sap,
332 self->max_sdu_size = max_sdu_size; 325 self->max_sdu_size = max_sdu_size;
333 self->max_header_size = max_header_size; 326 self->max_header_size = max_header_size;
334 327
335 IRDA_DEBUG(0, "%s: We are now connected!\n", __FUNCTION__); 328 IRDA_DEBUG(0, "%s: We are now connected!\n", __func__);
336 329
337 del_timer(&self->watchdog_timer); 330 del_timer(&self->watchdog_timer);
338 331
@@ -376,7 +369,7 @@ static void irlan_connect_confirm(void *instance, void *sap,
376 369
377 /* TODO: we could set the MTU depending on the max_sdu_size */ 370 /* TODO: we could set the MTU depending on the max_sdu_size */
378 371
379 IRDA_DEBUG(0, "%s: We are now connected!\n", __FUNCTION__); 372 IRDA_DEBUG(0, "%s: We are now connected!\n", __func__);
380 del_timer(&self->watchdog_timer); 373 del_timer(&self->watchdog_timer);
381 374
382 /* 375 /*
@@ -393,9 +386,6 @@ static void irlan_connect_confirm(void *instance, void *sap,
393 /* Ready to transfer Ethernet frames */ 386 /* Ready to transfer Ethernet frames */
394 netif_start_queue(self->dev); 387 netif_start_queue(self->dev);
395 self->disconnect_reason = 0; /* Clear reason */ 388 self->disconnect_reason = 0; /* Clear reason */
396#ifdef CONFIG_IRLAN_SEND_GRATUITOUS_ARP
397 irlan_eth_send_gratuitous_arp(&self->dev);
398#endif
399 wake_up_interruptible(&self->open_wait); 389 wake_up_interruptible(&self->open_wait);
400} 390}
401 391
@@ -412,7 +402,7 @@ static void irlan_disconnect_indication(void *instance,
412 struct irlan_cb *self; 402 struct irlan_cb *self;
413 struct tsap_cb *tsap; 403 struct tsap_cb *tsap;
414 404
415 IRDA_DEBUG(0, "%s(), reason=%d\n", __FUNCTION__ , reason); 405 IRDA_DEBUG(0, "%s(), reason=%d\n", __func__ , reason);
416 406
417 self = (struct irlan_cb *) instance; 407 self = (struct irlan_cb *) instance;
418 tsap = (struct tsap_cb *) sap; 408 tsap = (struct tsap_cb *) sap;
@@ -431,22 +421,22 @@ static void irlan_disconnect_indication(void *instance,
431 421
432 switch (reason) { 422 switch (reason) {
433 case LM_USER_REQUEST: /* User request */ 423 case LM_USER_REQUEST: /* User request */
434 IRDA_DEBUG(2, "%s(), User requested\n", __FUNCTION__ ); 424 IRDA_DEBUG(2, "%s(), User requested\n", __func__ );
435 break; 425 break;
436 case LM_LAP_DISCONNECT: /* Unexpected IrLAP disconnect */ 426 case LM_LAP_DISCONNECT: /* Unexpected IrLAP disconnect */
437 IRDA_DEBUG(2, "%s(), Unexpected IrLAP disconnect\n", __FUNCTION__ ); 427 IRDA_DEBUG(2, "%s(), Unexpected IrLAP disconnect\n", __func__ );
438 break; 428 break;
439 case LM_CONNECT_FAILURE: /* Failed to establish IrLAP connection */ 429 case LM_CONNECT_FAILURE: /* Failed to establish IrLAP connection */
440 IRDA_DEBUG(2, "%s(), IrLAP connect failed\n", __FUNCTION__ ); 430 IRDA_DEBUG(2, "%s(), IrLAP connect failed\n", __func__ );
441 break; 431 break;
442 case LM_LAP_RESET: /* IrLAP reset */ 432 case LM_LAP_RESET: /* IrLAP reset */
443 IRDA_DEBUG(2, "%s(), IrLAP reset\n", __FUNCTION__ ); 433 IRDA_DEBUG(2, "%s(), IrLAP reset\n", __func__ );
444 break; 434 break;
445 case LM_INIT_DISCONNECT: 435 case LM_INIT_DISCONNECT:
446 IRDA_DEBUG(2, "%s(), IrLMP connect failed\n", __FUNCTION__ ); 436 IRDA_DEBUG(2, "%s(), IrLMP connect failed\n", __func__ );
447 break; 437 break;
448 default: 438 default:
449 IRDA_ERROR("%s(), Unknown disconnect reason\n", __FUNCTION__); 439 IRDA_ERROR("%s(), Unknown disconnect reason\n", __func__);
450 break; 440 break;
451 } 441 }
452 442
@@ -468,7 +458,7 @@ void irlan_open_data_tsap(struct irlan_cb *self)
468 struct tsap_cb *tsap; 458 struct tsap_cb *tsap;
469 notify_t notify; 459 notify_t notify;
470 460
471 IRDA_DEBUG(2, "%s()\n", __FUNCTION__ ); 461 IRDA_DEBUG(2, "%s()\n", __func__ );
472 462
473 IRDA_ASSERT(self != NULL, return;); 463 IRDA_ASSERT(self != NULL, return;);
474 IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); 464 IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;);
@@ -490,7 +480,7 @@ void irlan_open_data_tsap(struct irlan_cb *self)
490 480
491 tsap = irttp_open_tsap(LSAP_ANY, DEFAULT_INITIAL_CREDIT, &notify); 481 tsap = irttp_open_tsap(LSAP_ANY, DEFAULT_INITIAL_CREDIT, &notify);
492 if (!tsap) { 482 if (!tsap) {
493 IRDA_DEBUG(2, "%s(), Got no tsap!\n", __FUNCTION__ ); 483 IRDA_DEBUG(2, "%s(), Got no tsap!\n", __func__ );
494 return; 484 return;
495 } 485 }
496 self->tsap_data = tsap; 486 self->tsap_data = tsap;
@@ -504,7 +494,7 @@ void irlan_open_data_tsap(struct irlan_cb *self)
504 494
505void irlan_close_tsaps(struct irlan_cb *self) 495void irlan_close_tsaps(struct irlan_cb *self)
506{ 496{
507 IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); 497 IRDA_DEBUG(4, "%s()\n", __func__ );
508 498
509 IRDA_ASSERT(self != NULL, return;); 499 IRDA_ASSERT(self != NULL, return;);
510 IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); 500 IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;);
@@ -594,7 +584,7 @@ int irlan_run_ctrl_tx_queue(struct irlan_cb *self)
594{ 584{
595 struct sk_buff *skb; 585 struct sk_buff *skb;
596 586
597 IRDA_DEBUG(2, "%s()\n", __FUNCTION__ ); 587 IRDA_DEBUG(2, "%s()\n", __func__ );
598 588
599 if (irda_lock(&self->client.tx_busy) == FALSE) 589 if (irda_lock(&self->client.tx_busy) == FALSE)
600 return -EBUSY; 590 return -EBUSY;
@@ -613,7 +603,7 @@ int irlan_run_ctrl_tx_queue(struct irlan_cb *self)
613 dev_kfree_skb(skb); 603 dev_kfree_skb(skb);
614 return -1; 604 return -1;
615 } 605 }
616 IRDA_DEBUG(2, "%s(), sending ...\n", __FUNCTION__ ); 606 IRDA_DEBUG(2, "%s(), sending ...\n", __func__ );
617 607
618 return irttp_data_request(self->client.tsap_ctrl, skb); 608 return irttp_data_request(self->client.tsap_ctrl, skb);
619} 609}
@@ -626,7 +616,7 @@ int irlan_run_ctrl_tx_queue(struct irlan_cb *self)
626 */ 616 */
627static void irlan_ctrl_data_request(struct irlan_cb *self, struct sk_buff *skb) 617static void irlan_ctrl_data_request(struct irlan_cb *self, struct sk_buff *skb)
628{ 618{
629 IRDA_DEBUG(2, "%s()\n", __FUNCTION__ ); 619 IRDA_DEBUG(2, "%s()\n", __func__ );
630 620
631 /* Queue command */ 621 /* Queue command */
632 skb_queue_tail(&self->client.txq, skb); 622 skb_queue_tail(&self->client.txq, skb);
@@ -646,7 +636,7 @@ void irlan_get_provider_info(struct irlan_cb *self)
646 struct sk_buff *skb; 636 struct sk_buff *skb;
647 __u8 *frame; 637 __u8 *frame;
648 638
649 IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); 639 IRDA_DEBUG(4, "%s()\n", __func__ );
650 640
651 IRDA_ASSERT(self != NULL, return;); 641 IRDA_ASSERT(self != NULL, return;);
652 IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); 642 IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;);
@@ -679,7 +669,7 @@ void irlan_open_data_channel(struct irlan_cb *self)
679 struct sk_buff *skb; 669 struct sk_buff *skb;
680 __u8 *frame; 670 __u8 *frame;
681 671
682 IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); 672 IRDA_DEBUG(4, "%s()\n", __func__ );
683 673
684 IRDA_ASSERT(self != NULL, return;); 674 IRDA_ASSERT(self != NULL, return;);
685 IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); 675 IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;);
@@ -714,7 +704,7 @@ void irlan_close_data_channel(struct irlan_cb *self)
714 struct sk_buff *skb; 704 struct sk_buff *skb;
715 __u8 *frame; 705 __u8 *frame;
716 706
717 IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); 707 IRDA_DEBUG(4, "%s()\n", __func__ );
718 708
719 IRDA_ASSERT(self != NULL, return;); 709 IRDA_ASSERT(self != NULL, return;);
720 IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); 710 IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;);
@@ -755,7 +745,7 @@ static void irlan_open_unicast_addr(struct irlan_cb *self)
755 struct sk_buff *skb; 745 struct sk_buff *skb;
756 __u8 *frame; 746 __u8 *frame;
757 747
758 IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); 748 IRDA_DEBUG(4, "%s()\n", __func__ );
759 749
760 IRDA_ASSERT(self != NULL, return;); 750 IRDA_ASSERT(self != NULL, return;);
761 IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); 751 IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;);
@@ -797,7 +787,7 @@ void irlan_set_broadcast_filter(struct irlan_cb *self, int status)
797 struct sk_buff *skb; 787 struct sk_buff *skb;
798 __u8 *frame; 788 __u8 *frame;
799 789
800 IRDA_DEBUG(2, "%s()\n", __FUNCTION__ ); 790 IRDA_DEBUG(2, "%s()\n", __func__ );
801 791
802 IRDA_ASSERT(self != NULL, return;); 792 IRDA_ASSERT(self != NULL, return;);
803 IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); 793 IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;);
@@ -841,7 +831,7 @@ void irlan_set_multicast_filter(struct irlan_cb *self, int status)
841 struct sk_buff *skb; 831 struct sk_buff *skb;
842 __u8 *frame; 832 __u8 *frame;
843 833
844 IRDA_DEBUG(2, "%s()\n", __FUNCTION__ ); 834 IRDA_DEBUG(2, "%s()\n", __func__ );
845 835
846 IRDA_ASSERT(self != NULL, return;); 836 IRDA_ASSERT(self != NULL, return;);
847 IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); 837 IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;);
@@ -886,7 +876,7 @@ static void irlan_get_unicast_addr(struct irlan_cb *self)
886 struct sk_buff *skb; 876 struct sk_buff *skb;
887 __u8 *frame; 877 __u8 *frame;
888 878
889 IRDA_DEBUG(2, "%s()\n", __FUNCTION__ ); 879 IRDA_DEBUG(2, "%s()\n", __func__ );
890 880
891 IRDA_ASSERT(self != NULL, return;); 881 IRDA_ASSERT(self != NULL, return;);
892 IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); 882 IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;);
@@ -926,7 +916,7 @@ void irlan_get_media_char(struct irlan_cb *self)
926 struct sk_buff *skb; 916 struct sk_buff *skb;
927 __u8 *frame; 917 __u8 *frame;
928 918
929 IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); 919 IRDA_DEBUG(4, "%s()\n", __func__ );
930 920
931 IRDA_ASSERT(self != NULL, return;); 921 IRDA_ASSERT(self != NULL, return;);
932 IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); 922 IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;);
@@ -1014,7 +1004,7 @@ static int __irlan_insert_param(struct sk_buff *skb, char *param, int type,
1014 int n=0; 1004 int n=0;
1015 1005
1016 if (skb == NULL) { 1006 if (skb == NULL) {
1017 IRDA_DEBUG(2, "%s(), Got NULL skb\n", __FUNCTION__ ); 1007 IRDA_DEBUG(2, "%s(), Got NULL skb\n", __func__ );
1018 return 0; 1008 return 0;
1019 } 1009 }
1020 1010
@@ -1031,7 +1021,7 @@ static int __irlan_insert_param(struct sk_buff *skb, char *param, int type,
1031 IRDA_ASSERT(value_len > 0, return 0;); 1021 IRDA_ASSERT(value_len > 0, return 0;);
1032 break; 1022 break;
1033 default: 1023 default:
1034 IRDA_DEBUG(2, "%s(), Unknown parameter type!\n", __FUNCTION__ ); 1024 IRDA_DEBUG(2, "%s(), Unknown parameter type!\n", __func__ );
1035 return 0; 1025 return 0;
1036 break; 1026 break;
1037 } 1027 }
@@ -1041,7 +1031,7 @@ static int __irlan_insert_param(struct sk_buff *skb, char *param, int type,
1041 1031
1042 /* Make space for data */ 1032 /* Make space for data */
1043 if (skb_tailroom(skb) < (param_len+value_len+3)) { 1033 if (skb_tailroom(skb) < (param_len+value_len+3)) {
1044 IRDA_DEBUG(2, "%s(), No more space at end of skb\n", __FUNCTION__ ); 1034 IRDA_DEBUG(2, "%s(), No more space at end of skb\n", __func__ );
1045 return 0; 1035 return 0;
1046 } 1036 }
1047 skb_put(skb, param_len+value_len+3); 1037 skb_put(skb, param_len+value_len+3);
@@ -1088,13 +1078,13 @@ int irlan_extract_param(__u8 *buf, char *name, char *value, __u16 *len)
1088 __u16 val_len; 1078 __u16 val_len;
1089 int n=0; 1079 int n=0;
1090 1080
1091 IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); 1081 IRDA_DEBUG(4, "%s()\n", __func__ );
1092 1082
1093 /* get length of parameter name (1 byte) */ 1083 /* get length of parameter name (1 byte) */
1094 name_len = buf[n++]; 1084 name_len = buf[n++];
1095 1085
1096 if (name_len > 254) { 1086 if (name_len > 254) {
1097 IRDA_DEBUG(2, "%s(), name_len > 254\n", __FUNCTION__ ); 1087 IRDA_DEBUG(2, "%s(), name_len > 254\n", __func__ );
1098 return -RSP_INVALID_COMMAND_FORMAT; 1088 return -RSP_INVALID_COMMAND_FORMAT;
1099 } 1089 }
1100 1090
@@ -1111,7 +1101,7 @@ int irlan_extract_param(__u8 *buf, char *name, char *value, __u16 *len)
1111 le16_to_cpus(&val_len); n+=2; 1101 le16_to_cpus(&val_len); n+=2;
1112 1102
1113 if (val_len > 1016) { 1103 if (val_len > 1016) {
1114 IRDA_DEBUG(2, "%s(), parameter length to long\n", __FUNCTION__ ); 1104 IRDA_DEBUG(2, "%s(), parameter length to long\n", __func__ );
1115 return -RSP_INVALID_COMMAND_FORMAT; 1105 return -RSP_INVALID_COMMAND_FORMAT;
1116 } 1106 }
1117 *len = val_len; 1107 *len = val_len;