diff options
author | YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org> | 2007-02-09 23:24:53 +0900 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-02-10 23:19:47 -0800 |
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 95cf1234ea1..a4c1c954582 100644 --- a/net/irda/irlan/irlan_client.c +++ b/net/irda/irlan/irlan_client.c @@ -1,5 +1,5 @@ /********************************************************************* - * + * * Filename: irlan_client.c * Version: 0.9 * Description: IrDA LAN Access Protocol (IrLAN) Client @@ -11,17 +11,17 @@ * Sources: skeleton.c by Donald Becker <becker@CESDIS.gsfc.nasa.gov> * slip.c by Laurence Culhane, <loz@holmes.demon.co.uk> * Fred N. van Kempen, <waltje@uwalt.nl.mugnet.org> - * - * Copyright (c) 1998-1999 Dag Brattli <dagb@cs.uit.no>, + * + * Copyright (c) 1998-1999 Dag Brattli <dagb@cs.uit.no>, * All Rights Reserved. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * Neither Dag Brattli nor University of Tromsų admit liability nor - * provide warranty for any of this software. This material is + * provide warranty for any of this software. This material is * provided "AS-IS" and at no charge. * ********************************************************************/ @@ -54,35 +54,35 @@ #undef CONFIG_IRLAN_GRATUITOUS_ARP -static void irlan_client_ctrl_disconnect_indication(void *instance, void *sap, - LM_REASON reason, +static void irlan_client_ctrl_disconnect_indication(void *instance, void *sap, + LM_REASON reason, struct sk_buff *); -static int irlan_client_ctrl_data_indication(void *instance, void *sap, +static int irlan_client_ctrl_data_indication(void *instance, void *sap, struct sk_buff *skb); -static void irlan_client_ctrl_connect_confirm(void *instance, void *sap, - struct qos_info *qos, +static void irlan_client_ctrl_connect_confirm(void *instance, void *sap, + struct qos_info *qos, __u32 max_sdu_size, __u8 max_header_size, struct sk_buff *); -static void irlan_check_response_param(struct irlan_cb *self, char *param, +static void irlan_check_response_param(struct irlan_cb *self, char *param, char *value, int val_len); static void irlan_client_open_ctrl_tsap(struct irlan_cb *self); static void irlan_client_kick_timer_expired(void *data) { struct irlan_cb *self = (struct irlan_cb *) data; - + IRDA_DEBUG(2, "%s()\n", __FUNCTION__ ); IRDA_ASSERT(self != NULL, return;); IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); - - /* + + /* * If we are in peer mode, the client may not have got the discovery - * indication it needs to make progress. If the client is still in + * indication it needs to make progress. If the client is still in * IDLE state, we must kick it to, but only if the provider is not IDLE - */ - if ((self->provider.access_type == ACCESS_PEER) && + */ + if ((self->provider.access_type == ACCESS_PEER) && (self->client.state == IRLAN_IDLE) && (self->provider.state != IRLAN_IDLE)) { irlan_client_wakeup(self, self->saddr, self->daddr); @@ -92,8 +92,8 @@ static void irlan_client_kick_timer_expired(void *data) static void irlan_client_start_kick_timer(struct irlan_cb *self, int timeout) { IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); - - irda_start_timer(&self->client.kick_timer, timeout, (void *) self, + + irda_start_timer(&self->client.kick_timer, timeout, (void *) self, irlan_client_kick_timer_expired); } @@ -110,11 +110,11 @@ void irlan_client_wakeup(struct irlan_cb *self, __u32 saddr, __u32 daddr) IRDA_ASSERT(self != NULL, return;); IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); - /* + /* * Check if we are already awake, or if we are a provider in direct * mode (in that case we must leave the client idle */ - if ((self->client.state != IRLAN_IDLE) || + if ((self->client.state != IRLAN_IDLE) || (self->provider.access_type == ACCESS_DIRECT)) { IRDA_DEBUG(0, "%s(), already awake!\n", __FUNCTION__ ); @@ -135,7 +135,7 @@ void irlan_client_wakeup(struct irlan_cb *self, __u32 saddr, __u32 daddr) irlan_open_data_tsap(self); irlan_do_client_event(self, IRLAN_DISCOVERY_INDICATION, NULL); - + /* Start kick timer */ irlan_client_start_kick_timer(self, 2*HZ); } @@ -148,11 +148,11 @@ void irlan_client_wakeup(struct irlan_cb *self, __u32 saddr, __u32 daddr) */ void irlan_client_discovery_indication(discinfo_t *discovery, DISCOVERY_MODE mode, - void *priv) + void *priv) { struct irlan_cb *self; __u32 saddr, daddr; - + IRDA_DEBUG(1, "%s()\n", __FUNCTION__ ); IRDA_ASSERT(discovery != NULL, return;); @@ -177,35 +177,35 @@ void irlan_client_discovery_indication(discinfo_t *discovery, IRDA_DEBUG(1, "%s(), Found instance (%08x)!\n", __FUNCTION__ , daddr); - + irlan_client_wakeup(self, saddr, daddr); } IRDA_ASSERT_LABEL(out:) rcu_read_unlock(); } - + /* * Function irlan_client_data_indication (handle, skb) * * This function gets the data that is received on the control channel * */ -static int irlan_client_ctrl_data_indication(void *instance, void *sap, +static int irlan_client_ctrl_data_indication(void *instance, void *sap, struct sk_buff *skb) { struct irlan_cb *self; - + IRDA_DEBUG(2, "%s()\n", __FUNCTION__ ); - + self = (struct irlan_cb *) instance; - + IRDA_ASSERT(self != NULL, return -1;); IRDA_ASSERT(self->magic == IRLAN_MAGIC, return -1;); IRDA_ASSERT(skb != NULL, return -1;); - - irlan_do_client_event(self, IRLAN_DATA_INDICATION, skb); - /* Ready for a new command */ + irlan_do_client_event(self, IRLAN_DATA_INDICATION, skb); + + /* Ready for a new command */ IRDA_DEBUG(2, "%s(), clearing tx_busy\n", __FUNCTION__ ); self->client.tx_busy = FALSE; @@ -215,27 +215,27 @@ static int irlan_client_ctrl_data_indication(void *instance, void *sap, return 0; } -static void irlan_client_ctrl_disconnect_indication(void *instance, void *sap, - LM_REASON reason, - struct sk_buff *userdata) +static void irlan_client_ctrl_disconnect_indication(void *instance, void *sap, + LM_REASON reason, + struct sk_buff *userdata) { struct irlan_cb *self; struct tsap_cb *tsap; struct sk_buff *skb; IRDA_DEBUG(4, "%s(), reason=%d\n", __FUNCTION__ , reason); - + self = (struct irlan_cb *) instance; tsap = (struct tsap_cb *) sap; IRDA_ASSERT(self != NULL, return;); - IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); + IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); IRDA_ASSERT(tsap != NULL, return;); IRDA_ASSERT(tsap->magic == TTP_TSAP_MAGIC, return;); - + IRDA_ASSERT(tsap == self->client.tsap_ctrl, return;); - /* Remove frames queued on the control channel */ + /* Remove frames queued on the control channel */ while ((skb = skb_dequeue(&self->client.txq)) != NULL) { dev_kfree_skb(skb); } @@ -272,7 +272,7 @@ static void irlan_client_open_ctrl_tsap(struct irlan_cb *self) notify.disconnect_indication = irlan_client_ctrl_disconnect_indication; notify.instance = self; strlcpy(notify.name, "IrLAN ctrl (c)", sizeof(notify.name)); - + tsap = irttp_open_tsap(LSAP_ANY, DEFAULT_INITIAL_CREDIT, ¬ify); if (!tsap) { IRDA_DEBUG(2, "%s(), Got no tsap!\n", __FUNCTION__ ); @@ -287,11 +287,11 @@ static void irlan_client_open_ctrl_tsap(struct irlan_cb *self) * Connection to peer IrLAN laye confirmed * */ -static void irlan_client_ctrl_connect_confirm(void *instance, void *sap, - struct qos_info *qos, +static void irlan_client_ctrl_connect_confirm(void *instance, void *sap, + struct qos_info *qos, __u32 max_sdu_size, __u8 max_header_size, - struct sk_buff *skb) + struct sk_buff *skb) { struct irlan_cb *self; @@ -316,7 +316,7 @@ static void irlan_client_ctrl_connect_confirm(void *instance, void *sap, * Print return code of request to peer IrLAN layer. * */ -static void print_ret_code(__u8 code) +static void print_ret_code(__u8 code) { switch(code) { case 0: @@ -358,7 +358,7 @@ static void print_ret_code(__u8 code) /* * Function irlan_client_parse_response (self, skb) * - * Extract all parameters from received buffer, then feed them to + * Extract all parameters from received buffer, then feed them to * check_params for parsing */ 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) int ret; __u16 val_len; int i; - char *name; - char *value; + char *name; + char *value; + + IRDA_ASSERT(skb != NULL, return;); - IRDA_ASSERT(skb != NULL, return;); - IRDA_DEBUG(4, "%s() skb->len=%d\n", __FUNCTION__ , (int) skb->len); - + IRDA_ASSERT(self != NULL, return;); IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); - + if (!skb) { IRDA_ERROR("%s(), Got NULL skb!\n", __FUNCTION__); return; } frame = skb->data; - - /* - * Check return code and print it if not success + + /* + * Check return code and print it if not success */ if (frame[0]) { print_ret_code(frame[0]); return; } - + name = kmalloc(255, GFP_ATOMIC); if (!name) return; @@ -406,11 +406,11 @@ void irlan_client_parse_response(struct irlan_cb *self, struct sk_buff *skb) count = frame[1]; IRDA_DEBUG(4, "%s(), got %d parameters\n", __FUNCTION__ , count); - + ptr = frame+2; /* For all parameters */ - for (i=0; i<count;i++) { + for (i=0; i<count;i++) { ret = irlan_extract_param(ptr, name, value, &val_len); if (ret < 0) { 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) } ptr += ret; irlan_check_response_param(self, name, value, val_len); - } + } /* Cleanup */ kfree(name); kfree(value); @@ -430,8 +430,8 @@ void irlan_client_parse_response(struct irlan_cb *self, struct sk_buff *skb) * Check which parameter is received and update local variables * */ -static void irlan_check_response_param(struct irlan_cb *self, char *param, - char *value, int val_len) +static void irlan_check_response_param(struct irlan_cb *self, char *param, + char *value, int val_len) { __u16 tmp_cpu; /* Temporary value in host order */ __u8 *bytes; @@ -465,7 +465,7 @@ static void irlan_check_response_param(struct irlan_cb *self, char *param, self->client.filter_type |= IRLAN_BROADCAST; else if (strcmp(value, "IPX_SOCKET") == 0) self->client.filter_type |= IRLAN_IPX_SOCKET; - + } if (strcmp(param, "ACCESS_TYPE") == 0) { if (strcmp(value, "DIRECT") == 0) @@ -480,7 +480,7 @@ static void irlan_check_response_param(struct irlan_cb *self, char *param, } /* IRLAN version */ if (strcmp(param, "IRLAN_VER") == 0) { - IRDA_DEBUG(4, "IrLAN version %d.%d\n", (__u8) value[0], + IRDA_DEBUG(4, "IrLAN version %d.%d\n", (__u8) value[0], (__u8) value[1]); self->version[0] = value[0]; @@ -497,17 +497,17 @@ static void irlan_check_response_param(struct irlan_cb *self, char *param, memcpy(&tmp_cpu, value, 2); /* Align value */ le16_to_cpus(&tmp_cpu); /* Convert to host order */ self->client.recv_arb_val = tmp_cpu; - IRDA_DEBUG(2, "%s(), receive arb val=%d\n", __FUNCTION__ , + IRDA_DEBUG(2, "%s(), receive arb val=%d\n", __FUNCTION__ , self->client.recv_arb_val); } if (strcmp(param, "MAX_FRAME") == 0) { memcpy(&tmp_cpu, value, 2); /* Align value */ le16_to_cpus(&tmp_cpu); /* Convert to host order */ self->client.max_frame = tmp_cpu; - IRDA_DEBUG(4, "%s(), max frame=%d\n", __FUNCTION__ , + IRDA_DEBUG(4, "%s(), max frame=%d\n", __FUNCTION__ , self->client.max_frame); } - + /* RECONNECT_KEY, in case the link goes down! */ if (strcmp(param, "RECONNECT_KEY") == 0) { IRDA_DEBUG(4, "Got reconnect key: "); @@ -521,9 +521,9 @@ static void irlan_check_response_param(struct irlan_cb *self, char *param, if (strcmp(param, "FILTER_ENTRY") == 0) { bytes = value; IRDA_DEBUG(4, "Ethernet address = %02x:%02x:%02x:%02x:%02x:%02x\n", - bytes[0], bytes[1], bytes[2], bytes[3], bytes[4], + bytes[0], bytes[1], bytes[2], bytes[3], bytes[4], bytes[5]); - for (i = 0; i < 6; i++) + for (i = 0; i < 6; i++) self->dev->dev_addr[i] = bytes[i]; } } @@ -534,11 +534,11 @@ static void irlan_check_response_param(struct irlan_cb *self, char *param, * Got results from remote LM-IAS * */ -void irlan_client_get_value_confirm(int result, __u16 obj_id, - struct ias_value *value, void *priv) +void irlan_client_get_value_confirm(int result, __u16 obj_id, + struct ias_value *value, void *priv) { struct irlan_cb *self; - + IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); IRDA_ASSERT(priv != NULL, return;); @@ -553,7 +553,7 @@ void irlan_client_get_value_confirm(int result, __u16 obj_id, /* Check if request succeeded */ if (result != IAS_SUCCESS) { IRDA_DEBUG(2, "%s(), got NULL value!\n", __FUNCTION__ ); - irlan_do_client_event(self, IRLAN_IAS_PROVIDER_NOT_AVAIL, + irlan_do_client_event(self, IRLAN_IAS_PROVIDER_NOT_AVAIL, NULL); return; } diff --git a/net/irda/irlan/irlan_client_event.c b/net/irda/irlan/irlan_client_event.c index ce943b69e99..843ab6fbb39 100644 --- a/net/irda/irlan/irlan_client_event.c +++ b/net/irda/irlan/irlan_client_event.c @@ -1,5 +1,5 @@ /********************************************************************* - * + * * Filename: irlan_client_event.c * Version: 0.9 * Description: IrLAN client state machine @@ -8,17 +8,17 @@ * Created at: Sun Aug 31 20:14:37 1997 * Modified at: Sun Dec 26 21:52:24 1999 * Modified by: Dag Brattli <dagb@cs.uit.no> - * - * Copyright (c) 1998-1999 Dag Brattli <dagb@cs.uit.no>, + * + * Copyright (c) 1998-1999 Dag Brattli <dagb@cs.uit.no>, * All Rights Reserved. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * Neither Dag Brattli nor University of Tromsų admit liability nor - * provide warranty for any of this software. This material is + * provide warranty for any of this software. This material is * provided "AS-IS" and at no charge. * ********************************************************************/ @@ -36,31 +36,31 @@ #include <net/irda/irlan_client.h> #include <net/irda/irlan_event.h> -static int irlan_client_state_idle (struct irlan_cb *self, IRLAN_EVENT event, +static int irlan_client_state_idle (struct irlan_cb *self, IRLAN_EVENT event, struct sk_buff *skb); -static int irlan_client_state_query(struct irlan_cb *self, IRLAN_EVENT event, +static int irlan_client_state_query(struct irlan_cb *self, IRLAN_EVENT event, struct sk_buff *skb); -static int irlan_client_state_conn (struct irlan_cb *self, IRLAN_EVENT event, +static int irlan_client_state_conn (struct irlan_cb *self, IRLAN_EVENT event, struct sk_buff *skb); -static int irlan_client_state_info (struct irlan_cb *self, IRLAN_EVENT event, +static int irlan_client_state_info (struct irlan_cb *self, IRLAN_EVENT event, struct sk_buff *skb); -static int irlan_client_state_media(struct irlan_cb *self, IRLAN_EVENT event, +static int irlan_client_state_media(struct irlan_cb *self, IRLAN_EVENT event, struct sk_buff *skb); -static int irlan_client_state_open (struct irlan_cb *self, IRLAN_EVENT event, +static int irlan_client_state_open (struct irlan_cb *self, IRLAN_EVENT event, struct sk_buff *skb); -static int irlan_client_state_wait (struct irlan_cb *self, IRLAN_EVENT event, +static int irlan_client_state_wait (struct irlan_cb *self, IRLAN_EVENT event, struct sk_buff *skb); -static int irlan_client_state_arb (struct irlan_cb *self, IRLAN_EVENT event, +static int irlan_client_state_arb (struct irlan_cb *self, IRLAN_EVENT event, struct sk_buff *skb); -static int irlan_client_state_data (struct irlan_cb *self, IRLAN_EVENT event, +static int irlan_client_state_data (struct irlan_cb *self, IRLAN_EVENT event, struct sk_buff *skb); -static int irlan_client_state_close(struct irlan_cb *self, IRLAN_EVENT event, +static int irlan_client_state_close(struct irlan_cb *self, IRLAN_EVENT event, struct sk_buff *skb); -static int irlan_client_state_sync (struct irlan_cb *self, IRLAN_EVENT event, +static int irlan_client_state_sync (struct irlan_cb *self, IRLAN_EVENT event, struct sk_buff *skb); static int (*state[])(struct irlan_cb *, IRLAN_EVENT event, struct sk_buff *) = -{ +{ irlan_client_state_idle, irlan_client_state_query, irlan_client_state_conn, @@ -74,8 +74,8 @@ static int (*state[])(struct irlan_cb *, IRLAN_EVENT event, struct sk_buff *) = irlan_client_state_sync }; -void irlan_do_client_event(struct irlan_cb *self, IRLAN_EVENT event, - struct sk_buff *skb) +void irlan_do_client_event(struct irlan_cb *self, IRLAN_EVENT event, + struct sk_buff *skb) { IRDA_ASSERT(self != NULL, return;); IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); @@ -89,14 +89,14 @@ void irlan_do_client_event(struct irlan_cb *self, IRLAN_EVENT event, * IDLE, We are waiting for an indication that there is a provider * available. */ -static int irlan_client_state_idle(struct irlan_cb *self, IRLAN_EVENT event, - struct sk_buff *skb) +static int irlan_client_state_idle(struct irlan_cb *self, IRLAN_EVENT event, + struct sk_buff *skb) { IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); IRDA_ASSERT(self != NULL, return -1;); IRDA_ASSERT(self->magic == IRLAN_MAGIC, return -1;); - + switch (event) { case IRLAN_DISCOVERY_INDICATION: if (self->client.iriap) { @@ -104,7 +104,7 @@ static int irlan_client_state_idle(struct irlan_cb *self, IRLAN_EVENT event, __FUNCTION__); return -EBUSY; } - + self->client.iriap = iriap_open(LSAP_ANY, IAS_CLIENT, self, irlan_client_get_value_confirm); /* Get some values from peer IAS */ @@ -120,7 +120,7 @@ static int irlan_client_state_idle(struct irlan_cb *self, IRLAN_EVENT event, IRDA_DEBUG(4, "%s(), Unknown event %d\n", __FUNCTION__ , event); break; } - if (skb) + if (skb) dev_kfree_skb(skb); return 0; @@ -133,23 +133,23 @@ static int irlan_client_state_idle(struct irlan_cb *self, IRLAN_EVENT event, * to provider, just waiting for the confirm. * */ -static int irlan_client_state_query(struct irlan_cb *self, IRLAN_EVENT event, - struct sk_buff *skb) +static int irlan_client_state_query(struct irlan_cb *self, IRLAN_EVENT event, + struct sk_buff *skb) { IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); IRDA_ASSERT(self != NULL, return -1;); IRDA_ASSERT(self->magic == IRLAN_MAGIC, return -1;); - + switch(event) { case IRLAN_IAS_PROVIDER_AVAIL: IRDA_ASSERT(self->dtsap_sel_ctrl != 0, return -1;); self->client.open_retries = 0; - - irttp_connect_request(self->client.tsap_ctrl, - self->dtsap_sel_ctrl, - self->saddr, self->daddr, NULL, + + irttp_connect_request(self->client.tsap_ctrl, + self->dtsap_sel_ctrl, + self->saddr, self->daddr, NULL, IRLAN_MTU, NULL); irlan_next_client_state(self, IRLAN_CONN); break; @@ -158,7 +158,7 @@ static int irlan_client_state_query(struct irlan_cb *self, IRLAN_EVENT event, irlan_next_client_state(self, IRLAN_IDLE); /* Give the client a kick! */ - if ((self->provider.access_type == ACCESS_PEER) && + if ((self->provider.access_type == ACCESS_PEER) && (self->provider.state != IRLAN_IDLE)) irlan_client_wakeup(self, self->saddr, self->daddr); break; @@ -175,7 +175,7 @@ static int irlan_client_state_query(struct irlan_cb *self, IRLAN_EVENT event, } if (skb) dev_kfree_skb(skb); - + return 0; } @@ -186,13 +186,13 @@ static int irlan_client_state_query(struct irlan_cb *self, IRLAN_EVENT event, * commands yet. * */ -static int irlan_client_state_conn(struct irlan_cb *self, IRLAN_EVENT event, - struct sk_buff *skb) +static int irlan_client_state_conn(struct irlan_cb *self, IRLAN_EVENT event, + struct sk_buff *skb) { IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); - + IRDA_ASSERT(self != NULL, return -1;); - + switch (event) { case IRLAN_CONNECT_COMPLETE: /* Send getinfo cmd */ @@ -212,7 +212,7 @@ static int irlan_client_state_conn(struct irlan_cb *self, IRLAN_EVENT event, } if (skb) dev_kfree_skb(skb); - + return 0; } @@ -221,24 +221,24 @@ static int irlan_client_state_conn(struct irlan_cb *self, IRLAN_EVENT event, * * INFO, We have issued a GetInfo command and is awaiting a reply. */ -static int irlan_client_state_info(struct irlan_cb *self, IRLAN_EVENT event, - struct sk_buff *skb) +static int irlan_client_state_info(struct irlan_cb *self, IRLAN_EVENT event, + struct sk_buff *skb) { IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); IRDA_ASSERT(self != NULL, return -1;); - + switch (event) { case IRLAN_DATA_INDICATION: IRDA_ASSERT(skb != NULL, return -1;); - + irlan_client_parse_response(self, skb); - + irlan_next_client_state(self, IRLAN_MEDIA); - + irlan_get_media_char(self); break; - + case IRLAN_LMP_DISCONNECT: case IRLAN_LAP_DISCONNECT: irlan_next_client_state(self, IRLAN_IDLE); @@ -252,7 +252,7 @@ static int irlan_client_state_info(struct irlan_cb *self, IRLAN_EVENT event, } if (skb) dev_kfree_skb(skb); - + return 0; } @@ -263,11 +263,11 @@ static int irlan_client_state_info(struct irlan_cb *self, IRLAN_EVENT event, * reply. * */ -static int irlan_client_state_media(struct irlan_cb *self, IRLAN_EVENT event, - struct sk_buff *skb) +static int irlan_client_state_media(struct irlan_cb *self, IRLAN_EVENT event, + struct sk_buff *skb) { IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); - + IRDA_ASSERT(self != NULL, return -1;); switch(event) { @@ -289,7 +289,7 @@ static int irlan_client_state_media(struct irlan_cb *self, IRLAN_EVENT event, } if (skb) dev_kfree_skb(skb); - + return 0; } @@ -300,47 +300,47 @@ static int irlan_client_state_media(struct irlan_cb *self, IRLAN_EVENT event, * reply * */ -static int irlan_client_state_open(struct irlan_cb *self, IRLAN_EVENT event, - struct sk_buff *skb) +static int irlan_client_state_open(struct irlan_cb *self, IRLAN_EVENT event, + struct sk_buff *skb) { struct qos_info qos; IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); - + IRDA_ASSERT(self != NULL, return -1;); switch(event) { case IRLAN_DATA_INDICATION: irlan_client_parse_response(self, skb); - + /* - * Check if we have got the remote TSAP for data + * Check if we have got the remote TSAP for data * communications */ - IRDA_ASSERT(self->dtsap_sel_data != 0, return -1;); + IRDA_ASSERT(self->dtsap_sel_data != 0, return -1;); /* Check which access type we are dealing with */ switch (self->client.access_type) { case ACCESS_PEER: if (self->provider.state == IRLAN_OPEN) { - + irlan_next_client_state(self, IRLAN_ARB); - irlan_do_client_event(self, IRLAN_CHECK_CON_ARB, + irlan_do_client_event(self, IRLAN_CHECK_CON_ARB, NULL); } else { - + irlan_next_client_state(self, IRLAN_WAIT); } break; case ACCESS_DIRECT: case ACCESS_HOSTED: qos.link_disc_time.bits = 0x01; /* 3 secs */ - - irttp_connect_request(self->tsap_data, - self->dtsap_sel_data, - self->saddr, self->daddr, &qos, + + irttp_connect_request(self->tsap_data, + self->dtsap_sel_data, + self->saddr, self->daddr, &qos, IRLAN_MTU, NULL); - + irlan_next_client_state(self, IRLAN_DATA); break; default: @@ -359,7 +359,7 @@ static int irlan_client_state_open(struct irlan_cb *self, IRLAN_EVENT event, IRDA_DEBUG(2, "%s(), Unknown event %d\n", __FUNCTION__ , event); break; } - + if (skb) dev_kfree_skb(skb); @@ -373,13 +373,13 @@ static int irlan_client_state_open(struct irlan_cb *self, IRLAN_EVENT event, * provider OPEN state. * */ -static int irlan_client_state_wait(struct irlan_cb *self, IRLAN_EVENT event, - struct sk_buff *skb) +static int irlan_client_state_wait(struct irlan_cb *self, IRLAN_EVENT event, + struct sk_buff *skb) { IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); - + IRDA_ASSERT(self != NULL, return -1;); - + switch(event) { case IRLAN_PROVIDER_SIGNAL: irlan_next_client_state(self, IRLAN_ARB); @@ -398,36 +398,36 @@ static int irlan_client_state_wait(struct irlan_cb *self, IRLAN_EVENT event, } if (skb) dev_kfree_skb(skb); - + return 0; } -static int irlan_client_state_arb(struct irlan_cb *self, IRLAN_EVENT event, - struct sk_buff *skb) +static int irlan_client_state_arb(struct irlan_cb *self, IRLAN_EVENT event, + struct sk_buff *skb) { struct qos_info qos; IRDA_DEBUG(2, "%s()\n", __FUNCTION__ ); IRDA_ASSERT(self != NULL, return -1;); - + switch(event) { case IRLAN_CHECK_CON_ARB: if (self->client.recv_arb_val == self->provider.send_arb_val) { irlan_next_client_state(self, IRLAN_CLOSE); irlan_close_data_channel(self); - } else if (self->client.recv_arb_val < - self->provider.send_arb_val) + } else if (self->client.recv_arb_val < + self->provider.send_arb_val) { qos.link_disc_time.bits = 0x01; /* 3 secs */ irlan_next_client_state(self, IRLAN_DATA); - irttp_connect_request(self->tsap_data, - self->dtsap_sel_data, - self->saddr, self->daddr, &qos, + irttp_connect_request(self->tsap_data, + self->dtsap_sel_data, + self->saddr, self->daddr, &qos, IRLAN_MTU, NULL); } else if (self->client.recv_arb_val > - self->provider.send_arb_val) + self->provider.send_arb_val) { IRDA_DEBUG(2, "%s(), lost the battle :-(\n", __FUNCTION__ ); } @@ -448,7 +448,7 @@ static int irlan_client_state_arb(struct irlan_cb *self, IRLAN_EVENT event, } if (skb) dev_kfree_skb(skb); - + return 0; } @@ -459,8 +459,8 @@ static int irlan_client_state_arb(struct irlan_cb *self, IRLAN_EVENT event, * the local and remote machines. * */ -static int irlan_client_state_data(struct irlan_cb *self, IRLAN_EVENT event, - struct sk_buff *skb) +static int irlan_client_state_data(struct irlan_cb *self, IRLAN_EVENT event, + struct sk_buff *skb) { IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); @@ -470,7 +470,7 @@ static int irlan_client_state_data(struct irlan_cb *self, IRLAN_EVENT event, switch(event) { case IRLAN_DATA_INDICATION: irlan_client_parse_response(self, skb); - break; + break; case IRLAN_LMP_DISCONNECT: /* FALLTHROUGH */ case IRLAN_LAP_DISCONNECT: irlan_next_client_state(self, IRLAN_IDLE); @@ -481,18 +481,18 @@ static int irlan_client_state_data(struct irlan_cb *self, IRLAN_EVENT event, } if (skb) dev_kfree_skb(skb); - + return 0; } /* * Function irlan_client_state_close (self, event, skb, info) * - * + * * */ -static int irlan_client_state_close(struct irlan_cb *self, IRLAN_EVENT event, - struct sk_buff *skb) +static int irlan_client_state_close(struct irlan_cb *self, IRLAN_EVENT event, + struct sk_buff *skb) { IRDA_DEBUG(2, "%s()\n", __FUNCTION__ ); @@ -505,17 +505,17 @@ static int irlan_client_state_close(struct irlan_cb *self, IRLAN_EVENT event, /* * Function irlan_client_state_sync (self, event, skb, info) * - * + * * */ -static int irlan_client_state_sync(struct irlan_cb *self, IRLAN_EVENT event, - struct sk_buff *skb) +static int irlan_client_state_sync(struct irlan_cb *self, IRLAN_EVENT event, + struct sk_buff *skb) { IRDA_DEBUG(2, "%s()\n", __FUNCTION__ ); - + if (skb) dev_kfree_skb(skb); - + return 0; } diff --git a/net/irda/irlan/irlan_common.c b/net/irda/irlan/irlan_common.c index 310776dd610..9c3dc57ff74 100644 --- a/net/irda/irlan/irlan_common.c +++ b/net/irda/irlan/irlan_common.c @@ -1,5 +1,5 @@ /********************************************************************* - * + * * Filename: irlan_common.c * Version: 0.9 * Description: IrDA LAN Access Protocol Implementation @@ -8,17 +8,17 @@ * Created at: Sun Aug 31 20:14:37 1997 * Modified at: Sun Dec 26 21:53:10 1999 * Modified by: Dag Brattli <dagb@cs.uit.no> - * - * Copyright (c) 1997, 1999 Dag Brattli <dagb@cs.uit.no>, + * + * Copyright (c) 1997, 1999 Dag Brattli <dagb@cs.uit.no>, * All Rights Reserved. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * Neither Dag Brattli nor University of Tromsų admit liability nor - * provide warranty for any of this software. This material is + * provide warranty for any of this software. This material is * provided "AS-IS" and at no charge. * ********************************************************************/ @@ -49,12 +49,12 @@ #include <net/irda/irlan_common.h> #include <net/irda/irlan_client.h> -#include <net/irda/irlan_provider.h> +#include <net/irda/irlan_provider.h> #include <net/irda/irlan_eth.h> #include <net/irda/irlan_filter.h> -/* +/* * Send gratuitous ARP when connected to a new AP or not. May be a clever * thing to do, but for some reason the machine crashes if you use DHCP. So * lets not use it by default. @@ -106,8 +106,8 @@ extern struct proc_dir_entry *proc_irda; static struct irlan_cb *irlan_open(__u32 saddr, __u32 daddr); static void __irlan_close(struct irlan_cb *self); -static int __irlan_insert_param(struct sk_buff *skb, char *param, int type, - __u8 value_byte, __u16 value_short, +static int __irlan_insert_param(struct sk_buff *skb, char *param, int type, + __u8 value_byte, __u16 value_short, __u8 *value_array, __u16 value_len); static void irlan_open_unicast_addr(struct irlan_cb *self); static void irlan_get_unicast_addr(struct irlan_cb *self); @@ -177,7 +177,7 @@ err_ckey: return -ENOMEM; } -static void __exit irlan_cleanup(void) +static void __exit irlan_cleanup(void) { struct irlan_cb *self, *next; @@ -201,7 +201,7 @@ static void __exit irlan_cleanup(void) /* * Function irlan_open (void) * - * Open new instance of a client/provider, we should only register the + * Open new instance of a client/provider, we should only register the * network device if this instance is ment for a particular client/provider */ static struct irlan_cb *irlan_open(__u32 saddr, __u32 daddr) @@ -229,9 +229,9 @@ static struct irlan_cb *irlan_open(__u32 saddr, __u32 daddr) /* Provider access can only be PEER, DIRECT, or HOSTED */ self->provider.access_type = access; if (access == ACCESS_DIRECT) { - /* + /* * Since we are emulating an IrLAN sever we will have to - * give ourself an ethernet address! + * give ourself an ethernet address! */ dev->dev_addr[0] = 0x40; dev->dev_addr[1] = 0x00; @@ -245,15 +245,15 @@ static struct irlan_cb *irlan_open(__u32 saddr, __u32 daddr) self->disconnect_reason = LM_USER_REQUEST; init_timer(&self->watchdog_timer); init_timer(&self->client.kick_timer); - init_waitqueue_head(&self->open_wait); - + init_waitqueue_head(&self->open_wait); + skb_queue_head_init(&self->client.txq); - + irlan_next_client_state(self, IRLAN_IDLE); irlan_next_provider_state(self, IRLAN_IDLE); if (register_netdev(dev)) { - IRDA_DEBUG(2, "%s(), register_netdev() failed!\n", + IRDA_DEBUG(2, "%s(), register_netdev() failed!\n", __FUNCTION__ ); self = NULL; free_netdev(dev); @@ -268,14 +268,14 @@ static struct irlan_cb *irlan_open(__u32 saddr, __u32 daddr) /* * Function __irlan_close (self) * - * This function closes and deallocates the IrLAN client instances. Be + * This function closes and deallocates the IrLAN client instances. Be * aware that other functions which calls client_close() must * remove self from irlans list first. */ static void __irlan_close(struct irlan_cb *self) { IRDA_DEBUG(2, "%s()\n", __FUNCTION__ ); - + ASSERT_RTNL(); IRDA_ASSERT(self != NULL, return;); IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); @@ -285,8 +285,8 @@ static void __irlan_close(struct irlan_cb *self) /* Close all open connections and remove TSAPs */ irlan_close_tsaps(self); - - if (self->client.iriap) + + if (self->client.iriap) iriap_close(self->client.iriap); /* Remove frames queued on the control channel */ @@ -316,17 +316,17 @@ struct irlan_cb *irlan_get_any(void) static void irlan_connect_indication(void *instance, void *sap, struct qos_info *qos, __u32 max_sdu_size, - __u8 max_header_size, + __u8 max_header_size, struct sk_buff *skb) { struct irlan_cb *self; struct tsap_cb *tsap; IRDA_DEBUG(2, "%s()\n", __FUNCTION__ ); - + self = (struct irlan_cb *) instance; tsap = (struct tsap_cb *) sap; - + IRDA_ASSERT(self != NULL, return;); IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); IRDA_ASSERT(tsap == self->tsap_data,return;); @@ -349,9 +349,9 @@ static void irlan_connect_indication(void *instance, void *sap, irlan_do_client_event(self, IRLAN_DATA_CONNECT_INDICATION, NULL); if (self->provider.access_type == ACCESS_PEER) { - /* + /* * Data channel is open, so we are now allowed to - * configure the remote filter + * configure the remote filter */ irlan_get_unicast_addr(self); irlan_open_unicast_addr(self); @@ -361,10 +361,10 @@ static void irlan_connect_indication(void *instance, void *sap, } static void irlan_connect_confirm(void *instance, void *sap, - struct qos_info *qos, + struct qos_info *qos, __u32 max_sdu_size, - __u8 max_header_size, - struct sk_buff *skb) + __u8 max_header_size, + struct sk_buff *skb) { struct irlan_cb *self; @@ -381,16 +381,16 @@ static void irlan_connect_confirm(void *instance, void *sap, IRDA_DEBUG(0, "%s: We are now connected!\n", __FUNCTION__); del_timer(&self->watchdog_timer); - /* + /* * Data channel is open, so we are now allowed to configure the remote - * filter + * filter */ irlan_get_unicast_addr(self); irlan_open_unicast_addr(self); - + /* Open broadcast and multicast filter by default */ - irlan_set_broadcast_filter(self, TRUE); - irlan_set_multicast_filter(self, TRUE); + irlan_set_broadcast_filter(self, TRUE); + irlan_set_multicast_filter(self, TRUE); /* Ready to transfer Ethernet frames */ netif_start_queue(self->dev); @@ -408,29 +408,29 @@ static void irlan_connect_confirm(void *instance, void *sap, * the specified connection (handle) */ static void irlan_disconnect_indication(void *instance, - void *sap, LM_REASON reason, - struct sk_buff *userdata) + void *sap, LM_REASON reason, + struct sk_buff *userdata) { struct irlan_cb *self; struct tsap_cb *tsap; IRDA_DEBUG(0, "%s(), reason=%d\n", __FUNCTION__ , reason); - + self = (struct irlan_cb *) instance; tsap = (struct tsap_cb *) sap; IRDA_ASSERT(self != NULL, return;); - IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); + IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); IRDA_ASSERT(tsap != NULL, return;); IRDA_ASSERT(tsap->magic == TTP_TSAP_MAGIC, return;); - + IRDA_ASSERT(tsap == self->tsap_data, return;); IRDA_DEBUG(2, "IrLAN, data channel disconnected by peer!\n"); /* Save reason so we know if we should try to reconnect or not */ self->disconnect_reason = reason; - + switch (reason) { case LM_USER_REQUEST: /* User request */ IRDA_DEBUG(2, "%s(), User requested\n", __FUNCTION__ ); @@ -451,7 +451,7 @@ static void irlan_disconnect_indication(void *instance, IRDA_ERROR("%s(), Unknown disconnect reason\n", __FUNCTION__); break; } - + /* If you want to pass the skb to *both* state machines, you will * need to skb_clone() it, so that you don't free it twice. * As the state machines don't need it, git rid of it here... @@ -461,7 +461,7 @@ static void irlan_disconnect_indication(void *instance, irlan_do_client_event(self, IRLAN_LMP_DISCONNECT, NULL); irlan_do_provider_event(self, IRLAN_LMP_DISCONNECT, NULL); - + wake_up_interruptible(&self->open_wait); } @@ -480,12 +480,12 @@ void irlan_open_data_tsap(struct irlan_cb *self) return; irda_notify_init(¬ify); - + notify.data_indication = irlan_eth_receive; notify.udata_indication = irlan_eth_receive; notify.connect_indication = irlan_connect_indication; notify.connect_confirm = irlan_connect_confirm; - notify.flow_indication = irlan_eth_flow_indication; + notify.flow_indication = irlan_eth_flow_indication; notify.disconnect_indication = irlan_disconnect_indication; notify.instance = self; strlcpy(notify.name, "IrLAN data", sizeof(notify.name)); @@ -497,7 +497,7 @@ void irlan_open_data_tsap(struct irlan_cb *self) } self->tsap_data = tsap; - /* + /* * This is the data TSAP selector which we will pass to the client * when the client ask for it. */ @@ -518,13 +518,13 @@ void irlan_close_tsaps(struct irlan_cb *self) self->tsap_data = NULL; } if (self->client.tsap_ctrl) { - irttp_disconnect_request(self->client.tsap_ctrl, NULL, + irttp_disconnect_request(self->client.tsap_ctrl, NULL, P_NORMAL); irttp_close_tsap(self->client.tsap_ctrl); self->client.tsap_ctrl = NULL; } if (self->provider.tsap_ctrl) { - irttp_disconnect_request(self->provider.tsap_ctrl, NULL, + irttp_disconnect_request(self->provider.tsap_ctrl, NULL, P_NORMAL); irttp_close_tsap(self->provider.tsap_ctrl); self->provider.tsap_ctrl = NULL; @@ -545,8 +545,8 @@ void irlan_ias_register(struct irlan_cb *self, __u8 tsap_sel) IRDA_ASSERT(self != NULL, return;); IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); - - /* + + /* * Check if object has already been registered by a previous provider. * If that is the case, we just change the value of the attribute */ @@ -560,9 +560,9 @@ void irlan_ias_register(struct irlan_cb *self, __u8 tsap_sel) irias_object_change_attribute("IrLAN", "IrDA:TinyTP:LsapSel", new_value); } - - /* Register PnP object only if not registered before */ - if (!irias_find_object("PnP")) { + + /* Register PnP object only if not registered before */ + if (!irias_find_object("PnP")) { obj = irias_new_object("PnP", IAS_PNP_ID); #if 0 irias_add_string_attrib(obj, "Name", sysctl_devname, @@ -606,10 +606,10 @@ int irlan_run_ctrl_tx_queue(struct irlan_cb *self) self->client.tx_busy = FALSE; return 0; } - + /* Check that it's really possible to send commands */ - if ((self->client.tsap_ctrl == NULL) || - (self->client.state == IRLAN_IDLE)) + if ((self->client.tsap_ctrl == NULL) || + (self->client.state == IRLAN_IDLE)) { self->client.tx_busy = FALSE; dev_kfree_skb(skb); @@ -649,7 +649,7 @@ void irlan_get_provider_info(struct irlan_cb *self) __u8 *frame; IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); - + IRDA_ASSERT(self != NULL, return;); IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); @@ -661,12 +661,12 @@ void irlan_get_provider_info(struct irlan_cb *self) /* Reserve space for TTP, LMP, and LAP header */ skb_reserve(skb, self->client.max_header_size); skb_put(skb, 2); - + frame = skb->data; - - frame[0] = CMD_GET_PROVIDER_INFO; + + frame[0] = CMD_GET_PROVIDER_INFO; frame[1] = 0x00; /* Zero parameters */ - + irlan_ctrl_data_request(self, skb); } @@ -676,16 +676,16 @@ void irlan_get_provider_info(struct irlan_cb *self) * Send an Open Data Command to provider * */ -void irlan_open_data_channel(struct irlan_cb *self) +void irlan_open_data_channel(struct irlan_cb *self) { struct sk_buff *skb; __u8 *frame; - + IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); IRDA_ASSERT(self != NULL, return;); IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); - + skb = alloc_skb(IRLAN_MAX_HEADER + IRLAN_CMD_HEADER + IRLAN_STRING_PARAMETER_LEN("MEDIA", "802.3") + IRLAN_STRING_PARAMETER_LEN("ACCESS_TYPE", "DIRECT"), @@ -695,11 +695,11 @@ void irlan_open_data_channel(struct irlan_cb *self) skb_reserve(skb, self->client.max_header_size); skb_put(skb, 2); - + frame = skb->data; - + /* Build frame */ - frame[0] = CMD_OPEN_DATA_CHANNEL; + frame[0] = CMD_OPEN_DATA_CHANNEL; frame[1] = 0x02; /* Two parameters */ irlan_insert_string_param(skb, "MEDIA", "802.3"); @@ -711,11 +711,11 @@ void irlan_open_data_channel(struct irlan_cb *self) irlan_ctrl_data_request(self, skb); } -void irlan_close_data_channel(struct irlan_cb *self) +void irlan_close_data_channel(struct irlan_cb *self) { struct sk_buff *skb; __u8 *frame; - + IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); IRDA_ASSERT(self != NULL, return;); @@ -733,11 +733,11 @@ void irlan_close_data_channel(struct irlan_cb *self) skb_reserve(skb, self->client.max_header_size); skb_put(skb, 2); - + frame = skb->data; - + /* Build frame */ - frame[0] = CMD_CLOSE_DATA_CHAN; + frame[0] = CMD_CLOSE_DATA_CHAN; frame[1] = 0x01; /* One parameter */ irlan_insert_byte_param(skb, "DATA_CHAN", self->dtsap_sel_data); @@ -748,7 +748,7 @@ void irlan_close_data_channel(struct irlan_cb *self) /* * Function irlan_open_unicast_addr (self) * - * Make IrLAN provider accept ethernet frames addressed to the unicast + * Make IrLAN provider accept ethernet frames addressed to the unicast * address. * */ @@ -756,12 +756,12 @@ static void irlan_open_unicast_addr(struct irlan_cb *self) { struct sk_buff *skb; __u8 *frame; - + IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); IRDA_ASSERT(self != NULL, return;); - IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); - + IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); + skb = alloc_skb(IRLAN_MAX_HEADER + IRLAN_CMD_HEADER + IRLAN_BYTE_PARAMETER_LEN("DATA_CHAN") + IRLAN_STRING_PARAMETER_LEN("FILTER_TYPE", "DIRECTED") + @@ -773,15 +773,15 @@ static void irlan_open_unicast_addr(struct irlan_cb *self) /* Reserve space for TTP, LMP, and LAP header */ skb_reserve(skb, self->max_header_size); skb_put(skb, 2); - + frame = skb->data; - - frame[0] = CMD_FILTER_OPERATION; + + frame[0] = CMD_FILTER_OPERATION; frame[1] = 0x03; /* Three parameters */ - irlan_insert_byte_param(skb, "DATA_CHAN" , self->dtsap_sel_data); - irlan_insert_string_param(skb, "FILTER_TYPE", "DIRECTED"); - irlan_insert_string_param(skb, "FILTER_MODE", "FILTER"); - + irlan_insert_byte_param(skb, "DATA_CHAN" , self->dtsap_sel_data); + irlan_insert_string_param(skb, "FILTER_TYPE", "DIRECTED"); + irlan_insert_string_param(skb, "FILTER_MODE", "FILTER"); + irlan_ctrl_data_request(self, skb); } @@ -794,17 +794,17 @@ static void irlan_open_unicast_addr(struct irlan_cb *self) * one but then _we_ have to initiate all communication with other * hosts, since ARP request for this host will not be answered. */ -void irlan_set_broadcast_filter(struct irlan_cb *self, int status) +void irlan_set_broadcast_filter(struct irlan_cb *self, int status) { struct sk_buff *skb; __u8 *frame; - + IRDA_DEBUG(2, "%s()\n", __FUNCTION__ ); IRDA_ASSERT(self != NULL, return;); IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); - - skb = alloc_skb(IRLAN_MAX_HEADER + IRLAN_CMD_HEADER + + + skb = alloc_skb(IRLAN_MAX_HEADER + IRLAN_CMD_HEADER + IRLAN_BYTE_PARAMETER_LEN("DATA_CHAN") + IRLAN_STRING_PARAMETER_LEN("FILTER_TYPE", "BROADCAST") + /* We may waste one byte here...*/ @@ -816,17 +816,17 @@ void irlan_set_broadcast_filter(struct irlan_cb *self, int status) /* Reserve space for TTP, LMP, and LAP header */ skb_reserve(skb, self->client.max_header_size); skb_put(skb, 2); - + frame = skb->data; - - frame[0] = CMD_FILTER_OPERATION; + + frame[0] = CMD_FILTER_OPERATION; frame[1] = 0x03; /* Three parameters */ - irlan_insert_byte_param(skb, "DATA_CHAN", self->dtsap_sel_data); - irlan_insert_string_param(skb, "FILTER_TYPE", "BROADCAST"); + irlan_insert_byte_param(skb, "DATA_CHAN", self->dtsap_sel_data); + irlan_insert_string_param(skb, "FILTER_TYPE", "BROADCAST"); if (status) - irlan_insert_string_param(skb, "FILTER_MODE", "FILTER"); + irlan_insert_string_param(skb, "FILTER_MODE", "FILTER"); else - irlan_insert_string_param(skb, "FILTER_MODE", "NONE"); + irlan_insert_string_param(skb, "FILTER_MODE", "NONE"); irlan_ctrl_data_request(self, skb); } @@ -835,14 +835,14 @@ void irlan_set_broadcast_filter(struct irlan_cb *self, int status) * Function irlan_set_multicast_filter (self, status) * * Make IrLAN provider accept ethernet frames addressed to the multicast - * address. + * address. * */ -void irlan_set_multicast_filter(struct irlan_cb *self, int status) +void irlan_set_multicast_filter(struct irlan_cb *self, int status) { struct sk_buff *skb; __u8 *frame; - + IRDA_DEBUG(2, "%s()\n", __FUNCTION__ ); IRDA_ASSERT(self != NULL, return;); @@ -856,21 +856,21 @@ void irlan_set_multicast_filter(struct irlan_cb *self, int status) GFP_ATOMIC); if (!skb) return; - + /* Reserve space for TTP, LMP, and LAP header */ skb_reserve(skb, self->client.max_header_size); skb_put(skb, 2); - + frame = skb->data; - - frame[0] = CMD_FILTER_OPERATION; + + frame[0] = CMD_FILTER_OPERATION; frame[1] = 0x03; /* Three parameters */ - irlan_insert_byte_param(skb, "DATA_CHAN", self->dtsap_sel_data); - irlan_insert_string_param(skb, "FILTER_TYPE", "MULTICAST"); + irlan_insert_byte_param(skb, "DATA_CHAN", self->dtsap_sel_data); + irlan_insert_string_param(skb, "FILTER_TYPE", "MULTICAST"); if (status) - irlan_insert_string_param(skb, "FILTER_MODE", "ALL"); + irlan_insert_string_param(skb, "FILTER_MODE", "ALL"); else - irlan_insert_string_param(skb, "FILTER_MODE", "NONE"); + irlan_insert_string_param(skb, "FILTER_MODE", "NONE"); irlan_ctrl_data_request(self, skb); } @@ -887,12 +887,12 @@ static void irlan_get_unicast_addr(struct irlan_cb *self) { struct sk_buff *skb; __u8 *frame; - + IRDA_DEBUG(2, "%s()\n", __FUNCTION__ ); IRDA_ASSERT(self != NULL, return;); IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); - + skb = alloc_skb(IRLAN_MAX_HEADER + IRLAN_CMD_HEADER + IRLAN_BYTE_PARAMETER_LEN("DATA_CHAN") + IRLAN_STRING_PARAMETER_LEN("FILTER_TYPE", "DIRECTED") + @@ -905,34 +905,34 @@ static void irlan_get_unicast_addr(struct irlan_cb *self) /* Reserve space for TTP, LMP, and LAP header */ skb_reserve(skb, self->client.max_header_size); skb_put(skb, 2); - + frame = skb->data; - - frame[0] = CMD_FILTER_OPERATION; + + frame[0] = CMD_FILTER_OPERATION; frame[1] = 0x03; /* Three parameters */ - irlan_insert_byte_param(skb, "DATA_CHAN", self->dtsap_sel_data); - irlan_insert_string_param(skb, "FILTER_TYPE", "DIRECTED"); - irlan_insert_string_param(skb, "FILTER_OPERATION", "DYNAMIC"); - + irlan_insert_byte_param(skb, "DATA_CHAN", self->dtsap_sel_data); + irlan_insert_string_param(skb, "FILTER_TYPE", "DIRECTED"); + irlan_insert_string_param(skb, "FILTER_OPERATION", "DYNAMIC"); + irlan_ctrl_data_request(self, skb); } /* * Function irlan_get_media_char (self) * - * + * * */ -void irlan_get_media_char(struct irlan_cb *self) +void irlan_get_media_char(struct irlan_cb *self) { struct sk_buff *skb; __u8 *frame; - + IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); IRDA_ASSERT(self != NULL, return;); IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); - + skb = alloc_skb(IRLAN_MAX_HEADER + IRLAN_CMD_HEADER + IRLAN_STRING_PARAMETER_LEN("MEDIA", "802.3"), GFP_ATOMIC); @@ -943,13 +943,13 @@ void irlan_get_media_char(struct irlan_cb *self) /* Reserve space for TTP, LMP, and LAP header */ skb_reserve(skb, self->client.max_header_size); skb_put(skb, 2); - + frame = skb->data; - + /* Build frame */ - frame[0] = CMD_GET_MEDIA_CHAR; + frame[0] = CMD_GET_MEDIA_CHAR; frame[1] = 0x01; /* One parameter */ - + irlan_insert_string_param(skb, "MEDIA", "802.3"); irlan_ctrl_data_request(self, skb); } @@ -980,7 +980,7 @@ int irlan_insert_string_param(struct sk_buff *skb, char *param, char *string) { int string_len = strlen(string); - return __irlan_insert_param(skb, param, IRLAN_ARRAY, 0, 0, string, + return __irlan_insert_param(skb, param, IRLAN_ARRAY, 0, 0, string, string_len); } @@ -993,7 +993,7 @@ int irlan_insert_string_param(struct sk_buff *skb, char *param, char *string) int irlan_insert_array_param(struct sk_buff *skb, char *name, __u8 *array, __u16 array_len) { - return __irlan_insert_param(skb, name, IRLAN_ARRAY, 0, 0, array, + return __irlan_insert_param(skb, name, IRLAN_ARRAY, 0, 0, array, array_len); } @@ -1006,19 +1006,19 @@ int irlan_insert_array_param(struct sk_buff *skb, char *name, __u8 *array, * | Name Length[1] | Param Name[1..255] | Val Length[2] | Value[0..1016]| * ----------------------------------------------------------------------- */ -static int __irlan_insert_param(struct sk_buff *skb, char *param, int type, - __u8 value_byte, __u16 value_short, +static int __irlan_insert_param(struct sk_buff *skb, char *param, int type, + __u8 value_byte, __u16 value_short, __u8 *value_array, __u16 value_len) { __u8 *frame; __u8 param_len; __le16 tmp_le; /* Temporary value in little endian format */ int n=0; - + if (skb == NULL) { IRDA_DEBUG(2, "%s(), Got NULL skb\n", __FUNCTION__ ); return 0; - } + } param_len = strlen(param); switch (type) { @@ -1037,7 +1037,7 @@ static int __irlan_insert_param(struct sk_buff *skb, char *param, int type, return 0; break; } - + /* Insert at end of sk-buffer */ frame = skb->tail; @@ -1045,15 +1045,15 @@ static int __irlan_insert_param(struct sk_buff *skb, char *param, int type, if (skb_tailroom(skb) < (param_len+value_len+3)) { IRDA_DEBUG(2, "%s(), No more space at end of skb\n", __FUNCTION__ ); return 0; - } + } skb_put(skb, param_len+value_len+3); - + /* Insert parameter length */ frame[n++] = param_len; - + /* Insert parameter */ memcpy(frame+n, param, param_len); n += param_len; - + /* Insert value length (2 byte little endian format, LSB first) */ tmp_le = cpu_to_le16(value_len); 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, * Function irlan_extract_param (buf, name, value, len) * * Extracts a single parameter name/value pair from buffer and updates - * the buffer pointer to point to the next name/value pair. + * the buffer pointer to point to the next name/value pair. */ int irlan_extract_param(__u8 *buf, char *name, char *value, __u16 *len) { __u8 name_len; __u16 val_len; int n=0; - + IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); - + /* get length of parameter name (1 byte) */ name_len = buf[n++]; - + if (name_len > 254) { IRDA_DEBUG(2, "%s(), name_len > 254\n", __FUNCTION__ ); return -RSP_INVALID_COMMAND_FORMAT; } - + /* get parameter name */ memcpy(name, buf+n, name_len); name[name_len] = '\0'; n+=name_len; - - /* - * Get length of parameter value (2 bytes in little endian - * format) + + /* + * Get length of parameter value (2 bytes in little endian + * format) */ memcpy(&val_len, buf+n, 2); /* To avoid alignment problems */ le16_to_cpus(&val_len); n+=2; - + if (val_len > 1016) { IRDA_DEBUG(2, "%s(), parameter length to long\n", __FUNCTION__ ); return -RSP_INVALID_COMMAND_FORMAT; @@ -1122,9 +1122,9 @@ int irlan_extract_param(__u8 *buf, char *name, char *value, __u16 *len) memcpy(value, buf+n, val_len); value[val_len] = '\0'; n+=val_len; - - IRDA_DEBUG(4, "Parameter: %s ", name); - IRDA_DEBUG(4, "Value: %s\n", value); + + IRDA_DEBUG(4, "Parameter: %s ", name); + IRDA_DEBUG(4, "Value: %s\n", value); return n; } @@ -1133,7 +1133,7 @@ int irlan_extract_param(__u8 *buf, char *name, char *value, __u16 *len) /* * Start of reading /proc entries. - * Return entry at pos, + * Return entry at pos, * or start_token to indicate print header line * or NULL if end of file */ @@ -1147,7 +1147,7 @@ static void *irlan_seq_start(struct seq_file *seq, loff_t *pos) return SEQ_START_TOKEN; list_for_each_entry(self, &irlans, dev_list) { - if (*pos == i) + if (*pos == i) return self; ++i; } @@ -1160,12 +1160,12 @@ static void *irlan_seq_next(struct seq_file *seq, void *v, loff_t *pos) struct list_head *nxt; ++*pos; - if (v == SEQ_START_TOKEN) + if (v == SEQ_START_TOKEN) nxt = irlans.next; else nxt = ((struct irlan_cb *)v)->dev_list.next; - return (nxt == &irlans) ? NULL + return (nxt == &irlans) ? NULL : list_entry(nxt, struct irlan_cb, dev_list); } @@ -1185,7 +1185,7 @@ static int irlan_seq_show(struct seq_file *seq, void *v) seq_puts(seq, "IrLAN instances:\n"); else { struct irlan_cb *self = v; - + IRDA_ASSERT(self != NULL, return -1;); IRDA_ASSERT(self->magic == IRLAN_MAGIC, return -1;); @@ -1201,17 +1201,17 @@ static int irlan_seq_show(struct seq_file *seq, void *v) self->daddr); seq_printf(seq,"version: %d.%d,\n", self->version[1], self->version[0]); - seq_printf(seq,"access type: %s\n", + seq_printf(seq,"access type: %s\n", irlan_access[self->client.access_type]); - seq_printf(seq,"media: %s\n", + seq_printf(seq,"media: %s\n", irlan_media[self->media]); - + seq_printf(seq,"local filter:\n"); seq_printf(seq,"remote filter: "); irlan_print_filter(seq, self->client.filter_type); - seq_printf(seq,"tx busy: %s\n", + seq_printf(seq,"tx busy: %s\n", netif_queue_stopped(self->dev) ? "TRUE" : "FALSE"); - + seq_putc(seq,'\n'); } return 0; @@ -1231,7 +1231,7 @@ static int irlan_seq_open(struct inode *inode, struct file *file) #endif MODULE_AUTHOR("Dag Brattli <dagb@cs.uit.no>"); -MODULE_DESCRIPTION("The Linux IrDA LAN protocol"); +MODULE_DESCRIPTION("The Linux IrDA LAN protocol"); MODULE_LICENSE("GPL"); module_param(eth, bool, 0); diff --git a/net/irda/irlan/irlan_eth.c b/net/irda/irlan/irlan_eth.c index b0ccc455b74..672ab3f6903 100644 --- a/net/irda/irlan/irlan_eth.c +++ b/net/irda/irlan/irlan_eth.c @@ -1,8 +1,8 @@ /********************************************************************* - * + * * Filename: irlan_eth.c - * Version: - * Description: + * Version: + * Description: * Status: Experimental. * Author: Dag Brattli <dagb@cs.uit.no> * Created at: Thu Oct 15 08:37:58 1998 @@ -11,18 +11,18 @@ * Sources: skeleton.c by Donald Becker <becker@CESDIS.gsfc.nasa.gov> * slip.c by Laurence Culhane, <loz@holmes.demon.co.uk> * Fred N. van Kempen, <waltje@uwalt.nl.mugnet.org> - * + * * Copyright (c) 1998-2000 Dag Brattli, All Rights Reserved. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. - * + * * Neither Dag Brattli nor University of Tromsų admit liability nor - * provide warranty for any of this software. This material is + * provide warranty for any of this software. This material is * provided "AS-IS" and at no charge. - * + * ********************************************************************/ #include <linux/netdevice.h> @@ -55,7 +55,7 @@ static void irlan_eth_setup(struct net_device *dev) { dev->open = irlan_eth_open; dev->stop = irlan_eth_close; - dev->hard_start_xmit = irlan_eth_xmit; + dev->hard_start_xmit = irlan_eth_xmit; dev->get_stats = irlan_eth_get_stats; dev->set_multicast_list = irlan_eth_set_multicast_list; dev->destructor = free_netdev; @@ -63,8 +63,8 @@ static void irlan_eth_setup(struct net_device *dev) SET_MODULE_OWNER(dev); ether_setup(dev); - - /* + + /* * Lets do all queueing in IrTTP instead of this device driver. * Queueing here as well can introduce some strange latency * problems, which we will avoid by setting the queue size to 0. @@ -104,17 +104,17 @@ struct net_device *alloc_irlandev(const char *name) static int irlan_eth_open(struct net_device *dev) { struct irlan_cb *self = netdev_priv(dev); - + IRDA_DEBUG(2, "%s()\n", __FUNCTION__ ); /* Ready to play! */ - netif_stop_queue(dev); /* Wait until data link is ready */ + netif_stop_queue(dev); /* Wait until data link is ready */ /* We are now open, so time to do some work */ self->disconnect_reason = 0; irlan_client_wakeup(self, self->saddr, self->daddr); - /* Make sure we have a hardware address before we return, + /* Make sure we have a hardware address before we return, so DHCP clients gets happy */ return wait_event_interruptible(self->open_wait, !self->tsap_data->connected); @@ -124,30 +124,30 @@ static int irlan_eth_open(struct net_device *dev) * Function irlan_eth_close (dev) * * Stop the ether network device, his function will usually be called by - * ifconfig down. We should now disconnect the link, We start the + * ifconfig down. We should now disconnect the link, We start the * close timer, so that the instance will be removed if we are unable * to discover the remote device after the disconnect. */ static int irlan_eth_close(struct net_device *dev) { struct irlan_cb *self = netdev_priv(dev); - + IRDA_DEBUG(2, "%s()\n", __FUNCTION__ ); - + /* Stop device */ netif_stop_queue(dev); - + irlan_close_data_channel(self); irlan_close_tsaps(self); irlan_do_client_event(self, IRLAN_LMP_DISCONNECT, NULL); - irlan_do_provider_event(self, IRLAN_LMP_DISCONNECT, NULL); - + irlan_do_provider_event(self, IRLAN_LMP_DISCONNECT, NULL); + /* Remove frames queued on the control channel */ skb_queue_purge(&self->client.txq); self->client.tx_busy = 0; - + return 0; } @@ -164,7 +164,7 @@ static int irlan_eth_xmit(struct sk_buff *skb, struct net_device *dev) /* skb headroom large enough to contain all IrDA-headers? */ if ((skb_headroom(skb) < self->max_header_size) || (skb_shared(skb))) { - struct sk_buff *new_skb = + struct sk_buff *new_skb = skb_realloc_headroom(skb, self->max_header_size); /* 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) /* Use the new skb instead */ skb = new_skb; - } + } dev->trans_start = jiffies; @@ -187,7 +187,7 @@ static int irlan_eth_xmit(struct sk_buff *skb, struct net_device *dev) ret = irttp_data_request(self->tsap_data, skb); if (ret < 0) { - /* + /* * IrTTPs tx queue is full, so we just have to * drop the frame! You might think that we should * 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) * we have replaced the original skb with a new * one with larger headroom, and that would really * confuse do_dev_queue_xmit() in dev.c! I have - * tried :-) DB + * tried :-) DB */ /* irttp_data_request already free the packet */ self->stats.tx_dropped++; } else { self->stats.tx_packets++; - self->stats.tx_bytes += skb->len; + self->stats.tx_bytes += skb->len; } - + return 0; } @@ -218,37 +218,37 @@ int irlan_eth_receive(void *instance, void *sap, struct sk_buff *skb) struct irlan_cb *self = instance; if (skb == NULL) { - ++self->stats.rx_dropped; + ++self->stats.rx_dropped; return 0; } if (skb->len < ETH_HLEN) { IRDA_DEBUG(0, "%s() : IrLAN frame too short (%d)\n", __FUNCTION__, skb->len); - ++self->stats.rx_dropped; + ++self->stats.rx_dropped; dev_kfree_skb(skb); return 0; } - - /* - * Adopt this frame! Important to set all these fields since they + + /* + * Adopt this frame! Important to set all these fields since they * might have been previously set by the low level IrDA network - * device driver + * device driver */ skb->dev = self->dev; skb->protocol=eth_type_trans(skb, skb->dev); /* Remove eth header */ - + self->stats.rx_packets++; - self->stats.rx_bytes += skb->len; + self->stats.rx_bytes += skb->len; netif_rx(skb); /* Eat it! */ - + return 0; } /* * Function irlan_eth_flow (status) * - * Do flow control between IP/Ethernet and IrLAN/IrTTP. This is done by + * Do flow control between IP/Ethernet and IrLAN/IrTTP. This is done by * controlling the queue stop/start. * * 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) IRDA_ASSERT(self != NULL, return;); IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); - + dev = self->dev; IRDA_ASSERT(dev != NULL, return;); - + IRDA_DEBUG(0, "%s() : flow %s ; running %d\n", __FUNCTION__, flow == FLOW_STOP ? "FLOW_STOP" : "FLOW_START", netif_running(dev)); @@ -301,10 +301,10 @@ void irlan_eth_send_gratuitous_arp(struct net_device *dev) { struct in_device *in_dev; - /* + /* * When we get a new MAC address do a gratuitous ARP. This * is useful if we have changed access points on the same - * subnet. + * subnet. */ #ifdef CONFIG_INET IRDA_DEBUG(4, "IrLAN: Sending gratuitous ARP\n"); @@ -313,10 +313,10 @@ void irlan_eth_send_gratuitous_arp(struct net_device *dev) if (in_dev == NULL) goto out; if (in_dev->ifa_list) - - arp_send(ARPOP_REQUEST, ETH_P_ARP, + + arp_send(ARPOP_REQUEST, ETH_P_ARP, in_dev->ifa_list->ifa_address, - dev, + dev, in_dev->ifa_list->ifa_address, NULL, dev->dev_addr, NULL); out: @@ -331,9 +331,9 @@ out: * */ #define HW_MAX_ADDRS 4 /* Must query to get it! */ -static void irlan_eth_set_multicast_list(struct net_device *dev) +static void irlan_eth_set_multicast_list(struct net_device *dev) { - struct irlan_cb *self = netdev_priv(dev); + struct irlan_cb *self = netdev_priv(dev); IRDA_DEBUG(2, "%s()\n", __FUNCTION__ ); @@ -346,7 +346,7 @@ static void irlan_eth_set_multicast_list(struct net_device *dev) if (dev->flags & IFF_PROMISC) { /* Enable promiscuous mode */ IRDA_WARNING("Promiscous mode not implemented by IrLAN!\n"); - } + } else if ((dev->flags & IFF_ALLMULTI) || dev->mc_count > HW_MAX_ADDRS) { /* Disable promiscuous mode, use normal mode. */ IRDA_DEBUG(4, "%s(), Setting multicast filter\n", __FUNCTION__ ); @@ -378,7 +378,7 @@ static void irlan_eth_set_multicast_list(struct net_device *dev) * Get the current statistics for this device * */ -static struct net_device_stats *irlan_eth_get_stats(struct net_device *dev) +static struct net_device_stats *irlan_eth_get_stats(struct net_device *dev) { struct irlan_cb *self = netdev_priv(dev); diff --git a/net/irda/irlan/irlan_event.c b/net/irda/irlan/irlan_event.c index 2778d8c6aa3..623e0fd16c1 100644 --- a/net/irda/irlan/irlan_event.c +++ b/net/irda/irlan/irlan_event.c @@ -1,25 +1,25 @@ /********************************************************************* - * + * * Filename: irlan_event.c - * Version: - * Description: + * Version: + * Description: * Status: Experimental. * Author: Dag Brattli <dagb@cs.uit.no> * Created at: Tue Oct 20 09:10:16 1998 * Modified at: Sat Oct 30 12:59:01 1999 * Modified by: Dag Brattli <dagb@cs.uit.no> - * + * * Copyright (c) 1998-1999 Dag Brattli, All Rights Reserved. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. - * + * * Neither Dag Brattli nor University of Tromsų admit liability nor - * provide warranty for any of this software. This material is + * provide warranty for any of this software. This material is * provided "AS-IS" and at no charge. - * + * ********************************************************************/ #include <net/irda/irlan_event.h> @@ -38,7 +38,7 @@ char *irlan_state[] = { "IRLAN_SYNC", }; -void irlan_next_client_state(struct irlan_cb *self, IRLAN_STATE state) +void irlan_next_client_state(struct irlan_cb *self, IRLAN_STATE state) { IRDA_DEBUG(2, "%s(), %s\n", __FUNCTION__ , irlan_state[state]); @@ -48,7 +48,7 @@ void irlan_next_client_state(struct irlan_cb *self, IRLAN_STATE state) self->client.state = state; } -void irlan_next_provider_state(struct irlan_cb *self, IRLAN_STATE state) +void irlan_next_provider_state(struct irlan_cb *self, IRLAN_STATE state) { IRDA_DEBUG(2, "%s(), %s\n", __FUNCTION__ , irlan_state[state]); diff --git a/net/irda/irlan/irlan_filter.c b/net/irda/irlan/irlan_filter.c index ca7d358dab5..e6346b88f93 100644 --- a/net/irda/irlan/irlan_filter.c +++ b/net/irda/irlan/irlan_filter.c @@ -1,25 +1,25 @@ /********************************************************************* - * + * * Filename: irlan_filter.c - * Version: - * Description: + * Version: + * Description: * Status: Experimental. * Author: Dag Brattli <dagb@cs.uit.no> * Created at: Fri Jan 29 11:16:38 1999 * Modified at: Sat Oct 30 12:58:45 1999 * Modified by: Dag Brattli <dagb@cs.uit.no> - * + * * Copyright (c) 1998-1999 Dag Brattli, All Rights Reserved. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. - * + * * Neither Dag Brattli nor University of Tromsų admit liability nor - * provide warranty for any of this software. This material is + * provide warranty for any of this software. This material is * provided "AS-IS" and at no charge. - * + * ********************************************************************/ #include <linux/skbuff.h> @@ -40,7 +40,7 @@ void irlan_filter_request(struct irlan_cb *self, struct sk_buff *skb) IRDA_ASSERT(self != NULL, return;); IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); - if ((self->provider.filter_type == IRLAN_DIRECTED) && + if ((self->provider.filter_type == IRLAN_DIRECTED) && (self->provider.filter_operation == DYNAMIC)) { 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) self->provider.mac_address[1] = 0x00; self->provider.mac_address[2] = 0x00; self->provider.mac_address[3] = 0x00; - + /* Use arbitration value to generate MAC address */ if (self->provider.access_type == ACCESS_PEER) { - self->provider.mac_address[4] = + self->provider.mac_address[4] = self->provider.send_arb_val & 0xff; - self->provider.mac_address[5] = + self->provider.mac_address[5] = (self->provider.send_arb_val >> 8) & 0xff; } else { /* Just generate something for now */ @@ -65,12 +65,12 @@ void irlan_filter_request(struct irlan_cb *self, struct sk_buff *skb) skb->data[1] = 0x03; irlan_insert_string_param(skb, "FILTER_MODE", "NONE"); irlan_insert_short_param(skb, "MAX_ENTRY", 0x0001); - irlan_insert_array_param(skb, "FILTER_ENTRY", + irlan_insert_array_param(skb, "FILTER_ENTRY", self->provider.mac_address, 6); return; } - - if ((self->provider.filter_type == IRLAN_DIRECTED) && + + if ((self->provider.filter_type == IRLAN_DIRECTED) && (self->provider.filter_mode == FILTER)) { IRDA_DEBUG(0, "Directed filter on\n"); @@ -78,7 +78,7 @@ void irlan_filter_request(struct irlan_cb *self, struct sk_buff *skb) skb->data[1] = 0x00; return; } - if ((self->provider.filter_type == IRLAN_DIRECTED) && + if ((self->provider.filter_type == IRLAN_DIRECTED) && (self->provider.filter_mode == NONE)) { IRDA_DEBUG(0, "Directed filter off\n"); @@ -87,7 +87,7 @@ void irlan_filter_request(struct irlan_cb *self, struct sk_buff *skb) return; } - if ((self->provider.filter_type == IRLAN_BROADCAST) && + if ((self->provider.filter_type == IRLAN_BROADCAST) && (self->provider.filter_mode == FILTER)) { IRDA_DEBUG(0, "Broadcast filter on\n"); @@ -95,7 +95,7 @@ void irlan_filter_request(struct irlan_cb *self, struct sk_buff *skb) skb->data[1] = 0x00; return; } - if ((self->provider.filter_type == IRLAN_BROADCAST) && + if ((self->provider.filter_type == IRLAN_BROADCAST) && (self->provider.filter_mode == NONE)) { IRDA_DEBUG(0, "Broadcast filter off\n"); @@ -103,7 +103,7 @@ void irlan_filter_request(struct irlan_cb *self, struct sk_buff *skb) skb->data[1] = 0x00; return; } - if ((self->provider.filter_type == IRLAN_MULTICAST) && + if ((self->provider.filter_type == IRLAN_MULTICAST) && (self->provider.filter_mode == FILTER)) { IRDA_DEBUG(0, "Multicast filter on\n"); @@ -111,7 +111,7 @@ void irlan_filter_request(struct irlan_cb *self, struct sk_buff *skb) skb->data[1] = 0x00; return; } - if ((self->provider.filter_type == IRLAN_MULTICAST) && + if ((self->provider.filter_type == IRLAN_MULTICAST) && (self->provider.filter_mode == NONE)) { IRDA_DEBUG(0, "Multicast filter off\n"); @@ -119,7 +119,7 @@ void irlan_filter_request(struct irlan_cb *self, struct sk_buff *skb) skb->data[1] = 0x00; return; } - if ((self->provider.filter_type == IRLAN_MULTICAST) && + if ((self->provider.filter_type == IRLAN_MULTICAST) && (self->provider.filter_operation == GET)) { IRDA_DEBUG(0, "Multicast filter get\n"); diff --git a/net/irda/irlan/irlan_provider.c b/net/irda/irlan/irlan_provider.c index 58efde91966..aac66434e47 100644 --- a/net/irda/irlan/irlan_provider.c +++ b/net/irda/irlan/irlan_provider.c @@ -1,5 +1,5 @@ /********************************************************************* - * + * * Filename: irlan_provider.c * Version: 0.9 * Description: IrDA LAN Access Protocol Implementation @@ -11,17 +11,17 @@ * Sources: skeleton.c by Donald Becker <becker@CESDIS.gsfc.nasa.gov> * slip.c by Laurence Culhane, <loz@holmes.demon.co.uk> * Fred N. van Kempen, <waltje@uwalt.nl.mugnet.org> - * - * Copyright (c) 1998-1999 Dag Brattli <dagb@cs.uit.no>, + * + * Copyright (c) 1998-1999 Dag Brattli <dagb@cs.uit.no>, * All Rights Reserved. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * Neither Dag Brattli nor University of Tromsų admit liability nor - * provide warranty for any of this software. This material is + * provide warranty for any of this software. This material is * provided "AS-IS" and at no charge. * ********************************************************************/ @@ -52,8 +52,8 @@ #include <net/irda/irlan_filter.h> #include <net/irda/irlan_client.h> -static void irlan_provider_connect_indication(void *instance, void *sap, - struct qos_info *qos, +static void irlan_provider_connect_indication(void *instance, void *sap, + struct qos_info *qos, __u32 max_sdu_size, __u8 max_header_size, struct sk_buff *skb); @@ -64,14 +64,14 @@ static void irlan_provider_connect_indication(void *instance, void *sap, * This function gets the data that is received on the control channel * */ -static int irlan_provider_data_indication(void *instance, void *sap, - struct sk_buff *skb) +static int irlan_provider_data_indication(void *instance, void *sap, + struct sk_buff *skb) { struct irlan_cb *self; __u8 code; - + IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); - + self = (struct irlan_cb *) instance; IRDA_ASSERT(self != NULL, return -1;); @@ -83,16 +83,16 @@ static int irlan_provider_data_indication(void *instance, void *sap, switch(code) { case CMD_GET_PROVIDER_INFO: IRDA_DEBUG(4, "Got GET_PROVIDER_INFO command!\n"); - irlan_do_provider_event(self, IRLAN_GET_INFO_CMD, skb); + irlan_do_provider_event(self, IRLAN_GET_INFO_CMD, skb); break; case CMD_GET_MEDIA_CHAR: IRDA_DEBUG(4, "Got GET_MEDIA_CHAR command!\n"); - irlan_do_provider_event(self, IRLAN_GET_MEDIA_CMD, skb); + irlan_do_provider_event(self, IRLAN_GET_MEDIA_CMD, skb); break; case CMD_OPEN_DATA_CHANNEL: IRDA_DEBUG(4, "Got OPEN_DATA_CHANNEL command!\n"); - irlan_do_provider_event(self, IRLAN_OPEN_DATA_CMD, skb); + irlan_do_provider_event(self, IRLAN_OPEN_DATA_CMD, skb); break; case CMD_FILTER_OPERATION: IRDA_DEBUG(4, "Got FILTER_OPERATION command!\n"); @@ -119,9 +119,9 @@ static int irlan_provider_data_indication(void *instance, void *sap, * Got connection from peer IrLAN client * */ -static void irlan_provider_connect_indication(void *instance, void *sap, +static void irlan_provider_connect_indication(void *instance, void *sap, struct qos_info *qos, - __u32 max_sdu_size, + __u32 max_sdu_size, __u8 max_header_size, struct sk_buff *skb) { @@ -130,13 +130,13 @@ static void irlan_provider_connect_indication(void *instance, void *sap, __u32 saddr, daddr; IRDA_DEBUG(0, "%s()\n", __FUNCTION__ ); - + self = (struct irlan_cb *) instance; tsap = (struct tsap_cb *) sap; - + IRDA_ASSERT(self != NULL, return;); IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); - + IRDA_ASSERT(tsap == self->provider.tsap_ctrl,return;); IRDA_ASSERT(self->provider.state == IRLAN_IDLE, return;); @@ -147,13 +147,13 @@ static void irlan_provider_connect_indication(void *instance, void *sap, irlan_do_provider_event(self, IRLAN_CONNECT_INDICATION, NULL); - /* + /* * If we are in peer mode, the client may not have got the discovery - * indication it needs to make progress. If the client is still in - * IDLE state, we must kick it. + * indication it needs to make progress. If the client is still in + * IDLE state, we must kick it. */ - if ((self->provider.access_type == ACCESS_PEER) && - (self->client.state == IRLAN_IDLE)) + if ((self->provider.access_type == ACCESS_PEER) && + (self->client.state == IRLAN_IDLE)) { irlan_client_wakeup(self, self->saddr, self->daddr); } @@ -175,38 +175,38 @@ void irlan_provider_connect_response(struct irlan_cb *self, irttp_connect_response(tsap, IRLAN_MTU, NULL); } -static void irlan_provider_disconnect_indication(void *instance, void *sap, - LM_REASON reason, - struct sk_buff *userdata) +static void irlan_provider_disconnect_indication(void *instance, void *sap, + LM_REASON reason, + struct sk_buff *userdata) { struct irlan_cb *self; struct tsap_cb *tsap; IRDA_DEBUG(4, "%s(), reason=%d\n", __FUNCTION__ , reason); - + self = (struct irlan_cb *) instance; tsap = (struct tsap_cb *) sap; IRDA_ASSERT(self != NULL, return;); - IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); + IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;); IRDA_ASSERT(tsap != NULL, return;); IRDA_ASSERT(tsap->magic == TTP_TSAP_MAGIC, return;); - + IRDA_ASSERT(tsap == self->provider.tsap_ctrl, return;); - + irlan_do_provider_event(self, IRLAN_LMP_DISCONNECT, NULL); } /* * Function irlan_parse_open_data_cmd (self, skb) * - * + * * */ int irlan_parse_open_data_cmd(struct irlan_cb *self, struct sk_buff *skb) { int ret; - + ret = irlan_provider_parse_command(self, CMD_OPEN_DATA_CHANNEL, skb); /* Open data channel */ @@ -218,12 +218,12 @@ int irlan_parse_open_data_cmd(struct irlan_cb *self, struct sk_buff *skb) /* * Function parse_command (skb) * - * Extract all parameters from received buffer, then feed them to + * Extract all parameters from received buffer, then feed them to * check_params for parsing * */ int irlan_provider_parse_command(struct irlan_cb *self, int cmd, - struct sk_buff *skb) + struct sk_buff *skb) { __u8 *frame; __u8 *ptr; @@ -231,16 +231,16 @@ int irlan_provider_parse_command(struct irlan_cb *self, int cmd, __u16 val_len; int i; char *name; - char *value; + char *value; int ret = RSP_SUCCESS; - + IRDA_ASSERT(skb != NULL, return -RSP_PROTOCOL_ERROR;); - + IRDA_DEBUG(4, "%s(), skb->len=%d\n", __FUNCTION__ , (int)skb->len); IRDA_ASSERT(self != NULL, return -RSP_PROTOCOL_ERROR;); IRDA_ASSERT(self->magic == IRLAN_MAGIC, return -RSP_PROTOCOL_ERROR;); - + if (!skb) return -RSP_PROTOCOL_ERROR; @@ -259,11 +259,11 @@ int irlan_provider_parse_command(struct irlan_cb *self, int cmd, count = frame[1]; IRDA_DEBUG(4, "Got %d parameters\n", count); - + ptr = frame+2; - + /* For all parameters */ - for (i=0; i<count;i++) { + for (i=0; i<count;i++) { ret = irlan_extract_param(ptr, name, value, &val_len); if (ret < 0) { IRDA_DEBUG(2, "%s(), IrLAN, Error!\n", __FUNCTION__ ); @@ -286,7 +286,7 @@ int irlan_provider_parse_command(struct irlan_cb *self, int cmd, * Send reply to query to peer IrLAN layer * */ -void irlan_provider_send_reply(struct irlan_cb *self, int command, +void irlan_provider_send_reply(struct irlan_cb *self, int command, int ret_code) { struct sk_buff *skb; @@ -310,7 +310,7 @@ void irlan_provider_send_reply(struct irlan_cb *self, int command, /* Reserve space for TTP, LMP, and LAP header */ skb_reserve(skb, self->provider.max_header_size); skb_put(skb, 2); - + switch (command) { case CMD_GET_PROVIDER_INFO: skb->data[0] = 0x00; /* Success */ @@ -356,7 +356,7 @@ void irlan_provider_send_reply(struct irlan_cb *self, int command, skb->data[0] = 0x00; /* Success */ if (self->provider.send_arb_val) { skb->data[1] = 0x03; /* 3 parameters */ - irlan_insert_short_param(skb, "CON_ARB", + irlan_insert_short_param(skb, "CON_ARB", self->provider.send_arb_val); } else skb->data[1] = 0x02; /* 2 parameters */ @@ -378,13 +378,13 @@ void irlan_provider_send_reply(struct irlan_cb *self, int command, * Function irlan_provider_register(void) * * Register provider support so we can accept incoming connections. - * + * */ int irlan_provider_open_ctrl_tsap(struct irlan_cb *self) { struct tsap_cb *tsap; notify_t notify; - + IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); IRDA_ASSERT(self != NULL, return -1;); @@ -393,7 +393,7 @@ int irlan_provider_open_ctrl_tsap(struct irlan_cb *self) /* Check if already open */ if (self->provider.tsap_ctrl) return -1; - + /* * First register well known control TSAP */ diff --git a/net/irda/irlan/irlan_provider_event.c b/net/irda/irlan/irlan_provider_event.c index 5a086f9827e..ef401bd6ea0 100644 --- a/net/irda/irlan/irlan_provider_event.c +++ b/net/irda/irlan/irlan_provider_event.c @@ -1,5 +1,5 @@ /********************************************************************* - * + * * Filename: irlan_provider_event.c * Version: 0.9 * Description: IrLAN provider state machine) @@ -8,16 +8,16 @@ * Created at: Sun Aug 31 20:14:37 1997 * Modified at: Sat Oct 30 12:52:41 1999 * Modified by: Dag Brattli <dagb@cs.uit.no> - * + * * Copyright (c) 1998-1999 Dag Brattli <dagb@cs.uit.no>, All Rights Reserved. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * Neither Dag Brattli nor University of Tromsų admit liability nor - * provide warranty for any of this software. This material is + * provide warranty for any of this software. This material is * provided "AS-IS" and at no charge. * ********************************************************************/ @@ -30,18 +30,18 @@ #include <net/irda/irlan_provider.h> #include <net/irda/irlan_event.h> -static int irlan_provider_state_idle(struct irlan_cb *self, IRLAN_EVENT event, +static int irlan_provider_state_idle(struct irlan_cb *self, IRLAN_EVENT event, struct sk_buff *skb); -static int irlan_provider_state_info(struct irlan_cb *self, IRLAN_EVENT event, +static int irlan_provider_state_info(struct irlan_cb *self, IRLAN_EVENT event, struct sk_buff *skb); -static int irlan_provider_state_open(struct irlan_cb *self, IRLAN_EVENT event, +static int irlan_provider_state_open(struct irlan_cb *self, IRLAN_EVENT event, struct sk_buff *skb); -static int irlan_provider_state_data(struct irlan_cb *self, IRLAN_EVENT event, +static int irlan_provider_state_data(struct irlan_cb *self, IRLAN_EVENT event, struct sk_buff *skb); -static int (*state[])(struct irlan_cb *self, IRLAN_EVENT event, - struct sk_buff *skb) = -{ +static int (*state[])(struct irlan_cb *self, IRLAN_EVENT event, + struct sk_buff *skb) = +{ irlan_provider_state_idle, NULL, /* Query */ NULL, /* Info */ @@ -55,8 +55,8 @@ static int (*state[])(struct irlan_cb *self, IRLAN_EVENT event, NULL, /* Sync */ }; -void irlan_do_provider_event(struct irlan_cb *self, IRLAN_EVENT event, - struct sk_buff *skb) +void irlan_do_provider_event(struct irlan_cb *self, IRLAN_EVENT event, + struct sk_buff *skb) { IRDA_ASSERT(*state[ self->provider.state] != NULL, return;); @@ -73,9 +73,9 @@ static int irlan_provider_state_idle(struct irlan_cb *self, IRLAN_EVENT event, struct sk_buff *skb) { IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); - + IRDA_ASSERT(self != NULL, return -1;); - + switch(event) { case IRLAN_CONNECT_INDICATION: 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, * * INFO, We have issued a GetInfo command and is awaiting a reply. */ -static int irlan_provider_state_info(struct irlan_cb *self, IRLAN_EVENT event, - struct sk_buff *skb) +static int irlan_provider_state_info(struct irlan_cb *self, IRLAN_EVENT event, + struct sk_buff *skb) { int ret; IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); - + IRDA_ASSERT(self != NULL, return -1;); switch(event) { @@ -110,7 +110,7 @@ static int irlan_provider_state_info(struct irlan_cb *self, IRLAN_EVENT event, /* Be sure to use 802.3 in case of peer mode */ if (self->provider.access_type == ACCESS_PEER) { self->media = MEDIA_802_3; - + /* Check if client has started yet */ if (self->client.state == IRLAN_IDLE) { /* This should get the client going */ @@ -118,15 +118,15 @@ static int irlan_provider_state_info(struct irlan_cb *self, IRLAN_EVENT event, } } - irlan_provider_send_reply(self, CMD_GET_PROVIDER_INFO, + irlan_provider_send_reply(self, CMD_GET_PROVIDER_INFO, RSP_SUCCESS); /* Keep state */ break; - case IRLAN_GET_MEDIA_CMD: - irlan_provider_send_reply(self, CMD_GET_MEDIA_CHAR, + case IRLAN_GET_MEDIA_CMD: + irlan_provider_send_reply(self, CMD_GET_MEDIA_CHAR, RSP_SUCCESS); /* Keep state */ - break; + break; case IRLAN_OPEN_DATA_CMD: ret = irlan_parse_open_data_cmd(self, skb); if (self->provider.access_type == ACCESS_PEER) { @@ -152,7 +152,7 @@ static int irlan_provider_state_info(struct irlan_cb *self, IRLAN_EVENT event, } if (skb) dev_kfree_skb(skb); - + return 0; } @@ -163,7 +163,7 @@ static int irlan_provider_state_info(struct irlan_cb *self, IRLAN_EVENT event, * reply * */ -static int irlan_provider_state_open(struct irlan_cb *self, IRLAN_EVENT event, +static int irlan_provider_state_open(struct irlan_cb *self, IRLAN_EVENT event, struct sk_buff *skb) { IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); @@ -173,11 +173,11 @@ static int irlan_provider_state_open(struct irlan_cb *self, IRLAN_EVENT event, switch(event) { case IRLAN_FILTER_CONFIG_CMD: irlan_provider_parse_command(self, CMD_FILTER_OPERATION, skb); - irlan_provider_send_reply(self, CMD_FILTER_OPERATION, + irlan_provider_send_reply(self, CMD_FILTER_OPERATION, RSP_SUCCESS); /* Keep state */ break; - case IRLAN_DATA_CONNECT_INDICATION: + case IRLAN_DATA_CONNECT_INDICATION: irlan_next_provider_state(self, IRLAN_DATA); irlan_provider_connect_response(self, self->tsap_data); break; @@ -202,8 +202,8 @@ static int irlan_provider_state_open(struct irlan_cb *self, IRLAN_EVENT event, * the local and remote machines. * */ -static int irlan_provider_state_data(struct irlan_cb *self, IRLAN_EVENT event, - struct sk_buff *skb) +static int irlan_provider_state_data(struct irlan_cb *self, IRLAN_EVENT event, + struct sk_buff *skb) { IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); @@ -213,7 +213,7 @@ static int irlan_provider_state_data(struct irlan_cb *self, IRLAN_EVENT event, switch(event) { case IRLAN_FILTER_CONFIG_CMD: irlan_provider_parse_command(self, CMD_FILTER_OPERATION, skb); - irlan_provider_send_reply(self, CMD_FILTER_OPERATION, + irlan_provider_send_reply(self, CMD_FILTER_OPERATION, RSP_SUCCESS); break; case IRLAN_LMP_DISCONNECT: /* FALLTHROUGH */ @@ -226,7 +226,7 @@ static int irlan_provider_state_data(struct irlan_cb *self, IRLAN_EVENT event, } if (skb) dev_kfree_skb(skb); - + return 0; } |