Commit 760a916d authored by Linus Torvalds's avatar Linus Torvalds

Merge http://gkernel.bkbits.net/irda-2.5

into home.transmeta.com:/home/torvalds/v2.5/linux
parents e752b6dd 5a1c8ba5
...@@ -10,6 +10,8 @@ ...@@ -10,6 +10,8 @@
* Modified by: Dag Brattli <dag@brattli.net> * Modified by: Dag Brattli <dag@brattli.net>
* Modified at: Tue Jun 26 2001 * Modified at: Tue Jun 26 2001
* Modified by: Stefani Seibold <stefani@seibold.net> * Modified by: Stefani Seibold <stefani@seibold.net>
* Modified at: Thur Apr 18 2002
* Modified by: Jeff Snyder <je4d@pobox.com>
* *
* Copyright (c) 2001 Stefani Seibold * Copyright (c) 2001 Stefani Seibold
* Copyright (c) 1999-2001 Dag Brattli * Copyright (c) 1999-2001 Dag Brattli
...@@ -539,7 +541,7 @@ static int __init ircc_open(unsigned int fir_base, unsigned int sir_base) ...@@ -539,7 +541,7 @@ static int __init ircc_open(unsigned int fir_base, unsigned int sir_base)
if (ircc_irq < 255) { if (ircc_irq < 255) {
if (ircc_irq!=irq) if (ircc_irq!=irq)
MESSAGE("%s, Overriding IRQ - chip says %d, using %d\n", MESSAGE("%s, Overriding IRQ - chip says %d, using %d\n",
driver_name, self->io->irq, ircc_irq); driver_name, irq, ircc_irq);
self->io->irq = ircc_irq; self->io->irq = ircc_irq;
} }
else else
...@@ -547,13 +549,13 @@ static int __init ircc_open(unsigned int fir_base, unsigned int sir_base) ...@@ -547,13 +549,13 @@ static int __init ircc_open(unsigned int fir_base, unsigned int sir_base)
if (ircc_dma < 255) { if (ircc_dma < 255) {
if (ircc_dma!=dma) if (ircc_dma!=dma)
MESSAGE("%s, Overriding DMA - chip says %d, using %d\n", MESSAGE("%s, Overriding DMA - chip says %d, using %d\n",
driver_name, self->io->dma, ircc_dma); driver_name, dma, ircc_dma);
self->io->dma = ircc_dma; self->io->dma = ircc_dma;
} }
else else
self->io->dma = dma; self->io->dma = dma;
request_region(fir_base, CHIP_IO_EXTENT, driver_name); request_region(self->io->fir_base, CHIP_IO_EXTENT, driver_name);
/* Initialize QoS for this device */ /* Initialize QoS for this device */
irda_init_max_qos_capabilies(&irport->qos); irda_init_max_qos_capabilies(&irport->qos);
...@@ -1191,10 +1193,9 @@ static int __exit ircc_close(struct ircc_cb *self) ...@@ -1191,10 +1193,9 @@ static int __exit ircc_close(struct ircc_cb *self)
outb(IRCC_CFGB_IR, iobase+IRCC_SCE_CFGB); outb(IRCC_CFGB_IR, iobase+IRCC_SCE_CFGB);
#endif #endif
/* Release the PORT that this driver is using */ /* Release the PORT that this driver is using */
IRDA_DEBUG(0, __FUNCTION__ "(), releasing 0x%03x\n", IRDA_DEBUG(0, __FUNCTION__ "(), releasing 0x%03x\n", iobase);
self->io->fir_base);
release_region(self->io->fir_base, self->io->fir_ext); release_region(iobase, CHIP_IO_EXTENT);
if (self->tx_buff.head) if (self->tx_buff.head)
kfree(self->tx_buff.head); kfree(self->tx_buff.head);
......
...@@ -100,7 +100,7 @@ struct lsap_cb { ...@@ -100,7 +100,7 @@ struct lsap_cb {
irda_queue_t queue; /* Must be first */ irda_queue_t queue; /* Must be first */
magic_t magic; magic_t magic;
int connected; unsigned long connected; /* set_bit used on this */
int persistent; int persistent;
__u8 slsap_sel; /* Source (this) LSAP address */ __u8 slsap_sel; /* Source (this) LSAP address */
...@@ -119,6 +119,21 @@ struct lsap_cb { ...@@ -119,6 +119,21 @@ struct lsap_cb {
struct lap_cb *lap; /* Pointer to LAP connection structure */ struct lap_cb *lap; /* Pointer to LAP connection structure */
}; };
/*
* Used for caching the last slsap->dlsap->handle mapping
*
* We don't need to keep/match the remote address in the cache because
* we are associated with a specific LAP (which implies it).
* Jean II
*/
typedef struct {
int valid;
__u8 slsap_sel;
__u8 dlsap_sel;
struct lsap_cb *lsap;
} CACHE_ENTRY;
/* /*
* Information about each registred IrLAP layer * Information about each registred IrLAP layer
*/ */
...@@ -140,18 +155,14 @@ struct lap_cb { ...@@ -140,18 +155,14 @@ struct lap_cb {
struct qos_info *qos; /* LAP QoS for this session */ struct qos_info *qos; /* LAP QoS for this session */
struct timer_list idle_timer; struct timer_list idle_timer;
};
/*
* Used for caching the last slsap->dlsap->handle mapping
*/
typedef struct {
int valid;
__u8 slsap_sel; #ifdef CONFIG_IRDA_CACHE_LAST_LSAP
__u8 dlsap_sel; /* The lsap cache was moved from struct irlmp_cb to here because
struct lsap_cb *lsap; * it must be associated with the specific LAP. Also, this
} CACHE_ENTRY; * improves performance. - Jean II */
CACHE_ENTRY cache; /* Caching last slsap->dlsap->handle mapping */
#endif
};
/* /*
* Main structure for IrLMP * Main structure for IrLMP
...@@ -166,9 +177,6 @@ struct irlmp_cb { ...@@ -166,9 +177,6 @@ struct irlmp_cb {
int free_lsap_sel; int free_lsap_sel;
#ifdef CONFIG_IRDA_CACHE_LAST_LSAP
CACHE_ENTRY cache; /* Caching last slsap->dlsap->handle mapping */
#endif
struct timer_list discovery_timer; struct timer_list discovery_timer;
hashbin_t *links; /* IrLAP connection table */ hashbin_t *links; /* IrLAP connection table */
......
...@@ -139,7 +139,7 @@ struct tsap_cb { ...@@ -139,7 +139,7 @@ struct tsap_cb {
__u32 tx_max_sdu_size; /* Max transmit user data size */ __u32 tx_max_sdu_size; /* Max transmit user data size */
int close_pend; /* Close, but disconnect_pend */ int close_pend; /* Close, but disconnect_pend */
int disconnect_pend; /* Disconnect, but still data to send */ unsigned long disconnect_pend; /* Disconnect, but still data to send */
struct sk_buff *disconnect_skb; struct sk_buff *disconnect_skb;
}; };
......
...@@ -93,9 +93,6 @@ int __init irlmp_init(void) ...@@ -93,9 +93,6 @@ int __init irlmp_init(void)
irlmp->cachelog = hashbin_new(HB_GLOBAL); irlmp->cachelog = hashbin_new(HB_GLOBAL);
irlmp->free_lsap_sel = 0x10; /* Reserved 0x00-0x0f */ irlmp->free_lsap_sel = 0x10; /* Reserved 0x00-0x0f */
#ifdef CONFIG_IRDA_CACHE_LAST_LSAP
irlmp->cache.valid = FALSE;
#endif
strcpy(sysctl_devname, "Linux"); strcpy(sysctl_devname, "Linux");
/* Do discovery every 3 seconds */ /* Do discovery every 3 seconds */
...@@ -208,10 +205,6 @@ static void __irlmp_close_lsap(struct lsap_cb *self) ...@@ -208,10 +205,6 @@ static void __irlmp_close_lsap(struct lsap_cb *self)
if (self->conn_skb) if (self->conn_skb)
dev_kfree_skb(self->conn_skb); dev_kfree_skb(self->conn_skb);
#ifdef CONFIG_IRDA_CACHE_LAST_LSAP
ASSERT(irlmp != NULL, return;);
irlmp->cache.valid = FALSE;
#endif
kfree(self); kfree(self);
} }
...@@ -247,6 +240,9 @@ void irlmp_close_lsap(struct lsap_cb *self) ...@@ -247,6 +240,9 @@ void irlmp_close_lsap(struct lsap_cb *self)
} }
/* Now, remove from the link */ /* Now, remove from the link */
lsap = hashbin_remove(lap->lsaps, (int) self, NULL); lsap = hashbin_remove(lap->lsaps, (int) self, NULL);
#ifdef CONFIG_IRDA_CACHE_LAST_LSAP
lap->cache.valid = FALSE;
#endif
} }
self->lap = NULL; self->lap = NULL;
/* Check if we found the LSAP! If not then try the unconnected lsaps */ /* Check if we found the LSAP! If not then try the unconnected lsaps */
...@@ -292,6 +288,9 @@ void irlmp_register_link(struct irlap_cb *irlap, __u32 saddr, notify_t *notify) ...@@ -292,6 +288,9 @@ void irlmp_register_link(struct irlap_cb *irlap, __u32 saddr, notify_t *notify)
lap->saddr = saddr; lap->saddr = saddr;
lap->daddr = DEV_ADDR_ANY; lap->daddr = DEV_ADDR_ANY;
lap->lsaps = hashbin_new(HB_GLOBAL); lap->lsaps = hashbin_new(HB_GLOBAL);
#ifdef CONFIG_IRDA_CACHE_LAST_LSAP
lap->cache.valid = FALSE;
#endif
lap->lap_state = LAP_STANDBY; lap->lap_state = LAP_STANDBY;
...@@ -602,7 +601,7 @@ struct lsap_cb *irlmp_dup(struct lsap_cb *orig, void *instance) ...@@ -602,7 +601,7 @@ struct lsap_cb *irlmp_dup(struct lsap_cb *orig, void *instance)
/* Make sure that we invalidate the cache */ /* Make sure that we invalidate the cache */
#ifdef CONFIG_IRDA_CACHE_LAST_LSAP #ifdef CONFIG_IRDA_CACHE_LAST_LSAP
irlmp->cache.valid = FALSE; new->lap->cache.valid = FALSE;
#endif /* CONFIG_IRDA_CACHE_LAST_LSAP */ #endif /* CONFIG_IRDA_CACHE_LAST_LSAP */
return new; return new;
...@@ -692,10 +691,6 @@ void irlmp_disconnect_indication(struct lsap_cb *self, LM_REASON reason, ...@@ -692,10 +691,6 @@ void irlmp_disconnect_indication(struct lsap_cb *self, LM_REASON reason,
return; return;
} }
#ifdef CONFIG_IRDA_CACHE_LAST_LSAP
irlmp->cache.valid = FALSE;
#endif
/* /*
* Remove association between this LSAP and the link it used * Remove association between this LSAP and the link it used
*/ */
...@@ -703,6 +698,9 @@ void irlmp_disconnect_indication(struct lsap_cb *self, LM_REASON reason, ...@@ -703,6 +698,9 @@ void irlmp_disconnect_indication(struct lsap_cb *self, LM_REASON reason,
ASSERT(self->lap->lsaps != NULL, return;); ASSERT(self->lap->lsaps != NULL, return;);
lsap = hashbin_remove(self->lap->lsaps, (int) self, NULL); lsap = hashbin_remove(self->lap->lsaps, (int) self, NULL);
#ifdef CONFIG_IRDA_CACHE_LAST_LSAP
self->lap->cache.valid = FALSE;
#endif
ASSERT(lsap != NULL, return;); ASSERT(lsap != NULL, return;);
ASSERT(lsap == self, return;); ASSERT(lsap == self, return;);
......
...@@ -408,13 +408,14 @@ void irlmp_link_discovery_confirm(struct lap_cb *self, hashbin_t *log) ...@@ -408,13 +408,14 @@ void irlmp_link_discovery_confirm(struct lap_cb *self, hashbin_t *log)
} }
#ifdef CONFIG_IRDA_CACHE_LAST_LSAP #ifdef CONFIG_IRDA_CACHE_LAST_LSAP
inline void irlmp_update_cache(struct lsap_cb *self) static inline void irlmp_update_cache(struct lap_cb *lap,
struct lsap_cb *lsap)
{ {
/* Update cache entry */ /* Update cache entry */
irlmp->cache.dlsap_sel = self->dlsap_sel; lap->cache.dlsap_sel = lsap->dlsap_sel;
irlmp->cache.slsap_sel = self->slsap_sel; lap->cache.slsap_sel = lsap->slsap_sel;
irlmp->cache.lsap = self; lap->cache.lsap = lsap;
irlmp->cache.valid = TRUE; lap->cache.valid = TRUE;
} }
#endif #endif
...@@ -423,6 +424,17 @@ inline void irlmp_update_cache(struct lsap_cb *self) ...@@ -423,6 +424,17 @@ inline void irlmp_update_cache(struct lsap_cb *self)
* *
* Find handle assosiated with destination and source LSAP * Find handle assosiated with destination and source LSAP
* *
* Any IrDA connection (LSAP/TSAP) is uniquely identified by
* 3 parameters, the local lsap, the remote lsap and the remote address.
* We may initiate multiple connections to the same remote service
* (they will have different local lsap), a remote device may initiate
* multiple connections to the same local service (they will have
* different remote lsap), or multiple devices may connect to the same
* service and may use the same remote lsap (and they will have
* different remote address).
* So, where is the remote address ? Each LAP connection is made with
* a single remote device, so imply a specific remote address.
* Jean II
*/ */
static struct lsap_cb *irlmp_find_lsap(struct lap_cb *self, __u8 dlsap_sel, static struct lsap_cb *irlmp_find_lsap(struct lap_cb *self, __u8 dlsap_sel,
__u8 slsap_sel, int status, __u8 slsap_sel, int status,
...@@ -436,11 +448,11 @@ static struct lsap_cb *irlmp_find_lsap(struct lap_cb *self, __u8 dlsap_sel, ...@@ -436,11 +448,11 @@ static struct lsap_cb *irlmp_find_lsap(struct lap_cb *self, __u8 dlsap_sel,
* cache first to avoid the linear search * cache first to avoid the linear search
*/ */
#ifdef CONFIG_IRDA_CACHE_LAST_LSAP #ifdef CONFIG_IRDA_CACHE_LAST_LSAP
if ((irlmp->cache.valid) && if ((self->cache.valid) &&
(irlmp->cache.slsap_sel == slsap_sel) && (self->cache.slsap_sel == slsap_sel) &&
(irlmp->cache.dlsap_sel == dlsap_sel)) (self->cache.dlsap_sel == dlsap_sel))
{ {
return (irlmp->cache.lsap); return (self->cache.lsap);
} }
#endif #endif
lsap = (struct lsap_cb *) hashbin_get_first(queue); lsap = (struct lsap_cb *) hashbin_get_first(queue);
...@@ -458,7 +470,7 @@ static struct lsap_cb *irlmp_find_lsap(struct lap_cb *self, __u8 dlsap_sel, ...@@ -458,7 +470,7 @@ static struct lsap_cb *irlmp_find_lsap(struct lap_cb *self, __u8 dlsap_sel,
lsap->dlsap_sel = dlsap_sel; lsap->dlsap_sel = dlsap_sel;
#ifdef CONFIG_IRDA_CACHE_LAST_LSAP #ifdef CONFIG_IRDA_CACHE_LAST_LSAP
irlmp_update_cache(lsap); irlmp_update_cache(self, lsap);
#endif #endif
return lsap; return lsap;
} }
...@@ -469,7 +481,7 @@ static struct lsap_cb *irlmp_find_lsap(struct lap_cb *self, __u8 dlsap_sel, ...@@ -469,7 +481,7 @@ static struct lsap_cb *irlmp_find_lsap(struct lap_cb *self, __u8 dlsap_sel,
(lsap->dlsap_sel == dlsap_sel)) (lsap->dlsap_sel == dlsap_sel))
{ {
#ifdef CONFIG_IRDA_CACHE_LAST_LSAP #ifdef CONFIG_IRDA_CACHE_LAST_LSAP
irlmp_update_cache(lsap); irlmp_update_cache(self, lsap);
#endif #endif
return lsap; return lsap;
} }
......
...@@ -409,8 +409,8 @@ typedef struct irnet_socket ...@@ -409,8 +409,8 @@ typedef struct irnet_socket
/* ------------------------ IrTTP part ------------------------ */ /* ------------------------ IrTTP part ------------------------ */
/* We create a pseudo "socket" over the IrDA tranport */ /* We create a pseudo "socket" over the IrDA tranport */
int ttp_open; /* Set when IrTTP is ready */ unsigned long ttp_open; /* Set when IrTTP is ready */
int ttp_connect; /* Set when IrTTP is connecting */ unsigned long ttp_connect; /* Set when IrTTP is connecting */
struct tsap_cb * tsap; /* IrTTP instance (the connection) */ struct tsap_cb * tsap; /* IrTTP instance (the connection) */
char rname[NICKNAME_MAX_LEN + 1]; char rname[NICKNAME_MAX_LEN + 1];
......
...@@ -860,7 +860,7 @@ ppp_irnet_send(struct ppp_channel * chan, ...@@ -860,7 +860,7 @@ ppp_irnet_send(struct ppp_channel * chan,
irda_irnet_connect(self); irda_irnet_connect(self);
#endif /* CONNECT_IN_SEND */ #endif /* CONNECT_IN_SEND */
DEBUG(PPP_INFO, "IrTTP not ready ! (%d-%d)\n", DEBUG(PPP_INFO, "IrTTP not ready ! (%ld-%ld)\n",
self->ttp_open, self->ttp_connect); self->ttp_open, self->ttp_connect);
/* Note : we can either drop the packet or block the packet. /* Note : we can either drop the packet or block the packet.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment