summaryrefslogtreecommitdiff
path: root/net/irda/irlan/irlan_common.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/irda/irlan/irlan_common.c')
-rw-r--r--net/irda/irlan/irlan_common.c343
1 files changed, 180 insertions, 163 deletions
diff --git a/net/irda/irlan/irlan_common.c b/net/irda/irlan/irlan_common.c
index 2bb04ac09329..fcf9d6599628 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.
@@ -93,7 +93,7 @@ extern struct proc_dir_entry *proc_irda;
static int irlan_seq_open(struct inode *inode, struct file *file);
-static struct file_operations irlan_fops = {
+static const struct file_operations irlan_fops = {
.owner = THIS_MODULE,
.open = irlan_seq_open,
.read = seq_read,
@@ -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);
@@ -144,12 +144,18 @@ static int __init irlan_init(void)
/* Register with IrLMP as a client */
ckey = irlmp_register_client(hints, &irlan_client_discovery_indication,
NULL, NULL);
-
+ if (!ckey)
+ goto err_ckey;
+
/* Register with IrLMP as a service */
- skey = irlmp_register_service(hints);
+ skey = irlmp_register_service(hints);
+ if (!skey)
+ goto err_skey;
/* Start the master IrLAN instance (the only one for now) */
- new = irlan_open(DEV_ADDR_ANY, DEV_ADDR_ANY);
+ new = irlan_open(DEV_ADDR_ANY, DEV_ADDR_ANY);
+ if (!new)
+ goto err_open;
/* The master will only open its (listen) control TSAP */
irlan_provider_open_ctrl_tsap(new);
@@ -158,9 +164,20 @@ static int __init irlan_init(void)
irlmp_discovery_request(DISCOVERY_DEFAULT_SLOTS);
return 0;
+
+err_open:
+ irlmp_unregister_service(skey);
+err_skey:
+ irlmp_unregister_client(ckey);
+err_ckey:
+#ifdef CONFIG_PROC_FS
+ remove_proc_entry("irlan", proc_irda);
+#endif /* CONFIG_PROC_FS */
+
+ return -ENOMEM;
}
-static void __exit irlan_cleanup(void)
+static void __exit irlan_cleanup(void)
{
struct irlan_cb *self, *next;
@@ -184,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)
@@ -212,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;
@@ -228,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);
@@ -251,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;);
@@ -268,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 */
@@ -299,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;);
@@ -332,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);
@@ -344,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;
@@ -364,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);
@@ -391,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__ );
@@ -434,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...
@@ -444,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);
}
@@ -463,12 +480,12 @@ void irlan_open_data_tsap(struct irlan_cb *self)
return;
irda_notify_init(&notify);
-
+
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));
@@ -480,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.
*/
@@ -501,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;
@@ -528,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
*/
@@ -543,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,
@@ -589,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);
@@ -632,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;);
@@ -644,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);
}
@@ -659,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"),
@@ -678,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");
@@ -694,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;);
@@ -716,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);
@@ -731,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.
*
*/
@@ -739,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") +
@@ -756,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);
}
@@ -777,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...*/
@@ -799,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);
}
@@ -818,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;);
@@ -839,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);
}
@@ -870,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") +
@@ -888,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);
@@ -926,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);
}
@@ -963,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);
}
@@ -976,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);
}
@@ -989,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) {
@@ -1020,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;
@@ -1028,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 */
@@ -1065,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;
@@ -1105,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;
}
@@ -1116,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
*/
@@ -1130,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;
}
@@ -1143,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);
}
@@ -1168,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;);
@@ -1184,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;
@@ -1214,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);