diff options
Diffstat (limited to 'net/irda/irlan/irlan_common.c')
-rw-r--r-- | net/irda/irlan/irlan_common.c | 318 |
1 files changed, 159 insertions, 159 deletions
diff --git a/net/irda/irlan/irlan_common.c b/net/irda/irlan/irlan_common.c index 310776dd6109..9c3dc57ff746 100644 --- a/net/irda/irlan/irlan_common.c +++ b/net/irda/irlan/irlan_common.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /********************************************************************* | 1 | /********************************************************************* |
2 | * | 2 | * |
3 | * Filename: irlan_common.c | 3 | * Filename: irlan_common.c |
4 | * Version: 0.9 | 4 | * Version: 0.9 |
5 | * Description: IrDA LAN Access Protocol Implementation | 5 | * Description: IrDA LAN Access Protocol Implementation |
@@ -8,17 +8,17 @@ | |||
8 | * Created at: Sun Aug 31 20:14:37 1997 | 8 | * Created at: Sun Aug 31 20:14:37 1997 |
9 | * Modified at: Sun Dec 26 21:53:10 1999 | 9 | * Modified at: Sun Dec 26 21:53:10 1999 |
10 | * Modified by: Dag Brattli <dagb@cs.uit.no> | 10 | * Modified by: Dag Brattli <dagb@cs.uit.no> |
11 | * | 11 | * |
12 | * Copyright (c) 1997, 1999 Dag Brattli <dagb@cs.uit.no>, | 12 | * Copyright (c) 1997, 1999 Dag Brattli <dagb@cs.uit.no>, |
13 | * All Rights Reserved. | 13 | * All Rights Reserved. |
14 | * | 14 | * |
15 | * This program is free software; you can redistribute it and/or | 15 | * This program is free software; you can redistribute it and/or |
16 | * modify it under the terms of the GNU General Public License as | 16 | * modify it under the terms of the GNU General Public License as |
17 | * published by the Free Software Foundation; either version 2 of | 17 | * published by the Free Software Foundation; either version 2 of |
18 | * the License, or (at your option) any later version. | 18 | * the License, or (at your option) any later version. |
19 | * | 19 | * |
20 | * Neither Dag Brattli nor University of Tromsų admit liability nor | 20 | * Neither Dag Brattli nor University of Tromsų admit liability nor |
21 | * provide warranty for any of this software. This material is | 21 | * provide warranty for any of this software. This material is |
22 | * provided "AS-IS" and at no charge. | 22 | * provided "AS-IS" and at no charge. |
23 | * | 23 | * |
24 | ********************************************************************/ | 24 | ********************************************************************/ |
@@ -49,12 +49,12 @@ | |||
49 | 49 | ||
50 | #include <net/irda/irlan_common.h> | 50 | #include <net/irda/irlan_common.h> |
51 | #include <net/irda/irlan_client.h> | 51 | #include <net/irda/irlan_client.h> |
52 | #include <net/irda/irlan_provider.h> | 52 | #include <net/irda/irlan_provider.h> |
53 | #include <net/irda/irlan_eth.h> | 53 | #include <net/irda/irlan_eth.h> |
54 | #include <net/irda/irlan_filter.h> | 54 | #include <net/irda/irlan_filter.h> |
55 | 55 | ||
56 | 56 | ||
57 | /* | 57 | /* |
58 | * Send gratuitous ARP when connected to a new AP or not. May be a clever | 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 | 59 | * thing to do, but for some reason the machine crashes if you use DHCP. So |
60 | * lets not use it by default. | 60 | * lets not use it by default. |
@@ -106,8 +106,8 @@ extern struct proc_dir_entry *proc_irda; | |||
106 | 106 | ||
107 | static struct irlan_cb *irlan_open(__u32 saddr, __u32 daddr); | 107 | static struct irlan_cb *irlan_open(__u32 saddr, __u32 daddr); |
108 | static void __irlan_close(struct irlan_cb *self); | 108 | static void __irlan_close(struct irlan_cb *self); |
109 | static int __irlan_insert_param(struct sk_buff *skb, char *param, int type, | 109 | static int __irlan_insert_param(struct sk_buff *skb, char *param, int type, |
110 | __u8 value_byte, __u16 value_short, | 110 | __u8 value_byte, __u16 value_short, |
111 | __u8 *value_array, __u16 value_len); | 111 | __u8 *value_array, __u16 value_len); |
112 | static void irlan_open_unicast_addr(struct irlan_cb *self); | 112 | static void irlan_open_unicast_addr(struct irlan_cb *self); |
113 | static void irlan_get_unicast_addr(struct irlan_cb *self); | 113 | static void irlan_get_unicast_addr(struct irlan_cb *self); |
@@ -177,7 +177,7 @@ err_ckey: | |||
177 | return -ENOMEM; | 177 | return -ENOMEM; |
178 | } | 178 | } |
179 | 179 | ||
180 | static void __exit irlan_cleanup(void) | 180 | static void __exit irlan_cleanup(void) |
181 | { | 181 | { |
182 | struct irlan_cb *self, *next; | 182 | struct irlan_cb *self, *next; |
183 | 183 | ||
@@ -201,7 +201,7 @@ static void __exit irlan_cleanup(void) | |||
201 | /* | 201 | /* |
202 | * Function irlan_open (void) | 202 | * Function irlan_open (void) |
203 | * | 203 | * |
204 | * Open new instance of a client/provider, we should only register the | 204 | * Open new instance of a client/provider, we should only register the |
205 | * network device if this instance is ment for a particular client/provider | 205 | * network device if this instance is ment for a particular client/provider |
206 | */ | 206 | */ |
207 | static struct irlan_cb *irlan_open(__u32 saddr, __u32 daddr) | 207 | static struct irlan_cb *irlan_open(__u32 saddr, __u32 daddr) |
@@ -229,9 +229,9 @@ static struct irlan_cb *irlan_open(__u32 saddr, __u32 daddr) | |||
229 | /* Provider access can only be PEER, DIRECT, or HOSTED */ | 229 | /* Provider access can only be PEER, DIRECT, or HOSTED */ |
230 | self->provider.access_type = access; | 230 | self->provider.access_type = access; |
231 | if (access == ACCESS_DIRECT) { | 231 | if (access == ACCESS_DIRECT) { |
232 | /* | 232 | /* |
233 | * Since we are emulating an IrLAN sever we will have to | 233 | * Since we are emulating an IrLAN sever we will have to |
234 | * give ourself an ethernet address! | 234 | * give ourself an ethernet address! |
235 | */ | 235 | */ |
236 | dev->dev_addr[0] = 0x40; | 236 | dev->dev_addr[0] = 0x40; |
237 | dev->dev_addr[1] = 0x00; | 237 | dev->dev_addr[1] = 0x00; |
@@ -245,15 +245,15 @@ static struct irlan_cb *irlan_open(__u32 saddr, __u32 daddr) | |||
245 | self->disconnect_reason = LM_USER_REQUEST; | 245 | self->disconnect_reason = LM_USER_REQUEST; |
246 | init_timer(&self->watchdog_timer); | 246 | init_timer(&self->watchdog_timer); |
247 | init_timer(&self->client.kick_timer); | 247 | init_timer(&self->client.kick_timer); |
248 | init_waitqueue_head(&self->open_wait); | 248 | init_waitqueue_head(&self->open_wait); |
249 | 249 | ||
250 | skb_queue_head_init(&self->client.txq); | 250 | skb_queue_head_init(&self->client.txq); |
251 | 251 | ||
252 | irlan_next_client_state(self, IRLAN_IDLE); | 252 | irlan_next_client_state(self, IRLAN_IDLE); |
253 | irlan_next_provider_state(self, IRLAN_IDLE); | 253 | irlan_next_provider_state(self, IRLAN_IDLE); |
254 | 254 | ||
255 | if (register_netdev(dev)) { | 255 | if (register_netdev(dev)) { |
256 | IRDA_DEBUG(2, "%s(), register_netdev() failed!\n", | 256 | IRDA_DEBUG(2, "%s(), register_netdev() failed!\n", |
257 | __FUNCTION__ ); | 257 | __FUNCTION__ ); |
258 | self = NULL; | 258 | self = NULL; |
259 | free_netdev(dev); | 259 | free_netdev(dev); |
@@ -268,14 +268,14 @@ static struct irlan_cb *irlan_open(__u32 saddr, __u32 daddr) | |||
268 | /* | 268 | /* |
269 | * Function __irlan_close (self) | 269 | * Function __irlan_close (self) |
270 | * | 270 | * |
271 | * This function closes and deallocates the IrLAN client instances. Be | 271 | * This function closes and deallocates the IrLAN client instances. Be |
272 | * aware that other functions which calls client_close() must | 272 | * aware that other functions which calls client_close() must |
273 | * remove self from irlans list first. | 273 | * remove self from irlans list first. |
274 | */ | 274 | */ |
275 | static void __irlan_close(struct irlan_cb *self) | 275 | static void __irlan_close(struct irlan_cb *self) |
276 | { | 276 | { |
277 | IRDA_DEBUG(2, "%s()\n", __FUNCTION__ ); | 277 | IRDA_DEBUG(2, "%s()\n", __FUNCTION__ ); |
278 | 278 | ||
279 | ASSERT_RTNL(); | 279 | ASSERT_RTNL(); |
280 | IRDA_ASSERT(self != NULL, return;); | 280 | IRDA_ASSERT(self != NULL, return;); |
281 | IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); | 281 | IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); |
@@ -285,8 +285,8 @@ static void __irlan_close(struct irlan_cb *self) | |||
285 | 285 | ||
286 | /* Close all open connections and remove TSAPs */ | 286 | /* Close all open connections and remove TSAPs */ |
287 | irlan_close_tsaps(self); | 287 | irlan_close_tsaps(self); |
288 | 288 | ||
289 | if (self->client.iriap) | 289 | if (self->client.iriap) |
290 | iriap_close(self->client.iriap); | 290 | iriap_close(self->client.iriap); |
291 | 291 | ||
292 | /* Remove frames queued on the control channel */ | 292 | /* Remove frames queued on the control channel */ |
@@ -316,17 +316,17 @@ struct irlan_cb *irlan_get_any(void) | |||
316 | static void irlan_connect_indication(void *instance, void *sap, | 316 | static void irlan_connect_indication(void *instance, void *sap, |
317 | struct qos_info *qos, | 317 | struct qos_info *qos, |
318 | __u32 max_sdu_size, | 318 | __u32 max_sdu_size, |
319 | __u8 max_header_size, | 319 | __u8 max_header_size, |
320 | struct sk_buff *skb) | 320 | struct sk_buff *skb) |
321 | { | 321 | { |
322 | struct irlan_cb *self; | 322 | struct irlan_cb *self; |
323 | struct tsap_cb *tsap; | 323 | struct tsap_cb *tsap; |
324 | 324 | ||
325 | IRDA_DEBUG(2, "%s()\n", __FUNCTION__ ); | 325 | IRDA_DEBUG(2, "%s()\n", __FUNCTION__ ); |
326 | 326 | ||
327 | self = (struct irlan_cb *) instance; | 327 | self = (struct irlan_cb *) instance; |
328 | tsap = (struct tsap_cb *) sap; | 328 | tsap = (struct tsap_cb *) sap; |
329 | 329 | ||
330 | IRDA_ASSERT(self != NULL, return;); | 330 | IRDA_ASSERT(self != NULL, return;); |
331 | IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); | 331 | IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); |
332 | IRDA_ASSERT(tsap == self->tsap_data,return;); | 332 | IRDA_ASSERT(tsap == self->tsap_data,return;); |
@@ -349,9 +349,9 @@ static void irlan_connect_indication(void *instance, void *sap, | |||
349 | irlan_do_client_event(self, IRLAN_DATA_CONNECT_INDICATION, NULL); | 349 | irlan_do_client_event(self, IRLAN_DATA_CONNECT_INDICATION, NULL); |
350 | 350 | ||
351 | if (self->provider.access_type == ACCESS_PEER) { | 351 | if (self->provider.access_type == ACCESS_PEER) { |
352 | /* | 352 | /* |
353 | * Data channel is open, so we are now allowed to | 353 | * Data channel is open, so we are now allowed to |
354 | * configure the remote filter | 354 | * configure the remote filter |
355 | */ | 355 | */ |
356 | irlan_get_unicast_addr(self); | 356 | irlan_get_unicast_addr(self); |
357 | irlan_open_unicast_addr(self); | 357 | irlan_open_unicast_addr(self); |
@@ -361,10 +361,10 @@ static void irlan_connect_indication(void *instance, void *sap, | |||
361 | } | 361 | } |
362 | 362 | ||
363 | static void irlan_connect_confirm(void *instance, void *sap, | 363 | static void irlan_connect_confirm(void *instance, void *sap, |
364 | struct qos_info *qos, | 364 | struct qos_info *qos, |
365 | __u32 max_sdu_size, | 365 | __u32 max_sdu_size, |
366 | __u8 max_header_size, | 366 | __u8 max_header_size, |
367 | struct sk_buff *skb) | 367 | struct sk_buff *skb) |
368 | { | 368 | { |
369 | struct irlan_cb *self; | 369 | struct irlan_cb *self; |
370 | 370 | ||
@@ -381,16 +381,16 @@ static void irlan_connect_confirm(void *instance, void *sap, | |||
381 | IRDA_DEBUG(0, "%s: We are now connected!\n", __FUNCTION__); | 381 | IRDA_DEBUG(0, "%s: We are now connected!\n", __FUNCTION__); |
382 | del_timer(&self->watchdog_timer); | 382 | del_timer(&self->watchdog_timer); |
383 | 383 | ||
384 | /* | 384 | /* |
385 | * Data channel is open, so we are now allowed to configure the remote | 385 | * Data channel is open, so we are now allowed to configure the remote |
386 | * filter | 386 | * filter |
387 | */ | 387 | */ |
388 | irlan_get_unicast_addr(self); | 388 | irlan_get_unicast_addr(self); |
389 | irlan_open_unicast_addr(self); | 389 | irlan_open_unicast_addr(self); |
390 | 390 | ||
391 | /* Open broadcast and multicast filter by default */ | 391 | /* Open broadcast and multicast filter by default */ |
392 | irlan_set_broadcast_filter(self, TRUE); | 392 | irlan_set_broadcast_filter(self, TRUE); |
393 | irlan_set_multicast_filter(self, TRUE); | 393 | irlan_set_multicast_filter(self, TRUE); |
394 | 394 | ||
395 | /* Ready to transfer Ethernet frames */ | 395 | /* Ready to transfer Ethernet frames */ |
396 | netif_start_queue(self->dev); | 396 | netif_start_queue(self->dev); |
@@ -408,29 +408,29 @@ static void irlan_connect_confirm(void *instance, void *sap, | |||
408 | * the specified connection (handle) | 408 | * the specified connection (handle) |
409 | */ | 409 | */ |
410 | static void irlan_disconnect_indication(void *instance, | 410 | static void irlan_disconnect_indication(void *instance, |
411 | void *sap, LM_REASON reason, | 411 | void *sap, LM_REASON reason, |
412 | struct sk_buff *userdata) | 412 | struct sk_buff *userdata) |
413 | { | 413 | { |
414 | struct irlan_cb *self; | 414 | struct irlan_cb *self; |
415 | struct tsap_cb *tsap; | 415 | struct tsap_cb *tsap; |
416 | 416 | ||
417 | IRDA_DEBUG(0, "%s(), reason=%d\n", __FUNCTION__ , reason); | 417 | IRDA_DEBUG(0, "%s(), reason=%d\n", __FUNCTION__ , reason); |
418 | 418 | ||
419 | self = (struct irlan_cb *) instance; | 419 | self = (struct irlan_cb *) instance; |
420 | tsap = (struct tsap_cb *) sap; | 420 | tsap = (struct tsap_cb *) sap; |
421 | 421 | ||
422 | IRDA_ASSERT(self != NULL, return;); | 422 | IRDA_ASSERT(self != NULL, return;); |
423 | IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); | 423 | IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); |
424 | IRDA_ASSERT(tsap != NULL, return;); | 424 | IRDA_ASSERT(tsap != NULL, return;); |
425 | IRDA_ASSERT(tsap->magic == TTP_TSAP_MAGIC, return;); | 425 | IRDA_ASSERT(tsap->magic == TTP_TSAP_MAGIC, return;); |
426 | 426 | ||
427 | IRDA_ASSERT(tsap == self->tsap_data, return;); | 427 | IRDA_ASSERT(tsap == self->tsap_data, return;); |
428 | 428 | ||
429 | IRDA_DEBUG(2, "IrLAN, data channel disconnected by peer!\n"); | 429 | IRDA_DEBUG(2, "IrLAN, data channel disconnected by peer!\n"); |
430 | 430 | ||
431 | /* Save reason so we know if we should try to reconnect or not */ | 431 | /* Save reason so we know if we should try to reconnect or not */ |
432 | self->disconnect_reason = reason; | 432 | self->disconnect_reason = reason; |
433 | 433 | ||
434 | switch (reason) { | 434 | switch (reason) { |
435 | case LM_USER_REQUEST: /* User request */ | 435 | case LM_USER_REQUEST: /* User request */ |
436 | IRDA_DEBUG(2, "%s(), User requested\n", __FUNCTION__ ); | 436 | IRDA_DEBUG(2, "%s(), User requested\n", __FUNCTION__ ); |
@@ -451,7 +451,7 @@ static void irlan_disconnect_indication(void *instance, | |||
451 | IRDA_ERROR("%s(), Unknown disconnect reason\n", __FUNCTION__); | 451 | IRDA_ERROR("%s(), Unknown disconnect reason\n", __FUNCTION__); |
452 | break; | 452 | break; |
453 | } | 453 | } |
454 | 454 | ||
455 | /* If you want to pass the skb to *both* state machines, you will | 455 | /* If you want to pass the skb to *both* state machines, you will |
456 | * need to skb_clone() it, so that you don't free it twice. | 456 | * need to skb_clone() it, so that you don't free it twice. |
457 | * As the state machines don't need it, git rid of it here... | 457 | * As the state machines don't need it, git rid of it here... |
@@ -461,7 +461,7 @@ static void irlan_disconnect_indication(void *instance, | |||
461 | 461 | ||
462 | irlan_do_client_event(self, IRLAN_LMP_DISCONNECT, NULL); | 462 | irlan_do_client_event(self, IRLAN_LMP_DISCONNECT, NULL); |
463 | irlan_do_provider_event(self, IRLAN_LMP_DISCONNECT, NULL); | 463 | irlan_do_provider_event(self, IRLAN_LMP_DISCONNECT, NULL); |
464 | 464 | ||
465 | wake_up_interruptible(&self->open_wait); | 465 | wake_up_interruptible(&self->open_wait); |
466 | } | 466 | } |
467 | 467 | ||
@@ -480,12 +480,12 @@ void irlan_open_data_tsap(struct irlan_cb *self) | |||
480 | return; | 480 | return; |
481 | 481 | ||
482 | irda_notify_init(¬ify); | 482 | irda_notify_init(¬ify); |
483 | 483 | ||
484 | notify.data_indication = irlan_eth_receive; | 484 | notify.data_indication = irlan_eth_receive; |
485 | notify.udata_indication = irlan_eth_receive; | 485 | notify.udata_indication = irlan_eth_receive; |
486 | notify.connect_indication = irlan_connect_indication; | 486 | notify.connect_indication = irlan_connect_indication; |
487 | notify.connect_confirm = irlan_connect_confirm; | 487 | notify.connect_confirm = irlan_connect_confirm; |
488 | notify.flow_indication = irlan_eth_flow_indication; | 488 | notify.flow_indication = irlan_eth_flow_indication; |
489 | notify.disconnect_indication = irlan_disconnect_indication; | 489 | notify.disconnect_indication = irlan_disconnect_indication; |
490 | notify.instance = self; | 490 | notify.instance = self; |
491 | strlcpy(notify.name, "IrLAN data", sizeof(notify.name)); | 491 | strlcpy(notify.name, "IrLAN data", sizeof(notify.name)); |
@@ -497,7 +497,7 @@ void irlan_open_data_tsap(struct irlan_cb *self) | |||
497 | } | 497 | } |
498 | self->tsap_data = tsap; | 498 | self->tsap_data = tsap; |
499 | 499 | ||
500 | /* | 500 | /* |
501 | * This is the data TSAP selector which we will pass to the client | 501 | * This is the data TSAP selector which we will pass to the client |
502 | * when the client ask for it. | 502 | * when the client ask for it. |
503 | */ | 503 | */ |
@@ -518,13 +518,13 @@ void irlan_close_tsaps(struct irlan_cb *self) | |||
518 | self->tsap_data = NULL; | 518 | self->tsap_data = NULL; |
519 | } | 519 | } |
520 | if (self->client.tsap_ctrl) { | 520 | if (self->client.tsap_ctrl) { |
521 | irttp_disconnect_request(self->client.tsap_ctrl, NULL, | 521 | irttp_disconnect_request(self->client.tsap_ctrl, NULL, |
522 | P_NORMAL); | 522 | P_NORMAL); |
523 | irttp_close_tsap(self->client.tsap_ctrl); | 523 | irttp_close_tsap(self->client.tsap_ctrl); |
524 | self->client.tsap_ctrl = NULL; | 524 | self->client.tsap_ctrl = NULL; |
525 | } | 525 | } |
526 | if (self->provider.tsap_ctrl) { | 526 | if (self->provider.tsap_ctrl) { |
527 | irttp_disconnect_request(self->provider.tsap_ctrl, NULL, | 527 | irttp_disconnect_request(self->provider.tsap_ctrl, NULL, |
528 | P_NORMAL); | 528 | P_NORMAL); |
529 | irttp_close_tsap(self->provider.tsap_ctrl); | 529 | irttp_close_tsap(self->provider.tsap_ctrl); |
530 | self->provider.tsap_ctrl = NULL; | 530 | self->provider.tsap_ctrl = NULL; |
@@ -545,8 +545,8 @@ void irlan_ias_register(struct irlan_cb *self, __u8 tsap_sel) | |||
545 | 545 | ||
546 | IRDA_ASSERT(self != NULL, return;); | 546 | IRDA_ASSERT(self != NULL, return;); |
547 | IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); | 547 | IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); |
548 | 548 | ||
549 | /* | 549 | /* |
550 | * Check if object has already been registered by a previous provider. | 550 | * Check if object has already been registered by a previous provider. |
551 | * If that is the case, we just change the value of the attribute | 551 | * If that is the case, we just change the value of the attribute |
552 | */ | 552 | */ |
@@ -560,9 +560,9 @@ void irlan_ias_register(struct irlan_cb *self, __u8 tsap_sel) | |||
560 | irias_object_change_attribute("IrLAN", "IrDA:TinyTP:LsapSel", | 560 | irias_object_change_attribute("IrLAN", "IrDA:TinyTP:LsapSel", |
561 | new_value); | 561 | new_value); |
562 | } | 562 | } |
563 | 563 | ||
564 | /* Register PnP object only if not registered before */ | 564 | /* Register PnP object only if not registered before */ |
565 | if (!irias_find_object("PnP")) { | 565 | if (!irias_find_object("PnP")) { |
566 | obj = irias_new_object("PnP", IAS_PNP_ID); | 566 | obj = irias_new_object("PnP", IAS_PNP_ID); |
567 | #if 0 | 567 | #if 0 |
568 | irias_add_string_attrib(obj, "Name", sysctl_devname, | 568 | irias_add_string_attrib(obj, "Name", sysctl_devname, |
@@ -606,10 +606,10 @@ int irlan_run_ctrl_tx_queue(struct irlan_cb *self) | |||
606 | self->client.tx_busy = FALSE; | 606 | self->client.tx_busy = FALSE; |
607 | return 0; | 607 | return 0; |
608 | } | 608 | } |
609 | 609 | ||
610 | /* Check that it's really possible to send commands */ | 610 | /* Check that it's really possible to send commands */ |
611 | if ((self->client.tsap_ctrl == NULL) || | 611 | if ((self->client.tsap_ctrl == NULL) || |
612 | (self->client.state == IRLAN_IDLE)) | 612 | (self->client.state == IRLAN_IDLE)) |
613 | { | 613 | { |
614 | self->client.tx_busy = FALSE; | 614 | self->client.tx_busy = FALSE; |
615 | dev_kfree_skb(skb); | 615 | dev_kfree_skb(skb); |
@@ -649,7 +649,7 @@ void irlan_get_provider_info(struct irlan_cb *self) | |||
649 | __u8 *frame; | 649 | __u8 *frame; |
650 | 650 | ||
651 | IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); | 651 | IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); |
652 | 652 | ||
653 | IRDA_ASSERT(self != NULL, return;); | 653 | IRDA_ASSERT(self != NULL, return;); |
654 | IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); | 654 | IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); |
655 | 655 | ||
@@ -661,12 +661,12 @@ void irlan_get_provider_info(struct irlan_cb *self) | |||
661 | /* Reserve space for TTP, LMP, and LAP header */ | 661 | /* Reserve space for TTP, LMP, and LAP header */ |
662 | skb_reserve(skb, self->client.max_header_size); | 662 | skb_reserve(skb, self->client.max_header_size); |
663 | skb_put(skb, 2); | 663 | skb_put(skb, 2); |
664 | 664 | ||
665 | frame = skb->data; | 665 | frame = skb->data; |
666 | 666 | ||
667 | frame[0] = CMD_GET_PROVIDER_INFO; | 667 | frame[0] = CMD_GET_PROVIDER_INFO; |
668 | frame[1] = 0x00; /* Zero parameters */ | 668 | frame[1] = 0x00; /* Zero parameters */ |
669 | 669 | ||
670 | irlan_ctrl_data_request(self, skb); | 670 | irlan_ctrl_data_request(self, skb); |
671 | } | 671 | } |
672 | 672 | ||
@@ -676,16 +676,16 @@ void irlan_get_provider_info(struct irlan_cb *self) | |||
676 | * Send an Open Data Command to provider | 676 | * Send an Open Data Command to provider |
677 | * | 677 | * |
678 | */ | 678 | */ |
679 | void irlan_open_data_channel(struct irlan_cb *self) | 679 | void irlan_open_data_channel(struct irlan_cb *self) |
680 | { | 680 | { |
681 | struct sk_buff *skb; | 681 | struct sk_buff *skb; |
682 | __u8 *frame; | 682 | __u8 *frame; |
683 | 683 | ||
684 | IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); | 684 | IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); |
685 | 685 | ||
686 | IRDA_ASSERT(self != NULL, return;); | 686 | IRDA_ASSERT(self != NULL, return;); |
687 | IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); | 687 | IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); |
688 | 688 | ||
689 | skb = alloc_skb(IRLAN_MAX_HEADER + IRLAN_CMD_HEADER + | 689 | skb = alloc_skb(IRLAN_MAX_HEADER + IRLAN_CMD_HEADER + |
690 | IRLAN_STRING_PARAMETER_LEN("MEDIA", "802.3") + | 690 | IRLAN_STRING_PARAMETER_LEN("MEDIA", "802.3") + |
691 | IRLAN_STRING_PARAMETER_LEN("ACCESS_TYPE", "DIRECT"), | 691 | IRLAN_STRING_PARAMETER_LEN("ACCESS_TYPE", "DIRECT"), |
@@ -695,11 +695,11 @@ void irlan_open_data_channel(struct irlan_cb *self) | |||
695 | 695 | ||
696 | skb_reserve(skb, self->client.max_header_size); | 696 | skb_reserve(skb, self->client.max_header_size); |
697 | skb_put(skb, 2); | 697 | skb_put(skb, 2); |
698 | 698 | ||
699 | frame = skb->data; | 699 | frame = skb->data; |
700 | 700 | ||
701 | /* Build frame */ | 701 | /* Build frame */ |
702 | frame[0] = CMD_OPEN_DATA_CHANNEL; | 702 | frame[0] = CMD_OPEN_DATA_CHANNEL; |
703 | frame[1] = 0x02; /* Two parameters */ | 703 | frame[1] = 0x02; /* Two parameters */ |
704 | 704 | ||
705 | irlan_insert_string_param(skb, "MEDIA", "802.3"); | 705 | irlan_insert_string_param(skb, "MEDIA", "802.3"); |
@@ -711,11 +711,11 @@ void irlan_open_data_channel(struct irlan_cb *self) | |||
711 | irlan_ctrl_data_request(self, skb); | 711 | irlan_ctrl_data_request(self, skb); |
712 | } | 712 | } |
713 | 713 | ||
714 | void irlan_close_data_channel(struct irlan_cb *self) | 714 | void irlan_close_data_channel(struct irlan_cb *self) |
715 | { | 715 | { |
716 | struct sk_buff *skb; | 716 | struct sk_buff *skb; |
717 | __u8 *frame; | 717 | __u8 *frame; |
718 | 718 | ||
719 | IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); | 719 | IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); |
720 | 720 | ||
721 | IRDA_ASSERT(self != NULL, return;); | 721 | IRDA_ASSERT(self != NULL, return;); |
@@ -733,11 +733,11 @@ void irlan_close_data_channel(struct irlan_cb *self) | |||
733 | 733 | ||
734 | skb_reserve(skb, self->client.max_header_size); | 734 | skb_reserve(skb, self->client.max_header_size); |
735 | skb_put(skb, 2); | 735 | skb_put(skb, 2); |
736 | 736 | ||
737 | frame = skb->data; | 737 | frame = skb->data; |
738 | 738 | ||
739 | /* Build frame */ | 739 | /* Build frame */ |
740 | frame[0] = CMD_CLOSE_DATA_CHAN; | 740 | frame[0] = CMD_CLOSE_DATA_CHAN; |
741 | frame[1] = 0x01; /* One parameter */ | 741 | frame[1] = 0x01; /* One parameter */ |
742 | 742 | ||
743 | irlan_insert_byte_param(skb, "DATA_CHAN", self->dtsap_sel_data); | 743 | irlan_insert_byte_param(skb, "DATA_CHAN", self->dtsap_sel_data); |
@@ -748,7 +748,7 @@ void irlan_close_data_channel(struct irlan_cb *self) | |||
748 | /* | 748 | /* |
749 | * Function irlan_open_unicast_addr (self) | 749 | * Function irlan_open_unicast_addr (self) |
750 | * | 750 | * |
751 | * Make IrLAN provider accept ethernet frames addressed to the unicast | 751 | * Make IrLAN provider accept ethernet frames addressed to the unicast |
752 | * address. | 752 | * address. |
753 | * | 753 | * |
754 | */ | 754 | */ |
@@ -756,12 +756,12 @@ static void irlan_open_unicast_addr(struct irlan_cb *self) | |||
756 | { | 756 | { |
757 | struct sk_buff *skb; | 757 | struct sk_buff *skb; |
758 | __u8 *frame; | 758 | __u8 *frame; |
759 | 759 | ||
760 | IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); | 760 | IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); |
761 | 761 | ||
762 | IRDA_ASSERT(self != NULL, return;); | 762 | IRDA_ASSERT(self != NULL, return;); |
763 | IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); | 763 | IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); |
764 | 764 | ||
765 | skb = alloc_skb(IRLAN_MAX_HEADER + IRLAN_CMD_HEADER + | 765 | skb = alloc_skb(IRLAN_MAX_HEADER + IRLAN_CMD_HEADER + |
766 | IRLAN_BYTE_PARAMETER_LEN("DATA_CHAN") + | 766 | IRLAN_BYTE_PARAMETER_LEN("DATA_CHAN") + |
767 | IRLAN_STRING_PARAMETER_LEN("FILTER_TYPE", "DIRECTED") + | 767 | IRLAN_STRING_PARAMETER_LEN("FILTER_TYPE", "DIRECTED") + |
@@ -773,15 +773,15 @@ static void irlan_open_unicast_addr(struct irlan_cb *self) | |||
773 | /* Reserve space for TTP, LMP, and LAP header */ | 773 | /* Reserve space for TTP, LMP, and LAP header */ |
774 | skb_reserve(skb, self->max_header_size); | 774 | skb_reserve(skb, self->max_header_size); |
775 | skb_put(skb, 2); | 775 | skb_put(skb, 2); |
776 | 776 | ||
777 | frame = skb->data; | 777 | frame = skb->data; |
778 | 778 | ||
779 | frame[0] = CMD_FILTER_OPERATION; | 779 | frame[0] = CMD_FILTER_OPERATION; |
780 | frame[1] = 0x03; /* Three parameters */ | 780 | frame[1] = 0x03; /* Three parameters */ |
781 | irlan_insert_byte_param(skb, "DATA_CHAN" , self->dtsap_sel_data); | 781 | irlan_insert_byte_param(skb, "DATA_CHAN" , self->dtsap_sel_data); |
782 | irlan_insert_string_param(skb, "FILTER_TYPE", "DIRECTED"); | 782 | irlan_insert_string_param(skb, "FILTER_TYPE", "DIRECTED"); |
783 | irlan_insert_string_param(skb, "FILTER_MODE", "FILTER"); | 783 | irlan_insert_string_param(skb, "FILTER_MODE", "FILTER"); |
784 | 784 | ||
785 | irlan_ctrl_data_request(self, skb); | 785 | irlan_ctrl_data_request(self, skb); |
786 | } | 786 | } |
787 | 787 | ||
@@ -794,17 +794,17 @@ static void irlan_open_unicast_addr(struct irlan_cb *self) | |||
794 | * one but then _we_ have to initiate all communication with other | 794 | * one but then _we_ have to initiate all communication with other |
795 | * hosts, since ARP request for this host will not be answered. | 795 | * hosts, since ARP request for this host will not be answered. |
796 | */ | 796 | */ |
797 | void irlan_set_broadcast_filter(struct irlan_cb *self, int status) | 797 | void irlan_set_broadcast_filter(struct irlan_cb *self, int status) |
798 | { | 798 | { |
799 | struct sk_buff *skb; | 799 | struct sk_buff *skb; |
800 | __u8 *frame; | 800 | __u8 *frame; |
801 | 801 | ||
802 | IRDA_DEBUG(2, "%s()\n", __FUNCTION__ ); | 802 | IRDA_DEBUG(2, "%s()\n", __FUNCTION__ ); |
803 | 803 | ||
804 | IRDA_ASSERT(self != NULL, return;); | 804 | IRDA_ASSERT(self != NULL, return;); |
805 | IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); | 805 | IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); |
806 | 806 | ||
807 | skb = alloc_skb(IRLAN_MAX_HEADER + IRLAN_CMD_HEADER + | 807 | skb = alloc_skb(IRLAN_MAX_HEADER + IRLAN_CMD_HEADER + |
808 | IRLAN_BYTE_PARAMETER_LEN("DATA_CHAN") + | 808 | IRLAN_BYTE_PARAMETER_LEN("DATA_CHAN") + |
809 | IRLAN_STRING_PARAMETER_LEN("FILTER_TYPE", "BROADCAST") + | 809 | IRLAN_STRING_PARAMETER_LEN("FILTER_TYPE", "BROADCAST") + |
810 | /* We may waste one byte here...*/ | 810 | /* We may waste one byte here...*/ |
@@ -816,17 +816,17 @@ void irlan_set_broadcast_filter(struct irlan_cb *self, int status) | |||
816 | /* Reserve space for TTP, LMP, and LAP header */ | 816 | /* Reserve space for TTP, LMP, and LAP header */ |
817 | skb_reserve(skb, self->client.max_header_size); | 817 | skb_reserve(skb, self->client.max_header_size); |
818 | skb_put(skb, 2); | 818 | skb_put(skb, 2); |
819 | 819 | ||
820 | frame = skb->data; | 820 | frame = skb->data; |
821 | 821 | ||
822 | frame[0] = CMD_FILTER_OPERATION; | 822 | frame[0] = CMD_FILTER_OPERATION; |
823 | frame[1] = 0x03; /* Three parameters */ | 823 | frame[1] = 0x03; /* Three parameters */ |
824 | irlan_insert_byte_param(skb, "DATA_CHAN", self->dtsap_sel_data); | 824 | irlan_insert_byte_param(skb, "DATA_CHAN", self->dtsap_sel_data); |
825 | irlan_insert_string_param(skb, "FILTER_TYPE", "BROADCAST"); | 825 | irlan_insert_string_param(skb, "FILTER_TYPE", "BROADCAST"); |
826 | if (status) | 826 | if (status) |
827 | irlan_insert_string_param(skb, "FILTER_MODE", "FILTER"); | 827 | irlan_insert_string_param(skb, "FILTER_MODE", "FILTER"); |
828 | else | 828 | else |
829 | irlan_insert_string_param(skb, "FILTER_MODE", "NONE"); | 829 | irlan_insert_string_param(skb, "FILTER_MODE", "NONE"); |
830 | 830 | ||
831 | irlan_ctrl_data_request(self, skb); | 831 | irlan_ctrl_data_request(self, skb); |
832 | } | 832 | } |
@@ -835,14 +835,14 @@ void irlan_set_broadcast_filter(struct irlan_cb *self, int status) | |||
835 | * Function irlan_set_multicast_filter (self, status) | 835 | * Function irlan_set_multicast_filter (self, status) |
836 | * | 836 | * |
837 | * Make IrLAN provider accept ethernet frames addressed to the multicast | 837 | * Make IrLAN provider accept ethernet frames addressed to the multicast |
838 | * address. | 838 | * address. |
839 | * | 839 | * |
840 | */ | 840 | */ |
841 | void irlan_set_multicast_filter(struct irlan_cb *self, int status) | 841 | void irlan_set_multicast_filter(struct irlan_cb *self, int status) |
842 | { | 842 | { |
843 | struct sk_buff *skb; | 843 | struct sk_buff *skb; |
844 | __u8 *frame; | 844 | __u8 *frame; |
845 | 845 | ||
846 | IRDA_DEBUG(2, "%s()\n", __FUNCTION__ ); | 846 | IRDA_DEBUG(2, "%s()\n", __FUNCTION__ ); |
847 | 847 | ||
848 | IRDA_ASSERT(self != NULL, return;); | 848 | IRDA_ASSERT(self != NULL, return;); |
@@ -856,21 +856,21 @@ void irlan_set_multicast_filter(struct irlan_cb *self, int status) | |||
856 | GFP_ATOMIC); | 856 | GFP_ATOMIC); |
857 | if (!skb) | 857 | if (!skb) |
858 | return; | 858 | return; |
859 | 859 | ||
860 | /* Reserve space for TTP, LMP, and LAP header */ | 860 | /* Reserve space for TTP, LMP, and LAP header */ |
861 | skb_reserve(skb, self->client.max_header_size); | 861 | skb_reserve(skb, self->client.max_header_size); |
862 | skb_put(skb, 2); | 862 | skb_put(skb, 2); |
863 | 863 | ||
864 | frame = skb->data; | 864 | frame = skb->data; |
865 | 865 | ||
866 | frame[0] = CMD_FILTER_OPERATION; | 866 | frame[0] = CMD_FILTER_OPERATION; |
867 | frame[1] = 0x03; /* Three parameters */ | 867 | frame[1] = 0x03; /* Three parameters */ |
868 | irlan_insert_byte_param(skb, "DATA_CHAN", self->dtsap_sel_data); | 868 | irlan_insert_byte_param(skb, "DATA_CHAN", self->dtsap_sel_data); |
869 | irlan_insert_string_param(skb, "FILTER_TYPE", "MULTICAST"); | 869 | irlan_insert_string_param(skb, "FILTER_TYPE", "MULTICAST"); |
870 | if (status) | 870 | if (status) |
871 | irlan_insert_string_param(skb, "FILTER_MODE", "ALL"); | 871 | irlan_insert_string_param(skb, "FILTER_MODE", "ALL"); |
872 | else | 872 | else |
873 | irlan_insert_string_param(skb, "FILTER_MODE", "NONE"); | 873 | irlan_insert_string_param(skb, "FILTER_MODE", "NONE"); |
874 | 874 | ||
875 | irlan_ctrl_data_request(self, skb); | 875 | irlan_ctrl_data_request(self, skb); |
876 | } | 876 | } |
@@ -887,12 +887,12 @@ static void irlan_get_unicast_addr(struct irlan_cb *self) | |||
887 | { | 887 | { |
888 | struct sk_buff *skb; | 888 | struct sk_buff *skb; |
889 | __u8 *frame; | 889 | __u8 *frame; |
890 | 890 | ||
891 | IRDA_DEBUG(2, "%s()\n", __FUNCTION__ ); | 891 | IRDA_DEBUG(2, "%s()\n", __FUNCTION__ ); |
892 | 892 | ||
893 | IRDA_ASSERT(self != NULL, return;); | 893 | IRDA_ASSERT(self != NULL, return;); |
894 | IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); | 894 | IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); |
895 | 895 | ||
896 | skb = alloc_skb(IRLAN_MAX_HEADER + IRLAN_CMD_HEADER + | 896 | skb = alloc_skb(IRLAN_MAX_HEADER + IRLAN_CMD_HEADER + |
897 | IRLAN_BYTE_PARAMETER_LEN("DATA_CHAN") + | 897 | IRLAN_BYTE_PARAMETER_LEN("DATA_CHAN") + |
898 | IRLAN_STRING_PARAMETER_LEN("FILTER_TYPE", "DIRECTED") + | 898 | IRLAN_STRING_PARAMETER_LEN("FILTER_TYPE", "DIRECTED") + |
@@ -905,34 +905,34 @@ static void irlan_get_unicast_addr(struct irlan_cb *self) | |||
905 | /* Reserve space for TTP, LMP, and LAP header */ | 905 | /* Reserve space for TTP, LMP, and LAP header */ |
906 | skb_reserve(skb, self->client.max_header_size); | 906 | skb_reserve(skb, self->client.max_header_size); |
907 | skb_put(skb, 2); | 907 | skb_put(skb, 2); |
908 | 908 | ||
909 | frame = skb->data; | 909 | frame = skb->data; |
910 | 910 | ||
911 | frame[0] = CMD_FILTER_OPERATION; | 911 | frame[0] = CMD_FILTER_OPERATION; |
912 | frame[1] = 0x03; /* Three parameters */ | 912 | frame[1] = 0x03; /* Three parameters */ |
913 | irlan_insert_byte_param(skb, "DATA_CHAN", self->dtsap_sel_data); | 913 | irlan_insert_byte_param(skb, "DATA_CHAN", self->dtsap_sel_data); |
914 | irlan_insert_string_param(skb, "FILTER_TYPE", "DIRECTED"); | 914 | irlan_insert_string_param(skb, "FILTER_TYPE", "DIRECTED"); |
915 | irlan_insert_string_param(skb, "FILTER_OPERATION", "DYNAMIC"); | 915 | irlan_insert_string_param(skb, "FILTER_OPERATION", "DYNAMIC"); |
916 | 916 | ||
917 | irlan_ctrl_data_request(self, skb); | 917 | irlan_ctrl_data_request(self, skb); |
918 | } | 918 | } |
919 | 919 | ||
920 | /* | 920 | /* |
921 | * Function irlan_get_media_char (self) | 921 | * Function irlan_get_media_char (self) |
922 | * | 922 | * |
923 | * | 923 | * |
924 | * | 924 | * |
925 | */ | 925 | */ |
926 | void irlan_get_media_char(struct irlan_cb *self) | 926 | void irlan_get_media_char(struct irlan_cb *self) |
927 | { | 927 | { |
928 | struct sk_buff *skb; | 928 | struct sk_buff *skb; |
929 | __u8 *frame; | 929 | __u8 *frame; |
930 | 930 | ||
931 | IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); | 931 | IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); |
932 | 932 | ||
933 | IRDA_ASSERT(self != NULL, return;); | 933 | IRDA_ASSERT(self != NULL, return;); |
934 | IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); | 934 | IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); |
935 | 935 | ||
936 | skb = alloc_skb(IRLAN_MAX_HEADER + IRLAN_CMD_HEADER + | 936 | skb = alloc_skb(IRLAN_MAX_HEADER + IRLAN_CMD_HEADER + |
937 | IRLAN_STRING_PARAMETER_LEN("MEDIA", "802.3"), | 937 | IRLAN_STRING_PARAMETER_LEN("MEDIA", "802.3"), |
938 | GFP_ATOMIC); | 938 | GFP_ATOMIC); |
@@ -943,13 +943,13 @@ void irlan_get_media_char(struct irlan_cb *self) | |||
943 | /* Reserve space for TTP, LMP, and LAP header */ | 943 | /* Reserve space for TTP, LMP, and LAP header */ |
944 | skb_reserve(skb, self->client.max_header_size); | 944 | skb_reserve(skb, self->client.max_header_size); |
945 | skb_put(skb, 2); | 945 | skb_put(skb, 2); |
946 | 946 | ||
947 | frame = skb->data; | 947 | frame = skb->data; |
948 | 948 | ||
949 | /* Build frame */ | 949 | /* Build frame */ |
950 | frame[0] = CMD_GET_MEDIA_CHAR; | 950 | frame[0] = CMD_GET_MEDIA_CHAR; |
951 | frame[1] = 0x01; /* One parameter */ | 951 | frame[1] = 0x01; /* One parameter */ |
952 | 952 | ||
953 | irlan_insert_string_param(skb, "MEDIA", "802.3"); | 953 | irlan_insert_string_param(skb, "MEDIA", "802.3"); |
954 | irlan_ctrl_data_request(self, skb); | 954 | irlan_ctrl_data_request(self, skb); |
955 | } | 955 | } |
@@ -980,7 +980,7 @@ int irlan_insert_string_param(struct sk_buff *skb, char *param, char *string) | |||
980 | { | 980 | { |
981 | int string_len = strlen(string); | 981 | int string_len = strlen(string); |
982 | 982 | ||
983 | return __irlan_insert_param(skb, param, IRLAN_ARRAY, 0, 0, string, | 983 | return __irlan_insert_param(skb, param, IRLAN_ARRAY, 0, 0, string, |
984 | string_len); | 984 | string_len); |
985 | } | 985 | } |
986 | 986 | ||
@@ -993,7 +993,7 @@ int irlan_insert_string_param(struct sk_buff *skb, char *param, char *string) | |||
993 | int irlan_insert_array_param(struct sk_buff *skb, char *name, __u8 *array, | 993 | int irlan_insert_array_param(struct sk_buff *skb, char *name, __u8 *array, |
994 | __u16 array_len) | 994 | __u16 array_len) |
995 | { | 995 | { |
996 | return __irlan_insert_param(skb, name, IRLAN_ARRAY, 0, 0, array, | 996 | return __irlan_insert_param(skb, name, IRLAN_ARRAY, 0, 0, array, |
997 | array_len); | 997 | array_len); |
998 | } | 998 | } |
999 | 999 | ||
@@ -1006,19 +1006,19 @@ int irlan_insert_array_param(struct sk_buff *skb, char *name, __u8 *array, | |||
1006 | * | Name Length[1] | Param Name[1..255] | Val Length[2] | Value[0..1016]| | 1006 | * | Name Length[1] | Param Name[1..255] | Val Length[2] | Value[0..1016]| |
1007 | * ----------------------------------------------------------------------- | 1007 | * ----------------------------------------------------------------------- |
1008 | */ | 1008 | */ |
1009 | static int __irlan_insert_param(struct sk_buff *skb, char *param, int type, | 1009 | static int __irlan_insert_param(struct sk_buff *skb, char *param, int type, |
1010 | __u8 value_byte, __u16 value_short, | 1010 | __u8 value_byte, __u16 value_short, |
1011 | __u8 *value_array, __u16 value_len) | 1011 | __u8 *value_array, __u16 value_len) |
1012 | { | 1012 | { |
1013 | __u8 *frame; | 1013 | __u8 *frame; |
1014 | __u8 param_len; | 1014 | __u8 param_len; |
1015 | __le16 tmp_le; /* Temporary value in little endian format */ | 1015 | __le16 tmp_le; /* Temporary value in little endian format */ |
1016 | int n=0; | 1016 | int n=0; |
1017 | 1017 | ||
1018 | if (skb == NULL) { | 1018 | if (skb == NULL) { |
1019 | IRDA_DEBUG(2, "%s(), Got NULL skb\n", __FUNCTION__ ); | 1019 | IRDA_DEBUG(2, "%s(), Got NULL skb\n", __FUNCTION__ ); |
1020 | return 0; | 1020 | return 0; |
1021 | } | 1021 | } |
1022 | 1022 | ||
1023 | param_len = strlen(param); | 1023 | param_len = strlen(param); |
1024 | switch (type) { | 1024 | switch (type) { |
@@ -1037,7 +1037,7 @@ static int __irlan_insert_param(struct sk_buff *skb, char *param, int type, | |||
1037 | return 0; | 1037 | return 0; |
1038 | break; | 1038 | break; |
1039 | } | 1039 | } |
1040 | 1040 | ||
1041 | /* Insert at end of sk-buffer */ | 1041 | /* Insert at end of sk-buffer */ |
1042 | frame = skb->tail; | 1042 | frame = skb->tail; |
1043 | 1043 | ||
@@ -1045,15 +1045,15 @@ static int __irlan_insert_param(struct sk_buff *skb, char *param, int type, | |||
1045 | if (skb_tailroom(skb) < (param_len+value_len+3)) { | 1045 | if (skb_tailroom(skb) < (param_len+value_len+3)) { |
1046 | IRDA_DEBUG(2, "%s(), No more space at end of skb\n", __FUNCTION__ ); | 1046 | IRDA_DEBUG(2, "%s(), No more space at end of skb\n", __FUNCTION__ ); |
1047 | return 0; | 1047 | return 0; |
1048 | } | 1048 | } |
1049 | skb_put(skb, param_len+value_len+3); | 1049 | skb_put(skb, param_len+value_len+3); |
1050 | 1050 | ||
1051 | /* Insert parameter length */ | 1051 | /* Insert parameter length */ |
1052 | frame[n++] = param_len; | 1052 | frame[n++] = param_len; |
1053 | 1053 | ||
1054 | /* Insert parameter */ | 1054 | /* Insert parameter */ |
1055 | memcpy(frame+n, param, param_len); n += param_len; | 1055 | memcpy(frame+n, param, param_len); n += param_len; |
1056 | 1056 | ||
1057 | /* Insert value length (2 byte little endian format, LSB first) */ | 1057 | /* Insert value length (2 byte little endian format, LSB first) */ |
1058 | tmp_le = cpu_to_le16(value_len); | 1058 | tmp_le = cpu_to_le16(value_len); |
1059 | memcpy(frame+n, &tmp_le, 2); n += 2; /* To avoid alignment problems */ | 1059 | memcpy(frame+n, &tmp_le, 2); n += 2; /* To avoid alignment problems */ |
@@ -1082,36 +1082,36 @@ static int __irlan_insert_param(struct sk_buff *skb, char *param, int type, | |||
1082 | * Function irlan_extract_param (buf, name, value, len) | 1082 | * Function irlan_extract_param (buf, name, value, len) |
1083 | * | 1083 | * |
1084 | * Extracts a single parameter name/value pair from buffer and updates | 1084 | * Extracts a single parameter name/value pair from buffer and updates |
1085 | * the buffer pointer to point to the next name/value pair. | 1085 | * the buffer pointer to point to the next name/value pair. |
1086 | */ | 1086 | */ |
1087 | int irlan_extract_param(__u8 *buf, char *name, char *value, __u16 *len) | 1087 | int irlan_extract_param(__u8 *buf, char *name, char *value, __u16 *len) |
1088 | { | 1088 | { |
1089 | __u8 name_len; | 1089 | __u8 name_len; |
1090 | __u16 val_len; | 1090 | __u16 val_len; |
1091 | int n=0; | 1091 | int n=0; |
1092 | 1092 | ||
1093 | IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); | 1093 | IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); |
1094 | 1094 | ||
1095 | /* get length of parameter name (1 byte) */ | 1095 | /* get length of parameter name (1 byte) */ |
1096 | name_len = buf[n++]; | 1096 | name_len = buf[n++]; |
1097 | 1097 | ||
1098 | if (name_len > 254) { | 1098 | if (name_len > 254) { |
1099 | IRDA_DEBUG(2, "%s(), name_len > 254\n", __FUNCTION__ ); | 1099 | IRDA_DEBUG(2, "%s(), name_len > 254\n", __FUNCTION__ ); |
1100 | return -RSP_INVALID_COMMAND_FORMAT; | 1100 | return -RSP_INVALID_COMMAND_FORMAT; |
1101 | } | 1101 | } |
1102 | 1102 | ||
1103 | /* get parameter name */ | 1103 | /* get parameter name */ |
1104 | memcpy(name, buf+n, name_len); | 1104 | memcpy(name, buf+n, name_len); |
1105 | name[name_len] = '\0'; | 1105 | name[name_len] = '\0'; |
1106 | n+=name_len; | 1106 | n+=name_len; |
1107 | 1107 | ||
1108 | /* | 1108 | /* |
1109 | * Get length of parameter value (2 bytes in little endian | 1109 | * Get length of parameter value (2 bytes in little endian |
1110 | * format) | 1110 | * format) |
1111 | */ | 1111 | */ |
1112 | memcpy(&val_len, buf+n, 2); /* To avoid alignment problems */ | 1112 | memcpy(&val_len, buf+n, 2); /* To avoid alignment problems */ |
1113 | le16_to_cpus(&val_len); n+=2; | 1113 | le16_to_cpus(&val_len); n+=2; |
1114 | 1114 | ||
1115 | if (val_len > 1016) { | 1115 | if (val_len > 1016) { |
1116 | IRDA_DEBUG(2, "%s(), parameter length to long\n", __FUNCTION__ ); | 1116 | IRDA_DEBUG(2, "%s(), parameter length to long\n", __FUNCTION__ ); |
1117 | return -RSP_INVALID_COMMAND_FORMAT; | 1117 | return -RSP_INVALID_COMMAND_FORMAT; |
@@ -1122,9 +1122,9 @@ int irlan_extract_param(__u8 *buf, char *name, char *value, __u16 *len) | |||
1122 | memcpy(value, buf+n, val_len); | 1122 | memcpy(value, buf+n, val_len); |
1123 | value[val_len] = '\0'; | 1123 | value[val_len] = '\0'; |
1124 | n+=val_len; | 1124 | n+=val_len; |
1125 | 1125 | ||
1126 | IRDA_DEBUG(4, "Parameter: %s ", name); | 1126 | IRDA_DEBUG(4, "Parameter: %s ", name); |
1127 | IRDA_DEBUG(4, "Value: %s\n", value); | 1127 | IRDA_DEBUG(4, "Value: %s\n", value); |
1128 | 1128 | ||
1129 | return n; | 1129 | return n; |
1130 | } | 1130 | } |
@@ -1133,7 +1133,7 @@ int irlan_extract_param(__u8 *buf, char *name, char *value, __u16 *len) | |||
1133 | 1133 | ||
1134 | /* | 1134 | /* |
1135 | * Start of reading /proc entries. | 1135 | * Start of reading /proc entries. |
1136 | * Return entry at pos, | 1136 | * Return entry at pos, |
1137 | * or start_token to indicate print header line | 1137 | * or start_token to indicate print header line |
1138 | * or NULL if end of file | 1138 | * or NULL if end of file |
1139 | */ | 1139 | */ |
@@ -1147,7 +1147,7 @@ static void *irlan_seq_start(struct seq_file *seq, loff_t *pos) | |||
1147 | return SEQ_START_TOKEN; | 1147 | return SEQ_START_TOKEN; |
1148 | 1148 | ||
1149 | list_for_each_entry(self, &irlans, dev_list) { | 1149 | list_for_each_entry(self, &irlans, dev_list) { |
1150 | if (*pos == i) | 1150 | if (*pos == i) |
1151 | return self; | 1151 | return self; |
1152 | ++i; | 1152 | ++i; |
1153 | } | 1153 | } |
@@ -1160,12 +1160,12 @@ static void *irlan_seq_next(struct seq_file *seq, void *v, loff_t *pos) | |||
1160 | struct list_head *nxt; | 1160 | struct list_head *nxt; |
1161 | 1161 | ||
1162 | ++*pos; | 1162 | ++*pos; |
1163 | if (v == SEQ_START_TOKEN) | 1163 | if (v == SEQ_START_TOKEN) |
1164 | nxt = irlans.next; | 1164 | nxt = irlans.next; |
1165 | else | 1165 | else |
1166 | nxt = ((struct irlan_cb *)v)->dev_list.next; | 1166 | nxt = ((struct irlan_cb *)v)->dev_list.next; |
1167 | 1167 | ||
1168 | return (nxt == &irlans) ? NULL | 1168 | return (nxt == &irlans) ? NULL |
1169 | : list_entry(nxt, struct irlan_cb, dev_list); | 1169 | : list_entry(nxt, struct irlan_cb, dev_list); |
1170 | } | 1170 | } |
1171 | 1171 | ||
@@ -1185,7 +1185,7 @@ static int irlan_seq_show(struct seq_file *seq, void *v) | |||
1185 | seq_puts(seq, "IrLAN instances:\n"); | 1185 | seq_puts(seq, "IrLAN instances:\n"); |
1186 | else { | 1186 | else { |
1187 | struct irlan_cb *self = v; | 1187 | struct irlan_cb *self = v; |
1188 | 1188 | ||
1189 | IRDA_ASSERT(self != NULL, return -1;); | 1189 | IRDA_ASSERT(self != NULL, return -1;); |
1190 | IRDA_ASSERT(self->magic == IRLAN_MAGIC, return -1;); | 1190 | IRDA_ASSERT(self->magic == IRLAN_MAGIC, return -1;); |
1191 | 1191 | ||
@@ -1201,17 +1201,17 @@ static int irlan_seq_show(struct seq_file *seq, void *v) | |||
1201 | self->daddr); | 1201 | self->daddr); |
1202 | seq_printf(seq,"version: %d.%d,\n", | 1202 | seq_printf(seq,"version: %d.%d,\n", |
1203 | self->version[1], self->version[0]); | 1203 | self->version[1], self->version[0]); |
1204 | seq_printf(seq,"access type: %s\n", | 1204 | seq_printf(seq,"access type: %s\n", |
1205 | irlan_access[self->client.access_type]); | 1205 | irlan_access[self->client.access_type]); |
1206 | seq_printf(seq,"media: %s\n", | 1206 | seq_printf(seq,"media: %s\n", |
1207 | irlan_media[self->media]); | 1207 | irlan_media[self->media]); |
1208 | 1208 | ||
1209 | seq_printf(seq,"local filter:\n"); | 1209 | seq_printf(seq,"local filter:\n"); |
1210 | seq_printf(seq,"remote filter: "); | 1210 | seq_printf(seq,"remote filter: "); |
1211 | irlan_print_filter(seq, self->client.filter_type); | 1211 | irlan_print_filter(seq, self->client.filter_type); |
1212 | seq_printf(seq,"tx busy: %s\n", | 1212 | seq_printf(seq,"tx busy: %s\n", |
1213 | netif_queue_stopped(self->dev) ? "TRUE" : "FALSE"); | 1213 | netif_queue_stopped(self->dev) ? "TRUE" : "FALSE"); |
1214 | 1214 | ||
1215 | seq_putc(seq,'\n'); | 1215 | seq_putc(seq,'\n'); |
1216 | } | 1216 | } |
1217 | return 0; | 1217 | return 0; |
@@ -1231,7 +1231,7 @@ static int irlan_seq_open(struct inode *inode, struct file *file) | |||
1231 | #endif | 1231 | #endif |
1232 | 1232 | ||
1233 | MODULE_AUTHOR("Dag Brattli <dagb@cs.uit.no>"); | 1233 | MODULE_AUTHOR("Dag Brattli <dagb@cs.uit.no>"); |
1234 | MODULE_DESCRIPTION("The Linux IrDA LAN protocol"); | 1234 | MODULE_DESCRIPTION("The Linux IrDA LAN protocol"); |
1235 | MODULE_LICENSE("GPL"); | 1235 | MODULE_LICENSE("GPL"); |
1236 | 1236 | ||
1237 | module_param(eth, bool, 0); | 1237 | module_param(eth, bool, 0); |