diff options
author | YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org> | 2007-02-09 09:24:53 -0500 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-02-11 02:19:47 -0500 |
commit | 6819bc2e1e46c71711a8dddf4040e706b02973c0 (patch) | |
tree | 6baa6c808fd70a01d5e95c77b02d0a6c5409cc9e /net/irda/irlan | |
parent | 981c0ff6900c981668a798fe9e0bc5ba32ee3fd4 (diff) |
[NET] IRDA: Fix whitespace errors.
Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/irda/irlan')
-rw-r--r-- | net/irda/irlan/irlan_client.c | 150 | ||||
-rw-r--r-- | net/irda/irlan/irlan_client_event.c | 190 | ||||
-rw-r--r-- | net/irda/irlan/irlan_common.c | 318 | ||||
-rw-r--r-- | net/irda/irlan/irlan_eth.c | 102 | ||||
-rw-r--r-- | net/irda/irlan/irlan_event.c | 26 | ||||
-rw-r--r-- | net/irda/irlan/irlan_filter.c | 48 | ||||
-rw-r--r-- | net/irda/irlan/irlan_provider.c | 102 | ||||
-rw-r--r-- | net/irda/irlan/irlan_provider_event.c | 68 |
8 files changed, 502 insertions, 502 deletions
diff --git a/net/irda/irlan/irlan_client.c b/net/irda/irlan/irlan_client.c index 95cf1234ea17..a4c1c9545827 100644 --- a/net/irda/irlan/irlan_client.c +++ b/net/irda/irlan/irlan_client.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /********************************************************************* | 1 | /********************************************************************* |
2 | * | 2 | * |
3 | * Filename: irlan_client.c | 3 | * Filename: irlan_client.c |
4 | * Version: 0.9 | 4 | * Version: 0.9 |
5 | * Description: IrDA LAN Access Protocol (IrLAN) Client | 5 | * Description: IrDA LAN Access Protocol (IrLAN) Client |
@@ -11,17 +11,17 @@ | |||
11 | * Sources: skeleton.c by Donald Becker <becker@CESDIS.gsfc.nasa.gov> | 11 | * Sources: skeleton.c by Donald Becker <becker@CESDIS.gsfc.nasa.gov> |
12 | * slip.c by Laurence Culhane, <loz@holmes.demon.co.uk> | 12 | * slip.c by Laurence Culhane, <loz@holmes.demon.co.uk> |
13 | * Fred N. van Kempen, <waltje@uwalt.nl.mugnet.org> | 13 | * Fred N. van Kempen, <waltje@uwalt.nl.mugnet.org> |
14 | * | 14 | * |
15 | * Copyright (c) 1998-1999 Dag Brattli <dagb@cs.uit.no>, | 15 | * Copyright (c) 1998-1999 Dag Brattli <dagb@cs.uit.no>, |
16 | * All Rights Reserved. | 16 | * All Rights Reserved. |
17 | * | 17 | * |
18 | * This program is free software; you can redistribute it and/or | 18 | * This program is free software; you can redistribute it and/or |
19 | * modify it under the terms of the GNU General Public License as | 19 | * modify it under the terms of the GNU General Public License as |
20 | * published by the Free Software Foundation; either version 2 of | 20 | * published by the Free Software Foundation; either version 2 of |
21 | * the License, or (at your option) any later version. | 21 | * the License, or (at your option) any later version. |
22 | * | 22 | * |
23 | * Neither Dag Brattli nor University of Tromsų admit liability nor | 23 | * Neither Dag Brattli nor University of Tromsų admit liability nor |
24 | * provide warranty for any of this software. This material is | 24 | * provide warranty for any of this software. This material is |
25 | * provided "AS-IS" and at no charge. | 25 | * provided "AS-IS" and at no charge. |
26 | * | 26 | * |
27 | ********************************************************************/ | 27 | ********************************************************************/ |
@@ -54,35 +54,35 @@ | |||
54 | 54 | ||
55 | #undef CONFIG_IRLAN_GRATUITOUS_ARP | 55 | #undef CONFIG_IRLAN_GRATUITOUS_ARP |
56 | 56 | ||
57 | static void irlan_client_ctrl_disconnect_indication(void *instance, void *sap, | 57 | static void irlan_client_ctrl_disconnect_indication(void *instance, void *sap, |
58 | LM_REASON reason, | 58 | LM_REASON reason, |
59 | struct sk_buff *); | 59 | struct sk_buff *); |
60 | static int irlan_client_ctrl_data_indication(void *instance, void *sap, | 60 | static int irlan_client_ctrl_data_indication(void *instance, void *sap, |
61 | struct sk_buff *skb); | 61 | struct sk_buff *skb); |
62 | static void irlan_client_ctrl_connect_confirm(void *instance, void *sap, | 62 | static void irlan_client_ctrl_connect_confirm(void *instance, void *sap, |
63 | struct qos_info *qos, | 63 | struct qos_info *qos, |
64 | __u32 max_sdu_size, | 64 | __u32 max_sdu_size, |
65 | __u8 max_header_size, | 65 | __u8 max_header_size, |
66 | struct sk_buff *); | 66 | struct sk_buff *); |
67 | static void irlan_check_response_param(struct irlan_cb *self, char *param, | 67 | static void irlan_check_response_param(struct irlan_cb *self, char *param, |
68 | char *value, int val_len); | 68 | char *value, int val_len); |
69 | static void irlan_client_open_ctrl_tsap(struct irlan_cb *self); | 69 | static void irlan_client_open_ctrl_tsap(struct irlan_cb *self); |
70 | 70 | ||
71 | static void irlan_client_kick_timer_expired(void *data) | 71 | static void irlan_client_kick_timer_expired(void *data) |
72 | { | 72 | { |
73 | struct irlan_cb *self = (struct irlan_cb *) data; | 73 | struct irlan_cb *self = (struct irlan_cb *) data; |
74 | 74 | ||
75 | IRDA_DEBUG(2, "%s()\n", __FUNCTION__ ); | 75 | IRDA_DEBUG(2, "%s()\n", __FUNCTION__ ); |
76 | 76 | ||
77 | IRDA_ASSERT(self != NULL, return;); | 77 | IRDA_ASSERT(self != NULL, return;); |
78 | IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); | 78 | IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); |
79 | 79 | ||
80 | /* | 80 | /* |
81 | * If we are in peer mode, the client may not have got the discovery | 81 | * If we are in peer mode, the client may not have got the discovery |
82 | * indication it needs to make progress. If the client is still in | 82 | * indication it needs to make progress. If the client is still in |
83 | * IDLE state, we must kick it to, but only if the provider is not IDLE | 83 | * IDLE state, we must kick it to, but only if the provider is not IDLE |
84 | */ | 84 | */ |
85 | if ((self->provider.access_type == ACCESS_PEER) && | 85 | if ((self->provider.access_type == ACCESS_PEER) && |
86 | (self->client.state == IRLAN_IDLE) && | 86 | (self->client.state == IRLAN_IDLE) && |
87 | (self->provider.state != IRLAN_IDLE)) { | 87 | (self->provider.state != IRLAN_IDLE)) { |
88 | irlan_client_wakeup(self, self->saddr, self->daddr); | 88 | irlan_client_wakeup(self, self->saddr, self->daddr); |
@@ -92,8 +92,8 @@ static void irlan_client_kick_timer_expired(void *data) | |||
92 | static void irlan_client_start_kick_timer(struct irlan_cb *self, int timeout) | 92 | static void irlan_client_start_kick_timer(struct irlan_cb *self, int timeout) |
93 | { | 93 | { |
94 | IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); | 94 | IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); |
95 | 95 | ||
96 | irda_start_timer(&self->client.kick_timer, timeout, (void *) self, | 96 | irda_start_timer(&self->client.kick_timer, timeout, (void *) self, |
97 | irlan_client_kick_timer_expired); | 97 | irlan_client_kick_timer_expired); |
98 | } | 98 | } |
99 | 99 | ||
@@ -110,11 +110,11 @@ void irlan_client_wakeup(struct irlan_cb *self, __u32 saddr, __u32 daddr) | |||
110 | IRDA_ASSERT(self != NULL, return;); | 110 | IRDA_ASSERT(self != NULL, return;); |
111 | IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); | 111 | IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); |
112 | 112 | ||
113 | /* | 113 | /* |
114 | * Check if we are already awake, or if we are a provider in direct | 114 | * Check if we are already awake, or if we are a provider in direct |
115 | * mode (in that case we must leave the client idle | 115 | * mode (in that case we must leave the client idle |
116 | */ | 116 | */ |
117 | if ((self->client.state != IRLAN_IDLE) || | 117 | if ((self->client.state != IRLAN_IDLE) || |
118 | (self->provider.access_type == ACCESS_DIRECT)) | 118 | (self->provider.access_type == ACCESS_DIRECT)) |
119 | { | 119 | { |
120 | IRDA_DEBUG(0, "%s(), already awake!\n", __FUNCTION__ ); | 120 | IRDA_DEBUG(0, "%s(), already awake!\n", __FUNCTION__ ); |
@@ -135,7 +135,7 @@ void irlan_client_wakeup(struct irlan_cb *self, __u32 saddr, __u32 daddr) | |||
135 | irlan_open_data_tsap(self); | 135 | irlan_open_data_tsap(self); |
136 | 136 | ||
137 | irlan_do_client_event(self, IRLAN_DISCOVERY_INDICATION, NULL); | 137 | irlan_do_client_event(self, IRLAN_DISCOVERY_INDICATION, NULL); |
138 | 138 | ||
139 | /* Start kick timer */ | 139 | /* Start kick timer */ |
140 | irlan_client_start_kick_timer(self, 2*HZ); | 140 | irlan_client_start_kick_timer(self, 2*HZ); |
141 | } | 141 | } |
@@ -148,11 +148,11 @@ void irlan_client_wakeup(struct irlan_cb *self, __u32 saddr, __u32 daddr) | |||
148 | */ | 148 | */ |
149 | void irlan_client_discovery_indication(discinfo_t *discovery, | 149 | void irlan_client_discovery_indication(discinfo_t *discovery, |
150 | DISCOVERY_MODE mode, | 150 | DISCOVERY_MODE mode, |
151 | void *priv) | 151 | void *priv) |
152 | { | 152 | { |
153 | struct irlan_cb *self; | 153 | struct irlan_cb *self; |
154 | __u32 saddr, daddr; | 154 | __u32 saddr, daddr; |
155 | 155 | ||
156 | IRDA_DEBUG(1, "%s()\n", __FUNCTION__ ); | 156 | IRDA_DEBUG(1, "%s()\n", __FUNCTION__ ); |
157 | 157 | ||
158 | IRDA_ASSERT(discovery != NULL, return;); | 158 | IRDA_ASSERT(discovery != NULL, return;); |
@@ -177,35 +177,35 @@ void irlan_client_discovery_indication(discinfo_t *discovery, | |||
177 | 177 | ||
178 | IRDA_DEBUG(1, "%s(), Found instance (%08x)!\n", __FUNCTION__ , | 178 | IRDA_DEBUG(1, "%s(), Found instance (%08x)!\n", __FUNCTION__ , |
179 | daddr); | 179 | daddr); |
180 | 180 | ||
181 | irlan_client_wakeup(self, saddr, daddr); | 181 | irlan_client_wakeup(self, saddr, daddr); |
182 | } | 182 | } |
183 | IRDA_ASSERT_LABEL(out:) | 183 | IRDA_ASSERT_LABEL(out:) |
184 | rcu_read_unlock(); | 184 | rcu_read_unlock(); |
185 | } | 185 | } |
186 | 186 | ||
187 | /* | 187 | /* |
188 | * Function irlan_client_data_indication (handle, skb) | 188 | * Function irlan_client_data_indication (handle, skb) |
189 | * | 189 | * |
190 | * This function gets the data that is received on the control channel | 190 | * This function gets the data that is received on the control channel |
191 | * | 191 | * |
192 | */ | 192 | */ |
193 | static int irlan_client_ctrl_data_indication(void *instance, void *sap, | 193 | static int irlan_client_ctrl_data_indication(void *instance, void *sap, |
194 | struct sk_buff *skb) | 194 | struct sk_buff *skb) |
195 | { | 195 | { |
196 | struct irlan_cb *self; | 196 | struct irlan_cb *self; |
197 | 197 | ||
198 | IRDA_DEBUG(2, "%s()\n", __FUNCTION__ ); | 198 | IRDA_DEBUG(2, "%s()\n", __FUNCTION__ ); |
199 | 199 | ||
200 | self = (struct irlan_cb *) instance; | 200 | self = (struct irlan_cb *) instance; |
201 | 201 | ||
202 | IRDA_ASSERT(self != NULL, return -1;); | 202 | IRDA_ASSERT(self != NULL, return -1;); |
203 | IRDA_ASSERT(self->magic == IRLAN_MAGIC, return -1;); | 203 | IRDA_ASSERT(self->magic == IRLAN_MAGIC, return -1;); |
204 | IRDA_ASSERT(skb != NULL, return -1;); | 204 | IRDA_ASSERT(skb != NULL, return -1;); |
205 | |||
206 | irlan_do_client_event(self, IRLAN_DATA_INDICATION, skb); | ||
207 | 205 | ||
208 | /* Ready for a new command */ | 206 | irlan_do_client_event(self, IRLAN_DATA_INDICATION, skb); |
207 | |||
208 | /* Ready for a new command */ | ||
209 | IRDA_DEBUG(2, "%s(), clearing tx_busy\n", __FUNCTION__ ); | 209 | IRDA_DEBUG(2, "%s(), clearing tx_busy\n", __FUNCTION__ ); |
210 | self->client.tx_busy = FALSE; | 210 | self->client.tx_busy = FALSE; |
211 | 211 | ||
@@ -215,27 +215,27 @@ static int irlan_client_ctrl_data_indication(void *instance, void *sap, | |||
215 | return 0; | 215 | return 0; |
216 | } | 216 | } |
217 | 217 | ||
218 | static void irlan_client_ctrl_disconnect_indication(void *instance, void *sap, | 218 | static void irlan_client_ctrl_disconnect_indication(void *instance, void *sap, |
219 | LM_REASON reason, | 219 | LM_REASON reason, |
220 | struct sk_buff *userdata) | 220 | struct sk_buff *userdata) |
221 | { | 221 | { |
222 | struct irlan_cb *self; | 222 | struct irlan_cb *self; |
223 | struct tsap_cb *tsap; | 223 | struct tsap_cb *tsap; |
224 | struct sk_buff *skb; | 224 | struct sk_buff *skb; |
225 | 225 | ||
226 | IRDA_DEBUG(4, "%s(), reason=%d\n", __FUNCTION__ , reason); | 226 | IRDA_DEBUG(4, "%s(), reason=%d\n", __FUNCTION__ , reason); |
227 | 227 | ||
228 | self = (struct irlan_cb *) instance; | 228 | self = (struct irlan_cb *) instance; |
229 | tsap = (struct tsap_cb *) sap; | 229 | tsap = (struct tsap_cb *) sap; |
230 | 230 | ||
231 | IRDA_ASSERT(self != NULL, return;); | 231 | IRDA_ASSERT(self != NULL, return;); |
232 | IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); | 232 | IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); |
233 | IRDA_ASSERT(tsap != NULL, return;); | 233 | IRDA_ASSERT(tsap != NULL, return;); |
234 | IRDA_ASSERT(tsap->magic == TTP_TSAP_MAGIC, return;); | 234 | IRDA_ASSERT(tsap->magic == TTP_TSAP_MAGIC, return;); |
235 | 235 | ||
236 | IRDA_ASSERT(tsap == self->client.tsap_ctrl, return;); | 236 | IRDA_ASSERT(tsap == self->client.tsap_ctrl, return;); |
237 | 237 | ||
238 | /* Remove frames queued on the control channel */ | 238 | /* Remove frames queued on the control channel */ |
239 | while ((skb = skb_dequeue(&self->client.txq)) != NULL) { | 239 | while ((skb = skb_dequeue(&self->client.txq)) != NULL) { |
240 | dev_kfree_skb(skb); | 240 | dev_kfree_skb(skb); |
241 | } | 241 | } |
@@ -272,7 +272,7 @@ static void irlan_client_open_ctrl_tsap(struct irlan_cb *self) | |||
272 | notify.disconnect_indication = irlan_client_ctrl_disconnect_indication; | 272 | notify.disconnect_indication = irlan_client_ctrl_disconnect_indication; |
273 | notify.instance = self; | 273 | notify.instance = self; |
274 | strlcpy(notify.name, "IrLAN ctrl (c)", sizeof(notify.name)); | 274 | strlcpy(notify.name, "IrLAN ctrl (c)", sizeof(notify.name)); |
275 | 275 | ||
276 | tsap = irttp_open_tsap(LSAP_ANY, DEFAULT_INITIAL_CREDIT, ¬ify); | 276 | tsap = irttp_open_tsap(LSAP_ANY, DEFAULT_INITIAL_CREDIT, ¬ify); |
277 | if (!tsap) { | 277 | if (!tsap) { |
278 | IRDA_DEBUG(2, "%s(), Got no tsap!\n", __FUNCTION__ ); | 278 | IRDA_DEBUG(2, "%s(), Got no tsap!\n", __FUNCTION__ ); |
@@ -287,11 +287,11 @@ static void irlan_client_open_ctrl_tsap(struct irlan_cb *self) | |||
287 | * Connection to peer IrLAN laye confirmed | 287 | * Connection to peer IrLAN laye confirmed |
288 | * | 288 | * |
289 | */ | 289 | */ |
290 | static void irlan_client_ctrl_connect_confirm(void *instance, void *sap, | 290 | static void irlan_client_ctrl_connect_confirm(void *instance, void *sap, |
291 | struct qos_info *qos, | 291 | struct qos_info *qos, |
292 | __u32 max_sdu_size, | 292 | __u32 max_sdu_size, |
293 | __u8 max_header_size, | 293 | __u8 max_header_size, |
294 | struct sk_buff *skb) | 294 | struct sk_buff *skb) |
295 | { | 295 | { |
296 | struct irlan_cb *self; | 296 | struct irlan_cb *self; |
297 | 297 | ||
@@ -316,7 +316,7 @@ static void irlan_client_ctrl_connect_confirm(void *instance, void *sap, | |||
316 | * Print return code of request to peer IrLAN layer. | 316 | * Print return code of request to peer IrLAN layer. |
317 | * | 317 | * |
318 | */ | 318 | */ |
319 | static void print_ret_code(__u8 code) | 319 | static void print_ret_code(__u8 code) |
320 | { | 320 | { |
321 | switch(code) { | 321 | switch(code) { |
322 | case 0: | 322 | case 0: |
@@ -358,7 +358,7 @@ static void print_ret_code(__u8 code) | |||
358 | /* | 358 | /* |
359 | * Function irlan_client_parse_response (self, skb) | 359 | * Function irlan_client_parse_response (self, skb) |
360 | * | 360 | * |
361 | * Extract all parameters from received buffer, then feed them to | 361 | * Extract all parameters from received buffer, then feed them to |
362 | * check_params for parsing | 362 | * check_params for parsing |
363 | */ | 363 | */ |
364 | void irlan_client_parse_response(struct irlan_cb *self, struct sk_buff *skb) | 364 | void irlan_client_parse_response(struct irlan_cb *self, struct sk_buff *skb) |
@@ -369,30 +369,30 @@ void irlan_client_parse_response(struct irlan_cb *self, struct sk_buff *skb) | |||
369 | int ret; | 369 | int ret; |
370 | __u16 val_len; | 370 | __u16 val_len; |
371 | int i; | 371 | int i; |
372 | char *name; | 372 | char *name; |
373 | char *value; | 373 | char *value; |
374 | |||
375 | IRDA_ASSERT(skb != NULL, return;); | ||
374 | 376 | ||
375 | IRDA_ASSERT(skb != NULL, return;); | ||
376 | |||
377 | IRDA_DEBUG(4, "%s() skb->len=%d\n", __FUNCTION__ , (int) skb->len); | 377 | IRDA_DEBUG(4, "%s() skb->len=%d\n", __FUNCTION__ , (int) skb->len); |
378 | 378 | ||
379 | IRDA_ASSERT(self != NULL, return;); | 379 | IRDA_ASSERT(self != NULL, return;); |
380 | IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); | 380 | IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); |
381 | 381 | ||
382 | if (!skb) { | 382 | if (!skb) { |
383 | IRDA_ERROR("%s(), Got NULL skb!\n", __FUNCTION__); | 383 | IRDA_ERROR("%s(), Got NULL skb!\n", __FUNCTION__); |
384 | return; | 384 | return; |
385 | } | 385 | } |
386 | frame = skb->data; | 386 | frame = skb->data; |
387 | 387 | ||
388 | /* | 388 | /* |
389 | * Check return code and print it if not success | 389 | * Check return code and print it if not success |
390 | */ | 390 | */ |
391 | if (frame[0]) { | 391 | if (frame[0]) { |
392 | print_ret_code(frame[0]); | 392 | print_ret_code(frame[0]); |
393 | return; | 393 | return; |
394 | } | 394 | } |
395 | 395 | ||
396 | name = kmalloc(255, GFP_ATOMIC); | 396 | name = kmalloc(255, GFP_ATOMIC); |
397 | if (!name) | 397 | if (!name) |
398 | return; | 398 | return; |
@@ -406,11 +406,11 @@ void irlan_client_parse_response(struct irlan_cb *self, struct sk_buff *skb) | |||
406 | count = frame[1]; | 406 | count = frame[1]; |
407 | 407 | ||
408 | IRDA_DEBUG(4, "%s(), got %d parameters\n", __FUNCTION__ , count); | 408 | IRDA_DEBUG(4, "%s(), got %d parameters\n", __FUNCTION__ , count); |
409 | 409 | ||
410 | ptr = frame+2; | 410 | ptr = frame+2; |
411 | 411 | ||
412 | /* For all parameters */ | 412 | /* For all parameters */ |
413 | for (i=0; i<count;i++) { | 413 | for (i=0; i<count;i++) { |
414 | ret = irlan_extract_param(ptr, name, value, &val_len); | 414 | ret = irlan_extract_param(ptr, name, value, &val_len); |
415 | if (ret < 0) { | 415 | if (ret < 0) { |
416 | IRDA_DEBUG(2, "%s(), IrLAN, Error!\n", __FUNCTION__ ); | 416 | IRDA_DEBUG(2, "%s(), IrLAN, Error!\n", __FUNCTION__ ); |
@@ -418,7 +418,7 @@ void irlan_client_parse_response(struct irlan_cb *self, struct sk_buff *skb) | |||
418 | } | 418 | } |
419 | ptr += ret; | 419 | ptr += ret; |
420 | irlan_check_response_param(self, name, value, val_len); | 420 | irlan_check_response_param(self, name, value, val_len); |
421 | } | 421 | } |
422 | /* Cleanup */ | 422 | /* Cleanup */ |
423 | kfree(name); | 423 | kfree(name); |
424 | kfree(value); | 424 | kfree(value); |
@@ -430,8 +430,8 @@ void irlan_client_parse_response(struct irlan_cb *self, struct sk_buff *skb) | |||
430 | * Check which parameter is received and update local variables | 430 | * Check which parameter is received and update local variables |
431 | * | 431 | * |
432 | */ | 432 | */ |
433 | static void irlan_check_response_param(struct irlan_cb *self, char *param, | 433 | static void irlan_check_response_param(struct irlan_cb *self, char *param, |
434 | char *value, int val_len) | 434 | char *value, int val_len) |
435 | { | 435 | { |
436 | __u16 tmp_cpu; /* Temporary value in host order */ | 436 | __u16 tmp_cpu; /* Temporary value in host order */ |
437 | __u8 *bytes; | 437 | __u8 *bytes; |
@@ -465,7 +465,7 @@ static void irlan_check_response_param(struct irlan_cb *self, char *param, | |||
465 | self->client.filter_type |= IRLAN_BROADCAST; | 465 | self->client.filter_type |= IRLAN_BROADCAST; |
466 | else if (strcmp(value, "IPX_SOCKET") == 0) | 466 | else if (strcmp(value, "IPX_SOCKET") == 0) |
467 | self->client.filter_type |= IRLAN_IPX_SOCKET; | 467 | self->client.filter_type |= IRLAN_IPX_SOCKET; |
468 | 468 | ||
469 | } | 469 | } |
470 | if (strcmp(param, "ACCESS_TYPE") == 0) { | 470 | if (strcmp(param, "ACCESS_TYPE") == 0) { |
471 | if (strcmp(value, "DIRECT") == 0) | 471 | if (strcmp(value, "DIRECT") == 0) |
@@ -480,7 +480,7 @@ static void irlan_check_response_param(struct irlan_cb *self, char *param, | |||
480 | } | 480 | } |
481 | /* IRLAN version */ | 481 | /* IRLAN version */ |
482 | if (strcmp(param, "IRLAN_VER") == 0) { | 482 | if (strcmp(param, "IRLAN_VER") == 0) { |
483 | IRDA_DEBUG(4, "IrLAN version %d.%d\n", (__u8) value[0], | 483 | IRDA_DEBUG(4, "IrLAN version %d.%d\n", (__u8) value[0], |
484 | (__u8) value[1]); | 484 | (__u8) value[1]); |
485 | 485 | ||
486 | self->version[0] = value[0]; | 486 | self->version[0] = value[0]; |
@@ -497,17 +497,17 @@ static void irlan_check_response_param(struct irlan_cb *self, char *param, | |||
497 | memcpy(&tmp_cpu, value, 2); /* Align value */ | 497 | memcpy(&tmp_cpu, value, 2); /* Align value */ |
498 | le16_to_cpus(&tmp_cpu); /* Convert to host order */ | 498 | le16_to_cpus(&tmp_cpu); /* Convert to host order */ |
499 | self->client.recv_arb_val = tmp_cpu; | 499 | self->client.recv_arb_val = tmp_cpu; |
500 | IRDA_DEBUG(2, "%s(), receive arb val=%d\n", __FUNCTION__ , | 500 | IRDA_DEBUG(2, "%s(), receive arb val=%d\n", __FUNCTION__ , |
501 | self->client.recv_arb_val); | 501 | self->client.recv_arb_val); |
502 | } | 502 | } |
503 | if (strcmp(param, "MAX_FRAME") == 0) { | 503 | if (strcmp(param, "MAX_FRAME") == 0) { |
504 | memcpy(&tmp_cpu, value, 2); /* Align value */ | 504 | memcpy(&tmp_cpu, value, 2); /* Align value */ |
505 | le16_to_cpus(&tmp_cpu); /* Convert to host order */ | 505 | le16_to_cpus(&tmp_cpu); /* Convert to host order */ |
506 | self->client.max_frame = tmp_cpu; | 506 | self->client.max_frame = tmp_cpu; |
507 | IRDA_DEBUG(4, "%s(), max frame=%d\n", __FUNCTION__ , | 507 | IRDA_DEBUG(4, "%s(), max frame=%d\n", __FUNCTION__ , |
508 | self->client.max_frame); | 508 | self->client.max_frame); |
509 | } | 509 | } |
510 | 510 | ||
511 | /* RECONNECT_KEY, in case the link goes down! */ | 511 | /* RECONNECT_KEY, in case the link goes down! */ |
512 | if (strcmp(param, "RECONNECT_KEY") == 0) { | 512 | if (strcmp(param, "RECONNECT_KEY") == 0) { |
513 | IRDA_DEBUG(4, "Got reconnect key: "); | 513 | IRDA_DEBUG(4, "Got reconnect key: "); |
@@ -521,9 +521,9 @@ static void irlan_check_response_param(struct irlan_cb *self, char *param, | |||
521 | if (strcmp(param, "FILTER_ENTRY") == 0) { | 521 | if (strcmp(param, "FILTER_ENTRY") == 0) { |
522 | bytes = value; | 522 | bytes = value; |
523 | IRDA_DEBUG(4, "Ethernet address = %02x:%02x:%02x:%02x:%02x:%02x\n", | 523 | IRDA_DEBUG(4, "Ethernet address = %02x:%02x:%02x:%02x:%02x:%02x\n", |
524 | bytes[0], bytes[1], bytes[2], bytes[3], bytes[4], | 524 | bytes[0], bytes[1], bytes[2], bytes[3], bytes[4], |
525 | bytes[5]); | 525 | bytes[5]); |
526 | for (i = 0; i < 6; i++) | 526 | for (i = 0; i < 6; i++) |
527 | self->dev->dev_addr[i] = bytes[i]; | 527 | self->dev->dev_addr[i] = bytes[i]; |
528 | } | 528 | } |
529 | } | 529 | } |
@@ -534,11 +534,11 @@ static void irlan_check_response_param(struct irlan_cb *self, char *param, | |||
534 | * Got results from remote LM-IAS | 534 | * Got results from remote LM-IAS |
535 | * | 535 | * |
536 | */ | 536 | */ |
537 | void irlan_client_get_value_confirm(int result, __u16 obj_id, | 537 | void irlan_client_get_value_confirm(int result, __u16 obj_id, |
538 | struct ias_value *value, void *priv) | 538 | struct ias_value *value, void *priv) |
539 | { | 539 | { |
540 | struct irlan_cb *self; | 540 | struct irlan_cb *self; |
541 | 541 | ||
542 | IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); | 542 | IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); |
543 | 543 | ||
544 | IRDA_ASSERT(priv != NULL, return;); | 544 | IRDA_ASSERT(priv != NULL, return;); |
@@ -553,7 +553,7 @@ void irlan_client_get_value_confirm(int result, __u16 obj_id, | |||
553 | /* Check if request succeeded */ | 553 | /* Check if request succeeded */ |
554 | if (result != IAS_SUCCESS) { | 554 | if (result != IAS_SUCCESS) { |
555 | IRDA_DEBUG(2, "%s(), got NULL value!\n", __FUNCTION__ ); | 555 | IRDA_DEBUG(2, "%s(), got NULL value!\n", __FUNCTION__ ); |
556 | irlan_do_client_event(self, IRLAN_IAS_PROVIDER_NOT_AVAIL, | 556 | irlan_do_client_event(self, IRLAN_IAS_PROVIDER_NOT_AVAIL, |
557 | NULL); | 557 | NULL); |
558 | return; | 558 | return; |
559 | } | 559 | } |
diff --git a/net/irda/irlan/irlan_client_event.c b/net/irda/irlan/irlan_client_event.c index ce943b69e996..843ab6fbb394 100644 --- a/net/irda/irlan/irlan_client_event.c +++ b/net/irda/irlan/irlan_client_event.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /********************************************************************* | 1 | /********************************************************************* |
2 | * | 2 | * |
3 | * Filename: irlan_client_event.c | 3 | * Filename: irlan_client_event.c |
4 | * Version: 0.9 | 4 | * Version: 0.9 |
5 | * Description: IrLAN client state machine | 5 | * Description: IrLAN client state machine |
@@ -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:52:24 1999 | 9 | * Modified at: Sun Dec 26 21:52:24 1999 |
10 | * Modified by: Dag Brattli <dagb@cs.uit.no> | 10 | * Modified by: Dag Brattli <dagb@cs.uit.no> |
11 | * | 11 | * |
12 | * Copyright (c) 1998-1999 Dag Brattli <dagb@cs.uit.no>, | 12 | * Copyright (c) 1998-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 | ********************************************************************/ |
@@ -36,31 +36,31 @@ | |||
36 | #include <net/irda/irlan_client.h> | 36 | #include <net/irda/irlan_client.h> |
37 | #include <net/irda/irlan_event.h> | 37 | #include <net/irda/irlan_event.h> |
38 | 38 | ||
39 | static int irlan_client_state_idle (struct irlan_cb *self, IRLAN_EVENT event, | 39 | static int irlan_client_state_idle (struct irlan_cb *self, IRLAN_EVENT event, |
40 | struct sk_buff *skb); | 40 | struct sk_buff *skb); |
41 | static int irlan_client_state_query(struct irlan_cb *self, IRLAN_EVENT event, | 41 | static int irlan_client_state_query(struct irlan_cb *self, IRLAN_EVENT event, |
42 | struct sk_buff *skb); | 42 | struct sk_buff *skb); |
43 | static int irlan_client_state_conn (struct irlan_cb *self, IRLAN_EVENT event, | 43 | static int irlan_client_state_conn (struct irlan_cb *self, IRLAN_EVENT event, |
44 | struct sk_buff *skb); | 44 | struct sk_buff *skb); |
45 | static int irlan_client_state_info (struct irlan_cb *self, IRLAN_EVENT event, | 45 | static int irlan_client_state_info (struct irlan_cb *self, IRLAN_EVENT event, |
46 | struct sk_buff *skb); | 46 | struct sk_buff *skb); |
47 | static int irlan_client_state_media(struct irlan_cb *self, IRLAN_EVENT event, | 47 | static int irlan_client_state_media(struct irlan_cb *self, IRLAN_EVENT event, |
48 | struct sk_buff *skb); | 48 | struct sk_buff *skb); |
49 | static int irlan_client_state_open (struct irlan_cb *self, IRLAN_EVENT event, | 49 | static int irlan_client_state_open (struct irlan_cb *self, IRLAN_EVENT event, |
50 | struct sk_buff *skb); | 50 | struct sk_buff *skb); |
51 | static int irlan_client_state_wait (struct irlan_cb *self, IRLAN_EVENT event, | 51 | static int irlan_client_state_wait (struct irlan_cb *self, IRLAN_EVENT event, |
52 | struct sk_buff *skb); | 52 | struct sk_buff *skb); |
53 | static int irlan_client_state_arb (struct irlan_cb *self, IRLAN_EVENT event, | 53 | static int irlan_client_state_arb (struct irlan_cb *self, IRLAN_EVENT event, |
54 | struct sk_buff *skb); | 54 | struct sk_buff *skb); |
55 | static int irlan_client_state_data (struct irlan_cb *self, IRLAN_EVENT event, | 55 | static int irlan_client_state_data (struct irlan_cb *self, IRLAN_EVENT event, |
56 | struct sk_buff *skb); | 56 | struct sk_buff *skb); |
57 | static int irlan_client_state_close(struct irlan_cb *self, IRLAN_EVENT event, | 57 | static int irlan_client_state_close(struct irlan_cb *self, IRLAN_EVENT event, |
58 | struct sk_buff *skb); | 58 | struct sk_buff *skb); |
59 | static int irlan_client_state_sync (struct irlan_cb *self, IRLAN_EVENT event, | 59 | static int irlan_client_state_sync (struct irlan_cb *self, IRLAN_EVENT event, |
60 | struct sk_buff *skb); | 60 | struct sk_buff *skb); |
61 | 61 | ||
62 | static int (*state[])(struct irlan_cb *, IRLAN_EVENT event, struct sk_buff *) = | 62 | static int (*state[])(struct irlan_cb *, IRLAN_EVENT event, struct sk_buff *) = |
63 | { | 63 | { |
64 | irlan_client_state_idle, | 64 | irlan_client_state_idle, |
65 | irlan_client_state_query, | 65 | irlan_client_state_query, |
66 | irlan_client_state_conn, | 66 | irlan_client_state_conn, |
@@ -74,8 +74,8 @@ static int (*state[])(struct irlan_cb *, IRLAN_EVENT event, struct sk_buff *) = | |||
74 | irlan_client_state_sync | 74 | irlan_client_state_sync |
75 | }; | 75 | }; |
76 | 76 | ||
77 | void irlan_do_client_event(struct irlan_cb *self, IRLAN_EVENT event, | 77 | void irlan_do_client_event(struct irlan_cb *self, IRLAN_EVENT event, |
78 | struct sk_buff *skb) | 78 | struct sk_buff *skb) |
79 | { | 79 | { |
80 | IRDA_ASSERT(self != NULL, return;); | 80 | IRDA_ASSERT(self != NULL, return;); |
81 | IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); | 81 | IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); |
@@ -89,14 +89,14 @@ void irlan_do_client_event(struct irlan_cb *self, IRLAN_EVENT event, | |||
89 | * IDLE, We are waiting for an indication that there is a provider | 89 | * IDLE, We are waiting for an indication that there is a provider |
90 | * available. | 90 | * available. |
91 | */ | 91 | */ |
92 | static int irlan_client_state_idle(struct irlan_cb *self, IRLAN_EVENT event, | 92 | static int irlan_client_state_idle(struct irlan_cb *self, IRLAN_EVENT event, |
93 | struct sk_buff *skb) | 93 | struct sk_buff *skb) |
94 | { | 94 | { |
95 | IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); | 95 | IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); |
96 | 96 | ||
97 | IRDA_ASSERT(self != NULL, return -1;); | 97 | IRDA_ASSERT(self != NULL, return -1;); |
98 | IRDA_ASSERT(self->magic == IRLAN_MAGIC, return -1;); | 98 | IRDA_ASSERT(self->magic == IRLAN_MAGIC, return -1;); |
99 | 99 | ||
100 | switch (event) { | 100 | switch (event) { |
101 | case IRLAN_DISCOVERY_INDICATION: | 101 | case IRLAN_DISCOVERY_INDICATION: |
102 | if (self->client.iriap) { | 102 | if (self->client.iriap) { |
@@ -104,7 +104,7 @@ static int irlan_client_state_idle(struct irlan_cb *self, IRLAN_EVENT event, | |||
104 | __FUNCTION__); | 104 | __FUNCTION__); |
105 | return -EBUSY; | 105 | return -EBUSY; |
106 | } | 106 | } |
107 | 107 | ||
108 | self->client.iriap = iriap_open(LSAP_ANY, IAS_CLIENT, self, | 108 | self->client.iriap = iriap_open(LSAP_ANY, IAS_CLIENT, self, |
109 | irlan_client_get_value_confirm); | 109 | irlan_client_get_value_confirm); |
110 | /* Get some values from peer IAS */ | 110 | /* Get some values from peer IAS */ |
@@ -120,7 +120,7 @@ static int irlan_client_state_idle(struct irlan_cb *self, IRLAN_EVENT event, | |||
120 | IRDA_DEBUG(4, "%s(), Unknown event %d\n", __FUNCTION__ , event); | 120 | IRDA_DEBUG(4, "%s(), Unknown event %d\n", __FUNCTION__ , event); |
121 | break; | 121 | break; |
122 | } | 122 | } |
123 | if (skb) | 123 | if (skb) |
124 | dev_kfree_skb(skb); | 124 | dev_kfree_skb(skb); |
125 | 125 | ||
126 | return 0; | 126 | return 0; |
@@ -133,23 +133,23 @@ static int irlan_client_state_idle(struct irlan_cb *self, IRLAN_EVENT event, | |||
133 | * to provider, just waiting for the confirm. | 133 | * to provider, just waiting for the confirm. |
134 | * | 134 | * |
135 | */ | 135 | */ |
136 | static int irlan_client_state_query(struct irlan_cb *self, IRLAN_EVENT event, | 136 | static int irlan_client_state_query(struct irlan_cb *self, IRLAN_EVENT event, |
137 | struct sk_buff *skb) | 137 | struct sk_buff *skb) |
138 | { | 138 | { |
139 | IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); | 139 | IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); |
140 | 140 | ||
141 | IRDA_ASSERT(self != NULL, return -1;); | 141 | IRDA_ASSERT(self != NULL, return -1;); |
142 | IRDA_ASSERT(self->magic == IRLAN_MAGIC, return -1;); | 142 | IRDA_ASSERT(self->magic == IRLAN_MAGIC, return -1;); |
143 | 143 | ||
144 | switch(event) { | 144 | switch(event) { |
145 | case IRLAN_IAS_PROVIDER_AVAIL: | 145 | case IRLAN_IAS_PROVIDER_AVAIL: |
146 | IRDA_ASSERT(self->dtsap_sel_ctrl != 0, return -1;); | 146 | IRDA_ASSERT(self->dtsap_sel_ctrl != 0, return -1;); |
147 | 147 | ||
148 | self->client.open_retries = 0; | 148 | self->client.open_retries = 0; |
149 | 149 | ||
150 | irttp_connect_request(self->client.tsap_ctrl, | 150 | irttp_connect_request(self->client.tsap_ctrl, |
151 | self->dtsap_sel_ctrl, | 151 | self->dtsap_sel_ctrl, |
152 | self->saddr, self->daddr, NULL, | 152 | self->saddr, self->daddr, NULL, |
153 | IRLAN_MTU, NULL); | 153 | IRLAN_MTU, NULL); |
154 | irlan_next_client_state(self, IRLAN_CONN); | 154 | irlan_next_client_state(self, IRLAN_CONN); |
155 | break; | 155 | break; |
@@ -158,7 +158,7 @@ static int irlan_client_state_query(struct irlan_cb *self, IRLAN_EVENT event, | |||
158 | irlan_next_client_state(self, IRLAN_IDLE); | 158 | irlan_next_client_state(self, IRLAN_IDLE); |
159 | 159 | ||
160 | /* Give the client a kick! */ | 160 | /* Give the client a kick! */ |
161 | if ((self->provider.access_type == ACCESS_PEER) && | 161 | if ((self->provider.access_type == ACCESS_PEER) && |
162 | (self->provider.state != IRLAN_IDLE)) | 162 | (self->provider.state != IRLAN_IDLE)) |
163 | irlan_client_wakeup(self, self->saddr, self->daddr); | 163 | irlan_client_wakeup(self, self->saddr, self->daddr); |
164 | break; | 164 | break; |
@@ -175,7 +175,7 @@ static int irlan_client_state_query(struct irlan_cb *self, IRLAN_EVENT event, | |||
175 | } | 175 | } |
176 | if (skb) | 176 | if (skb) |
177 | dev_kfree_skb(skb); | 177 | dev_kfree_skb(skb); |
178 | 178 | ||
179 | return 0; | 179 | return 0; |
180 | } | 180 | } |
181 | 181 | ||
@@ -186,13 +186,13 @@ static int irlan_client_state_query(struct irlan_cb *self, IRLAN_EVENT event, | |||
186 | * commands yet. | 186 | * commands yet. |
187 | * | 187 | * |
188 | */ | 188 | */ |
189 | static int irlan_client_state_conn(struct irlan_cb *self, IRLAN_EVENT event, | 189 | static int irlan_client_state_conn(struct irlan_cb *self, IRLAN_EVENT event, |
190 | struct sk_buff *skb) | 190 | struct sk_buff *skb) |
191 | { | 191 | { |
192 | IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); | 192 | IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); |
193 | 193 | ||
194 | IRDA_ASSERT(self != NULL, return -1;); | 194 | IRDA_ASSERT(self != NULL, return -1;); |
195 | 195 | ||
196 | switch (event) { | 196 | switch (event) { |
197 | case IRLAN_CONNECT_COMPLETE: | 197 | case IRLAN_CONNECT_COMPLETE: |
198 | /* Send getinfo cmd */ | 198 | /* Send getinfo cmd */ |
@@ -212,7 +212,7 @@ static int irlan_client_state_conn(struct irlan_cb *self, IRLAN_EVENT event, | |||
212 | } | 212 | } |
213 | if (skb) | 213 | if (skb) |
214 | dev_kfree_skb(skb); | 214 | dev_kfree_skb(skb); |
215 | 215 | ||
216 | return 0; | 216 | return 0; |
217 | } | 217 | } |
218 | 218 | ||
@@ -221,24 +221,24 @@ static int irlan_client_state_conn(struct irlan_cb *self, IRLAN_EVENT event, | |||
221 | * | 221 | * |
222 | * INFO, We have issued a GetInfo command and is awaiting a reply. | 222 | * INFO, We have issued a GetInfo command and is awaiting a reply. |
223 | */ | 223 | */ |
224 | static int irlan_client_state_info(struct irlan_cb *self, IRLAN_EVENT event, | 224 | static int irlan_client_state_info(struct irlan_cb *self, IRLAN_EVENT event, |
225 | struct sk_buff *skb) | 225 | struct sk_buff *skb) |
226 | { | 226 | { |
227 | IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); | 227 | IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); |
228 | 228 | ||
229 | IRDA_ASSERT(self != NULL, return -1;); | 229 | IRDA_ASSERT(self != NULL, return -1;); |
230 | 230 | ||
231 | switch (event) { | 231 | switch (event) { |
232 | case IRLAN_DATA_INDICATION: | 232 | case IRLAN_DATA_INDICATION: |
233 | IRDA_ASSERT(skb != NULL, return -1;); | 233 | IRDA_ASSERT(skb != NULL, return -1;); |
234 | 234 | ||
235 | irlan_client_parse_response(self, skb); | 235 | irlan_client_parse_response(self, skb); |
236 | 236 | ||
237 | irlan_next_client_state(self, IRLAN_MEDIA); | 237 | irlan_next_client_state(self, IRLAN_MEDIA); |
238 | 238 | ||
239 | irlan_get_media_char(self); | 239 | irlan_get_media_char(self); |
240 | break; | 240 | break; |
241 | 241 | ||
242 | case IRLAN_LMP_DISCONNECT: | 242 | case IRLAN_LMP_DISCONNECT: |
243 | case IRLAN_LAP_DISCONNECT: | 243 | case IRLAN_LAP_DISCONNECT: |
244 | irlan_next_client_state(self, IRLAN_IDLE); | 244 | irlan_next_client_state(self, IRLAN_IDLE); |
@@ -252,7 +252,7 @@ static int irlan_client_state_info(struct irlan_cb *self, IRLAN_EVENT event, | |||
252 | } | 252 | } |
253 | if (skb) | 253 | if (skb) |
254 | dev_kfree_skb(skb); | 254 | dev_kfree_skb(skb); |
255 | 255 | ||
256 | return 0; | 256 | return 0; |
257 | } | 257 | } |
258 | 258 | ||
@@ -263,11 +263,11 @@ static int irlan_client_state_info(struct irlan_cb *self, IRLAN_EVENT event, | |||
263 | * reply. | 263 | * reply. |
264 | * | 264 | * |
265 | */ | 265 | */ |
266 | static int irlan_client_state_media(struct irlan_cb *self, IRLAN_EVENT event, | 266 | static int irlan_client_state_media(struct irlan_cb *self, IRLAN_EVENT event, |
267 | struct sk_buff *skb) | 267 | struct sk_buff *skb) |
268 | { | 268 | { |
269 | IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); | 269 | IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); |
270 | 270 | ||
271 | IRDA_ASSERT(self != NULL, return -1;); | 271 | IRDA_ASSERT(self != NULL, return -1;); |
272 | 272 | ||
273 | switch(event) { | 273 | switch(event) { |
@@ -289,7 +289,7 @@ static int irlan_client_state_media(struct irlan_cb *self, IRLAN_EVENT event, | |||
289 | } | 289 | } |
290 | if (skb) | 290 | if (skb) |
291 | dev_kfree_skb(skb); | 291 | dev_kfree_skb(skb); |
292 | 292 | ||
293 | return 0; | 293 | return 0; |
294 | } | 294 | } |
295 | 295 | ||
@@ -300,47 +300,47 @@ static int irlan_client_state_media(struct irlan_cb *self, IRLAN_EVENT event, | |||
300 | * reply | 300 | * reply |
301 | * | 301 | * |
302 | */ | 302 | */ |
303 | static int irlan_client_state_open(struct irlan_cb *self, IRLAN_EVENT event, | 303 | static int irlan_client_state_open(struct irlan_cb *self, IRLAN_EVENT event, |
304 | struct sk_buff *skb) | 304 | struct sk_buff *skb) |
305 | { | 305 | { |
306 | struct qos_info qos; | 306 | struct qos_info qos; |
307 | 307 | ||
308 | IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); | 308 | IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); |
309 | 309 | ||
310 | IRDA_ASSERT(self != NULL, return -1;); | 310 | IRDA_ASSERT(self != NULL, return -1;); |
311 | 311 | ||
312 | switch(event) { | 312 | switch(event) { |
313 | case IRLAN_DATA_INDICATION: | 313 | case IRLAN_DATA_INDICATION: |
314 | irlan_client_parse_response(self, skb); | 314 | irlan_client_parse_response(self, skb); |
315 | 315 | ||
316 | /* | 316 | /* |
317 | * Check if we have got the remote TSAP for data | 317 | * Check if we have got the remote TSAP for data |
318 | * communications | 318 | * communications |
319 | */ | 319 | */ |
320 | IRDA_ASSERT(self->dtsap_sel_data != 0, return -1;); | 320 | IRDA_ASSERT(self->dtsap_sel_data != 0, return -1;); |
321 | 321 | ||
322 | /* Check which access type we are dealing with */ | 322 | /* Check which access type we are dealing with */ |
323 | switch (self->client.access_type) { | 323 | switch (self->client.access_type) { |
324 | case ACCESS_PEER: | 324 | case ACCESS_PEER: |
325 | if (self->provider.state == IRLAN_OPEN) { | 325 | if (self->provider.state == IRLAN_OPEN) { |
326 | 326 | ||
327 | irlan_next_client_state(self, IRLAN_ARB); | 327 | irlan_next_client_state(self, IRLAN_ARB); |
328 | irlan_do_client_event(self, IRLAN_CHECK_CON_ARB, | 328 | irlan_do_client_event(self, IRLAN_CHECK_CON_ARB, |
329 | NULL); | 329 | NULL); |
330 | } else { | 330 | } else { |
331 | 331 | ||
332 | irlan_next_client_state(self, IRLAN_WAIT); | 332 | irlan_next_client_state(self, IRLAN_WAIT); |
333 | } | 333 | } |
334 | break; | 334 | break; |
335 | case ACCESS_DIRECT: | 335 | case ACCESS_DIRECT: |
336 | case ACCESS_HOSTED: | 336 | case ACCESS_HOSTED: |
337 | qos.link_disc_time.bits = 0x01; /* 3 secs */ | 337 | qos.link_disc_time.bits = 0x01; /* 3 secs */ |
338 | 338 | ||
339 | irttp_connect_request(self->tsap_data, | 339 | irttp_connect_request(self->tsap_data, |
340 | self->dtsap_sel_data, | 340 | self->dtsap_sel_data, |
341 | self->saddr, self->daddr, &qos, | 341 | self->saddr, self->daddr, &qos, |
342 | IRLAN_MTU, NULL); | 342 | IRLAN_MTU, NULL); |
343 | 343 | ||
344 | irlan_next_client_state(self, IRLAN_DATA); | 344 | irlan_next_client_state(self, IRLAN_DATA); |
345 | break; | 345 | break; |
346 | default: | 346 | default: |
@@ -359,7 +359,7 @@ static int irlan_client_state_open(struct irlan_cb *self, IRLAN_EVENT event, | |||
359 | IRDA_DEBUG(2, "%s(), Unknown event %d\n", __FUNCTION__ , event); | 359 | IRDA_DEBUG(2, "%s(), Unknown event %d\n", __FUNCTION__ , event); |
360 | break; | 360 | break; |
361 | } | 361 | } |
362 | 362 | ||
363 | if (skb) | 363 | if (skb) |
364 | dev_kfree_skb(skb); | 364 | dev_kfree_skb(skb); |
365 | 365 | ||
@@ -373,13 +373,13 @@ static int irlan_client_state_open(struct irlan_cb *self, IRLAN_EVENT event, | |||
373 | * provider OPEN state. | 373 | * provider OPEN state. |
374 | * | 374 | * |
375 | */ | 375 | */ |
376 | static int irlan_client_state_wait(struct irlan_cb *self, IRLAN_EVENT event, | 376 | static int irlan_client_state_wait(struct irlan_cb *self, IRLAN_EVENT event, |
377 | struct sk_buff *skb) | 377 | struct sk_buff *skb) |
378 | { | 378 | { |
379 | IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); | 379 | IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); |
380 | 380 | ||
381 | IRDA_ASSERT(self != NULL, return -1;); | 381 | IRDA_ASSERT(self != NULL, return -1;); |
382 | 382 | ||
383 | switch(event) { | 383 | switch(event) { |
384 | case IRLAN_PROVIDER_SIGNAL: | 384 | case IRLAN_PROVIDER_SIGNAL: |
385 | irlan_next_client_state(self, IRLAN_ARB); | 385 | irlan_next_client_state(self, IRLAN_ARB); |
@@ -398,36 +398,36 @@ static int irlan_client_state_wait(struct irlan_cb *self, IRLAN_EVENT event, | |||
398 | } | 398 | } |
399 | if (skb) | 399 | if (skb) |
400 | dev_kfree_skb(skb); | 400 | dev_kfree_skb(skb); |
401 | 401 | ||
402 | return 0; | 402 | return 0; |
403 | } | 403 | } |
404 | 404 | ||
405 | static int irlan_client_state_arb(struct irlan_cb *self, IRLAN_EVENT event, | 405 | static int irlan_client_state_arb(struct irlan_cb *self, IRLAN_EVENT event, |
406 | struct sk_buff *skb) | 406 | struct sk_buff *skb) |
407 | { | 407 | { |
408 | struct qos_info qos; | 408 | struct qos_info qos; |
409 | 409 | ||
410 | IRDA_DEBUG(2, "%s()\n", __FUNCTION__ ); | 410 | IRDA_DEBUG(2, "%s()\n", __FUNCTION__ ); |
411 | 411 | ||
412 | IRDA_ASSERT(self != NULL, return -1;); | 412 | IRDA_ASSERT(self != NULL, return -1;); |
413 | 413 | ||
414 | switch(event) { | 414 | switch(event) { |
415 | case IRLAN_CHECK_CON_ARB: | 415 | case IRLAN_CHECK_CON_ARB: |
416 | if (self->client.recv_arb_val == self->provider.send_arb_val) { | 416 | if (self->client.recv_arb_val == self->provider.send_arb_val) { |
417 | irlan_next_client_state(self, IRLAN_CLOSE); | 417 | irlan_next_client_state(self, IRLAN_CLOSE); |
418 | irlan_close_data_channel(self); | 418 | irlan_close_data_channel(self); |
419 | } else if (self->client.recv_arb_val < | 419 | } else if (self->client.recv_arb_val < |
420 | self->provider.send_arb_val) | 420 | self->provider.send_arb_val) |
421 | { | 421 | { |
422 | qos.link_disc_time.bits = 0x01; /* 3 secs */ | 422 | qos.link_disc_time.bits = 0x01; /* 3 secs */ |
423 | 423 | ||
424 | irlan_next_client_state(self, IRLAN_DATA); | 424 | irlan_next_client_state(self, IRLAN_DATA); |
425 | irttp_connect_request(self->tsap_data, | 425 | irttp_connect_request(self->tsap_data, |
426 | self->dtsap_sel_data, | 426 | self->dtsap_sel_data, |
427 | self->saddr, self->daddr, &qos, | 427 | self->saddr, self->daddr, &qos, |
428 | IRLAN_MTU, NULL); | 428 | IRLAN_MTU, NULL); |
429 | } else if (self->client.recv_arb_val > | 429 | } else if (self->client.recv_arb_val > |
430 | self->provider.send_arb_val) | 430 | self->provider.send_arb_val) |
431 | { | 431 | { |
432 | IRDA_DEBUG(2, "%s(), lost the battle :-(\n", __FUNCTION__ ); | 432 | IRDA_DEBUG(2, "%s(), lost the battle :-(\n", __FUNCTION__ ); |
433 | } | 433 | } |
@@ -448,7 +448,7 @@ static int irlan_client_state_arb(struct irlan_cb *self, IRLAN_EVENT event, | |||
448 | } | 448 | } |
449 | if (skb) | 449 | if (skb) |
450 | dev_kfree_skb(skb); | 450 | dev_kfree_skb(skb); |
451 | 451 | ||
452 | return 0; | 452 | return 0; |
453 | } | 453 | } |
454 | 454 | ||
@@ -459,8 +459,8 @@ static int irlan_client_state_arb(struct irlan_cb *self, IRLAN_EVENT event, | |||
459 | * the local and remote machines. | 459 | * the local and remote machines. |
460 | * | 460 | * |
461 | */ | 461 | */ |
462 | static int irlan_client_state_data(struct irlan_cb *self, IRLAN_EVENT event, | 462 | static int irlan_client_state_data(struct irlan_cb *self, IRLAN_EVENT event, |
463 | struct sk_buff *skb) | 463 | struct sk_buff *skb) |
464 | { | 464 | { |
465 | IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); | 465 | IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); |
466 | 466 | ||
@@ -470,7 +470,7 @@ static int irlan_client_state_data(struct irlan_cb *self, IRLAN_EVENT event, | |||
470 | switch(event) { | 470 | switch(event) { |
471 | case IRLAN_DATA_INDICATION: | 471 | case IRLAN_DATA_INDICATION: |
472 | irlan_client_parse_response(self, skb); | 472 | irlan_client_parse_response(self, skb); |
473 | break; | 473 | break; |
474 | case IRLAN_LMP_DISCONNECT: /* FALLTHROUGH */ | 474 | case IRLAN_LMP_DISCONNECT: /* FALLTHROUGH */ |
475 | case IRLAN_LAP_DISCONNECT: | 475 | case IRLAN_LAP_DISCONNECT: |
476 | irlan_next_client_state(self, IRLAN_IDLE); | 476 | irlan_next_client_state(self, IRLAN_IDLE); |
@@ -481,18 +481,18 @@ static int irlan_client_state_data(struct irlan_cb *self, IRLAN_EVENT event, | |||
481 | } | 481 | } |
482 | if (skb) | 482 | if (skb) |
483 | dev_kfree_skb(skb); | 483 | dev_kfree_skb(skb); |
484 | 484 | ||
485 | return 0; | 485 | return 0; |
486 | } | 486 | } |
487 | 487 | ||
488 | /* | 488 | /* |
489 | * Function irlan_client_state_close (self, event, skb, info) | 489 | * Function irlan_client_state_close (self, event, skb, info) |
490 | * | 490 | * |
491 | * | 491 | * |
492 | * | 492 | * |
493 | */ | 493 | */ |
494 | static int irlan_client_state_close(struct irlan_cb *self, IRLAN_EVENT event, | 494 | static int irlan_client_state_close(struct irlan_cb *self, IRLAN_EVENT event, |
495 | struct sk_buff *skb) | 495 | struct sk_buff *skb) |
496 | { | 496 | { |
497 | IRDA_DEBUG(2, "%s()\n", __FUNCTION__ ); | 497 | IRDA_DEBUG(2, "%s()\n", __FUNCTION__ ); |
498 | 498 | ||
@@ -505,17 +505,17 @@ static int irlan_client_state_close(struct irlan_cb *self, IRLAN_EVENT event, | |||
505 | /* | 505 | /* |
506 | * Function irlan_client_state_sync (self, event, skb, info) | 506 | * Function irlan_client_state_sync (self, event, skb, info) |
507 | * | 507 | * |
508 | * | 508 | * |
509 | * | 509 | * |
510 | */ | 510 | */ |
511 | static int irlan_client_state_sync(struct irlan_cb *self, IRLAN_EVENT event, | 511 | static int irlan_client_state_sync(struct irlan_cb *self, IRLAN_EVENT event, |
512 | struct sk_buff *skb) | 512 | struct sk_buff *skb) |
513 | { | 513 | { |
514 | IRDA_DEBUG(2, "%s()\n", __FUNCTION__ ); | 514 | IRDA_DEBUG(2, "%s()\n", __FUNCTION__ ); |
515 | 515 | ||
516 | if (skb) | 516 | if (skb) |
517 | dev_kfree_skb(skb); | 517 | dev_kfree_skb(skb); |
518 | 518 | ||
519 | return 0; | 519 | return 0; |
520 | } | 520 | } |
521 | 521 | ||
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); |
diff --git a/net/irda/irlan/irlan_eth.c b/net/irda/irlan/irlan_eth.c index b0ccc455b747..672ab3f69033 100644 --- a/net/irda/irlan/irlan_eth.c +++ b/net/irda/irlan/irlan_eth.c | |||
@@ -1,8 +1,8 @@ | |||
1 | /********************************************************************* | 1 | /********************************************************************* |
2 | * | 2 | * |
3 | * Filename: irlan_eth.c | 3 | * Filename: irlan_eth.c |
4 | * Version: | 4 | * Version: |
5 | * Description: | 5 | * Description: |
6 | * Status: Experimental. | 6 | * Status: Experimental. |
7 | * Author: Dag Brattli <dagb@cs.uit.no> | 7 | * Author: Dag Brattli <dagb@cs.uit.no> |
8 | * Created at: Thu Oct 15 08:37:58 1998 | 8 | * Created at: Thu Oct 15 08:37:58 1998 |
@@ -11,18 +11,18 @@ | |||
11 | * Sources: skeleton.c by Donald Becker <becker@CESDIS.gsfc.nasa.gov> | 11 | * Sources: skeleton.c by Donald Becker <becker@CESDIS.gsfc.nasa.gov> |
12 | * slip.c by Laurence Culhane, <loz@holmes.demon.co.uk> | 12 | * slip.c by Laurence Culhane, <loz@holmes.demon.co.uk> |
13 | * Fred N. van Kempen, <waltje@uwalt.nl.mugnet.org> | 13 | * Fred N. van Kempen, <waltje@uwalt.nl.mugnet.org> |
14 | * | 14 | * |
15 | * Copyright (c) 1998-2000 Dag Brattli, All Rights Reserved. | 15 | * Copyright (c) 1998-2000 Dag Brattli, All Rights Reserved. |
16 | * | 16 | * |
17 | * This program is free software; you can redistribute it and/or | 17 | * This program is free software; you can redistribute it and/or |
18 | * modify it under the terms of the GNU General Public License as | 18 | * modify it under the terms of the GNU General Public License as |
19 | * published by the Free Software Foundation; either version 2 of | 19 | * published by the Free Software Foundation; either version 2 of |
20 | * the License, or (at your option) any later version. | 20 | * the License, or (at your option) any later version. |
21 | * | 21 | * |
22 | * Neither Dag Brattli nor University of Tromsų admit liability nor | 22 | * Neither Dag Brattli nor University of Tromsų admit liability nor |
23 | * provide warranty for any of this software. This material is | 23 | * provide warranty for any of this software. This material is |
24 | * provided "AS-IS" and at no charge. | 24 | * provided "AS-IS" and at no charge. |
25 | * | 25 | * |
26 | ********************************************************************/ | 26 | ********************************************************************/ |
27 | 27 | ||
28 | #include <linux/netdevice.h> | 28 | #include <linux/netdevice.h> |
@@ -55,7 +55,7 @@ static void irlan_eth_setup(struct net_device *dev) | |||
55 | { | 55 | { |
56 | dev->open = irlan_eth_open; | 56 | dev->open = irlan_eth_open; |
57 | dev->stop = irlan_eth_close; | 57 | dev->stop = irlan_eth_close; |
58 | dev->hard_start_xmit = irlan_eth_xmit; | 58 | dev->hard_start_xmit = irlan_eth_xmit; |
59 | dev->get_stats = irlan_eth_get_stats; | 59 | dev->get_stats = irlan_eth_get_stats; |
60 | dev->set_multicast_list = irlan_eth_set_multicast_list; | 60 | dev->set_multicast_list = irlan_eth_set_multicast_list; |
61 | dev->destructor = free_netdev; | 61 | dev->destructor = free_netdev; |
@@ -63,8 +63,8 @@ static void irlan_eth_setup(struct net_device *dev) | |||
63 | SET_MODULE_OWNER(dev); | 63 | SET_MODULE_OWNER(dev); |
64 | 64 | ||
65 | ether_setup(dev); | 65 | ether_setup(dev); |
66 | 66 | ||
67 | /* | 67 | /* |
68 | * Lets do all queueing in IrTTP instead of this device driver. | 68 | * Lets do all queueing in IrTTP instead of this device driver. |
69 | * Queueing here as well can introduce some strange latency | 69 | * Queueing here as well can introduce some strange latency |
70 | * problems, which we will avoid by setting the queue size to 0. | 70 | * problems, which we will avoid by setting the queue size to 0. |
@@ -104,17 +104,17 @@ struct net_device *alloc_irlandev(const char *name) | |||
104 | static int irlan_eth_open(struct net_device *dev) | 104 | static int irlan_eth_open(struct net_device *dev) |
105 | { | 105 | { |
106 | struct irlan_cb *self = netdev_priv(dev); | 106 | struct irlan_cb *self = netdev_priv(dev); |
107 | 107 | ||
108 | IRDA_DEBUG(2, "%s()\n", __FUNCTION__ ); | 108 | IRDA_DEBUG(2, "%s()\n", __FUNCTION__ ); |
109 | 109 | ||
110 | /* Ready to play! */ | 110 | /* Ready to play! */ |
111 | netif_stop_queue(dev); /* Wait until data link is ready */ | 111 | netif_stop_queue(dev); /* Wait until data link is ready */ |
112 | 112 | ||
113 | /* We are now open, so time to do some work */ | 113 | /* We are now open, so time to do some work */ |
114 | self->disconnect_reason = 0; | 114 | self->disconnect_reason = 0; |
115 | irlan_client_wakeup(self, self->saddr, self->daddr); | 115 | irlan_client_wakeup(self, self->saddr, self->daddr); |
116 | 116 | ||
117 | /* Make sure we have a hardware address before we return, | 117 | /* Make sure we have a hardware address before we return, |
118 | so DHCP clients gets happy */ | 118 | so DHCP clients gets happy */ |
119 | return wait_event_interruptible(self->open_wait, | 119 | return wait_event_interruptible(self->open_wait, |
120 | !self->tsap_data->connected); | 120 | !self->tsap_data->connected); |
@@ -124,30 +124,30 @@ static int irlan_eth_open(struct net_device *dev) | |||
124 | * Function irlan_eth_close (dev) | 124 | * Function irlan_eth_close (dev) |
125 | * | 125 | * |
126 | * Stop the ether network device, his function will usually be called by | 126 | * Stop the ether network device, his function will usually be called by |
127 | * ifconfig down. We should now disconnect the link, We start the | 127 | * ifconfig down. We should now disconnect the link, We start the |
128 | * close timer, so that the instance will be removed if we are unable | 128 | * close timer, so that the instance will be removed if we are unable |
129 | * to discover the remote device after the disconnect. | 129 | * to discover the remote device after the disconnect. |
130 | */ | 130 | */ |
131 | static int irlan_eth_close(struct net_device *dev) | 131 | static int irlan_eth_close(struct net_device *dev) |
132 | { | 132 | { |
133 | struct irlan_cb *self = netdev_priv(dev); | 133 | struct irlan_cb *self = netdev_priv(dev); |
134 | 134 | ||
135 | IRDA_DEBUG(2, "%s()\n", __FUNCTION__ ); | 135 | IRDA_DEBUG(2, "%s()\n", __FUNCTION__ ); |
136 | 136 | ||
137 | /* Stop device */ | 137 | /* Stop device */ |
138 | netif_stop_queue(dev); | 138 | netif_stop_queue(dev); |
139 | 139 | ||
140 | irlan_close_data_channel(self); | 140 | irlan_close_data_channel(self); |
141 | irlan_close_tsaps(self); | 141 | irlan_close_tsaps(self); |
142 | 142 | ||
143 | irlan_do_client_event(self, IRLAN_LMP_DISCONNECT, NULL); | 143 | irlan_do_client_event(self, IRLAN_LMP_DISCONNECT, NULL); |
144 | irlan_do_provider_event(self, IRLAN_LMP_DISCONNECT, NULL); | 144 | irlan_do_provider_event(self, IRLAN_LMP_DISCONNECT, NULL); |
145 | 145 | ||
146 | /* Remove frames queued on the control channel */ | 146 | /* Remove frames queued on the control channel */ |
147 | skb_queue_purge(&self->client.txq); | 147 | skb_queue_purge(&self->client.txq); |
148 | 148 | ||
149 | self->client.tx_busy = 0; | 149 | self->client.tx_busy = 0; |
150 | 150 | ||
151 | return 0; | 151 | return 0; |
152 | } | 152 | } |
153 | 153 | ||
@@ -164,7 +164,7 @@ static int irlan_eth_xmit(struct sk_buff *skb, struct net_device *dev) | |||
164 | 164 | ||
165 | /* skb headroom large enough to contain all IrDA-headers? */ | 165 | /* skb headroom large enough to contain all IrDA-headers? */ |
166 | if ((skb_headroom(skb) < self->max_header_size) || (skb_shared(skb))) { | 166 | if ((skb_headroom(skb) < self->max_header_size) || (skb_shared(skb))) { |
167 | struct sk_buff *new_skb = | 167 | struct sk_buff *new_skb = |
168 | skb_realloc_headroom(skb, self->max_header_size); | 168 | skb_realloc_headroom(skb, self->max_header_size); |
169 | 169 | ||
170 | /* We have to free the original skb anyway */ | 170 | /* We have to free the original skb anyway */ |
@@ -176,7 +176,7 @@ static int irlan_eth_xmit(struct sk_buff *skb, struct net_device *dev) | |||
176 | 176 | ||
177 | /* Use the new skb instead */ | 177 | /* Use the new skb instead */ |
178 | skb = new_skb; | 178 | skb = new_skb; |
179 | } | 179 | } |
180 | 180 | ||
181 | dev->trans_start = jiffies; | 181 | dev->trans_start = jiffies; |
182 | 182 | ||
@@ -187,7 +187,7 @@ static int irlan_eth_xmit(struct sk_buff *skb, struct net_device *dev) | |||
187 | ret = irttp_data_request(self->tsap_data, skb); | 187 | ret = irttp_data_request(self->tsap_data, skb); |
188 | 188 | ||
189 | if (ret < 0) { | 189 | if (ret < 0) { |
190 | /* | 190 | /* |
191 | * IrTTPs tx queue is full, so we just have to | 191 | * IrTTPs tx queue is full, so we just have to |
192 | * drop the frame! You might think that we should | 192 | * drop the frame! You might think that we should |
193 | * just return -1 and don't deallocate the frame, | 193 | * just return -1 and don't deallocate the frame, |
@@ -195,15 +195,15 @@ static int irlan_eth_xmit(struct sk_buff *skb, struct net_device *dev) | |||
195 | * we have replaced the original skb with a new | 195 | * we have replaced the original skb with a new |
196 | * one with larger headroom, and that would really | 196 | * one with larger headroom, and that would really |
197 | * confuse do_dev_queue_xmit() in dev.c! I have | 197 | * confuse do_dev_queue_xmit() in dev.c! I have |
198 | * tried :-) DB | 198 | * tried :-) DB |
199 | */ | 199 | */ |
200 | /* irttp_data_request already free the packet */ | 200 | /* irttp_data_request already free the packet */ |
201 | self->stats.tx_dropped++; | 201 | self->stats.tx_dropped++; |
202 | } else { | 202 | } else { |
203 | self->stats.tx_packets++; | 203 | self->stats.tx_packets++; |
204 | self->stats.tx_bytes += skb->len; | 204 | self->stats.tx_bytes += skb->len; |
205 | } | 205 | } |
206 | 206 | ||
207 | return 0; | 207 | return 0; |
208 | } | 208 | } |
209 | 209 | ||
@@ -218,37 +218,37 @@ int irlan_eth_receive(void *instance, void *sap, struct sk_buff *skb) | |||
218 | struct irlan_cb *self = instance; | 218 | struct irlan_cb *self = instance; |
219 | 219 | ||
220 | if (skb == NULL) { | 220 | if (skb == NULL) { |
221 | ++self->stats.rx_dropped; | 221 | ++self->stats.rx_dropped; |
222 | return 0; | 222 | return 0; |
223 | } | 223 | } |
224 | if (skb->len < ETH_HLEN) { | 224 | if (skb->len < ETH_HLEN) { |
225 | IRDA_DEBUG(0, "%s() : IrLAN frame too short (%d)\n", | 225 | IRDA_DEBUG(0, "%s() : IrLAN frame too short (%d)\n", |
226 | __FUNCTION__, skb->len); | 226 | __FUNCTION__, skb->len); |
227 | ++self->stats.rx_dropped; | 227 | ++self->stats.rx_dropped; |
228 | dev_kfree_skb(skb); | 228 | dev_kfree_skb(skb); |
229 | return 0; | 229 | return 0; |
230 | } | 230 | } |
231 | 231 | ||
232 | /* | 232 | /* |
233 | * Adopt this frame! Important to set all these fields since they | 233 | * Adopt this frame! Important to set all these fields since they |
234 | * might have been previously set by the low level IrDA network | 234 | * might have been previously set by the low level IrDA network |
235 | * device driver | 235 | * device driver |
236 | */ | 236 | */ |
237 | skb->dev = self->dev; | 237 | skb->dev = self->dev; |
238 | skb->protocol=eth_type_trans(skb, skb->dev); /* Remove eth header */ | 238 | skb->protocol=eth_type_trans(skb, skb->dev); /* Remove eth header */ |
239 | 239 | ||
240 | self->stats.rx_packets++; | 240 | self->stats.rx_packets++; |
241 | self->stats.rx_bytes += skb->len; | 241 | self->stats.rx_bytes += skb->len; |
242 | 242 | ||
243 | netif_rx(skb); /* Eat it! */ | 243 | netif_rx(skb); /* Eat it! */ |
244 | 244 | ||
245 | return 0; | 245 | return 0; |
246 | } | 246 | } |
247 | 247 | ||
248 | /* | 248 | /* |
249 | * Function irlan_eth_flow (status) | 249 | * Function irlan_eth_flow (status) |
250 | * | 250 | * |
251 | * Do flow control between IP/Ethernet and IrLAN/IrTTP. This is done by | 251 | * Do flow control between IP/Ethernet and IrLAN/IrTTP. This is done by |
252 | * controlling the queue stop/start. | 252 | * controlling the queue stop/start. |
253 | * | 253 | * |
254 | * The IrDA link layer has the advantage to have flow control, and | 254 | * The IrDA link layer has the advantage to have flow control, and |
@@ -268,11 +268,11 @@ void irlan_eth_flow_indication(void *instance, void *sap, LOCAL_FLOW flow) | |||
268 | 268 | ||
269 | IRDA_ASSERT(self != NULL, return;); | 269 | IRDA_ASSERT(self != NULL, return;); |
270 | IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); | 270 | IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); |
271 | 271 | ||
272 | dev = self->dev; | 272 | dev = self->dev; |
273 | 273 | ||
274 | IRDA_ASSERT(dev != NULL, return;); | 274 | IRDA_ASSERT(dev != NULL, return;); |
275 | 275 | ||
276 | IRDA_DEBUG(0, "%s() : flow %s ; running %d\n", __FUNCTION__, | 276 | IRDA_DEBUG(0, "%s() : flow %s ; running %d\n", __FUNCTION__, |
277 | flow == FLOW_STOP ? "FLOW_STOP" : "FLOW_START", | 277 | flow == FLOW_STOP ? "FLOW_STOP" : "FLOW_START", |
278 | netif_running(dev)); | 278 | netif_running(dev)); |
@@ -301,10 +301,10 @@ void irlan_eth_send_gratuitous_arp(struct net_device *dev) | |||
301 | { | 301 | { |
302 | struct in_device *in_dev; | 302 | struct in_device *in_dev; |
303 | 303 | ||
304 | /* | 304 | /* |
305 | * When we get a new MAC address do a gratuitous ARP. This | 305 | * When we get a new MAC address do a gratuitous ARP. This |
306 | * is useful if we have changed access points on the same | 306 | * is useful if we have changed access points on the same |
307 | * subnet. | 307 | * subnet. |
308 | */ | 308 | */ |
309 | #ifdef CONFIG_INET | 309 | #ifdef CONFIG_INET |
310 | IRDA_DEBUG(4, "IrLAN: Sending gratuitous ARP\n"); | 310 | IRDA_DEBUG(4, "IrLAN: Sending gratuitous ARP\n"); |
@@ -313,10 +313,10 @@ void irlan_eth_send_gratuitous_arp(struct net_device *dev) | |||
313 | if (in_dev == NULL) | 313 | if (in_dev == NULL) |
314 | goto out; | 314 | goto out; |
315 | if (in_dev->ifa_list) | 315 | if (in_dev->ifa_list) |
316 | 316 | ||
317 | arp_send(ARPOP_REQUEST, ETH_P_ARP, | 317 | arp_send(ARPOP_REQUEST, ETH_P_ARP, |
318 | in_dev->ifa_list->ifa_address, | 318 | in_dev->ifa_list->ifa_address, |
319 | dev, | 319 | dev, |
320 | in_dev->ifa_list->ifa_address, | 320 | in_dev->ifa_list->ifa_address, |
321 | NULL, dev->dev_addr, NULL); | 321 | NULL, dev->dev_addr, NULL); |
322 | out: | 322 | out: |
@@ -331,9 +331,9 @@ out: | |||
331 | * | 331 | * |
332 | */ | 332 | */ |
333 | #define HW_MAX_ADDRS 4 /* Must query to get it! */ | 333 | #define HW_MAX_ADDRS 4 /* Must query to get it! */ |
334 | static void irlan_eth_set_multicast_list(struct net_device *dev) | 334 | static void irlan_eth_set_multicast_list(struct net_device *dev) |
335 | { | 335 | { |
336 | struct irlan_cb *self = netdev_priv(dev); | 336 | struct irlan_cb *self = netdev_priv(dev); |
337 | 337 | ||
338 | IRDA_DEBUG(2, "%s()\n", __FUNCTION__ ); | 338 | IRDA_DEBUG(2, "%s()\n", __FUNCTION__ ); |
339 | 339 | ||
@@ -346,7 +346,7 @@ static void irlan_eth_set_multicast_list(struct net_device *dev) | |||
346 | if (dev->flags & IFF_PROMISC) { | 346 | if (dev->flags & IFF_PROMISC) { |
347 | /* Enable promiscuous mode */ | 347 | /* Enable promiscuous mode */ |
348 | IRDA_WARNING("Promiscous mode not implemented by IrLAN!\n"); | 348 | IRDA_WARNING("Promiscous mode not implemented by IrLAN!\n"); |
349 | } | 349 | } |
350 | else if ((dev->flags & IFF_ALLMULTI) || dev->mc_count > HW_MAX_ADDRS) { | 350 | else if ((dev->flags & IFF_ALLMULTI) || dev->mc_count > HW_MAX_ADDRS) { |
351 | /* Disable promiscuous mode, use normal mode. */ | 351 | /* Disable promiscuous mode, use normal mode. */ |
352 | IRDA_DEBUG(4, "%s(), Setting multicast filter\n", __FUNCTION__ ); | 352 | IRDA_DEBUG(4, "%s(), Setting multicast filter\n", __FUNCTION__ ); |
@@ -378,7 +378,7 @@ static void irlan_eth_set_multicast_list(struct net_device *dev) | |||
378 | * Get the current statistics for this device | 378 | * Get the current statistics for this device |
379 | * | 379 | * |
380 | */ | 380 | */ |
381 | static struct net_device_stats *irlan_eth_get_stats(struct net_device *dev) | 381 | static struct net_device_stats *irlan_eth_get_stats(struct net_device *dev) |
382 | { | 382 | { |
383 | struct irlan_cb *self = netdev_priv(dev); | 383 | struct irlan_cb *self = netdev_priv(dev); |
384 | 384 | ||
diff --git a/net/irda/irlan/irlan_event.c b/net/irda/irlan/irlan_event.c index 2778d8c6aa31..623e0fd16c19 100644 --- a/net/irda/irlan/irlan_event.c +++ b/net/irda/irlan/irlan_event.c | |||
@@ -1,25 +1,25 @@ | |||
1 | /********************************************************************* | 1 | /********************************************************************* |
2 | * | 2 | * |
3 | * Filename: irlan_event.c | 3 | * Filename: irlan_event.c |
4 | * Version: | 4 | * Version: |
5 | * Description: | 5 | * Description: |
6 | * Status: Experimental. | 6 | * Status: Experimental. |
7 | * Author: Dag Brattli <dagb@cs.uit.no> | 7 | * Author: Dag Brattli <dagb@cs.uit.no> |
8 | * Created at: Tue Oct 20 09:10:16 1998 | 8 | * Created at: Tue Oct 20 09:10:16 1998 |
9 | * Modified at: Sat Oct 30 12:59:01 1999 | 9 | * Modified at: Sat Oct 30 12:59:01 1999 |
10 | * Modified by: Dag Brattli <dagb@cs.uit.no> | 10 | * Modified by: Dag Brattli <dagb@cs.uit.no> |
11 | * | 11 | * |
12 | * Copyright (c) 1998-1999 Dag Brattli, All Rights Reserved. | 12 | * Copyright (c) 1998-1999 Dag Brattli, All Rights Reserved. |
13 | * | 13 | * |
14 | * This program is free software; you can redistribute it and/or | 14 | * This program is free software; you can redistribute it and/or |
15 | * modify it under the terms of the GNU General Public License as | 15 | * modify it under the terms of the GNU General Public License as |
16 | * published by the Free Software Foundation; either version 2 of | 16 | * published by the Free Software Foundation; either version 2 of |
17 | * the License, or (at your option) any later version. | 17 | * the License, or (at your option) any later version. |
18 | * | 18 | * |
19 | * Neither Dag Brattli nor University of Tromsų admit liability nor | 19 | * Neither Dag Brattli nor University of Tromsų admit liability nor |
20 | * provide warranty for any of this software. This material is | 20 | * provide warranty for any of this software. This material is |
21 | * provided "AS-IS" and at no charge. | 21 | * provided "AS-IS" and at no charge. |
22 | * | 22 | * |
23 | ********************************************************************/ | 23 | ********************************************************************/ |
24 | 24 | ||
25 | #include <net/irda/irlan_event.h> | 25 | #include <net/irda/irlan_event.h> |
@@ -38,7 +38,7 @@ char *irlan_state[] = { | |||
38 | "IRLAN_SYNC", | 38 | "IRLAN_SYNC", |
39 | }; | 39 | }; |
40 | 40 | ||
41 | void irlan_next_client_state(struct irlan_cb *self, IRLAN_STATE state) | 41 | void irlan_next_client_state(struct irlan_cb *self, IRLAN_STATE state) |
42 | { | 42 | { |
43 | IRDA_DEBUG(2, "%s(), %s\n", __FUNCTION__ , irlan_state[state]); | 43 | IRDA_DEBUG(2, "%s(), %s\n", __FUNCTION__ , irlan_state[state]); |
44 | 44 | ||
@@ -48,7 +48,7 @@ void irlan_next_client_state(struct irlan_cb *self, IRLAN_STATE state) | |||
48 | self->client.state = state; | 48 | self->client.state = state; |
49 | } | 49 | } |
50 | 50 | ||
51 | void irlan_next_provider_state(struct irlan_cb *self, IRLAN_STATE state) | 51 | void irlan_next_provider_state(struct irlan_cb *self, IRLAN_STATE state) |
52 | { | 52 | { |
53 | IRDA_DEBUG(2, "%s(), %s\n", __FUNCTION__ , irlan_state[state]); | 53 | IRDA_DEBUG(2, "%s(), %s\n", __FUNCTION__ , irlan_state[state]); |
54 | 54 | ||
diff --git a/net/irda/irlan/irlan_filter.c b/net/irda/irlan/irlan_filter.c index ca7d358dab52..e6346b88f934 100644 --- a/net/irda/irlan/irlan_filter.c +++ b/net/irda/irlan/irlan_filter.c | |||
@@ -1,25 +1,25 @@ | |||
1 | /********************************************************************* | 1 | /********************************************************************* |
2 | * | 2 | * |
3 | * Filename: irlan_filter.c | 3 | * Filename: irlan_filter.c |
4 | * Version: | 4 | * Version: |
5 | * Description: | 5 | * Description: |
6 | * Status: Experimental. | 6 | * Status: Experimental. |
7 | * Author: Dag Brattli <dagb@cs.uit.no> | 7 | * Author: Dag Brattli <dagb@cs.uit.no> |
8 | * Created at: Fri Jan 29 11:16:38 1999 | 8 | * Created at: Fri Jan 29 11:16:38 1999 |
9 | * Modified at: Sat Oct 30 12:58:45 1999 | 9 | * Modified at: Sat Oct 30 12:58:45 1999 |
10 | * Modified by: Dag Brattli <dagb@cs.uit.no> | 10 | * Modified by: Dag Brattli <dagb@cs.uit.no> |
11 | * | 11 | * |
12 | * Copyright (c) 1998-1999 Dag Brattli, All Rights Reserved. | 12 | * Copyright (c) 1998-1999 Dag Brattli, All Rights Reserved. |
13 | * | 13 | * |
14 | * This program is free software; you can redistribute it and/or | 14 | * This program is free software; you can redistribute it and/or |
15 | * modify it under the terms of the GNU General Public License as | 15 | * modify it under the terms of the GNU General Public License as |
16 | * published by the Free Software Foundation; either version 2 of | 16 | * published by the Free Software Foundation; either version 2 of |
17 | * the License, or (at your option) any later version. | 17 | * the License, or (at your option) any later version. |
18 | * | 18 | * |
19 | * Neither Dag Brattli nor University of Tromsų admit liability nor | 19 | * Neither Dag Brattli nor University of Tromsų admit liability nor |
20 | * provide warranty for any of this software. This material is | 20 | * provide warranty for any of this software. This material is |
21 | * provided "AS-IS" and at no charge. | 21 | * provided "AS-IS" and at no charge. |
22 | * | 22 | * |
23 | ********************************************************************/ | 23 | ********************************************************************/ |
24 | 24 | ||
25 | #include <linux/skbuff.h> | 25 | #include <linux/skbuff.h> |
@@ -40,7 +40,7 @@ void irlan_filter_request(struct irlan_cb *self, struct sk_buff *skb) | |||
40 | IRDA_ASSERT(self != NULL, return;); | 40 | IRDA_ASSERT(self != NULL, return;); |
41 | IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); | 41 | IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); |
42 | 42 | ||
43 | if ((self->provider.filter_type == IRLAN_DIRECTED) && | 43 | if ((self->provider.filter_type == IRLAN_DIRECTED) && |
44 | (self->provider.filter_operation == DYNAMIC)) | 44 | (self->provider.filter_operation == DYNAMIC)) |
45 | { | 45 | { |
46 | IRDA_DEBUG(0, "Giving peer a dynamic Ethernet address\n"); | 46 | IRDA_DEBUG(0, "Giving peer a dynamic Ethernet address\n"); |
@@ -48,12 +48,12 @@ void irlan_filter_request(struct irlan_cb *self, struct sk_buff *skb) | |||
48 | self->provider.mac_address[1] = 0x00; | 48 | self->provider.mac_address[1] = 0x00; |
49 | self->provider.mac_address[2] = 0x00; | 49 | self->provider.mac_address[2] = 0x00; |
50 | self->provider.mac_address[3] = 0x00; | 50 | self->provider.mac_address[3] = 0x00; |
51 | 51 | ||
52 | /* Use arbitration value to generate MAC address */ | 52 | /* Use arbitration value to generate MAC address */ |
53 | if (self->provider.access_type == ACCESS_PEER) { | 53 | if (self->provider.access_type == ACCESS_PEER) { |
54 | self->provider.mac_address[4] = | 54 | self->provider.mac_address[4] = |
55 | self->provider.send_arb_val & 0xff; | 55 | self->provider.send_arb_val & 0xff; |
56 | self->provider.mac_address[5] = | 56 | self->provider.mac_address[5] = |
57 | (self->provider.send_arb_val >> 8) & 0xff; | 57 | (self->provider.send_arb_val >> 8) & 0xff; |
58 | } else { | 58 | } else { |
59 | /* Just generate something for now */ | 59 | /* Just generate something for now */ |
@@ -65,12 +65,12 @@ void irlan_filter_request(struct irlan_cb *self, struct sk_buff *skb) | |||
65 | skb->data[1] = 0x03; | 65 | skb->data[1] = 0x03; |
66 | irlan_insert_string_param(skb, "FILTER_MODE", "NONE"); | 66 | irlan_insert_string_param(skb, "FILTER_MODE", "NONE"); |
67 | irlan_insert_short_param(skb, "MAX_ENTRY", 0x0001); | 67 | irlan_insert_short_param(skb, "MAX_ENTRY", 0x0001); |
68 | irlan_insert_array_param(skb, "FILTER_ENTRY", | 68 | irlan_insert_array_param(skb, "FILTER_ENTRY", |
69 | self->provider.mac_address, 6); | 69 | self->provider.mac_address, 6); |
70 | return; | 70 | return; |
71 | } | 71 | } |
72 | 72 | ||
73 | if ((self->provider.filter_type == IRLAN_DIRECTED) && | 73 | if ((self->provider.filter_type == IRLAN_DIRECTED) && |
74 | (self->provider.filter_mode == FILTER)) | 74 | (self->provider.filter_mode == FILTER)) |
75 | { | 75 | { |
76 | IRDA_DEBUG(0, "Directed filter on\n"); | 76 | IRDA_DEBUG(0, "Directed filter on\n"); |
@@ -78,7 +78,7 @@ void irlan_filter_request(struct irlan_cb *self, struct sk_buff *skb) | |||
78 | skb->data[1] = 0x00; | 78 | skb->data[1] = 0x00; |
79 | return; | 79 | return; |
80 | } | 80 | } |
81 | if ((self->provider.filter_type == IRLAN_DIRECTED) && | 81 | if ((self->provider.filter_type == IRLAN_DIRECTED) && |
82 | (self->provider.filter_mode == NONE)) | 82 | (self->provider.filter_mode == NONE)) |
83 | { | 83 | { |
84 | IRDA_DEBUG(0, "Directed filter off\n"); | 84 | IRDA_DEBUG(0, "Directed filter off\n"); |
@@ -87,7 +87,7 @@ void irlan_filter_request(struct irlan_cb *self, struct sk_buff *skb) | |||
87 | return; | 87 | return; |
88 | } | 88 | } |
89 | 89 | ||
90 | if ((self->provider.filter_type == IRLAN_BROADCAST) && | 90 | if ((self->provider.filter_type == IRLAN_BROADCAST) && |
91 | (self->provider.filter_mode == FILTER)) | 91 | (self->provider.filter_mode == FILTER)) |
92 | { | 92 | { |
93 | IRDA_DEBUG(0, "Broadcast filter on\n"); | 93 | IRDA_DEBUG(0, "Broadcast filter on\n"); |
@@ -95,7 +95,7 @@ void irlan_filter_request(struct irlan_cb *self, struct sk_buff *skb) | |||
95 | skb->data[1] = 0x00; | 95 | skb->data[1] = 0x00; |
96 | return; | 96 | return; |
97 | } | 97 | } |
98 | if ((self->provider.filter_type == IRLAN_BROADCAST) && | 98 | if ((self->provider.filter_type == IRLAN_BROADCAST) && |
99 | (self->provider.filter_mode == NONE)) | 99 | (self->provider.filter_mode == NONE)) |
100 | { | 100 | { |
101 | IRDA_DEBUG(0, "Broadcast filter off\n"); | 101 | IRDA_DEBUG(0, "Broadcast filter off\n"); |
@@ -103,7 +103,7 @@ void irlan_filter_request(struct irlan_cb *self, struct sk_buff *skb) | |||
103 | skb->data[1] = 0x00; | 103 | skb->data[1] = 0x00; |
104 | return; | 104 | return; |
105 | } | 105 | } |
106 | if ((self->provider.filter_type == IRLAN_MULTICAST) && | 106 | if ((self->provider.filter_type == IRLAN_MULTICAST) && |
107 | (self->provider.filter_mode == FILTER)) | 107 | (self->provider.filter_mode == FILTER)) |
108 | { | 108 | { |
109 | IRDA_DEBUG(0, "Multicast filter on\n"); | 109 | IRDA_DEBUG(0, "Multicast filter on\n"); |
@@ -111,7 +111,7 @@ void irlan_filter_request(struct irlan_cb *self, struct sk_buff *skb) | |||
111 | skb->data[1] = 0x00; | 111 | skb->data[1] = 0x00; |
112 | return; | 112 | return; |
113 | } | 113 | } |
114 | if ((self->provider.filter_type == IRLAN_MULTICAST) && | 114 | if ((self->provider.filter_type == IRLAN_MULTICAST) && |
115 | (self->provider.filter_mode == NONE)) | 115 | (self->provider.filter_mode == NONE)) |
116 | { | 116 | { |
117 | IRDA_DEBUG(0, "Multicast filter off\n"); | 117 | IRDA_DEBUG(0, "Multicast filter off\n"); |
@@ -119,7 +119,7 @@ void irlan_filter_request(struct irlan_cb *self, struct sk_buff *skb) | |||
119 | skb->data[1] = 0x00; | 119 | skb->data[1] = 0x00; |
120 | return; | 120 | return; |
121 | } | 121 | } |
122 | if ((self->provider.filter_type == IRLAN_MULTICAST) && | 122 | if ((self->provider.filter_type == IRLAN_MULTICAST) && |
123 | (self->provider.filter_operation == GET)) | 123 | (self->provider.filter_operation == GET)) |
124 | { | 124 | { |
125 | IRDA_DEBUG(0, "Multicast filter get\n"); | 125 | IRDA_DEBUG(0, "Multicast filter get\n"); |
diff --git a/net/irda/irlan/irlan_provider.c b/net/irda/irlan/irlan_provider.c index 58efde919667..aac66434e473 100644 --- a/net/irda/irlan/irlan_provider.c +++ b/net/irda/irlan/irlan_provider.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /********************************************************************* | 1 | /********************************************************************* |
2 | * | 2 | * |
3 | * Filename: irlan_provider.c | 3 | * Filename: irlan_provider.c |
4 | * Version: 0.9 | 4 | * Version: 0.9 |
5 | * Description: IrDA LAN Access Protocol Implementation | 5 | * Description: IrDA LAN Access Protocol Implementation |
@@ -11,17 +11,17 @@ | |||
11 | * Sources: skeleton.c by Donald Becker <becker@CESDIS.gsfc.nasa.gov> | 11 | * Sources: skeleton.c by Donald Becker <becker@CESDIS.gsfc.nasa.gov> |
12 | * slip.c by Laurence Culhane, <loz@holmes.demon.co.uk> | 12 | * slip.c by Laurence Culhane, <loz@holmes.demon.co.uk> |
13 | * Fred N. van Kempen, <waltje@uwalt.nl.mugnet.org> | 13 | * Fred N. van Kempen, <waltje@uwalt.nl.mugnet.org> |
14 | * | 14 | * |
15 | * Copyright (c) 1998-1999 Dag Brattli <dagb@cs.uit.no>, | 15 | * Copyright (c) 1998-1999 Dag Brattli <dagb@cs.uit.no>, |
16 | * All Rights Reserved. | 16 | * All Rights Reserved. |
17 | * | 17 | * |
18 | * This program is free software; you can redistribute it and/or | 18 | * This program is free software; you can redistribute it and/or |
19 | * modify it under the terms of the GNU General Public License as | 19 | * modify it under the terms of the GNU General Public License as |
20 | * published by the Free Software Foundation; either version 2 of | 20 | * published by the Free Software Foundation; either version 2 of |
21 | * the License, or (at your option) any later version. | 21 | * the License, or (at your option) any later version. |
22 | * | 22 | * |
23 | * Neither Dag Brattli nor University of Tromsų admit liability nor | 23 | * Neither Dag Brattli nor University of Tromsų admit liability nor |
24 | * provide warranty for any of this software. This material is | 24 | * provide warranty for any of this software. This material is |
25 | * provided "AS-IS" and at no charge. | 25 | * provided "AS-IS" and at no charge. |
26 | * | 26 | * |
27 | ********************************************************************/ | 27 | ********************************************************************/ |
@@ -52,8 +52,8 @@ | |||
52 | #include <net/irda/irlan_filter.h> | 52 | #include <net/irda/irlan_filter.h> |
53 | #include <net/irda/irlan_client.h> | 53 | #include <net/irda/irlan_client.h> |
54 | 54 | ||
55 | static void irlan_provider_connect_indication(void *instance, void *sap, | 55 | static void irlan_provider_connect_indication(void *instance, void *sap, |
56 | struct qos_info *qos, | 56 | struct qos_info *qos, |
57 | __u32 max_sdu_size, | 57 | __u32 max_sdu_size, |
58 | __u8 max_header_size, | 58 | __u8 max_header_size, |
59 | struct sk_buff *skb); | 59 | struct sk_buff *skb); |
@@ -64,14 +64,14 @@ static void irlan_provider_connect_indication(void *instance, void *sap, | |||
64 | * This function gets the data that is received on the control channel | 64 | * This function gets the data that is received on the control channel |
65 | * | 65 | * |
66 | */ | 66 | */ |
67 | static int irlan_provider_data_indication(void *instance, void *sap, | 67 | static int irlan_provider_data_indication(void *instance, void *sap, |
68 | struct sk_buff *skb) | 68 | struct sk_buff *skb) |
69 | { | 69 | { |
70 | struct irlan_cb *self; | 70 | struct irlan_cb *self; |
71 | __u8 code; | 71 | __u8 code; |
72 | 72 | ||
73 | IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); | 73 | IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); |
74 | 74 | ||
75 | self = (struct irlan_cb *) instance; | 75 | self = (struct irlan_cb *) instance; |
76 | 76 | ||
77 | IRDA_ASSERT(self != NULL, return -1;); | 77 | IRDA_ASSERT(self != NULL, return -1;); |
@@ -83,16 +83,16 @@ static int irlan_provider_data_indication(void *instance, void *sap, | |||
83 | switch(code) { | 83 | switch(code) { |
84 | case CMD_GET_PROVIDER_INFO: | 84 | case CMD_GET_PROVIDER_INFO: |
85 | IRDA_DEBUG(4, "Got GET_PROVIDER_INFO command!\n"); | 85 | IRDA_DEBUG(4, "Got GET_PROVIDER_INFO command!\n"); |
86 | irlan_do_provider_event(self, IRLAN_GET_INFO_CMD, skb); | 86 | irlan_do_provider_event(self, IRLAN_GET_INFO_CMD, skb); |
87 | break; | 87 | break; |
88 | 88 | ||
89 | case CMD_GET_MEDIA_CHAR: | 89 | case CMD_GET_MEDIA_CHAR: |
90 | IRDA_DEBUG(4, "Got GET_MEDIA_CHAR command!\n"); | 90 | IRDA_DEBUG(4, "Got GET_MEDIA_CHAR command!\n"); |
91 | irlan_do_provider_event(self, IRLAN_GET_MEDIA_CMD, skb); | 91 | irlan_do_provider_event(self, IRLAN_GET_MEDIA_CMD, skb); |
92 | break; | 92 | break; |
93 | case CMD_OPEN_DATA_CHANNEL: | 93 | case CMD_OPEN_DATA_CHANNEL: |
94 | IRDA_DEBUG(4, "Got OPEN_DATA_CHANNEL command!\n"); | 94 | IRDA_DEBUG(4, "Got OPEN_DATA_CHANNEL command!\n"); |
95 | irlan_do_provider_event(self, IRLAN_OPEN_DATA_CMD, skb); | 95 | irlan_do_provider_event(self, IRLAN_OPEN_DATA_CMD, skb); |
96 | break; | 96 | break; |
97 | case CMD_FILTER_OPERATION: | 97 | case CMD_FILTER_OPERATION: |
98 | IRDA_DEBUG(4, "Got FILTER_OPERATION command!\n"); | 98 | IRDA_DEBUG(4, "Got FILTER_OPERATION command!\n"); |
@@ -119,9 +119,9 @@ static int irlan_provider_data_indication(void *instance, void *sap, | |||
119 | * Got connection from peer IrLAN client | 119 | * Got connection from peer IrLAN client |
120 | * | 120 | * |
121 | */ | 121 | */ |
122 | static void irlan_provider_connect_indication(void *instance, void *sap, | 122 | static void irlan_provider_connect_indication(void *instance, void *sap, |
123 | struct qos_info *qos, | 123 | struct qos_info *qos, |
124 | __u32 max_sdu_size, | 124 | __u32 max_sdu_size, |
125 | __u8 max_header_size, | 125 | __u8 max_header_size, |
126 | struct sk_buff *skb) | 126 | struct sk_buff *skb) |
127 | { | 127 | { |
@@ -130,13 +130,13 @@ static void irlan_provider_connect_indication(void *instance, void *sap, | |||
130 | __u32 saddr, daddr; | 130 | __u32 saddr, daddr; |
131 | 131 | ||
132 | IRDA_DEBUG(0, "%s()\n", __FUNCTION__ ); | 132 | IRDA_DEBUG(0, "%s()\n", __FUNCTION__ ); |
133 | 133 | ||
134 | self = (struct irlan_cb *) instance; | 134 | self = (struct irlan_cb *) instance; |
135 | tsap = (struct tsap_cb *) sap; | 135 | tsap = (struct tsap_cb *) sap; |
136 | 136 | ||
137 | IRDA_ASSERT(self != NULL, return;); | 137 | IRDA_ASSERT(self != NULL, return;); |
138 | IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); | 138 | IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); |
139 | 139 | ||
140 | IRDA_ASSERT(tsap == self->provider.tsap_ctrl,return;); | 140 | IRDA_ASSERT(tsap == self->provider.tsap_ctrl,return;); |
141 | IRDA_ASSERT(self->provider.state == IRLAN_IDLE, return;); | 141 | IRDA_ASSERT(self->provider.state == IRLAN_IDLE, return;); |
142 | 142 | ||
@@ -147,13 +147,13 @@ static void irlan_provider_connect_indication(void *instance, void *sap, | |||
147 | 147 | ||
148 | irlan_do_provider_event(self, IRLAN_CONNECT_INDICATION, NULL); | 148 | irlan_do_provider_event(self, IRLAN_CONNECT_INDICATION, NULL); |
149 | 149 | ||
150 | /* | 150 | /* |
151 | * If we are in peer mode, the client may not have got the discovery | 151 | * If we are in peer mode, the client may not have got the discovery |
152 | * indication it needs to make progress. If the client is still in | 152 | * indication it needs to make progress. If the client is still in |
153 | * IDLE state, we must kick it. | 153 | * IDLE state, we must kick it. |
154 | */ | 154 | */ |
155 | if ((self->provider.access_type == ACCESS_PEER) && | 155 | if ((self->provider.access_type == ACCESS_PEER) && |
156 | (self->client.state == IRLAN_IDLE)) | 156 | (self->client.state == IRLAN_IDLE)) |
157 | { | 157 | { |
158 | irlan_client_wakeup(self, self->saddr, self->daddr); | 158 | irlan_client_wakeup(self, self->saddr, self->daddr); |
159 | } | 159 | } |
@@ -175,38 +175,38 @@ void irlan_provider_connect_response(struct irlan_cb *self, | |||
175 | irttp_connect_response(tsap, IRLAN_MTU, NULL); | 175 | irttp_connect_response(tsap, IRLAN_MTU, NULL); |
176 | } | 176 | } |
177 | 177 | ||
178 | static void irlan_provider_disconnect_indication(void *instance, void *sap, | 178 | static void irlan_provider_disconnect_indication(void *instance, void *sap, |
179 | LM_REASON reason, | 179 | LM_REASON reason, |
180 | struct sk_buff *userdata) | 180 | struct sk_buff *userdata) |
181 | { | 181 | { |
182 | struct irlan_cb *self; | 182 | struct irlan_cb *self; |
183 | struct tsap_cb *tsap; | 183 | struct tsap_cb *tsap; |
184 | 184 | ||
185 | IRDA_DEBUG(4, "%s(), reason=%d\n", __FUNCTION__ , reason); | 185 | IRDA_DEBUG(4, "%s(), reason=%d\n", __FUNCTION__ , reason); |
186 | 186 | ||
187 | self = (struct irlan_cb *) instance; | 187 | self = (struct irlan_cb *) instance; |
188 | tsap = (struct tsap_cb *) sap; | 188 | tsap = (struct tsap_cb *) sap; |
189 | 189 | ||
190 | IRDA_ASSERT(self != NULL, return;); | 190 | IRDA_ASSERT(self != NULL, return;); |
191 | IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); | 191 | IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); |
192 | IRDA_ASSERT(tsap != NULL, return;); | 192 | IRDA_ASSERT(tsap != NULL, return;); |
193 | IRDA_ASSERT(tsap->magic == TTP_TSAP_MAGIC, return;); | 193 | IRDA_ASSERT(tsap->magic == TTP_TSAP_MAGIC, return;); |
194 | 194 | ||
195 | IRDA_ASSERT(tsap == self->provider.tsap_ctrl, return;); | 195 | IRDA_ASSERT(tsap == self->provider.tsap_ctrl, return;); |
196 | 196 | ||
197 | irlan_do_provider_event(self, IRLAN_LMP_DISCONNECT, NULL); | 197 | irlan_do_provider_event(self, IRLAN_LMP_DISCONNECT, NULL); |
198 | } | 198 | } |
199 | 199 | ||
200 | /* | 200 | /* |
201 | * Function irlan_parse_open_data_cmd (self, skb) | 201 | * Function irlan_parse_open_data_cmd (self, skb) |
202 | * | 202 | * |
203 | * | 203 | * |
204 | * | 204 | * |
205 | */ | 205 | */ |
206 | int irlan_parse_open_data_cmd(struct irlan_cb *self, struct sk_buff *skb) | 206 | int irlan_parse_open_data_cmd(struct irlan_cb *self, struct sk_buff *skb) |
207 | { | 207 | { |
208 | int ret; | 208 | int ret; |
209 | 209 | ||
210 | ret = irlan_provider_parse_command(self, CMD_OPEN_DATA_CHANNEL, skb); | 210 | ret = irlan_provider_parse_command(self, CMD_OPEN_DATA_CHANNEL, skb); |
211 | 211 | ||
212 | /* Open data channel */ | 212 | /* Open data channel */ |
@@ -218,12 +218,12 @@ int irlan_parse_open_data_cmd(struct irlan_cb *self, struct sk_buff *skb) | |||
218 | /* | 218 | /* |
219 | * Function parse_command (skb) | 219 | * Function parse_command (skb) |
220 | * | 220 | * |
221 | * Extract all parameters from received buffer, then feed them to | 221 | * Extract all parameters from received buffer, then feed them to |
222 | * check_params for parsing | 222 | * check_params for parsing |
223 | * | 223 | * |
224 | */ | 224 | */ |
225 | int irlan_provider_parse_command(struct irlan_cb *self, int cmd, | 225 | int irlan_provider_parse_command(struct irlan_cb *self, int cmd, |
226 | struct sk_buff *skb) | 226 | struct sk_buff *skb) |
227 | { | 227 | { |
228 | __u8 *frame; | 228 | __u8 *frame; |
229 | __u8 *ptr; | 229 | __u8 *ptr; |
@@ -231,16 +231,16 @@ int irlan_provider_parse_command(struct irlan_cb *self, int cmd, | |||
231 | __u16 val_len; | 231 | __u16 val_len; |
232 | int i; | 232 | int i; |
233 | char *name; | 233 | char *name; |
234 | char *value; | 234 | char *value; |
235 | int ret = RSP_SUCCESS; | 235 | int ret = RSP_SUCCESS; |
236 | 236 | ||
237 | IRDA_ASSERT(skb != NULL, return -RSP_PROTOCOL_ERROR;); | 237 | IRDA_ASSERT(skb != NULL, return -RSP_PROTOCOL_ERROR;); |
238 | 238 | ||
239 | IRDA_DEBUG(4, "%s(), skb->len=%d\n", __FUNCTION__ , (int)skb->len); | 239 | IRDA_DEBUG(4, "%s(), skb->len=%d\n", __FUNCTION__ , (int)skb->len); |
240 | 240 | ||
241 | IRDA_ASSERT(self != NULL, return -RSP_PROTOCOL_ERROR;); | 241 | IRDA_ASSERT(self != NULL, return -RSP_PROTOCOL_ERROR;); |
242 | IRDA_ASSERT(self->magic == IRLAN_MAGIC, return -RSP_PROTOCOL_ERROR;); | 242 | IRDA_ASSERT(self->magic == IRLAN_MAGIC, return -RSP_PROTOCOL_ERROR;); |
243 | 243 | ||
244 | if (!skb) | 244 | if (!skb) |
245 | return -RSP_PROTOCOL_ERROR; | 245 | return -RSP_PROTOCOL_ERROR; |
246 | 246 | ||
@@ -259,11 +259,11 @@ int irlan_provider_parse_command(struct irlan_cb *self, int cmd, | |||
259 | count = frame[1]; | 259 | count = frame[1]; |
260 | 260 | ||
261 | IRDA_DEBUG(4, "Got %d parameters\n", count); | 261 | IRDA_DEBUG(4, "Got %d parameters\n", count); |
262 | 262 | ||
263 | ptr = frame+2; | 263 | ptr = frame+2; |
264 | 264 | ||
265 | /* For all parameters */ | 265 | /* For all parameters */ |
266 | for (i=0; i<count;i++) { | 266 | for (i=0; i<count;i++) { |
267 | ret = irlan_extract_param(ptr, name, value, &val_len); | 267 | ret = irlan_extract_param(ptr, name, value, &val_len); |
268 | if (ret < 0) { | 268 | if (ret < 0) { |
269 | IRDA_DEBUG(2, "%s(), IrLAN, Error!\n", __FUNCTION__ ); | 269 | IRDA_DEBUG(2, "%s(), IrLAN, Error!\n", __FUNCTION__ ); |
@@ -286,7 +286,7 @@ int irlan_provider_parse_command(struct irlan_cb *self, int cmd, | |||
286 | * Send reply to query to peer IrLAN layer | 286 | * Send reply to query to peer IrLAN layer |
287 | * | 287 | * |
288 | */ | 288 | */ |
289 | void irlan_provider_send_reply(struct irlan_cb *self, int command, | 289 | void irlan_provider_send_reply(struct irlan_cb *self, int command, |
290 | int ret_code) | 290 | int ret_code) |
291 | { | 291 | { |
292 | struct sk_buff *skb; | 292 | struct sk_buff *skb; |
@@ -310,7 +310,7 @@ void irlan_provider_send_reply(struct irlan_cb *self, int command, | |||
310 | /* Reserve space for TTP, LMP, and LAP header */ | 310 | /* Reserve space for TTP, LMP, and LAP header */ |
311 | skb_reserve(skb, self->provider.max_header_size); | 311 | skb_reserve(skb, self->provider.max_header_size); |
312 | skb_put(skb, 2); | 312 | skb_put(skb, 2); |
313 | 313 | ||
314 | switch (command) { | 314 | switch (command) { |
315 | case CMD_GET_PROVIDER_INFO: | 315 | case CMD_GET_PROVIDER_INFO: |
316 | skb->data[0] = 0x00; /* Success */ | 316 | skb->data[0] = 0x00; /* Success */ |
@@ -356,7 +356,7 @@ void irlan_provider_send_reply(struct irlan_cb *self, int command, | |||
356 | skb->data[0] = 0x00; /* Success */ | 356 | skb->data[0] = 0x00; /* Success */ |
357 | if (self->provider.send_arb_val) { | 357 | if (self->provider.send_arb_val) { |
358 | skb->data[1] = 0x03; /* 3 parameters */ | 358 | skb->data[1] = 0x03; /* 3 parameters */ |
359 | irlan_insert_short_param(skb, "CON_ARB", | 359 | irlan_insert_short_param(skb, "CON_ARB", |
360 | self->provider.send_arb_val); | 360 | self->provider.send_arb_val); |
361 | } else | 361 | } else |
362 | skb->data[1] = 0x02; /* 2 parameters */ | 362 | skb->data[1] = 0x02; /* 2 parameters */ |
@@ -378,13 +378,13 @@ void irlan_provider_send_reply(struct irlan_cb *self, int command, | |||
378 | * Function irlan_provider_register(void) | 378 | * Function irlan_provider_register(void) |
379 | * | 379 | * |
380 | * Register provider support so we can accept incoming connections. | 380 | * Register provider support so we can accept incoming connections. |
381 | * | 381 | * |
382 | */ | 382 | */ |
383 | int irlan_provider_open_ctrl_tsap(struct irlan_cb *self) | 383 | int irlan_provider_open_ctrl_tsap(struct irlan_cb *self) |
384 | { | 384 | { |
385 | struct tsap_cb *tsap; | 385 | struct tsap_cb *tsap; |
386 | notify_t notify; | 386 | notify_t notify; |
387 | 387 | ||
388 | IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); | 388 | IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); |
389 | 389 | ||
390 | IRDA_ASSERT(self != NULL, return -1;); | 390 | IRDA_ASSERT(self != NULL, return -1;); |
@@ -393,7 +393,7 @@ int irlan_provider_open_ctrl_tsap(struct irlan_cb *self) | |||
393 | /* Check if already open */ | 393 | /* Check if already open */ |
394 | if (self->provider.tsap_ctrl) | 394 | if (self->provider.tsap_ctrl) |
395 | return -1; | 395 | return -1; |
396 | 396 | ||
397 | /* | 397 | /* |
398 | * First register well known control TSAP | 398 | * First register well known control TSAP |
399 | */ | 399 | */ |
diff --git a/net/irda/irlan/irlan_provider_event.c b/net/irda/irlan/irlan_provider_event.c index 5a086f9827ed..ef401bd6ea00 100644 --- a/net/irda/irlan/irlan_provider_event.c +++ b/net/irda/irlan/irlan_provider_event.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /********************************************************************* | 1 | /********************************************************************* |
2 | * | 2 | * |
3 | * Filename: irlan_provider_event.c | 3 | * Filename: irlan_provider_event.c |
4 | * Version: 0.9 | 4 | * Version: 0.9 |
5 | * Description: IrLAN provider state machine) | 5 | * Description: IrLAN provider state machine) |
@@ -8,16 +8,16 @@ | |||
8 | * Created at: Sun Aug 31 20:14:37 1997 | 8 | * Created at: Sun Aug 31 20:14:37 1997 |
9 | * Modified at: Sat Oct 30 12:52:41 1999 | 9 | * Modified at: Sat Oct 30 12:52:41 1999 |
10 | * Modified by: Dag Brattli <dagb@cs.uit.no> | 10 | * Modified by: Dag Brattli <dagb@cs.uit.no> |
11 | * | 11 | * |
12 | * Copyright (c) 1998-1999 Dag Brattli <dagb@cs.uit.no>, All Rights Reserved. | 12 | * Copyright (c) 1998-1999 Dag Brattli <dagb@cs.uit.no>, All Rights Reserved. |
13 | * | 13 | * |
14 | * This program is free software; you can redistribute it and/or | 14 | * This program is free software; you can redistribute it and/or |
15 | * modify it under the terms of the GNU General Public License as | 15 | * modify it under the terms of the GNU General Public License as |
16 | * published by the Free Software Foundation; either version 2 of | 16 | * published by the Free Software Foundation; either version 2 of |
17 | * the License, or (at your option) any later version. | 17 | * the License, or (at your option) any later version. |
18 | * | 18 | * |
19 | * Neither Dag Brattli nor University of Tromsų admit liability nor | 19 | * Neither Dag Brattli nor University of Tromsų admit liability nor |
20 | * provide warranty for any of this software. This material is | 20 | * provide warranty for any of this software. This material is |
21 | * provided "AS-IS" and at no charge. | 21 | * provided "AS-IS" and at no charge. |
22 | * | 22 | * |
23 | ********************************************************************/ | 23 | ********************************************************************/ |
@@ -30,18 +30,18 @@ | |||
30 | #include <net/irda/irlan_provider.h> | 30 | #include <net/irda/irlan_provider.h> |
31 | #include <net/irda/irlan_event.h> | 31 | #include <net/irda/irlan_event.h> |
32 | 32 | ||
33 | static int irlan_provider_state_idle(struct irlan_cb *self, IRLAN_EVENT event, | 33 | static int irlan_provider_state_idle(struct irlan_cb *self, IRLAN_EVENT event, |
34 | struct sk_buff *skb); | 34 | struct sk_buff *skb); |
35 | static int irlan_provider_state_info(struct irlan_cb *self, IRLAN_EVENT event, | 35 | static int irlan_provider_state_info(struct irlan_cb *self, IRLAN_EVENT event, |
36 | struct sk_buff *skb); | 36 | struct sk_buff *skb); |
37 | static int irlan_provider_state_open(struct irlan_cb *self, IRLAN_EVENT event, | 37 | static int irlan_provider_state_open(struct irlan_cb *self, IRLAN_EVENT event, |
38 | struct sk_buff *skb); | 38 | struct sk_buff *skb); |
39 | static int irlan_provider_state_data(struct irlan_cb *self, IRLAN_EVENT event, | 39 | static int irlan_provider_state_data(struct irlan_cb *self, IRLAN_EVENT event, |
40 | struct sk_buff *skb); | 40 | struct sk_buff *skb); |
41 | 41 | ||
42 | static int (*state[])(struct irlan_cb *self, IRLAN_EVENT event, | 42 | static int (*state[])(struct irlan_cb *self, IRLAN_EVENT event, |
43 | struct sk_buff *skb) = | 43 | struct sk_buff *skb) = |
44 | { | 44 | { |
45 | irlan_provider_state_idle, | 45 | irlan_provider_state_idle, |
46 | NULL, /* Query */ | 46 | NULL, /* Query */ |
47 | NULL, /* Info */ | 47 | NULL, /* Info */ |
@@ -55,8 +55,8 @@ static int (*state[])(struct irlan_cb *self, IRLAN_EVENT event, | |||
55 | NULL, /* Sync */ | 55 | NULL, /* Sync */ |
56 | }; | 56 | }; |
57 | 57 | ||
58 | void irlan_do_provider_event(struct irlan_cb *self, IRLAN_EVENT event, | 58 | void irlan_do_provider_event(struct irlan_cb *self, IRLAN_EVENT event, |
59 | struct sk_buff *skb) | 59 | struct sk_buff *skb) |
60 | { | 60 | { |
61 | IRDA_ASSERT(*state[ self->provider.state] != NULL, return;); | 61 | IRDA_ASSERT(*state[ self->provider.state] != NULL, return;); |
62 | 62 | ||
@@ -73,9 +73,9 @@ static int irlan_provider_state_idle(struct irlan_cb *self, IRLAN_EVENT event, | |||
73 | struct sk_buff *skb) | 73 | struct sk_buff *skb) |
74 | { | 74 | { |
75 | IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); | 75 | IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); |
76 | 76 | ||
77 | IRDA_ASSERT(self != NULL, return -1;); | 77 | IRDA_ASSERT(self != NULL, return -1;); |
78 | 78 | ||
79 | switch(event) { | 79 | switch(event) { |
80 | case IRLAN_CONNECT_INDICATION: | 80 | case IRLAN_CONNECT_INDICATION: |
81 | irlan_provider_connect_response( self, self->provider.tsap_ctrl); | 81 | irlan_provider_connect_response( self, self->provider.tsap_ctrl); |
@@ -96,13 +96,13 @@ static int irlan_provider_state_idle(struct irlan_cb *self, IRLAN_EVENT event, | |||
96 | * | 96 | * |
97 | * INFO, We have issued a GetInfo command and is awaiting a reply. | 97 | * INFO, We have issued a GetInfo command and is awaiting a reply. |
98 | */ | 98 | */ |
99 | static int irlan_provider_state_info(struct irlan_cb *self, IRLAN_EVENT event, | 99 | static int irlan_provider_state_info(struct irlan_cb *self, IRLAN_EVENT event, |
100 | struct sk_buff *skb) | 100 | struct sk_buff *skb) |
101 | { | 101 | { |
102 | int ret; | 102 | int ret; |
103 | 103 | ||
104 | IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); | 104 | IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); |
105 | 105 | ||
106 | IRDA_ASSERT(self != NULL, return -1;); | 106 | IRDA_ASSERT(self != NULL, return -1;); |
107 | 107 | ||
108 | switch(event) { | 108 | switch(event) { |
@@ -110,7 +110,7 @@ static int irlan_provider_state_info(struct irlan_cb *self, IRLAN_EVENT event, | |||
110 | /* Be sure to use 802.3 in case of peer mode */ | 110 | /* Be sure to use 802.3 in case of peer mode */ |
111 | if (self->provider.access_type == ACCESS_PEER) { | 111 | if (self->provider.access_type == ACCESS_PEER) { |
112 | self->media = MEDIA_802_3; | 112 | self->media = MEDIA_802_3; |
113 | 113 | ||
114 | /* Check if client has started yet */ | 114 | /* Check if client has started yet */ |
115 | if (self->client.state == IRLAN_IDLE) { | 115 | if (self->client.state == IRLAN_IDLE) { |
116 | /* This should get the client going */ | 116 | /* This should get the client going */ |
@@ -118,15 +118,15 @@ static int irlan_provider_state_info(struct irlan_cb *self, IRLAN_EVENT event, | |||
118 | } | 118 | } |
119 | } | 119 | } |
120 | 120 | ||
121 | irlan_provider_send_reply(self, CMD_GET_PROVIDER_INFO, | 121 | irlan_provider_send_reply(self, CMD_GET_PROVIDER_INFO, |
122 | RSP_SUCCESS); | 122 | RSP_SUCCESS); |
123 | /* Keep state */ | 123 | /* Keep state */ |
124 | break; | 124 | break; |
125 | case IRLAN_GET_MEDIA_CMD: | 125 | case IRLAN_GET_MEDIA_CMD: |
126 | irlan_provider_send_reply(self, CMD_GET_MEDIA_CHAR, | 126 | irlan_provider_send_reply(self, CMD_GET_MEDIA_CHAR, |
127 | RSP_SUCCESS); | 127 | RSP_SUCCESS); |
128 | /* Keep state */ | 128 | /* Keep state */ |
129 | break; | 129 | break; |
130 | case IRLAN_OPEN_DATA_CMD: | 130 | case IRLAN_OPEN_DATA_CMD: |
131 | ret = irlan_parse_open_data_cmd(self, skb); | 131 | ret = irlan_parse_open_data_cmd(self, skb); |
132 | if (self->provider.access_type == ACCESS_PEER) { | 132 | if (self->provider.access_type == ACCESS_PEER) { |
@@ -152,7 +152,7 @@ static int irlan_provider_state_info(struct irlan_cb *self, IRLAN_EVENT event, | |||
152 | } | 152 | } |
153 | if (skb) | 153 | if (skb) |
154 | dev_kfree_skb(skb); | 154 | dev_kfree_skb(skb); |
155 | 155 | ||
156 | return 0; | 156 | return 0; |
157 | } | 157 | } |
158 | 158 | ||
@@ -163,7 +163,7 @@ static int irlan_provider_state_info(struct irlan_cb *self, IRLAN_EVENT event, | |||
163 | * reply | 163 | * reply |
164 | * | 164 | * |
165 | */ | 165 | */ |
166 | static int irlan_provider_state_open(struct irlan_cb *self, IRLAN_EVENT event, | 166 | static int irlan_provider_state_open(struct irlan_cb *self, IRLAN_EVENT event, |
167 | struct sk_buff *skb) | 167 | struct sk_buff *skb) |
168 | { | 168 | { |
169 | IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); | 169 | IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); |
@@ -173,11 +173,11 @@ static int irlan_provider_state_open(struct irlan_cb *self, IRLAN_EVENT event, | |||
173 | switch(event) { | 173 | switch(event) { |
174 | case IRLAN_FILTER_CONFIG_CMD: | 174 | case IRLAN_FILTER_CONFIG_CMD: |
175 | irlan_provider_parse_command(self, CMD_FILTER_OPERATION, skb); | 175 | irlan_provider_parse_command(self, CMD_FILTER_OPERATION, skb); |
176 | irlan_provider_send_reply(self, CMD_FILTER_OPERATION, | 176 | irlan_provider_send_reply(self, CMD_FILTER_OPERATION, |
177 | RSP_SUCCESS); | 177 | RSP_SUCCESS); |
178 | /* Keep state */ | 178 | /* Keep state */ |
179 | break; | 179 | break; |
180 | case IRLAN_DATA_CONNECT_INDICATION: | 180 | case IRLAN_DATA_CONNECT_INDICATION: |
181 | irlan_next_provider_state(self, IRLAN_DATA); | 181 | irlan_next_provider_state(self, IRLAN_DATA); |
182 | irlan_provider_connect_response(self, self->tsap_data); | 182 | irlan_provider_connect_response(self, self->tsap_data); |
183 | break; | 183 | break; |
@@ -202,8 +202,8 @@ static int irlan_provider_state_open(struct irlan_cb *self, IRLAN_EVENT event, | |||
202 | * the local and remote machines. | 202 | * the local and remote machines. |
203 | * | 203 | * |
204 | */ | 204 | */ |
205 | static int irlan_provider_state_data(struct irlan_cb *self, IRLAN_EVENT event, | 205 | static int irlan_provider_state_data(struct irlan_cb *self, IRLAN_EVENT event, |
206 | struct sk_buff *skb) | 206 | struct sk_buff *skb) |
207 | { | 207 | { |
208 | IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); | 208 | IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); |
209 | 209 | ||
@@ -213,7 +213,7 @@ static int irlan_provider_state_data(struct irlan_cb *self, IRLAN_EVENT event, | |||
213 | switch(event) { | 213 | switch(event) { |
214 | case IRLAN_FILTER_CONFIG_CMD: | 214 | case IRLAN_FILTER_CONFIG_CMD: |
215 | irlan_provider_parse_command(self, CMD_FILTER_OPERATION, skb); | 215 | irlan_provider_parse_command(self, CMD_FILTER_OPERATION, skb); |
216 | irlan_provider_send_reply(self, CMD_FILTER_OPERATION, | 216 | irlan_provider_send_reply(self, CMD_FILTER_OPERATION, |
217 | RSP_SUCCESS); | 217 | RSP_SUCCESS); |
218 | break; | 218 | break; |
219 | case IRLAN_LMP_DISCONNECT: /* FALLTHROUGH */ | 219 | case IRLAN_LMP_DISCONNECT: /* FALLTHROUGH */ |
@@ -226,7 +226,7 @@ static int irlan_provider_state_data(struct irlan_cb *self, IRLAN_EVENT event, | |||
226 | } | 226 | } |
227 | if (skb) | 227 | if (skb) |
228 | dev_kfree_skb(skb); | 228 | dev_kfree_skb(skb); |
229 | 229 | ||
230 | return 0; | 230 | return 0; |
231 | } | 231 | } |
232 | 232 | ||