summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
Diffstat (limited to 'net')
-rw-r--r--net/core/dev.c1
-rw-r--r--net/decnet/Config.in2
-rw-r--r--net/irda/af_irda.c106
-rw-r--r--net/irda/discovery.c23
-rw-r--r--net/irda/ircomm/ircomm_core.c4
-rw-r--r--net/irda/ircomm/ircomm_param.c46
-rw-r--r--net/irda/ircomm/ircomm_tty.c10
-rw-r--r--net/irda/ircomm/ircomm_tty_attach.c27
-rw-r--r--net/irda/irda_device.c909
-rw-r--r--net/irda/iriap.c77
-rw-r--r--net/irda/iriap_event.c60
-rw-r--r--net/irda/irias_object.c199
-rw-r--r--net/irda/irlan/irlan_common.c4
-rw-r--r--net/irda/irlap.c131
-rw-r--r--net/irda/irlap_comp.c44
-rw-r--r--net/irda/irlap_event.c134
-rw-r--r--net/irda/irlap_frame.c90
-rw-r--r--net/irda/irlmp.c153
-rw-r--r--net/irda/irlmp_event.c90
-rw-r--r--net/irda/irlmp_frame.c30
-rw-r--r--net/irda/irmod.c39
-rw-r--r--net/irda/irproc.c20
-rw-r--r--net/irda/irqueue.c78
-rw-r--r--net/irda/irttp.c100
-rw-r--r--net/irda/parameters.c27
-rw-r--r--net/irda/qos.c36
-rw-r--r--net/irda/timer.c43
-rw-r--r--net/irda/wrapper.c216
28 files changed, 1156 insertions, 1543 deletions
diff --git a/net/core/dev.c b/net/core/dev.c
index 2f9edda09..078caeb99 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -374,6 +374,7 @@ struct net_device *dev_alloc(const char *name, int *err)
*err=-ENOBUFS;
return NULL;
}
+ memset(dev, 0, sizeof(struct net_device));
dev->name=(char *)(dev+1); /* Name string space */
*err=dev_alloc_name(dev,name);
if(*err<0)
diff --git a/net/decnet/Config.in b/net/decnet/Config.in
index 6e992c0a8..323ae86f7 100644
--- a/net/decnet/Config.in
+++ b/net/decnet/Config.in
@@ -2,7 +2,7 @@
# DECnet configuration
#
bool ' DECnet: SIOCGIFCONF support' CONFIG_DECNET_SIOCGIFCONF
-if [ "$CONFIG_EXPERIMENTAL" ]; then
+if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then
bool ' DECnet: router support (EXPERIMENTAL)' CONFIG_DECNET_ROUTER
fi
bool ' DECnet: raw socket support' CONFIG_DECNET_RAW
diff --git a/net/irda/af_irda.c b/net/irda/af_irda.c
index 96060aa88..7a01c28ea 100644
--- a/net/irda/af_irda.c
+++ b/net/irda/af_irda.c
@@ -6,7 +6,7 @@
* Status: Experimental.
* Author: Dag Brattli <dagb@cs.uit.no>
* Created at: Sun May 31 10:12:43 1998
- * Modified at: Mon Sep 27 20:11:52 1999
+ * Modified at: Fri Oct 1 19:11:04 1999
* Modified by: Dag Brattli <dagb@cs.uit.no>
* Sources: af_netroom.c, af_ax25.c, af_rose.c, af_x25.c etc.
*
@@ -76,7 +76,7 @@ static int irda_data_indication(void *instance, void *sap, struct sk_buff *skb)
err = sock_queue_rcv_skb(sk, skb);
if (err) {
- DEBUG(1, __FUNCTION__ "(), error: no more mem!\n");
+ IRDA_DEBUG(1, __FUNCTION__ "(), error: no more mem!\n");
self->rx_flow = FLOW_STOP;
/* When we return error, TTP will need to requeue the skb */
@@ -98,7 +98,7 @@ static void irda_disconnect_indication(void *instance, void *sap,
struct irda_sock *self;
struct sock *sk;
- DEBUG(2, __FUNCTION__ "()\n");
+ IRDA_DEBUG(2, __FUNCTION__ "()\n");
self = (struct irda_sock *) instance;
@@ -129,7 +129,7 @@ static void irda_connect_confirm(void *instance, void *sap,
struct irda_sock *self;
struct sock *sk;
- DEBUG(2, __FUNCTION__ "()\n");
+ IRDA_DEBUG(2, __FUNCTION__ "()\n");
self = (struct irda_sock *) instance;
@@ -145,7 +145,7 @@ static void irda_connect_confirm(void *instance, void *sap,
else
self->max_data_size = max_sdu_size;
- DEBUG(1, __FUNCTION__ "(), max_data_size=%d\n", self->max_data_size);
+ IRDA_DEBUG(1, __FUNCTION__ "(), max_data_size=%d\n", self->max_data_size);
memcpy(&self->qos_tx, qos, sizeof(struct qos_info));
@@ -173,7 +173,7 @@ static void irda_connect_indication(void *instance, void *sap,
struct irda_sock *self;
struct sock *sk;
- DEBUG(2, __FUNCTION__ "()\n");
+ IRDA_DEBUG(2, __FUNCTION__ "()\n");
self = (struct irda_sock *) instance;
@@ -189,7 +189,7 @@ static void irda_connect_indication(void *instance, void *sap,
else
self->max_data_size = max_sdu_size;
- DEBUG(1, __FUNCTION__ "(), max_data_size=%d\n", self->max_data_size);
+ IRDA_DEBUG(1, __FUNCTION__ "(), max_data_size=%d\n", self->max_data_size);
memcpy(&self->qos_tx, qos, sizeof(struct qos_info));
@@ -212,13 +212,13 @@ void irda_connect_response(struct irda_sock *self)
{
struct sk_buff *skb;
- DEBUG(1, __FUNCTION__ "()\n");
+ IRDA_DEBUG(1, __FUNCTION__ "()\n");
ASSERT(self != NULL, return;);
skb = dev_alloc_skb(64);
if (skb == NULL) {
- DEBUG(0, __FUNCTION__ "() Unable to allocate sk_buff!\n");
+ IRDA_DEBUG(0, __FUNCTION__ "() Unable to allocate sk_buff!\n");
return;
}
@@ -239,7 +239,7 @@ static void irda_flow_indication(void *instance, void *sap, LOCAL_FLOW flow)
struct irda_sock *self;
struct sock *sk;
- DEBUG(1, __FUNCTION__ "()\n");
+ IRDA_DEBUG(1, __FUNCTION__ "()\n");
self = (struct irda_sock *) instance;
ASSERT(self != NULL, return;);
@@ -249,16 +249,16 @@ static void irda_flow_indication(void *instance, void *sap, LOCAL_FLOW flow)
switch (flow) {
case FLOW_STOP:
- DEBUG(1, __FUNCTION__ "(), IrTTP wants us to slow down\n");
+ IRDA_DEBUG(1, __FUNCTION__ "(), IrTTP wants us to slow down\n");
self->tx_flow = flow;
break;
case FLOW_START:
self->tx_flow = flow;
- DEBUG(1, __FUNCTION__ "(), IrTTP wants us to start again\n");
+ IRDA_DEBUG(1, __FUNCTION__ "(), IrTTP wants us to start again\n");
wake_up_interruptible(sk->sleep);
break;
default:
- DEBUG( 0, __FUNCTION__ "(), Unknown flow command!\n");
+ IRDA_DEBUG( 0, __FUNCTION__ "(), Unknown flow command!\n");
}
}
@@ -273,7 +273,7 @@ static void irda_get_value_confirm(int result, __u16 obj_id,
{
struct irda_sock *self;
- DEBUG(1, __FUNCTION__ "()\n");
+ IRDA_DEBUG(1, __FUNCTION__ "()\n");
ASSERT(priv != NULL, return;);
self = (struct irda_sock *) priv;
@@ -283,7 +283,7 @@ static void irda_get_value_confirm(int result, __u16 obj_id,
/* Check if request succeeded */
if (result != IAS_SUCCESS) {
- DEBUG(0, __FUNCTION__ "(), IAS query failed!\n");
+ IRDA_DEBUG(0, __FUNCTION__ "(), IAS query failed!\n");
self->errno = result;
@@ -295,7 +295,7 @@ static void irda_get_value_confirm(int result, __u16 obj_id,
switch (value->type) {
case IAS_INTEGER:
- DEBUG(4, __FUNCTION__ "() int=%d\n", value->t.integer);
+ IRDA_DEBUG(4, __FUNCTION__ "() int=%d\n", value->t.integer);
if (value->t.integer != -1) {
self->dtsap_sel = value->t.integer;
@@ -303,7 +303,7 @@ static void irda_get_value_confirm(int result, __u16 obj_id,
self->dtsap_sel = 0;
break;
default:
- DEBUG(0, __FUNCTION__ "(), bad type!\n");
+ IRDA_DEBUG(0, __FUNCTION__ "(), bad type!\n");
break;
}
/* Wake up any processes waiting for result */
@@ -318,7 +318,7 @@ static void irda_get_value_confirm(int result, __u16 obj_id,
*/
static void irda_discovery_indication(hashbin_t *log)
{
- DEBUG(1, __FUNCTION__ "()\n");
+ IRDA_DEBUG(1, __FUNCTION__ "()\n");
cachelog = log;
@@ -349,7 +349,7 @@ static int irda_open_tsap(struct irda_sock *self, __u8 tsap_sel, char *name)
self->tsap = irttp_open_tsap(tsap_sel, DEFAULT_INITIAL_CREDIT,
&notify);
if (self->tsap == NULL) {
- DEBUG( 0, __FUNCTION__ "(), Unable to allocate TSAP!\n");
+ IRDA_DEBUG( 0, __FUNCTION__ "(), Unable to allocate TSAP!\n");
return -1;
}
/* Remember which TSAP selector we actually got */
@@ -366,7 +366,7 @@ static int irda_open_tsap(struct irda_sock *self, __u8 tsap_sel, char *name)
*/
static int irda_find_lsap_sel(struct irda_sock *self, char *name)
{
- DEBUG(1, __FUNCTION__ "()\n");
+ IRDA_DEBUG(1, __FUNCTION__ "()\n");
ASSERT(self != NULL, return -1;);
@@ -408,8 +408,8 @@ static int irda_getname(struct socket *sock, struct sockaddr *uaddr,
saddr.sir_addr = sk->protinfo.irda->saddr;
}
- DEBUG(1, __FUNCTION__ "(), tsap_sel = %#x\n", saddr.sir_lsap_sel);
- DEBUG(1, __FUNCTION__ "(), addr = %08x\n", saddr.sir_addr);
+ IRDA_DEBUG(1, __FUNCTION__ "(), tsap_sel = %#x\n", saddr.sir_lsap_sel);
+ IRDA_DEBUG(1, __FUNCTION__ "(), addr = %08x\n", saddr.sir_addr);
if (*uaddr_len > sizeof (struct sockaddr_irda))
*uaddr_len = sizeof (struct sockaddr_irda);
@@ -493,7 +493,7 @@ static int irda_accept(struct socket *sock, struct socket *newsock, int flags)
struct sk_buff *skb;
int err;
- DEBUG(0, __FUNCTION__ "()\n");
+ IRDA_DEBUG(0, __FUNCTION__ "()\n");
self = sk->protinfo.irda;
ASSERT(self != NULL, return -1;);
@@ -538,7 +538,7 @@ static int irda_accept(struct socket *sock, struct socket *newsock, int flags)
/* Now attach up the new socket */
new->tsap = irttp_dup(self->tsap, new);
if (!new->tsap) {
- DEBUG(0, __FUNCTION__ "(), dup failed!\n");
+ IRDA_DEBUG(0, __FUNCTION__ "(), dup failed!\n");
return -1;
}
@@ -610,12 +610,12 @@ static int irda_connect(struct socket *sock, struct sockaddr *uaddr,
return -EINVAL;
self->daddr = addr->sir_addr;
- DEBUG(1, __FUNCTION__ "(), daddr = %08x\n", self->daddr);
+ IRDA_DEBUG(1, __FUNCTION__ "(), daddr = %08x\n", self->daddr);
/* Query remote LM-IAS */
err = irda_find_lsap_sel(self, addr->sir_name);
if (err) {
- DEBUG(0, __FUNCTION__ "(), connect failed!\n");
+ IRDA_DEBUG(0, __FUNCTION__ "(), connect failed!\n");
return err;
}
@@ -632,7 +632,7 @@ static int irda_connect(struct socket *sock, struct sockaddr *uaddr,
self->saddr, self->daddr, NULL,
self->max_sdu_size_rx, NULL);
if (err) {
- DEBUG(0, __FUNCTION__ "(), connect failed!\n");
+ IRDA_DEBUG(0, __FUNCTION__ "(), connect failed!\n");
return err;
}
@@ -676,7 +676,7 @@ static int irda_create(struct socket *sock, int protocol)
struct sock *sk;
struct irda_sock *self;
- DEBUG(2, __FUNCTION__ "()\n");
+ IRDA_DEBUG(2, __FUNCTION__ "()\n");
/* Check for valid socket type */
switch (sock->type) {
@@ -730,7 +730,7 @@ static int irda_create(struct socket *sock, int protocol)
*/
void irda_destroy_socket(struct irda_sock *self)
{
- DEBUG(2, __FUNCTION__ "()\n");
+ IRDA_DEBUG(2, __FUNCTION__ "()\n");
ASSERT(self != NULL, return;);
@@ -766,7 +766,7 @@ static int irda_release(struct socket *sock)
{
struct sock *sk = sock->sk;
- DEBUG(1, __FUNCTION__ "()\n");
+ IRDA_DEBUG(1, __FUNCTION__ "()\n");
if (sk == NULL)
return 0;
@@ -800,7 +800,7 @@ static int irda_sendmsg(struct socket *sock, struct msghdr *msg, int len,
unsigned char *asmptr;
int err;
- DEBUG(4, __FUNCTION__ "(), len=%d\n", len);
+ IRDA_DEBUG(4, __FUNCTION__ "(), len=%d\n", len);
if (msg->msg_flags & ~MSG_DONTWAIT)
return -EINVAL;
@@ -815,7 +815,7 @@ static int irda_sendmsg(struct socket *sock, struct msghdr *msg, int len,
/* Check if IrTTP is wants us to slow down */
while (self->tx_flow == FLOW_STOP) {
- DEBUG(2, __FUNCTION__ "(), IrTTP is busy, going to sleep!\n");
+ IRDA_DEBUG(2, __FUNCTION__ "(), IrTTP is busy, going to sleep!\n");
interruptible_sleep_on(sk->sleep);
/* Check if we are still connected */
@@ -825,7 +825,7 @@ static int irda_sendmsg(struct socket *sock, struct msghdr *msg, int len,
/* Check that we don't send out to big frames */
if (len > self->max_data_size) {
- DEBUG(0, __FUNCTION__ "(), Warning to much data! "
+ IRDA_DEBUG(0, __FUNCTION__ "(), Warning to much data! "
"Chopping frame from %d to %d bytes!\n", len,
self->max_data_size);
len = self->max_data_size;
@@ -838,7 +838,7 @@ static int irda_sendmsg(struct socket *sock, struct msghdr *msg, int len,
skb_reserve(skb, self->max_header_size);
- DEBUG(4, __FUNCTION__ "(), appending user data\n");
+ IRDA_DEBUG(4, __FUNCTION__ "(), appending user data\n");
asmptr = skb->h.raw = skb_put(skb, len);
memcpy_fromiovec(asmptr, msg->msg_iov, len);
@@ -848,7 +848,7 @@ static int irda_sendmsg(struct socket *sock, struct msghdr *msg, int len,
*/
err = irttp_data_request(self->tsap, skb);
if (err) {
- DEBUG(0, __FUNCTION__ "(), err=%d\n", err);
+ IRDA_DEBUG(0, __FUNCTION__ "(), err=%d\n", err);
return err;
}
return len;
@@ -868,7 +868,7 @@ static int irda_recvmsg_dgram(struct socket *sock, struct msghdr *msg,
struct sk_buff *skb;
int copied, err;
- DEBUG(4, __FUNCTION__ "()\n");
+ IRDA_DEBUG(4, __FUNCTION__ "()\n");
self = sk->protinfo.irda;
ASSERT(self != NULL, return -1;);
@@ -897,7 +897,7 @@ static int irda_recvmsg_dgram(struct socket *sock, struct msghdr *msg,
*/
if (self->rx_flow == FLOW_STOP) {
if ((atomic_read(&sk->rmem_alloc) << 2) <= sk->rcvbuf) {
- DEBUG(2, __FUNCTION__ "(), Starting IrTTP\n");
+ IRDA_DEBUG(2, __FUNCTION__ "(), Starting IrTTP\n");
self->rx_flow = FLOW_START;
irttp_flow_request(self->tsap, FLOW_START);
}
@@ -936,7 +936,7 @@ static int irda_recvmsg_stream(struct socket *sock, struct msghdr *msg,
int copied = 0;
int target = 1;
- DEBUG(3, __FUNCTION__ "()\n");
+ IRDA_DEBUG(3, __FUNCTION__ "()\n");
self = sk->protinfo.irda;
ASSERT(self != NULL, return -1;);
@@ -1021,7 +1021,7 @@ static int irda_recvmsg_stream(struct socket *sock, struct msghdr *msg,
/* put the skb back if we didn't use it up.. */
if (skb->len) {
- DEBUG(1, __FUNCTION__ "(), back on q!\n");
+ IRDA_DEBUG(1, __FUNCTION__ "(), back on q!\n");
skb_queue_head(&sk->receive_queue, skb);
break;
}
@@ -1031,7 +1031,7 @@ static int irda_recvmsg_stream(struct socket *sock, struct msghdr *msg,
/* if (scm->fp) */
/* break; */
} else {
- DEBUG(0, __FUNCTION__ "() questionable!?\n");
+ IRDA_DEBUG(0, __FUNCTION__ "() questionable!?\n");
/* It is questionable, see note in unix_dgram_recvmsg. */
/* if (UNIXCB(skb).fp) */
/* scm->fp = scm_fp_dup(UNIXCB(skb).fp); */
@@ -1050,7 +1050,7 @@ static int irda_recvmsg_stream(struct socket *sock, struct msghdr *msg,
*/
if (self->rx_flow == FLOW_STOP) {
if ((atomic_read(&sk->rmem_alloc) << 2) <= sk->rcvbuf) {
- DEBUG(2, __FUNCTION__ "(), Starting IrTTP\n");
+ IRDA_DEBUG(2, __FUNCTION__ "(), Starting IrTTP\n");
self->rx_flow = FLOW_START;
irttp_flow_request(self->tsap, FLOW_START);
}
@@ -1069,7 +1069,7 @@ static int irda_recvmsg_stream(struct socket *sock, struct msghdr *msg,
*/
static int irda_shutdown( struct socket *sk, int how)
{
- DEBUG( 0, __FUNCTION__ "()\n");
+ IRDA_DEBUG( 0, __FUNCTION__ "()\n");
/* FIXME - generate DM and RNR states */
return -EOPNOTSUPP;
@@ -1087,7 +1087,7 @@ static unsigned int irda_poll(struct file * file, struct socket *sock,
struct sock *sk = sock->sk;
unsigned int mask;
- DEBUG(1, __FUNCTION__ "()\n");
+ IRDA_DEBUG(1, __FUNCTION__ "()\n");
poll_wait(file, sk->sleep, wait);
mask = 0;
@@ -1126,7 +1126,7 @@ static int irda_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
{
struct sock *sk = sock->sk;
- DEBUG(4, __FUNCTION__ "(), cmd=%#x\n", cmd);
+ IRDA_DEBUG(4, __FUNCTION__ "(), cmd=%#x\n", cmd);
switch (cmd) {
case TIOCOUTQ: {
@@ -1173,7 +1173,7 @@ static int irda_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
case SIOCSIFMETRIC:
return -EINVAL;
default:
- DEBUG(1, __FUNCTION__ "(), doing device ioctl!\n");
+ IRDA_DEBUG(1, __FUNCTION__ "(), doing device ioctl!\n");
return dev_ioctl(cmd, (void *) arg);
}
@@ -1208,10 +1208,10 @@ static int irda_setsockopt(struct socket *sock, int level, int optname,
switch (optname) {
case IRLMP_IAS_SET:
- DEBUG(0, __FUNCTION__ "(), sorry not impl. yet!\n");
+ IRDA_DEBUG(0, __FUNCTION__ "(), sorry not impl. yet!\n");
return 0;
case IRTTP_MAX_SDU_SIZE:
- DEBUG(2, __FUNCTION__ "(), setting max_sdu_size = %d\n", opt);
+ IRDA_DEBUG(2, __FUNCTION__ "(), setting max_sdu_size = %d\n", opt);
self->max_sdu_size_rx = opt;
break;
default:
@@ -1265,7 +1265,7 @@ static int irda_getsockopt(struct socket *sock, int level, int optname,
offset = sizeof(struct irda_device_list) -
sizeof(struct irda_device_info);
- total = offset; /* Initialized to size of the device list */
+ total = offset; /* Initialized to size of the device list */
list.len = 0; /* Initialize lenght of list */
/*
@@ -1279,7 +1279,7 @@ static int irda_getsockopt(struct socket *sock, int level, int optname,
if (discovery->hints.word & self->mask) {
/* Check if room for this device entry */
- if (len - total >= sizeof(struct irda_device_info))
+ if (len - total < sizeof(struct irda_device_info))
break;
/* Copy discovery information */
@@ -1291,7 +1291,7 @@ static int irda_getsockopt(struct socket *sock, int level, int optname,
strncpy(info->info, discovery->nickname,
NICKNAME_MAX_LEN);
- if (copy_to_user(optval+offset, &info,
+ if (copy_to_user(optval+offset, info,
sizeof(struct irda_device_info)))
return -EFAULT;
list.len++;
@@ -1313,7 +1313,7 @@ static int irda_getsockopt(struct socket *sock, int level, int optname,
break;
case IRTTP_MAX_SDU_SIZE:
val = self->max_data_size;
- DEBUG(2, __FUNCTION__ "(), getting max_sdu_size = %d\n", val);
+ IRDA_DEBUG(2, __FUNCTION__ "(), getting max_sdu_size = %d\n", val);
len = sizeof(int);
if (put_user(len, optlen))
return -EFAULT;
@@ -1397,11 +1397,11 @@ static int irda_device_event(struct notifier_block *this, unsigned long event,
switch (event) {
case NETDEV_UP:
- DEBUG(3, __FUNCTION__ "(), NETDEV_UP\n");
+ IRDA_DEBUG(3, __FUNCTION__ "(), NETDEV_UP\n");
/* irda_dev_device_up(dev); */
break;
case NETDEV_DOWN:
- DEBUG(3, __FUNCTION__ "(), NETDEV_DOWN\n");
+ IRDA_DEBUG(3, __FUNCTION__ "(), NETDEV_DOWN\n");
/* irda_kill_by_device(dev); */
/* irda_rt_device_down(dev); */
/* irda_dev_device_down(dev); */
diff --git a/net/irda/discovery.c b/net/irda/discovery.c
index 2419a62f2..957426154 100644
--- a/net/irda/discovery.c
+++ b/net/irda/discovery.c
@@ -6,7 +6,7 @@
* Status: Experimental.
* Author: Dag Brattli <dagb@cs.uit.no>
* Created at: Tue Apr 6 15:33:50 1999
- * Modified at: Mon Aug 23 09:48:40 1999
+ * Modified at: Sat Oct 9 17:11:31 1999
* Modified by: Dag Brattli <dagb@cs.uit.no>
* Modified at: Fri May 28 3:11 CST 1999
* Modified by: Horst von Brand <vonbrand@sleipnir.valparaiso.cl>
@@ -32,7 +32,6 @@
#include <linux/string.h>
#include <linux/socket.h>
-#include <linux/irda.h>
#include <net/irda/irda.h>
#include <net/irda/irlmp.h>
@@ -78,7 +77,7 @@ void irlmp_add_discovery(hashbin_t *cachelog, discovery_t *new)
/* Insert the new and updated version */
- hashbin_insert(cachelog, (QUEUE *) new, new->daddr, NULL);
+ hashbin_insert(cachelog, (queue_t *) new, new->daddr, NULL);
spin_unlock_irqrestore(&irlmp->lock, flags);
}
@@ -93,7 +92,7 @@ void irlmp_add_discovery_log(hashbin_t *cachelog, hashbin_t *log)
{
discovery_t *discovery;
- DEBUG(4, __FUNCTION__ "()\n");
+ IRDA_DEBUG(4, __FUNCTION__ "()\n");
/*
* If log is missing this means that IrLAP was unable to perform the
@@ -126,7 +125,7 @@ void irlmp_expire_discoveries(hashbin_t *log, __u32 saddr, int force)
{
discovery_t *discovery, *curr;
- DEBUG(4, __FUNCTION__ "()\n");
+ IRDA_DEBUG(4, __FUNCTION__ "()\n");
discovery = (discovery_t *) hashbin_get_first(log);
while (discovery != NULL) {
@@ -160,10 +159,10 @@ void irlmp_dump_discoveries(hashbin_t *log)
discovery = (discovery_t *) hashbin_get_first(log);
while (discovery != NULL) {
- DEBUG(0, "Discovery:\n");
- DEBUG(0, " daddr=%08x\n", discovery->daddr);
- DEBUG(0, " saddr=%08x\n", discovery->saddr);
- DEBUG(0, " nickname=%s\n", discovery->nickname);
+ IRDA_DEBUG(0, "Discovery:\n");
+ IRDA_DEBUG(0, " daddr=%08x\n", discovery->daddr);
+ IRDA_DEBUG(0, " saddr=%08x\n", discovery->saddr);
+ IRDA_DEBUG(0, " nickname=%s\n", discovery->nickname);
discovery = (discovery_t *) hashbin_get_next(log);
}
@@ -186,9 +185,9 @@ __u32 irlmp_find_device(hashbin_t *cachelog, char *name, __u32 *saddr)
/* Look at all discoveries for that link */
d = (discovery_t *) hashbin_get_first(cachelog);
while (d != NULL) {
- DEBUG(1, "Discovery:\n");
- DEBUG(1, " daddr=%08x\n", d->daddr);
- DEBUG(1, " nickname=%s\n", d->nickname);
+ IRDA_DEBUG(1, "Discovery:\n");
+ IRDA_DEBUG(1, " daddr=%08x\n", d->daddr);
+ IRDA_DEBUG(1, " nickname=%s\n", d->nickname);
if (strcmp(name, d->nickname) == 0) {
*saddr = d->saddr;
diff --git a/net/irda/ircomm/ircomm_core.c b/net/irda/ircomm/ircomm_core.c
index a1fd0223a..e7c1f5064 100644
--- a/net/irda/ircomm/ircomm_core.c
+++ b/net/irda/ircomm/ircomm_core.c
@@ -6,7 +6,7 @@
* Status: Experimental.
* Author: Dag Brattli <dagb@cs.uit.no>
* Created at: Sun Jun 6 20:37:34 1999
- * Modified at: Tue Aug 17 11:05:41 1999
+ * Modified at: Tue Oct 5 11:37:11 1999
* Modified by: Dag Brattli <dagb@cs.uit.no>
*
* Copyright (c) 1999 Dag Brattli, All Rights Reserved.
@@ -128,7 +128,7 @@ struct ircomm_cb *ircomm_open(notify_t *notify, __u8 service_type, int line)
self->service_type = service_type;
self->line = line;
- hashbin_insert(ircomm, (QUEUE *) self, line, NULL);
+ hashbin_insert(ircomm, (queue_t *) self, line, NULL);
ircomm_next_state(self, IRCOMM_IDLE);
diff --git a/net/irda/ircomm/ircomm_param.c b/net/irda/ircomm/ircomm_param.c
index 4294dbdb2..b6012d511 100644
--- a/net/irda/ircomm/ircomm_param.c
+++ b/net/irda/ircomm/ircomm_param.c
@@ -6,7 +6,7 @@
* Status: Experimental.
* Author: Dag Brattli <dagb@cs.uit.no>
* Created at: Mon Jun 7 10:25:11 1999
- * Modified at: Fri Sep 3 09:28:20 1999
+ * Modified at: Mon Oct 4 09:36:53 1999
* Modified by: Dag Brattli <dagb@cs.uit.no>
*
* Copyright (c) 1999 Dag Brattli, All Rights Reserved.
@@ -236,7 +236,7 @@ static int ircomm_param_port_type(void *instance, param_t *param, int get)
/*
* Function ircomm_param_port_name (self, param)
*
- *
+ * Exchange port name
*
*/
static int ircomm_param_port_name(void *instance, param_t *param, int get)
@@ -259,7 +259,7 @@ static int ircomm_param_port_name(void *instance, param_t *param, int get)
/*
* Function ircomm_param_data_rate (self, param)
*
- *
+ * Exchange data rate to be used in this session
*
*/
static int ircomm_param_data_rate(void *instance, param_t *param, int get)
@@ -282,7 +282,7 @@ static int ircomm_param_data_rate(void *instance, param_t *param, int get)
/*
* Function ircomm_param_data_format (self, param)
*
- *
+ * Exchange data format to be used in this session
*
*/
static int ircomm_param_data_format(void *instance, param_t *param, int get)
@@ -303,7 +303,7 @@ static int ircomm_param_data_format(void *instance, param_t *param, int get)
/*
* Function ircomm_param_flow_control (self, param)
*
- *
+ * Exchange flow control settings to be used in this session
*
*/
static int ircomm_param_flow_control(void *instance, param_t *param, int get)
@@ -326,12 +326,26 @@ static int ircomm_param_flow_control(void *instance, param_t *param, int get)
/*
* Function ircomm_param_xon_xoff (self, param)
*
- *
+ * Exchange XON/XOFF characters
*
*/
static int ircomm_param_xon_xoff(void *instance, param_t *param, int get)
{
- DEBUG(2, __FUNCTION__ "(), not impl.\n");
+ struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) instance;
+
+ ASSERT(self != NULL, return -1;);
+ ASSERT(self->magic == IRCOMM_TTY_MAGIC, return -1;);
+
+ if (get) {
+ param->pv.s = self->session.xonxoff[0];
+ param->pv.s |= self->session.xonxoff[1] << 8;
+ } else {
+ self->session.xonxoff[0] = param->pv.s & 0xff;
+ self->session.xonxoff[1] = param->pv.s >> 8;
+ }
+
+ DEBUG(0, __FUNCTION__ "(), XON/XOFF = 0x%02x\n,0x%02x",
+ param->pv.s & 0xff, param->pv.s >> 8);
return 0;
}
@@ -339,12 +353,26 @@ static int ircomm_param_xon_xoff(void *instance, param_t *param, int get)
/*
* Function ircomm_param_enq_ack (self, param)
*
- *
+ * Exchange ENQ/ACK characters
*
*/
static int ircomm_param_enq_ack(void *instance, param_t *param, int get)
{
- DEBUG(2, __FUNCTION__ "(), not impl.\n");
+ struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) instance;
+
+ ASSERT(self != NULL, return -1;);
+ ASSERT(self->magic == IRCOMM_TTY_MAGIC, return -1;);
+
+ if (get) {
+ param->pv.s = self->session.enqack[0];
+ param->pv.s |= self->session.enqack[1] << 8;
+ } else {
+ self->session.enqack[0] = param->pv.s & 0xff;
+ self->session.enqack[1] = param->pv.s >> 8;
+ }
+
+ DEBUG(0, __FUNCTION__ "(), ENQ/ACK = 0x%02x,0x%02x\n",
+ param->pv.s & 0xff, param->pv.s >> 8);
return 0;
}
diff --git a/net/irda/ircomm/ircomm_tty.c b/net/irda/ircomm/ircomm_tty.c
index 8df8d876e..14da65d89 100644
--- a/net/irda/ircomm/ircomm_tty.c
+++ b/net/irda/ircomm/ircomm_tty.c
@@ -6,7 +6,7 @@
* Status: Experimental.
* Author: Dag Brattli <dagb@cs.uit.no>
* Created at: Sun Jun 6 21:00:56 1999
- * Modified at: Tue Sep 21 11:46:59 1999
+ * Modified at: Tue Oct 19 21:32:04 1999
* Modified by: Dag Brattli <dagb@cs.uit.no>
* Sources: serial.c and previous IrCOMM work by Takahide Higuchi
*
@@ -408,7 +408,7 @@ static int ircomm_tty_open(struct tty_struct *tty, struct file *filp)
tty->termios->c_oflag = 0;
/* Insert into hash */
- hashbin_insert(ircomm_tty, (QUEUE *) self, line, NULL);
+ hashbin_insert(ircomm_tty, (queue_t *) self, line, NULL);
}
self->open_count++;
@@ -796,7 +796,7 @@ static void ircomm_tty_wait_until_sent(struct tty_struct *tty, int timeout)
orig_jiffies = jiffies;
/* Set poll time to 200 ms */
- poll_time = MIN(timeout, MSECS_TO_JIFFIES(200));
+ poll_time = IRDA_MIN(timeout, MSECS_TO_JIFFIES(200));
while (self->tx_skb && self->tx_skb->len) {
current->state = TASK_INTERRUPTIBLE;
@@ -939,8 +939,6 @@ static void ircomm_tty_hangup(struct tty_struct *tty)
*/
static void ircomm_tty_send_xchar(struct tty_struct *tty, char ch)
{
- struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) tty->driver_data;
-
DEBUG(0, __FUNCTION__"(), not impl\n");
}
@@ -1082,7 +1080,7 @@ static int ircomm_tty_control_indication(void *instance, void *sap,
clen = skb->data[0];
- irda_param_extract_all(self, skb->data+1, MIN(skb->len-1, clen),
+ irda_param_extract_all(self, skb->data+1, IRDA_MIN(skb->len-1, clen),
&ircomm_param_info);
dev_kfree_skb(skb);
diff --git a/net/irda/ircomm/ircomm_tty_attach.c b/net/irda/ircomm/ircomm_tty_attach.c
index f2466d68c..52a6ec5e9 100644
--- a/net/irda/ircomm/ircomm_tty_attach.c
+++ b/net/irda/ircomm/ircomm_tty_attach.c
@@ -6,7 +6,7 @@
* Status: Experimental.
* Author: Dag Brattli <dagb@cs.uit.no>
* Created at: Sat Jun 5 17:42:00 1999
- * Modified at: Wed Sep 8 11:54:27 1999
+ * Modified at: Tue Oct 19 21:32:17 1999
* Modified by: Dag Brattli <dagb@cs.uit.no>
*
* Copyright (c) 1999 Dag Brattli, All Rights Reserved.
@@ -208,7 +208,6 @@ static void ircomm_tty_ias_register(struct ircomm_tty_cb *self)
irias_insert_object(self->obj);
} else {
hints = irlmp_service_to_hint(S_COMM);
- hints |= irlmp_service_to_hint(S_TELEPHONY);
/* Register IrCOMM with LM-IAS */
self->obj = irias_new_object("IrDA:IrCOMM", IAS_IRCOMM_ID);
@@ -243,13 +242,24 @@ static int ircomm_tty_send_initial_parameters(struct ircomm_tty_cb *self)
if (self->service_type & IRCOMM_3_WIRE_RAW)
return 0;
- /* Set default values */
- self->session.data_rate = 9600;
- self->session.data_format = IRCOMM_WSIZE_8; /* 8N1 */
- self->session.flow_control = 0; /* None */
+ /*
+ * Set default values, but only if the application for some reason
+ * haven't set them already
+ */
+ DEBUG(2, __FUNCTION__ "(), data-rate = %d\n", self->session.data_rate);
+ if (!self->session.data_rate)
+ self->session.data_rate = 9600;
+ DEBUG(2, __FUNCTION__ "(), data-format = %d\n",
+ self->session.data_format);
+ if (!self->session.data_format)
+ self->session.data_format = IRCOMM_WSIZE_8; /* 8N1 */
+
+ DEBUG(2, __FUNCTION__ "(), flow-control = %d\n",
+ self->session.flow_control);
+ /*self->session.flow_control = IRCOMM_RTS_CTS_IN|IRCOMM_RTS_CTS_OUT;*/
/* Do not set delta values for the initial parameters */
- self->session.dte = (IRCOMM_DTR| IRCOMM_RTS);
+ self->session.dte = IRCOMM_DTR | IRCOMM_RTS;
ircomm_param_request(self, IRCOMM_SERVICE_TYPE, FALSE);
ircomm_param_request(self, IRCOMM_DATA_RATE, FALSE);
@@ -430,7 +440,8 @@ void ircomm_tty_connect_indication(void *instance, void *sap,
clen = skb->data[0];
if (clen)
- irda_param_extract_all(self, skb->data+1, MIN(skb->len, clen),
+ irda_param_extract_all(self, skb->data+1,
+ IRDA_MIN(skb->len, clen),
&ircomm_param_info);
ircomm_tty_do_event(self, IRCOMM_TTY_CONNECT_INDICATION, NULL, NULL);
diff --git a/net/irda/irda_device.c b/net/irda/irda_device.c
index 6937d62f3..b4c6e6905 100644
--- a/net/irda/irda_device.c
+++ b/net/irda/irda_device.c
@@ -1,26 +1,30 @@
/*********************************************************************
*
* Filename: irda_device.c
- * Version: 0.6
- * Description: Abstract device driver layer and helper functions
+ * Version: 0.9
+ * Description: Utility functions used by the device drivers
* Status: Experimental.
* Author: Dag Brattli <dagb@cs.uit.no>
- * Created at: Wed Sep 2 20:22:08 1998
- * Modified at: Tue Sep 28 08:40:31 1999
+ * Created at: Sat Oct 9 09:22:27 1999
+ * Modified at: Mon Oct 18 22:40:10 1999
* Modified by: Dag Brattli <dagb@cs.uit.no>
- * Modified at: Fri May 28 3:11 CST 1999
- * Modified by: Horst von Brand <vonbrand@sleipnir.valparaiso.cl>
*
- * Copyright (c) 1998-1999 Dag Brattli, All Rights Reserved.
- *
+ * Copyright (c) 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
* 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
- * provided "AS-IS" and at no charge.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
*
********************************************************************/
@@ -46,7 +50,7 @@
#include <net/pkt_sched.h>
#include <net/irda/irda_device.h>
-#include <net/irda/irlap_frame.h>
+#include <net/irda/irlap.h>
#include <net/irda/timer.h>
#include <net/irda/wrapper.h>
@@ -58,33 +62,38 @@ extern int tekram_init(void);
extern int actisys_init(void);
extern int girbil_init(void);
-static hashbin_t *irda_device = NULL;
static hashbin_t *dongles = NULL;
+static hashbin_t *tasks = NULL;
+
+const char *infrared_mode[] = {
+ "IRDA_IRLAP",
+ "IRDA_RAW",
+ "SHARP_ASK",
+ "TV_REMOTE",
+};
+
+static const char *task_state[] = {
+ "IRDA_TASK_INIT",
+ "IRDA_TASK_DONE",
+ "IRDA_TASK_WAIT",
+ "IRDA_TASK_WAIT1",
+ "IRDA_TASK_WAIT2",
+ "IRDA_TASK_WAIT3",
+ "IRDA_TASK_CHILD_INIT",
+ "IRDA_TASK_CHILD_WAIT",
+ "IRDA_TASK_CHILD_DONE",
+};
+
+static void irda_task_timer_expired(void *data);
-/* Netdevice functions */
-static int irda_device_net_rebuild_header(struct sk_buff *skb);
-static int irda_device_net_hard_header(struct sk_buff *skb,
- struct net_device *dev,
- unsigned short type, void *daddr,
- void *saddr, unsigned len);
-static int irda_device_net_set_config(struct net_device *dev, struct ifmap *map);
-static int irda_device_net_change_mtu(struct net_device *dev, int new_mtu);
-static int irda_device_net_ioctl(struct net_device *dev, struct ifreq *rq,int cmd);
#ifdef CONFIG_PROC_FS
-int irda_device_proc_read( char *buf, char **start, off_t offset, int len,
- int unused);
+int irda_device_proc_read(char *buf, char **start, off_t offset, int len,
+ int unused);
#endif /* CONFIG_PROC_FS */
int __init irda_device_init( void)
{
- /* Allocate master array */
- irda_device = hashbin_new( HB_LOCAL);
- if (irda_device == NULL) {
- WARNING("IrDA: Can't allocate irda_device hashbin!\n");
- return -ENOMEM;
- }
-
dongles = hashbin_new(HB_LOCAL);
if (dongles == NULL) {
printk(KERN_WARNING
@@ -92,6 +101,13 @@ int __init irda_device_init( void)
return -ENOMEM;
}
+ tasks = hashbin_new(HB_LOCAL);
+ if (tasks == NULL) {
+ printk(KERN_WARNING
+ "IrDA: Can't allocate tasks hashbin!\n");
+ return -ENOMEM;
+ }
+
/*
* Call the init function of the device drivers that has not been
* compiled as a module
@@ -134,287 +150,215 @@ int __init irda_device_init( void)
void irda_device_cleanup(void)
{
- DEBUG(4, __FUNCTION__ "()\n");
-
- ASSERT(irda_device != NULL, return;);
+ IRDA_DEBUG(4, __FUNCTION__ "()\n");
+ hashbin_delete(tasks, NULL);
hashbin_delete(dongles, NULL);
- hashbin_delete(irda_device, (FREE_FUNC) irda_device_close);
}
/*
- * Function irda_device_open (self)
- *
- * Open a new IrDA port device
+ * Function irda_device_set_media_busy (self, status)
*
+ * Called when we have detected that another station is transmiting
+ * in contention mode.
*/
-int irda_device_open(struct irda_device *self, char *name, void *priv)
-{
- int result;
- int i=0;
-
- /* Allocate memory if needed */
- if (self->rx_buff.truesize > 0) {
- self->rx_buff.head = (__u8 *) kmalloc(self->rx_buff.truesize,
- self->rx_buff.flags);
- if (self->rx_buff.head == NULL)
- return -ENOMEM;
-
- memset(self->rx_buff.head, 0, self->rx_buff.truesize);
- }
- if (self->tx_buff.truesize > 0) {
- self->tx_buff.head = (__u8 *) kmalloc(self->tx_buff.truesize,
- self->tx_buff.flags);
- if (self->tx_buff.head == NULL) {
- kfree(self->rx_buff.head);
- return -ENOMEM;
- }
-
- memset(self->tx_buff.head, 0, self->tx_buff.truesize);
- }
-
- self->magic = IRDA_DEVICE_MAGIC;
-
- self->rx_buff.in_frame = FALSE;
- self->rx_buff.state = OUTSIDE_FRAME;
- self->tx_buff.data = self->tx_buff.head;
- self->rx_buff.data = self->rx_buff.head;
+void irda_device_set_media_busy(struct net_device *dev, int status)
+{
+ struct irlap_cb *self;
- /* Initialize timers */
- init_timer(&self->media_busy_timer);
+ IRDA_DEBUG(4, __FUNCTION__ "(%s)\n", status ? "TRUE" : "FALSE");
- self->lock = SPIN_LOCK_UNLOCKED;
+ self = (struct irlap_cb *) dev->atalk_ptr;
- /* A pointer to the low level implementation */
- self->priv = priv;
+ ASSERT(self != NULL, return;);
+ ASSERT(self->magic == LAP_MAGIC, return;);
- /* Initialize IrDA net device */
- do {
- sprintf(self->name, "%s%d", "irda", i++);
- } while (dev_get(self->name));
-
- self->netdev.name = self->name;
- self->netdev.priv = (void *) self;
- self->netdev.next = NULL;
-
- result = register_netdev(&self->netdev);
- if (result) {
- ERROR(__FUNCTION__ "(), register_netdev() failed!\n");
- return -1;
+ if (status) {
+ self->media_busy = TRUE;
+ irlap_start_mbusy_timer(self);
+ IRDA_DEBUG( 4, "Media busy!\n");
+ } else {
+ self->media_busy = FALSE;
+ del_timer(&self->media_busy_timer);
}
-
- /*
- * Make the description for the device. self->netdev.name will get
- * a name like "irda0" and the self->descriptin will get a name
- * like "irda0 <-> irtty0"
- */
- strncpy(self->description, self->name, 5);
- strcat(self->description, " <-> ");
- strncat(self->description, name, 23);
-
- hashbin_insert(irda_device, (QUEUE *) self, (int) self, NULL);
-
- MESSAGE("IrDA: Registered device %s\n", self->name);
-
- irda_device_set_media_busy(&self->netdev, FALSE);
-
- return 0;
}
-/*
- * Function irda_device_close (self)
- *
- * Close this instance of the irda_device, just deallocate buffers
- *
- */
-void __irda_device_close(struct irda_device *self)
-{
- DEBUG(4, __FUNCTION__ "()\n");
+int irda_device_set_dtr_rts(struct net_device *dev, int dtr, int rts)
+{
+ struct if_irda_req req;
+ int ret;
- ASSERT(self != NULL, return;);
- ASSERT(self->magic == IRDA_DEVICE_MAGIC, return;);
+ IRDA_DEBUG(0, __FUNCTION__ "()\n");
- /* We do this test to know if the device has been registered at all */
- if (self->netdev.type == ARPHRD_IRDA) {
- /* Remove netdevice */
- unregister_netdev(&self->netdev);
+ if (!dev->do_ioctl) {
+ ERROR(__FUNCTION__ "(), do_ioctl not impl. by "
+ "device driver\n");
+ return -1;
}
- /* Stop timers */
- del_timer(&self->media_busy_timer);
-
- if (self->tx_buff.head)
- kfree(self->tx_buff.head);
+ req.ifr_dtr = dtr;
+ req.ifr_rts = rts;
- if (self->rx_buff.head)
- kfree(self->rx_buff.head);
+ ret = dev->do_ioctl(dev, (struct ifreq *) &req, SIOCSDTRRTS);
- self->magic = 0;
+ return ret;
}
/*
- * Function irda_device_close (self)
+ * Function irda_device_is_receiving (dev)
*
- * Close the device
+ * Check if the device driver is currently receiving data
*
*/
-void irda_device_close(struct irda_device *self)
+int irda_device_is_receiving(struct net_device *dev)
{
- DEBUG(4, __FUNCTION__ "()\n");
+ struct if_irda_req req;
+ int ret;
- ASSERT(self != NULL, return;);
- ASSERT(self->magic == IRDA_DEVICE_MAGIC, return;);
+ IRDA_DEBUG(2, __FUNCTION__ "()\n");
- /* We are not using any dongle anymore! */
- if (self->dongle)
- self->dongle->close(self);
+ if (!dev->do_ioctl) {
+ ERROR(__FUNCTION__ "(), do_ioctl not impl. by "
+ "device driver\n");
+ return -1;
+ }
- hashbin_remove(irda_device, (int) self, NULL);
+ ret = dev->do_ioctl(dev, (struct ifreq *) &req, SIOCGRECEIVING);
+ if (ret < 0)
+ return ret;
- __irda_device_close(self);
+ return req.ifr_receiving;
}
-/*
- * Function irda_device_set_media_busy (self, status)
- *
- * Called when we have detected that another station is transmiting
- * in contention mode.
- */
-void irda_device_set_media_busy(struct net_device *dev, int status)
+void irda_task_next_state(struct irda_task *task, TASK_STATE state)
{
- struct irda_device *self;
-
- DEBUG(4, __FUNCTION__ "(%s)\n", status ? "TRUE" : "FALSE");
+ IRDA_DEBUG(2, __FUNCTION__ "(), state = %s\n", task_state[state]);
- self = dev->priv;
-
- ASSERT(self != NULL, return;);
- ASSERT(self->magic == IRDA_DEVICE_MAGIC, return;);
-
- if (status) {
- self->media_busy = TRUE;
- irda_device_start_mbusy_timer(self);
- DEBUG( 4, "Media busy!\n");
- } else {
- self->media_busy = FALSE;
- del_timer(&self->media_busy_timer);
- }
+ task->state = state;
}
/*
- * Function __irda_device_change_speed (self, speed)
+ * Function irda_task_kick (task)
*
- * When this function is called, we will have a process context so its
- * possible for us to sleep, wait or whatever :-)
+ * Tries to execute a task possible multiple times until the task is either
+ * finished, or askes for a timeout. When a task is finished, we do post
+ * processing, and notify the parent task, that is waiting for this task
+ * to complete.
*/
-static void __irda_device_change_speed(struct irda_device *self, int speed)
+int irda_task_kick(struct irda_task *task)
{
- int n = 0;
+ int timeout;
+ int ret = 0;
+ int count = 0;
- ASSERT(self != NULL, return;);
- ASSERT(self->magic == IRDA_DEVICE_MAGIC, return;);
-
- /*
- * Is is possible to change speed yet? Wait until the last byte
- * has been transmitted.
- */
- if (!self->wait_until_sent) {
- ERROR("IrDA: wait_until_sent() "
- "has not implemented by the IrDA device driver!\n");
- return;
- }
-
- /* Make sure all transmitted data has actually been sent */
- self->wait_until_sent(self);
+ IRDA_DEBUG(2, __FUNCTION__ "()\n");
- /* Make sure nobody tries to transmit during the speed change */
- while (irda_lock((void *) &self->netdev.tbusy) == FALSE) {
- WARNING(__FUNCTION__ "(), device locked!\n");
- current->state = TASK_INTERRUPTIBLE;
- schedule_timeout(MSECS_TO_JIFFIES(10));
+ ASSERT(task != NULL, return -1;);
+ ASSERT(task->magic == IRDA_TASK_MAGIC, return -1;);
- if (n++ > 10) {
- WARNING(__FUNCTION__ "(), breaking loop!\n");
- return;
- }
+ /* Execute task until it's finished, or askes for a timeout */
+ do {
+ timeout = task->function(task);
+ if (count++ > 100) {
+ ERROR(__FUNCTION__ "(), error in task handler!\n");
+ return -1;
+ }
+ } while ((timeout == 0) && (task->state != IRDA_TASK_DONE));
+
+ if (timeout < 0) {
+ ERROR(__FUNCTION__ "(), Error executing task!\n");
+ return -1;
}
-
- /* Change speed of dongle */
- if (self->dongle)
- self->dongle->change_speed(self, speed);
-
- /* Change speed of IrDA port */
- if (self->change_speed) {
- self->change_speed(self, speed);
-
- /* Update the QoS value only */
- self->qos.baud_rate.value = speed;
+
+ /* Check if we are finished */
+ if (task->state == IRDA_TASK_DONE) {
+ del_timer(&task->timer);
+
+ /* Do post processing */
+ if (task->finished)
+ task->finished(task);
+
+ /* Notify parent */
+ if (task->parent) {
+ /* Check if parent is waiting for us to complete */
+ if (task->parent->state == IRDA_TASK_CHILD_WAIT) {
+ task->parent->state = IRDA_TASK_CHILD_DONE;
+
+ /* Stop timer now that we are here */
+ del_timer(&task->parent->timer);
+
+ /* Kick parent task */
+ irda_task_kick(task->parent);
+ }
+ }
+ /* Unregister task */
+ hashbin_remove(tasks, (int) task, NULL);
+
+ kfree(task);
+ } else if (timeout > 0) {
+ irda_start_timer(&task->timer, timeout, (void *) task,
+ irda_task_timer_expired);
+ ret = 1;
+ } else {
+ IRDA_DEBUG(0, __FUNCTION__ "(), not finished, and no timeout!\n");
+ ret = 1;
}
- self->netdev.tbusy = FALSE;
+
+ return ret;
}
/*
- * Function irda_device_change_speed (self, speed)
- *
- * Change the speed of the currently used irda_device
+ * Function irda_task_execute (instance, function, finished)
*
+ * This function registers and tries to execute tasks that may take some
+ * time to complete. We do it this hairy way since we may have been
+ * called from interrupt context, so it's not possible to use
+ * schedule_timeout()
*/
-void irda_device_change_speed(struct irda_device *self, int speed)
+int irda_task_execute(void *instance, TASK_CALLBACK function,
+ TASK_CALLBACK finished, struct irda_task *parent,
+ void *param)
{
- ASSERT(self != NULL, return;);
- ASSERT(self->magic == IRDA_DEVICE_MAGIC, return;);
+ struct irda_task *task;
- irda_execute_as_process(self,
- (TODO_CALLBACK) __irda_device_change_speed,
- speed);
-}
+ IRDA_DEBUG(2, __FUNCTION__ "()\n");
-int irda_device_is_media_busy(struct net_device *dev)
-{
- struct irda_device *self;
-
- self = dev->priv;
+ task = kmalloc(sizeof(struct irda_task), GFP_ATOMIC);
+ if (!task)
+ return -ENOMEM;
- ASSERT(self != NULL, return FALSE;);
- ASSERT(self->magic == IRDA_DEVICE_MAGIC, return FALSE;);
-
- return self->media_busy;
-}
+ task->state = IRDA_TASK_INIT;
+ task->instance = instance;
+ task->function = function;
+ task->finished = finished;
+ task->parent = parent;
+ task->param = param;
+ task->magic = IRDA_TASK_MAGIC;
-int irda_device_is_receiving(struct net_device *dev)
-{
- struct irda_device *self;
-
- self = dev->priv;
-
- ASSERT(self != NULL, return FALSE;);
- ASSERT(self->magic == IRDA_DEVICE_MAGIC, return FALSE;);
+ init_timer(&task->timer);
- if (self->is_receiving)
- return self->is_receiving(self);
- else
- return FALSE;
+ /* Register task */
+ hashbin_insert(tasks, (queue_t *) task, (int) task, NULL);
+
+ /* No time to waste, so lets get going! */
+ return irda_task_kick(task);
}
-struct qos_info *irda_device_get_qos(struct net_device *dev)
+/*
+ * Function irda_task_timer_expired (data)
+ *
+ * Task time has expired. We now try to execute task (again), and restart
+ * the timer if the task has not finished yet
+ */
+static void irda_task_timer_expired(void *data)
{
- struct irda_device *self;
-
- ASSERT(dev != NULL, return NULL;);
-
- self = dev->priv;
-
- ASSERT(self != NULL, return NULL;);
- ASSERT(self->magic == IRDA_DEVICE_MAGIC, return NULL;);
+ struct irda_task *task;
- return &self->qos;
-}
+ IRDA_DEBUG(2, __FUNCTION__ "()\n");
-static struct enet_statistics *irda_device_get_stats(struct net_device *dev)
-{
- struct irda_device *priv = (struct irda_device *) dev->priv;
+ task = (struct irda_task *) data;
- return &priv->stats;
+ irda_task_kick(task);
}
/*
@@ -425,24 +369,14 @@ static struct enet_statistics *irda_device_get_stats(struct net_device *dev)
*/
int irda_device_setup(struct net_device *dev)
{
- struct irda_device *self;
-
ASSERT(dev != NULL, return -1;);
- self = (struct irda_device *) dev->priv;
-
- ASSERT(self != NULL, return -1;);
- ASSERT(self->magic == IRDA_DEVICE_MAGIC, return -1;);
-
- dev->get_stats = irda_device_get_stats;
- dev->rebuild_header = irda_device_net_rebuild_header;
- dev->set_config = irda_device_net_set_config;
- dev->change_mtu = irda_device_net_change_mtu;
-/* dev->hard_header = irda_device_net_hard_header; */
- dev->do_ioctl = irda_device_net_ioctl;
dev->hard_header_len = 0;
dev->addr_len = 0;
+ dev->new_style = 1;
+ /* dev->destructor = irda_device_destructor; */
+
dev->type = ARPHRD_IRDA;
dev->tx_queue_len = 8; /* Window size + 1 s-frame */
@@ -458,314 +392,72 @@ int irda_device_setup(struct net_device *dev)
return 0;
}
-int irda_device_net_open(struct net_device *dev)
-{
- struct irda_device *self;
-
- ASSERT(dev != NULL, return -1;);
-
- self = dev->priv;
-
- ASSERT(self != NULL, return 0;);
- ASSERT(self->magic == IRDA_DEVICE_MAGIC, return -1;);
-
- /* Ready to play! */
- dev->tbusy = 0;
- dev->interrupt = 0;
- dev->start = 1;
-
- /*
- * Open new IrLAP layer instance, now that everything should be
- * initialized properly
- */
- self->irlap = irlap_open(dev);
-
- /* It's now safe to initilize the saddr */
- memcpy(self->netdev.dev_addr, &self->irlap->saddr, 4);
-
- return 0;
-}
-
-int irda_device_net_close(struct net_device *dev)
-{
- struct irda_device *self;
-
- ASSERT(dev != NULL, return -1;);
-
- self = dev->priv;
-
- ASSERT(self != NULL, return 0;);
- ASSERT(self->magic == IRDA_DEVICE_MAGIC, return -1;);
-
- /* Stop device */
- dev->tbusy = 1;
- dev->start = 0;
-
- /* Stop and remove instance of IrLAP */
- if (self->irlap)
- irlap_close(self->irlap);
- self->irlap = NULL;
-
- return 0;
-}
-
-/*
- * Function irda_device_net_rebuild_header (buff, dev, dst, skb)
- *
- *
- *
- */
-static int irda_device_net_rebuild_header( struct sk_buff *skb)
-{
- DEBUG( 4, __FUNCTION__ "()\n");
-
- return 0;
-}
-
-static int irda_device_net_hard_header(struct sk_buff *skb,
- struct net_device *dev,
- unsigned short type, void *daddr,
- void *saddr, unsigned len)
-{
- DEBUG( 0, __FUNCTION__ "()\n");
-
- skb->mac.raw = skb->data;
- /* skb_push(skb,PPP_HARD_HDR_LEN); */
- /* return PPP_HARD_HDR_LEN; */
-
- return 0;
-}
-
-static int irda_device_net_set_config(struct net_device *dev,
- struct ifmap *map)
-{
- DEBUG( 0, __FUNCTION__ "()\n");
-
- return 0;
-}
-
-static int irda_device_net_change_mtu(struct net_device *dev, int new_mtu)
-{
- DEBUG( 0, __FUNCTION__ "()\n");
-
- return 0;
-}
-
-static int irda_device_net_ioctl(struct net_device *dev, /* ioctl device */
- struct ifreq *rq, /* Data passed */
- int cmd) /* Ioctl number */
-{
- unsigned long flags;
- int ret = 0;
-#ifdef WIRELESS_EXT
- struct iwreq *wrq = (struct iwreq *) rq;
-#endif
- struct irda_device *self;
-
- ASSERT(dev != NULL, return -1;);
-
- self = dev->priv;
-
- ASSERT(self != NULL, return -1;);
- ASSERT(self->magic == IRDA_DEVICE_MAGIC, return -1;);
-
- DEBUG(0, __FUNCTION__ "(), %s, (cmd=0x%X)\n", dev->name, cmd);
-
- /* Disable interrupts & save flags */
- save_flags(flags);
- cli();
-
- /* Look what is the request */
- switch (cmd) {
-#ifdef WIRELESS_EXT
- case SIOCGIWNAME:
- /* Get name */
- strcpy(wrq->u.name, self->name);
- break;
- case SIOCSIWNWID:
- /* Set domain */
- if (wrq->u.nwid.on) {
-
- } break;
- case SIOCGIWNWID:
- /* Read domain*/
-/* wrq->u.nwid.nwid = domain; */
-/* wrq->u.nwid.on = 1; */
- break;
- case SIOCGIWENCODE:
- /* Get scramble key */
- /* wrq->u.encoding.code = scramble_key; */
-/* wrq->u.encoding.method = 1; */
- break;
- case SIOCSIWENCODE:
- /* Set scramble key */
- /* scramble_key = wrq->u.encoding.code; */
- break;
- case SIOCGIWRANGE:
- /* Basic checking... */
- if(wrq->u.data.pointer != (caddr_t) 0) {
- struct iw_range range;
-
- /* Verify the user buffer */
- ret = verify_area(VERIFY_WRITE, wrq->u.data.pointer,
- sizeof(struct iw_range));
- if(ret)
- break;
-
- /* Set the length (useless : its constant...) */
- wrq->u.data.length = sizeof(struct iw_range);
-
- /* Set information in the range struct */
- range.throughput = 1.6 * 1024 * 1024; /* don't argue on this ! */
- range.min_nwid = 0x0000;
- range.max_nwid = 0x01FF;
-
- range.num_channels = range.num_frequency = 0;
-
- range.sensitivity = 0x3F;
- range.max_qual.qual = 255;
- range.max_qual.level = 255;
- range.max_qual.noise = 0;
-
- /* Copy structure to the user buffer */
- copy_to_user(wrq->u.data.pointer, &range,
- sizeof(struct iw_range));
- }
- break;
- case SIOCGIWPRIV:
- /* Basic checking... */
-#if 0
- if (wrq->u.data.pointer != (caddr_t) 0) {
- struct iw_priv_args priv[] =
- { /* cmd, set_args, get_args, name */
- { SIOCGIPSNAP, IW_PRIV_TYPE_BYTE | IW_PRIV_SIZE_FIXED | 0,
- sizeof(struct site_survey),
- "getsitesurvey" },
- };
-
- /* Verify the user buffer */
- ret = verify_area(VERIFY_WRITE, wrq->u.data.pointer,
- sizeof(priv));
- if (ret)
- break;
-
- /* Set the number of ioctl available */
- wrq->u.data.length = 1;
-
- /* Copy structure to the user buffer */
- copy_to_user(wrq->u.data.pointer, (u_char *) priv,
- sizeof(priv));
- }
-#endif
- break;
-#endif
- case SIOCSBANDWIDTH: /* Set bandwidth */
- irda_device_change_speed(self, rq->ifr_bandwidth);
- break;
- case SIOCSDONGLE: /* Set dongle */
- /* Initialize dongle */
- irda_device_init_dongle(self, (int) rq->ifr_data);
- break;
- case SIOCSMEDIABUSY: /* Set media busy */
- irda_device_set_media_busy(&self->netdev, TRUE);
- break;
- default:
- ret = -EOPNOTSUPP;
- }
-
- restore_flags(flags);
-
- return ret;
-}
-
/*
- * Function irda_device_txqueue_empty (irda_device)
+ * Function irda_device_txqueue_empty (dev)
*
* Check if there is still some frames in the transmit queue for this
* device. Maybe we should use: q->q.qlen == 0.
*
*/
-int irda_device_txqueue_empty(struct irda_device *self)
+int irda_device_txqueue_empty(struct net_device *dev)
{
- ASSERT(self != NULL, return -1;);
- ASSERT(self->magic == IRDA_DEVICE_MAGIC, return -1;);
-
- if (skb_queue_len(&self->netdev.qdisc->q))
+ if (skb_queue_len(&dev->qdisc->q))
return FALSE;
return TRUE;
}
/*
- * Function irda_device_init_dongle (self, type)
+ * Function irda_device_init_dongle (self, type, qos)
*
- * Initialize attached dongle. Warning, must be called with a process
- * context!
+ * Initialize attached dongle.
*/
-void irda_device_init_dongle(struct irda_device *self, int type)
+dongle_t *irda_device_dongle_init(struct net_device *dev, int type)
{
- struct dongle_q *node;
+ struct dongle_reg *reg;
+ char modname[32];
+ dongle_t *dongle;
- ASSERT(self != NULL, return;);
- ASSERT(self->magic == IRDA_DEVICE_MAGIC, return;);
+ ASSERT(dev != NULL, return NULL;);
#ifdef CONFIG_KMOD
/* Try to load the module needed */
- switch (type) {
- case ESI_DONGLE:
- MESSAGE("IrDA: Initializing ESI dongle!\n");
- request_module("esi");
- break;
- case TEKRAM_DONGLE:
- MESSAGE("IrDA: Initializing Tekram dongle!\n");
- request_module("tekram");
- break;
- case ACTISYS_DONGLE: /* FALLTHROUGH */
- case ACTISYS_PLUS_DONGLE:
- MESSAGE("IrDA: Initializing ACTiSYS dongle!\n");
- request_module("actisys");
- break;
- case GIRBIL_DONGLE:
- MESSAGE("IrDA: Initializing GIrBIL dongle!\n");
- request_module("girbil");
- break;
- case LITELINK_DONGLE:
- MESSAGE("IrDA: Initializing Litelink dongle!\n");
- request_module("litelink");
- break;
- case AIRPORT_DONGLE:
- MESSAGE("IrDA: Initializing Airport dongle!\n");
- request_module("airport");
- break;
- default:
- ERROR("Unknown dongle type!\n");
- return;
- }
+ sprintf(modname, "irda-dongle-%d", type);
+ request_module(modname);
#endif /* CONFIG_KMOD */
- node = hashbin_find(dongles, type, NULL);
- if (!node) {
+ if (!(reg = hashbin_find(dongles, type, NULL))) {
ERROR("IrDA: Unable to find requested dongle\n");
- return;
- }
-
- /* Check if we're already using a dongle */
- if (self->dongle) {
- self->dongle->close(self);
+ return NULL;
}
- /* Set the dongle to be used by this driver */
- self->dongle = node->dongle;
+ /* Allocate dongle info for this instance */
+ dongle = kmalloc(sizeof(dongle_t), GFP_KERNEL);
+ if (!dongle)
+ return NULL;
- /* Now initialize the dongle! */
- node->dongle->open(self, type);
- node->dongle->qos_init(self, &self->qos);
-
- /* Reset dongle */
- node->dongle->reset(self);
+ /* Bind the registration info to this particular instance */
+ dongle->issue = reg;
+ dongle->dev = dev;
- /* Set to default baudrate */
- irda_device_change_speed(self, 9600);
+ return dongle;
+}
+
+/*
+ * Function irda_device_dongle_cleanup (dongle)
+ *
+ *
+ *
+ */
+int irda_device_dongle_cleanup(dongle_t *dongle)
+{
+ ASSERT(dongle != NULL, return -1;);
+
+ dongle->issue->close(dongle);
+
+ kfree(dongle);
+
+ return 0;
}
/*
@@ -774,26 +466,16 @@ void irda_device_init_dongle(struct irda_device *self, int type)
*
*
*/
-int irda_device_register_dongle(struct dongle *dongle)
+int irda_device_register_dongle(struct dongle_reg *new)
{
- struct dongle_q *new;
-
/* Check if this dongle has been registred before */
- if (hashbin_find(dongles, dongle->type, NULL)) {
+ if (hashbin_find(dongles, new->type, NULL)) {
MESSAGE(__FUNCTION__ "(), Dongle already registered\n");
return 0;
}
- /* Make new IrDA dongle */
- new = (struct dongle_q *) kmalloc(sizeof(struct dongle_q), GFP_KERNEL);
- if (new == NULL)
- return -1;
-
- memset(new, 0, sizeof( struct dongle_q));
- new->dongle = dongle;
-
/* Insert IrDA dongle into hashbin */
- hashbin_insert(dongles, (QUEUE *) new, dongle->type, NULL);
+ hashbin_insert(dongles, (queue_t *) new, new->type, NULL);
return 0;
}
@@ -801,44 +483,44 @@ int irda_device_register_dongle(struct dongle *dongle)
/*
* Function irda_device_unregister_dongle (dongle)
*
- *
+ * Unregister dongle, and remove dongle from list of registred dongles
*
*/
-void irda_device_unregister_dongle(struct dongle *dongle)
+void irda_device_unregister_dongle(struct dongle_reg *dongle)
{
- struct dongle_q *node;
+ struct dongle *node;
node = hashbin_remove(dongles, dongle->type, NULL);
if (!node) {
ERROR(__FUNCTION__ "(), dongle not found!\n");
return;
}
- kfree(node);
}
/*
- * Function irda_device_set_raw_mode (self, status)
+ * Function irda_device_set_raw_mode (self, mode)
*
*
*
*/
-int irda_device_set_raw_mode(struct irda_device* self, int status)
+int irda_device_set_raw_mode(struct net_device* dev, int mode)
{
- DEBUG(2, __FUNCTION__ "()\n");
+ struct if_irda_req req;
+ int ret;
- ASSERT(self != NULL, return -1;);
- ASSERT(self->magic == IRDA_DEVICE_MAGIC, return -1;);
-
- if (self->set_raw_mode == NULL) {
+ IRDA_DEBUG(0, __FUNCTION__ "()\n");
+
+ if (!dev->do_ioctl) {
ERROR(__FUNCTION__ "(), set_raw_mode not impl. by "
"device driver\n");
return -1;
}
- self->raw_mode = status;
- self->set_raw_mode(self, status);
+ req.ifr_raw_mode = mode;
+
+ ret = dev->do_ioctl(dev, (struct ifreq *) &req, SIOCSRAWMODE);
- return 0;
+ return ret;
}
/*
@@ -862,88 +544,3 @@ void setup_dma(int channel, char *buffer, int count, int mode)
release_dma_lock(flags);
}
-
-#ifdef CONFIG_PROC_FS
-
-int irda_device_print_flags(struct irda_device *idev, char *buf)
-{
- int len=0;
-
- len += sprintf( buf+len, "\t");
-
- if (idev->netdev.flags & IFF_UP)
- len += sprintf( buf+len, "UP ");
- if (!idev->netdev.tbusy)
- len += sprintf( buf+len, "RUNNING ");
-
- if (idev->flags & IFF_SIR)
- len += sprintf( buf+len, "SIR ");
- if (idev->flags & IFF_MIR)
- len += sprintf( buf+len, "MIR ");
- if (idev->flags & IFF_FIR)
- len += sprintf( buf+len, "FIR ");
- if (idev->flags & IFF_PIO)
- len += sprintf( buf+len, "PIO ");
- if (idev->flags & IFF_DMA)
- len += sprintf( buf+len, "DMA ");
- if (idev->flags & IFF_SHM)
- len += sprintf( buf+len, "SHM ");
- if (idev->flags & IFF_DONGLE)
- len += sprintf( buf+len, "DONGLE ");
-
- len += sprintf( buf+len, "\n");
-
- return len;
-}
-
-/*
- * Function irda_device_proc_read (buf, start, offset, len, unused)
- *
- * Give some info to the /proc file system
- *
- */
-int irda_device_proc_read(char *buf, char **start, off_t offset, int len,
- int unused)
-{
- struct irda_device *self;
- unsigned long flags;
-
- save_flags(flags);
- cli();
-
- len = 0;
-
- self = (struct irda_device *) hashbin_get_first(irda_device);
- while ( self != NULL) {
- len += sprintf(buf+len, "\n%s,", self->name);
- len += sprintf(buf+len, "\tbinding: %s\n",
- self->description);
-
- len += irda_device_print_flags(self, buf+len);
- len += sprintf(buf+len, "\tbps\tmaxtt\tdsize\twinsize\taddbofs\tmintt\tldisc\n");
-
- len += sprintf(buf+len, "\t%d\t",
- self->qos.baud_rate.value);
- len += sprintf(buf+len, "%d\t",
- self->qos.max_turn_time.value);
- len += sprintf(buf+len, "%d\t",
- self->qos.data_size.value);
- len += sprintf(buf+len, "%d\t",
- self->qos.window_size.value);
- len += sprintf(buf+len, "%d\t",
- self->qos.additional_bofs.value);
- len += sprintf(buf+len, "%d\t",
- self->qos.min_turn_time.value);
- len += sprintf(buf+len, "%d",
- self->qos.link_disc_time.value);
- len += sprintf(buf+len, "\n");
-
- self = (struct irda_device *) hashbin_get_next(irda_device);
- }
- restore_flags(flags);
-
- return len;
-}
-
-#endif /* CONFIG_PROC_FS */
-
diff --git a/net/irda/iriap.c b/net/irda/iriap.c
index 508e1d9d6..10fdd4627 100644
--- a/net/irda/iriap.c
+++ b/net/irda/iriap.c
@@ -6,7 +6,7 @@
* Status: Experimental.
* Author: Dag Brattli <dagb@cs.uit.no>
* Created at: Thu Aug 21 00:02:07 1997
- * Modified at: Fri Aug 20 10:26:39 1999
+ * Modified at: Sat Oct 9 17:00:56 1999
* Modified by: Dag Brattli <dagb@cs.uit.no>
*
* Copyright (c) 1998-1999 Dag Brattli <dagb@cs.uit.no>,
@@ -28,7 +28,6 @@
#include <linux/skbuff.h>
#include <linux/string.h>
#include <linux/init.h>
-#include <linux/irda.h>
#include <asm/byteorder.h>
#include <asm/unaligned.h>
@@ -146,7 +145,7 @@ struct iriap_cb *iriap_open(__u8 slsap_sel, int mode)
struct lsap_cb *lsap;
notify_t notify;
- DEBUG(4, __FUNCTION__ "()\n");
+ IRDA_DEBUG(4, __FUNCTION__ "()\n");
self = kmalloc(sizeof(struct iriap_cb), GFP_ATOMIC);
if (!self) {
@@ -184,7 +183,7 @@ struct iriap_cb *iriap_open(__u8 slsap_sel, int mode)
init_timer(&self->watchdog_timer);
- hashbin_insert(iriap, (QUEUE*) self, slsap_sel, NULL);
+ hashbin_insert(iriap, (queue_t *) self, slsap_sel, NULL);
/* Initialize state machines */
iriap_next_client_state(self, S_DISCONNECT);
@@ -203,7 +202,7 @@ struct iriap_cb *iriap_open(__u8 slsap_sel, int mode)
*/
static void __iriap_close(struct iriap_cb *self)
{
- DEBUG(4, __FUNCTION__ "()\n");
+ IRDA_DEBUG(4, __FUNCTION__ "()\n");
ASSERT(self != NULL, return;);
ASSERT(self->magic == IAS_MAGIC, return;);
@@ -251,7 +250,7 @@ static void iriap_disconnect_indication(void *instance, void *sap,
{
struct iriap_cb *self;
- DEBUG(4, __FUNCTION__ "(), reason=%s\n", lmp_reasons[reason]);
+ IRDA_DEBUG(4, __FUNCTION__ "(), reason=%s\n", lmp_reasons[reason]);
self = (struct iriap_cb *) instance;
@@ -263,7 +262,7 @@ static void iriap_disconnect_indication(void *instance, void *sap,
del_timer(&self->watchdog_timer);
if (self->mode == IAS_CLIENT) {
- DEBUG(4, __FUNCTION__ "(), disconnect as client\n");
+ IRDA_DEBUG(4, __FUNCTION__ "(), disconnect as client\n");
/*
* Inform service user that the request failed by sending
@@ -279,7 +278,7 @@ static void iriap_disconnect_indication(void *instance, void *sap,
iriap_close(self);
} else {
- DEBUG(4, __FUNCTION__ "(), disconnect as server\n");
+ IRDA_DEBUG(4, __FUNCTION__ "(), disconnect as server\n");
iriap_do_server_event(self, IAP_LM_DISCONNECT_INDICATION,
NULL);
}
@@ -298,14 +297,14 @@ void iriap_disconnect_request(struct iriap_cb *self)
{
struct sk_buff *skb;
- DEBUG(4, __FUNCTION__ "()\n");
+ IRDA_DEBUG(4, __FUNCTION__ "()\n");
ASSERT(self != NULL, return;);
ASSERT(self->magic == IAS_MAGIC, return;);
skb = dev_alloc_skb(64);
if (skb == NULL) {
- DEBUG(0, __FUNCTION__
+ IRDA_DEBUG(0, __FUNCTION__
"(), Could not allocate an sk_buff of length %d\n", 64);
return;
}
@@ -320,27 +319,27 @@ void iriap_disconnect_request(struct iriap_cb *self)
void iriap_getinfobasedetails_request(void)
{
- DEBUG(0, __FUNCTION__ "(), Not implemented!\n");
+ IRDA_DEBUG(0, __FUNCTION__ "(), Not implemented!\n");
}
void iriap_getinfobasedetails_confirm(void)
{
- DEBUG(0, __FUNCTION__ "(), Not implemented!\n");
+ IRDA_DEBUG(0, __FUNCTION__ "(), Not implemented!\n");
}
void iriap_getobjects_request(void)
{
- DEBUG(0, __FUNCTION__ "(), Not implemented!\n");
+ IRDA_DEBUG(0, __FUNCTION__ "(), Not implemented!\n");
}
void iriap_getobjects_confirm(void)
{
- DEBUG(0, __FUNCTION__ "(), Not implemented!\n");
+ IRDA_DEBUG(0, __FUNCTION__ "(), Not implemented!\n");
}
void iriap_getvalue(void)
{
- DEBUG(0, __FUNCTION__ "(), Not implemented!\n");
+ IRDA_DEBUG(0, __FUNCTION__ "(), Not implemented!\n");
}
/*
@@ -434,13 +433,13 @@ void iriap_getvaluebyclass_confirm(struct iriap_cb *self, struct sk_buff *skb)
/* Get length, MSB first */
len = be16_to_cpu(get_unaligned((__u16 *)(fp+n))); n += 2;
- DEBUG(4, __FUNCTION__ "(), len=%d\n", len);
+ IRDA_DEBUG(4, __FUNCTION__ "(), len=%d\n", len);
/* Get object ID, MSB first */
obj_id = be16_to_cpu(get_unaligned((__u16 *)(fp+n))); n += 2;
type = fp[n++];
- DEBUG(4, __FUNCTION__ "(), Value type = %d\n", type);
+ IRDA_DEBUG(4, __FUNCTION__ "(), Value type = %d\n", type);
switch (type) {
case IAS_INTEGER:
@@ -449,7 +448,7 @@ void iriap_getvaluebyclass_confirm(struct iriap_cb *self, struct sk_buff *skb)
value = irias_new_integer_value(tmp_cpu32);
/* Legal values restricted to 0x01-0x6f, page 15 irttp */
- DEBUG(4, __FUNCTION__ "(), lsap=%d\n", value->t.integer);
+ IRDA_DEBUG(4, __FUNCTION__ "(), lsap=%d\n", value->t.integer);
break;
case IAS_STRING:
charset = fp[n++];
@@ -468,19 +467,19 @@ void iriap_getvaluebyclass_confirm(struct iriap_cb *self, struct sk_buff *skb)
/* case CS_ISO_8859_9: */
/* case CS_UNICODE: */
default:
- DEBUG(0, __FUNCTION__"(), charset %s, not supported\n",
+ IRDA_DEBUG(0, __FUNCTION__"(), charset %s, not supported\n",
ias_charset_types[charset]);
return;
/* break; */
}
value_len = fp[n++];
- DEBUG(4, __FUNCTION__ "(), strlen=%d\n", value_len);
+ IRDA_DEBUG(4, __FUNCTION__ "(), strlen=%d\n", value_len);
ASSERT(value_len < 64, return;);
/* Make sure the string is null-terminated */
fp[n+value_len] = 0x00;
- DEBUG(4, "Got string %s\n", fp+n);
+ IRDA_DEBUG(4, "Got string %s\n", fp+n);
value = irias_new_string_value(fp+n);
break;
case IAS_OCT_SEQ:
@@ -517,7 +516,7 @@ void iriap_getvaluebyclass_response(struct iriap_cb *self, __u16 obj_id,
__u32 tmp_be32, tmp_be16;
__u8 *fp;
- DEBUG(4, __FUNCTION__ "()\n");
+ IRDA_DEBUG(4, __FUNCTION__ "()\n");
ASSERT(self != NULL, return;);
ASSERT(self->magic == IAS_MAGIC, return;);
@@ -578,12 +577,12 @@ void iriap_getvaluebyclass_response(struct iriap_cb *self, __u16 obj_id,
memcpy(fp+n, value->t.oct_seq, value->len); n+=value->len;
break;
case IAS_MISSING:
- DEBUG( 3, __FUNCTION__ ": sending IAS_MISSING\n");
+ IRDA_DEBUG( 3, __FUNCTION__ ": sending IAS_MISSING\n");
skb_put( skb, 1);
fp[n++] = value->type;
break;
default:
- DEBUG(0, __FUNCTION__ "(), type not implemented!\n");
+ IRDA_DEBUG(0, __FUNCTION__ "(), type not implemented!\n");
break;
}
iriap_do_r_connect_event(self, IAP_CALL_RESPONSE, skb);
@@ -607,7 +606,7 @@ void iriap_getvaluebyclass_indication(struct iriap_cb *self,
__u8 *fp;
int n;
- DEBUG(4, __FUNCTION__ "()\n");
+ IRDA_DEBUG(4, __FUNCTION__ "()\n");
ASSERT(self != NULL, return;);
ASSERT(self->magic == IAS_MAGIC, return;);
@@ -629,26 +628,26 @@ void iriap_getvaluebyclass_indication(struct iriap_cb *self,
/*
* Now, do some advanced parsing! :-)
*/
- DEBUG(4, "LM-IAS: Looking up %s: %s\n", name, attr);
+ IRDA_DEBUG(4, "LM-IAS: Looking up %s: %s\n", name, attr);
obj = irias_find_object(name);
if (obj == NULL) {
- DEBUG(0, "LM-IAS: Object not found\n");
+ IRDA_DEBUG(0, "LM-IAS: Object not found\n");
iriap_getvaluebyclass_response(self, 0x1235, IAS_CLASS_UNKNOWN,
&missing);
return;
}
- DEBUG(4, "LM-IAS: found %s, id=%d\n", obj->name, obj->id);
+ IRDA_DEBUG(4, "LM-IAS: found %s, id=%d\n", obj->name, obj->id);
attrib = irias_find_attrib(obj, attr);
if (attrib == NULL) {
- DEBUG(0, "LM-IAS: Attribute %s not found\n", attr);
+ IRDA_DEBUG(0, "LM-IAS: Attribute %s not found\n", attr);
iriap_getvaluebyclass_response(self, obj->id,
IAS_ATTRIB_UNKNOWN, &missing);
return;
}
- DEBUG(4, "LM-IAS: found %s\n", attrib->name);
+ IRDA_DEBUG(4, "LM-IAS: found %s\n", attrib->name);
/*
* We have a match; send the value.
@@ -670,7 +669,7 @@ void iriap_send_ack(struct iriap_cb *self)
struct sk_buff *skb;
__u8 *frame;
- DEBUG(6, __FUNCTION__ "()\n");
+ IRDA_DEBUG(6, __FUNCTION__ "()\n");
ASSERT(self != NULL, return;);
ASSERT(self->magic == IAS_MAGIC, return;);
@@ -707,7 +706,7 @@ static void iriap_connect_confirm(void *instance, void *sap,
ASSERT(self->magic == IAS_MAGIC, return;);
ASSERT(userdata != NULL, return;);
- DEBUG(4, __FUNCTION__ "()\n");
+ IRDA_DEBUG(4, __FUNCTION__ "()\n");
del_timer(&self->watchdog_timer);
@@ -748,7 +747,7 @@ static int iriap_data_indication(void *instance, void *sap,
__u8 *frame;
__u8 opcode;
- DEBUG( 4, __FUNCTION__ "()\n");
+ IRDA_DEBUG( 4, __FUNCTION__ "()\n");
self = (struct iriap_cb *) instance;
@@ -761,7 +760,7 @@ static int iriap_data_indication(void *instance, void *sap,
if (self->mode == IAS_SERVER) {
/* Call server */
- DEBUG(4, __FUNCTION__ "(), Calling server!\n");
+ IRDA_DEBUG(4, __FUNCTION__ "(), Calling server!\n");
iriap_do_r_connect_event( self, IAP_RECV_F_LST, skb);
return 0;
@@ -775,7 +774,7 @@ static int iriap_data_indication(void *instance, void *sap,
/* Check for ack frames since they don't contain any data */
if (opcode & IAP_ACK) {
- DEBUG(0, __FUNCTION__ "() Got ack frame!\n");
+ IRDA_DEBUG(0, __FUNCTION__ "() Got ack frame!\n");
return 0;
}
@@ -783,7 +782,7 @@ static int iriap_data_indication(void *instance, void *sap,
switch (opcode) {
case GET_INFO_BASE:
- DEBUG(0, "IrLMP GetInfoBaseDetails not implemented!\n");
+ IRDA_DEBUG(0, "IrLMP GetInfoBaseDetails not implemented!\n");
break;
case GET_VALUE_BY_CLASS:
switch (frame[1]) {
@@ -818,7 +817,7 @@ static int iriap_data_indication(void *instance, void *sap,
iriap_close(self);
break;
default:
- DEBUG(0, __FUNCTION__ "(), Unknown op-code: %02x\n", opcode);
+ IRDA_DEBUG(0, __FUNCTION__ "(), Unknown op-code: %02x\n", opcode);
break;
}
return 0;
@@ -835,7 +834,7 @@ void iriap_call_indication(struct iriap_cb *self, struct sk_buff *skb)
__u8 *fp;
__u8 opcode;
- DEBUG(4, __FUNCTION__ "()\n");
+ IRDA_DEBUG(4, __FUNCTION__ "()\n");
ASSERT(self != NULL, return;);
ASSERT(self->magic == IAS_MAGIC, return;);
@@ -938,7 +937,7 @@ int irias_proc_read(char *buf, char **start, off_t offset, int len, int unused)
len += sprintf(buf+len, "missing\n");
break;
default:
- DEBUG(0, __FUNCTION__
+ IRDA_DEBUG(0, __FUNCTION__
"(), Unknown value type!\n");
return -1;
}
diff --git a/net/irda/iriap_event.c b/net/irda/iriap_event.c
index 18a70fec3..6fc2ead68 100644
--- a/net/irda/iriap_event.c
+++ b/net/irda/iriap_event.c
@@ -95,9 +95,9 @@ void iriap_next_client_state( struct iriap_cb *self, IRIAP_STATE state)
ASSERT( self->magic == IAS_MAGIC, return;);
switch ( state) {
- /* case S_DISCONNECT: DEBUG( 0, "IAP Client = S_DISCONNECT\n"); break; */
-/* case S_CONNECTING: DEBUG( 0, "IAP Client = S_CONNECTING\n"); break; */
-/* case S_CALL: DEBUG( 0, "IAP Client = S_CALL\n"); break; */
+ /* case S_DISCONNECT: IRDA_DEBUG( 0, "IAP Client = S_DISCONNECT\n"); break; */
+/* case S_CONNECTING: IRDA_DEBUG( 0, "IAP Client = S_CONNECTING\n"); break; */
+/* case S_CALL: IRDA_DEBUG( 0, "IAP Client = S_CALL\n"); break; */
default:
break;
}
@@ -110,12 +110,12 @@ void iriap_next_call_state( struct iriap_cb *self, IRIAP_STATE state)
ASSERT( self->magic == IAS_MAGIC, return;);
/* switch ( state) { */
-/* case S_MAKE_CALL: DEBUG( 0, "IAP Call = S_MAKE_CALL\n"); break; */
-/* case S_CALLING: DEBUG( 0, "IAP Call = S_CALLING\n"); break; */
-/* case S_OUTSTANDING: DEBUG( 0, "IAP Call = S_OUTSTANDING\n");break; */
-/* case S_REPLYING: DEBUG( 0, "IAP Call = S_REPLYING\n"); break; */
-/* case S_WAIT_FOR_CALL: DEBUG( 0, "IAP Call = S_WAIT_FOR_CALL\n"); break; */
-/* case S_WAIT_ACTIVE: DEBUG( 0, "IAP Call = S_WAIT_ACTIVE\n"); break; */
+/* case S_MAKE_CALL: IRDA_DEBUG( 0, "IAP Call = S_MAKE_CALL\n"); break; */
+/* case S_CALLING: IRDA_DEBUG( 0, "IAP Call = S_CALLING\n"); break; */
+/* case S_OUTSTANDING: IRDA_DEBUG( 0, "IAP Call = S_OUTSTANDING\n");break; */
+/* case S_REPLYING: IRDA_DEBUG( 0, "IAP Call = S_REPLYING\n"); break; */
+/* case S_WAIT_FOR_CALL: IRDA_DEBUG( 0, "IAP Call = S_WAIT_FOR_CALL\n"); break; */
+/* case S_WAIT_ACTIVE: IRDA_DEBUG( 0, "IAP Call = S_WAIT_ACTIVE\n"); break; */
/* default: */
/* break; */
/* } */
@@ -200,7 +200,7 @@ static void state_s_disconnect( struct iriap_cb *self, IRIAP_EVENT event,
case IAP_LM_DISCONNECT_INDICATION:
break;
default:
- DEBUG( 0, __FUNCTION__"(), Unknown event %d\n", event);
+ IRDA_DEBUG( 0, __FUNCTION__"(), Unknown event %d\n", event);
break;
}
}
@@ -232,7 +232,7 @@ static void state_s_connecting( struct iriap_cb *self, IRIAP_EVENT event,
iriap_next_client_state( self, S_DISCONNECT);
break;
default:
- DEBUG( 0, __FUNCTION__ "(), Unknown event %d\n", event);
+ IRDA_DEBUG( 0, __FUNCTION__ "(), Unknown event %d\n", event);
break;
}
}
@@ -256,7 +256,7 @@ static void state_s_call( struct iriap_cb *self, IRIAP_EVENT event,
iriap_next_client_state( self, S_DISCONNECT);
break;
default:
- DEBUG( 0, "state_s_call: Unknown event %d\n", event);
+ IRDA_DEBUG( 0, "state_s_call: Unknown event %d\n", event);
break;
}
}
@@ -278,7 +278,7 @@ static void state_s_make_call( struct iriap_cb *self, IRIAP_EVENT event,
iriap_next_call_state( self, S_OUTSTANDING);
break;
default:
- DEBUG( 0, "state_s_make_call: Unknown event %d\n", event);
+ IRDA_DEBUG( 0, "state_s_make_call: Unknown event %d\n", event);
break;
}
if ( skb) {
@@ -295,7 +295,7 @@ static void state_s_make_call( struct iriap_cb *self, IRIAP_EVENT event,
static void state_s_calling( struct iriap_cb *self, IRIAP_EVENT event,
struct sk_buff *skb)
{
- DEBUG( 0, __FUNCTION__ "(), Not implemented\n");
+ IRDA_DEBUG( 0, __FUNCTION__ "(), Not implemented\n");
}
/*
@@ -318,7 +318,7 @@ static void state_s_outstanding( struct iriap_cb *self, IRIAP_EVENT event,
iriap_next_call_state( self, S_WAIT_FOR_CALL);
break;
default:
- DEBUG( 0, __FUNCTION__ "(), Unknown event %d\n", event);
+ IRDA_DEBUG( 0, __FUNCTION__ "(), Unknown event %d\n", event);
break;
}
}
@@ -331,7 +331,7 @@ static void state_s_outstanding( struct iriap_cb *self, IRIAP_EVENT event,
static void state_s_replying( struct iriap_cb *self, IRIAP_EVENT event,
struct sk_buff *skb)
{
- DEBUG( 0, __FUNCTION__ "(), Not implemented\n");
+ IRDA_DEBUG( 0, __FUNCTION__ "(), Not implemented\n");
}
/*
@@ -343,7 +343,7 @@ static void state_s_replying( struct iriap_cb *self, IRIAP_EVENT event,
static void state_s_wait_for_call( struct iriap_cb *self, IRIAP_EVENT event,
struct sk_buff *skb)
{
- DEBUG( 0, __FUNCTION__ "(), Not implemented\n");
+ IRDA_DEBUG( 0, __FUNCTION__ "(), Not implemented\n");
}
@@ -356,7 +356,7 @@ static void state_s_wait_for_call( struct iriap_cb *self, IRIAP_EVENT event,
static void state_s_wait_active( struct iriap_cb *self, IRIAP_EVENT event,
struct sk_buff *skb)
{
- DEBUG( 0, __FUNCTION__ "(), Not implemented\n");
+ IRDA_DEBUG( 0, __FUNCTION__ "(), Not implemented\n");
}
/**************************************************************************
@@ -380,7 +380,7 @@ static void state_r_disconnect( struct iriap_cb *self, IRIAP_EVENT event,
case IAP_LM_CONNECT_INDICATION:
tx_skb = dev_alloc_skb( 64);
if ( tx_skb == NULL) {
- DEBUG( 0,"state_r_disconnect: "
+ IRDA_DEBUG( 0,"state_r_disconnect: "
"Could not allocate an sk_buff of length %d\n",
64);
return;
@@ -405,7 +405,7 @@ static void state_r_disconnect( struct iriap_cb *self, IRIAP_EVENT event,
break;
default:
- DEBUG( 0, "state_r_disconnect: Unknown event %d\n", event);
+ IRDA_DEBUG( 0, "state_r_disconnect: Unknown event %d\n", event);
break;
}
}
@@ -419,7 +419,7 @@ static void state_r_disconnect( struct iriap_cb *self, IRIAP_EVENT event,
static void state_r_call( struct iriap_cb *self, IRIAP_EVENT event,
struct sk_buff *skb)
{
- DEBUG( 4, "state_r_call()\n");
+ IRDA_DEBUG( 4, "state_r_call()\n");
switch( event) {
case IAP_LM_DISCONNECT_INDICATION:
@@ -429,7 +429,7 @@ static void state_r_call( struct iriap_cb *self, IRIAP_EVENT event,
break;
default:
- DEBUG( 0, "state_r_call, unknown event!\n");
+ IRDA_DEBUG( 0, "state_r_call, unknown event!\n");
break;
}
}
@@ -447,13 +447,13 @@ static void state_r_call( struct iriap_cb *self, IRIAP_EVENT event,
static void state_r_waiting( struct iriap_cb *self, IRIAP_EVENT event,
struct sk_buff *skb)
{
- DEBUG( 0, __FUNCTION__ "(), Not implemented\n");
+ IRDA_DEBUG( 0, __FUNCTION__ "(), Not implemented\n");
}
static void state_r_wait_active( struct iriap_cb *self,
IRIAP_EVENT event, struct sk_buff *skb)
{
- DEBUG( 0, __FUNCTION__ "(), Not implemented\n");
+ IRDA_DEBUG( 0, __FUNCTION__ "(), Not implemented\n");
}
/*
@@ -465,7 +465,7 @@ static void state_r_wait_active( struct iriap_cb *self,
static void state_r_receiving( struct iriap_cb *self, IRIAP_EVENT event,
struct sk_buff *skb)
{
- DEBUG( 4, __FUNCTION__ "()\n");
+ IRDA_DEBUG( 4, __FUNCTION__ "()\n");
switch( event) {
case IAP_RECV_F_LST:
@@ -474,7 +474,7 @@ static void state_r_receiving( struct iriap_cb *self, IRIAP_EVENT event,
iriap_call_indication( self, skb);
break;
default:
- DEBUG( 0, __FUNCTION__ "(), unknown event!\n");
+ IRDA_DEBUG( 0, __FUNCTION__ "(), unknown event!\n");
break;
}
@@ -489,12 +489,12 @@ static void state_r_receiving( struct iriap_cb *self, IRIAP_EVENT event,
static void state_r_execute( struct iriap_cb *self, IRIAP_EVENT event,
struct sk_buff *skb)
{
- DEBUG( 4, __FUNCTION__ "()\n");
+ IRDA_DEBUG( 4, __FUNCTION__ "()\n");
ASSERT( skb != NULL, return;);
if ( !self || self->magic != IAS_MAGIC) {
- DEBUG( 0, "state_r_execute: bad pointer self\n");
+ IRDA_DEBUG( 0, "state_r_execute: bad pointer self\n");
return;
}
@@ -509,7 +509,7 @@ static void state_r_execute( struct iriap_cb *self, IRIAP_EVENT event,
irlmp_data_request( self->lsap, skb);
break;
default:
- DEBUG( 0, __FUNCTION__ "(), unknown event!\n");
+ IRDA_DEBUG( 0, __FUNCTION__ "(), unknown event!\n");
break;
}
}
@@ -517,7 +517,7 @@ static void state_r_execute( struct iriap_cb *self, IRIAP_EVENT event,
static void state_r_returning( struct iriap_cb *self, IRIAP_EVENT event,
struct sk_buff *skb)
{
- DEBUG( 0, __FUNCTION__ "(), event=%d\n", event);
+ IRDA_DEBUG( 0, __FUNCTION__ "(), event=%d\n", event);
switch( event) {
case IAP_RECV_F_LST:
diff --git a/net/irda/irias_object.c b/net/irda/irias_object.c
index 8621c43b6..c83bb855b 100644
--- a/net/irda/irias_object.c
+++ b/net/irda/irias_object.c
@@ -6,7 +6,7 @@
* Status: Experimental.
* Author: Dag Brattli <dagb@cs.uit.no>
* Created at: Thu Oct 1 22:50:04 1998
- * Modified at: Mon Jun 21 16:11:13 1999
+ * Modified at: Sat Oct 9 17:11:16 1999
* Modified by: Dag Brattli <dagb@cs.uit.no>
*
* Copyright (c) 1998-1999 Dag Brattli, All Rights Reserved.
@@ -24,7 +24,6 @@
#include <linux/string.h>
#include <linux/socket.h>
-#include <linux/irda.h>
#include <net/irda/irda.h>
#include <net/irda/irmod.h>
@@ -71,12 +70,12 @@ struct ias_object *irias_new_object( char *name, int id)
{
struct ias_object *obj;
- DEBUG( 4, __FUNCTION__ "()\n");
+ IRDA_DEBUG( 4, __FUNCTION__ "()\n");
obj = (struct ias_object *) kmalloc( sizeof( struct ias_object),
GFP_ATOMIC);
if (obj == NULL) {
- DEBUG(0, __FUNCTION__ "(), Unable to allocate object!\n");
+ IRDA_DEBUG(0, __FUNCTION__ "(), Unable to allocate object!\n");
return NULL;
}
memset(obj, 0, sizeof( struct ias_object));
@@ -156,12 +155,10 @@ int irias_delete_object(struct ias_object *obj)
*/
void irias_insert_object(struct ias_object *obj)
{
- DEBUG(4, __FUNCTION__ "()\n");
-
ASSERT(obj != NULL, return;);
ASSERT(obj->magic == IAS_OBJECT_MAGIC, return;);
- hashbin_insert(objects, (QUEUE *) obj, 0, obj->name);
+ hashbin_insert(objects, (queue_t *) obj, 0, obj->name);
}
/*
@@ -183,18 +180,16 @@ struct ias_object *irias_find_object(char *name)
* Find named attribute in object
*
*/
-struct ias_attrib *irias_find_attrib( struct ias_object *obj, char *name)
+struct ias_attrib *irias_find_attrib(struct ias_object *obj, char *name)
{
struct ias_attrib *attrib;
- DEBUG( 4, __FUNCTION__ "()\n");
-
- ASSERT( obj != NULL, return NULL;);
- ASSERT( obj->magic == IAS_OBJECT_MAGIC, return NULL;);
- ASSERT( name != NULL, return NULL;);
+ ASSERT(obj != NULL, return NULL;);
+ ASSERT(obj->magic == IAS_OBJECT_MAGIC, return NULL;);
+ ASSERT(name != NULL, return NULL;);
- attrib = hashbin_find( obj->attribs, 0, name);
- if ( attrib == NULL)
+ attrib = hashbin_find(obj->attribs, 0, name);
+ if (attrib == NULL)
return NULL;
return attrib;
@@ -208,15 +203,13 @@ struct ias_attrib *irias_find_attrib( struct ias_object *obj, char *name)
*/
void irias_add_attrib( struct ias_object *obj, struct ias_attrib *attrib)
{
- DEBUG( 4, __FUNCTION__ "()\n");
-
- ASSERT( obj != NULL, return;);
- ASSERT( obj->magic == IAS_OBJECT_MAGIC, return;);
+ ASSERT(obj != NULL, return;);
+ ASSERT(obj->magic == IAS_OBJECT_MAGIC, return;);
- ASSERT( attrib != NULL, return;);
- ASSERT( attrib->magic == IAS_ATTRIB_MAGIC, return;);
+ ASSERT(attrib != NULL, return;);
+ ASSERT(attrib->magic == IAS_ATTRIB_MAGIC, return;);
- hashbin_insert( obj->attribs, (QUEUE *) attrib, 0, attrib->name);
+ hashbin_insert(obj->attribs, (queue_t *) attrib, 0, attrib->name);
}
/*
@@ -225,36 +218,36 @@ void irias_add_attrib( struct ias_object *obj, struct ias_attrib *attrib)
* Change the value of an objects attribute.
*
*/
-int irias_object_change_attribute( char *obj_name, char *attrib_name,
- struct ias_value *new_value)
+int irias_object_change_attribute(char *obj_name, char *attrib_name,
+ struct ias_value *new_value)
{
struct ias_object *obj;
struct ias_attrib *attrib;
/* Find object */
- obj = hashbin_find( objects, 0, obj_name);
- if ( obj == NULL) {
- DEBUG( 0, __FUNCTION__ "(), Unable to find object: %s\n",
- obj_name);
+ obj = hashbin_find(objects, 0, obj_name);
+ if (obj == NULL) {
+ WARNING(__FUNCTION__ "(), Unable to find object: %s\n",
+ obj_name);
return -1;
}
/* Find attribute */
- attrib = hashbin_find( obj->attribs, 0, attrib_name);
- if ( attrib == NULL) {
- DEBUG( 0, __FUNCTION__ "(), Unable to find attribute: %s\n",
- attrib_name);
+ attrib = hashbin_find(obj->attribs, 0, attrib_name);
+ if (attrib == NULL) {
+ WARNING(__FUNCTION__ "(), Unable to find attribute: %s\n",
+ attrib_name);
return -1;
}
-
+
if ( attrib->value->type != new_value->type) {
- DEBUG( 0, __FUNCTION__
+ IRDA_DEBUG( 0, __FUNCTION__
"(), changing value type not allowed!\n");
return -1;
}
/* Delete old value */
- irias_delete_value( attrib->value);
+ irias_delete_value(attrib->value);
/* Insert new value */
attrib->value = new_value;
@@ -269,31 +262,29 @@ int irias_object_change_attribute( char *obj_name, char *attrib_name,
* Add an integer attribute to an LM-IAS object
*
*/
-void irias_add_integer_attrib( struct ias_object *obj, char *name, int value)
+void irias_add_integer_attrib(struct ias_object *obj, char *name, int value)
{
struct ias_attrib *attrib;
- ASSERT( obj != NULL, return;);
- ASSERT( obj->magic == IAS_OBJECT_MAGIC, return;);
- ASSERT( name != NULL, return;);
+ ASSERT(obj != NULL, return;);
+ ASSERT(obj->magic == IAS_OBJECT_MAGIC, return;);
+ ASSERT(name != NULL, return;);
- attrib = (struct ias_attrib *) kmalloc( sizeof( struct ias_attrib),
- GFP_ATOMIC);
- if ( attrib == NULL) {
- DEBUG( 0, __FUNCTION__
- "(), Unable to allocate attribute!\n");
+ attrib = (struct ias_attrib *) kmalloc(sizeof(struct ias_attrib),
+ GFP_ATOMIC);
+ if (attrib == NULL) {
+ WARNING(__FUNCTION__ "(), Unable to allocate attribute!\n");
return;
}
- memset( attrib, 0, sizeof( struct ias_attrib));
+ memset(attrib, 0, sizeof( struct ias_attrib));
attrib->magic = IAS_ATTRIB_MAGIC;
- attrib->name = strdup( name);
-/* attrib->attr = NULL; */
+ attrib->name = strdup(name);
/* Insert value */
- attrib->value = irias_new_integer_value( value);
+ attrib->value = irias_new_integer_value(value);
- irias_add_attrib( obj, attrib);
+ irias_add_attrib(obj, attrib);
}
/*
@@ -303,33 +294,32 @@ void irias_add_integer_attrib( struct ias_object *obj, char *name, int value)
*
*/
-void irias_add_octseq_attrib( struct ias_object *obj, char *name,
- __u8 *octets, int len)
+void irias_add_octseq_attrib(struct ias_object *obj, char *name, __u8 *octets,
+ int len)
{
struct ias_attrib *attrib;
- ASSERT( obj != NULL, return;);
- ASSERT( obj->magic == IAS_OBJECT_MAGIC, return;);
+ ASSERT(obj != NULL, return;);
+ ASSERT(obj->magic == IAS_OBJECT_MAGIC, return;);
- ASSERT( name != NULL, return;);
- ASSERT( octets != NULL, return;);
- ASSERT( len < 55, return;); /* FIXME: must be 1024, but... */
+ ASSERT(name != NULL, return;);
+ ASSERT(octets != NULL, return;);
- attrib = (struct ias_attrib *) kmalloc( sizeof( struct ias_attrib),
- GFP_ATOMIC);
- if ( attrib == NULL) {
- DEBUG( 0, __FUNCTION__
- "(), Unable to allocate attribute!\n");
+ attrib = (struct ias_attrib *) kmalloc(sizeof(struct ias_attrib),
+ GFP_ATOMIC);
+ if (attrib == NULL) {
+ WARNING(__FUNCTION__
+ "(), Unable to allocate attribute!\n");
return;
}
- memset( attrib, 0, sizeof( struct ias_attrib));
+ memset(attrib, 0, sizeof( struct ias_attrib));
attrib->magic = IAS_ATTRIB_MAGIC;
attrib->name = strdup( name);
attrib->value = irias_new_octseq_value( octets, len);
- irias_add_attrib( obj, attrib);
+ irias_add_attrib(obj, attrib);
}
/*
@@ -338,31 +328,30 @@ void irias_add_octseq_attrib( struct ias_object *obj, char *name,
* Add a string attribute to an LM-IAS object
*
*/
-void irias_add_string_attrib( struct ias_object *obj, char *name, char *value)
+void irias_add_string_attrib(struct ias_object *obj, char *name, char *value)
{
struct ias_attrib *attrib;
- ASSERT( obj != NULL, return;);
- ASSERT( obj->magic == IAS_OBJECT_MAGIC, return;);
+ ASSERT(obj != NULL, return;);
+ ASSERT(obj->magic == IAS_OBJECT_MAGIC, return;);
- ASSERT( name != NULL, return;);
- ASSERT( value != NULL, return;);
+ ASSERT(name != NULL, return;);
+ ASSERT(value != NULL, return;);
- attrib = (struct ias_attrib *) kmalloc( sizeof( struct ias_attrib),
- GFP_ATOMIC);
- if ( attrib == NULL) {
- DEBUG( 0, __FUNCTION__
- "(), Unable to allocate attribute!\n");
+ attrib = (struct ias_attrib *) kmalloc(sizeof( struct ias_attrib),
+ GFP_ATOMIC);
+ if (attrib == NULL) {
+ WARNING(__FUNCTION__ "(), Unable to allocate attribute!\n");
return;
}
- memset( attrib, 0, sizeof( struct ias_attrib));
+ memset(attrib, 0, sizeof( struct ias_attrib));
attrib->magic = IAS_ATTRIB_MAGIC;
- attrib->name = strdup( name);
+ attrib->name = strdup(name);
- attrib->value = irias_new_string_value( value);
+ attrib->value = irias_new_string_value(value);
- irias_add_attrib( obj, attrib);
+ irias_add_attrib(obj, attrib);
}
/*
@@ -371,16 +360,16 @@ void irias_add_string_attrib( struct ias_object *obj, char *name, char *value)
* Create new IAS integer value
*
*/
-struct ias_value *irias_new_integer_value( int integer)
+struct ias_value *irias_new_integer_value(int integer)
{
struct ias_value *value;
- value = kmalloc( sizeof( struct ias_value), GFP_ATOMIC);
- if ( value == NULL) {
- DEBUG( 0, __FUNCTION__ "(), Unable to kmalloc!\n");
+ value = kmalloc(sizeof( struct ias_value), GFP_ATOMIC);
+ if (value == NULL) {
+ WARNING(__FUNCTION__ "(), Unable to kmalloc!\n");
return NULL;
}
- memset( value, 0, sizeof( struct ias_value));
+ memset(value, 0, sizeof(struct ias_value));
value->type = IAS_INTEGER;
value->len = 4;
@@ -395,21 +384,21 @@ struct ias_value *irias_new_integer_value( int integer)
* Create new IAS string value
*
*/
-struct ias_value *irias_new_string_value( char *string)
+struct ias_value *irias_new_string_value(char *string)
{
struct ias_value *value;
- value = kmalloc( sizeof( struct ias_value), GFP_ATOMIC);
- if ( value == NULL) {
- DEBUG( 0, __FUNCTION__ "(), Unable to kmalloc!\n");
+ value = kmalloc(sizeof(struct ias_value), GFP_ATOMIC);
+ if (value == NULL) {
+ WARNING(__FUNCTION__ "(), Unable to kmalloc!\n");
return NULL;
}
memset( value, 0, sizeof( struct ias_value));
value->type = IAS_STRING;
value->charset = CS_ASCII;
- value->len = strlen( string);
- value->t.string = strdup( string);
+ value->len = strlen(string);
+ value->t.string = strdup(string);
return value;
}
@@ -421,25 +410,23 @@ struct ias_value *irias_new_string_value( char *string)
* Create new IAS octet-sequence value
*
*/
-struct ias_value *irias_new_octseq_value( __u8 *octseq , int len)
+struct ias_value *irias_new_octseq_value(__u8 *octseq , int len)
{
struct ias_value *value;
- ASSERT(len <= 55, return NULL;); /*FIXME: must be 1024, but.....*/
-
- value = kmalloc( sizeof( struct ias_value), GFP_ATOMIC);
- if ( value == NULL) {
- DEBUG( 0, __FUNCTION__ "(), Unable to kmalloc!\n");
+ value = kmalloc(sizeof(struct ias_value), GFP_ATOMIC);
+ if (value == NULL) {
+ WARNING(__FUNCTION__ "(), Unable to kmalloc!\n");
return NULL;
}
- memset( value, 0, sizeof( struct ias_value));
+ memset(value, 0, sizeof( struct ias_value));
value->type = IAS_OCT_SEQ;
value->len = len;
value->t.oct_seq = kmalloc(len, GFP_ATOMIC);
- if( value->t.oct_seq == NULL){
- DEBUG(0, __FUNCTION__"(), Unable to kmalloc!\n");
+ if (value->t.oct_seq == NULL){
+ WARNING(__FUNCTION__"(), Unable to kmalloc!\n");
return NULL;
}
memcpy(value->t.oct_seq, octseq , len);
@@ -452,32 +439,32 @@ struct ias_value *irias_new_octseq_value( __u8 *octseq , int len)
* Delete IAS value
*
*/
-void irias_delete_value( struct ias_value *value)
+void irias_delete_value(struct ias_value *value)
{
- DEBUG( 4, __FUNCTION__ "()\n");
+ IRDA_DEBUG(4, __FUNCTION__ "()\n");
- ASSERT( value != NULL, return;);
+ ASSERT(value != NULL, return;);
- switch( value->type) {
+ switch (value->type) {
case IAS_INTEGER: /* Fallthrough */
case IAS_MISSING:
/* No need to deallocate */
break;
case IAS_STRING:
/* If string, deallocate string */
- if ( value->t.string != NULL)
- kfree( value->t.string);
+ if (value->t.string != NULL)
+ kfree(value->t.string);
break;
case IAS_OCT_SEQ:
/* If byte stream, deallocate byte stream */
- if ( value->t.oct_seq != NULL)
+ if (value->t.oct_seq != NULL)
kfree(value->t.oct_seq);
break;
default:
- DEBUG( 0, __FUNCTION__ "(), Unknown value type!\n");
+ IRDA_DEBUG(0, __FUNCTION__ "(), Unknown value type!\n");
break;
}
- kfree( value);
+ kfree(value);
}
diff --git a/net/irda/irlan/irlan_common.c b/net/irda/irlan/irlan_common.c
index 894034353..0e80c0db8 100644
--- a/net/irda/irlan/irlan_common.c
+++ b/net/irda/irlan/irlan_common.c
@@ -6,7 +6,7 @@
* Status: Experimental.
* Author: Dag Brattli <dagb@cs.uit.no>
* Created at: Sun Aug 31 20:14:37 1997
- * Modified at: Thu Sep 9 11:39:43 1999
+ * Modified at: Tue Oct 5 11:36:11 1999
* Modified by: Dag Brattli <dagb@cs.uit.no>
*
* Copyright (c) 1997, 1999 Dag Brattli <dagb@cs.uit.no>,
@@ -296,7 +296,7 @@ struct irlan_cb *irlan_open(__u32 saddr, __u32 daddr, int netdev)
init_timer(&self->watchdog_timer);
init_timer(&self->client.kick_timer);
- hashbin_insert(irlan, (QUEUE *) self, daddr, NULL);
+ hashbin_insert(irlan, (queue_t *) self, daddr, NULL);
skb_queue_head_init(&self->client.txq);
diff --git a/net/irda/irlap.c b/net/irda/irlap.c
index 2b59a1efc..ffa3665e3 100644
--- a/net/irda/irlap.c
+++ b/net/irda/irlap.c
@@ -6,7 +6,7 @@
* Status: Stable
* Author: Dag Brattli <dagb@cs.uit.no>
* Created at: Mon Aug 4 20:40:53 1997
- * Modified at: Mon Sep 20 11:04:32 1999
+ * Modified at: Fri Oct 8 23:17:36 1999
* Modified by: Dag Brattli <dagb@cs.uit.no>
*
* Copyright (c) 1998-1999 Dag Brattli, All Rights Reserved.
@@ -74,14 +74,15 @@ int __init irlap_init(void)
/* Allocate master array */
irlap = hashbin_new(HB_LOCAL);
if (irlap == NULL) {
- printk(KERN_WARNING "IrLAP: Can't allocate irlap hashbin!\n");
+ ERROR(__FUNCTION__ "(), can't allocate irlap hashbin!\n");
return -ENOMEM;
}
#ifdef CONFIG_IRDA_COMPRESSION
irlap_compressors = hashbin_new(HB_LOCAL);
if (irlap_compressors == NULL) {
- printk(KERN_WARNING "IrLAP: Can't allocate compressors hashbin!\n");
+ WARNING(__FUNCTION__
+ "(), can't allocate compressors hashbin!\n");
return -ENOMEM;
}
#endif
@@ -106,11 +107,11 @@ void irlap_cleanup(void)
* Initialize IrLAP layer
*
*/
-struct irlap_cb *irlap_open(struct net_device *dev)
+struct irlap_cb *irlap_open(struct net_device *dev, struct qos_info *qos)
{
struct irlap_cb *self;
- DEBUG(4, __FUNCTION__ "()\n");
+ IRDA_DEBUG(4, __FUNCTION__ "()\n");
/* Initialize the irlap structure. */
self = kmalloc(sizeof(struct irlap_cb), GFP_KERNEL);
@@ -122,6 +123,10 @@ struct irlap_cb *irlap_open(struct net_device *dev)
/* Make a binding between the layers */
self->netdev = dev;
+ self->qos_dev = qos;
+
+ /* FIXME: should we get our own field? */
+ dev->atalk_ptr = self;
irlap_next_state(self, LAP_OFFLINE);
@@ -131,6 +136,7 @@ struct irlap_cb *irlap_open(struct net_device *dev)
/* My unique IrLAP device address! */
get_random_bytes(&self->saddr, sizeof(self->saddr));
+ memcpy(dev->dev_addr, &self->saddr, 4);
/*
* Generate random connection address for this session, which must
@@ -148,12 +154,13 @@ struct irlap_cb *irlap_open(struct net_device *dev)
init_timer(&self->poll_timer);
init_timer(&self->wd_timer);
init_timer(&self->backoff_timer);
+ init_timer(&self->media_busy_timer);
irlap_apply_default_connection_parameters(self);
irlap_next_state(self, LAP_NDM);
- hashbin_insert(irlap, (QUEUE *) self, self->saddr, NULL);
+ hashbin_insert(irlap, (queue_t *) self, self->saddr, NULL);
irlmp_register_link(self, self->saddr, &self->notify);
@@ -179,6 +186,7 @@ static void __irlap_close(struct irlap_cb *self)
del_timer(&self->poll_timer);
del_timer(&self->wd_timer);
del_timer(&self->backoff_timer);
+ del_timer(&self->media_busy_timer);
irlap_flush_all_queues(self);
@@ -197,7 +205,7 @@ void irlap_close(struct irlap_cb *self)
{
struct irlap_cb *lap;
- DEBUG(4, __FUNCTION__ "()\n");
+ IRDA_DEBUG(4, __FUNCTION__ "()\n");
ASSERT(self != NULL, return;);
ASSERT(self->magic == LAP_MAGIC, return;);
@@ -210,7 +218,7 @@ void irlap_close(struct irlap_cb *self)
/* Be sure that we manage to remove ourself from the hash */
lap = hashbin_remove(irlap, self->saddr, NULL);
if (!lap) {
- DEBUG(1, __FUNCTION__ "(), Didn't find myself!\n");
+ IRDA_DEBUG(1, __FUNCTION__ "(), Didn't find myself!\n");
return;
}
__irlap_close(lap);
@@ -224,7 +232,7 @@ void irlap_close(struct irlap_cb *self)
*/
void irlap_connect_indication(struct irlap_cb *self, struct sk_buff *skb)
{
- DEBUG(4, __FUNCTION__ "()\n");
+ IRDA_DEBUG(4, __FUNCTION__ "()\n");
ASSERT(self != NULL, return;);
ASSERT(self->magic == LAP_MAGIC, return;);
@@ -243,7 +251,7 @@ void irlap_connect_indication(struct irlap_cb *self, struct sk_buff *skb)
*/
void irlap_connect_response(struct irlap_cb *self, struct sk_buff *skb)
{
- DEBUG(4, __FUNCTION__ "()\n");
+ IRDA_DEBUG(4, __FUNCTION__ "()\n");
irlap_do_event(self, CONNECT_RESPONSE, skb, NULL);
}
@@ -258,7 +266,7 @@ void irlap_connect_response(struct irlap_cb *self, struct sk_buff *skb)
void irlap_connect_request(struct irlap_cb *self, __u32 daddr,
struct qos_info *qos_user, int sniff)
{
- DEBUG(3, __FUNCTION__ "(), daddr=0x%08x\n", daddr);
+ IRDA_DEBUG(3, __FUNCTION__ "(), daddr=0x%08x\n", daddr);
ASSERT(self != NULL, return;);
ASSERT(self->magic == LAP_MAGIC, return;);
@@ -271,8 +279,7 @@ void irlap_connect_request(struct irlap_cb *self, __u32 daddr,
*/
irlap_init_qos_capabilities(self, qos_user);
- if ((self->state == LAP_NDM) &&
- !irda_device_is_media_busy(self->netdev))
+ if ((self->state == LAP_NDM) && !self->media_busy)
irlap_do_event(self, CONNECT_REQUEST, NULL, NULL);
else
self->connect_pending = TRUE;
@@ -286,7 +293,7 @@ void irlap_connect_request(struct irlap_cb *self, __u32 daddr,
*/
void irlap_connect_confirm(struct irlap_cb *self, struct sk_buff *skb)
{
- DEBUG(4, __FUNCTION__ "()\n");
+ IRDA_DEBUG(4, __FUNCTION__ "()\n");
ASSERT(self != NULL, return;);
ASSERT(self->magic == LAP_MAGIC, return;);
@@ -310,7 +317,7 @@ inline void irlap_data_indication(struct irlap_cb *self, struct sk_buff *skb)
if (self->qos_tx.compression.value) {
skb = irlap_decompress_frame(self, skb);
if (!skb) {
- DEBUG(1, __FUNCTION__ "(), Decompress error!\n");
+ IRDA_DEBUG(1, __FUNCTION__ "(), Decompress error!\n");
return;
}
}
@@ -326,7 +333,7 @@ inline void irlap_data_indication(struct irlap_cb *self, struct sk_buff *skb)
*/
void irlap_unit_data_indication(struct irlap_cb *self, struct sk_buff *skb)
{
- DEBUG(1, __FUNCTION__ "()\n");
+ IRDA_DEBUG(1, __FUNCTION__ "()\n");
ASSERT(self != NULL, return;);
ASSERT(self->magic == LAP_MAGIC, return;);
@@ -340,7 +347,7 @@ void irlap_unit_data_indication(struct irlap_cb *self, struct sk_buff *skb)
skb = irlap_decompress_frame(self, skb);
if (!skb) {
- DEBUG(1, __FUNCTION__ "(), Decompress error!\n");
+ IRDA_DEBUG(1, __FUNCTION__ "(), Decompress error!\n");
return;
}
}
@@ -364,7 +371,7 @@ inline void irlap_data_request(struct irlap_cb *self, struct sk_buff *skb,
if (self->qos_tx.compression.value) {
skb = irlap_compress_frame(self, skb);
if (!skb) {
- DEBUG(1, __FUNCTION__ "(), Compress error!\n");
+ IRDA_DEBUG(1, __FUNCTION__ "(), Compress error!\n");
return;
}
}
@@ -381,7 +388,7 @@ inline void irlap_data_request(struct irlap_cb *self, struct sk_buff *skb,
if (reliable)
skb->data[1] = I_FRAME;
else {
- DEBUG(4, __FUNCTION__ "(), queueing unreliable frame\n");
+ IRDA_DEBUG(4, __FUNCTION__ "(), queueing unreliable frame\n");
skb->data[1] = UI_FRAME;
}
@@ -412,7 +419,7 @@ inline void irlap_data_request(struct irlap_cb *self, struct sk_buff *skb,
*/
void irlap_disconnect_request(struct irlap_cb *self)
{
- DEBUG(3, __FUNCTION__ "()\n");
+ IRDA_DEBUG(3, __FUNCTION__ "()\n");
ASSERT(self != NULL, return;);
ASSERT(self->magic == LAP_MAGIC, return;);
@@ -434,7 +441,7 @@ void irlap_disconnect_request(struct irlap_cb *self)
irlap_do_event(self, DISCONNECT_REQUEST, NULL, NULL);
break;
default:
- DEBUG(2, __FUNCTION__ "(), disconnect pending!\n");
+ IRDA_DEBUG(2, __FUNCTION__ "(), disconnect pending!\n");
self->disconnect_pending = TRUE;
break;
}
@@ -448,7 +455,7 @@ void irlap_disconnect_request(struct irlap_cb *self)
*/
void irlap_disconnect_indication(struct irlap_cb *self, LAP_REASON reason)
{
- DEBUG(1, __FUNCTION__ "(), reason=%s\n", lap_reasons[reason]);
+ IRDA_DEBUG(1, __FUNCTION__ "(), reason=%s\n", lap_reasons[reason]);
ASSERT(self != NULL, return;);
ASSERT(self->magic == LAP_MAGIC, return;);
@@ -461,7 +468,7 @@ void irlap_disconnect_indication(struct irlap_cb *self, LAP_REASON reason)
switch(reason) {
case LAP_RESET_INDICATION:
- DEBUG(1, __FUNCTION__ "(), Sending reset request!\n");
+ IRDA_DEBUG(1, __FUNCTION__ "(), Sending reset request!\n");
irlap_do_event(self, RESET_REQUEST, NULL, NULL);
break;
case LAP_NO_RESPONSE: /* FALLTROUGH */
@@ -472,7 +479,7 @@ void irlap_disconnect_indication(struct irlap_cb *self, LAP_REASON reason)
reason, NULL);
break;
default:
- DEBUG(1, __FUNCTION__ "(), Reason %d not implemented!\n",
+ IRDA_DEBUG(1, __FUNCTION__ "(), Reason %d not implemented!\n",
reason);
}
}
@@ -491,7 +498,7 @@ void irlap_discovery_request(struct irlap_cb *self, discovery_t *discovery)
ASSERT(self->magic == LAP_MAGIC, return;);
ASSERT(discovery != NULL, return;);
- DEBUG(4, __FUNCTION__ "(), nslots = %d\n", discovery->nslots);
+ IRDA_DEBUG(4, __FUNCTION__ "(), nslots = %d\n", discovery->nslots);
ASSERT((discovery->nslots == 1) || (discovery->nslots == 6) ||
(discovery->nslots == 8) || (discovery->nslots == 16),
@@ -535,7 +542,7 @@ void irlap_discovery_request(struct irlap_cb *self, discovery_t *discovery)
irlap_do_event(self, DISCOVERY_REQUEST, NULL, &info);
} else {
- DEBUG(4, __FUNCTION__
+ IRDA_DEBUG(4, __FUNCTION__
"(), discovery only possible in NDM mode\n");
irlap_discovery_confirm(self, NULL);
}
@@ -559,7 +566,7 @@ void irlap_discovery_confirm(struct irlap_cb *self, hashbin_t *discovery_log)
* the media busy condition (irlap p.94). This should allow us to make
* connection attempts much easier.
*/
- if (discovery_log && hashbin_get_size(discovery_log) > 0)
+ if (discovery_log && HASHBIN_GET_SIZE(discovery_log) > 0)
irda_device_set_media_busy(self->netdev, FALSE);
/* Inform IrLMP */
@@ -574,7 +581,7 @@ void irlap_discovery_confirm(struct irlap_cb *self, hashbin_t *discovery_log)
*/
void irlap_discovery_indication(struct irlap_cb *self, discovery_t *discovery)
{
- DEBUG(4, __FUNCTION__ "()\n");
+ IRDA_DEBUG(4, __FUNCTION__ "()\n");
ASSERT(self != NULL, return;);
ASSERT(self->magic == LAP_MAGIC, return;);
@@ -595,10 +602,10 @@ void irlap_status_indication(int quality_of_link)
{
switch (quality_of_link) {
case STATUS_NO_ACTIVITY:
- printk(KERN_INFO "IrLAP, no activity on link!\n");
+ MESSAGE("IrLAP, no activity on link!\n");
break;
case STATUS_NOISY:
- printk(KERN_INFO "IrLAP, noisy link!\n");
+ MESSAGE("IrLAP, noisy link!\n");
break;
default:
break;
@@ -614,7 +621,7 @@ void irlap_status_indication(int quality_of_link)
*/
void irlap_reset_indication(struct irlap_cb *self)
{
- DEBUG(1, __FUNCTION__ "()\n");
+ IRDA_DEBUG(1, __FUNCTION__ "()\n");
ASSERT(self != NULL, return;);
ASSERT(self->magic == LAP_MAGIC, return;);
@@ -633,7 +640,7 @@ void irlap_reset_indication(struct irlap_cb *self)
*/
void irlap_reset_confirm(void)
{
- DEBUG(1, __FUNCTION__ "()\n");
+ IRDA_DEBUG(1, __FUNCTION__ "()\n");
}
/*
@@ -728,7 +735,7 @@ int irlap_validate_nr_received(struct irlap_cb *self, int nr)
{
/* nr as expected? */
if (nr == self->vs) {
- DEBUG(4, __FUNCTION__ "(), expected!\n");
+ IRDA_DEBUG(4, __FUNCTION__ "(), expected!\n");
return NR_EXPECTED;
}
@@ -756,7 +763,7 @@ int irlap_validate_nr_received(struct irlap_cb *self, int nr)
*/
void irlap_initiate_connection_state(struct irlap_cb *self)
{
- DEBUG(4, __FUNCTION__ "()\n");
+ IRDA_DEBUG(4, __FUNCTION__ "()\n");
ASSERT(self != NULL, return;);
ASSERT(self->magic == LAP_MAGIC, return;);
@@ -783,9 +790,9 @@ void irlap_initiate_connection_state(struct irlap_cb *self)
*/
void irlap_wait_min_turn_around(struct irlap_cb *self, struct qos_info *qos)
{
- int usecs;
- int speed;
- int bytes ;
+ __u32 speed;
+ __u32 usecs;
+ __u32 bytes ;
/* Get QoS values. */
speed = qos->baud_rate.value;
@@ -844,25 +851,12 @@ void irlap_flush_all_queues(struct irlap_cb *self)
*/
void irlap_change_speed(struct irlap_cb *self, __u32 speed)
{
- struct ifreq req;
-
- DEBUG(4, __FUNCTION__ "(), setting speed to %d\n", speed);
+ IRDA_DEBUG(4, __FUNCTION__ "(), setting speed to %d\n", speed);
ASSERT(self != NULL, return;);
ASSERT(self->magic == LAP_MAGIC, return;);
- if (!self->netdev) {
- DEBUG(1, __FUNCTION__ "(), driver missing!\n");
- return;
- }
-
- /*
- * Warning, ifr_bandwidth is only 16 bits on architectures where ints
- * are 16 bits wide.
- */
- req.ifr_bandwidth = speed;
- self->netdev->do_ioctl(self->netdev, &req, SIOCSBANDWIDTH);
-
+ /* Must use the same speed in both directions */
self->qos_rx.baud_rate.value = speed;
self->qos_tx.baud_rate.value = speed;
}
@@ -883,24 +877,24 @@ void irlap_init_comp_qos_capabilities(struct irlap_cb *self)
* actually been loaded. Ths is sort of hairy code but that is what
* you get when you do a little bit flicking :-)
*/
- DEBUG(4, __FUNCTION__ "(), comp bits 0x%02x\n",
+ IRDA_DEBUG(4, __FUNCTION__ "(), comp bits 0x%02x\n",
self->qos_rx.compression.bits);
mask = 0x80; /* Start with testing MSB */
for (i=0;i<8;i++) {
- DEBUG(4, __FUNCTION__ "(), testing bit %d\n", 8-i);
+ IRDA_DEBUG(4, __FUNCTION__ "(), testing bit %d\n", 8-i);
if (self->qos_rx.compression.bits & mask) {
- DEBUG(4, __FUNCTION__ "(), bit %d is set by defalt\n",
+ IRDA_DEBUG(4, __FUNCTION__ "(), bit %d is set by defalt\n",
8-i);
comp = hashbin_find(irlap_compressors,
compression[ msb_index(mask)],
NULL);
if (!comp) {
/* Protocol not supported, so clear the bit */
- DEBUG(4, __FUNCTION__ "(), Compression "
+ IRDA_DEBUG(4, __FUNCTION__ "(), Compression "
"protocol %d has not been loaded!\n",
compression[msb_index(mask)]);
self->qos_rx.compression.bits &= ~mask;
- DEBUG(4, __FUNCTION__
+ IRDA_DEBUG(4, __FUNCTION__
"(), comp bits 0x%02x\n",
self->qos_rx.compression.bits);
}
@@ -934,8 +928,7 @@ void irlap_init_qos_capabilities(struct irlap_cb *self,
#endif
/* Apply drivers QoS capabilities */
- irda_qos_compute_intersection(&self->qos_rx,
- irda_device_get_qos(self->netdev));
+ irda_qos_compute_intersection(&self->qos_rx, self->qos_dev);
/*
* Check for user supplied QoS parameters. The service user is only
@@ -943,7 +936,7 @@ void irlap_init_qos_capabilities(struct irlap_cb *self,
* user may not have set all of them.
*/
if (qos_user) {
- DEBUG(1, __FUNCTION__ "(), Found user specified QoS!\n");
+ IRDA_DEBUG(1, __FUNCTION__ "(), Found user specified QoS!\n");
if (qos_user->baud_rate.bits)
self->qos_rx.baud_rate.bits &= qos_user->baud_rate.bits;
@@ -986,7 +979,7 @@ void irlap_init_qos_capabilities(struct irlap_cb *self,
*/
void irlap_apply_default_connection_parameters(struct irlap_cb *self)
{
- DEBUG(4, __FUNCTION__ "()\n");
+ IRDA_DEBUG(4, __FUNCTION__ "()\n");
ASSERT(self != NULL, return;);
ASSERT(self->magic == LAP_MAGIC, return;);
@@ -1019,7 +1012,7 @@ void irlap_apply_default_connection_parameters(struct irlap_cb *self)
void irlap_apply_connection_parameters(struct irlap_cb *self,
struct qos_info *qos)
{
- DEBUG(4, __FUNCTION__ "()\n");
+ IRDA_DEBUG(4, __FUNCTION__ "()\n");
ASSERT(self != NULL, return;);
ASSERT(self->magic == LAP_MAGIC, return;);
@@ -1036,7 +1029,7 @@ void irlap_apply_connection_parameters(struct irlap_cb *self,
*/
self->window_bytes = qos->baud_rate.value
* qos->max_turn_time.value / 10000;
- DEBUG(4, "Setting window_bytes = %d\n", self->window_bytes);
+ IRDA_DEBUG(4, "Setting window_bytes = %d\n", self->window_bytes);
/*
* Set N1 to 0 if Link Disconnect/Threshold Time = 3 and set it to
@@ -1049,10 +1042,10 @@ void irlap_apply_connection_parameters(struct irlap_cb *self,
else
self->N1 = 3000 / qos->max_turn_time.value;
- DEBUG(4, "Setting N1 = %d\n", self->N1);
+ IRDA_DEBUG(4, "Setting N1 = %d\n", self->N1);
self->N2 = qos->link_disc_time.value * 1000 / qos->max_turn_time.value;
- DEBUG(4, "Setting N2 = %d\n", self->N2);
+ IRDA_DEBUG(4, "Setting N2 = %d\n", self->N2);
/*
* Initialize timeout values, some of the rules are listed on
@@ -1064,7 +1057,7 @@ void irlap_apply_connection_parameters(struct irlap_cb *self,
#ifdef CONFIG_IRDA_COMPRESSION
if (qos->compression.value) {
- DEBUG(1, __FUNCTION__ "(), Initializing compression\n");
+ IRDA_DEBUG(1, __FUNCTION__ "(), Initializing compression\n");
irda_set_compression(self, qos->compression.value);
irlap_compressor_init(self, 0);
@@ -1080,14 +1073,14 @@ void irlap_apply_connection_parameters(struct irlap_cb *self,
*/
void irlap_set_local_busy(struct irlap_cb *self, int status)
{
- DEBUG(0, __FUNCTION__ "()\n");
+ IRDA_DEBUG(0, __FUNCTION__ "()\n");
self->local_busy = status;
if (status)
- DEBUG(0, __FUNCTION__ "(), local busy ON\n");
+ IRDA_DEBUG(0, __FUNCTION__ "(), local busy ON\n");
else
- DEBUG(0, __FUNCTION__ "(), local busy OFF\n");
+ IRDA_DEBUG(0, __FUNCTION__ "(), local busy OFF\n");
}
#ifdef CONFIG_PROC_FS
diff --git a/net/irda/irlap_comp.c b/net/irda/irlap_comp.c
index 299d1705c..942949ac8 100644
--- a/net/irda/irlap_comp.c
+++ b/net/irda/irlap_comp.c
@@ -6,7 +6,7 @@
* Status: Experimental.
* Author: Dag Brattli <dagb@cs.uit.no>
* Created at: Fri Oct 9 09:18:07 1998
- * Modified at: Sun May 9 11:37:06 1999
+ * Modified at: Tue Oct 5 11:34:52 1999
* Modified by: Dag Brattli <dagb@cs.uit.no>
* Modified at: Fri May 28 3:11 CST 1999
* Modified by: Horst von Brand <vonbrand@sleipnir.valparaiso.cl>
@@ -45,11 +45,11 @@ int irda_register_compressor( struct compressor *cp)
{
struct irda_compressor *new;
- DEBUG( 4, __FUNCTION__ "()\n");
+ IRDA_DEBUG( 4, __FUNCTION__ "()\n");
/* Check if this compressor has been registred before */
if ( hashbin_find ( irlap_compressors, cp->compress_proto, NULL)) {
- DEBUG( 0, __FUNCTION__ "(), Compressor already registered\n");
+ IRDA_DEBUG( 0, __FUNCTION__ "(), Compressor already registered\n");
return 0;
}
@@ -63,7 +63,7 @@ int irda_register_compressor( struct compressor *cp)
new->cp = cp;
/* Insert IrDA compressor into hashbin */
- hashbin_insert( irlap_compressors, (QUEUE *) new, cp->compress_proto,
+ hashbin_insert( irlap_compressors, (queue_t *) new, cp->compress_proto,
NULL);
return 0;
@@ -79,11 +79,11 @@ void irda_unregister_compressor ( struct compressor *cp)
{
struct irda_compressor *node;
- DEBUG( 4, __FUNCTION__ "()\n");
+ IRDA_DEBUG( 4, __FUNCTION__ "()\n");
node = hashbin_remove( irlap_compressors, cp->compress_proto, NULL);
if ( !node) {
- DEBUG( 0, __FUNCTION__ "(), compressor not found!\n");
+ IRDA_DEBUG( 0, __FUNCTION__ "(), compressor not found!\n");
return;
}
kfree( node);
@@ -102,7 +102,7 @@ int irda_set_compression( struct irlap_cb *self, int proto)
__u8 options[CILEN_DEFLATE];
- DEBUG( 4, __FUNCTION__ "()\n");
+ IRDA_DEBUG( 4, __FUNCTION__ "()\n");
ASSERT( self != NULL, return -ENODEV;);
ASSERT( self->magic == LAP_MAGIC, return -EBADR;);
@@ -115,7 +115,7 @@ int irda_set_compression( struct irlap_cb *self, int proto)
comp = hashbin_find( irlap_compressors, proto, NULL);
if ( !comp) {
- DEBUG( 0, __FUNCTION__ "(), Unable to find compressor\n");
+ IRDA_DEBUG( 0, __FUNCTION__ "(), Unable to find compressor\n");
return -1;
}
@@ -130,7 +130,7 @@ int irda_set_compression( struct irlap_cb *self, int proto)
self->compressor.cp = cp;
self->compressor.state = cp->comp_alloc( options, sizeof( options));
if ( self->compressor.state == NULL) {
- DEBUG( 0, __FUNCTION__ "(), Failed!\n");
+ IRDA_DEBUG( 0, __FUNCTION__ "(), Failed!\n");
return -ENOBUFS;
}
@@ -145,7 +145,7 @@ int irda_set_compression( struct irlap_cb *self, int proto)
self->decompressor.cp = cp;
self->decompressor.state = cp->decomp_alloc( options, sizeof( options));
if ( self->decompressor.state == NULL) {
- DEBUG( 0, __FUNCTION__ "(), Failed!\n");
+ IRDA_DEBUG( 0, __FUNCTION__ "(), Failed!\n");
return -ENOBUFS;
}
return 0;
@@ -159,7 +159,7 @@ int irda_set_compression( struct irlap_cb *self, int proto)
*/
void irda_free_compression( struct irlap_cb *self)
{
- DEBUG( 4, __FUNCTION__ "()\n");
+ IRDA_DEBUG( 4, __FUNCTION__ "()\n");
if ( self->compressor.state) {
irda_comp_free( self->compressor.state);
@@ -183,7 +183,7 @@ void irlap_compressor_init( struct irlap_cb *self, int compress)
int debug = TRUE;
__u8 options[CILEN_DEFLATE];
- DEBUG(4, __FUNCTION__ "()\n");
+ IRDA_DEBUG(4, __FUNCTION__ "()\n");
ASSERT( self != NULL, return;);
ASSERT( self->magic == LAP_MAGIC, return;);
@@ -198,7 +198,7 @@ void irlap_compressor_init( struct irlap_cb *self, int compress)
* We're agreeing to send compressed packets.
*/
if ( self->compressor.state == NULL) {
- DEBUG( 0, __FUNCTION__ "(), state == NULL\n");
+ IRDA_DEBUG( 0, __FUNCTION__ "(), state == NULL\n");
return;
}
@@ -206,7 +206,7 @@ void irlap_compressor_init( struct irlap_cb *self, int compress)
options, sizeof( options),
0, 0, debug))
{
- DEBUG( 0, __FUNCTION__ "(), Compressor running!\n");
+ IRDA_DEBUG( 0, __FUNCTION__ "(), Compressor running!\n");
/* ppp->flags |= SC_COMP_RUN; */
}
@@ -214,7 +214,7 @@ void irlap_compressor_init( struct irlap_cb *self, int compress)
* Initialize decompressor
*/
if ( self->decompressor.state == NULL) {
- DEBUG( 0, __FUNCTION__ "(), state == NULL\n");
+ IRDA_DEBUG( 0, __FUNCTION__ "(), state == NULL\n");
return;
}
@@ -222,7 +222,7 @@ void irlap_compressor_init( struct irlap_cb *self, int compress)
options, sizeof( options),
0, 0, 0, debug))
{
- DEBUG( 0, __FUNCTION__ "(), Decompressor running!\n");
+ IRDA_DEBUG( 0, __FUNCTION__ "(), Decompressor running!\n");
/* ppp->flags |= SC_DECOMP_RUN; */
/* ppp->flags &= ~(SC_DC_ERROR | SC_DC_FERROR); */
@@ -243,7 +243,7 @@ struct sk_buff *irlap_compress_frame( struct irlap_cb *self,
ASSERT( skb != NULL, return NULL;);
- DEBUG(4, __FUNCTION__ "() skb->len=%d, jiffies=%ld\n", (int) skb->len,
+ IRDA_DEBUG(4, __FUNCTION__ "() skb->len=%d, jiffies=%ld\n", (int) skb->len,
jiffies);
ASSERT( self != NULL, return NULL;);
@@ -270,7 +270,7 @@ struct sk_buff *irlap_compress_frame( struct irlap_cb *self,
skb->data, new_skb->data,
skb->len, new_skb->len);
if( count <= 0) {
- DEBUG(4, __FUNCTION__ "(), Unable to compress frame!\n");
+ IRDA_DEBUG(4, __FUNCTION__ "(), Unable to compress frame!\n");
dev_kfree_skb( new_skb);
/* Tell peer that this frame is not compressed */
@@ -287,7 +287,7 @@ struct sk_buff *irlap_compress_frame( struct irlap_cb *self,
dev_kfree_skb( skb);
- DEBUG(4, __FUNCTION__ "() new_skb->len=%d\n, jiffies=%ld",
+ IRDA_DEBUG(4, __FUNCTION__ "() new_skb->len=%d\n, jiffies=%ld",
(int) new_skb->len, jiffies);
return new_skb;
@@ -305,7 +305,7 @@ struct sk_buff *irlap_decompress_frame( struct irlap_cb *self,
struct sk_buff *new_skb;
int count;
- DEBUG( 4, __FUNCTION__ "() skb->len=%d\n", (int) skb->len);
+ IRDA_DEBUG( 4, __FUNCTION__ "() skb->len=%d\n", (int) skb->len);
ASSERT( self != NULL, return NULL;);
ASSERT( self->magic == LAP_MAGIC, return NULL;);
@@ -339,7 +339,7 @@ struct sk_buff *irlap_decompress_frame( struct irlap_cb *self,
count = irda_decompress( self->decompressor.state, skb->data,
skb->len, new_skb->data, new_skb->len);
if ( count <= 0) {
- DEBUG( 4, __FUNCTION__ "(), Unable to decompress frame!\n");
+ IRDA_DEBUG( 4, __FUNCTION__ "(), Unable to decompress frame!\n");
dev_kfree_skb( new_skb);
return skb;
@@ -347,7 +347,7 @@ struct sk_buff *irlap_decompress_frame( struct irlap_cb *self,
skb_trim( new_skb, count);
- DEBUG( 4, __FUNCTION__ "() new_skb->len=%d\n", (int) new_skb->len);
+ IRDA_DEBUG( 4, __FUNCTION__ "() new_skb->len=%d\n", (int) new_skb->len);
return new_skb;
}
diff --git a/net/irda/irlap_event.c b/net/irda/irlap_event.c
index 203b7360f..fa9369863 100644
--- a/net/irda/irlap_event.c
+++ b/net/irda/irlap_event.c
@@ -6,7 +6,7 @@
* Status: Experimental.
* Author: Dag Brattli <dagb@cs.uit.no>
* Created at: Sat Aug 16 00:59:29 1997
- * Modified at: Mon Sep 20 12:30:31 1999
+ * Modified at: Sun Oct 10 11:14:22 1999
* Modified by: Dag Brattli <dagb@cs.uit.no>
*
* Copyright (c) 1998-1999 Dag Brattli <dagb@cs.uit.no>,
@@ -200,7 +200,7 @@ void irlap_start_poll_timer(struct irlap_cb *self, int timeout)
} else
self->fast_RR = FALSE;
- DEBUG(4, __FUNCTION__ "(), Timeout=%d\n", timeout);
+ IRDA_DEBUG(4, __FUNCTION__ "(), Timeout=%d\n", timeout);
#endif
if (timeout == 0)
irlap_do_event(self, POLL_TIMER_EXPIRED, NULL, NULL);
@@ -223,7 +223,7 @@ void irlap_do_event(struct irlap_cb *self, IRLAP_EVENT event,
if (!self || self->magic != LAP_MAGIC)
return;
- DEBUG(4, __FUNCTION__ "(), event = %s, state = %s\n",
+ IRDA_DEBUG(4, __FUNCTION__ "(), event = %s, state = %s\n",
irlap_event[event], irlap_state[self->state]);
ret = (*state[self->state])(self, event, skb, info);
@@ -256,9 +256,7 @@ void irlap_do_event(struct irlap_cb *self, IRLAP_EVENT event,
break;
case LAP_NDM:
/* Check if we should try to connect */
- if ((self->connect_pending) &&
- !irda_device_is_media_busy(self->netdev))
- {
+ if ((self->connect_pending) && !self->media_busy) {
self->connect_pending = FALSE;
ret = (*state[self->state])(self, CONNECT_REQUEST,
@@ -284,7 +282,7 @@ void irlap_next_state(struct irlap_cb *self, IRLAP_STATE state)
if (!self || self->magic != LAP_MAGIC)
return;
- DEBUG(4, "next LAP state = %s\n", irlap_state[ state]);
+ IRDA_DEBUG(4, "next LAP state = %s\n", irlap_state[ state]);
self->state = state;
@@ -317,8 +315,8 @@ static int irlap_state_ndm(struct irlap_cb *self, IRLAP_EVENT event,
case CONNECT_REQUEST:
ASSERT(self->netdev != NULL, return -1;);
- if (irda_device_is_media_busy(self->netdev)) {
- DEBUG(0, __FUNCTION__
+ if (self->media_busy) {
+ IRDA_DEBUG(0, __FUNCTION__
"(), CONNECT_REQUEST: media busy!\n");
/* Always switch state before calling upper layers */
@@ -345,7 +343,7 @@ static int irlap_state_ndm(struct irlap_cb *self, IRLAP_EVENT event,
irlap_connect_indication(self, skb);
} else {
- DEBUG(0, __FUNCTION__ "(), SNRM frame does not contain"
+ IRDA_DEBUG(0, __FUNCTION__ "(), SNRM frame does not contain"
" and I field!\n");
dev_kfree_skb(skb);
}
@@ -353,8 +351,8 @@ static int irlap_state_ndm(struct irlap_cb *self, IRLAP_EVENT event,
case DISCOVERY_REQUEST:
ASSERT(info != NULL, return -1;);
- if (irda_device_is_media_busy(self->netdev)) {
- DEBUG(0, __FUNCTION__ "(), media busy!\n");
+ if (self->media_busy) {
+ IRDA_DEBUG(0, __FUNCTION__ "(), media busy!\n");
/* irlap->log.condition = MEDIA_BUSY; */
/* Always switch state before calling upper layers */
@@ -382,7 +380,7 @@ static int irlap_state_ndm(struct irlap_cb *self, IRLAP_EVENT event,
/* self->daddr = info->daddr; */
self->slot = irlap_generate_rand_time_slot(info->S,
info->s);
- DEBUG(4, "XID_CMD: S=%d, s=%d, slot %d\n", info->S,
+ IRDA_DEBUG(4, "XID_CMD: S=%d, s=%d, slot %d\n", info->S,
info->s, self->slot);
if (self->slot == info->s) {
@@ -418,11 +416,11 @@ static int irlap_state_ndm(struct irlap_cb *self, IRLAP_EVENT event,
dev_kfree_skb(skb);
break;
case RECV_TEST_RSP:
- DEBUG(0, __FUNCTION__ "() not implemented!\n");
+ IRDA_DEBUG(0, __FUNCTION__ "() not implemented!\n");
dev_kfree_skb(skb);
break;
default:
- DEBUG(2, __FUNCTION__ "(), Unknown event %s\n",
+ IRDA_DEBUG(2, __FUNCTION__ "(), Unknown event %s\n",
irlap_event[event]);
if (skb)
@@ -453,7 +451,7 @@ static int irlap_state_query(struct irlap_cb *self, IRLAP_EVENT event,
ASSERT(info != NULL, return -1;);
ASSERT(info->discovery != NULL, return -1;);
- DEBUG(4, __FUNCTION__ "(), daddr=%08x\n",
+ IRDA_DEBUG(4, __FUNCTION__ "(), daddr=%08x\n",
info->discovery->daddr);
if (!self->discovery_log) {
@@ -463,7 +461,7 @@ static int irlap_state_query(struct irlap_cb *self, IRLAP_EVENT event,
break;
}
hashbin_insert(self->discovery_log,
- (QUEUE *) info->discovery,
+ (queue_t *) info->discovery,
info->discovery->daddr, NULL);
dev_kfree_skb(skb);
@@ -501,7 +499,7 @@ static int irlap_state_query(struct irlap_cb *self, IRLAP_EVENT event,
}
break;
default:
- DEBUG(2, __FUNCTION__ "(), Unknown event %d, %s\n", event,
+ IRDA_DEBUG(2, __FUNCTION__ "(), Unknown event %d, %s\n", event,
irlap_event[event]);
if (skb)
@@ -526,14 +524,14 @@ static int irlap_state_reply(struct irlap_cb *self, IRLAP_EVENT event,
discovery_t *discovery_rsp;
int ret=0;
- DEBUG(4, __FUNCTION__ "()\n");
+ IRDA_DEBUG(4, __FUNCTION__ "()\n");
ASSERT(self != NULL, return -1;);
ASSERT(self->magic == LAP_MAGIC, return -1;);
switch (event) {
case QUERY_TIMER_EXPIRED:
- DEBUG(2, __FUNCTION__ "(), QUERY_TIMER_EXPIRED <%ld>\n",
+ IRDA_DEBUG(2, __FUNCTION__ "(), QUERY_TIMER_EXPIRED <%ld>\n",
jiffies);
irlap_next_state(self, LAP_NDM);
break;
@@ -565,7 +563,7 @@ static int irlap_state_reply(struct irlap_cb *self, IRLAP_EVENT event,
dev_kfree_skb(skb);
break;
default:
- DEBUG(1, __FUNCTION__ "(), Unknown event %d, %s\n", event,
+ IRDA_DEBUG(1, __FUNCTION__ "(), Unknown event %d, %s\n", event,
irlap_event[event]);
if ( skb)
@@ -589,7 +587,7 @@ static int irlap_state_conn(struct irlap_cb *self, IRLAP_EVENT event,
{
int ret = 0;
- DEBUG(4, __FUNCTION__ "(), event=%s\n", irlap_event[ event]);
+ IRDA_DEBUG(4, __FUNCTION__ "(), event=%s\n", irlap_event[ event]);
ASSERT(self != NULL, return -1;);
ASSERT(self->magic == LAP_MAGIC, return -1;);
@@ -622,7 +620,7 @@ static int irlap_state_conn(struct irlap_cb *self, IRLAP_EVENT event,
irlap_next_state( self, LAP_NRM_S);
break;
case RECV_DISCOVERY_XID_CMD:
- DEBUG( 3, __FUNCTION__ "(), event RECV_DISCOVER_XID_CMD!\n");
+ IRDA_DEBUG( 3, __FUNCTION__ "(), event RECV_DISCOVER_XID_CMD!\n");
irlap_next_state( self, LAP_NDM);
break;
case DISCONNECT_REQUEST:
@@ -630,7 +628,7 @@ static int irlap_state_conn(struct irlap_cb *self, IRLAP_EVENT event,
irlap_next_state( self, LAP_CONN);
break;
default:
- DEBUG(1, __FUNCTION__ "(), Unknown event %d, %s\n", event,
+ IRDA_DEBUG(1, __FUNCTION__ "(), Unknown event %d, %s\n", event,
irlap_event[event]);
if (skb)
@@ -655,7 +653,7 @@ static int irlap_state_setup(struct irlap_cb *self, IRLAP_EVENT event,
{
int ret = 0;
- DEBUG(4, __FUNCTION__ "()\n");
+ IRDA_DEBUG(4, __FUNCTION__ "()\n");
ASSERT(self != NULL, return -1;);
ASSERT(self->magic == LAP_MAGIC, return -1;);
@@ -685,7 +683,7 @@ static int irlap_state_setup(struct irlap_cb *self, IRLAP_EVENT event,
break;
case RECV_SNRM_CMD:
- DEBUG(4, __FUNCTION__ "(), SNRM battle!\n");
+ IRDA_DEBUG(4, __FUNCTION__ "(), SNRM battle!\n");
ASSERT(skb != NULL, return 0;);
ASSERT(info != NULL, return 0;);
@@ -759,7 +757,7 @@ static int irlap_state_setup(struct irlap_cb *self, IRLAP_EVENT event,
/* DM handled in irlap_frame.c, irlap_driver_rcv() */
default:
- DEBUG(1, __FUNCTION__ "(), Unknown event %d, %s\n", event,
+ IRDA_DEBUG(1, __FUNCTION__ "(), Unknown event %d, %s\n", event,
irlap_event[event]);
if (skb)
@@ -780,7 +778,7 @@ static int irlap_state_setup(struct irlap_cb *self, IRLAP_EVENT event,
static int irlap_state_offline(struct irlap_cb *self, IRLAP_EVENT event,
struct sk_buff *skb, struct irlap_info *info)
{
- DEBUG( 0, __FUNCTION__ "(), Unknown event\n");
+ IRDA_DEBUG( 0, __FUNCTION__ "(), Unknown event\n");
return -1;
}
@@ -811,7 +809,7 @@ static int irlap_state_xmit_p(struct irlap_cb *self, IRLAP_EVENT event,
* speed and turn-around-time.
*/
if ((skb->len+self->bofs_count) > self->bytes_left) {
- DEBUG(4, __FUNCTION__ "(), Not allowed to "
+ IRDA_DEBUG(4, __FUNCTION__ "(), Not allowed to "
"transmit more bytes!\n");
skb_queue_head(&self->tx_list, skb);
@@ -851,7 +849,7 @@ static int irlap_state_xmit_p(struct irlap_cb *self, IRLAP_EVENT event,
self->fast_RR = FALSE;
#endif
} else {
- DEBUG(4, __FUNCTION__
+ IRDA_DEBUG(4, __FUNCTION__
"(), Unable to send! remote busy?\n");
skb_queue_head(&self->tx_list, skb);
@@ -877,7 +875,7 @@ static int irlap_state_xmit_p(struct irlap_cb *self, IRLAP_EVENT event,
irlap_next_state(self, LAP_PCLOSE);
break;
default:
- DEBUG(0, __FUNCTION__ "(), Unknown event %s\n",
+ IRDA_DEBUG(0, __FUNCTION__ "(), Unknown event %s\n",
irlap_event[event]);
if (skb)
@@ -899,7 +897,7 @@ static int irlap_state_pclose(struct irlap_cb *self, IRLAP_EVENT event,
{
int ret = 0;
- DEBUG(1, __FUNCTION__ "()\n");
+ IRDA_DEBUG(1, __FUNCTION__ "()\n");
ASSERT(self != NULL, return -1;);
ASSERT(self->magic == LAP_MAGIC, return -1;);
@@ -935,7 +933,7 @@ static int irlap_state_pclose(struct irlap_cb *self, IRLAP_EVENT event,
}
break;
default:
- DEBUG(1, __FUNCTION__ "(), Unknown event %d\n", event);
+ IRDA_DEBUG(1, __FUNCTION__ "(), Unknown event %d\n", event);
if (skb)
dev_kfree_skb(skb);
@@ -1044,7 +1042,7 @@ static int irlap_state_nrm_p(struct irlap_cb *self, IRLAP_EVENT event,
/* Keep state */
irlap_next_state(self, LAP_NRM_P);
} else {
- DEBUG( 4, __FUNCTION__
+ IRDA_DEBUG( 4, __FUNCTION__
"(), missing or duplicate frame!\n");
/* Update Nr received */
@@ -1110,7 +1108,7 @@ static int irlap_state_nrm_p(struct irlap_cb *self, IRLAP_EVENT event,
if ((ns_status == NS_UNEXPECTED) &&
(nr_status == NR_UNEXPECTED))
{
- DEBUG( 4, "IrLAP: unexpected nr and ns!\n");
+ IRDA_DEBUG( 4, "IrLAP: unexpected nr and ns!\n");
if (info->pf) {
/* Resend rejected frames */
irlap_resend_rejected_frames(self, CMD_FRAME);
@@ -1149,8 +1147,8 @@ static int irlap_state_nrm_p(struct irlap_cb *self, IRLAP_EVENT event,
}
break;
}
- DEBUG(1, __FUNCTION__ "(), Not implemented!\n");
- DEBUG(1, __FUNCTION__
+ IRDA_DEBUG(1, __FUNCTION__ "(), Not implemented!\n");
+ IRDA_DEBUG(1, __FUNCTION__
"(), event=%s, ns_status=%d, nr_status=%d\n",
irlap_event[ event], ns_status, nr_status);
break;
@@ -1204,7 +1202,7 @@ static int irlap_state_nrm_p(struct irlap_cb *self, IRLAP_EVENT event,
/* Update Nr received */
irlap_update_nr_received(self, info->nr);
- DEBUG(4, "RECV_RR_FRAME: Retrans:%d, nr=%d, va=%d, "
+ IRDA_DEBUG(4, "RECV_RR_FRAME: Retrans:%d, nr=%d, va=%d, "
"vs=%d, vr=%d\n",
self->retry_count, info->nr, self->va,
self->vs, self->vr);
@@ -1214,7 +1212,7 @@ static int irlap_state_nrm_p(struct irlap_cb *self, IRLAP_EVENT event,
irlap_next_state(self, LAP_NRM_P);
} else if (ret == NR_INVALID) {
- DEBUG(1, __FUNCTION__ "(), Received RR with "
+ IRDA_DEBUG(1, __FUNCTION__ "(), Received RR with "
"invalid nr !\n");
del_timer(&self->final_timer);
@@ -1227,7 +1225,7 @@ static int irlap_state_nrm_p(struct irlap_cb *self, IRLAP_EVENT event,
dev_kfree_skb(skb);
break;
case RECV_RNR_FRAME:
- DEBUG(4, "irlap_state_nrm_p: RECV_RNR_FRAME: Retrans:%d, "
+ IRDA_DEBUG(4, "irlap_state_nrm_p: RECV_RNR_FRAME: Retrans:%d, "
"nr=%d, va=%d, vs=%d, vr=%d\n",
self->retry_count, info->nr, self->va, self->vs,
self->vr);
@@ -1264,7 +1262,7 @@ static int irlap_state_nrm_p(struct irlap_cb *self, IRLAP_EVENT event,
* we only do this once for each frame.
*/
if (irda_device_is_receiving(self->netdev) && !self->add_wait) {
- DEBUG(4, "FINAL_TIMER_EXPIRED when receiving a "
+ IRDA_DEBUG(4, "FINAL_TIMER_EXPIRED when receiving a "
"frame! Waiting a little bit more!\n");
irlap_start_final_timer(self, MSECS_TO_JIFFIES(300));
@@ -1287,7 +1285,7 @@ static int irlap_state_nrm_p(struct irlap_cb *self, IRLAP_EVENT event,
irlap_start_final_timer(self, self->final_timeout);
self->retry_count++;
- DEBUG(4, "irlap_state_nrm_p: FINAL_TIMER_EXPIRED:"
+ IRDA_DEBUG(4, "irlap_state_nrm_p: FINAL_TIMER_EXPIRED:"
" retry_count=%d\n", self->retry_count);
/* Keep state */
} else if (self->retry_count == self->N1) {
@@ -1298,7 +1296,7 @@ static int irlap_state_nrm_p(struct irlap_cb *self, IRLAP_EVENT event,
irlap_start_final_timer(self, self->final_timeout);
self->retry_count++;
- DEBUG(4, "retry count = N1; retry_count=%d\n",
+ IRDA_DEBUG(4, "retry count = N1; retry_count=%d\n",
self->retry_count);
/* Keep state */
} else if (self->retry_count >= self->N2) {
@@ -1310,7 +1308,7 @@ static int irlap_state_nrm_p(struct irlap_cb *self, IRLAP_EVENT event,
}
break;
case RECV_DISC_FRAME: /* FIXME: Check how this is in the standard! */
- DEBUG(1, __FUNCTION__ "(), RECV_DISC_FRAME()\n");
+ IRDA_DEBUG(1, __FUNCTION__ "(), RECV_DISC_FRAME()\n");
/* Always switch state before calling upper layers */
irlap_next_state(self, LAP_NDM);
@@ -1330,7 +1328,7 @@ static int irlap_state_nrm_p(struct irlap_cb *self, IRLAP_EVENT event,
break;
default:
- DEBUG(1, __FUNCTION__ "(), Unknown event %s\n",
+ IRDA_DEBUG(1, __FUNCTION__ "(), Unknown event %s\n",
irlap_event[event]);
if (skb)
@@ -1354,7 +1352,7 @@ static int irlap_state_reset_wait(struct irlap_cb *self, IRLAP_EVENT event,
{
int ret = 0;
- DEBUG(3, __FUNCTION__ "(), event = %s\n", irlap_event[event]);
+ IRDA_DEBUG(3, __FUNCTION__ "(), event = %s\n", irlap_event[event]);
ASSERT(self != NULL, return -1;);
ASSERT(self->magic == LAP_MAGIC, return -1;);
@@ -1380,7 +1378,7 @@ static int irlap_state_reset_wait(struct irlap_cb *self, IRLAP_EVENT event,
irlap_next_state( self, LAP_PCLOSE);
break;
default:
- DEBUG(1, __FUNCTION__ "(), Unknown event %s\n",
+ IRDA_DEBUG(1, __FUNCTION__ "(), Unknown event %s\n",
irlap_event[event]);
if (skb)
dev_kfree_skb(skb);
@@ -1403,7 +1401,7 @@ static int irlap_state_reset(struct irlap_cb *self, IRLAP_EVENT event,
{
int ret = 0;
- DEBUG(3, __FUNCTION__ "(), event = %s\n", irlap_event[event]);
+ IRDA_DEBUG(3, __FUNCTION__ "(), event = %s\n", irlap_event[event]);
ASSERT(self != NULL, return -1;);
ASSERT(self->magic == LAP_MAGIC, return -1;);
@@ -1438,7 +1436,7 @@ static int irlap_state_reset(struct irlap_cb *self, IRLAP_EVENT event,
irlap_wait_min_turn_around(self, &self->qos_tx);
ASSERT(self->netdev != NULL, return -1;);
- irlap_send_snrm_frame(self, irda_device_get_qos(self->netdev));
+ irlap_send_snrm_frame(self, self->qos_dev);
self->retry_count++; /* Experimental!! */
@@ -1459,7 +1457,7 @@ static int irlap_state_reset(struct irlap_cb *self, IRLAP_EVENT event,
* state
*/
if (!info) {
- DEBUG(3, __FUNCTION__ "(), RECV_SNRM_CMD\n");
+ IRDA_DEBUG(3, __FUNCTION__ "(), RECV_SNRM_CMD\n");
irlap_initiate_connection_state(self);
irlap_wait_min_turn_around(self, &self->qos_tx);
irlap_send_ua_response_frame(self, &self->qos_rx);
@@ -1467,13 +1465,13 @@ static int irlap_state_reset(struct irlap_cb *self, IRLAP_EVENT event,
irlap_start_wd_timer(self, self->wd_timeout);
irlap_next_state(self, LAP_NDM);
} else {
- DEBUG(0, __FUNCTION__ "(), SNRM frame contained an I "
+ IRDA_DEBUG(0, __FUNCTION__ "(), SNRM frame contained an I "
"field!\n");
dev_kfree_skb(skb);
}
break;
default:
- DEBUG(1, __FUNCTION__ "(), Unknown event %s\n",
+ IRDA_DEBUG(1, __FUNCTION__ "(), Unknown event %s\n",
irlap_event[event]);
if (skb)
@@ -1497,7 +1495,7 @@ static int irlap_state_xmit_s(struct irlap_cb *self, IRLAP_EVENT event,
{
int ret = 0;
- DEBUG(4, __FUNCTION__ "(), event=%s\n", irlap_event[ event]);
+ IRDA_DEBUG(4, __FUNCTION__ "(), event=%s\n", irlap_event[ event]);
ASSERT(self != NULL, return -ENODEV;);
ASSERT(self->magic == LAP_MAGIC, return -EBADR;);
@@ -1547,13 +1545,13 @@ static int irlap_state_xmit_s(struct irlap_cb *self, IRLAP_EVENT event,
ret = -EPROTO;
}
} else {
- DEBUG(1, __FUNCTION__ "(), Unable to send!\n");
+ IRDA_DEBUG(1, __FUNCTION__ "(), Unable to send!\n");
skb_queue_head( &self->tx_list, skb);
ret = -EPROTO;
}
break;
default:
- DEBUG(1, __FUNCTION__ "(), Unknown event %s\n",
+ IRDA_DEBUG(1, __FUNCTION__ "(), Unknown event %s\n",
irlap_event[event]);
if (skb)
dev_kfree_skb(skb);
@@ -1578,7 +1576,7 @@ static int irlap_state_nrm_s(struct irlap_cb *self, IRLAP_EVENT event,
int nr_status;
int ret = 0;
- DEBUG(4, __FUNCTION__ "(), event=%s\n", irlap_event[ event]);
+ IRDA_DEBUG(4, __FUNCTION__ "(), event=%s\n", irlap_event[ event]);
ASSERT(self != NULL, return -1;);
ASSERT(self->magic == LAP_MAGIC, return -1;);
@@ -1586,7 +1584,7 @@ static int irlap_state_nrm_s(struct irlap_cb *self, IRLAP_EVENT event,
switch (event) {
case RECV_I_CMD: /* Optimize for the common case */
/* FIXME: must check for remote_busy below */
- DEBUG(4, __FUNCTION__ "(), event=%s nr=%d, vs=%d, ns=%d, "
+ IRDA_DEBUG(4, __FUNCTION__ "(), event=%s nr=%d, vs=%d, ns=%d, "
"vr=%d, pf=%d\n", irlap_event[event], info->nr,
self->vs, info->ns, self->vr, info->pf);
@@ -1690,7 +1688,7 @@ static int irlap_state_nrm_s(struct irlap_cb *self, IRLAP_EVENT event,
if ((ns_status == NS_EXPECTED) && (nr_status == NR_UNEXPECTED))
{
if (info->pf) {
- DEBUG(4, "RECV_I_RSP: frame(s) lost\n");
+ IRDA_DEBUG(4, "RECV_I_RSP: frame(s) lost\n");
self->vr = (self->vr + 1) % 8;
@@ -1726,10 +1724,10 @@ static int irlap_state_nrm_s(struct irlap_cb *self, IRLAP_EVENT event,
}
if (ret == NR_INVALID) {
- DEBUG(0, "NRM_S, NR_INVALID not implemented!\n");
+ IRDA_DEBUG(0, "NRM_S, NR_INVALID not implemented!\n");
}
if (ret == NS_INVALID) {
- DEBUG(0, "NRM_S, NS_INVALID not implemented!\n");
+ IRDA_DEBUG(0, "NRM_S, NS_INVALID not implemented!\n");
}
break;
case RECV_UI_FRAME:
@@ -1805,7 +1803,7 @@ static int irlap_state_nrm_s(struct irlap_cb *self, IRLAP_EVENT event,
/* Keep state */
irlap_next_state(self, LAP_NRM_S);
} else {
- DEBUG(1, __FUNCTION__ "(), invalid nr not implemented!\n");
+ IRDA_DEBUG(1, __FUNCTION__ "(), invalid nr not implemented!\n");
}
if (skb)
dev_kfree_skb(skb);
@@ -1815,12 +1813,12 @@ static int irlap_state_nrm_s(struct irlap_cb *self, IRLAP_EVENT event,
/* SNRM frame is not allowed to contain an I-field */
if (!info) {
del_timer(&self->wd_timer);
- DEBUG(1, __FUNCTION__ "(), received SNRM cmd\n");
+ IRDA_DEBUG(1, __FUNCTION__ "(), received SNRM cmd\n");
irlap_next_state(self, LAP_RESET_CHECK);
irlap_reset_indication(self);
} else {
- DEBUG(0, __FUNCTION__ "(), SNRM frame contained an "
+ IRDA_DEBUG(0, __FUNCTION__ "(), SNRM frame contained an "
"I-field!\n");
dev_kfree_skb(skb);
}
@@ -1830,7 +1828,7 @@ static int irlap_state_nrm_s(struct irlap_cb *self, IRLAP_EVENT event,
* Wait until retry_count * n matches negotiated threshold/
* disconnect time (note 2 in IrLAP p. 82)
*/
- DEBUG(1, __FUNCTION__ "(), retry_count = %d\n",
+ IRDA_DEBUG(1, __FUNCTION__ "(), retry_count = %d\n",
self->retry_count);
if ((self->retry_count < (self->N2/2)) &&
@@ -1885,7 +1883,7 @@ static int irlap_state_nrm_s(struct irlap_cb *self, IRLAP_EVENT event,
dev_kfree_skb(skb);
break;
default:
- DEBUG(1, __FUNCTION__ "(), Unknown event %d, (%s)\n",
+ IRDA_DEBUG(1, __FUNCTION__ "(), Unknown event %d, (%s)\n",
event, irlap_event[event]);
ret = -1;
break;
@@ -1902,7 +1900,7 @@ static int irlap_state_nrm_s(struct irlap_cb *self, IRLAP_EVENT event,
static int irlap_state_sclose( struct irlap_cb *self, IRLAP_EVENT event,
struct sk_buff *skb, struct irlap_info *info)
{
- DEBUG( 0, __FUNCTION__ "(), Not implemented!\n");
+ IRDA_DEBUG( 0, __FUNCTION__ "(), Not implemented!\n");
return -1;
}
@@ -1913,7 +1911,7 @@ static int irlap_state_reset_check( struct irlap_cb *self, IRLAP_EVENT event,
{
int ret = 0;
- DEBUG(1, __FUNCTION__ "(), event=%s\n", irlap_event[ event]);
+ IRDA_DEBUG(1, __FUNCTION__ "(), event=%s\n", irlap_event[ event]);
ASSERT( self != NULL, return -ENODEV;);
ASSERT( self->magic == LAP_MAGIC, return -EBADR;);
@@ -1933,7 +1931,7 @@ static int irlap_state_reset_check( struct irlap_cb *self, IRLAP_EVENT event,
irlap_start_wd_timer( self, WD_TIMEOUT);
break;
default:
- DEBUG(1, __FUNCTION__ "(), Unknown event %d, (%s)\n",
+ IRDA_DEBUG(1, __FUNCTION__ "(), Unknown event %d, (%s)\n",
event, irlap_event[event]);
ret = -1;
break;
diff --git a/net/irda/irlap_frame.c b/net/irda/irlap_frame.c
index 303bc3b12..160690889 100644
--- a/net/irda/irlap_frame.c
+++ b/net/irda/irlap_frame.c
@@ -6,7 +6,7 @@
* Status: Experimental.
* Author: Dag Brattli <dagb@cs.uit.no>
* Created at: Tue Aug 19 10:27:26 1997
- * Modified at: Tue Sep 28 08:49:58 1999
+ * Modified at: Sat Oct 9 09:42:11 1999
* Modified by: Dag Brattli <dagb@cs.uit.no>
*
* Copyright (c) 1998-1999 Dag Brattli <dagb@cs.uit.no>,
@@ -43,23 +43,25 @@
#include <net/irda/qos.h>
/*
- * Function irlap_insert_mtt (self, skb)
+ * Function irlap_insert_info (self, skb)
*
- * Insert minimum turnaround time relevant information into the skb. We
+ * Insert minimum turnaround time and speed information into the skb. We
* need to do this since it's per packet relevant information.
*
*/
-static inline void irlap_insert_mtt(struct irlap_cb *self, struct sk_buff *skb)
+static inline void irlap_insert_info(struct irlap_cb *self,
+ struct sk_buff *skb)
{
struct irda_skb_cb *cb = (struct irda_skb_cb *) skb->cb;
- /*
- * Insert MTT (min. turn time) into skb, so that the device driver
- * knows which MTT to use
- */
+ /*
+ * Insert MTT (min. turn time) and speed into skb, so that the
+ * device driver knows which settings to use
+ */
cb->magic = LAP_MAGIC;
cb->mtt = self->mtt_required;
-
+ cb->speed = self->qos_tx.baud_rate.value;
+
/* Reset */
self->mtt_required = 0;
@@ -94,10 +96,9 @@ void irlap_queue_xmit(struct irlap_cb *self, struct sk_buff *skb)
skb->protocol = htons(ETH_P_IRDA);
skb->priority = TC_PRIO_BESTEFFORT;
- irlap_insert_mtt(self, skb);
+ irlap_insert_info(self, skb);
dev_queue_xmit(skb);
- self->stats.tx_packets++;
}
/*
@@ -169,7 +170,7 @@ static void irlap_recv_snrm_cmd(struct irlap_cb *self, struct sk_buff *skb,
/* Check if the new connection address is valid */
if ((info->caddr == 0x00) || (info->caddr == 0xfe)) {
- DEBUG(3, __FUNCTION__
+ IRDA_DEBUG(3, __FUNCTION__
"(), invalid connection address!\n");
dev_kfree_skb(skb);
return;
@@ -181,7 +182,7 @@ static void irlap_recv_snrm_cmd(struct irlap_cb *self, struct sk_buff *skb,
/* Only accept if addressed directly to us */
if (info->saddr != self->saddr) {
- DEBUG(2, __FUNCTION__ "(), not addressed to us!\n");
+ IRDA_DEBUG(2, __FUNCTION__ "(), not addressed to us!\n");
dev_kfree_skb(skb);
return;
}
@@ -203,7 +204,7 @@ void irlap_send_ua_response_frame(struct irlap_cb *self, struct qos_info *qos)
struct ua_frame *frame;
int ret;
- DEBUG(2, __FUNCTION__ "() <%ld>\n", jiffies);
+ IRDA_DEBUG(2, __FUNCTION__ "() <%ld>\n", jiffies);
ASSERT(self != NULL, return;);
ASSERT(self->magic == LAP_MAGIC, return;);
@@ -280,7 +281,7 @@ void irlap_send_disc_frame(struct irlap_cb *self)
struct sk_buff *skb = NULL;
__u8 *frame;
- DEBUG(3, __FUNCTION__ "()\n");
+ IRDA_DEBUG(3, __FUNCTION__ "()\n");
ASSERT(self != NULL, return;);
ASSERT(self->magic == LAP_MAGIC, return;);
@@ -312,7 +313,7 @@ void irlap_send_discovery_xid_frame(struct irlap_cb *self, int S, __u8 s,
__u32 bcast = BROADCAST;
__u8 *info;
- DEBUG(4, __FUNCTION__ "(), s=%d, S=%d, command=%d\n", s, S, command);
+ IRDA_DEBUG(4, __FUNCTION__ "(), s=%d, S=%d, command=%d\n", s, S, command);
ASSERT(self != NULL, return;);
ASSERT(self->magic == LAP_MAGIC, return;);
@@ -404,7 +405,7 @@ static void irlap_recv_discovery_xid_rsp(struct irlap_cb *self,
__u8 *discovery_info;
char *text;
- DEBUG(4, __FUNCTION__ "()\n");
+ IRDA_DEBUG(4, __FUNCTION__ "()\n");
ASSERT(self != NULL, return;);
ASSERT(self->magic == LAP_MAGIC, return;);
@@ -417,7 +418,7 @@ static void irlap_recv_discovery_xid_rsp(struct irlap_cb *self,
/* Make sure frame is addressed to us */
if ((info->saddr != self->saddr) && (info->saddr != BROADCAST)) {
dev_kfree_skb(skb);
- DEBUG(0, __FUNCTION__ "(), frame is not addressed to us!\n");
+ IRDA_DEBUG(0, __FUNCTION__ "(), frame is not addressed to us!\n");
return;
}
@@ -431,14 +432,14 @@ static void irlap_recv_discovery_xid_rsp(struct irlap_cb *self,
discovery->saddr = self->saddr;
discovery->timestamp = jiffies;
- DEBUG(4, __FUNCTION__ "(), daddr=%08x\n", discovery->daddr);
+ IRDA_DEBUG(4, __FUNCTION__ "(), daddr=%08x\n", discovery->daddr);
discovery_info = skb_pull(skb, sizeof(struct xid_frame));
/* Get info returned from peer */
discovery->hints.byte[0] = discovery_info[0];
if (discovery_info[0] & HINT_EXTENSION) {
- DEBUG(4, "EXTENSION\n");
+ IRDA_DEBUG(4, "EXTENSION\n");
discovery->hints.byte[1] = discovery_info[1];
discovery->charset = discovery_info[2];
text = (char *) &discovery_info[3];
@@ -482,7 +483,7 @@ static void irlap_recv_discovery_xid_cmd(struct irlap_cb *self,
/* Make sure frame is addressed to us */
if ((info->saddr != self->saddr) && (info->saddr != BROADCAST)) {
- DEBUG(0, __FUNCTION__ "(), frame is not addressed to us!\n");
+ IRDA_DEBUG(0, __FUNCTION__ "(), frame is not addressed to us!\n");
dev_kfree_skb(skb);
return;
}
@@ -619,7 +620,7 @@ void irlap_send_frmr_frame( struct irlap_cb *self, int command)
frame[2] = 0;
- DEBUG( 4, __FUNCTION__ "(), vr=%d, %ld\n",self->vr, jiffies);
+ IRDA_DEBUG( 4, __FUNCTION__ "(), vr=%d, %ld\n",self->vr, jiffies);
irlap_queue_xmit(self, skb);
}
@@ -641,7 +642,7 @@ static void irlap_recv_rnr_frame( struct irlap_cb *self, struct sk_buff *skb,
frame = skb->data;
info->nr = frame[1] >> 5;
- DEBUG( 4, __FUNCTION__ "(), nr=%d, %ld\n", info->nr, jiffies);
+ IRDA_DEBUG( 4, __FUNCTION__ "(), nr=%d, %ld\n", info->nr, jiffies);
irlap_do_event( self, RECV_RNR_FRAME, skb, info);
}
@@ -700,7 +701,7 @@ void irlap_send_data_primary(struct irlap_cb *self, struct sk_buff *skb)
irlap_send_i_frame( self, tx_skb, CMD_FRAME);
} else {
- DEBUG( 4, __FUNCTION__ "(), sending unreliable frame\n");
+ IRDA_DEBUG( 4, __FUNCTION__ "(), sending unreliable frame\n");
irlap_send_ui_frame(self, skb, CMD_FRAME);
self->window -= 1;
}
@@ -759,7 +760,7 @@ void irlap_send_data_primary_poll(struct irlap_cb *self, struct sk_buff *skb)
irlap_send_i_frame(self, tx_skb, CMD_FRAME);
} else {
- DEBUG(4, __FUNCTION__ "(), sending unreliable frame\n");
+ IRDA_DEBUG(4, __FUNCTION__ "(), sending unreliable frame\n");
del_timer(&self->poll_timer);
@@ -959,7 +960,7 @@ void irlap_resend_rejected_frames(struct irlap_cb *self, int command)
while (skb_queue_len( &self->tx_list) > 0) {
- DEBUG(0, __FUNCTION__ "(), sending additional frames!\n");
+ IRDA_DEBUG(0, __FUNCTION__ "(), sending additional frames!\n");
if ((skb_queue_len( &self->tx_list) > 0) &&
(self->window > 0)) {
skb = skb_dequeue( &self->tx_list);
@@ -991,7 +992,7 @@ void irlap_send_ui_frame(struct irlap_cb *self, struct sk_buff *skb,
{
__u8 *frame;
- DEBUG(4, __FUNCTION__ "()\n");
+ IRDA_DEBUG(4, __FUNCTION__ "()\n");
ASSERT(self != NULL, return;);
ASSERT(self->magic == LAP_MAGIC, return;);
@@ -1056,7 +1057,7 @@ static void irlap_recv_ui_frame(struct irlap_cb *self, struct sk_buff *skb,
{
__u8 *frame;
- DEBUG( 4, __FUNCTION__ "()\n");
+ IRDA_DEBUG( 4, __FUNCTION__ "()\n");
frame = skb->data;
@@ -1077,7 +1078,7 @@ static void irlap_recv_frmr_frame(struct irlap_cb *self, struct sk_buff *skb,
__u8 *frame;
int w, x, y, z;
- DEBUG(0, __FUNCTION__ "()\n");
+ IRDA_DEBUG(0, __FUNCTION__ "()\n");
ASSERT(self != NULL, return;);
ASSERT(self->magic == LAP_MAGIC, return;);
@@ -1096,20 +1097,20 @@ static void irlap_recv_frmr_frame(struct irlap_cb *self, struct sk_buff *skb,
z = frame[3] & 0x08;
if (w) {
- DEBUG(0, "Rejected control field is undefined or not "
+ IRDA_DEBUG(0, "Rejected control field is undefined or not "
"implemented.\n");
}
if (x) {
- DEBUG(0, "Rejected control field was invalid because it "
+ IRDA_DEBUG(0, "Rejected control field was invalid because it "
"contained a non permitted I field.\n");
}
if (y) {
- DEBUG(0, "Received I field exceeded the maximum negotiated "
+ IRDA_DEBUG(0, "Received I field exceeded the maximum negotiated "
"for the existing connection or exceeded the maximum "
"this station supports if no connection exists.\n");
}
if (z) {
- DEBUG(0, "Rejected control field control field contained an "
+ IRDA_DEBUG(0, "Rejected control field control field contained an "
"invalid Nr count.\n");
}
irlap_do_event(self, RECV_FRMR_RSP, skb, info);
@@ -1168,10 +1169,10 @@ void irlap_recv_test_frame(struct irlap_cb *self, struct sk_buff *skb,
{
struct test_frame *frame;
- DEBUG(2, __FUNCTION__ "()\n");
+ IRDA_DEBUG(2, __FUNCTION__ "()\n");
if (skb->len < sizeof(struct test_frame)) {
- DEBUG(0, __FUNCTION__ "() test frame to short!\n");
+ IRDA_DEBUG(0, __FUNCTION__ "() test frame to short!\n");
return;
}
@@ -1205,12 +1206,11 @@ int irlap_driver_rcv(struct sk_buff *skb, struct net_device *dev,
{
struct irlap_info info;
struct irlap_cb *self;
- struct irda_device *idev;
int command;
__u8 control;
- idev = (struct irda_device *) dev->priv;
- self = idev->irlap;
+ /* FIXME: should we get our own field? */
+ self = (struct irlap_cb *) dev->atalk_ptr;
/* If the net device is down, then IrLAP is gone! */
if (!self || self->magic != LAP_MAGIC) {
@@ -1235,7 +1235,7 @@ int irlap_driver_rcv(struct sk_buff *skb, struct net_device *dev,
/* First we check if this frame has a valid connection address */
if ((info.caddr != self->caddr) && (info.caddr != CBROADCAST)) {
- DEBUG(0, __FUNCTION__ "(), wrong connection address!\n");
+ IRDA_DEBUG(0, __FUNCTION__ "(), wrong connection address!\n");
dev_kfree_skb(skb);
return 0;
}
@@ -1245,7 +1245,6 @@ int irlap_driver_rcv(struct sk_buff *skb, struct net_device *dev,
*/
if (~control & 0x01) {
irlap_recv_i_frame(self, skb, &info, command);
- self->stats.rx_packets++;
return 0;
}
/*
@@ -1260,17 +1259,15 @@ int irlap_driver_rcv(struct sk_buff *skb, struct net_device *dev,
switch (control & 0x0f) {
case RR:
irlap_recv_rr_frame(self, skb, &info, command);
- self->stats.rx_packets++;
break;
case RNR:
irlap_recv_rnr_frame(self, skb, &info);
- self->stats.rx_packets++;
break;
case REJ:
- DEBUG( 0, "*** REJ frame received! ***\n");
+ IRDA_DEBUG( 0, "*** REJ frame received! ***\n");
break;
case SREJ:
- DEBUG( 0, "*** SREJ frame received! ***\n");
+ IRDA_DEBUG( 0, "*** SREJ frame received! ***\n");
break;
default:
WARNING(__FUNCTION__
@@ -1294,7 +1291,7 @@ int irlap_driver_rcv(struct sk_buff *skb, struct net_device *dev,
irlap_recv_snrm_cmd(self, skb, &info);
break;
case DM_RSP:
- DEBUG( 0, "DM rsp frame received!\n");
+ IRDA_DEBUG( 0, "DM rsp frame received!\n");
irlap_next_state(self, LAP_NDM);
break;
case DISC_CMD:
@@ -1310,7 +1307,6 @@ int irlap_driver_rcv(struct sk_buff *skb, struct net_device *dev,
irlap_recv_frmr_frame(self, skb, &info);
break;
case UI_FRAME:
- DEBUG(4, "UI-frame received!\n");
irlap_recv_ui_frame(self, skb, &info);
break;
default:
@@ -1319,7 +1315,5 @@ int irlap_driver_rcv(struct sk_buff *skb, struct net_device *dev,
dev_kfree_skb( skb);
break;
}
- self->stats.rx_packets++;
-
return 0;
}
diff --git a/net/irda/irlmp.c b/net/irda/irlmp.c
index 8b63351ed..bd2f906f9 100644
--- a/net/irda/irlmp.c
+++ b/net/irda/irlmp.c
@@ -6,7 +6,7 @@
* Status: Stable.
* Author: Dag Brattli <dagb@cs.uit.no>
* Created at: Sun Aug 17 20:54:32 1997
- * Modified at: Mon Sep 27 11:15:20 1999
+ * Modified at: Sat Oct 9 17:00:49 1999
* Modified by: Dag Brattli <dagb@cs.uit.no>
*
* Copyright (c) 1998-1999 Dag Brattli <dagb@cs.uit.no>,
@@ -32,7 +32,6 @@
#include <linux/init.h>
#include <linux/kmod.h>
#include <linux/random.h>
-#include <linux/irda.h>
#include <net/irda/irda.h>
#include <net/irda/irmod.h>
@@ -189,7 +188,7 @@ struct lsap_cb *irlmp_open_lsap(__u8 slsap_sel, notify_t *notify)
/*
* Insert into queue of unconnected LSAPs
*/
- hashbin_insert(irlmp->unconnected_lsaps, (QUEUE *) self, (int) self,
+ hashbin_insert(irlmp->unconnected_lsaps, (queue_t *) self, (int) self,
NULL);
return self;
@@ -202,7 +201,7 @@ struct lsap_cb *irlmp_open_lsap(__u8 slsap_sel, notify_t *notify)
*/
static void __irlmp_close_lsap(struct lsap_cb *self)
{
- DEBUG(4, __FUNCTION__ "()\n");
+ IRDA_DEBUG(4, __FUNCTION__ "()\n");
ASSERT(self != NULL, return;);
ASSERT(self->magic == LMP_LSAP_MAGIC, return;);
@@ -249,7 +248,7 @@ void irlmp_close_lsap(struct lsap_cb *self)
NULL);
}
if (!lsap) {
- DEBUG(0, __FUNCTION__
+ IRDA_DEBUG(0, __FUNCTION__
"(), Looks like somebody has removed me already!\n");
return;
}
@@ -294,7 +293,7 @@ void irlmp_register_link(struct irlap_cb *irlap, __u32 saddr, notify_t *notify)
/*
* Insert into queue of unconnected LSAPs
*/
- hashbin_insert(irlmp->links, (QUEUE *) lap, lap->saddr, NULL);
+ hashbin_insert(irlmp->links, (queue_t *) lap, lap->saddr, NULL);
/*
* We set only this variable so IrLAP can tell us on which link the
@@ -314,7 +313,7 @@ void irlmp_unregister_link(__u32 saddr)
{
struct lap_cb *link;
- DEBUG(4, __FUNCTION__ "()\n");
+ IRDA_DEBUG(4, __FUNCTION__ "()\n");
link = hashbin_remove(irlmp->links, saddr, NULL);
if (link) {
@@ -348,7 +347,7 @@ int irlmp_connect_request(struct lsap_cb *self, __u8 dlsap_sel,
ASSERT(self != NULL, return -EBADR;);
ASSERT(self->magic == LMP_LSAP_MAGIC, return -EBADR;);
- DEBUG(2, __FUNCTION__
+ IRDA_DEBUG(2, __FUNCTION__
"(), slsap_sel=%02x, dlsap_sel=%02x, saddr=%08x, daddr=%08x\n",
self->slsap_sel, dlsap_sel, saddr, daddr);
@@ -391,14 +390,14 @@ int irlmp_connect_request(struct lsap_cb *self, __u8 dlsap_sel,
}
lap = hashbin_find(irlmp->links, saddr, NULL);
if (lap == NULL) {
- DEBUG(1, __FUNCTION__ "(), Unable to find a usable link!\n");
+ IRDA_DEBUG(1, __FUNCTION__ "(), Unable to find a usable link!\n");
return -EHOSTUNREACH;
}
if (lap->daddr == DEV_ADDR_ANY)
lap->daddr = daddr;
else if (lap->daddr != daddr) {
- DEBUG(0, __FUNCTION__ "(), sorry, but link is busy!\n");
+ IRDA_DEBUG(0, __FUNCTION__ "(), sorry, but link is busy!\n");
return -EBUSY;
}
@@ -415,7 +414,7 @@ int irlmp_connect_request(struct lsap_cb *self, __u8 dlsap_sel,
ASSERT(lsap->lap != NULL, return -1;);
ASSERT(lsap->lap->magic == LMP_LAP_MAGIC, return -1;);
- hashbin_insert(self->lap->lsaps, (QUEUE *) self, (int) self, NULL);
+ hashbin_insert(self->lap->lsaps, (queue_t *) self, (int) self, NULL);
self->connected = TRUE;
@@ -447,19 +446,19 @@ void irlmp_connect_indication(struct lsap_cb *self, struct sk_buff *skb)
ASSERT(skb != NULL, return;);
ASSERT(self->lap != NULL, return;);
- DEBUG(2, __FUNCTION__ "(), slsap_sel=%02x, dlsap_sel=%02x\n",
+ IRDA_DEBUG(2, __FUNCTION__ "(), slsap_sel=%02x, dlsap_sel=%02x\n",
self->slsap_sel, self->dlsap_sel);
self->qos = *self->lap->qos;
max_seg_size = self->lap->qos->data_size.value-LMP_HEADER;
- DEBUG(2, __FUNCTION__ "(), max_seg_size=%d\n", max_seg_size);
+ IRDA_DEBUG(2, __FUNCTION__ "(), max_seg_size=%d\n", max_seg_size);
- lap_header_size = irlap_get_header_size(self->lap->irlap);
+ lap_header_size = IRLAP_GET_HEADER_SIZE(self->lap->irlap);
max_header_size = LMP_HEADER + lap_header_size;
- DEBUG(2, __FUNCTION__ "(), max_header_size=%d\n", max_header_size);
+ IRDA_DEBUG(2, __FUNCTION__ "(), max_header_size=%d\n", max_header_size);
/* Hide LMP_CONTROL_HEADER header from layer above */
skb_pull(skb, LMP_CONTROL_HEADER);
@@ -484,7 +483,7 @@ int irlmp_connect_response(struct lsap_cb *self, struct sk_buff *userdata)
self->connected = TRUE;
- DEBUG(2, __FUNCTION__ "(), slsap_sel=%02x, dlsap_sel=%02x\n",
+ IRDA_DEBUG(2, __FUNCTION__ "(), slsap_sel=%02x, dlsap_sel=%02x\n",
self->slsap_sel, self->dlsap_sel);
/* Make room for MUX control header ( 3 bytes) */
@@ -507,7 +506,7 @@ void irlmp_connect_confirm(struct lsap_cb *self, struct sk_buff *skb)
int lap_header_size;
int max_seg_size;
- DEBUG(3, __FUNCTION__ "()\n");
+ IRDA_DEBUG(3, __FUNCTION__ "()\n");
ASSERT(skb != NULL, return;);
ASSERT(self != NULL, return;);
@@ -517,10 +516,10 @@ void irlmp_connect_confirm(struct lsap_cb *self, struct sk_buff *skb)
self->qos = *self->lap->qos;
max_seg_size = self->lap->qos->data_size.value-LMP_HEADER;
- lap_header_size = irlap_get_header_size(self->lap->irlap);
+ lap_header_size = IRLAP_GET_HEADER_SIZE(self->lap->irlap);
max_header_size = LMP_HEADER + lap_header_size;
- DEBUG(2, __FUNCTION__ "(), max_header_size=%d\n", max_header_size);
+ IRDA_DEBUG(2, __FUNCTION__ "(), max_header_size=%d\n", max_header_size);
/* Hide LMP_CONTROL_HEADER header from layer above */
skb_pull(skb, LMP_CONTROL_HEADER);
@@ -543,16 +542,16 @@ struct lsap_cb *irlmp_dup(struct lsap_cb *orig, void *instance)
{
struct lsap_cb *new;
- DEBUG(1, __FUNCTION__ "()\n");
+ IRDA_DEBUG(1, __FUNCTION__ "()\n");
/* Only allowed to duplicate unconnected LSAP's */
if (!hashbin_find(irlmp->unconnected_lsaps, (int) orig, NULL)) {
- DEBUG(0, __FUNCTION__ "(), unable to find LSAP\n");
+ IRDA_DEBUG(0, __FUNCTION__ "(), unable to find LSAP\n");
return NULL;
}
new = kmalloc(sizeof(struct lsap_cb), GFP_ATOMIC);
if (!new) {
- DEBUG(0, __FUNCTION__ "(), unable to kmalloc\n");
+ IRDA_DEBUG(0, __FUNCTION__ "(), unable to kmalloc\n");
return NULL;
}
/* Dup */
@@ -561,7 +560,7 @@ struct lsap_cb *irlmp_dup(struct lsap_cb *orig, void *instance)
init_timer(&new->watchdog_timer);
- hashbin_insert(irlmp->unconnected_lsaps, (QUEUE *) new, (int) new,
+ hashbin_insert(irlmp->unconnected_lsaps, (queue_t *) new, (int) new,
NULL);
/* Make sure that we invalidate the cache */
@@ -616,7 +615,7 @@ int irlmp_disconnect_request(struct lsap_cb *self, struct sk_buff *userdata)
ASSERT(lsap->magic == LMP_LSAP_MAGIC, return -1;);
ASSERT(lsap == self, return -1;);
- hashbin_insert(irlmp->unconnected_lsaps, (QUEUE *) self, (int) self,
+ hashbin_insert(irlmp->unconnected_lsaps, (queue_t *) self, (int) self,
NULL);
/* Reset some values */
@@ -637,13 +636,13 @@ void irlmp_disconnect_indication(struct lsap_cb *self, LM_REASON reason,
{
struct lsap_cb *lsap;
- DEBUG(1, __FUNCTION__ "(), reason=%s\n", lmp_reasons[reason]);
+ IRDA_DEBUG(1, __FUNCTION__ "(), reason=%s\n", lmp_reasons[reason]);
ASSERT(self != NULL, return;);
ASSERT(self->magic == LMP_LSAP_MAGIC, return;);
ASSERT(self->connected == TRUE, return;);
- DEBUG(3, __FUNCTION__ "(), slsap_sel=%02x, dlsap_sel=%02x\n",
+ IRDA_DEBUG(3, __FUNCTION__ "(), slsap_sel=%02x, dlsap_sel=%02x\n",
self->slsap_sel, self->dlsap_sel);
self->connected = FALSE;
@@ -663,7 +662,7 @@ void irlmp_disconnect_indication(struct lsap_cb *self, LM_REASON reason,
ASSERT(lsap != NULL, return;);
ASSERT(lsap == self, return;);
- hashbin_insert(irlmp->unconnected_lsaps, (QUEUE *) lsap, (int) lsap,
+ hashbin_insert(irlmp->unconnected_lsaps, (queue_t *) lsap, (int) lsap,
NULL);
self->lap = NULL;
@@ -691,7 +690,7 @@ void irlmp_do_discovery(int nslots)
if ((nslots != 1) && (nslots != 6) &&
(nslots != 8) && (nslots != 16))
{
- printk(KERN_WARNING __FUNCTION__
+ WARNING(__FUNCTION__
"(), invalid value for number of slots!\n");
nslots = sysctl_discovery_slots = 8;
}
@@ -768,8 +767,8 @@ void irlmp_check_services(discovery_t *discovery)
__u8 service;
int i = 0;
- DEBUG(1, "IrDA Discovered: %s\n", discovery->info);
- DEBUG(1, " Services: ");
+ IRDA_DEBUG(1, "IrDA Discovered: %s\n", discovery->info);
+ IRDA_DEBUG(1, " Services: ");
service_log = irlmp_hint_to_service(discovery->hints.byte);
if (!service_log)
@@ -779,10 +778,10 @@ void irlmp_check_services(discovery_t *discovery)
* Check all services on the device
*/
while ((service = service_log[i++]) != S_END) {
- DEBUG( 4, "service=%02x\n", service);
+ IRDA_DEBUG( 4, "service=%02x\n", service);
client = hashbin_find(irlmp->registry, service, NULL);
if (entry && entry->discovery_callback) {
- DEBUG( 4, "discovery_callback!\n");
+ IRDA_DEBUG( 4, "discovery_callback!\n");
entry->discovery_callback(discovery);
} else {
@@ -814,7 +813,7 @@ void irlmp_notify_client(irlmp_client_t *client, hashbin_t *log)
{
discovery_t *discovery;
- DEBUG(3, __FUNCTION__ "()\n");
+ IRDA_DEBUG(3, __FUNCTION__ "()\n");
/* Check if client wants the whole log */
if (client->callback2)
@@ -826,7 +825,7 @@ void irlmp_notify_client(irlmp_client_t *client, hashbin_t *log)
*/
discovery = (discovery_t *) hashbin_get_first(log);
while (discovery != NULL) {
- DEBUG(3, "discovery->daddr = 0x%08x\n", discovery->daddr);
+ IRDA_DEBUG(3, "discovery->daddr = 0x%08x\n", discovery->daddr);
/*
* Any common hint bits? Remember to mask away the extension
@@ -851,11 +850,11 @@ void irlmp_discovery_confirm(hashbin_t *log)
{
irlmp_client_t *client;
- DEBUG(3, __FUNCTION__ "()\n");
+ IRDA_DEBUG(3, __FUNCTION__ "()\n");
ASSERT(log != NULL, return;);
- if (!hashbin_get_size(log))
+ if (!(HASHBIN_GET_SIZE(log)))
return;
client = (irlmp_client_t *) hashbin_get_first(irlmp->clients);
@@ -875,7 +874,7 @@ void irlmp_discovery_confirm(hashbin_t *log)
*/
discovery_t *irlmp_get_discovery_response()
{
- DEBUG(4, __FUNCTION__ "()\n");
+ IRDA_DEBUG(4, __FUNCTION__ "()\n");
ASSERT(irlmp != NULL, return NULL;);
@@ -936,7 +935,7 @@ inline void irlmp_data_indication(struct lsap_cb *self, struct sk_buff *skb)
*/
inline void irlmp_udata_request(struct lsap_cb *self, struct sk_buff *skb)
{
- DEBUG(4, __FUNCTION__ "()\n");
+ IRDA_DEBUG(4, __FUNCTION__ "()\n");
ASSERT(skb != NULL, return;);
@@ -955,7 +954,7 @@ inline void irlmp_udata_request(struct lsap_cb *self, struct sk_buff *skb)
*/
void irlmp_udata_indication(struct lsap_cb *self, struct sk_buff *skb)
{
- DEBUG(4, __FUNCTION__ "()\n");
+ IRDA_DEBUG(4, __FUNCTION__ "()\n");
ASSERT(self != NULL, return;);
ASSERT(self->magic == LMP_LSAP_MAGIC, return;);
@@ -976,7 +975,7 @@ void irlmp_udata_indication(struct lsap_cb *self, struct sk_buff *skb)
*/
void irlmp_connectionless_data_request( struct sk_buff *skb)
{
- DEBUG( 1, __FUNCTION__ "(), Sorry not implemented\n");
+ IRDA_DEBUG( 1, __FUNCTION__ "(), Sorry not implemented\n");
}
/*
@@ -987,17 +986,17 @@ void irlmp_connectionless_data_request( struct sk_buff *skb)
*/
void irlmp_connectionless_data_indication(struct sk_buff *skb)
{
- DEBUG( 1, __FUNCTION__ "()\n");
+ IRDA_DEBUG( 1, __FUNCTION__ "()\n");
}
void irlmp_status_request(void)
{
- DEBUG(0, __FUNCTION__ "(), Not implemented\n");
+ IRDA_DEBUG(0, __FUNCTION__ "(), Not implemented\n");
}
void irlmp_status_indication(LINK_STATUS link, LOCK_STATUS lock)
{
- DEBUG(1, __FUNCTION__ "(), Not implemented\n");
+ IRDA_DEBUG(1, __FUNCTION__ "(), Not implemented\n");
}
/*
@@ -1017,31 +1016,31 @@ __u8 *irlmp_hint_to_service(__u8 *hint)
*/
service = kmalloc(16, GFP_ATOMIC);
if (!service) {
- DEBUG(1, __FUNCTION__ "(), Unable to kmalloc!\n");
+ IRDA_DEBUG(1, __FUNCTION__ "(), Unable to kmalloc!\n");
return NULL;
}
if (!hint[0]) {
- DEBUG(1, "<None>\n");
+ IRDA_DEBUG(1, "<None>\n");
kfree(service);
return NULL;
}
if (hint[0] & HINT_PNP)
- DEBUG(1, "PnP Compatible ");
+ IRDA_DEBUG(1, "PnP Compatible ");
if (hint[0] & HINT_PDA)
- DEBUG(1, "PDA/Palmtop ");
+ IRDA_DEBUG(1, "PDA/Palmtop ");
if (hint[0] & HINT_COMPUTER)
- DEBUG(1, "Computer ");
+ IRDA_DEBUG(1, "Computer ");
if (hint[0] & HINT_PRINTER) {
- DEBUG(1, "Printer ");
+ IRDA_DEBUG(1, "Printer ");
service[i++] = S_PRINTER;
}
if (hint[0] & HINT_MODEM)
- DEBUG(1, "Modem ");
+ IRDA_DEBUG(1, "Modem ");
if (hint[0] & HINT_FAX)
- DEBUG(1, "Fax ");
+ IRDA_DEBUG(1, "Fax ");
if (hint[0] & HINT_LAN) {
- DEBUG(1, "LAN Access ");
+ IRDA_DEBUG(1, "LAN Access ");
service[i++] = S_LAN;
}
/*
@@ -1051,21 +1050,21 @@ __u8 *irlmp_hint_to_service(__u8 *hint)
*/
if (hint[0] & HINT_EXTENSION) {
if (hint[1] & HINT_TELEPHONY) {
- DEBUG(1, "Telephony ");
+ IRDA_DEBUG(1, "Telephony ");
service[i++] = S_TELEPHONY;
} if (hint[1] & HINT_FILE_SERVER)
- DEBUG(1, "File Server ");
+ IRDA_DEBUG(1, "File Server ");
if (hint[1] & HINT_COMM) {
- DEBUG(1, "IrCOMM ");
+ IRDA_DEBUG(1, "IrCOMM ");
service[i++] = S_COMM;
}
if (hint[1] & HINT_OBEX) {
- DEBUG(1, "IrOBEX ");
+ IRDA_DEBUG(1, "IrOBEX ");
service[i++] = S_OBEX;
}
}
- DEBUG(1, "\n");
+ IRDA_DEBUG(1, "\n");
/* So that client can be notified about any discovery */
service[i++] = S_ANY;
@@ -1123,7 +1122,7 @@ __u16 irlmp_service_to_hint(int service)
hint.word = 0xffff;
break;
default:
- DEBUG( 1, __FUNCTION__ "(), Unknown service!\n");
+ IRDA_DEBUG( 1, __FUNCTION__ "(), Unknown service!\n");
break;
}
return hint.word;
@@ -1140,7 +1139,7 @@ __u32 irlmp_register_service(__u16 hints)
irlmp_service_t *service;
__u32 handle;
- DEBUG(4, __FUNCTION__ "(), hints = %04x\n", hints);
+ IRDA_DEBUG(4, __FUNCTION__ "(), hints = %04x\n", hints);
/* Get a unique handle for this service */
get_random_bytes(&handle, sizeof(handle));
@@ -1152,11 +1151,11 @@ __u32 irlmp_register_service(__u16 hints)
/* Make a new registration */
service = kmalloc(sizeof(irlmp_service_t), GFP_ATOMIC);
if (!service) {
- DEBUG(1, __FUNCTION__ "(), Unable to kmalloc!\n");
+ IRDA_DEBUG(1, __FUNCTION__ "(), Unable to kmalloc!\n");
return 0;
}
service->hints = hints;
- hashbin_insert(irlmp->services, (QUEUE*) service, handle, NULL);
+ hashbin_insert(irlmp->services, (queue_t *) service, handle, NULL);
return handle;
}
@@ -1172,14 +1171,14 @@ int irlmp_unregister_service(__u32 handle)
{
irlmp_service_t *service;
- DEBUG(4, __FUNCTION__ "()\n");
+ IRDA_DEBUG(4, __FUNCTION__ "()\n");
if (!handle)
return -1;
service = hashbin_find(irlmp->services, handle, NULL);
if (!service) {
- DEBUG(1, __FUNCTION__ "(), Unknown service!\n");
+ IRDA_DEBUG(1, __FUNCTION__ "(), Unknown service!\n");
return -1;
}
@@ -1221,7 +1220,7 @@ __u32 irlmp_register_client(__u16 hint_mask, DISCOVERY_CALLBACK1 callback1,
/* Make a new registration */
client = kmalloc(sizeof(irlmp_client_t), GFP_ATOMIC);
if (!client) {
- DEBUG( 1, __FUNCTION__ "(), Unable to kmalloc!\n");
+ IRDA_DEBUG( 1, __FUNCTION__ "(), Unable to kmalloc!\n");
return 0;
}
@@ -1231,7 +1230,7 @@ __u32 irlmp_register_client(__u16 hint_mask, DISCOVERY_CALLBACK1 callback1,
client->callback1 = callback1;
client->callback2 = callback2;
- hashbin_insert(irlmp->clients, (QUEUE *) client, handle, NULL);
+ hashbin_insert(irlmp->clients, (queue_t *) client, handle, NULL);
return handle;
}
@@ -1255,7 +1254,7 @@ int irlmp_update_client(__u32 handle, __u16 hint_mask,
client = hashbin_find(irlmp->clients, handle, NULL);
if (!client) {
- DEBUG(1, __FUNCTION__ "(), Unknown client!\n");
+ IRDA_DEBUG(1, __FUNCTION__ "(), Unknown client!\n");
return -1;
}
@@ -1276,18 +1275,18 @@ int irlmp_unregister_client(__u32 handle)
{
struct irlmp_client *client;
- DEBUG(4, __FUNCTION__ "()\n");
+ IRDA_DEBUG(4, __FUNCTION__ "()\n");
if (!handle)
return -1;
client = hashbin_find(irlmp->clients, handle, NULL);
if (!client) {
- DEBUG(1, __FUNCTION__ "(), Unknown client!\n");
+ IRDA_DEBUG(1, __FUNCTION__ "(), Unknown client!\n");
return -1;
}
- DEBUG( 4, __FUNCTION__ "(), removing client!\n");
+ IRDA_DEBUG( 4, __FUNCTION__ "(), removing client!\n");
client = hashbin_remove( irlmp->clients, handle, NULL);
if (client)
kfree(client);
@@ -1309,7 +1308,7 @@ int irlmp_slsap_inuse(__u8 slsap_sel)
ASSERT(irlmp->magic == LMP_MAGIC, return TRUE;);
ASSERT(slsap_sel != LSAP_ANY, return TRUE;);
- DEBUG(4, __FUNCTION__ "()\n");
+ IRDA_DEBUG(4, __FUNCTION__ "()\n");
/* Valid values are between 0 and 127 */
if (slsap_sel > 127)
@@ -1329,7 +1328,7 @@ int irlmp_slsap_inuse(__u8 slsap_sel)
ASSERT(self->magic == LMP_LSAP_MAGIC, return TRUE;);
if ((self->slsap_sel == slsap_sel)) {
- DEBUG(4, "Source LSAP selector=%02x in use\n",
+ IRDA_DEBUG(4, "Source LSAP selector=%02x in use\n",
self->slsap_sel);
return TRUE;
}
@@ -1369,7 +1368,7 @@ __u8 irlmp_find_free_slsap(void)
return 0;
}
}
- DEBUG(4, __FUNCTION__ "(), next free lsap_sel=%02x\n", lsap_sel);
+ IRDA_DEBUG(4, __FUNCTION__ "(), next free lsap_sel=%02x\n", lsap_sel);
return lsap_sel;
}
@@ -1387,25 +1386,25 @@ LM_REASON irlmp_convert_lap_reason( LAP_REASON lap_reason)
switch (lap_reason) {
case LAP_DISC_INDICATION: /* Received a disconnect request from peer */
- DEBUG( 1, __FUNCTION__ "(), LAP_DISC_INDICATION\n");
+ IRDA_DEBUG( 1, __FUNCTION__ "(), LAP_DISC_INDICATION\n");
reason = LM_USER_REQUEST;
break;
case LAP_NO_RESPONSE: /* To many retransmits without response */
- DEBUG( 1, __FUNCTION__ "(), LAP_NO_RESPONSE\n");
+ IRDA_DEBUG( 1, __FUNCTION__ "(), LAP_NO_RESPONSE\n");
reason = LM_LAP_DISCONNECT;
break;
case LAP_RESET_INDICATION:
- DEBUG( 1, __FUNCTION__ "(), LAP_RESET_INDICATION\n");
+ IRDA_DEBUG( 1, __FUNCTION__ "(), LAP_RESET_INDICATION\n");
reason = LM_LAP_RESET;
break;
case LAP_FOUND_NONE:
case LAP_MEDIA_BUSY:
case LAP_PRIMARY_CONFLICT:
- DEBUG(1, __FUNCTION__ "(), LAP_FOUND_NONE, LAP_MEDIA_BUSY or LAP_PRIMARY_CONFLICT\n");
+ IRDA_DEBUG(1, __FUNCTION__ "(), LAP_FOUND_NONE, LAP_MEDIA_BUSY or LAP_PRIMARY_CONFLICT\n");
reason = LM_CONNECT_FAILURE;
break;
default:
- DEBUG(1, __FUNCTION__
+ IRDA_DEBUG(1, __FUNCTION__
"(), Unknow IrLAP disconnect reason %d!\n", lap_reason);
reason = LM_LAP_DISCONNECT;
break;
diff --git a/net/irda/irlmp_event.c b/net/irda/irlmp_event.c
index ee41e54f4..122affe25 100644
--- a/net/irda/irlmp_event.c
+++ b/net/irda/irlmp_event.c
@@ -6,7 +6,7 @@
* Status: Experimental.
* Author: Dag Brattli <dagb@cs.uit.no>
* Created at: Mon Aug 4 20:40:53 1997
- * Modified at: Tue Sep 21 13:04:33 1999
+ * Modified at: Tue Oct 5 13:47:53 1999
* Modified by: Dag Brattli <dagb@cs.uit.no>
*
* Copyright (c) 1998-1999 Dag Brattli <dagb@cs.uit.no>,
@@ -120,7 +120,7 @@ int irlmp_do_lsap_event(struct lsap_cb *self, IRLMP_EVENT event,
ASSERT(self != NULL, return -1;);
ASSERT(self->magic == LMP_LSAP_MAGIC, return -1;);
- DEBUG(4, __FUNCTION__ "(), EVENT = %s, STATE = %s\n",
+ IRDA_DEBUG(4, __FUNCTION__ "(), EVENT = %s, STATE = %s\n",
irlmp_event[ event], irlmp_state[ self->lsap_state]);
return (*lsap_state[self->lsap_state]) (self, event, skb);
@@ -138,7 +138,7 @@ void irlmp_do_lap_event(struct lap_cb *self, IRLMP_EVENT event,
ASSERT(self != NULL, return;);
ASSERT(self->magic == LMP_LAP_MAGIC, return;);
- DEBUG(4, __FUNCTION__ "(), EVENT = %s, STATE = %s\n",
+ IRDA_DEBUG(4, __FUNCTION__ "(), EVENT = %s, STATE = %s\n",
irlmp_event[event],
irlmp_state[self->lap_state]);
@@ -147,7 +147,7 @@ void irlmp_do_lap_event(struct lap_cb *self, IRLMP_EVENT event,
void irlmp_discovery_timer_expired(void *data)
{
- DEBUG(4, __FUNCTION__ "()\n");
+ IRDA_DEBUG(4, __FUNCTION__ "()\n");
if (sysctl_discovery)
irlmp_do_discovery(sysctl_discovery_slots);
@@ -160,7 +160,7 @@ void irlmp_watchdog_timer_expired(void *data)
{
struct lsap_cb *self = (struct lsap_cb *) data;
- DEBUG(2, __FUNCTION__ "()\n");
+ IRDA_DEBUG(2, __FUNCTION__ "()\n");
ASSERT(self != NULL, return;);
ASSERT(self->magic == LMP_LSAP_MAGIC, return;);
@@ -172,7 +172,7 @@ void irlmp_idle_timer_expired(void *data)
{
struct lap_cb *self = (struct lap_cb *) data;
- DEBUG(2, __FUNCTION__ "()\n");
+ IRDA_DEBUG(2, __FUNCTION__ "()\n");
ASSERT(self != NULL, return;);
ASSERT(self->magic == LMP_LAP_MAGIC, return;);
@@ -195,7 +195,7 @@ void irlmp_idle_timer_expired(void *data)
static void irlmp_state_standby(struct lap_cb *self, IRLMP_EVENT event,
struct sk_buff *skb)
{
- DEBUG(4, __FUNCTION__ "()\n");
+ IRDA_DEBUG(4, __FUNCTION__ "()\n");
ASSERT(self->irlap != NULL, return;);
switch (event) {
@@ -219,7 +219,7 @@ static void irlmp_state_standby(struct lap_cb *self, IRLMP_EVENT event,
irlap_connect_response(self->irlap, skb);
break;
case LM_LAP_CONNECT_REQUEST:
- DEBUG(4, __FUNCTION__ "() LS_CONNECT_REQUEST\n");
+ IRDA_DEBUG(4, __FUNCTION__ "() LS_CONNECT_REQUEST\n");
/* FIXME: need to set users requested QoS */
irlap_connect_request(self->irlap, self->daddr, NULL, 0);
@@ -227,13 +227,13 @@ static void irlmp_state_standby(struct lap_cb *self, IRLMP_EVENT event,
irlmp_next_lap_state(self, LAP_U_CONNECT);
break;
case LM_LAP_DISCONNECT_INDICATION:
- DEBUG(4, __FUNCTION__
+ IRDA_DEBUG(4, __FUNCTION__
"(), Error LM_LAP_DISCONNECT_INDICATION\n");
irlmp_next_lap_state( self, LAP_STANDBY);
break;
default:
- DEBUG(4, __FUNCTION__ "(), Unknown event\n");
+ IRDA_DEBUG(4, __FUNCTION__ "(), Unknown event\n");
break;
}
}
@@ -251,7 +251,7 @@ static void irlmp_state_u_connect( struct lap_cb *self, IRLMP_EVENT event,
struct lsap_cb *lsap;
struct lsap_cb *lsap_current;
- DEBUG(2, __FUNCTION__ "(), event=%s\n", irlmp_event[event]);
+ IRDA_DEBUG(2, __FUNCTION__ "(), event=%s\n", irlmp_event[event]);
switch (event) {
case LM_LAP_CONNECT_CONFIRM:
@@ -265,7 +265,7 @@ static void irlmp_state_u_connect( struct lap_cb *self, IRLMP_EVENT event,
}
break;
case LM_LAP_DISCONNECT_INDICATION:
- DEBUG(2, __FUNCTION__ "(), IRLAP_DISCONNECT_INDICATION\n");
+ IRDA_DEBUG(2, __FUNCTION__ "(), IRLAP_DISCONNECT_INDICATION\n");
irlmp_next_lap_state(self, LAP_STANDBY);
@@ -285,7 +285,7 @@ static void irlmp_state_u_connect( struct lap_cb *self, IRLMP_EVENT event,
}
break;
case LM_LAP_DISCONNECT_REQUEST:
- DEBUG(4, __FUNCTION__ "(), LM_LAP_DISCONNECT_REQUEST\n");
+ IRDA_DEBUG(4, __FUNCTION__ "(), LM_LAP_DISCONNECT_REQUEST\n");
irlmp_next_lap_state(self, LAP_STANDBY);
@@ -293,7 +293,7 @@ static void irlmp_state_u_connect( struct lap_cb *self, IRLMP_EVENT event,
/* irlap_disconnect_request( self->irlap); */
break;
default:
- DEBUG(4, __FUNCTION__ "(), Unknown event\n");
+ IRDA_DEBUG(4, __FUNCTION__ "(), Unknown event\n");
break;
}
}
@@ -310,11 +310,11 @@ static void irlmp_state_active(struct lap_cb *self, IRLMP_EVENT event,
struct lsap_cb *lsap;
struct lsap_cb *lsap_current;
- DEBUG( 4, __FUNCTION__ "()\n");
+ IRDA_DEBUG( 4, __FUNCTION__ "()\n");
switch( event) {
case LM_LAP_CONNECT_REQUEST:
- DEBUG( 4, __FUNCTION__ "(), LS_CONNECT_REQUEST\n");
+ IRDA_DEBUG( 4, __FUNCTION__ "(), LS_CONNECT_REQUEST\n");
/*
* LAP connection allready active, just bounce back! Since we
@@ -347,7 +347,7 @@ static void irlmp_state_active(struct lap_cb *self, IRLMP_EVENT event,
* must be the one that tries to close IrLAP. It will be
* removed later and moved to the list of unconnected LSAPs
*/
- if (hashbin_get_size(self->lsaps) > 0)
+ if (HASHBIN_GET_SIZE(self->lsaps) > 0)
irlmp_start_idle_timer(self, LM_IDLE_TIMEOUT);
else {
/* No more connections, so close IrLAP */
@@ -356,7 +356,7 @@ static void irlmp_state_active(struct lap_cb *self, IRLMP_EVENT event,
}
break;
case LM_LAP_IDLE_TIMEOUT:
- if (hashbin_get_size(self->lsaps) == 0) {
+ if (HASHBIN_GET_SIZE(self->lsaps) == 0) {
irlmp_next_lap_state(self, LAP_STANDBY);
irlap_disconnect_request(self->irlap);
}
@@ -381,7 +381,7 @@ static void irlmp_state_active(struct lap_cb *self, IRLMP_EVENT event,
}
break;
default:
- DEBUG(4, __FUNCTION__ "(), Unknown event %d\n", event);
+ IRDA_DEBUG(4, __FUNCTION__ "(), Unknown event %d\n", event);
break;
}
}
@@ -403,14 +403,14 @@ static int irlmp_state_disconnected(struct lsap_cb *self, IRLMP_EVENT event,
{
int ret = 0;
- DEBUG(4, __FUNCTION__ "()\n");
+ IRDA_DEBUG(4, __FUNCTION__ "()\n");
ASSERT(self != NULL, return -1;);
ASSERT(self->magic == LMP_LSAP_MAGIC, return -1;);
switch (event) {
case LM_CONNECT_REQUEST:
- DEBUG(4, __FUNCTION__ "(), LM_CONNECT_REQUEST\n");
+ IRDA_DEBUG(4, __FUNCTION__ "(), LM_CONNECT_REQUEST\n");
irlmp_next_lsap_state(self, LSAP_SETUP_PEND);
irlmp_do_lap_event(self->lap, LM_LAP_CONNECT_REQUEST, NULL);
@@ -424,7 +424,7 @@ static int irlmp_state_disconnected(struct lsap_cb *self, IRLMP_EVENT event,
irlmp_do_lap_event(self->lap, LM_LAP_CONNECT_REQUEST, skb);
break;
default:
- DEBUG( 4, __FUNCTION__ "(), Unknown event %d\n", event);
+ IRDA_DEBUG( 4, __FUNCTION__ "(), Unknown event %d\n", event);
break;
}
return ret;
@@ -442,7 +442,7 @@ static int irlmp_state_connect(struct lsap_cb *self, IRLMP_EVENT event,
struct lsap_cb *lsap;
int ret = 0;
- DEBUG(4, __FUNCTION__ "()\n");
+ IRDA_DEBUG(4, __FUNCTION__ "()\n");
ASSERT(self != NULL, return -1;);
ASSERT(self->magic == LMP_LSAP_MAGIC, return -1;);
@@ -460,7 +460,7 @@ static int irlmp_state_connect(struct lsap_cb *self, IRLMP_EVENT event,
ASSERT(self->lap != NULL, return -1;);
ASSERT(self->lap->lsaps != NULL, return -1;);
- hashbin_insert(self->lap->lsaps, (QUEUE *) self, (int) self,
+ hashbin_insert(self->lap->lsaps, (queue_t *) self, (int) self,
NULL);
irlmp_send_lcf_pdu(self->lap, self->dlsap_sel,
@@ -471,7 +471,7 @@ static int irlmp_state_connect(struct lsap_cb *self, IRLMP_EVENT event,
irlmp_next_lsap_state(self, LSAP_DATA_TRANSFER_READY);
break;
default:
- DEBUG( 4, __FUNCTION__ "(), Unknown event\n");
+ IRDA_DEBUG( 4, __FUNCTION__ "(), Unknown event\n");
break;
}
return ret;
@@ -488,7 +488,7 @@ static int irlmp_state_connect_pend(struct lsap_cb *self, IRLMP_EVENT event,
{
int ret = 0;
- DEBUG(4, __FUNCTION__ "()\n");
+ IRDA_DEBUG(4, __FUNCTION__ "()\n");
ASSERT(self != NULL, return -1;);
ASSERT(self->magic == LMP_LSAP_MAGIC, return -1;);
@@ -498,22 +498,22 @@ static int irlmp_state_connect_pend(struct lsap_cb *self, IRLMP_EVENT event,
/* Keep state */
break;
case LM_CONNECT_RESPONSE:
- DEBUG(0, __FUNCTION__ "(), LM_CONNECT_RESPONSE, "
+ IRDA_DEBUG(0, __FUNCTION__ "(), LM_CONNECT_RESPONSE, "
"no indication issued yet\n");
/* Keep state */
break;
case LM_DISCONNECT_REQUEST:
- DEBUG(0, __FUNCTION__ "(), LM_DISCONNECT_REQUEST, "
+ IRDA_DEBUG(0, __FUNCTION__ "(), LM_DISCONNECT_REQUEST, "
"not yet bound to IrLAP connection\n");
/* Keep state */
break;
case LM_LAP_CONNECT_CONFIRM:
- DEBUG(4, __FUNCTION__ "(), LS_CONNECT_CONFIRM\n");
+ IRDA_DEBUG(4, __FUNCTION__ "(), LS_CONNECT_CONFIRM\n");
irlmp_next_lsap_state(self, LSAP_CONNECT);
irlmp_connect_indication(self, skb);
break;
default:
- DEBUG( 4, __FUNCTION__ "Unknown event %d\n", event);
+ IRDA_DEBUG( 4, __FUNCTION__ "Unknown event %d\n", event);
break;
}
return ret;
@@ -531,7 +531,7 @@ static int irlmp_state_dtr(struct lsap_cb *self, IRLMP_EVENT event,
LM_REASON reason;
int ret = 0;
- DEBUG(4, __FUNCTION__ "()\n");
+ IRDA_DEBUG(4, __FUNCTION__ "()\n");
ASSERT(self != NULL, return -1;);
ASSERT(self->magic == LMP_LSAP_MAGIC, return -1;);
@@ -557,12 +557,12 @@ static int irlmp_state_dtr(struct lsap_cb *self, IRLMP_EVENT event,
/* irlmp_next_lsap_state( DATA_TRANSFER_READY, info->handle);*/
break;
case LM_CONNECT_REQUEST:
- DEBUG(0, __FUNCTION__ "(), LM_CONNECT_REQUEST, "
+ IRDA_DEBUG(0, __FUNCTION__ "(), LM_CONNECT_REQUEST, "
"error, LSAP already connected\n");
/* Keep state */
break;
case LM_CONNECT_RESPONSE:
- DEBUG(0, __FUNCTION__ "(), LM_CONNECT_RESPONSE, "
+ IRDA_DEBUG(0, __FUNCTION__ "(), LM_CONNECT_RESPONSE, "
"error, LSAP allready connected\n");
/* Keep state */
break;
@@ -573,7 +573,7 @@ static int irlmp_state_dtr(struct lsap_cb *self, IRLMP_EVENT event,
/* Try to close the LAP connection if its still there */
if (self->lap) {
- DEBUG(4, __FUNCTION__ "(), trying to close IrLAP\n");
+ IRDA_DEBUG(4, __FUNCTION__ "(), trying to close IrLAP\n");
irlmp_do_lap_event(self->lap,
LM_LAP_DISCONNECT_REQUEST,
NULL);
@@ -597,13 +597,13 @@ static int irlmp_state_dtr(struct lsap_cb *self, IRLMP_EVENT event,
reason = skb->data[3];
/* Try to close the LAP connection */
- DEBUG(4, __FUNCTION__ "(), trying to close IrLAP\n");
+ IRDA_DEBUG(4, __FUNCTION__ "(), trying to close IrLAP\n");
irlmp_do_lap_event(self->lap, LM_LAP_DISCONNECT_REQUEST, NULL);
irlmp_disconnect_indication(self, reason, skb);
break;
default:
- DEBUG(4, __FUNCTION__ "(), Unknown event %d\n", event);
+ IRDA_DEBUG(4, __FUNCTION__ "(), Unknown event %d\n", event);
break;
}
return ret;
@@ -625,7 +625,7 @@ static int irlmp_state_setup(struct lsap_cb *self, IRLMP_EVENT event,
ASSERT(self != NULL, return -1;);
ASSERT(self->magic == LMP_LSAP_MAGIC, return -1;);
- DEBUG(4, __FUNCTION__ "()\n");
+ IRDA_DEBUG(4, __FUNCTION__ "()\n");
switch (event) {
case LM_CONNECT_CONFIRM:
@@ -646,7 +646,7 @@ static int irlmp_state_setup(struct lsap_cb *self, IRLMP_EVENT event,
reason = skb->data[3];
/* Try to close the LAP connection */
- DEBUG(4, __FUNCTION__ "(), trying to close IrLAP\n");
+ IRDA_DEBUG(4, __FUNCTION__ "(), trying to close IrLAP\n");
irlmp_do_lap_event(self->lap, LM_LAP_DISCONNECT_REQUEST, NULL);
irlmp_disconnect_indication(self, reason, skb);
@@ -664,7 +664,7 @@ static int irlmp_state_setup(struct lsap_cb *self, IRLMP_EVENT event,
irlmp_disconnect_indication(self, reason, skb);
break;
case LM_WATCHDOG_TIMEOUT:
- DEBUG(0, __FUNCTION__ "() WATCHDOG_TIMEOUT!\n");
+ IRDA_DEBUG(0, __FUNCTION__ "() WATCHDOG_TIMEOUT!\n");
ASSERT(self->lap != NULL, return -1;);
irlmp_do_lap_event(self->lap, LM_LAP_DISCONNECT_REQUEST, NULL);
@@ -673,7 +673,7 @@ static int irlmp_state_setup(struct lsap_cb *self, IRLMP_EVENT event,
irlmp_disconnect_indication(self, LM_CONNECT_FAILURE, NULL);
break;
default:
- DEBUG(4, __FUNCTION__ "(), Unknown event %d\n", event);
+ IRDA_DEBUG(4, __FUNCTION__ "(), Unknown event %d\n", event);
break;
}
return ret;
@@ -693,7 +693,7 @@ static int irlmp_state_setup_pend(struct lsap_cb *self, IRLMP_EVENT event,
LM_REASON reason;
int ret = 0;
- DEBUG(4, __FUNCTION__ "()\n");
+ IRDA_DEBUG(4, __FUNCTION__ "()\n");
ASSERT(self != NULL, return -1;);
ASSERT(irlmp != NULL, return -1;);
@@ -706,7 +706,7 @@ static int irlmp_state_setup_pend(struct lsap_cb *self, IRLMP_EVENT event,
irlmp_next_lsap_state(self, LSAP_SETUP);
break;
case LM_WATCHDOG_TIMEOUT:
- DEBUG(0, __FUNCTION__ "() WATCHDOG_TIMEOUT!\n");
+ IRDA_DEBUG(0, __FUNCTION__ "() WATCHDOG_TIMEOUT!\n");
ASSERT(self->lap != NULL, return -1;);
irlmp_do_lap_event(self->lap, LM_LAP_DISCONNECT_REQUEST, NULL);
@@ -724,7 +724,7 @@ static int irlmp_state_setup_pend(struct lsap_cb *self, IRLMP_EVENT event,
irlmp_disconnect_indication(self, reason, NULL);
break;
default:
- DEBUG(4, __FUNCTION__ "(), Unknown event %d\n", event);
+ IRDA_DEBUG(4, __FUNCTION__ "(), Unknown event %d\n", event);
break;
}
return ret;
@@ -732,7 +732,7 @@ static int irlmp_state_setup_pend(struct lsap_cb *self, IRLMP_EVENT event,
void irlmp_next_lap_state(struct lap_cb *self, IRLMP_STATE state)
{
- DEBUG(4, __FUNCTION__ "(), LMP LAP = %s\n", irlmp_state[state]);
+ IRDA_DEBUG(4, __FUNCTION__ "(), LMP LAP = %s\n", irlmp_state[state]);
self->lap_state = state;
}
@@ -740,6 +740,6 @@ void irlmp_next_lsap_state(struct lsap_cb *self, LSAP_STATE state)
{
ASSERT(self != NULL, return;);
- DEBUG(4, __FUNCTION__ "(), LMP LSAP = %s\n", irlsap_state[state]);
+ IRDA_DEBUG(4, __FUNCTION__ "(), LMP LSAP = %s\n", irlsap_state[state]);
self->lsap_state = state;
}
diff --git a/net/irda/irlmp_frame.c b/net/irda/irlmp_frame.c
index 135f82752..7a71005bf 100644
--- a/net/irda/irlmp_frame.c
+++ b/net/irda/irlmp_frame.c
@@ -44,7 +44,7 @@ inline void irlmp_send_data_pdu(struct lap_cb *self, __u8 dlsap, __u8 slsap,
skb->data[1] = slsap;
if (expedited) {
- DEBUG(4, __FUNCTION__ "(), sending expedited data\n");
+ IRDA_DEBUG(4, __FUNCTION__ "(), sending expedited data\n");
irlap_data_request(self->irlap, skb, FALSE);
} else
irlap_data_request(self->irlap, skb, TRUE);
@@ -60,7 +60,7 @@ void irlmp_send_lcf_pdu(struct lap_cb *self, __u8 dlsap, __u8 slsap,
{
__u8 *frame;
- DEBUG(4, __FUNCTION__ "()\n");
+ IRDA_DEBUG(4, __FUNCTION__ "()\n");
ASSERT(self != NULL, return;);
ASSERT(self->magic == LMP_LAP_MAGIC, return;);
@@ -114,7 +114,7 @@ void irlmp_link_data_indication(struct lap_cb *self, int reliable,
* it in a different way than other established connections.
*/
if ((fp[0] & CONTROL_BIT) && (fp[2] == CONNECT_CMD)) {
- DEBUG(3,"Incoming connection, source LSAP=%d, dest LSAP=%d\n",
+ IRDA_DEBUG(3,"Incoming connection, source LSAP=%d, dest LSAP=%d\n",
slsap_sel, dlsap_sel);
/* Try to find LSAP among the unconnected LSAPs */
@@ -130,15 +130,15 @@ void irlmp_link_data_indication(struct lap_cb *self, int reliable,
self->lsaps);
if (lsap == NULL) {
- DEBUG(2, "IrLMP, Sorry, no LSAP for received frame!\n");
- DEBUG(2, __FUNCTION__
+ IRDA_DEBUG(2, "IrLMP, Sorry, no LSAP for received frame!\n");
+ IRDA_DEBUG(2, __FUNCTION__
"(), slsap_sel = %02x, dlsap_sel = %02x\n", slsap_sel,
dlsap_sel);
if (fp[0] & CONTROL_BIT) {
- DEBUG(2, __FUNCTION__
+ IRDA_DEBUG(2, __FUNCTION__
"(), received control frame %02x\n", fp[2]);
} else {
- DEBUG(2, __FUNCTION__ "(), received data frame\n");
+ IRDA_DEBUG(2, __FUNCTION__ "(), received data frame\n");
}
dev_kfree_skb(skb);
return;
@@ -157,18 +157,18 @@ void irlmp_link_data_indication(struct lap_cb *self, int reliable,
irlmp_do_lsap_event(lsap, LM_CONNECT_CONFIRM, skb);
break;
case DISCONNECT:
- DEBUG( 4, __FUNCTION__ "(), Disconnect indication!\n");
+ IRDA_DEBUG( 4, __FUNCTION__ "(), Disconnect indication!\n");
irlmp_do_lsap_event(lsap, LM_DISCONNECT_INDICATION,
skb);
break;
case ACCESSMODE_CMD:
- DEBUG( 0, "Access mode cmd not implemented!\n");
+ IRDA_DEBUG( 0, "Access mode cmd not implemented!\n");
break;
case ACCESSMODE_CNF:
- DEBUG( 0, "Access mode cnf not implemented!\n");
+ IRDA_DEBUG( 0, "Access mode cnf not implemented!\n");
break;
default:
- DEBUG( 0, __FUNCTION__
+ IRDA_DEBUG( 0, __FUNCTION__
"(), Unknown control frame %02x\n", fp[2]);
break;
}
@@ -198,7 +198,7 @@ void irlmp_link_disconnect_indication(struct lap_cb *lap,
LAP_REASON reason,
struct sk_buff *userdata)
{
- DEBUG(2, __FUNCTION__ "()\n");
+ IRDA_DEBUG(2, __FUNCTION__ "()\n");
ASSERT(lap != NULL, return;);
ASSERT(lap->magic == LMP_LAP_MAGIC, return;);
@@ -224,7 +224,7 @@ void irlmp_link_connect_indication(struct lap_cb *self, __u32 saddr,
__u32 daddr, struct qos_info *qos,
struct sk_buff *skb)
{
- DEBUG(4, __FUNCTION__ "()\n");
+ IRDA_DEBUG(4, __FUNCTION__ "()\n");
/* Copy QoS settings for this session */
self->qos = qos;
@@ -245,7 +245,7 @@ void irlmp_link_connect_indication(struct lap_cb *self, __u32 saddr,
void irlmp_link_connect_confirm(struct lap_cb *self, struct qos_info *qos,
struct sk_buff *userdata)
{
- DEBUG(4, __FUNCTION__ "()\n");
+ IRDA_DEBUG(4, __FUNCTION__ "()\n");
ASSERT(self != NULL, return;);
ASSERT(self->magic == LMP_LAP_MAGIC, return;);
@@ -287,7 +287,7 @@ void irlmp_link_discovery_indication(struct lap_cb *self,
*/
void irlmp_link_discovery_confirm(struct lap_cb *self, hashbin_t *log)
{
- DEBUG(4, __FUNCTION__ "()\n");
+ IRDA_DEBUG(4, __FUNCTION__ "()\n");
ASSERT(self != NULL, return;);
ASSERT(self->magic == LMP_LAP_MAGIC, return;);
diff --git a/net/irda/irmod.c b/net/irda/irmod.c
index e5c5d72ef..7a2fa169a 100644
--- a/net/irda/irmod.c
+++ b/net/irda/irmod.c
@@ -6,7 +6,7 @@
* Status: Experimental.
* Author: Dag Brattli <dagb@cs.uit.no>
* Created at: Mon Dec 15 13:55:39 1997
- * Modified at: Mon Sep 20 09:27:25 1999
+ * Modified at: Mon Oct 18 14:54:35 1999
* Modified by: Dag Brattli <dagb@cs.uit.no>
*
* Copyright (c) 1997, 1999 Dag Brattli, All Rights Reserved.
@@ -173,28 +173,31 @@ EXPORT_SYMBOL(hashbin_get_next);
EXPORT_SYMBOL(hashbin_get_first);
/* IrLAP */
+EXPORT_SYMBOL(irlap_open);
+EXPORT_SYMBOL(irlap_close);
#ifdef CONFIG_IRDA_COMPRESSION
EXPORT_SYMBOL(irda_unregister_compressor);
EXPORT_SYMBOL(irda_register_compressor);
#endif /* CONFIG_IRDA_COMPRESSION */
EXPORT_SYMBOL(irda_init_max_qos_capabilies);
EXPORT_SYMBOL(irda_qos_bits_to_value);
-EXPORT_SYMBOL(irda_device_open);
-EXPORT_SYMBOL(irda_device_close);
EXPORT_SYMBOL(irda_device_setup);
EXPORT_SYMBOL(irda_device_set_media_busy);
EXPORT_SYMBOL(irda_device_txqueue_empty);
-EXPORT_SYMBOL(irda_device_net_open);
-EXPORT_SYMBOL(irda_device_net_close);
-EXPORT_SYMBOL(irda_device_init_dongle);
+EXPORT_SYMBOL(irda_device_dongle_init);
+EXPORT_SYMBOL(irda_device_dongle_cleanup);
EXPORT_SYMBOL(irda_device_register_dongle);
EXPORT_SYMBOL(irda_device_unregister_dongle);
+EXPORT_SYMBOL(irda_task_execute);
+EXPORT_SYMBOL(irda_task_kick);
+EXPORT_SYMBOL(irda_task_next_state);
EXPORT_SYMBOL(async_wrap_skb);
EXPORT_SYMBOL(async_unwrap_char);
EXPORT_SYMBOL(irda_start_timer);
EXPORT_SYMBOL(setup_dma);
+EXPORT_SYMBOL(infrared_mode);
#ifdef CONFIG_IRTTY
EXPORT_SYMBOL(irtty_set_dtr_rts);
@@ -205,7 +208,7 @@ EXPORT_SYMBOL(irtty_set_packet_mode);
int __init irda_init(void)
{
- printk(KERN_INFO "IrDA (tm) Protocols for Linux-2.3 (Dag Brattli)\n");
+ MESSAGE("IrDA (tm) Protocols for Linux-2.3 (Dag Brattli)\n");
irlmp_init();
irlap_init();
@@ -344,7 +347,7 @@ void irda_execute_as_process( void *self, TODO_CALLBACK callback, __u32 param)
new->param = param;
/* Queue todo */
- enqueue_last(&irda.todo_queue, (QUEUE *) new);
+ enqueue_last(&irda.todo_queue, (queue_t *) new);
event.event = EVENT_NEED_PROCESS_CONTEXT;
@@ -362,7 +365,7 @@ void irmanager_notify( struct irmanager_event *event)
{
struct irda_event *new;
- DEBUG(4, __FUNCTION__ "()\n");
+ IRDA_DEBUG(4, __FUNCTION__ "()\n");
/* Make sure irmanager is running */
if (!irda.in_use) {
@@ -380,7 +383,7 @@ void irmanager_notify( struct irmanager_event *event)
new->event = *event;
/* Queue event */
- enqueue_last(&irda.event_queue, (QUEUE *) new);
+ enqueue_last(&irda.event_queue, (queue_t *) new);
/* Wake up irmanager sleeping on read */
wake_up_interruptible(&irda.wait_queue);
@@ -388,10 +391,10 @@ void irmanager_notify( struct irmanager_event *event)
static int irda_open( struct inode * inode, struct file *file)
{
- DEBUG( 4, __FUNCTION__ "()\n");
+ IRDA_DEBUG( 4, __FUNCTION__ "()\n");
if ( irda.in_use) {
- DEBUG( 0, __FUNCTION__ "(), irmanager is already running!\n");
+ IRDA_DEBUG( 0, __FUNCTION__ "(), irmanager is already running!\n");
return -1;
}
irda.in_use = TRUE;
@@ -414,7 +417,7 @@ static int irda_ioctl( struct inode *inode, struct file *filp,
int err = 0;
int size = _IOC_SIZE(cmd);
- DEBUG(4, __FUNCTION__ "()\n");
+ IRDA_DEBUG(4, __FUNCTION__ "()\n");
if ( _IOC_DIR(cmd) & _IOC_READ)
err = verify_area( VERIFY_WRITE, (void *) arg, size);
@@ -426,7 +429,7 @@ static int irda_ioctl( struct inode *inode, struct file *filp,
switch( cmd) {
case IRMGR_IOCTNPC:
/* Got process context! */
- DEBUG(4, __FUNCTION__ "(), got process context!\n");
+ IRDA_DEBUG(4, __FUNCTION__ "(), got process context!\n");
while ((todo = (struct irda_todo *) dequeue_first(
&irda.todo_queue)) != NULL)
@@ -446,7 +449,7 @@ static int irda_ioctl( struct inode *inode, struct file *filp,
static int irda_close(struct inode *inode, struct file *file)
{
- DEBUG(4, __FUNCTION__ "()\n");
+ IRDA_DEBUG(4, __FUNCTION__ "()\n");
MOD_DEC_USE_COUNT;
@@ -462,7 +465,7 @@ static ssize_t irda_read(struct file *file, char *buffer, size_t count,
unsigned long flags;
int len;
- DEBUG(4, __FUNCTION__ "()\n");
+ IRDA_DEBUG(4, __FUNCTION__ "()\n");
/* * Go to sleep and wait for event if there is no event to be read! */
save_flags( flags);
@@ -494,14 +497,14 @@ static ssize_t irda_read(struct file *file, char *buffer, size_t count,
static ssize_t irda_write(struct file *file, const char *buffer,
size_t count, loff_t *noidea)
{
- DEBUG(0, __FUNCTION__ "()\n");
+ IRDA_DEBUG(0, __FUNCTION__ "()\n");
return 0;
}
static u_int irda_poll(struct file *file, poll_table *wait)
{
- DEBUG(0, __FUNCTION__ "(), Sorry not implemented yet!\n");
+ IRDA_DEBUG(0, __FUNCTION__ "(), Sorry not implemented yet!\n");
return 0;
}
diff --git a/net/irda/irproc.c b/net/irda/irproc.c
index cb361a787..940aacf7c 100644
--- a/net/irda/irproc.c
+++ b/net/irda/irproc.c
@@ -6,10 +6,11 @@
* Status: Experimental.
* Author: Thomas Davis, <ratbert@radiks.net>
* Created at: Sat Feb 21 21:33:24 1998
- * Modified at: Fri Jun 4 09:39:49 1999
+ * Modified at: Fri Oct 8 09:26:46 1999
* Modified by: Dag Brattli <dagb@cs.uit.no>
- *
- * Copyright (c) 1998-1999, Thomas Davis, <ratbert@radiks.net>,
+ *
+ * Copyright (c) 1998-1999, Dag Brattli <dagb@cs.uit.no>
+ * Copyright (c) 1998, Thomas Davis, <ratbert@radiks.net>,
* All Rights Reserved.
*
* This program is free software; you can redistribute it and/or
@@ -30,8 +31,6 @@
#include <net/irda/irlap.h>
#include <net/irda/irlmp.h>
-extern int irda_device_proc_read(char *buf, char **start, off_t offset,
- int len, int unused);
extern int irlap_proc_read(char *buf, char **start, off_t offset, int len,
int unused);
extern int irlmp_proc_read(char *buf, char **start, off_t offset, int len,
@@ -43,16 +42,6 @@ extern int irias_proc_read(char *buf, char **start, off_t offset, int len,
extern int discovery_proc_read(char *buf, char **start, off_t offset, int len,
int unused);
-/* enum irda_directory_inos { */
-/* PROC_IRDA_LAP = 1, */
-/* PROC_IRDA_LMP, */
-/* PROC_IRDA_TTP, */
-/* PROC_IRDA_LPT, */
-/* PROC_IRDA_COMM, */
-/* PROC_IRDA_IRDA_DEVICE, */
-/* PROC_IRDA_IRIAS */
-/* }; */
-
struct irda_entry {
char *name;
int (*fn)(char*, char**, off_t, int, int);
@@ -62,7 +51,6 @@ struct proc_dir_entry *proc_irda;
static struct irda_entry dir[] = {
{"discovery", discovery_proc_read},
- {"irda_device", irda_device_proc_read},
{"irttp", irttp_proc_read},
{"irlmp", irlmp_proc_read},
{"irlap", irlap_proc_read},
diff --git a/net/irda/irqueue.c b/net/irda/irqueue.c
index 4b9532f1b..91a7a6f85 100644
--- a/net/irda/irqueue.c
+++ b/net/irda/irqueue.c
@@ -6,7 +6,7 @@
* Status: Experimental.
* Author: Dag Brattli <dagb@cs.uit.no>
* Created at: Tue Jun 9 13:29:31 1998
- * Modified at: Thu Jun 10 11:00:12 1999
+ * Modified at: Tue Oct 5 09:02:15 1999
* Modified by: Dag Brattli <dagb@cs.uit.no>
*
* Copyright (C) 1998-1999, Aage Kvalnes <aage@cs.uit.no>
@@ -36,7 +36,7 @@
#include <net/irda/irqueue.h>
#include <net/irda/irmod.h>
-static QUEUE *dequeue_general( QUEUE **queue, QUEUE* element);
+static queue_t *dequeue_general( queue_t **queue, queue_t* element);
static __u32 hash( char* name);
/*
@@ -79,7 +79,7 @@ hashbin_t *hashbin_new(int type)
*/
int hashbin_clear( hashbin_t* hashbin, FREE_FUNC free_func)
{
- QUEUE* queue;
+ queue_t* queue;
int i;
ASSERT(hashbin != NULL, return -1;);
@@ -89,12 +89,12 @@ int hashbin_clear( hashbin_t* hashbin, FREE_FUNC free_func)
* Free the entries in the hashbin
*/
for ( i = 0; i < HASHBIN_SIZE; i ++ ) {
- queue = dequeue_first( (QUEUE**) &hashbin->hb_queue[ i]);
+ queue = dequeue_first( (queue_t**) &hashbin->hb_queue[ i]);
while( queue ) {
if ( free_func)
(*free_func)( queue );
queue = dequeue_first(
- (QUEUE**) &hashbin->hb_queue[ i]);
+ (queue_t**) &hashbin->hb_queue[ i]);
}
}
hashbin->hb_size = 0;
@@ -112,7 +112,7 @@ int hashbin_clear( hashbin_t* hashbin, FREE_FUNC free_func)
*/
int hashbin_delete( hashbin_t* hashbin, FREE_FUNC free_func)
{
- QUEUE* queue;
+ queue_t* queue;
int i;
ASSERT(hashbin != NULL, return -1;);
@@ -123,12 +123,12 @@ int hashbin_delete( hashbin_t* hashbin, FREE_FUNC free_func)
* it has been shown to work
*/
for (i = 0; i < HASHBIN_SIZE; i ++ ) {
- queue = dequeue_first((QUEUE**) &hashbin->hb_queue[i]);
+ queue = dequeue_first((queue_t**) &hashbin->hb_queue[i]);
while (queue ) {
if (free_func)
(*free_func)(queue);
queue = dequeue_first(
- (QUEUE**) &hashbin->hb_queue[i]);
+ (queue_t**) &hashbin->hb_queue[i]);
}
}
@@ -152,7 +152,7 @@ void hashbin_lock(hashbin_t* hashbin, __u32 hashv, char* name,
{
int bin;
- DEBUG(0, "hashbin_lock\n");
+ IRDA_DEBUG(0, "hashbin_lock\n");
ASSERT(hashbin != NULL, return;);
ASSERT(hashbin->magic == HB_MAGIC, return;);
@@ -184,7 +184,7 @@ void hashbin_unlock(hashbin_t* hashbin, __u32 hashv, char* name,
{
int bin;
- DEBUG(0, "hashbin_unlock()\n");
+ IRDA_DEBUG(0, "hashbin_unlock()\n");
ASSERT(hashbin != NULL, return;);
ASSERT(hashbin->magic == HB_MAGIC, return;);
@@ -210,12 +210,12 @@ void hashbin_unlock(hashbin_t* hashbin, __u32 hashv, char* name,
* Insert an entry into the hashbin
*
*/
-void hashbin_insert( hashbin_t* hashbin, QUEUE* entry, __u32 hashv, char* name)
+void hashbin_insert( hashbin_t* hashbin, queue_t* entry, __u32 hashv, char* name)
{
unsigned long flags = 0;
int bin;
- DEBUG( 4, __FUNCTION__"()\n");
+ IRDA_DEBUG( 4, __FUNCTION__"()\n");
ASSERT( hashbin != NULL, return;);
ASSERT( hashbin->magic == HB_MAGIC, return;);
@@ -250,7 +250,7 @@ void hashbin_insert( hashbin_t* hashbin, QUEUE* entry, __u32 hashv, char* name)
*/
if ( hashbin->hb_type & HB_SORTED) {
} else {
- enqueue_first( (QUEUE**) &hashbin->hb_queue[ bin ],
+ enqueue_first( (queue_t**) &hashbin->hb_queue[ bin ],
entry);
}
hashbin->hb_size++;
@@ -275,9 +275,9 @@ void* hashbin_find( hashbin_t* hashbin, __u32 hashv, char* name )
{
int bin, found = FALSE;
unsigned long flags = 0;
- QUEUE* entry;
+ queue_t* entry;
- DEBUG( 4, "hashbin_find()\n");
+ IRDA_DEBUG( 4, "hashbin_find()\n");
ASSERT( hashbin != NULL, return NULL;);
ASSERT( hashbin->magic == HB_MAGIC, return NULL;);
@@ -342,7 +342,7 @@ void* hashbin_find( hashbin_t* hashbin, __u32 hashv, char* name )
void *hashbin_remove_first( hashbin_t *hashbin)
{
unsigned long flags;
- QUEUE *entry = NULL;
+ queue_t *entry = NULL;
save_flags(flags);
cli();
@@ -367,9 +367,9 @@ void* hashbin_remove( hashbin_t* hashbin, __u32 hashv, char* name)
{
int bin, found = FALSE;
unsigned long flags = 0;
- QUEUE* entry;
+ queue_t* entry;
- DEBUG( 4, __FUNCTION__ "()\n");
+ IRDA_DEBUG( 4, __FUNCTION__ "()\n");
ASSERT( hashbin != NULL, return NULL;);
ASSERT( hashbin->magic == HB_MAGIC, return NULL;);
@@ -421,8 +421,8 @@ void* hashbin_remove( hashbin_t* hashbin, __u32 hashv, char* name)
* If entry was found, dequeue it
*/
if ( found ) {
- dequeue_general( (QUEUE**) &hashbin->hb_queue[ bin ],
- (QUEUE*) entry );
+ dequeue_general( (queue_t**) &hashbin->hb_queue[ bin ],
+ (queue_t*) entry );
hashbin->hb_size--;
/*
@@ -457,9 +457,9 @@ void* hashbin_remove( hashbin_t* hashbin, __u32 hashv, char* name)
* called before any calls to hashbin_get_next()!
*
*/
-QUEUE *hashbin_get_first( hashbin_t* hashbin)
+queue_t *hashbin_get_first( hashbin_t* hashbin)
{
- QUEUE *entry;
+ queue_t *entry;
int i;
ASSERT( hashbin != NULL, return NULL;);
@@ -489,9 +489,9 @@ QUEUE *hashbin_get_first( hashbin_t* hashbin)
* NULL when all items have been traversed
*
*/
-QUEUE *hashbin_get_next( hashbin_t *hashbin)
+queue_t *hashbin_get_next( hashbin_t *hashbin)
{
- QUEUE* entry;
+ queue_t* entry;
int bin;
int i;
@@ -542,9 +542,9 @@ QUEUE *hashbin_get_next( hashbin_t *hashbin)
* Insert item into end of queue.
*
*/
-static void __enqueue_last( QUEUE **queue, QUEUE* element)
+static void __enqueue_last( queue_t **queue, queue_t* element)
{
- DEBUG( 4, __FUNCTION__ "()\n");
+ IRDA_DEBUG( 4, __FUNCTION__ "()\n");
/*
* Check if queue is empty.
@@ -566,7 +566,7 @@ static void __enqueue_last( QUEUE **queue, QUEUE* element)
}
}
-inline void enqueue_last( QUEUE **queue, QUEUE* element)
+inline void enqueue_last( queue_t **queue, queue_t* element)
{
unsigned long flags;
@@ -584,10 +584,10 @@ inline void enqueue_last( QUEUE **queue, QUEUE* element)
* Insert item first in queue.
*
*/
-void enqueue_first(QUEUE **queue, QUEUE* element)
+void enqueue_first(queue_t **queue, queue_t* element)
{
- DEBUG( 4, __FUNCTION__ "()\n");
+ IRDA_DEBUG( 4, __FUNCTION__ "()\n");
/*
* Check if queue is empty.
@@ -616,9 +616,9 @@ void enqueue_first(QUEUE **queue, QUEUE* element)
* Insert a queue (list) into the start of the first queue
*
*/
-void enqueue_queue( QUEUE** queue, QUEUE** list )
+void enqueue_queue( queue_t** queue, queue_t** list )
{
- QUEUE* tmp;
+ queue_t* tmp;
/*
* Check if queue is empty
@@ -643,9 +643,9 @@ void enqueue_queue( QUEUE** queue, QUEUE** list )
*
*/
#if 0
-static void enqueue_second(QUEUE **queue, QUEUE* element)
+static void enqueue_second(queue_t **queue, queue_t* element)
{
- DEBUG( 0, "enqueue_second()\n");
+ IRDA_DEBUG( 0, "enqueue_second()\n");
/*
* Check if queue is empty.
@@ -674,11 +674,11 @@ static void enqueue_second(QUEUE **queue, QUEUE* element)
* Remove first entry in queue
*
*/
-QUEUE *dequeue_first(QUEUE **queue)
+queue_t *dequeue_first(queue_t **queue)
{
- QUEUE *ret;
+ queue_t *ret;
- DEBUG( 4, "dequeue_first()\n");
+ IRDA_DEBUG( 4, "dequeue_first()\n");
/*
* Set return value
@@ -715,11 +715,11 @@ QUEUE *dequeue_first(QUEUE **queue)
*
*
*/
-static QUEUE *dequeue_general(QUEUE **queue, QUEUE* element)
+static queue_t *dequeue_general(queue_t **queue, queue_t* element)
{
- QUEUE *ret;
+ queue_t *ret;
- DEBUG( 4, "dequeue_general()\n");
+ IRDA_DEBUG( 4, "dequeue_general()\n");
/*
* Set return value
diff --git a/net/irda/irttp.c b/net/irda/irttp.c
index 43fb65380..304f39e10 100644
--- a/net/irda/irttp.c
+++ b/net/irda/irttp.c
@@ -6,7 +6,7 @@
* Status: Experimental.
* Author: Dag Brattli <dagb@cs.uit.no>
* Created at: Sun Aug 31 20:14:31 1997
- * Modified at: Mon Sep 27 12:02:52 1999
+ * Modified at: Tue Oct 19 21:40:00 1999
* Modified by: Dag Brattli <dagb@cs.uit.no>
*
* Copyright (c) 1998-1999 Dag Brattli <dagb@cs.uit.no>,
@@ -90,7 +90,7 @@ int __init irttp_init(void)
irttp->tsaps = hashbin_new(HB_LOCAL);
if (!irttp->tsaps) {
- printk(KERN_WARNING "IrDA: Can't allocate IrTTP hashbin!\n");
+ ERROR(__FUNCTION__ "(), can't allocate IrTTP hashbin!\n");
return -ENOMEM;
}
@@ -140,7 +140,7 @@ struct tsap_cb *irttp_open_tsap(__u8 stsap_sel, int credit, notify_t *notify)
self = kmalloc(sizeof(struct tsap_cb), GFP_ATOMIC);
if (self == NULL) {
- DEBUG(0, __FUNCTION__ "(), unable to kmalloc!\n");
+ IRDA_DEBUG(0, __FUNCTION__ "(), unable to kmalloc!\n");
return NULL;
}
memset(self, 0, sizeof(struct tsap_cb));
@@ -168,7 +168,7 @@ struct tsap_cb *irttp_open_tsap(__u8 stsap_sel, int credit, notify_t *notify)
*/
lsap = irlmp_open_lsap(stsap_sel, &ttp_notify);
if (lsap == NULL) {
- printk(KERN_ERR "IrTTP, Unable to get LSAP!!\n");
+ WARNING(__FUNCTION__ "(), unable to allocate LSAP!!\n");
return NULL;
}
@@ -178,12 +178,12 @@ struct tsap_cb *irttp_open_tsap(__u8 stsap_sel, int credit, notify_t *notify)
* the stsap_sel we have might not be valid anymore
*/
self->stsap_sel = lsap->slsap_sel;
- DEBUG(4, __FUNCTION__ "(), stsap_sel=%02x\n", self->stsap_sel);
+ IRDA_DEBUG(4, __FUNCTION__ "(), stsap_sel=%02x\n", self->stsap_sel);
self->notify = *notify;
self->lsap = lsap;
- hashbin_insert(irttp->tsaps, (QUEUE *) self, (int) self, NULL);
+ hashbin_insert(irttp->tsaps, (queue_t *) self, (int) self, NULL);
if (credit > TTP_MAX_QUEUE)
self->initial_credit = TTP_MAX_QUEUE;
@@ -227,7 +227,7 @@ int irttp_close_tsap(struct tsap_cb *self)
{
struct tsap_cb *tsap;
- DEBUG(4, __FUNCTION__ "()\n");
+ IRDA_DEBUG(4, __FUNCTION__ "()\n");
ASSERT(self != NULL, return -1;);
ASSERT(self->magic == TTP_TSAP_MAGIC, return -1;);
@@ -236,7 +236,7 @@ int irttp_close_tsap(struct tsap_cb *self)
if (self->connected) {
/* Check if disconnect is not pending */
if (!self->disconnect_pend) {
- DEBUG(0, __FUNCTION__ "(), TSAP still connected!\n");
+ IRDA_DEBUG(0, __FUNCTION__ "(), TSAP still connected!\n");
irttp_disconnect_request(self, NULL, P_NORMAL);
}
self->close_pend = TRUE;
@@ -272,16 +272,16 @@ int irttp_udata_request(struct tsap_cb *self, struct sk_buff *skb)
ASSERT(self->magic == TTP_TSAP_MAGIC, return -1;);
ASSERT(skb != NULL, return -1;);
- DEBUG(4, __FUNCTION__ "()\n");
+ IRDA_DEBUG(4, __FUNCTION__ "()\n");
/* Check that nothing bad happens */
if ((skb->len == 0) || (!self->connected)) {
- DEBUG(1, __FUNCTION__ "(), No data, or not connected\n");
+ IRDA_DEBUG(1, __FUNCTION__ "(), No data, or not connected\n");
return -1;
}
if (skb->len > self->max_seg_size) {
- DEBUG(1, __FUNCTION__ "(), UData is to large for IrLAP!\n");
+ IRDA_DEBUG(1, __FUNCTION__ "(), UData is to large for IrLAP!\n");
return -1;
}
@@ -476,7 +476,7 @@ void irttp_give_credit(struct tsap_cb *self)
ASSERT(self != NULL, return;);
ASSERT(self->magic == TTP_TSAP_MAGIC, return;);
- DEBUG(4, __FUNCTION__ "() send=%d,avail=%d,remote=%d\n",
+ IRDA_DEBUG(4, __FUNCTION__ "() send=%d,avail=%d,remote=%d\n",
self->send_credit, self->avail_credit, self->remote_credit);
/* Give credit to peer */
@@ -524,7 +524,7 @@ static int irttp_udata_indication(void *instance, void *sap,
{
struct tsap_cb *self;
- DEBUG(4, __FUNCTION__ "()\n");
+ IRDA_DEBUG(4, __FUNCTION__ "()\n");
self = (struct tsap_cb *) instance;
@@ -610,24 +610,24 @@ static int irttp_data_indication(void *instance, void *sap,
*/
void irttp_flow_request(struct tsap_cb *self, LOCAL_FLOW flow)
{
- DEBUG(1, __FUNCTION__ "()\n");
+ IRDA_DEBUG(1, __FUNCTION__ "()\n");
ASSERT(self != NULL, return;);
ASSERT(self->magic == TTP_TSAP_MAGIC, return;);
switch (flow) {
case FLOW_STOP:
- DEBUG(1, __FUNCTION__ "(), flow stop\n");
+ IRDA_DEBUG(1, __FUNCTION__ "(), flow stop\n");
self->rx_sdu_busy = TRUE;
break;
case FLOW_START:
- DEBUG(1, __FUNCTION__ "(), flow start\n");
+ IRDA_DEBUG(1, __FUNCTION__ "(), flow start\n");
self->rx_sdu_busy = FALSE;
irttp_run_rx_queue(self);
break;
default:
- DEBUG(1, __FUNCTION__ "(), Unknown flow command!\n");
+ IRDA_DEBUG(1, __FUNCTION__ "(), Unknown flow command!\n");
}
}
@@ -646,7 +646,7 @@ int irttp_connect_request(struct tsap_cb *self, __u8 dtsap_sel,
__u8 *frame;
__u8 n;
- DEBUG(4, __FUNCTION__ "(), max_sdu_size=%d\n", max_sdu_size);
+ IRDA_DEBUG(4, __FUNCTION__ "(), max_sdu_size=%d\n", max_sdu_size);
ASSERT(self != NULL, return -EBADR;);
ASSERT(self->magic == TTP_TSAP_MAGIC, return -EBADR;);
@@ -738,7 +738,7 @@ static void irttp_connect_confirm(void *instance, void *sap,
__u8 plen;
__u8 n;
- DEBUG(4, __FUNCTION__ "()\n");
+ IRDA_DEBUG(4, __FUNCTION__ "()\n");
self = (struct tsap_cb *) instance;
@@ -754,15 +754,15 @@ static void irttp_connect_confirm(void *instance, void *sap,
* negotiated QoS for the link.
*/
if (qos) {
- DEBUG(4, "IrTTP, Negotiated BAUD_RATE: %02x\n",
+ IRDA_DEBUG(4, "IrTTP, Negotiated BAUD_RATE: %02x\n",
qos->baud_rate.bits);
- DEBUG(4, "IrTTP, Negotiated BAUD_RATE: %d bps.\n",
+ IRDA_DEBUG(4, "IrTTP, Negotiated BAUD_RATE: %d bps.\n",
qos->baud_rate.value);
}
n = skb->data[0] & 0x7f;
- DEBUG(4, __FUNCTION__ "(), Initial send_credit=%d\n", n);
+ IRDA_DEBUG(4, __FUNCTION__ "(), Initial send_credit=%d\n", n);
self->send_credit = n;
self->tx_max_sdu_size = 0;
@@ -777,7 +777,7 @@ static void irttp_connect_confirm(void *instance, void *sap,
plen = skb->data[0];
ret = irda_param_extract_all(self, skb->data+1,
- MIN(skb->len-1, plen),
+ IRDA_MIN(skb->len-1, plen),
&param_info);
/* Any errors in the parameter list? */
@@ -790,13 +790,13 @@ static void irttp_connect_confirm(void *instance, void *sap,
return;
}
/* Remove parameters */
- skb_pull(skb, MIN(skb->len, plen+1));
+ skb_pull(skb, IRDA_MIN(skb->len, plen+1));
}
- DEBUG(4, __FUNCTION__ "() send=%d,avail=%d,remote=%d\n",
+ IRDA_DEBUG(4, __FUNCTION__ "() send=%d,avail=%d,remote=%d\n",
self->send_credit, self->avail_credit, self->remote_credit);
- DEBUG(2, __FUNCTION__ "(), MaxSduSize=%d\n", self->tx_max_sdu_size);
+ IRDA_DEBUG(2, __FUNCTION__ "(), MaxSduSize=%d\n", self->tx_max_sdu_size);
if (self->notify.connect_confirm) {
self->notify.connect_confirm(self->notify.instance, self, qos,
@@ -833,7 +833,7 @@ void irttp_connect_indication(void *instance, void *sap, struct qos_info *qos,
self->max_seg_size = max_seg_size;
self->max_header_size = max_header_size+TTP_HEADER;
- DEBUG(4, __FUNCTION__ "(), TSAP sel=%02x\n", self->stsap_sel);
+ IRDA_DEBUG(4, __FUNCTION__ "(), TSAP sel=%02x\n", self->stsap_sel);
/* Need to update dtsap_sel if its equal to LSAP_ANY */
self->dtsap_sel = lsap->dlsap_sel;
@@ -852,7 +852,7 @@ void irttp_connect_indication(void *instance, void *sap, struct qos_info *qos,
plen = skb->data[0];
ret = irda_param_extract_all(self, skb->data+1,
- MIN(skb->len-1, plen),
+ IRDA_MIN(skb->len-1, plen),
&param_info);
/* Any errors in the parameter list? */
@@ -866,7 +866,7 @@ void irttp_connect_indication(void *instance, void *sap, struct qos_info *qos,
}
/* Remove parameters */
- skb_pull(skb, MIN(skb->len, plen+1));
+ skb_pull(skb, IRDA_MIN(skb->len, plen+1));
}
if (self->notify.connect_indication) {
@@ -894,7 +894,7 @@ int irttp_connect_response(struct tsap_cb *self, __u32 max_sdu_size,
ASSERT(self != NULL, return -1;);
ASSERT(self->magic == TTP_TSAP_MAGIC, return -1;);
- DEBUG(4, __FUNCTION__ "(), Source TSAP selector=%02x\n",
+ IRDA_DEBUG(4, __FUNCTION__ "(), Source TSAP selector=%02x\n",
self->stsap_sel);
/* Any userdata supplied? */
@@ -972,15 +972,15 @@ struct tsap_cb *irttp_dup(struct tsap_cb *orig, void *instance)
{
struct tsap_cb *new;
- DEBUG(1, __FUNCTION__ "()\n");
+ IRDA_DEBUG(1, __FUNCTION__ "()\n");
if (!hashbin_find(irttp->tsaps, (int) orig, NULL)) {
- DEBUG(0, __FUNCTION__ "(), unable to find TSAP\n");
+ IRDA_DEBUG(0, __FUNCTION__ "(), unable to find TSAP\n");
return NULL;
}
new = kmalloc(sizeof(struct tsap_cb), GFP_ATOMIC);
if (!new) {
- DEBUG(0, __FUNCTION__ "(), unable to kmalloc\n");
+ IRDA_DEBUG(0, __FUNCTION__ "(), unable to kmalloc\n");
return NULL;
}
/* Dup */
@@ -995,7 +995,7 @@ struct tsap_cb *irttp_dup(struct tsap_cb *orig, void *instance)
skb_queue_head_init(&new->tx_queue);
skb_queue_head_init(&new->rx_fragments);
- hashbin_insert(irttp->tsaps, (QUEUE *) new, (int) new, NULL);
+ hashbin_insert(irttp->tsaps, (queue_t *) new, (int) new, NULL);
return new;
}
@@ -1018,13 +1018,13 @@ int irttp_disconnect_request(struct tsap_cb *self, struct sk_buff *userdata,
/* Already disconnected? */
if (!self->connected) {
- DEBUG(4, __FUNCTION__ "(), already disconnected!\n");
+ IRDA_DEBUG(4, __FUNCTION__ "(), already disconnected!\n");
return -1;
}
/* Disconnect already pending? */
if (self->disconnect_pend) {
- DEBUG(1, __FUNCTION__ "(), disconnect already pending\n");
+ IRDA_DEBUG(1, __FUNCTION__ "(), disconnect already pending\n");
if (userdata) {
dev_kfree_skb(userdata);
}
@@ -1039,7 +1039,7 @@ int irttp_disconnect_request(struct tsap_cb *self, struct sk_buff *userdata,
*/
if (skb_queue_len(&self->tx_queue) > 0) {
if (priority == P_HIGH) {
- DEBUG(1, __FUNCTION__ "High priority!!()\n" );
+ IRDA_DEBUG(1, __FUNCTION__ "High priority!!()\n" );
/*
* No need to send the queued data, if we are
@@ -1065,7 +1065,7 @@ int irttp_disconnect_request(struct tsap_cb *self, struct sk_buff *userdata,
return -1;
}
}
- DEBUG(1, __FUNCTION__ "(), Disconnecting ...\n");
+ IRDA_DEBUG(1, __FUNCTION__ "(), Disconnecting ...\n");
self->connected = FALSE;
@@ -1097,7 +1097,7 @@ void irttp_disconnect_indication(void *instance, void *sap, LM_REASON reason,
{
struct tsap_cb *self;
- DEBUG(4, __FUNCTION__ "()\n");
+ IRDA_DEBUG(4, __FUNCTION__ "()\n");
self = (struct tsap_cb *) instance;
@@ -1132,7 +1132,7 @@ void irttp_do_data_indication(struct tsap_cb *self, struct sk_buff *skb)
* give an error back
*/
if (err == -ENOMEM) {
- DEBUG(0, __FUNCTION__ "() requeueing skb!\n");
+ IRDA_DEBUG(0, __FUNCTION__ "() requeueing skb!\n");
/* Make sure we take a break */
self->rx_sdu_busy = TRUE;
@@ -1157,7 +1157,7 @@ void irttp_run_rx_queue(struct tsap_cb *self)
struct sk_buff *skb;
int more = 0;
- DEBUG(4, __FUNCTION__ "() send=%d,avail=%d,remote=%d\n",
+ IRDA_DEBUG(4, __FUNCTION__ "() send=%d,avail=%d,remote=%d\n",
self->send_credit, self->avail_credit, self->remote_credit);
if (irda_lock(&self->rx_queue_lock) == FALSE)
@@ -1197,7 +1197,7 @@ void irttp_run_rx_queue(struct tsap_cb *self)
* limits of the maximum size of the rx_sdu
*/
if (self->rx_sdu_size <= self->rx_max_sdu_size) {
- DEBUG(4, __FUNCTION__ "(), queueing frag\n");
+ IRDA_DEBUG(4, __FUNCTION__ "(), queueing frag\n");
skb_queue_tail(&self->rx_fragments, skb);
} else {
/* Free the part of the SDU that is too big */
@@ -1227,7 +1227,7 @@ void irttp_run_rx_queue(struct tsap_cb *self)
/* Now we can deliver the reassembled skb */
irttp_do_data_indication(self, skb);
} else {
- DEBUG(1, __FUNCTION__ "(), Truncated frame\n");
+ IRDA_DEBUG(1, __FUNCTION__ "(), Truncated frame\n");
/* Free the part of the SDU that is too big */
dev_kfree_skb(skb);
@@ -1252,7 +1252,7 @@ void irttp_flush_queues(struct tsap_cb *self)
{
struct sk_buff* skb;
- DEBUG(4, __FUNCTION__ "()\n");
+ IRDA_DEBUG(4, __FUNCTION__ "()\n");
ASSERT(self != NULL, return;);
ASSERT(self->magic == TTP_TSAP_MAGIC, return;);
@@ -1285,7 +1285,7 @@ static struct sk_buff *irttp_reassemble_skb(struct tsap_cb *self)
ASSERT(self != NULL, return NULL;);
ASSERT(self->magic == TTP_TSAP_MAGIC, return NULL;);
- DEBUG(4, __FUNCTION__ "(), self->rx_sdu_size=%d\n",
+ IRDA_DEBUG(4, __FUNCTION__ "(), self->rx_sdu_size=%d\n",
self->rx_sdu_size);
skb = dev_alloc_skb(self->rx_sdu_size);
@@ -1308,10 +1308,10 @@ static struct sk_buff *irttp_reassemble_skb(struct tsap_cb *self)
dev_kfree_skb(frag);
}
- DEBUG(4, __FUNCTION__ "(), frame len=%d\n", n);
+ IRDA_DEBUG(4, __FUNCTION__ "(), frame len=%d\n", n);
/* Set the new length */
- DEBUG(4, __FUNCTION__ "(), rx_sdu_size=%d\n", self->rx_sdu_size);
+ IRDA_DEBUG(4, __FUNCTION__ "(), rx_sdu_size=%d\n", self->rx_sdu_size);
ASSERT(n <= self->rx_sdu_size, return NULL;);
skb_trim(skb, n);
@@ -1331,7 +1331,7 @@ static void irttp_fragment_skb(struct tsap_cb *self, struct sk_buff *skb)
struct sk_buff *frag;
__u8 *frame;
- DEBUG(4, __FUNCTION__ "()\n");
+ IRDA_DEBUG(4, __FUNCTION__ "()\n");
ASSERT(self != NULL, return;);
ASSERT(self->magic == TTP_TSAP_MAGIC, return;);
@@ -1346,7 +1346,7 @@ static void irttp_fragment_skb(struct tsap_cb *self, struct sk_buff *skb)
* queue what is left of the original skb
*/
if (skb->len < self->max_seg_size) {
- DEBUG(4, __FUNCTION__
+ IRDA_DEBUG(4, __FUNCTION__
"(), queuing last segment\n");
frame = skb_push(skb, TTP_HEADER);
@@ -1399,7 +1399,7 @@ static int irttp_param_max_sdu_size(void *instance, param_t *param, int get)
else
self->tx_max_sdu_size = param->pv.i;
- DEBUG(0, __FUNCTION__ "(), MaxSduSize=%d\n", param->pv.i);
+ IRDA_DEBUG(0, __FUNCTION__ "(), MaxSduSize=%d\n", param->pv.i);
return 0;
}
diff --git a/net/irda/parameters.c b/net/irda/parameters.c
index 630618bdb..9ca443f02 100644
--- a/net/irda/parameters.c
+++ b/net/irda/parameters.c
@@ -6,7 +6,7 @@
* Status: Experimental.
* Author: Dag Brattli <dagb@cs.uit.no>
* Created at: Mon Jun 7 10:25:11 1999
- * Modified at: Wed Aug 25 13:31:32 1999
+ * Modified at: Tue Oct 5 11:52:54 1999
* Modified by: Dag Brattli <dagb@cs.uit.no>
*
* Copyright (c) 1999 Dag Brattli, All Rights Reserved.
@@ -29,6 +29,7 @@
********************************************************************/
#include <asm/unaligned.h>
+#include <asm/byteorder.h>
#include <net/irda/irda.h>
#include <net/irda/parameters.h>
@@ -148,13 +149,13 @@ static int irda_insert_integer(void *self, __u8 *buf, int len, __u8 pi,
*/
if (p.pl == 0) {
if (p.pv.i < 0xff) {
- DEBUG(2, __FUNCTION__ "(), using 1 byte\n");
+ IRDA_DEBUG(2, __FUNCTION__ "(), using 1 byte\n");
p.pl = 1;
} else if (p.pv.i < 0xffff) {
- DEBUG(2, __FUNCTION__ "(), using 2 bytes\n");
+ IRDA_DEBUG(2, __FUNCTION__ "(), using 2 bytes\n");
p.pl = 2;
} else {
- DEBUG(2, __FUNCTION__ "(), using 4 bytes\n");
+ IRDA_DEBUG(2, __FUNCTION__ "(), using 4 bytes\n");
p.pl = 4; /* Default length */
}
}
@@ -163,7 +164,7 @@ static int irda_insert_integer(void *self, __u8 *buf, int len, __u8 pi,
WARNING(__FUNCTION__ "(), buffer to short for insertion!\n");
return -1;
}
- DEBUG(2, __FUNCTION__ "(), pi=%#x, pl=%d, pi=%d\n", p.pi, p.pl, p.pv.i);
+ IRDA_DEBUG(2, __FUNCTION__ "(), pi=%#x, pl=%d, pi=%d\n", p.pi, p.pl, p.pv.i);
switch (p.pl) {
case 1:
n += irda_param_pack(buf, "bbb", p.pi, p.pl, p.pv.b);
@@ -275,12 +276,12 @@ static int irda_extract_string(void *self, __u8 *buf, int len, __u8 pi,
param_t p;
int err;
- DEBUG(2, __FUNCTION__ "()\n");
+ IRDA_DEBUG(2, __FUNCTION__ "()\n");
p.pi = pi; /* In case handler needs to know */
p.pl = buf[1]; /* Extract lenght of value */
- DEBUG(2, __FUNCTION__ "(), pi=%#x, pl=%d\n", p.pi, p.pl);
+ IRDA_DEBUG(2, __FUNCTION__ "(), pi=%#x, pl=%d\n", p.pi, p.pl);
/* Check if buffer is long enough for parsing */
if (len < (2+p.pl)) {
@@ -293,7 +294,7 @@ static int irda_extract_string(void *self, __u8 *buf, int len, __u8 pi,
* checked that the buffer is long enough */
strncpy(str, buf+2, p.pl);
- DEBUG(2, __FUNCTION__ "(), str=0x%02x 0x%02x\n", (__u8) str[0],
+ IRDA_DEBUG(2, __FUNCTION__ "(), str=0x%02x 0x%02x\n", (__u8) str[0],
(__u8) str[1]);
/* Null terminate string */
@@ -330,7 +331,7 @@ static int irda_extract_octseq(void *self, __u8 *buf, int len, __u8 pi,
return -1;
}
- DEBUG(0, __FUNCTION__ "(), not impl\n");
+ IRDA_DEBUG(0, __FUNCTION__ "(), not impl\n");
return p.pl+2; /* Extracted pl+2 bytes */
}
@@ -454,7 +455,7 @@ int irda_param_insert(void *self, __u8 pi, __u8 *buf, int len,
if ((pi_major > info->len-1) ||
(pi_minor > info->tables[pi_major].len-1))
{
- DEBUG(0, __FUNCTION__
+ IRDA_DEBUG(0, __FUNCTION__
"(), no handler for parameter=0x%02x\n", pi);
/* Skip this parameter */
@@ -467,7 +468,7 @@ int irda_param_insert(void *self, __u8 pi, __u8 *buf, int len,
/* Find expected data type for this parameter identifier (pi)*/
type = pi_minor_info->type;
- DEBUG(3, __FUNCTION__ "(), pi=[%d,%d], type=%d\n",
+ IRDA_DEBUG(3, __FUNCTION__ "(), pi=[%d,%d], type=%d\n",
pi_major, pi_minor, type);
/* Check if handler has been implemented */
@@ -509,7 +510,7 @@ int irda_param_extract(void *self, __u8 *buf, int len, pi_param_info_t *info)
if ((pi_major > info->len-1) ||
(pi_minor > info->tables[pi_major].len-1))
{
- DEBUG(0, __FUNCTION__ "(), no handler for parameter=0x%02x\n",
+ IRDA_DEBUG(0, __FUNCTION__ "(), no handler for parameter=0x%02x\n",
buf[0]);
/* Skip this parameter */
@@ -525,7 +526,7 @@ int irda_param_extract(void *self, __u8 *buf, int len, pi_param_info_t *info)
/* Find expected data type for this parameter identifier (pi)*/
type = pi_minor_info->type;
- DEBUG(3, __FUNCTION__ "(), pi=[%d,%d], type=%d\n",
+ IRDA_DEBUG(3, __FUNCTION__ "(), pi=[%d,%d], type=%d\n",
pi_major, pi_minor, type);
/* Check if handler has been implemented */
diff --git a/net/irda/qos.c b/net/irda/qos.c
index 6af865bac..0d9a2550b 100644
--- a/net/irda/qos.c
+++ b/net/irda/qos.c
@@ -7,7 +7,7 @@
* Status: Experimental.
* Author: Dag Brattli <dagb@cs.uit.no>
* Created at: Tue Sep 9 00:00:26 1997
- * Modified at: Wed Sep 1 09:14:55 1999
+ * Modified at: Tue Oct 5 11:50:41 1999
* Modified by: Dag Brattli <dagb@cs.uit.no>
*
* Copyright (c) 1998-1999 Dag Brattli <dagb@cs.uit.no>,
@@ -167,7 +167,7 @@ int irlap_qos_negotiate(struct irlap_cb *self, struct sk_buff *skb)
#ifdef CONFIG_IRDA_COMPRESSION
if (!comp_seen) {
- DEBUG( 4, __FUNCTION__ "(), Compression not seen!\n");
+ IRDA_DEBUG( 4, __FUNCTION__ "(), Compression not seen!\n");
self->qos_tx.compression.bits = 0x00;
self->qos_rx.compression.bits = 0x00;
}
@@ -177,22 +177,22 @@ int irlap_qos_negotiate(struct irlap_cb *self, struct sk_buff *skb)
irda_qos_bits_to_value(&self->qos_tx);
irda_qos_bits_to_value(&self->qos_rx);
- DEBUG(2, "Setting BAUD_RATE to %d bps.\n",
+ IRDA_DEBUG(2, "Setting BAUD_RATE to %d bps.\n",
self->qos_tx.baud_rate.value);
- DEBUG(2, "Setting DATA_SIZE to %d bytes\n",
+ IRDA_DEBUG(2, "Setting DATA_SIZE to %d bytes\n",
self->qos_tx.data_size.value);
- DEBUG(2, "Setting WINDOW_SIZE to %d\n",
+ IRDA_DEBUG(2, "Setting WINDOW_SIZE to %d\n",
self->qos_tx.window_size.value);
- DEBUG(2, "Setting XBOFS to %d\n",
+ IRDA_DEBUG(2, "Setting XBOFS to %d\n",
self->qos_tx.additional_bofs.value);
- DEBUG(2, "Setting MAX_TURN_TIME to %d ms.\n",
+ IRDA_DEBUG(2, "Setting MAX_TURN_TIME to %d ms.\n",
self->qos_tx.max_turn_time.value);
- DEBUG(2, "Setting MIN_TURN_TIME to %d usecs.\n",
+ IRDA_DEBUG(2, "Setting MIN_TURN_TIME to %d usecs.\n",
self->qos_tx.min_turn_time.value);
- DEBUG(2, "Setting LINK_DISC to %d secs.\n",
+ IRDA_DEBUG(2, "Setting LINK_DISC to %d secs.\n",
self->qos_tx.link_disc_time.value);
#ifdef CONFIG_IRDA_COMPRESSION
- DEBUG(2, "Setting COMPRESSION to %d\n",
+ IRDA_DEBUG(2, "Setting COMPRESSION to %d\n",
self->qos_tx.compression.value);
#endif
return ret;
@@ -278,16 +278,16 @@ static int irlap_param_baud_rate(void *instance, param_t *param, int get)
if (get) {
param->pv.i = self->qos_rx.baud_rate.bits;
- DEBUG(2, __FUNCTION__ "(), baud rate = 0x%02x\n", param->pv.i);
+ IRDA_DEBUG(2, __FUNCTION__ "(), baud rate = 0x%02x\n", param->pv.i);
} else {
/*
* Stations must agree on baud rate, so calculate
* intersection
*/
- DEBUG(2, "Requested BAUD_RATE: 0x%04x\n", param->pv.s);
+ IRDA_DEBUG(2, "Requested BAUD_RATE: 0x%04x\n", param->pv.s);
final = param->pv.s & self->qos_rx.baud_rate.bits;
- DEBUG(2, "Final BAUD_RATE: 0x%04x\n", final);
+ IRDA_DEBUG(2, "Final BAUD_RATE: 0x%04x\n", final);
self->qos_tx.baud_rate.bits = final;
self->qos_rx.baud_rate.bits = final;
}
@@ -317,10 +317,10 @@ static int irlap_param_link_disconnect(void *instance, param_t *param, int get)
* Stations must agree on link disconnect/threshold
* time.
*/
- DEBUG(2, "LINK_DISC: %02x\n", param->pv.b);
+ IRDA_DEBUG(2, "LINK_DISC: %02x\n", param->pv.b);
final = param->pv.b & self->qos_rx.link_disc_time.bits;
- DEBUG(2, "Final LINK_DISC: %02x\n", final);
+ IRDA_DEBUG(2, "Final LINK_DISC: %02x\n", final);
self->qos_tx.link_disc_time.bits = final;
self->qos_rx.link_disc_time.bits = final;
}
@@ -435,7 +435,7 @@ static int irlap_param_min_turn_time(void *instance, param_t *param, int get)
return 0;
}
-__u32 byte_value(__u8 byte, int *array)
+__u32 byte_value(__u8 byte, __u32 *array)
{
int index;
@@ -472,7 +472,7 @@ int msb_index (__u16 word)
*
* Returns the index to the value in the specified array
*/
-int value_index(__u32 value, int *array)
+int value_index(__u32 value, __u32 *array)
{
int i;
@@ -488,7 +488,7 @@ int value_index(__u32 value, int *array)
* Returns value to index in array, easy!
*
*/
-__u32 index_value(int index, int *array)
+__u32 index_value(int index, __u32 *array)
{
return array[index];
}
diff --git a/net/irda/timer.c b/net/irda/timer.c
index fab26fd37..974863721 100644
--- a/net/irda/timer.c
+++ b/net/irda/timer.c
@@ -6,7 +6,7 @@
* Status: Experimental.
* Author: Dag Brattli <dagb@cs.uit.no>
* Created at: Sat Aug 16 00:59:29 1997
- * Modified at: Mon Sep 20 11:32:37 1999
+ * Modified at: Thu Oct 7 12:30:19 1999
* Modified by: Dag Brattli <dagb@cs.uit.no>
*
* Copyright (c) 1997, 1999 Dag Brattli <dagb@cs.uit.no>,
@@ -32,13 +32,13 @@
#include <net/irda/irlap.h>
#include <net/irda/irlmp_event.h>
-static void irlap_slot_timer_expired( void* data);
-static void irlap_query_timer_expired( void* data);
-static void irlap_final_timer_expired( void* data);
-static void irlap_wd_timer_expired( void* data);
-static void irlap_backoff_timer_expired( void* data);
+static void irlap_slot_timer_expired(void* data);
+static void irlap_query_timer_expired(void* data);
+static void irlap_final_timer_expired(void* data);
+static void irlap_wd_timer_expired(void* data);
+static void irlap_backoff_timer_expired(void* data);
-static void irda_device_media_busy_expired( void* data);
+static void irlap_media_busy_expired(void* data);
/*
* Function irda_start_timer (timer, timeout)
*
@@ -63,57 +63,55 @@ void irda_start_timer(struct timer_list *ptimer, int timeout, void *data,
add_timer(ptimer);
}
-inline void irlap_start_slot_timer(struct irlap_cb *self, int timeout)
+void irlap_start_slot_timer(struct irlap_cb *self, int timeout)
{
irda_start_timer(&self->slot_timer, timeout, (void *) self,
irlap_slot_timer_expired);
}
-inline void irlap_start_query_timer(struct irlap_cb *self, int timeout)
+void irlap_start_query_timer(struct irlap_cb *self, int timeout)
{
irda_start_timer( &self->query_timer, timeout, (void *) self,
irlap_query_timer_expired);
}
-inline void irlap_start_final_timer(struct irlap_cb *self, int timeout)
+void irlap_start_final_timer(struct irlap_cb *self, int timeout)
{
irda_start_timer(&self->final_timer, timeout, (void *) self,
irlap_final_timer_expired);
}
-inline void irlap_start_wd_timer(struct irlap_cb *self, int timeout)
+void irlap_start_wd_timer(struct irlap_cb *self, int timeout)
{
irda_start_timer(&self->wd_timer, timeout, (void *) self,
irlap_wd_timer_expired);
}
-inline void irlap_start_backoff_timer(struct irlap_cb *self, int timeout)
+void irlap_start_backoff_timer(struct irlap_cb *self, int timeout)
{
irda_start_timer(&self->backoff_timer, timeout, (void *) self,
irlap_backoff_timer_expired);
}
-inline void irda_device_start_mbusy_timer(struct irda_device *self)
+void irlap_start_mbusy_timer(struct irlap_cb *self)
{
irda_start_timer(&self->media_busy_timer, MEDIABUSY_TIMEOUT,
- (void *) self,
- irda_device_media_busy_expired);
-
+ (void *) self, irlap_media_busy_expired);
}
-inline void irlmp_start_watchdog_timer(struct lsap_cb *self, int timeout)
+void irlmp_start_watchdog_timer(struct lsap_cb *self, int timeout)
{
irda_start_timer(&self->watchdog_timer, timeout, (void *) self,
irlmp_watchdog_timer_expired);
}
-inline void irlmp_start_discovery_timer(struct irlmp_cb *self, int timeout)
+void irlmp_start_discovery_timer(struct irlmp_cb *self, int timeout)
{
irda_start_timer(&self->discovery_timer, timeout, (void *) self,
irlmp_discovery_timer_expired);
}
-inline void irlmp_start_idle_timer(struct lap_cb *self, int timeout)
+void irlmp_start_idle_timer(struct lap_cb *self, int timeout)
{
irda_start_timer(&self->idle_timer, timeout, (void *) self,
irlmp_idle_timer_expired);
@@ -205,12 +203,11 @@ static void irlap_backoff_timer_expired(void *data)
*
*
*/
-void irda_device_media_busy_expired(void* data)
+void irlap_media_busy_expired(void* data)
{
- struct irda_device *self = (struct irda_device *) data;
+ struct irlap_cb *self = (struct irlap_cb *) data;
ASSERT(self != NULL, return;);
- ASSERT(self->magic == IRDA_DEVICE_MAGIC, return;);
- irda_device_set_media_busy(&self->netdev, FALSE);
+ irda_device_set_media_busy(self->netdev, FALSE);
}
diff --git a/net/irda/wrapper.c b/net/irda/wrapper.c
index 5f5ed14f3..f884290f7 100644
--- a/net/irda/wrapper.c
+++ b/net/irda/wrapper.c
@@ -6,7 +6,7 @@
* Status: Experimental.
* Author: Dag Brattli <dagb@cs.uit.no>
* Created at: Mon Aug 4 20:40:53 1997
- * Modified at: Mon Sep 20 11:18:44 1999
+ * Modified at: Mon Oct 18 15:51:58 1999
* Modified by: Dag Brattli <dagb@cs.uit.no>
* Modified at: Fri May 28 3:11 CST 1999
* Modified by: Horst von Brand <vonbrand@sleipnir.valparaiso.cl>
@@ -39,12 +39,17 @@
static inline int stuff_byte(__u8 byte, __u8 *buf);
-static void state_outside_frame(struct irda_device *idev, __u8 byte);
-static void state_begin_frame(struct irda_device *idev, __u8 byte);
-static void state_link_escape(struct irda_device *idev, __u8 byte);
-static void state_inside_frame(struct irda_device *idev, __u8 byte);
+static int state_outside_frame(struct net_device *dev,
+ struct iobuff_t *rx_buff, __u8 byte);
+static int state_begin_frame(struct net_device *dev,
+ struct iobuff_t *rx_buff, __u8 byte);
+static int state_link_escape(struct net_device *dev,
+ struct iobuff_t *rx_buff, __u8 byte);
+static int state_inside_frame(struct net_device *dev,
+ struct iobuff_t *rx_buff, __u8 byte);
-static void (*state[])(struct irda_device *idev, __u8 byte) =
+static int (*state[])(struct net_device *dev, struct iobuff_t *rx_buff,
+ __u8 byte) =
{
state_outside_frame,
state_begin_frame,
@@ -60,9 +65,9 @@ static void (*state[])(struct irda_device *idev, __u8 byte) =
*/
int async_wrap_skb(struct sk_buff *skb, __u8 *tx_buff, int buffsize)
{
+ int xbofs;
int i;
int n;
- int xbofs;
union {
__u16 value;
__u8 bytes[2];
@@ -77,7 +82,7 @@ int async_wrap_skb(struct sk_buff *skb, __u8 *tx_buff, int buffsize)
* additional XBOFS
*/
if (((struct irda_skb_cb *)(skb->cb))->magic != LAP_MAGIC) {
- DEBUG(1, __FUNCTION__ "(), wrong magic in skb!\n");
+ IRDA_DEBUG(1, __FUNCTION__ "(), wrong magic in skb!\n");
xbofs = 10;
} else
xbofs = ((struct irda_skb_cb *)(skb->cb))->xbofs;
@@ -116,40 +121,6 @@ int async_wrap_skb(struct sk_buff *skb, __u8 *tx_buff, int buffsize)
}
/*
- * Function async_bump (idev, buf, len)
- *
- * Got a frame, make a copy of it, and pass it up the stack!
- *
- */
-static inline void async_bump(struct irda_device *idev, __u8 *buf, int len)
-{
- struct sk_buff *skb;
-
- skb = dev_alloc_skb(len+1);
- if (!skb) {
- idev->stats.rx_dropped++;
- return;
- }
-
- /* Align IP header to 20 bytes */
- skb_reserve(skb, 1);
-
- /* Copy data without CRC */
- memcpy(skb_put(skb, len-2), buf, len-2);
-
- /*
- * Feed it to IrLAP layer
- */
- skb->dev = &idev->netdev;
- skb->mac.raw = skb->data;
- skb->protocol = htons(ETH_P_IRDA);
-
- netif_rx(skb);
- idev->stats.rx_packets++;
- idev->stats.rx_bytes += skb->len;
-}
-
-/*
* Function stuff_byte (byte, buf)
*
* Byte stuff one single byte and put the result in buffer pointed to by
@@ -176,38 +147,77 @@ static inline int stuff_byte(__u8 byte, __u8 *buf)
}
/*
- * Function async_unwrap_char (idev, byte)
+ * Function async_bump (buf, len, stats)
+ *
+ * Got a frame, make a copy of it, and pass it up the stack!
+ *
+ */
+int async_bump(struct net_device *dev, __u8 *buf, int len)
+{
+ struct net_device_stats *stats = dev->get_stats(dev);
+ struct sk_buff *skb;
+
+ skb = dev_alloc_skb(len+1);
+ if (!skb) {
+ stats->rx_dropped++;
+ return -ENOMEM;
+ }
+
+ /* Align IP header to 20 bytes */
+ skb_reserve(skb, 1);
+
+ /* Copy data without CRC */
+ memcpy(skb_put(skb, len-2), buf, len-2);
+
+ /* Feed it to IrLAP layer */
+ skb->dev = dev;
+ skb->mac.raw = skb->data;
+ skb->protocol = htons(ETH_P_IRDA);
+
+ netif_rx(skb);
+
+ stats->rx_packets++;
+ stats->rx_bytes += len;
+
+ return skb->len;
+}
+
+/*
+ * Function async_unwrap_char (dev, rx_buff, byte)
*
* Parse and de-stuff frame received from the IrDA-port
*
*/
-inline void async_unwrap_char(struct irda_device *idev, __u8 byte)
+inline int async_unwrap_char(struct net_device *dev, struct iobuff_t *rx_buff,
+ __u8 byte)
{
- (*state[idev->rx_buff.state]) (idev, byte);
+ return (*state[rx_buff->state])(dev, rx_buff, byte);
}
/*
- * Function state_outside_frame (idev, byte)
+ * Function state_outside_frame (dev, rx_buff, byte)
*
*
*
*/
-static void state_outside_frame(struct irda_device *idev, __u8 byte)
+static int state_outside_frame(struct net_device *dev,
+ struct iobuff_t *rx_buff, __u8 byte)
{
switch (byte) {
case BOF:
- idev->rx_buff.state = BEGIN_FRAME;
- idev->rx_buff.in_frame = TRUE;
+ rx_buff->state = BEGIN_FRAME;
+ rx_buff->in_frame = TRUE;
break;
case XBOF:
/* idev->xbofs++; */
break;
case EOF:
- irda_device_set_media_busy(&idev->netdev, TRUE);
+ irda_device_set_media_busy(dev, TRUE);
break;
default:
break;
}
+ return 0;
}
/*
@@ -216,38 +226,39 @@ static void state_outside_frame(struct irda_device *idev, __u8 byte)
* Begin of frame detected
*
*/
-static void state_begin_frame(struct irda_device *idev, __u8 byte)
+static int state_begin_frame(struct net_device *dev,
+ struct iobuff_t *rx_buff, __u8 byte)
{
+ struct net_device_stats *stats = dev->get_stats(dev);
+
+ /* Time to initialize receive buffer */
+ rx_buff->data = rx_buff->head;
+ rx_buff->len = 0;
+ rx_buff->fcs = INIT_FCS;
+
switch (byte) {
case BOF:
/* Continue */
break;
case CE:
/* Stuffed byte */
- idev->rx_buff.state = LINK_ESCAPE;
-
- /* Time to initialize receive buffer */
- idev->rx_buff.data = idev->rx_buff.head;
- idev->rx_buff.len = 0;
+ rx_buff->state = LINK_ESCAPE;
break;
case EOF:
/* Abort frame */
- idev->rx_buff.state = OUTSIDE_FRAME;
-
- idev->stats.rx_errors++;
- idev->stats.rx_frame_errors++;
- break;
- default:
- /* Time to initialize receive buffer */
- idev->rx_buff.data = idev->rx_buff.head;
- idev->rx_buff.len = 0;
+ rx_buff->state = OUTSIDE_FRAME;
- idev->rx_buff.data[idev->rx_buff.len++] = byte;
+ stats->rx_errors++;
+ stats->rx_frame_errors++;
+ break;
+ default:
+ rx_buff->data[rx_buff->len++] = byte;
- idev->rx_buff.fcs = irda_fcs(INIT_FCS, byte);
- idev->rx_buff.state = INSIDE_FRAME;
+ rx_buff->fcs = irda_fcs(rx_buff->fcs, byte);
+ rx_buff->state = INSIDE_FRAME;
break;
}
+ return 0;
}
/*
@@ -256,18 +267,19 @@ static void state_begin_frame(struct irda_device *idev, __u8 byte)
*
*
*/
-static void state_link_escape(struct irda_device *idev, __u8 byte)
+static int state_link_escape(struct net_device *dev,
+ struct iobuff_t *rx_buff, __u8 byte)
{
switch (byte) {
case BOF: /* New frame? */
- idev->rx_buff.state = BEGIN_FRAME;
- irda_device_set_media_busy(&idev->netdev, TRUE);
+ rx_buff->state = BEGIN_FRAME;
+ irda_device_set_media_busy(dev, TRUE);
break;
case CE:
- DEBUG(4, "WARNING: State not defined\n");
+ IRDA_DEBUG(4, "WARNING: State not defined\n");
break;
case EOF: /* Abort frame */
- idev->rx_buff.state = OUTSIDE_FRAME;
+ rx_buff->state = OUTSIDE_FRAME;
break;
default:
/*
@@ -275,17 +287,18 @@ static void state_link_escape(struct irda_device *idev, __u8 byte)
* following CE, IrLAP p.114
*/
byte ^= IRDA_TRANS;
- if (idev->rx_buff.len < idev->rx_buff.truesize) {
- idev->rx_buff.data[idev->rx_buff.len++] = byte;
- idev->rx_buff.fcs = irda_fcs(idev->rx_buff.fcs, byte);
- idev->rx_buff.state = INSIDE_FRAME;
+ if (rx_buff->len < rx_buff->truesize) {
+ rx_buff->data[rx_buff->len++] = byte;
+ rx_buff->fcs = irda_fcs(rx_buff->fcs, byte);
+ rx_buff->state = INSIDE_FRAME;
} else {
- DEBUG(1, __FUNCTION__
+ IRDA_DEBUG(1, __FUNCTION__
"(), Rx buffer overflow, aborting\n");
- idev->rx_buff.state = OUTSIDE_FRAME;
+ rx_buff->state = OUTSIDE_FRAME;
}
break;
}
+ return 0;
}
/*
@@ -294,43 +307,50 @@ static void state_link_escape(struct irda_device *idev, __u8 byte)
* Handle bytes received within a frame
*
*/
-static void state_inside_frame(struct irda_device *idev, __u8 byte)
+static int state_inside_frame(struct net_device *dev,
+ struct iobuff_t *rx_buff, __u8 byte)
{
+ struct net_device_stats *stats = dev->get_stats(dev);
+ int ret = 0;
+
switch (byte) {
case BOF: /* New frame? */
- idev->rx_buff.state = BEGIN_FRAME;
- irda_device_set_media_busy(&idev->netdev, TRUE);
+ rx_buff->state = BEGIN_FRAME;
+ irda_device_set_media_busy(dev, TRUE);
break;
case CE: /* Stuffed char */
- idev->rx_buff.state = LINK_ESCAPE;
+ rx_buff->state = LINK_ESCAPE;
break;
case EOF: /* End of frame */
- idev->rx_buff.state = OUTSIDE_FRAME;
- idev->rx_buff.in_frame = FALSE;
+ rx_buff->state = OUTSIDE_FRAME;
+ rx_buff->in_frame = FALSE;
- /* Test FCS and deliver frame if it's good */
- if (idev->rx_buff.fcs == GOOD_FCS) {
- async_bump(idev, idev->rx_buff.data,
- idev->rx_buff.len);
+ /* Test FCS and signal success if the frame is good */
+ if (rx_buff->fcs == GOOD_FCS) {
+ /* Deliver frame */
+ async_bump(dev, rx_buff->data, rx_buff->len);
+ ret = TRUE;
+ break;
} else {
/* Wrong CRC, discard frame! */
- irda_device_set_media_busy(&idev->netdev, TRUE);
-
- idev->stats.rx_errors++;
- idev->stats.rx_crc_errors++;
+ irda_device_set_media_busy(dev, TRUE);
+
+ stats->rx_errors++;
+ stats->rx_crc_errors++;
}
break;
default: /* Must be the next byte of the frame */
- if (idev->rx_buff.len < idev->rx_buff.truesize) {
- idev->rx_buff.data[idev->rx_buff.len++] = byte;
- idev->rx_buff.fcs = irda_fcs(idev->rx_buff.fcs, byte);
+ if (rx_buff->len < rx_buff->truesize) {
+ rx_buff->data[rx_buff->len++] = byte;
+ rx_buff->fcs = irda_fcs(rx_buff->fcs, byte);
} else {
- DEBUG(1, __FUNCTION__
+ IRDA_DEBUG(1, __FUNCTION__
"(), Rx buffer overflow, aborting\n");
- idev->rx_buff.state = OUTSIDE_FRAME;
+ rx_buff->state = OUTSIDE_FRAME;
}
break;
}
+ return 0;
}