[patch] patch-2.4.2-irda1 (irda-usb)
Linus, Please apply this patch to your latest Linux-2.4.2 source. Changes: o IrDA-USB dongle support [new feature] -- Dag diff -urpN linux-2.4.2/Documentation/Configure.help linux-2.4.2-irda-patch/Documentation/Configure.help --- linux-2.4.2/Documentation/Configure.helpTue Feb 27 08:59:00 2001 +++ linux-2.4.2-irda-patch/Documentation/Configure.help Tue Feb 27 08:59:08 2001 @@ -16739,8 +16739,7 @@ CONFIG_IRDA infrared communication and is supported by most laptops and PDA's. To use Linux support for the IrDA (tm) protocols, you will also need - some user-space utilities like the irmanager and probably irattach - as well. For more information, see the file + some user-space utilities like irattach. For more information, see the file Documentation/networking/irda.txt. You also want to read the IR-HOWTO, available at http://www.linuxdoc.org/docs.html#howto . @@ -16849,6 +16848,19 @@ CONFIG_IRPORT_SIR 115200 bps. If unsure, say Y. + +USB IrDA FIR Dongle Device Driver +CONFIG_USB_IRDA + Say Y here if you want to build support for the USB IrDA FIR Dongle + device driver. If you want to compile it as a module (irda-usb.o), + say M here and read Documentation/modules.txt. IrDA-USB support the + various IrDA USB dongles available and most of their pecularities. + Those dongles plug in the USB port of your computer, are plug and + play, and support SIR and FIR (4Mbps) speeds. On the other hand, + those dongles tend to be less efficient than a FIR chipset. + + Please note that the driver is still experimental. And of course, + you will need both USB and IrDA support in your kernel... Winbond W83977AF IrDA Device Driver CONFIG_WINBOND_FIR diff -urpN linux-2.4.2/drivers/net/irda/Config.in linux-2.4.2-irda-patch/drivers/net/irda/Config.in --- linux-2.4.2/drivers/net/irda/Config.in Tue Feb 27 08:59:00 2001 +++ linux-2.4.2-irda-patch/drivers/net/irda/Config.in Tue Feb 27 08:57:44 2001 @@ -5,14 +5,6 @@ comment 'SIR device drivers' dep_tristate 'IrTTY (uses Linux serial driver)' CONFIG_IRTTY_SIR $CONFIG_IRDA dep_tristate 'IrPORT (IrDA serial driver)' CONFIG_IRPORT_SIR $CONFIG_IRDA -comment 'FIR device drivers' -dep_tristate 'NSC PC87108/PC87338' CONFIG_NSC_FIR $CONFIG_IRDA -dep_tristate 'Winbond W83977AF (IR)' CONFIG_WINBOND_FIR $CONFIG_IRDA -dep_tristate 'Toshiba Type-O IR Port' CONFIG_TOSHIBA_FIR $CONFIG_IRDA -if [ "$CONFIG_EXPERIMENTAL" != "n" ]; then -dep_tristate 'SMC IrCC (Experimental)' CONFIG_SMC_IRCC_FIR $CONFIG_IRDA -fi - comment 'Dongle support' bool 'Serial dongle support' CONFIG_DONGLE if [ "$CONFIG_DONGLE" != "n" ]; then @@ -22,6 +14,15 @@ if [ "$CONFIG_DONGLE" != "n" ]; then dep_tristate ' Greenwich GIrBIL dongle' CONFIG_GIRBIL_DONGLE $CONFIG_IRDA dep_tristate ' Parallax LiteLink dongle' CONFIG_LITELINK_DONGLE $CONFIG_IRDA dep_tristate ' Old Belkin dongle' CONFIG_OLD_BELKIN_DONGLE $CONFIG_IRDA +fi + +comment 'FIR device drivers' +dep_tristate 'IrDA USB dongles (Experimental)' CONFIG_USB_IRDA $CONFIG_IRDA +$CONFIG_USB $CONFIG_EXPERIMENTAL +dep_tristate 'NSC PC87108/PC87338' CONFIG_NSC_FIR $CONFIG_IRDA +dep_tristate 'Winbond W83977AF (IR)' CONFIG_WINBOND_FIR $CONFIG_IRDA +dep_tristate 'Toshiba Type-O IR Port' CONFIG_TOSHIBA_FIR $CONFIG_IRDA +if [ "$CONFIG_EXPERIMENTAL" != "n" ]; then +dep_tristate 'SMC IrCC (Experimental)' CONFIG_SMC_IRCC_FIR $CONFIG_IRDA fi endmenu diff -urpN linux-2.4.2/drivers/net/irda/Makefile linux-2.4.2-irda-patch/drivers/net/irda/Makefile --- linux-2.4.2/drivers/net/irda/Makefile Tue Feb 27 08:59:00 2001 +++ linux-2.4.2-irda-patch/drivers/net/irda/MakefileTue Feb 27 08:57:44 2001 @@ -12,6 +12,7 @@ export-objs = irport.o obj-$(CONFIG_IRTTY_SIR)+= irtty.o obj-$(CONFIG_IRPORT_SIR) += irport.o +obj-$(CONFIG_USB_IRDA) += irda-usb.o obj-$(CONFIG_NSC_FIR) += nsc-ircc.o obj-$(CONFIG_WINBOND_FIR) += w83977af_ir.o obj-$(CONFIG_TOSHIBA_FIR) += toshoboe.o diff -urpN linux-2.4.2/drivers/net/irda/irda-usb.c linux-2.4.2-irda-patch/drivers/net/irda/irda-usb.c --- linux-2.4.2/drivers/net/irda/irda-usb.c Thu Jan 1 01:00:00 1970 +++ linux-2.4.2-irda-patch/drivers/net/irda/irda-usb.c Tue Feb 27 08:57:44 2001 @@ -0,0 +1,1158 @@ +/********* + * + * Filename: irda-usb.c + * Version: 0.8 + * Description: IrDA-USB Driver + * Status:Experimental + * Author:Dag Brattli <[EMAIL PROTECTED]> + * + * Copyright (C) 2001, Dag Brattli <[EMAIL PROTECTED]> + * Copyright (C) 2001, Jean Tourrilhes <[EMAIL PROTECTED]> + * Copyright (C) 2000, Roma
[patch] patch-2.4.2-irda2 (ali)
Linus, Please apply this patch to your latest Linux-2.4.2 source. Changes: o ALi M5123 FIR (4Mbps IrDA) Controller support [new feature] -- Dag diff -urpN linux-2.4.2/Documentation/Configure.help linux-2.4.2-irda-patch/Documentation/Configure.help --- linux-2.4.2/Documentation/Configure.helpTue Feb 27 09:16:15 2001 +++ linux-2.4.2-irda-patch/Documentation/Configure.help Tue Feb 27 09:16:01 2001 @@ -16897,6 +16897,16 @@ CONFIG_SMC_IRCC_FIR here and read Documentation/modules.txt. The module will be called smc-ircc.o. +ALi M5123 FIR Controller Driver +CONFIG_ALI_FIR + Say Y here if you want to build support for the ALi M5123 FIR + Controller. The ALi M5123 FIR Controller is embedded in ALi + M1543C, M1535, M1535D, M1535+, M1535D Sourth Bridge. This + driver supports SIR, MIR and FIR (4Mbps) speeds. + + If you want to compile it as a module, say M here and read + Documentation/modules.txt. The module will be called ali-ircc.o. + Serial dongle support CONFIG_DONGLE Say Y here if you have an infrared device that connects to your diff -urpN linux-2.4.2/drivers/net/irda/Config.in linux-2.4.2-irda-patch/drivers/net/irda/Config.in --- linux-2.4.2/drivers/net/irda/Config.in Tue Feb 27 09:16:15 2001 +++ linux-2.4.2-irda-patch/drivers/net/irda/Config.in Tue Feb 27 09:16:01 2001 @@ -23,6 +23,7 @@ dep_tristate 'Winbond W83977AF (IR)' CON dep_tristate 'Toshiba Type-O IR Port' CONFIG_TOSHIBA_FIR $CONFIG_IRDA if [ "$CONFIG_EXPERIMENTAL" != "n" ]; then dep_tristate 'SMC IrCC (Experimental)' CONFIG_SMC_IRCC_FIR $CONFIG_IRDA +dep_tristate 'ALi M5123 FIR (Experimental)' CONFIG_ALI_FIR $CONFIG_IRDA fi endmenu diff -urpN linux-2.4.2/drivers/net/irda/Makefile linux-2.4.2-irda-patch/drivers/net/irda/Makefile --- linux-2.4.2/drivers/net/irda/Makefile Tue Feb 27 09:16:15 2001 +++ linux-2.4.2-irda-patch/drivers/net/irda/MakefileTue Feb 27 09:16:01 2001 @@ -17,6 +17,7 @@ obj-$(CONFIG_NSC_FIR) += nsc-ircc.o obj-$(CONFIG_WINBOND_FIR) += w83977af_ir.o obj-$(CONFIG_TOSHIBA_FIR) += toshoboe.o obj-$(CONFIG_SMC_IRCC_FIR) += smc-ircc.o irport.o +obj-$(CONFIG_ALI_FIR) += ali-ircc.o obj-$(CONFIG_ESI_DONGLE) += esi.o obj-$(CONFIG_TEKRAM_DONGLE)+= tekram.o obj-$(CONFIG_ACTISYS_DONGLE) += actisys.o diff -urpN linux-2.4.2/drivers/net/irda/ali-ircc.c linux-2.4.2-irda-patch/drivers/net/irda/ali-ircc.c --- linux-2.4.2/drivers/net/irda/ali-ircc.c Thu Jan 1 01:00:00 1970 +++ linux-2.4.2-irda-patch/drivers/net/irda/ali-ircc.c Tue Feb 27 09:16:01 2001 @@ -0,0 +1,2306 @@ +/* + * + * Filename: ali-ircc.h + * Version: 0.5 + * Description: Driver for the ALI M1535D and M1543C FIR Controller + * Status:Experimental. + * Author:Benjamin Kong <[EMAIL PROTECTED]> + * Created at:2000/10/16 03:46PM + * Modified at: 2001/1/3 02:55PM + * Modified by: Benjamin Kong <[EMAIL PROTECTED]> + * + * Copyright (c) 2000 Benjamin Kong <[EMAIL PROTECTED]> + * 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. + * + / + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include + +#include +#include +#include +#include +#include + +#include + +#define CHIP_IO_EXTENT 8 +#define BROKEN_DONGLE_ID + +static char *driver_name = "ali-ircc"; + +/* Module parameters */ +static int qos_mtt_bits = 0x07; /* 1 ms or more */ + +/* Use BIOS settions by default, but user may supply module parameters */ +static unsigned int io[] = { ~0, ~0, ~0, ~0 }; +static unsigned int irq[] = { 0, 0, 0, 0 }; +static unsigned int dma[] = { 0, 0, 0, 0 }; + +static int ali_ircc_probe_43(ali_chip_t *chip, chipio_t *info); +static int ali_ircc_probe_53(ali_chip_t *chip, chipio_t *info); +static int ali_ircc_init_43(ali_chip_t *chip, chipio_t *info); +static int ali_ircc_init_53(ali_chip_t *chip, chipio_t *info); + +/* These are the currently known ALi sourth-bridge chipsets, the only one difference + * is that M1543C doesn't support HP HDSL-3600 + */ +static ali_chip_t chips[] = +{ + { "M1543", { 0x3f0, 0x370 }, 0x51, 0x23, 0x20, 0x43, ali_ircc_probe_53, +ali_ircc_init_43 }, + { "M1535", { 0x3f0, 0x370 }, 0x51, 0x23, 0x20, 0x53, ali_ircc_probe_53, +ali_ircc_init_53 }, + { NULL } +}; + +/* Max 4 instances for now */ +static struct ali_ircc_cb *dev_self[] = { NULL, NULL, NULL, NULL }; + +/* Dongle Types */ +static char *dongle_types[] = { + "TFDS6000", + "HP HSDL-3600", + "HP HSDL-1100", + "N
[patch] patch-2.4.2-irda3 (misc fixes)
Linus, These are various irda patches to fix various bit of the stack. Please apply to your latest Linux-2.4.2 code. Changes: o Fix Ultra sockets on SMP kernel o Remove OBEX mask and minor cleanups o IrNET update All thanks to Jean Tourrilhes -- Dag diff -u -p linux/net/irda/af_irda.j1.c linux/net/irda/af_irda.c --- linux/net/irda/af_irda.j1.c Mon Jan 8 18:02:18 2001 +++ linux/net/irda/af_irda.cTue Jan 9 14:18:51 2001 @@ -2311,6 +2311,9 @@ static struct proto_ops SOCKOPS_WRAPPED( SOCKOPS_WRAP(irda_stream, PF_IRDA); SOCKOPS_WRAP(irda_seqpacket, PF_IRDA); SOCKOPS_WRAP(irda_dgram, PF_IRDA); +#ifdef CONFIG_IRDA_ULTRA +SOCKOPS_WRAP(irda_ultra, PF_IRDA); +#endif /* CONFIG_IRDA_ULTRA */ /* * Function irda_device_event (this, event, ptr) diff -u -p linux/net/irda/irias_object.d6.c linux/net/irda/irias_object.c --- linux/net/irda/irias_object.d6.cFri Jan 5 10:47:54 2001 +++ linux/net/irda/irias_object.c Fri Jan 5 10:51:28 2001 @@ -34,7 +34,7 @@ hashbin_t *objects = NULL; /* * Used when a missing value needs to be returned */ -struct ias_value missing = { IAS_MISSING, 0, 0, 0}; +struct ias_value missing = { IAS_MISSING, 0, 0, 0, {0}}; /* * Function strdup (str) diff -u -p linux/net/irda/af_irda.d6.c linux/net/irda/af_irda.c --- linux/net/irda/af_irda.d6.c Fri Jan 5 10:47:25 2001 +++ linux/net/irda/af_irda.cFri Jan 5 10:50:34 2001 @@ -776,7 +776,6 @@ static int irda_bind(struct socket *sock struct sock *sk = sock->sk; struct sockaddr_irda *addr = (struct sockaddr_irda *) uaddr; struct irda_sock *self; - __u16 hints = 0; int err; IRDA_DEBUG(2, __FUNCTION__ "()\n"); @@ -821,15 +820,6 @@ static int irda_bind(struct socket *sock self->stsap_sel, IAS_KERNEL_ATTR); irias_insert_object(self->ias_obj); -#if 1 /* Will be removed in near future */ - - /* Fill in some default hint bits values */ - if (strncmp(addr->sir_name, "OBEX", 4) == 0) - hints = irlmp_service_to_hint(S_OBEX); - - if (hints) - self->skey = irlmp_register_service(hints); -#endif return 0; } diff -urpN linux-2.4.1-pre8/drivers/net/irda/toshoboe.c linux-2.4.1-pre8-irda-patch/drivers/net/irda/toshoboe.c --- linux-2.4.1-pre8/drivers/net/irda/toshoboe.cThu Jan 4 21:50:12 2001 +++ linux-2.4.1-pre8-irda-patch/drivers/net/irda/toshoboe.c Mon Jan 22 00:54:52 +2001 @@ -896,7 +898,7 @@ toshoboe_gotosleep (struct toshoboe_cb * /*FIXME: can't sleep here wait one second */ while ((i--) && (self->txpending)) -mdelay (100); +udelay (100); toshoboe_stopchip (self); toshoboe_disablebm (self); diff -urpN linux-2.4.1-pre8/net/irda/af_irda.c linux-2.4.1-pre8-irda-patch/net/irda/af_irda.c --- linux-2.4.1-pre8/net/irda/af_irda.c Sun Nov 12 03:11:23 2000 +++ linux-2.4.1-pre8-irda-patch/net/irda/af_irda.c Mon Jan 22 00:54:42 2001 @@ -439,7 +439,7 @@ static void irda_selective_discovery_ind * We were waiting for a node to be discovered, but nothing has come up * so far. Wake up the user and tell him that we failed... */ -static void irda_discovery_timeout(u_long priv) +static void irda_discovery_timeout(u_long priv) { struct irda_sock *self; diff -urpN linux-2.4.1-pre8/net/irda/irlap.c linux-2.4.1-pre8-irda-patch/net/irda/irlap.c --- linux-2.4.1-pre8/net/irda/irlap.c Sun Nov 12 03:11:23 2000 +++ linux-2.4.1-pre8-irda-patch/net/irda/irlap.cMon Jan 22 00:54:45 2001 @@ -859,13 +868,6 @@ void irlap_flush_all_queues(struct irlap /* Free sliding window buffered packets */ while ((skb = skb_dequeue(&self->wx_list)) != NULL) dev_kfree_skb(skb); - -#ifdef CONFIG_IRDA_RECYCLE_RR - if (self->recycle_rr_skb) { - dev_kfree_skb(self->recycle_rr_skb); - self->recycle_rr_skb = NULL; - } -#endif } /* diff -u -p linux/Documentation/Configure.j1.help linux/Documentation/Configure.help --- linux/Documentation/Configure.j1.help Fri Feb 23 17:00:21 2001 +++ linux/Documentation/Configure.help Fri Feb 23 17:13:23 2001 @@ -16811,6 +16811,17 @@ CONFIG_IRLAN to another Linux machine running the IrLAN protocol for ad-hoc networking! +IrNET Protocol +CONFIG_IRNET + Say Y here if you want to build support for the IrNET protocol. If + you want to compile it as a module (irnet.o), say M here and read + Documentation/modules.txt. IrNET is a PPP driver, so you will also + need a working PPP subsystem (driver, daemon and config)... + + IrNET is an alternate way to tranfer TCP/IP traffic over IrDA. It + uses synchronous PPP over a set of point to point IrDA sockets. You + can use it between Linux machine or with W2k. + IrCOMM Protocol CONFIG_IRCOMM Say Y here if you want to build support for the IrCOMM protocol. If diff -u -p linux/net/irda/irnet/irnet.j1.h linux/net/irda/irnet/irnet.h --- linux/net/irda/irnet/irnet.j1.h
Re: [patch] patch-2.4.2-irda1 (irda-usb)
On Tue, 27 Feb 2001 09:33:29 -0800, Greg KH wrote: > On Tue, Feb 27, 2001 at 08:29:03AM +0000, Dag Brattli wrote: > > Linus, > > > > Please apply this patch to your latest Linux-2.4.2 source. Changes: > > > > o IrDA-USB dongle support [new feature] > > I'd recommend that this file be in the /drivers/usb directory, much like > almost all other USB drivers are. Yes, but do we want to spread the IrDA code around? The same argument applies to IrDA device drivers!? > > +/* These are the currently known IrDA USB dongles. Add new dongles here */ > > +struct irda_usb_dongle dongles[] = { /* idVendor, idProduct, idCapability */ > > + /* ACTiSYS Corp, ACT-IR2000U FIR-USB Adapter */ > > + { 0x9c4, 0x011, IUC_SPEED_BUG | IUC_NO_WINDOW }, > > + /* KC Technology Inc., KC-180 USB IrDA Device */ > > + { 0x50f, 0x180, IUC_SPEED_BUG | IUC_NO_WINDOW }, > > + /* Extended Systems, Inc., XTNDAccess IrDA USB (ESI-9685) */ > > + { 0x8e9, 0x100, IUC_SPEED_BUG | IUC_NO_WINDOW }, > > + { 0, 0, 0 }, /* The end */ > > +}; > > You should also probably add the following snippet to allow the USB > hotplug functionality to work properly: > > static __devinitdata struct usb_device_id id_table [] = { > { USB_DEVICE(0x09c4, 0x0011) }, > { USB_DEVICE(0x050f, 0x0180) }, > { USB_DEVICE(0x08e9, 0x0100) }, > { } /* Terminating entry */ > }; > MODULE_DEVICE_TABLE (usb, id_table); OK! > If IRDA has a class descriptor, can't you just rely on that, and not > have to worry about the individual device vendor and product ids? Sorry, some of the dongles don't follow the spec fully, as you can see from our table. Actually none of them follow the spec, since they are all based on the same chip which was made before the spec was finished. But there should be a new dongle out now which do follow the spec (but we haven't got hold of it yet) > > > + * This routine is called by the USB subsystem for each new device > > + * in the system. We need to check if the device is ours, and in > > + * this case start handling it. > > + * Note : it might be worth protecting this function by a global > > + * spinlock... > > +static void *irda_usb_probe(struct usb_device *dev, unsigned int ifnum, > > + const struct usb_device_id *id) > > A spinlock is not needed as the probe functions are called sequentially. > > thanks, > > greg k-h Dag Brattli <[EMAIL PROTECTED]> My homepage http://www.brattli.net/dag/ Try Linux-IrDA: http://irda.sourceforge.net/ Try Pygmy: http://pygmy.sourceforge.net/ - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[patch] patch-2.4.2-irda4 (misc fixes 2nd part)
Linus, These are various irda patches (2nd part) to fix various bit of the stack. Please apply to your latest Linux-2.4.2 code. Changes: o Fix socket stuck in CONN_PEND o NSC wakeup fix o Fix for IrDA stack static init diff -u -p linux/net/irda/irlmp_event.d7.c linux/net/irda/irlmp_event.c --- linux/net/irda/irlmp_event.d7.c Tue Feb 20 14:14:33 2001 +++ linux/net/irda/irlmp_event.cTue Feb 20 14:41:31 2001 @@ -472,8 +472,6 @@ static int irlmp_state_disconnected(stru irlmp_start_watchdog_timer(self, 5*HZ); break; case LM_CONNECT_INDICATION: - irlmp_next_lsap_state(self, LSAP_CONNECT_PEND); - if (self->conn_skb) { WARNING(__FUNCTION__ "(), busy with another request!\n"); @@ -481,6 +479,8 @@ static int irlmp_state_disconnected(stru } self->conn_skb = skb; + irlmp_next_lsap_state(self, LSAP_CONNECT_PEND); + irlmp_do_lap_event(self->lap, LM_LAP_CONNECT_REQUEST, NULL); break; default: @@ -562,6 +562,15 @@ static int irlmp_state_connect_pend(stru switch (event) { case LM_CONNECT_REQUEST: /* Keep state */ + break; + case LM_CONNECT_INDICATION: + /* Will happen in some rare cases when the socket get stuck, +* the other side retries the connect request. +* We just unstuck the socket - Jean II */ + IRDA_DEBUG(0, __FUNCTION__ "(), LM_CONNECT_INDICATION, " + "LSAP stuck in CONNECT_PEND state...\n"); + /* Keep state */ + irlmp_do_lap_event(self->lap, LM_LAP_CONNECT_REQUEST, NULL); break; case LM_CONNECT_RESPONSE: IRDA_DEBUG(0, __FUNCTION__ "(), LM_CONNECT_RESPONSE, " diff -u -p linux/drivers/net/irda/nsc-ircc.j1.c linux/drivers/net/irda/nsc-ircc.c --- linux/drivers/net/irda/nsc-ircc.j1.cFri Feb 23 15:56:05 2001 +++ linux/drivers/net/irda/nsc-ircc.c Fri Feb 23 16:01:20 2001 @@ -251,9 +251,14 @@ static int nsc_ircc_open(int i, chipio_t IRDA_DEBUG(2, __FUNCTION__ "()\n"); + MESSAGE("%s, Found chip at base=0x%03x\n", driver_name, + info->cfg_base); + if ((nsc_ircc_setup(info)) == -1) return -1; + MESSAGE("%s, driver loaded (Dag Brattli)\n", driver_name); + /* Allocate new instance of the driver */ self = kmalloc(sizeof(struct nsc_ircc_cb), GFP_KERNEL); if (self == NULL) { @@ -699,8 +704,6 @@ static int nsc_ircc_setup(chipio_t *info ERROR("%s, Wrong chip version %02x\n", driver_name, version); return -1; } - MESSAGE("%s, Found chip at base=0x%03x\n", driver_name, - info->cfg_base); /* Switch to advanced mode */ switch_bank(iobase, BANK2); @@ -729,8 +732,6 @@ static int nsc_ircc_setup(chipio_t *info outb(0x0d, iobase+2); /* Set SIR pulse width to 1.6us */ outb(0x2a, iobase+4); /* Set beginning frag, and preamble length */ - MESSAGE("%s, driver loaded (Dag Brattli)\n", driver_name); - /* Enable receive interrupts */ switch_bank(iobase, BANK0); outb(IER_RXHDL_IE, iobase+IER); @@ -1859,7 +1860,7 @@ static int nsc_ircc_net_open(struct net_ if (request_dma(self->io.dma, dev->name)) { WARNING("%s, unable to allocate dma=%d\n", driver_name, self->io.dma); - free_irq(self->io.irq, self); + free_irq(self->io.irq, dev); return -EAGAIN; } @@ -2011,18 +2012,10 @@ static void nsc_ircc_suspend(struct nsc_ static void nsc_ircc_wakeup(struct nsc_ircc_cb *self) { - int iobase; - if (!self->io.suspended) return; - iobase = self->io.fir_base; - - /* Switch to advanced mode */ - switch_bank(iobase, BANK2); - outb(ECR1_EXT_SL, iobase+ECR1); - switch_bank(iobase, BANK0); - + nsc_ircc_setup(&self->io); nsc_ircc_net_open(self->netdev); MESSAGE("%s, Waking up\n", driver_name); diff -urpN linux-2.4.1-pre8/init/main.c linux-2.4.1-pre8-irda-patch/init/main.c --- linux-2.4.1-pre8/init/main.cThu Jan 4 05:45:26 2001 +++ linux-2.4.1-pre8-irda-patch/init/main.c Mon Jan 22 00:53:49 2001 @@ -726,6 +726,7 @@ static void __init do_basic_setup(void) filesystem_setup(); #ifdef CONFIG_IRDA + irda_proto_init(); irda_device_init(); /* Must be done after protocol initialization */ #endif #ifdef CONFIG_PCMCIA Dag Brattli <[EMAIL PROTECTED]> My homepage http://www.brattli.net/dag/ Try Lin
Re: [Linux-IrDA]IrDA broken on pre-5/6 and stock 2.4.0-test11
Hi, I also get this kernel panic with the latest kernel (test11-pre5/6) but I didn't get it with any earlier kernels. I don't think this has anything to do with Linux-IrDA but maybe I'm wrong. -- Dag On Mon, 20 Nov 2000 16:57:30 +0400 (GMT-4), you wrote: > Guys, > > can someone confirm the following. I can reliably get my > kernel to panic if i kill irattach. I use SIR mode on my > laptop. Looks like lack of NULL checking in the kernel > code, but someone please try it out. Don't worry the > panic is not fatal - i.e. it won't crash your machine or > at least it doesn't mine.. > > So just a > kill > will kernel core. Look in your 'dmesg' output. > > Thanx > Mitch > > Here is my traceback > > Unable to handle kernel NULL pointer dereference at virtual address 0008 > c011578c > *pde = > Oops: > CPU:0 > EIP:0010:[] > EFLAGS: 00210246 > eax: c2124a64 ebx: c1414000 ecx: c35c01e0 edx: > esi: 0006 edi: ebp: c3fcb3a0 esp: c1415fb8 > ds: 0018 es: 0018 ss: 0018 > Process irattach (pid: 5497, stackpage=c1415000) > Stack: 0100 c357bdc0 c357bdf0 c3498000 c35c01e0 c3fcb3a0 c3f9ca40 c3f9ca40 >c3f9ca40 c3f9ca40 c0115a80 c025c620 c357be80 c357be6c c0108914 c357bdf0 >0078 c357be80 > Call Trace: [] [] > Code: 8b 4f 08 39 ca 7d 22 8b 47 14 83 3c 90 00 74 14 89 f0 89 d3 > Warning: trailing garbage ignored on Code: line > Text: 'Code: 8b 4f 08 39 ca 7d 22 8b 47 14 83 3c 90 00 74 14 89 f0 89 d3 ' > Garbage: ' ' > > >>EIP: c011578c > Trace: c0115a80 > Trace: c0108914 > Code: c011578c <_EIP>: <=== > Code: c011578c 0:8b 4f 08 mov > 0x8(%edi),%ecx <=== > Code: c011578f 3:39 ca cmp > %ecx,%edx > Code: c0115791 5:7d 22 jge > c01157b5 > Code: c0115793 7:8b 47 14 mov > 0x14(%edi),%eax > Code: c0115796 a:83 3c 90 00cmpl > $0x0,(%eax,%edx,4) > Code: c011579a e:74 14 je > c01157b0 > Code: c011579c 10:89 f0 mov > %esi,%eax > Code: c011579e 12:89 d3 mov > %edx,%ebx > > ___ > Linux-IrDA mailing list - [EMAIL PROTECTED] > http://www.pasta.cs.UiT.No/mailman/listinfo/linux-irda > > > > - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] Please read the FAQ at http://www.tux.org/lkml/
[patch] patch-2.4.0-test11-irda1
Linus, Please apply this patch to your latest 2.4 code. The patch have been tested by users at the Linux-IrDA mailing-list which confirms that it fixes the specific problems listed below. Changes: o Devfs support with IrCOMM (pmhahn?) o IrLAN connection failures with DHCP (me) o NSC FIR dongle fixes (Pontus Fuchs) o Fixes IrLAP discovery problems with some devices (me) o Updates to some doc files (me) -- Dag diff -urpN linux-2.4.0-test11-pre6/Documentation/networking/irda.txt linux/Documentation/networking/irda.txt --- linux-2.4.0-test11-pre6/Documentation/networking/irda.txt Tue Sep 7 19:14:36 1999 +++ linux/Documentation/networking/irda.txt Fri Nov 17 23:23:39 2000 @@ -1,10 +1,10 @@ To use the IrDA protocols within Linux you will need to get a suitable copy of the IrDA Utilities. More detailed information about these and associated -programs can be found on http://www.cs.uit.no/linux-irda/ +programs can be found on http://irda.sourceforge.net/ For more information about how to use the IrDA protocol stack, see the -IR-HOWTO (http://www.snafu.de/~wehe/IR-HOWTO.html) written by Werner Heuser -<[EMAIL PROTECTED]> +IR-HOWTO (http://www.mobilix.org/Infrared-HOWTO/Infrared-HOWTO.html) written by +Werner Heuser +<[EMAIL PROTECTED]> There is an active mailing list for discussing Linux-IrDA matters called linux-irda. To subscribe to it, visit: diff -urpN linux-2.4.0-test11-pre6/MAINTAINERS linux/MAINTAINERS --- linux-2.4.0-test11-pre6/MAINTAINERS Thu Nov 23 13:17:15 2000 +++ linux/MAINTAINERS Fri Nov 17 23:25:14 2000 @@ -645,9 +645,9 @@ S: Maintained IRDA SUBSYSTEM P: Dag Brattli -M: Dag Brattli <[EMAIL PROTECTED]> +M: Dag Brattli <[EMAIL PROTECTED]> L: [EMAIL PROTECTED] -W: http://www.cs.uit.no/linux-irda/ +W: http://irda.sourceforge.net/ S: Maintained ISAPNP diff -urpN linux-2.4.0-test11-pre6/drivers/net/irda/irtty.c linux/drivers/net/irda/irtty.c --- linux-2.4.0-test11-pre6/drivers/net/irda/irtty.cThu Nov 23 13:17:18 2000 +++ linux/drivers/net/irda/irtty.c Sun Nov 19 20:41:00 2000 @@ -960,7 +960,7 @@ static int irtty_net_ioctl(struct net_de ASSERT(self != NULL, return -1;); ASSERT(self->magic == IRTTY_MAGIC, return -1;); - IRDA_DEBUG(2, __FUNCTION__ "(), %s, (cmd=0x%X)\n", dev->name, cmd); + IRDA_DEBUG(3, __FUNCTION__ "(), %s, (cmd=0x%X)\n", dev->name, cmd); /* Disable interrupts & save flags */ save_flags(flags); diff -urpN linux-2.4.0-test11-pre6/drivers/net/irda/nsc-ircc.c linux/drivers/net/irda/nsc-ircc.c --- linux-2.4.0-test11-pre6/drivers/net/irda/nsc-ircc.c Thu Nov 23 13:17:18 2000 +++ linux/drivers/net/irda/nsc-ircc.c Wed Nov 22 23:01:34 2000 @@ -708,9 +708,12 @@ static int nsc_ircc_setup(chipio_t *info switch_bank(iobase, BANK0); /* Set FIFO threshold to TX17, RX16, reset and enable FIFO's */ - switch_bank(iobase, BANK0); + switch_bank(iobase, BANK0); outb(FCR_RXTH|FCR_TXTH|FCR_TXSR|FCR_RXSR|FCR_FIFO_EN, iobase+FCR); - + + outb(0x03, iobase+LCR); /* 8 bit word length */ + outb(MCR_SIR, iobase+MCR); /* Start at SIR-mode, also clears LSR*/ + /* Set FIFO size to 32 */ switch_bank(iobase, BANK2); outb(EXCR2_RFSIZ|EXCR2_TFSIZ, iobase+EXCR2); @@ -723,7 +726,7 @@ static int nsc_ircc_setup(chipio_t *info switch_bank(iobase, BANK6); outb(0x20, iobase+0); /* Set 32 bits FIR CRC */ outb(0x0a, iobase+1); /* Set MIR pulse width */ - outb(0x0d, iobase+2); /* Set SIR pulse width */ + outb(0x0d, iobase+2); /* Set SIR pulse width to 1.6us */ outb(0x2a, iobase+4); /* Set beginning frag, and preamble length */ MESSAGE("%s, driver loaded (Dag Brattli)\n", driver_name); @@ -804,8 +807,6 @@ static void nsc_ircc_init_dongle_interfa dongle_types[dongle_id]); break; case 0x04: /* Sharp RY5HD01 */ - IRDA_DEBUG(0, __FUNCTION__ "(), %s not supported yet\n", - dongle_types[dongle_id]); break; case 0x05: /* Reserved, but this is what the Thinkpad reports */ IRDA_DEBUG(0, __FUNCTION__ "(), %s not defined by irda yet\n", @@ -892,8 +893,7 @@ static void nsc_ircc_change_dongle_speed dongle_types[dongle_id]); break; case 0x04: /* Sharp RY5HD01 */ - IRDA_DEBUG(0, __FUNCTION__ "(), %s not supported yet\n", - dongle_types[dongle_id]); + break; case 0x05: /* Reserved */ IRDA_DEBUG(0, __FUNCTION__ "(), %s not defined by irda yet\n", dongle_types[dongle_id]); diff -urpN linux-2.4.0-test11-pre6/net/irda/ircomm/ircomm_core.c linux/net/irda/ircomm/i
Re: [RANT] Linux-IrDA statusRe: [RANT] Linux-IrDA status
Hi Linus, I agree that the latest patch wasn't good about specifying its contents. But in fact, the 26th of august I sent you a mail which was much better (but then your mailbox crashed or something!?) Since you hadn't applied any previoius patches (and not even the patches from Russell), I felt that you wasn't to interested about IrDA (even if Transmeta is a member of IrDA these days ;-) or didn't have time to look thru them. So that's the reason for the very short description. I'm sorry about that! I've watched the ISDN discussion a year ago, so I already knew what you felt about such large patches. The truth is that I've been very busy with my new job, and haven't had much time to maintain the Linux-IrDA project, so those large patches was the best I could do, and it's correct that I haven't actually flooded you with patches the last 6 months. But we should anyway discuss what to do with IrDA support in Linux 2.4. The state of the current IrDA code in 2.4 is very bad and probably not working at all. The latest patch may have some bad code as well but at least things are working (and Linux isn't the OS which is best known for it's beautiful code anyway). It will eventually be fixed, once people start complaining! Some options: 1) Split up the large patch and fix the things you didn't like, submit them with better discription. But then It's probably to late anyway for 2.4 (even if the 2.4-test series is not the most stable stuff I've tried). Is it to late for this? 2) Remove IrDA from the kernel, and we'll go back to using CVS and make our own package (like PCMCIA and IrDA was before they got into the kernel. At least PCMCIA used to work back then ;-) 3) Just apply the stuff!?! Look at Jean's mail for description of the changes. -- Dag On Tue, 7 Nov 2000 23:26:34 -0800 (PST), you wrote: > > > On Wed, 8 Nov 2000, Michael Rothwell wrote: > > > > Like what? I'm not sure what you're saying here. It seems that the pople > > writing the IrDA code have gotten no feedback from you as to why their > > patch is never accepted -- could you clarify? > > Just to clarify. > > The ONLY message from the IrDA people I've gotten during the last few > weeks has been a SINGLE email from Dag Brattli, with a 330kB patch. > > The whole, full, unabridged explanation for those 330kB of patches: > > >> Hello Linus, > >> > >> Here is the latest IrDA patch for Linux-2.4.0-test10. > >> > >> Short summary: > >> > >> o Fixes IrDA in 2.4 > >> o Touches _no_ other files. > >> > >> Please apply! > >> > >> Best regards > >> > >> Dag Brattli > > That's it. > > ONE message during the last month. ONE huge patch. From people who should > have known about 2.4.x being pending for some time. > > 10,000+ lines of diff, with _no_ effort to split it up, or explain it with > anything but > > "o Fixes IrDA in 2.4" > > and these people expect me to reply, sending long explanations of why I > don't like them? After they did nothing of the sort for the code they > claim should have been applied? Nada. > > Get a grip. > > Linus > > > Dag Brattli, Mail: [EMAIL PROTECTED] Senior Systems EngineerWeb: http://www.fast.no/ Fast Search & Transfer ASA Phone: +47 776 96 688 P.O. Box 1126 Fax: +47 776 96 689 NO-9261 Tromsø, NORWAY Cell: +47 924 05 388 Try FAST Search: http://www.alltheweb.com/ - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] Please read the FAQ at http://www.tux.org/lkml/
[patch] patch-2.4.0-test10-irda1 (was: Re The IrDA patches)[patch] patch-2.4.0-test10-irda1 (was: Re The IrDA patches)
Linus, Here are the new IrDA patches for Linux-2.4.0-test10. Please apply them to your latest 2.4 code. If you decide to apply them, then I suggest you start with the first one (irda1.diff) and work your way to the last one (irda24.diff) since most of them are not commutative. The name of this patch is irda1.diff. (Many thanks to Jean Tourrilhes for splitting up the big patch) [FEATURE] : Add a new feature to the IrDA stack [CORRECT] : Fix to have the correct/expected behaviour [CRITICA] : Fix potential kernel crash [OUPS ] : Error that will be fixed in a later patch irda1.diff : o [CORRECT] Proper return code in case of IAS lookup failure o [CORRECT] Fix getname() to return proper length & data o [FEATURE] Add Kernel/User space tag to IAS attributes o [FEATURE] Add the ability to delete user space IAS attributes o [FEATURE] Auto discover dest address base on service name o [FEATURE] Allow query IAS outside a connection diff -urpN old-linux/include/linux/irda.h linux/include/linux/irda.h --- old-linux/include/linux/irda.h Thu Jan 6 14:46:18 2000 +++ linux/include/linux/irda.h Thu Nov 9 11:17:07 2000 @@ -86,6 +86,7 @@ enum { #define IRLMP_QOS_GET6 #define IRLMP_MAX_SDU_SIZE 7 #define IRLMP_IAS_GET8 +#define IRLMP_IAS_DEL 9 #define IRTTP_MAX_SDU_SIZE IRLMP_MAX_SDU_SIZE /* Compatibility */ @@ -93,6 +94,11 @@ enum { #define IAS_MAX_OCTET_STRING 1024 #define IAS_MAX_CLASSNAME 64 #define IAS_MAX_ATTRIBNAME 256 + +#define IAS_MISSING 0 +#define IAS_INTEGER 1 +#define IAS_OCT_SEQ 2 +#define IAS_STRING 3 #define LSAP_ANY 0xff diff -urpN old-linux/include/net/irda/irias_object.h linux/include/net/irda/irias_object.h --- old-linux/include/net/irda/irias_object.h Tue Dec 21 10:17:31 1999 +++ linux/include/net/irda/irias_object.h Thu Nov 9 11:17:07 2000 @@ -34,6 +34,10 @@ #define IAS_OCT_SEQ 2 #define IAS_STRING 3 +/* Object ownership of attributes (user or kernel) */ +#define IAS_KERNEL_ATTR0 +#define IAS_USER_ATTR 1 + /* * LM-IAS Object */ @@ -51,6 +55,7 @@ struct ias_object { */ struct ias_value { __u8type;/* Value description */ + __u8owner; /* Managed from user/kernel space */ int charset; /* Only used by string type */ int len; @@ -78,12 +83,15 @@ char *strdup(char *str); struct ias_object *irias_new_object(char *name, int id); void irias_insert_object(struct ias_object *obj); int irias_delete_object(struct ias_object *obj); +int irias_delete_attrib(struct ias_object *obj, struct ias_attrib *attrib); void __irias_delete_object(struct ias_object *obj); -void irias_add_integer_attrib(struct ias_object *obj, char *name, int value); -void irias_add_string_attrib(struct ias_object *obj, char *name, char *value); +void irias_add_integer_attrib(struct ias_object *obj, char *name, int value, + int user); +void irias_add_string_attrib(struct ias_object *obj, char *name, char *value, +int user); void irias_add_octseq_attrib(struct ias_object *obj, char *name, __u8 *octets, -int len); +int len, int user); int irias_object_change_attribute(char *obj_name, char *attrib_name, struct ias_value *new_value); struct ias_object *irias_find_object(char *name); diff -urpN old-linux/net/irda/af_irda.c linux/net/irda/af_irda.c --- old-linux/net/irda/af_irda.cFri Oct 27 10:56:41 2000 +++ linux/net/irda/af_irda.cThu Nov 9 11:17:07 2000 @@ -323,6 +323,8 @@ static void irda_flow_indication(void *i } } +#if 0 +/* Now obsolete... */ /* * Function irda_getvalue_confirm (obj_id, value, priv) * @@ -378,6 +380,55 @@ static void irda_getvalue_confirm(int re /* Wake up any processes waiting for result */ wake_up_interruptible(&self->ias_wait); } +#endif + +/* + * Function irda_getvalue_confirm (obj_id, value, priv) + * + *Got answer from remote LM-IAS, just pass object to requester... + * + * Note : duplicate from above, but we need our own version that + * doesn't touch the dtsap_sel and save the full value structure... + */ +static void irda_getvalue_confirm(int result, __u16 obj_id, + struct ias_value *value, void *priv) +{ + struct irda_sock *self; + + IRDA_DEBUG(2, __FUNCTION__ "()\n"); + + ASSERT(priv != NULL, return;); + self = (struct irda_sock *) priv; + + if (!self) { + WARNING(__FUNCTION__ "(), lost myself!\n"); + return; + } + + /* We probably don't need to make any more queries */ + iriap_close(self->iriap); + self->iriap = NULL; + + /* Check if request succeeded */ + if (result != IAS_SUCCESS) { + IRDA_DEBUG(1, __
[patch] patch-2.4.0-test10-irda2 (was: Re The IrDA patches)[patch] patch-2.4.0-test10-irda2 (was: Re The IrDA patches)
Linus, Here are the new IrDA patches for Linux-2.4.0-test10. Please apply them to your latest 2.4 code. If you decide to apply them, then I suggest you start with the first one (irda1.diff) and work your way to the last one (irda24.diff) since most of them are not commutative. The name of this patch is irda2.diff. (Many thanks to Jean Tourrilhes for splitting up the big patch) [FEATURE] : Add a new feature to the IrDA stack [CORRECT] : Fix to have the correct/expected behaviour [CRITICA] : Fix potential kernel crash [OUPS ] : Error that will be fixed in a later patch irda2.diff : o [CORRECT] Propagate incoming discovery info o [CORRECT] Inform user in case of discarded frames o [FEATURE] Set hint mask filter for discovery o [FEATURE] WAITDEVICE ioctl for blocking discovery o [FEATURE] Discovery callback optimisation o [OUPS ] Extra printk diff -urpN old-linux/include/linux/irda.h linux/include/linux/irda.h --- old-linux/include/linux/irda.h Thu Nov 9 11:49:35 2000 +++ linux/include/linux/irda.h Thu Nov 9 11:50:18 2000 @@ -78,15 +78,17 @@ enum { #define SOL_IRLMP 266 /* Same as SOL_IRDA for now */ #define SOL_IRTTP 266 /* Same as SOL_IRDA for now */ -#define IRLMP_ENUMDEVICES1 -#define IRLMP_IAS_SET2 -#define IRLMP_IAS_QUERY 3 -#define IRLMP_HINTS_SET 4 +#define IRLMP_ENUMDEVICES1 /* Return discovery log */ +#define IRLMP_IAS_SET2 /* Set an attribute in local IAS */ +#define IRLMP_IAS_QUERY 3 /* Query remote IAS for attribute */ +#define IRLMP_HINTS_SET 4 /* Set hint bits advertised */ #define IRLMP_QOS_SET5 #define IRLMP_QOS_GET6 #define IRLMP_MAX_SDU_SIZE 7 -#define IRLMP_IAS_GET8 -#define IRLMP_IAS_DEL 9 +#define IRLMP_IAS_GET8 /* Get an attribute from local IAS */ +#define IRLMP_IAS_DEL 9 /* Remove attribute from local IAS */ +#define IRLMP_HINT_MASK_SET10 /* Set discovery filter */ +#define IRLMP_WAITDEVICE 11 /* Wait for a discovery */ #define IRTTP_MAX_SDU_SIZE IRLMP_MAX_SDU_SIZE /* Compatibility */ diff -urpN old-linux/net/irda/af_irda.c linux/net/irda/af_irda.c --- old-linux/net/irda/af_irda.cThu Nov 9 11:49:35 2000 +++ linux/net/irda/af_irda.cThu Nov 9 11:53:21 2000 @@ -81,6 +81,9 @@ static struct proto_ops irda_ultra_ops; static hashbin_t *cachelog = NULL; static DECLARE_WAIT_QUEUE_HEAD(discovery_wait); /* Wait for discovery */ +static discovery_t *cachediscovery = NULL; +static struct wait_queue *selective_discovery_wait = NULL; +static struct timer_list discovery_watchdog; /* to avoid blocking state */ #define IRDA_MAX_HEADER (TTP_MAX_HEADER) @@ -433,7 +436,7 @@ static void irda_getvalue_confirm(int re /* * Function irda_discovery_indication (log) * - *Got a discovery log from IrLMP, wake ut any process waiting for answer + *Got a discovery log from IrLMP, wake up any process waiting for answer * */ static void irda_discovery_indication(hashbin_t *log) @@ -447,6 +450,46 @@ static void irda_discovery_indication(ha } /* + * Function irda_selective_discovery_indication (discovery) + * + *Got a selective discovery indication from IrLMP (node matching hint + * bits), wake up any process waiting for answer + * + */ +static void irda_selective_discovery_indication(discovery_t *discovery) +{ + IRDA_DEBUG(2, __FUNCTION__ "()\n"); + + /* Pass parameter to the caller */ + cachediscovery = discovery; + + /* Wake up process if its waiting for device to be discovered */ + if(selective_discovery_wait != NULL) + wake_up_interruptible(&selective_discovery_wait); +} + +/* + * Function irda_discovery_timeout (a) + * + *Got a selective discovery indication from IrLMP (node matching hint + * bits), wake up any process waiting for answer + * + */ +static void irda_discovery_timeout(u_long priv) +{ + struct irda_sock *self; + + IRDA_DEBUG(2, __FUNCTION__ "()\n"); + + self = (struct irda_sock *) priv; + ASSERT(self != NULL, return;); + + /* Wake up process if its still waiting... */ + if(selective_discovery_wait != NULL) + wake_up_interruptible(&selective_discovery_wait); +} + +/* * Function irda_open_tsap (self) * *Open local Transport Service Access Point (TSAP) @@ -619,9 +662,12 @@ static int irda_discover_daddr_and_lsap_ irlmp_update_client(self->ckey, self->mask, NULL, irda_discovery_indication); - /* Do some discovery */ + /* Do some discovery (and also return cached discovery results) */ irlmp_discovery_request(self->nslots); + /* Tell IrLMP that we have been notified */ + irlmp_update_client(self->ckey, self->mask, NULL, NULL); + /* Check if t
[patch] patch-2.4.0-test10-irda3 (was: Re The IrDA patches)[patch] patch-2.4.0-test10-irda3 (was: Re The IrDA patches)
Linus, Here are the new IrDA patches for Linux-2.4.0-test10. Please apply them to your latest 2.4 code. If you decide to apply them, then I suggest you start with the first one (irda1.diff) and work your way to the last one (irda24.diff) since most of them are not commutative. The name of this patch is irda3.diff. (Many thanks to Jean Tourrilhes for splitting up the big patch) [FEATURE] : Add a new feature to the IrDA stack [CORRECT] : Fix to have the correct/expected behaviour [CRITICA] : Fix potential kernel crash [OUPS ] : Error that will be fixed in a later patch irda3.diff : o [CORRECT] Move query/discovery/watchdog data in per socket struct o [CORRECT] Identify socket in discovery callback (priv arg) o [CORRECT] Handle LAP waiting for timeout o [-OUPS ] Remove extra printk diff -urpN old-linux/include/net/irda/discovery.h linux/include/net/irda/discovery.h --- old-linux/include/net/irda/discovery.h Thu Nov 9 13:24:13 2000 +++ linux/include/net/irda/discovery.h Thu Nov 9 13:24:28 2000 @@ -44,7 +44,7 @@ /* * The DISCOVERY structure is used for both discovery requests and responses */ -typedef struct { +typedef struct discovery_t { queue_t q; /* Must be first! */ __u32 saddr;/* Which link the device was discovered */ diff -urpN old-linux/include/net/irda/irda.h linux/include/net/irda/irda.h --- old-linux/include/net/irda/irda.h Thu Nov 9 13:24:13 2000 +++ linux/include/net/irda/irda.h Thu Nov 9 13:24:28 2000 @@ -110,8 +110,14 @@ if(!(expr)) { \ typedef enum { FLOW_STOP, FLOW_START } LOCAL_FLOW; +/* A few forward declarations (to make compiler happy) */ +struct tsap_cb;/* in */ +struct lsap_cb;/* in */ +struct iriap_cb; /* in */ +struct ias_value; /* in */ +struct discovery_t;/* in */ + /* IrDA Socket */ -struct tsap_cb; struct irda_sock { __u32 saddr; /* my local address */ __u32 daddr; /* peer address */ @@ -137,14 +143,18 @@ struct irda_sock { struct ias_object *ias_obj; /* Our service name + lsap in IAS */ struct iriap_cb *iriap; /* Used to query remote IAS */ - struct ias_value *ias_result; /* Used by getsockopt(IRLMP_IAS_QUERY) */ + struct ias_value *ias_result; /* Result of remote IAS query */ + + hashbin_t *cachelog;/* Result of discovery query */ + struct discovery_t *cachediscovery; /* Result of selective discovery query +*/ int nslots; /* Number of slots to use for discovery */ int errno;/* status of the IAS query */ struct sock *sk; - wait_queue_head_t ias_wait; /* Wait for LM-IAS answer */ + wait_queue_head_t query_wait; /* Wait for the answer to a query */ + struct timer_list watchdog; /* Timeout for discovery */ LOCAL_FLOW tx_flow; LOCAL_FLOW rx_flow; diff -urpN old-linux/include/net/irda/irlan_client.h linux/include/net/irda/irlan_client.h --- old-linux/include/net/irda/irlan_client.h Thu Nov 9 13:24:13 2000 +++ linux/include/net/irda/irlan_client.h Thu Nov 9 13:24:28 2000 @@ -34,7 +34,7 @@ #include void irlan_client_start_kick_timer(struct irlan_cb *self, int timeout); -void irlan_client_discovery_indication(discovery_t *); +void irlan_client_discovery_indication(discovery_t *, void *); void irlan_client_wakeup(struct irlan_cb *self, __u32 saddr, __u32 daddr); void irlan_client_open_ctrl_tsap( struct irlan_cb *self); diff -urpN old-linux/include/net/irda/irlmp.h linux/include/net/irda/irlmp.h --- old-linux/include/net/irda/irlmp.h Thu Nov 9 13:24:13 2000 +++ linux/include/net/irda/irlmp.h Thu Nov 9 13:24:28 2000 @@ -71,8 +71,8 @@ typedef enum { S_END, } SERVICE; -typedef void (*DISCOVERY_CALLBACK1) (discovery_t *); -typedef void (*DISCOVERY_CALLBACK2) (hashbin_t *); +typedef void (*DISCOVERY_CALLBACK1) (discovery_t *, void *); +typedef void (*DISCOVERY_CALLBACK2) (hashbin_t *, void *); typedef struct { queue_t queue; /* Must be first */ @@ -87,6 +87,7 @@ typedef struct { DISCOVERY_CALLBACK1 callback1; DISCOVERY_CALLBACK2 callback2; + void *priv;/* Used to identify client */ } irlmp_client_t; struct lap_cb; /* Forward decl. */ @@ -192,10 +193,10 @@ __u16 irlmp_service_to_hint(int service) __u32 irlmp_register_service(__u16 hints); int irlmp_unregister_service(__u32 handle); __u32 irlmp_register_client(__u16 hint_mask, DISCOVERY_CALLBACK1 callback1, - DISCOVERY_CALLBACK2 callback2); + DISCOVERY_CALLBACK2 callback2, void *priv); int irlmp_unregister_client(__u32 handle); int irlmp_update_client(__u32 handle, __u16 hint_mask, - DISCOVERY_CALLBACK1, DISCOVERY_CALLBACK2); + DISCOVERY_CALLBACK1, DISCOVERY_CALLBACK2, voi
[patch] patch-2.4.0-test10-irda4 (was: Re The IrDA patches)[patch] patch-2.4.0-test10-irda4 (was: Re The IrDA patches)
Linus, Here are the new IrDA patches for Linux-2.4.0-test10. Please apply them to your latest 2.4 code. If you decide to apply them, then I suggest you start with the first one (irda1.diff) and work your way to the last one (irda24.diff) since most of them are not commutative. The name of this patch is irda4.diff. (Many thanks to Jean Tourrilhes for splitting up the big patch) [FEATURE] : Add a new feature to the IrDA stack [CORRECT] : Fix to have the correct/expected behaviour [CRITICA] : Fix potential kernel crash [OUPS ] : Error that will be fixed in a later patch irda4.diff : o [CORRECT] Add delay in -> Propagate incoming discovery info o [FEATURE] Save time of first discovery -> determine if new or same diff -urpN old-linux/include/net/irda/discovery.h linux/include/net/irda/discovery.h --- old-linux/include/net/irda/discovery.h Thu Nov 9 13:04:53 2000 +++ linux/include/net/irda/discovery.h Thu Nov 9 13:06:02 2000 @@ -59,6 +59,7 @@ typedef struct discovery_t { intgen_addr_bit; /* Need to generate a new device address? */ intnslots; /* Number of slots to use when discovering */ unsigned long timestamp; /* Time discovered */ + unsigned long first_timestamp; /* First time discovered */ } discovery_t; void irlmp_add_discovery(hashbin_t *cachelog, discovery_t *discovery); diff -urpN old-linux/net/irda/af_irda.c linux/net/irda/af_irda.c --- old-linux/net/irda/af_irda.cThu Nov 9 13:04:53 2000 +++ linux/net/irda/af_irda.cThu Nov 9 13:12:46 2000 @@ -452,9 +452,11 @@ static void irda_discovery_indication(ha /* * Function irda_selective_discovery_indication (discovery) * - *Got a selective discovery indication from IrLMP (node matching hint - * bits), wake up any process waiting for answer + *Got a selective discovery indication from IrLMP. * + * IrLMP is telling us that this node is matching our hint bit + * filter. Check if it's a newly discovered node (or if node changed its + * hint bits), and then wake up any process waiting for answer... */ static void irda_selective_discovery_indication(discovery_t *discovery, void *priv) @@ -469,6 +471,16 @@ static void irda_selective_discovery_ind return; } + /* Check if node is discovered is a new one or an old one. +* We check when how long ago this node was discovered, with a +* coarse timeout (we may miss some discovery events or be delayed). +* Note : by doing this test here, we avoid waking up a process ;-) +*/ + if((jiffies - discovery->first_timestamp) > + (sysctl_discovery_timeout * HZ)) { + return; /* Too old, not interesting -> goodbye */ + } + /* Pass parameter to the caller */ self->cachediscovery = discovery; @@ -477,11 +489,12 @@ static void irda_selective_discovery_ind } /* - * Function irda_discovery_timeout (a) + * Function irda_discovery_timeout (priv) * - *Got a selective discovery indication from IrLMP (node matching hint - * bits), wake up any process waiting for answer + *Timeout in the selective discovery process * + * We were waiting for a node to be discovered, but nothing has come up + * so far. Wake up the user and tell him that we failed... */ static void irda_discovery_timeout(u_long priv) { @@ -2245,6 +2258,10 @@ static int irda_getsockopt(struct socket * come into range. When this device arrive, we just wake * up the caller, so that he has time to connect to it before * the device goes away... +* Note : once the node has been discovered for more than a +* few second, it won't trigger this function, unless it +* goes away and come back changes its hint bits (so we +* might call it IRLMP_WAITNEWDEVICE). */ /* Check that the user is passing us an int */ diff -urpN old-linux/net/irda/discovery.c linux/net/irda/discovery.c --- old-linux/net/irda/discovery.c Tue Dec 21 10:17:58 1999 +++ linux/net/irda/discovery.c Thu Nov 9 13:06:02 2000 @@ -43,12 +43,23 @@ * *Add a new discovery to the cachelog, and remove any old discoveries *from the same device + * + * Note : we try to preserve the time this device was *first* discovered + * (as opposed to the time of last discovery used for cleanup). This is + * used by clients waiting for discovery events to tell if the device + * discovered is "new" or just the same old one. They can't rely there + * on a binary flag (new/old), because not all discovery events are + * propagated to them, and they might not always listen, so they would + * miss some new devices popping up... */ void irlmp_add_discovery(hashbin_t *cachelog, discovery_t *new) { discovery_t *discovery, *node; unsigned long
[patch] patch-2.4.0-test10-irda5 (was: Re The IrDA patches)[patch] patch-2.4.0-test10-irda5 (was: Re The IrDA patches)
Linus, Here are the new IrDA patches for Linux-2.4.0-test10. Please apply them to your latest 2.4 code. If you decide to apply them, then I suggest you start with the first one (irda1.diff) and work your way to the last one (irda24.diff) since most of them are not commutative. The name of this patch is irda5.diff. (Many thanks to Jean Tourrilhes for splitting up the big patch) [FEATURE] : Add a new feature to the IrDA stack [CORRECT] : Fix to have the correct/expected behaviour [CRITICA] : Fix potential kernel crash [OUPS ] : Error that will be fixed in a later patch irda5.diff : o [CRITICA] Stop idle timer when reconnecting o [CORRECT] Pass dest address properly for IAS queries diff -urpN old-linux/include/linux/irda.h linux/include/linux/irda.h --- old-linux/include/linux/irda.h Thu Nov 9 12:00:52 2000 +++ linux/include/linux/irda.h Thu Nov 9 13:29:43 2000 @@ -88,7 +88,7 @@ enum { #define IRLMP_IAS_GET8 /* Get an attribute from local IAS */ #define IRLMP_IAS_DEL 9 /* Remove attribute from local IAS */ #define IRLMP_HINT_MASK_SET10 /* Set discovery filter */ -#define IRLMP_WAITDEVICE 11 /* Wait for a discovery */ +#define IRLMP_WAITDEVICE 11 /* Wait for a new discovery */ #define IRTTP_MAX_SDU_SIZE IRLMP_MAX_SDU_SIZE /* Compatibility */ @@ -97,6 +97,7 @@ enum { #define IAS_MAX_CLASSNAME 64 #define IAS_MAX_ATTRIBNAME 256 +/* Attribute type needed for struct irda_ias_set */ #define IAS_MISSING 0 #define IAS_INTEGER 1 #define IAS_OCT_SEQ 2 @@ -140,6 +141,7 @@ struct irda_ias_set { __u8 string[IAS_MAX_STRING]; } irda_attrib_string; } attribute; + __u32 daddr;/* Address of device (for some queries only) */ }; /* Some private IOCTL's (max 16) */ diff -urpN old-linux/include/net/irda/timer.h linux/include/net/irda/timer.h --- old-linux/include/net/irda/timer.h Mon Oct 25 20:49:42 1999 +++ linux/include/net/irda/timer.h Thu Nov 9 13:29:43 2000 @@ -82,6 +82,7 @@ struct lap_cb; inline void irlmp_start_watchdog_timer(struct lsap_cb *, int timeout); inline void irlmp_start_discovery_timer(struct irlmp_cb *, int timeout); inline void irlmp_start_idle_timer(struct lap_cb *, int timeout); +inline void irlmp_stop_idle_timer(struct lap_cb *self); #endif diff -urpN old-linux/net/irda/af_irda.c linux/net/irda/af_irda.c --- old-linux/net/irda/af_irda.cThu Nov 9 13:29:19 2000 +++ linux/net/irda/af_irda.cThu Nov 9 13:29:43 2000 @@ -11,7 +11,7 @@ * Sources: af_netroom.c, af_ax25.c, af_rose.c, af_x25.c etc. * * Copyright (c) 1999 Dag Brattli <[EMAIL PROTECTED]> - * Copyright (c) 1999 Jean Tourrilhes <[EMAIL PROTECTED]> + * Copyright (c) 1999 Jean Tourrilhes <[EMAIL PROTECTED]> * All Rights Reserved. * * This program is free software; you can redistribute it and/or @@ -2199,7 +2199,7 @@ static int irda_getsockopt(struct socket } else { /* We are not connected, we must specify a valid * destination address */ - daddr = ias_opt.attribute.irda_attrib_int; + daddr = ias_opt.daddr; if((!daddr) || (daddr == DEV_ADDR_ANY)) return -EINVAL; } diff -urpN old-linux/net/irda/irlmp_event.c linux/net/irda/irlmp_event.c --- old-linux/net/irda/irlmp_event.cFri Jan 7 11:51:56 2000 +++ linux/net/irda/irlmp_event.cThu Nov 9 13:29:43 2000 @@ -122,7 +122,7 @@ int irlmp_do_lsap_event(struct lsap_cb * ASSERT(self->magic == LMP_LSAP_MAGIC, return -1;); IRDA_DEBUG(4, __FUNCTION__ "(), EVENT = %s, STATE = %s\n", - irlmp_event[event], irlmp_state[ self->lsap_state]); + irlmp_event[event], irlsap_state[ self->lsap_state]); return (*lsap_state[self->lsap_state]) (self, event, skb); } @@ -393,6 +393,14 @@ static void irlmp_state_active(struct la irlmp_next_lap_state(self, LAP_STANDBY); self->refcount = 0; + /* In some case, at this point our side has already closed +* all lsaps, and we are waiting for the idle_timer to +* expire. If another device reconnect immediately, the +* idle timer will expire in the midle of the connection +* initialisation, screwing up things a lot... +* Therefore, we must stop the timer... */ + irlmp_stop_idle_timer(self); + /* * Inform all connected LSAP's using this link */ @@ -410,7 +418,8 @@ static void irlmp_state_active(struct la } break; default: - IRDA_
[patch] patch-2.4.0-test10-irda6 (was: Re: The IrDA patches)[patch] patch-2.4.0-test10-irda6 (was: Re: The IrDA patches)
Linus, Here are the new IrDA patches for Linux-2.4.0-test10. Please apply them to your latest 2.4 code. If you decide to apply them, then I suggest you start with the first one (irda1.diff) and work your way to the last one (irda24.diff) since most of them are not commutative. The name of this patch is irda6.diff. (Many thanks to Jean Tourrilhes for splitting up the big patch) [FEATURE] : Add a new feature to the IrDA stack [CORRECT] : Fix to have the correct/expected behaviour [CRITICA] : Fix potential kernel crash [OUPS ] : Error that will be fixed in a later patch irda6.diff : o [CORRECT] Handle properly the MSG_EOR flag on SEQPACKET sockets idiff -urpN old-linux/net/irda/af_irda.c linux/net/irda/af_irda.c --- old-linux/net/irda/af_irda.cThu Nov 9 13:36:27 2000 +++ linux/net/irda/af_irda.cThu Nov 9 13:37:09 2000 @@ -1291,7 +1291,8 @@ static int irda_sendmsg(struct socket *s IRDA_DEBUG(4, __FUNCTION__ "(), len=%d\n", len); - if (msg->msg_flags & ~MSG_DONTWAIT) + /* Note : socket.c set MSG_EOR on SEQPACKET sockets */ + if (msg->msg_flags & ~(MSG_DONTWAIT | MSG_EOR)) return -EINVAL; if (sk->shutdown & SEND_SHUTDOWN) { - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] Please read the FAQ at http://www.tux.org/lkml/
[patch] patch-2.4.0-test10-irda7 (was: Re: The IrDA patches)[patch] patch-2.4.0-test10-irda7 (was: Re: The IrDA patches)
Linus, Here are the new IrDA patches for Linux-2.4.0-test10. Please apply them to your latest 2.4 code. If you decide to apply them, then I suggest you start with the first one (irda1.diff) and work your way to the last one (irda24.diff) since most of them are not commutative. The name of this patch is irda7.diff. (Many thanks to Jean Tourrilhes for splitting up the big patch) [FEATURE] : Add a new feature to the IrDA stack [CORRECT] : Fix to have the correct/expected behaviour [CRITICA] : Fix potential kernel crash [OUPS ] : Error that will be fixed in a later patch irda7.diff : o [CRITICA] Do proper spinlock on the discovery log o [CRITICA] Safe concurent reading of discovery log o [FEATURE] Remove cruft in af_irda diff -urpN old-linux/include/net/irda/discovery.h linux/include/net/irda/discovery.h --- old-linux/include/net/irda/discovery.h Thu Nov 9 13:29:19 2000 +++ linux/include/net/irda/discovery.h Thu Nov 9 13:40:12 2000 @@ -65,5 +65,6 @@ typedef struct discovery_t { void irlmp_add_discovery(hashbin_t *cachelog, discovery_t *discovery); void irlmp_add_discovery_log(hashbin_t *cachelog, hashbin_t *log); void irlmp_expire_discoveries(hashbin_t *log, __u32 saddr, int force); +struct irda_device_info *irlmp_copy_discoveries(hashbin_t *log, int *pn, __u16 mask); #endif diff -urpN old-linux/include/net/irda/irlmp.h linux/include/net/irda/irlmp.h --- old-linux/include/net/irda/irlmp.h Thu Nov 9 13:27:10 2000 +++ linux/include/net/irda/irlmp.h Thu Nov 9 13:40:12 2000 @@ -175,10 +175,10 @@ struct irlmp_cb { hashbin_t *clients; hashbin_t *services; - hashbin_t *cachelog; - int running; + hashbin_t *cachelog;/* Current discovery log */ + spinlock_t log_lock;/* discovery log spinlock */ - spinlock_t lock; + int running; __u16_host_order hints; /* Hint bits */ }; @@ -215,6 +215,7 @@ int irlmp_disconnect_request(struct lsa void irlmp_discovery_confirm(hashbin_t *discovery_log); void irlmp_discovery_request(int nslots); +struct irda_device_info *irlmp_get_discoveries(int *pn, __u16 mask); void irlmp_do_discovery(int nslots); discovery_t *irlmp_get_discovery_response(void); diff -urpN old-linux/net/irda/af_irda.c linux/net/irda/af_irda.c --- old-linux/net/irda/af_irda.cThu Nov 9 13:39:06 2000 +++ linux/net/irda/af_irda.cThu Nov 9 13:40:13 2000 @@ -320,65 +320,6 @@ static void irda_flow_indication(void *i } } -#if 0 -/* Now obsolete... */ -/* - * Function irda_getvalue_confirm (obj_id, value, priv) - * - *Got answer from remote LM-IAS - * - */ -static void irda_getvalue_confirm(int result, __u16 obj_id, - struct ias_value *value, void *priv) -{ - struct irda_sock *self; - - IRDA_DEBUG(2, __FUNCTION__ "()\n"); - - ASSERT(priv != NULL, return;); - self = (struct irda_sock *) priv; - - if (!self) { - WARNING(__FUNCTION__ "(), lost myself!\n"); - return; - } - - /* We probably don't need to make any more queries */ - iriap_close(self->iriap); - self->iriap = NULL; - - self->errno = result; - - /* Check if request succeeded */ - if (result != IAS_SUCCESS) { - IRDA_DEBUG(0, __FUNCTION__ "(), IAS query failed!\n"); - - /* Wake up any processes waiting for result */ - wake_up_interruptible(&self->ias_wait); - - return; - } - - switch (value->type) { - case IAS_INTEGER: - IRDA_DEBUG(4, __FUNCTION__ "() int=%d\n", value->t.integer); - - if (value->t.integer != -1) { - self->dtsap_sel = value->t.integer; - } else - self->dtsap_sel = 0; - break; - default: - IRDA_DEBUG(0, __FUNCTION__ "(), bad type!\n"); - break; - } - irias_delete_value(value); - - /* Wake up any processes waiting for result */ - wake_up_interruptible(&self->ias_wait); -} -#endif - /* * Function irda_getvalue_confirm (obj_id, value, priv) * @@ -425,6 +366,8 @@ static void irda_getvalue_confirm(int re wake_up_interruptible(&self->query_wait); } +#if 0 +/* Obsolete */ /* * Function irda_discovery_indication (log) * @@ -448,6 +391,7 @@ static void irda_discovery_indication(ha /* Wake up process if its waiting for device to be discovered */ wake_up_interruptible(&self->query_wait); } +#endif /* * Function irda_selective_discovery_indication (discovery) @@ -655,7 +599,7 @@ static int irda_find_lsap_sel(struct ird return -EADDRNOTAVAIL; } - /* +/* * Function irda_discover_daddr_and_lsap_sel (self, name) * *This try to find a device with the requested service. @@ -674,8 +618,10 @@ static int irda_find_lsap_sel(struct ird */ stati
[patch] patch-2.4.0-test10-irda8 (was: Re: The IrDA patches)[patch] patch-2.4.0-test10-irda8 (was: Re: The IrDA patches)
Linus, Here are the new IrDA patches for Linux-2.4.0-test10. Please apply them to your latest 2.4 code. If you decide to apply them, then I suggest you start with the first one (irda1.diff) and work your way to the last one (irda24.diff) since most of them are not commutative. The name of this patch is irda8.diff. (Many thanks to Jean Tourrilhes for splitting up the big patch) [FEATURE] : Add a new feature to the IrDA stack [CORRECT] : Fix to have the correct/expected behaviour [CRITICA] : Fix potential kernel crash [OUPS ] : Error that will be fixed in a later patch irda8.diff : o [CRITICA] Preserve irda device name (better fix later on) o [CORRECT] Use timer_pending when possible diff -urpN linux/drivers/net/irda/irtty.c old-linux/drivers/net/irda/irtty.c --- linux/drivers/net/irda/irtty.c Thu Nov 9 14:29:59 2000 +++ old-linux/drivers/net/irda/irtty.c Thu Nov 9 13:48:34 2000 @@ -233,8 +233,14 @@ static int irtty_open(struct tty_struct ERROR(__FUNCTION__ "(), dev_alloc() failed!\n"); return -ENOMEM; } + +#if LINUX_VERSION_CODE >= 0x020362 /* 2.3.99-pre7 */ + /* dev_alloc doesn't clear the struct (Yuck !!!) */ + memset(((__u8*)dev)+IFNAMSIZ,0,sizeof(struct net_device)-IFNAMSIZ); +#else /* dev_alloc doesn't clear the struct */ memset(((__u8*)dev)+sizeof(char*),0,sizeof(struct net_device)-sizeof(char*)); +#endif /* LINUX_VERSION_CODE >= 0x020362 */ dev->priv = (void *) self; self->netdev = dev; diff -urpN linux/net/irda/af_irda.c old-linux/net/irda/af_irda.c --- linux/net/irda/af_irda.cThu Nov 9 14:37:46 2000 +++ old-linux/net/irda/af_irda.cThu Nov 9 13:48:34 2000 @@ -2195,7 +2195,7 @@ static int irda_getsockopt(struct socket interruptible_sleep_on(&self->query_wait); /* If watchdog is still activated, kill it! */ - if(self->watchdog.prev != (struct timer_list *) NULL) + if(timer_pending(&(self->watchdog))) del_timer(&(self->watchdog)); IRDA_DEBUG(1, __FUNCTION__ diff -urpN linux/net/irda/irlmp_frame.c old-linux/net/irda/irlmp_frame.c --- linux/net/irda/irlmp_frame.cThu Nov 9 14:37:38 2000 +++ old-linux/net/irda/irlmp_frame.cThu Nov 9 13:48:34 2000 @@ -395,7 +395,7 @@ void irlmp_link_discovery_indication(str irlmp_add_discovery(irlmp->cachelog, discovery); /* If delay was activated, kill it! */ - if(disco_delay.prev != (struct timer_list *) NULL) + if(timer_pending(&disco_delay)) del_timer(&disco_delay); /* Set delay timer to expire in 0.5s. */ disco_delay.expires = jiffies + (DISCO_SMALL_DELAY * HZ/1000); @@ -422,7 +422,7 @@ void irlmp_link_discovery_confirm(struct irlmp_add_discovery_log(irlmp->cachelog, log); /* If delay was activated, kill it! */ - if(disco_delay.prev != (struct timer_list *) NULL) + if(timer_pending(&disco_delay)) del_timer(&disco_delay); /* Propagate event to the state machine */ diff -urpN linux/net/irda/timer.c old-linux/net/irda/timer.c --- linux/net/irda/timer.c Thu Nov 9 14:37:38 2000 +++ old-linux/net/irda/timer.c Thu Nov 9 13:48:34 2000 @@ -120,7 +120,7 @@ void irlmp_start_idle_timer(struct lap_c void irlmp_stop_idle_timer(struct lap_cb *self) { /* If timer is activated, kill it! */ - if(self->idle_timer.prev != (struct timer_list *) NULL) + if(timer_pending(&self->idle_timer)) del_timer(&self->idle_timer); } - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] Please read the FAQ at http://www.tux.org/lkml/
[patch] patch-2.4.0-test10-irda9 (was: Re: The IrDA patches)[patch] patch-2.4.0-test10-irda9 (was: Re: The IrDA patches)
Linus, Here are the new IrDA patches for Linux-2.4.0-test10. Please apply them to your latest 2.4 code. If you decide to apply them, then I suggest you start with the first one (irda1.diff) and work your way to the last one (irda24.diff) since most of them are not commutative. The name of this patch is irda9.diff. (Many thanks to Jean Tourrilhes for splitting up the big patch) [FEATURE] : Add a new feature to the IrDA stack [CORRECT] : Fix to have the correct/expected behaviour [CRITICA] : Fix potential kernel crash [OUPS ] : Error that will be fixed in a later patch irda9.diff : o [CORRECT] Change queue_t to irda_queue_t (namespace pollution) diff -urpN old-linux/include/net/irda/discovery.h linux/include/net/irda/discovery.h --- old-linux/include/net/irda/discovery.h Thu Nov 9 13:45:18 2000 +++ linux/include/net/irda/discovery.h Thu Nov 9 14:44:44 2000 @@ -45,7 +45,7 @@ * The DISCOVERY structure is used for both discovery requests and responses */ typedef struct discovery_t { - queue_t q; /* Must be first! */ + irda_queue_t q; /* Must be first! */ __u32 saddr;/* Which link the device was discovered */ __u32 daddr;/* Remote device address */ diff -urpN old-linux/include/net/irda/ircomm_core.h linux/include/net/irda/ircomm_core.h --- old-linux/include/net/irda/ircomm_core.hTue Dec 21 10:17:31 1999 +++ linux/include/net/irda/ircomm_core.hThu Nov 9 14:44:44 2000 @@ -53,7 +53,7 @@ typedef struct { } call_t; struct ircomm_cb { - queue_t queue; + irda_queue_t queue; magic_t magic; notify_t notify; diff -urpN old-linux/include/net/irda/ircomm_tty.h linux/include/net/irda/ircomm_tty.h --- old-linux/include/net/irda/ircomm_tty.h Fri Jan 28 19:36:22 2000 +++ linux/include/net/irda/ircomm_tty.h Thu Nov 9 14:44:44 2000 @@ -48,7 +48,7 @@ * IrCOMM TTY driver state */ struct ircomm_tty_cb { - queue_t queue;/* Must be first */ + irda_queue_t queue;/* Must be first */ magic_t magic; int state;/* Connect state */ diff -urpN old-linux/include/net/irda/irda_device.h linux/include/net/irda/irda_device.h --- old-linux/include/net/irda/irda_device.hTue Oct 31 11:18:04 2000 +++ linux/include/net/irda/irda_device.hThu Nov 9 14:44:44 2000 @@ -79,7 +79,7 @@ struct irda_task; typedef int (*IRDA_TASK_CALLBACK) (struct irda_task *task); struct irda_task { - queue_t q; + irda_queue_t q; magic_t magic; IRDA_TASK_STATE state; @@ -111,7 +111,7 @@ typedef struct { /* Dongle registration info */ struct dongle_reg { - queue_t q; /* Must be first */ + irda_queue_t q; /* Must be first */ IRDA_DONGLE type; void (*open)(dongle_t *dongle, struct qos_info *qos); diff -urpN old-linux/include/net/irda/iriap.h linux/include/net/irda/iriap.h --- old-linux/include/net/irda/iriap.h Thu Jan 6 14:46:18 2000 +++ linux/include/net/irda/iriap.h Thu Nov 9 14:44:44 2000 @@ -58,7 +58,7 @@ typedef void (*CONFIRM_CALLBACK)(int res struct ias_value *value, void *priv); struct iriap_cb { - queue_t q; /* Must be first */ + irda_queue_t q; /* Must be first */ magic_t magic; /* Magic cookie */ int mode; /* Client or server */ diff -urpN old-linux/include/net/irda/irias_object.h linux/include/net/irda/irias_object.h --- old-linux/include/net/irda/irias_object.h Thu Nov 9 11:49:35 2000 +++ linux/include/net/irda/irias_object.h Thu Nov 9 14:44:44 2000 @@ -42,7 +42,7 @@ * LM-IAS Object */ struct ias_object { - queue_t q; /* Must be first! */ + irda_queue_t q; /* Must be first! */ magic_t magic; char *name; @@ -71,7 +71,7 @@ struct ias_value { * Attributes used by LM-IAS objects */ struct ias_attrib { - queue_t q; /* Must be first! */ + irda_queue_t q; /* Must be first! */ int magic; char *name; /* Attribute name */ diff -urpN old-linux/include/net/irda/irlan_common.h linux/include/net/irda/irlan_common.h --- old-linux/include/net/irda/irlan_common.h Tue Jul 11 11:12:24 2000 +++ linux/include/net/irda/irlan_common.h Thu Nov 9 14:44:44 2000 @@ -161,7 +161,7 @@ struct irlan_provider_cb { * IrLAN control block */ struct irlan_cb { - queue_t q; /* Must be first */ + irda_queue_t q; /* Must be first */ intmagic; struct net_device dev;/* Ethernet device structure*/ diff -urpN old-linux/include/net/irda/irlap.h linux/include/net/irda/irlap.h --- old-linux/include/net/irda/irlap.h Tue Oct 31 11:18:04 2000 +++ linux/include/net/irda/irlap.h Thu Nov 9 14:44:44 2000 @@ -81,7 +81,7 @@ #define irda_incomp (*self->decompressor.cp->incomp) struct irda_compre
[patch] patch-2.4.0-test10-irda10 (was: Re: The IrDA patches)[patch] patch-2.4.0-test10-irda10 (was: Re: The IrDA patches)
Linus, Here are the new IrDA patches for Linux-2.4.0-test10. Please apply them to your latest 2.4 code. If you decide to apply them, then I suggest you start with the first one (irda1.diff) and work your way to the last one (irda24.diff) since most of them are not commutative. The name of this patch is irda10.diff. (Many thanks to Jean Tourrilhes for splitting up the big patch) [FEATURE] : Add a new feature to the IrDA stack [CORRECT] : Fix to have the correct/expected behaviour [CRITICA] : Fix potential kernel crash [OUPS ] : Error that will be fixed in a later patch irda10.diff : - o [CRITICA] Update skb handling (Add skb_get() and kfree_skb()) diff -urpN old-linux/net/irda/irlap.c linux/net/irda/irlap.c --- old-linux/net/irda/irlap.c Thu Nov 9 14:47:22 2000 +++ linux/net/irda/irlap.c Thu Nov 9 14:47:40 2000 @@ -232,7 +232,8 @@ void irlap_connect_indication(struct irl ASSERT(self->magic == LAP_MAGIC, return;); irlap_init_qos_capabilities(self, NULL); /* No user QoS! */ - + + skb_get(skb); /*LEVEL4*/ irlmp_link_connect_indication(self->notify.instance, self->saddr, self->daddr, &self->qos_tx, skb); } @@ -248,6 +249,7 @@ void irlap_connect_response(struct irlap IRDA_DEBUG(4, __FUNCTION__ "()\n"); irlap_do_event(self, CONNECT_RESPONSE, skb, NULL); + kfree_skb(skb); } /* @@ -292,6 +294,7 @@ void irlap_connect_confirm(struct irlap_ ASSERT(self != NULL, return;); ASSERT(self->magic == LAP_MAGIC, return;); + skb_get(skb); /*LEVEL4*/ irlmp_link_connect_confirm(self->notify.instance, &self->qos_tx, skb); } @@ -310,6 +313,7 @@ void irlap_data_indication(struct irlap_ #ifdef CONFIG_IRDA_COMPRESSION if (self->qos_tx.compression.value) { + skb_get(skb); /*LEVEL4*/ skb = irlap_decompress_frame(self, skb); if (!skb) { IRDA_DEBUG(1, __FUNCTION__ "(), Decompress error!\n"); @@ -317,6 +321,7 @@ void irlap_data_indication(struct irlap_ } } #endif + skb_get(skb); /*LEVEL4*/ irlmp_link_data_indication(self->notify.instance, skb, unreliable); } @@ -373,6 +378,7 @@ void irlap_data_request(struct irlap_cb ASSERT(skb != NULL, return;); } irlap_do_event(self, SEND_I_CMD, skb, NULL); + kfree_skb(skb); } else skb_queue_tail(&self->txq, skb); } @@ -422,6 +428,7 @@ void irlap_unitdata_indication(struct ir /* Hide LAP header from IrLMP layer */ skb_pull(skb, LAP_ADDR_HEADER+LAP_CTRL_HEADER); + skb_get(skb); /*LEVEL4*/ irlmp_link_unitdata_indication(self->notify.instance, skb); } #endif /* CONFIG_IRDA_ULTRA */ diff -urpN old-linux/net/irda/irlap_event.c linux/net/irda/irlap_event.c --- old-linux/net/irda/irlap_event.cThu Nov 9 14:47:22 2000 +++ linux/net/irda/irlap_event.cThu Nov 9 14:47:40 2000 @@ -230,7 +230,7 @@ void irlap_do_event(struct irlap_cb *sel if (!self || self->magic != LAP_MAGIC) return; - + IRDA_DEBUG(3, __FUNCTION__ "(), event = %s, state = %s\n", irlap_event[event], irlap_state[self->state]); @@ -252,6 +252,7 @@ void irlap_do_event(struct irlap_cb *sel while ((skb = skb_dequeue(&self->txq)) != NULL) { ret = (*state[self->state])(self, SEND_I_CMD, skb, NULL); + kfree_skb(skb); if (ret == -EPROTO) break; /* Try again later! */ } @@ -351,12 +352,11 @@ static int irlap_state_ndm(struct irlap_ self->caddr = info->caddr; irlap_next_state(self, LAP_CONN); - + irlap_connect_indication(self, skb); } else { IRDA_DEBUG(0, __FUNCTION__ "(), SNRM frame does not " "contain an I field!\n"); - dev_kfree_skb(skb); } break; case DISCOVERY_REQUEST: @@ -410,14 +410,13 @@ static int irlap_state_ndm(struct irlap_ irlap_start_query_timer(self, QUERY_TIMEOUT*info->S); irlap_next_state(self, LAP_REPLY); } - dev_kfree_skb(skb); break; #ifdef CONFIG_IRDA_ULTRA case SEND_UI_FRAME: /* Only allowed to repeat an operation twice */ for (i=0; ((i<2) && (self->media_busy == FALSE)); i++) { skb = skb_dequeue(&self->txq_ultra); - if (skb)
[patch] patch-2.4.0-test10-irda11 (was: Re: The IrDA patches)[patch] patch-2.4.0-test10-irda11 (was: Re: The IrDA patches)
Linus, Here are the new IrDA patches for Linux-2.4.0-test10. Please apply them to your latest 2.4 code. If you decide to apply them, then I suggest you start with the first one (irda1.diff) and work your way to the last one (irda24.diff) since most of them are not commutative. The name of this patch is irda11.diff. (Many thanks to Jean Tourrilhes for splitting up the big patch) [FEATURE] : Add a new feature to the IrDA stack [CORRECT] : Fix to have the correct/expected behaviour [CRITICA] : Fix potential kernel crash [OUPS ] : Error that will be fixed in a later patch irda11.diff : - o [CRITICA] Correct use of random number generator o [CRITICA] Fixed parameter parsing bug o [CRITICA] Fix packet lenght test in SMC driver o [CORRECT] Fix module initialisation code [not sure about this one] o [FEATURE] Setting device name update IAS diff -urpN old-linux/drivers/net/irda/smc-ircc.c linux/drivers/net/irda/smc-ircc.c --- old-linux/drivers/net/irda/smc-ircc.c Wed Jul 5 10:56:13 2000 +++ linux/drivers/net/irda/smc-ircc.c Thu Nov 9 14:52:26 2000 @@ -814,7 +814,7 @@ static void ircc_dma_receive_complete(st else len -= 4; - if ((len < 2) && (len > 2050)) { + if ((len < 2) || (len > 2050)) { WARNING(__FUNCTION__ "(), bogus len=%d\n", len); return; } diff -urpN old-linux/net/irda/af_irda.c linux/net/irda/af_irda.c --- old-linux/net/irda/af_irda.cThu Nov 9 13:48:34 2000 +++ linux/net/irda/af_irda.cThu Nov 9 16:03:21 2000 @@ -2376,14 +2376,15 @@ static struct notifier_block irda_dev_no */ static int __init irda_proto_init(void) { + MESSAGE("IrDA (tm) Protocols for Linux-2.3 (Dag Brattli)\n"); + sock_register(&irda_family_ops); irda_packet_type.type = htons(ETH_P_IRDA); -dev_add_pack(&irda_packet_type); + dev_add_pack(&irda_packet_type); register_netdevice_notifier(&irda_dev_notifier); -irda_init(); return 0; } module_init(irda_proto_init); @@ -2394,18 +2395,13 @@ module_init(irda_proto_init); *Remove IrDA protocol layer * */ -#ifdef MODULE void irda_proto_cleanup(void) { irda_packet_type.type = htons(ETH_P_IRDA); -dev_remove_pack(&irda_packet_type); + dev_remove_pack(&irda_packet_type); -unregister_netdevice_notifier(&irda_dev_notifier); + unregister_netdevice_notifier(&irda_dev_notifier); sock_unregister(PF_IRDA); - irda_cleanup(); - -return; } module_exit(irda_proto_cleanup); -#endif /* MODULE */ diff -urpN old-linux/net/irda/irlap.c linux/net/irda/irlap.c --- old-linux/net/irda/irlap.c Thu Nov 9 14:51:15 2000 +++ linux/net/irda/irlap.c Thu Nov 9 14:52:26 2000 @@ -671,11 +671,16 @@ void irlap_reset_confirm(void) */ int irlap_generate_rand_time_slot(int S, int s) { + static int rand; int slot; ASSERT((S - s) > 0, return 0;); - slot = s + jiffies % (S-s); + rand += jiffies; + rand ^= (rand << 12); + rand ^= (rand >> 20); + + slot = s + rand % (S-s); ASSERT((slot >= s) || (slot < S), return 0;); diff -urpN old-linux/net/irda/irmod.c linux/net/irda/irmod.c --- old-linux/net/irda/irmod.c Thu Nov 9 14:47:22 2000 +++ linux/net/irda/irmod.c Thu Nov 9 16:05:08 2000 @@ -208,10 +208,11 @@ EXPORT_SYMBOL(irtty_unregister_dongle); EXPORT_SYMBOL(irtty_set_packet_mode); #endif -int __init irda_init(void) +static int __init irda_init(void) { - MESSAGE("IrDA (tm) Protocols for Linux-2.3 (Dag Brattli)\n"); - +#ifdef MODULE + irda_proto_init(NULL); /* Called by net/socket.c when non-modular */ +#endif irlmp_init(); irlap_init(); @@ -258,9 +259,10 @@ int __init irda_init(void) return 0; } -#ifdef MODULE -void irda_cleanup(void) +static void __exit irda_cleanup(void) { + irda_proto_cleanup(); + misc_deregister(&irda.dev); #ifdef CONFIG_SYSCTL @@ -281,7 +283,6 @@ void irda_cleanup(void) /* Remove middle layer */ irlmp_cleanup(); } -#endif /* MODULE */ /* * Function irda_unlock (lock) @@ -542,11 +543,10 @@ void irda_proc_modcount(struct inode *in #endif /* MODULE */ } -#ifdef MODULE MODULE_AUTHOR("Dag Brattli <[EMAIL PROTECTED]>"); MODULE_DESCRIPTION("The Linux IrDA Protocol Subsystem"); MODULE_PARM(irda_debug, "1l"); -module_exit(irda_proto_cleanup); -#endif /* MODULE */ +module_init(irda_init); +module_exit(irda_cleanup); diff -urpN old-linux/net/irda/irsysctl.c linux/net/irda/irsysctl.c --- old-linux/net/irda/irsysctl.c Mon Aug 30 10:26:28 1999 +++ linux/net/irda/irsysctl.c Thu Nov 9 14:52:26 2000 @@ -29,6
[patch] patch-2.4.0-test10-irda12 (Re: was: The IrDA patches)[patch] patch-2.4.0-test10-irda12 (Re: was: The IrDA patches)
Linus, Here are the new IrDA patches for Linux-2.4.0-test10. Please apply them to your latest 2.4 code. If you decide to apply them, then I suggest you start with the first one (irda1.diff) and work your way to the last one (irda24.diff) since most of them are not commutative. The name of this patch is irda12.diff. (Many thanks to Jean Tourrilhes for splitting up the big patch) [FEATURE] : Add a new feature to the IrDA stack [CORRECT] : Fix to have the correct/expected behaviour [CRITICA] : Fix potential kernel crash [OUPS ] : Error that will be fixed in a later patch irda12.diff : - o [CORRECT] Remove memset of net_device (preserve device name) o [CORRECT] Correct structure member init for compressors o [CORRECT] Non module init of toshoboe and litelink drivers o [CORRECT] Add CONFIG_PROC_FS where needed o [FEATURE] Add MODULE_PARM_DESC there and there diff -urpN old-linux/drivers/net/irda/irport.c linux/drivers/net/irda/irport.c --- old-linux/drivers/net/irda/irport.c Tue Mar 21 11:17:28 2000 +++ linux/drivers/net/irda/irport.c Thu Nov 9 16:09:38 2000 @@ -999,7 +999,9 @@ static struct net_device_stats *irport_n #ifdef MODULE MODULE_PARM(io, "1-4i"); +MODULE_PARM_DESC(io, "Base I/O adresses"); MODULE_PARM(irq, "1-4i"); +MODULE_PARM_DESC(irq, "IRQ lines"); MODULE_AUTHOR("Dag Brattli <[EMAIL PROTECTED]>"); MODULE_DESCRIPTION("Half duplex serial driver for IrDA SIR mode"); diff -urpN old-linux/drivers/net/irda/irtty.c linux/drivers/net/irda/irtty.c --- old-linux/drivers/net/irda/irtty.c Thu Nov 9 14:47:22 2000 +++ linux/drivers/net/irda/irtty.c Thu Nov 9 16:09:38 2000 @@ -234,14 +234,6 @@ static int irtty_open(struct tty_struct return -ENOMEM; } -#if LINUX_VERSION_CODE >= 0x020362 /* 2.3.99-pre7 */ - /* dev_alloc doesn't clear the struct (Yuck !!!) */ - memset(((__u8*)dev)+IFNAMSIZ,0,sizeof(struct net_device)-IFNAMSIZ); -#else - /* dev_alloc doesn't clear the struct */ - memset(((__u8*)dev)+sizeof(char*),0,sizeof(struct net_device)-sizeof(char*)); -#endif /* LINUX_VERSION_CODE >= 0x020362 */ - dev->priv = (void *) self; self->netdev = dev; @@ -1035,6 +1027,7 @@ MODULE_AUTHOR("Dag Brattli <[EMAIL PROTECTED] MODULE_DESCRIPTION("IrDA TTY device driver"); MODULE_PARM(qos_mtt_bits, "i"); +MODULE_PARM_DESC(qos_mtt_bits, "Minimum Turn Time"); /* * Function init_module (void) diff -urpN old-linux/drivers/net/irda/nsc-ircc.c linux/drivers/net/irda/nsc-ircc.c --- old-linux/drivers/net/irda/nsc-ircc.c Mon Oct 16 12:58:51 2000 +++ linux/drivers/net/irda/nsc-ircc.c Thu Nov 9 16:09:38 2000 @@ -2029,10 +2029,15 @@ MODULE_AUTHOR("Dag Brattli <[EMAIL PROTECTED] MODULE_DESCRIPTION("NSC IrDA Device Driver"); MODULE_PARM(qos_mtt_bits, "i"); +MODULE_PARM_DESC(qos_mtt_bits, "Minimum Turn Time"); MODULE_PARM(io, "1-4i"); +MODULE_PARM_DESC(io, "Base I/O addresses"); MODULE_PARM(irq, "1-4i"); +MODULE_PARM_DESC(irq, "IRQ lines"); MODULE_PARM(dma, "1-4i"); +MODULE_PARM_DESC(dma, "DMA channels"); MODULE_PARM(dongle_id, "i"); +MODULE_PARM_DESC(dongle_id, "Type-id of used dongle"); int init_module(void) { diff -urpN old-linux/drivers/net/irda/smc-ircc.c linux/drivers/net/irda/smc-ircc.c --- old-linux/drivers/net/irda/smc-ircc.c Thu Nov 9 16:08:25 2000 +++ linux/drivers/net/irda/smc-ircc.c Thu Nov 9 16:09:38 2000 @@ -1039,7 +1039,9 @@ static int ircc_pmproc(struct pm_dev *de MODULE_AUTHOR("Thomas Davis <[EMAIL PROTECTED]>"); MODULE_DESCRIPTION("SMC IrCC controller driver"); MODULE_PARM(ircc_dma, "1i"); +MODULE_PARM_DESC(ircc_dma, "DMA channel"); MODULE_PARM(ircc_irq, "1i"); +MODULE_PARM_DESC(ircc_irq, "IRQ line"); int init_module(void) { diff -urpN old-linux/drivers/net/irda/toshoboe.c linux/drivers/net/irda/toshoboe.c --- old-linux/drivers/net/irda/toshoboe.c Sun Sep 17 09:45:07 2000 +++ linux/drivers/net/irda/toshoboe.c Thu Nov 9 16:09:38 2000 @@ -628,7 +628,10 @@ static int toshoboe_net_ioctl(struct net #ifdef MODULE +MODULE_DESCRIPTION("Toshiba OBOE IrDA Device Driver"); +MODULE_AUTHOR("James McKenzie <[EMAIL PROTECTED]>"); MODULE_PARM (max_baud, "i"); +MODULE_PARM_DESC(max_baus, "Maximum baud rate"); static int toshoboe_close (struct toshoboe_cb *self) diff -urpN old-linux/drivers/net/irda/w83977af_ir.c linux/drivers/net/irda/w83977af_ir.c --- old-linux/drivers/net/irda/w83977af_ir.cTue Mar 21 11:17:28 2000 +++ linux/drivers/net/irda/w83977af_ir.cThu Nov 9 16:09:38 2000 @@ -1366,9 +1366,11 @@ MODULE_AUTHOR("Dag Brattli <[EMAIL PROTEC
[patch] patch-2.4.0-test10-irda13 (was: Re: The IrDA patches)[patch] patch-2.4.0-test10-irda13 (was: Re: The IrDA patches)
Linus, Here are the new IrDA patches for Linux-2.4.0-test10. Please apply them to your latest 2.4 code. If you decide to apply them, then I suggest you start with the first one (irda1.diff) and work your way to the last one (irda24.diff) since most of them are not commutative. The name of this patch is irda13.diff. (Many thanks to Jean Tourrilhes for splitting up the big patch) [FEATURE] : Add a new feature to the IrDA stack [CORRECT] : Fix to have the correct/expected behaviour [CRITICA] : Fix potential kernel crash [OUPS ] : Error that will be fixed in a later patch irda13.diff : - o [CORRECT] More CONFIG_PROC_FS where needed o [CORRECT] Wait if receiving while discovery slot expired o [FEATURE] Cleanups diff -urpN old-linux/include/net/irda/irlan_common.h linux/include/net/irda/irlan_common.h --- old-linux/include/net/irda/irlan_common.h Thu Nov 9 14:47:22 2000 +++ linux/include/net/irda/irlan_common.h Thu Nov 9 17:09:43 2000 @@ -167,22 +167,20 @@ struct irlan_cb { struct net_device dev;/* Ethernet device structure*/ struct net_device_stats stats; - __u32 saddr; /* Source device address */ - __u32 daddr; /* Destination device address */ - int netdev_registered; - int notify_irmanager; + __u32 saddr; /* Source device address */ + __u32 daddr; /* Destination device address */ + int disconnect_reason; /* Why we got disconnected */ - int media;/* Media type */ - __u8 version[2]; /* IrLAN version */ + int media; /* Media type */ + __u8 version[2]; /* IrLAN version */ - struct tsap_cb *tsap_data; + struct tsap_cb *tsap_data; /* Data TSAP */ - int master; /* Master instance? */ - int use_udata; /* Use Unit Data transfers */ + int use_udata;/* Use Unit Data transfers */ - __u8 stsap_sel_data; /* Source data TSAP selector */ - __u8 dtsap_sel_data; /* Destination data TSAP selector */ - __u8 dtsap_sel_ctrl; /* Destination ctrl TSAP selector */ + __u8 stsap_sel_data; /* Source data TSAP selector */ + __u8 dtsap_sel_data; /* Destination data TSAP selector */ + __u8 dtsap_sel_ctrl; /* Destination ctrl TSAP selector */ struct irlan_client_cb client; /* Client specific fields */ struct irlan_provider_cb provider; /* Provider specific fields */ @@ -190,10 +188,11 @@ struct irlan_cb { __u32 max_sdu_size; __u8 max_header_size; + wait_queue_head_t open_wait; struct timer_list watchdog_timer; }; -struct irlan_cb *irlan_open(__u32 saddr, __u32 daddr, int netdev); +struct irlan_cb *irlan_open(__u32 saddr, __u32 daddr); void irlan_close(struct irlan_cb *self); void irlan_close_tsaps(struct irlan_cb *self); void irlan_mod_inc_use_count(void); diff -urpN old-linux/drivers/net/irda/w83977af_ir.c linux/drivers/net/irda/w83977af_ir.c --- old-linux/drivers/net/irda/w83977af_ir.cThu Nov 9 17:09:30 2000 +++ linux/drivers/net/irda/w83977af_ir.cThu Nov 9 17:09:43 2000 @@ -255,13 +255,12 @@ int w83977af_open(int i, unsigned int io dev->get_stats = w83977af_net_get_stats; rtnl_lock(); - err = register_netdev(dev); + err = register_netdevice(dev); rtnl_unlock(); if (err) { - ERROR(__FUNCTION__ "(), register_netdev() failed!\n"); + ERROR(__FUNCTION__ "(), register_netdevice() failed!\n"); return -1; } - MESSAGE("IrDA: Registered device %s\n", dev->name); return 0; diff -urpN old-linux/net/irda/af_irda.c linux/net/irda/af_irda.c --- old-linux/net/irda/af_irda.cThu Nov 9 16:08:25 2000 +++ linux/net/irda/af_irda.cThu Nov 9 17:09:43 2000 @@ -2376,7 +2376,7 @@ static struct notifier_block irda_dev_no */ static int __init irda_proto_init(void) { - MESSAGE("IrDA (tm) Protocols for Linux-2.3 (Dag Brattli)\n"); + MESSAGE("IrDA (tm) Protocols for Linux-2.4 (Dag Brattli)\n"); sock_register(&irda_family_ops); @@ -2403,5 +2403,6 @@ void irda_proto_cleanup(void) unregister_netdevice_notifier(&irda_dev_notifier); sock_unregister(PF_IRDA); + } module_exit(irda_proto_cleanup); diff -urpN old-linux/net/irda/ircomm/ircomm_tty.c linux/net/irda/ircomm/ircomm_tty.c --- old-linux/net/irda/ircomm/ircomm_tty.c Thu Nov 9 17:09:30 2000 +++ linux/net/irda/ircomm/ircomm_tty.c Thu Nov 9 17:09:43 2000 @@ -69,9 +69,10 @@ static int ircomm_tty_control_indication struct sk_buff *skb); static void ircomm_tty_flow_indication(void *instance, void *sap,
[patch] patch-2.4.0-test10-irda14 (was: Re: The IrDA patches)[patch] patch-2.4.0-test10-irda14 (was: Re: The IrDA patches)
Linus, Here are the new IrDA patches for Linux-2.4.0-test10. Please apply them to your latest 2.4 code. If you decide to apply them, then I suggest you start with the first one (irda1.diff) and work your way to the last one (irda24.diff) since most of them are not commutative. The name of this patch is irda14.diff. (Many thanks to Jean Tourrilhes for splitting up the big patch) [FEATURE] : Add a new feature to the IrDA stack [CORRECT] : Fix to have the correct/expected behaviour [CRITICA] : Fix potential kernel crash [OUPS ] : Error that will be fixed in a later patch irda14.diff : - o [CRITICA] Allow immediate driver speed change from within IrDA stack diff -urpN linux-2.4.0-test10-linus/net/irda/irlap.c linux-2.4.0-test10-irda/net/irda/irlap.c --- linux-2.4.0-test10-linus/net/irda/irlap.c Sat Nov 11 19:49:03 2000 +++ linux-2.4.0-test10-irda/net/irda/irlap.cFri Nov 10 00:07:48 2000 @@ -876,6 +876,8 @@ void irlap_flush_all_queues(struct irlap */ void irlap_change_speed(struct irlap_cb *self, __u32 speed, int now) { + struct sk_buff *skb; + IRDA_DEBUG(0, __FUNCTION__ "(), setting speed to %d\n", speed); ASSERT(self != NULL, return;); @@ -884,8 +886,11 @@ void irlap_change_speed(struct irlap_cb self->speed = speed; /* Change speed now, or just piggyback speed on frames */ - if (now) - irda_device_change_speed(self->netdev, speed); + if (now) { + /* Send down empty frame to trigger speed change */ + skb = dev_alloc_skb(0); + irlap_queue_xmit(self, skb); + } } #ifdef CONFIG_IRDA_COMPRESSION diff -urpN linux-2.4.0-test10-linus/drivers/net/irda/irport.c linux-2.4.0-test10-irda/drivers/net/irda/irport.c --- linux-2.4.0-test10-linus/drivers/net/irda/irport.c Sat Nov 11 19:47:43 2000 +++ linux-2.4.0-test10-irda/drivers/net/irda/irport.c Sat Nov 11 20:06:31 2000 @@ -629,8 +629,16 @@ int irport_hard_xmit(struct sk_buff *skb netif_stop_queue(dev); /* Check if we need to change the speed */ - if ((speed = irda_get_speed(skb)) != self->io.speed) - self->new_speed = speed; + if ((speed = irda_get_speed(skb)) != self->io.speed) { + /* Check for empty frame */ + if (!skb->len) { + irda_task_execute(self, __irport_change_speed, + irport_change_speed_complete, + NULL, (void *) speed); + return 0; + } else + self->new_speed = speed; + } spin_lock_irqsave(&self->lock, flags); diff -urpN linux-2.4.0-test10-linus/drivers/net/irda/irtty.c linux-2.4.0-test10-irda/drivers/net/irda/irtty.c --- linux-2.4.0-test10-linus/drivers/net/irda/irtty.c Sat Nov 11 19:47:43 2000 +++ linux-2.4.0-test10-irda/drivers/net/irda/irtty.cSat Nov 11 20:06:25 2000 @@ -638,8 +638,16 @@ static int irtty_hard_xmit(struct sk_buf netif_stop_queue(dev); /* Check if we need to change the speed */ - if ((speed = irda_get_speed(skb)) != self->io.speed) - self->new_speed = speed; + if ((speed = irda_get_speed(skb)) != self->io.speed) { + /* Check for empty frame */ + if (!skb->len) { + irda_task_execute(self, irtty_change_speed, + irtty_change_speed_complete, + NULL, (void *) speed); + return 0; + } else + self->new_speed = speed; + } /* Init tx buffer*/ self->tx_buff.data = self->tx_buff.head; diff -urpN linux-2.4.0-test10-linus/drivers/net/irda/nsc-ircc.c linux-2.4.0-test10-irda/drivers/net/irda/nsc-ircc.c --- linux-2.4.0-test10-linus/drivers/net/irda/nsc-ircc.cSat Nov 11 19:47:43 2000 +++ linux-2.4.0-test10-irda/drivers/net/irda/nsc-ircc.c Sat Nov 11 20:02:20 2000 @@ -1076,9 +1075,15 @@ static int nsc_ircc_hard_xmit_sir(struct netif_stop_queue(dev); /* Check if we need to change the speed */ - if ((speed = irda_get_speed(skb)) != self->io.speed) - self->new_speed = speed; - + if ((speed = irda_get_speed(skb)) != self->io.speed) { + /* Check for empty frame */ + if (!skb->len) { + nsc_ircc_change_speed(self, speed); + return 0; + } else + self->new_speed = speed; + } + spin_lock_irqsave(&self->lock, flags); /* Save current bank */ @@ -1120,8 +1125,14 @@ static int nsc_ircc_hard_xmit_fir(struct netif_stop_queue(dev); /* Check if we need to change the speed */ - if ((speed = irda_get_speed(skb)) != self->io.speed) - se
[patch] patch-2.4.0-test10-irda15 (was: Re: The IrDA patches)[patch] patch-2.4.0-test10-irda15 (was: Re: The IrDA patches)
Linus, Here are the new IrDA patches for Linux-2.4.0-test10. Please apply them to your latest 2.4 code. If you decide to apply them, then I suggest you start with the first one (irda1.diff) and work your way to the last one (irda24.diff) since most of them are not commutative. The name of this patch is irda15.diff. (Many thanks to Jean Tourrilhes for splitting up the big patch) [FEATURE] : Add a new feature to the IrDA stack [CORRECT] : Fix to have the correct/expected behaviour [CRITICA] : Fix potential kernel crash [OUPS ] : Error that will be fixed in a later patch irda15.diff : - o [-OUPS ] Missing a bit for -> module init change o [CRITICA] IrLAN update (was broken - various things) diff -urpN old-linux/net/irda/af_irda.c linux/net/irda/af_irda.c --- old-linux/net/irda/af_irda.cThu Nov 9 17:11:25 2000 +++ linux/net/irda/af_irda.cThu Nov 9 17:26:46 2000 @@ -2395,7 +2395,7 @@ module_init(irda_proto_init); *Remove IrDA protocol layer * */ -void irda_proto_cleanup(void) +void __exit irda_proto_cleanup(void) { irda_packet_type.type = htons(ETH_P_IRDA); dev_remove_pack(&irda_packet_type); @@ -2403,6 +2403,5 @@ void irda_proto_cleanup(void) unregister_netdevice_notifier(&irda_dev_notifier); sock_unregister(PF_IRDA); - } module_exit(irda_proto_cleanup); diff -urpN old-linux/net/irda/irlan/irlan_client.c linux/net/irda/irlan/irlan_client.c --- old-linux/net/irda/irlan/irlan_client.c Thu Nov 9 13:27:10 2000 +++ linux/net/irda/irlan/irlan_client.c Thu Nov 9 17:20:01 2000 @@ -104,8 +104,6 @@ void irlan_client_start_kick_timer(struc */ void irlan_client_wakeup(struct irlan_cb *self, __u32 saddr, __u32 daddr) { - struct irmanager_event mgr_event; - IRDA_DEBUG(1, __FUNCTION__ "()\n"); ASSERT(self != NULL, return;); @@ -117,41 +115,24 @@ void irlan_client_wakeup(struct irlan_cb */ if ((self->client.state != IRLAN_IDLE) || (self->provider.access_type == ACCESS_DIRECT)) - return; + { + IRDA_DEBUG(0, __FUNCTION__ "(), already awake!\n"); + return; + } - /* saddr may have changed! */ + /* Address may have changed! */ self->saddr = saddr; - - /* Before we try to connect, we check if network device is up. If it -* is up, that means that the "user" really wants to connect. If not -* we notify the user about the possibility of an IrLAN connection -*/ - if (netif_running(&self->dev)) { - /* Open TSAPs */ - irlan_client_open_ctrl_tsap(self); - irlan_open_data_tsap(self); - - irlan_do_client_event(self, IRLAN_DISCOVERY_INDICATION, NULL); - } else if (self->notify_irmanager) { - /* -* Tell irmanager that the device can now be -* configured but only if the device was not taken -* down by the user -*/ - mgr_event.event = EVENT_IRLAN_START; - strcpy(mgr_event.devname, self->dev.name); - irmanager_notify(&mgr_event); - - /* -* We set this so that we only notify once, since if -* configuration of the network device fails, the user -* will have to sort it out first anyway. No need to -* try again. -*/ - self->notify_irmanager = FALSE; + + if (self->disconnect_reason == LM_USER_REQUEST) { + IRDA_DEBUG(0, __FUNCTION__ "(), still stopped by user\n"); + return; } - /* Restart watchdog timer */ - irlan_start_watchdog_timer(self, IRLAN_TIMEOUT); + + /* Open TSAPs */ + irlan_client_open_ctrl_tsap(self); + irlan_open_data_tsap(self); + + irlan_do_client_event(self, IRLAN_DISCOVERY_INDICATION, NULL); /* Start kick timer */ irlan_client_start_kick_timer(self, 2*HZ); @@ -176,29 +157,16 @@ void irlan_client_discovery_indication(d saddr = discovery->saddr; daddr = discovery->daddr; - /* -* Check if we already dealing with this provider. -*/ - self = (struct irlan_cb *) hashbin_find(irlan, daddr, NULL); - if (self) { + /* Find instance */ + self = (struct irlan_cb *) hashbin_get_first(irlan); +if (self) { ASSERT(self->magic == IRLAN_MAGIC, return;); IRDA_DEBUG(1, __FUNCTION__ "(), Found instance (%08x)!\n", daddr); irlan_client_wakeup(self, saddr, daddr); - - return; } - - /* -* We have no instance for daddr, so start a new one -*/ - IRDA_DEBUG(1, __FUNCTION__ "(), starting new instance!
[patch] patch-2.4.0-test10-irda16 (was: Re: The IrDA patches)[patch] patch-2.4.0-test10-irda16 (was: Re: The IrDA patches)
Linus, Here are the new IrDA patches for Linux-2.4.0-test10. Please apply them to your latest 2.4 code. If you decide to apply them, then I suggest you start with the first one (irda1.diff) and work your way to the last one (irda24.diff) since most of them are not commutative. The name of this patch is irda16.diff. (Many thanks to Jean Tourrilhes for splitting up the big patch) [FEATURE] : Add a new feature to the IrDA stack [CORRECT] : Fix to have the correct/expected behaviour [CRITICA] : Fix potential kernel crash [OUPS ] : Error that will be fixed in a later patch irda16.diff : - o [CRITICA] Add hashbin_remove_first for safe linked list removal o [CRITICA] Modify discovery to handle safely duplicate nodes o [CRITICA] Fix infinite loop in discovery_proc_read o [CORRECT] Handle interleaved discovery frames (not complete) o [FEATURE] Add discovery expiry callback o [FEATURE] Remove cruft in af_irda diff -urpN old-linux/include/net/irda/irlmp.h linux/include/net/irda/irlmp.h --- old-linux/include/net/irda/irlmp.h Thu Nov 9 14:47:22 2000 +++ linux/include/net/irda/irlmp.h Thu Nov 9 17:33:48 2000 @@ -85,8 +85,9 @@ typedef struct { __u16 hint_mask; - DISCOVERY_CALLBACK1 callback1; - DISCOVERY_CALLBACK2 callback2; + DISCOVERY_CALLBACK1 callback1; /* Selective discovery */ + DISCOVERY_CALLBACK2 callback2; /* Whole discovery */ + DISCOVERY_CALLBACK1 callback3; /* Selective expiration */ void *priv;/* Used to identify client */ } irlmp_client_t; @@ -193,10 +194,13 @@ __u16 irlmp_service_to_hint(int service) __u32 irlmp_register_service(__u16 hints); int irlmp_unregister_service(__u32 handle); __u32 irlmp_register_client(__u16 hint_mask, DISCOVERY_CALLBACK1 callback1, - DISCOVERY_CALLBACK2 callback2, void *priv); + DISCOVERY_CALLBACK2 callback2, + DISCOVERY_CALLBACK1 callback3, void *priv); int irlmp_unregister_client(__u32 handle); int irlmp_update_client(__u32 handle, __u16 hint_mask, - DISCOVERY_CALLBACK1, DISCOVERY_CALLBACK2, void *priv); + DISCOVERY_CALLBACK1 callback1, + DISCOVERY_CALLBACK2 callback2, + DISCOVERY_CALLBACK1 callback3, void *priv); void irlmp_register_link(struct irlap_cb *, __u32 saddr, notify_t *); void irlmp_unregister_link(__u32 saddr); @@ -218,6 +222,7 @@ void irlmp_discovery_request(int nslots) struct irda_device_info *irlmp_get_discoveries(int *pn, __u16 mask); void irlmp_do_discovery(int nslots); discovery_t *irlmp_get_discovery_response(void); +void irlmp_discovery_expiry(discovery_t *expiry); int irlmp_data_request(struct lsap_cb *, struct sk_buff *); void irlmp_data_indication(struct lsap_cb *, struct sk_buff *); diff -urpN old-linux/include/net/irda/irqueue.h linux/include/net/irda/irqueue.h --- old-linux/include/net/irda/irqueue.hThu Nov 9 14:47:22 2000 +++ linux/include/net/irda/irqueue.hThu Nov 9 17:33:48 2000 @@ -89,6 +89,7 @@ void hashbin_insert(hashbin_t* hashb void*hashbin_find(hashbin_t* hashbin, __u32 hashv, char* name); void*hashbin_remove(hashbin_t* hashbin, __u32 hashv, char* name); void*hashbin_remove_first(hashbin_t *hashbin); +void* hashbin_remove_this( hashbin_t* hashbin, irda_queue_t* entry); irda_queue_t *hashbin_get_first(hashbin_t *hashbin); irda_queue_t *hashbin_get_next(hashbin_t *hashbin); diff -urpN old-linux/net/irda/af_irda.c linux/net/irda/af_irda.c --- old-linux/net/irda/af_irda.cThu Nov 9 17:32:39 2000 +++ linux/net/irda/af_irda.cThu Nov 9 17:33:48 2000 @@ -366,33 +366,6 @@ static void irda_getvalue_confirm(int re wake_up_interruptible(&self->query_wait); } -#if 0 -/* Obsolete */ -/* - * Function irda_discovery_indication (log) - * - *Got a discovery log from IrLMP, wake up any process waiting for answer - * - */ -static void irda_discovery_indication(hashbin_t *log, void *priv) -{ - struct irda_sock *self; - - IRDA_DEBUG(2, __FUNCTION__ "()\n"); - - self = (struct irda_sock *) priv; - if (!self) { - WARNING(__FUNCTION__ "(), lost myself!\n"); - return; - } - - self->cachelog = log; - - /* Wake up process if its waiting for device to be discovered */ - wake_up_interruptible(&self->query_wait); -} -#endif - /* * Function irda_selective_discovery_indication (discovery) * @@ -1123,7 +1096,7 @@ static int irda_create(struct socket *so sk->protocol = protocol; /* Register as a client with IrLMP */ - self->ckey = irlmp_register_client(0, NULL, NULL, NULL); + self->ckey = irlmp_register_client(0, NULL, NULL, NULL, NULL); self->mask = 0x; self->rx_flow = self->tx_flow = FLOW_START; self->nslot
[patch] patch-2.4.0-test10-irda17 (was: Re: The IrDA patches)[patch] patch-2.4.0-test10-irda17 (was: Re: The IrDA patches)
Linus, Here are the new IrDA patches for Linux-2.4.0-test10. Please apply them to your latest 2.4 code. If you decide to apply them, then I suggest you start with the first one (irda1.diff) and work your way to the last one (irda24.diff) since most of them are not commutative. The name of this patch is irda17.diff. (Many thanks to Jean Tourrilhes for splitting up the big patch) [FEATURE] : Add a new feature to the IrDA stack [CORRECT] : Fix to have the correct/expected behaviour [CRITICA] : Fix potential kernel crash [OUPS ] : Error that will be fixed in a later patch irda17.diff : - o [FEATURE] Removed unused discovery callback o [FEATURE] Give discovery and expery callback meaningful names diff -urpN old-linux/include/net/irda/irlmp.h linux/include/net/irda/irlmp.h --- old-linux/include/net/irda/irlmp.h Thu Nov 9 17:39:46 2000 +++ linux/include/net/irda/irlmp.h Thu Nov 9 17:40:01 2000 @@ -85,9 +85,8 @@ typedef struct { __u16 hint_mask; - DISCOVERY_CALLBACK1 callback1; /* Selective discovery */ - DISCOVERY_CALLBACK2 callback2; /* Whole discovery */ - DISCOVERY_CALLBACK1 callback3; /* Selective expiration */ + DISCOVERY_CALLBACK1 disco_callback; /* Selective discovery */ + DISCOVERY_CALLBACK1 expir_callback; /* Selective expiration */ void *priv;/* Used to identify client */ } irlmp_client_t; @@ -193,14 +192,12 @@ void irlmp_close_lsap( struct lsap_cb *s __u16 irlmp_service_to_hint(int service); __u32 irlmp_register_service(__u16 hints); int irlmp_unregister_service(__u32 handle); -__u32 irlmp_register_client(__u16 hint_mask, DISCOVERY_CALLBACK1 callback1, - DISCOVERY_CALLBACK2 callback2, - DISCOVERY_CALLBACK1 callback3, void *priv); +__u32 irlmp_register_client(__u16 hint_mask, DISCOVERY_CALLBACK1 disco_clb, + DISCOVERY_CALLBACK1 expir_clb, void *priv); int irlmp_unregister_client(__u32 handle); int irlmp_update_client(__u32 handle, __u16 hint_mask, - DISCOVERY_CALLBACK1 callback1, - DISCOVERY_CALLBACK2 callback2, - DISCOVERY_CALLBACK1 callback3, void *priv); + DISCOVERY_CALLBACK1 disco_clb, + DISCOVERY_CALLBACK1 expir_clb, void *priv); void irlmp_register_link(struct irlap_cb *, __u32 saddr, notify_t *); void irlmp_unregister_link(__u32 saddr); diff -urpN old-linux/net/irda/af_irda.c linux/net/irda/af_irda.c --- old-linux/net/irda/af_irda.cThu Nov 9 17:39:46 2000 +++ linux/net/irda/af_irda.cThu Nov 9 17:40:01 2000 @@ -1096,7 +1096,7 @@ static int irda_create(struct socket *so sk->protocol = protocol; /* Register as a client with IrLMP */ - self->ckey = irlmp_register_client(0, NULL, NULL, NULL, NULL); + self->ckey = irlmp_register_client(0, NULL, NULL, NULL); self->mask = 0x; self->rx_flow = self->tx_flow = FLOW_START; self->nslots = DISCOVERY_DEFAULT_SLOTS; @@ -2147,7 +2147,7 @@ static int irda_getsockopt(struct socket /* Tell IrLMP we want to be notified */ irlmp_update_client(self->ckey, self->mask, - irda_selective_discovery_indication, NULL, + irda_selective_discovery_indication, NULL, (void *) self); /* Do some discovery (and also return cached results) */ @@ -2179,8 +2179,7 @@ static int irda_getsockopt(struct socket "(), found immediately !\n"); /* Tell IrLMP that we have been notified */ - irlmp_update_client(self->ckey, self->mask, NULL, NULL, - NULL, NULL); + irlmp_update_client(self->ckey, self->mask, NULL, NULL, NULL); /* Check if the we got some results */ if (!self->cachediscovery) diff -urpN old-linux/net/irda/ircomm/ircomm_tty_attach.c linux/net/irda/ircomm/ircomm_tty_attach.c --- old-linux/net/irda/ircomm/ircomm_tty_attach.c Thu Nov 9 17:39:46 2000 +++ linux/net/irda/ircomm/ircomm_tty_attach.c Thu Nov 9 17:39:55 2000 @@ -236,8 +236,7 @@ static void ircomm_tty_ias_register(stru } self->skey = irlmp_register_service(hints); self->ckey = irlmp_register_client( - hints, ircomm_tty_discovery_indication, NULL, NULL, - (void *) self); + hints, ircomm_tty_discovery_indication, NULL, (void *) self); } /* diff -urpN old-linux/net/irda/irlan/irlan_common.c linux/net/irda/irlan/irlan_common.c --- old-linux/net/irda/irlan/irlan_common.c Thu Nov 9 17:39:46 2000 +++ linux/net/irda/irlan/irlan_common.c Thu Nov 9 17:39:55 2000 @@ -137,7 +137,7 @@ int __init irlan_init(void) /*
[patch] patch-2.4.0-test10-irda18 (was: Re: The IrDA patches)[patch] patch-2.4.0-test10-irda18 (was: Re: The IrDA patches)
Linus, Here are the new IrDA patches for Linux-2.4.0-test10. Please apply them to your latest 2.4 code. If you decide to apply them, then I suggest you start with the first one (irda1.diff) and work your way to the last one (irda24.diff) since most of them are not commutative. The name of this patch is irda18.diff. (Many thanks to Jean Tourrilhes for splitting up the big patch) [FEATURE] : Add a new feature to the IrDA stack [CORRECT] : Fix to have the correct/expected behaviour [CRITICA] : Fix potential kernel crash [OUPS ] : Error that will be fixed in a later patch irda18.diff : - o [CRITICA] Prevent out of bound access in QoS arrays o [CORRECT] Properly disable link broken warning when disc time = 3s o [FEATURE] Propagate link status indication to higher layers o [FEATURE] Allow to set max IrDA speed in sysctl o [FEATURE] Allow to set max IrDA inactive time in sysctl diff -urpN old-linux/include/net/irda/irda.h linux/include/net/irda/irda.h --- old-linux/include/net/irda/irda.h Thu Nov 9 13:27:10 2000 +++ linux/include/net/irda/irda.h Thu Nov 9 17:45:53 2000 @@ -242,6 +242,8 @@ typedef struct { void (*disconnect_indication)(void *instance, void *sap, LM_REASON reason, struct sk_buff *); void (*flow_indication)(void *instance, void *sap, LOCAL_FLOW flow); + void (*status_indication)(void *instance, + LINK_STATUS link, LOCK_STATUS lock); void *instance; /* Layer instance pointer */ char name[16]; /* Name of layer */ } notify_t; diff -urpN old-linux/include/net/irda/irlap.h linux/include/net/irda/irlap.h --- old-linux/include/net/irda/irlap.h Thu Nov 9 14:47:22 2000 +++ linux/include/net/irda/irlap.h Thu Nov 9 17:45:53 2000 @@ -214,7 +214,7 @@ void irlap_unitdata_indication(struct ir void irlap_disconnect_request(struct irlap_cb *); void irlap_disconnect_indication(struct irlap_cb *, LAP_REASON reason); -void irlap_status_indication(int quality_of_link); +void irlap_status_indication(struct irlap_cb *, int quality_of_link); void irlap_test_request(__u8 *info, int len); diff -urpN old-linux/include/net/irda/irlmp.h linux/include/net/irda/irlmp.h --- old-linux/include/net/irda/irlmp.h Thu Nov 9 17:41:49 2000 +++ linux/include/net/irda/irlmp.h Thu Nov 9 17:45:53 2000 @@ -233,7 +233,7 @@ void irlmp_connless_data_indication(stru #endif /* CONFIG_IRDA_ULTRA */ void irlmp_status_request(void); -void irlmp_status_indication(LINK_STATUS link, LOCK_STATUS lock); +void irlmp_status_indication(struct lap_cb *, LINK_STATUS link, LOCK_STATUS lock); int irlmp_slsap_inuse(__u8 slsap); __u8 irlmp_find_free_slsap(void); diff -urpN old-linux/include/net/irda/irttp.h linux/include/net/irda/irttp.h --- old-linux/include/net/irda/irttp.h Thu Nov 9 14:47:22 2000 +++ linux/include/net/irda/irttp.h Thu Nov 9 17:45:53 2000 @@ -129,6 +129,8 @@ int irttp_connect_response(struct tsap_c int irttp_disconnect_request(struct tsap_cb *self, struct sk_buff *skb, int priority); void irttp_flow_request(struct tsap_cb *self, LOCAL_FLOW flow); +void irttp_status_indication(void *instance, +LINK_STATUS link, LOCK_STATUS lock); struct tsap_cb *irttp_dup(struct tsap_cb *self, void *instance); static __inline __u32 irttp_get_saddr(struct tsap_cb *self) diff -urpN old-linux/include/net/irda/qos.h linux/include/net/irda/qos.h --- old-linux/include/net/irda/qos.hTue Oct 31 11:18:17 2000 +++ linux/include/net/irda/qos.hThu Nov 9 17:45:53 2000 @@ -86,6 +86,9 @@ struct qos_info { #endif }; +extern int sysctl_max_baud_rate; +extern int sysctl_max_inactive_time; + extern __u32 baud_rates[]; extern __u32 data_sizes[]; extern __u32 min_turn_times[]; @@ -100,10 +103,6 @@ __u32 irlap_requested_line_capacity(stru __u32 irlap_min_turn_time_in_bytes(__u32 speed, __u32 min_turn_time); int msb_index(__u16 byte); -int value_index(__u32 value, __u32 *array); -__u32 byte_value(__u8 byte, __u32 *array); -__u32 index_value(int index, __u32 *array); - void irda_qos_bits_to_value(struct qos_info *qos); #endif diff -urpN old-linux/net/irda/irlap.c linux/net/irda/irlap.c --- old-linux/net/irda/irlap.c Thu Nov 9 16:08:25 2000 +++ linux/net/irda/irlap.c Thu Nov 9 17:45:53 2000 @@ -617,7 +617,7 @@ void irlap_discovery_indication(struct i * * */ -void irlap_status_indication(int quality_of_link) +void irlap_status_indication(struct irlap_cb *self, int quality_of_link) { switch (quality_of_link) { case STATUS_NO_ACTIVITY: @@ -629,7 +629,8 @@ void irlap_status_indication(int quality default: break; } - irlmp_status_indication(quality_of_link, LOCK_NO_CHANGE); + irlmp_status_indication(self->notify.instance, + quality_of_link, LOCK_NO_CHANGE); } /* @@
[patch] patch-2.4.0-test10-irda19 (was: Re: The IrDA patches)[patch] patch-2.4.0-test10-irda19 (was: Re: The IrDA patches)
Linus, Here are the new IrDA patches for Linux-2.4.0-test10. Please apply them to your latest 2.4 code. If you decide to apply them, then I suggest you start with the first one (irda1.diff) and work your way to the last one (irda24.diff) since most of them are not commutative. The name of this patch is irda19.diff. (Many thanks to Jean Tourrilhes for splitting up the big patch) [FEATURE] : Add a new feature to the IrDA stack [CORRECT] : Fix to have the correct/expected behaviour [CRITICA] : Fix potential kernel crash [OUPS ] : Error that will be fixed in a later patch irda19.diff : - o [CORRECT] Correctly handle interleaved discovery frames diff -urpN old-linux/net/irda/irlap_event.c linux/net/irda/irlap_event.c --- old-linux/net/irda/irlap_event.cThu Nov 9 17:52:56 2000 +++ linux/net/irda/irlap_event.cThu Nov 9 17:53:16 2000 @@ -407,6 +407,27 @@ static int irlap_state_ndm(struct irlap_ irlap_start_query_timer(self, QUERY_TIMEOUT*info->S); irlap_next_state(self, LAP_REPLY); } + else { + /* This is the final slot. How is it possible ? +* This would happen is both discoveries are just slightly +* offset (if they are in sync, all packets are lost). +* Most often, all the discovery requests will be received +* in QUERY state (see my comment there), except for the +* last frame that will come here. +* The big trouble when it happen is that active discovery +* doesn't happen, because nobody answer the discoveries +* frame of the other guy, so the log shows up empty. +* What should we do ? +* Not much. It's too late to answer those discovery frames, +* so we just pass the info to IrLMP who will put it in the +* log (and post an event). +* Jean II +*/ + IRDA_DEBUG(1, __FUNCTION__ "(), Receiving final discovery +request, missed the discovery slots :-(\n"); + + /* Last discovery request -> in the log */ + irlap_discovery_indication(self, info->discovery); + } break; #ifdef CONFIG_IRDA_ULTRA case SEND_UI_FRAME: @@ -494,11 +515,8 @@ static int irlap_state_query(struct irla break; case RECV_DISCOVERY_XID_CMD: /* Yes, it is possible to receive those frames in this mode. -* This would happen is both discoveries are just slightly -* offset (if they are in sync, all packets are lost). -* The big trouble when it happen is that passive discovery -* doesn't happen, because nobody answer the discoveries -* frame of the other guy, so the log shows up empty. +* Note that most often the last discovery request won't +* occur here but in NDM state (see my comment there). * What should we do ? * Not much. We are currently performing our own discovery, * therefore we can't answer those frames. We don't want @@ -509,10 +527,9 @@ static int irlap_state_query(struct irla ASSERT(info != NULL, return -1;); - IRDA_DEBUG(1, __FUNCTION__ "(), Receiving event %d, %s\n", - event, irlap_event[event]); + IRDA_DEBUG(1, __FUNCTION__ "(), Receiving discovery request (s = %d) +while performing discovery :-(\n", info->s); - /* Last discovery frame? */ + /* Last discovery request ? */ if (info->s == 0xff) irlap_discovery_indication(self, info->discovery); break; - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] Please read the FAQ at http://www.tux.org/lkml/
[patch] patch-2.4.0-test10-irda20 (was: Re: The IrDA patches)[patch] patch-2.4.0-test10-irda20 (was: Re: The IrDA patches)
Linus, Here are the new IrDA patches for Linux-2.4.0-test10. Please apply them to your latest 2.4 code. If you decide to apply them, then I suggest you start with the first one (irda1.diff) and work your way to the last one (irda24.diff) since most of them are not commutative. The name of this patch is irda20.diff. (Many thanks to Jean Tourrilhes for splitting up the big patch) [FEATURE] : Add a new feature to the IrDA stack [CORRECT] : Fix to have the correct/expected behaviour [CRITICA] : Fix potential kernel crash [OUPS ] : Error that will be fixed in a later patch irda20.diff : - o [CORRECT] Close up LMP socket when receive a disconnect o [FEATURE] Cleanups diff -urpN old-linux/net/irda/af_irda.c linux/net/irda/af_irda.c --- old-linux/net/irda/af_irda.cThu Nov 9 17:41:49 2000 +++ linux/net/irda/af_irda.cThu Nov 9 17:55:35 2000 @@ -114,7 +114,7 @@ static int irda_data_indication(void *in /* * Function irda_disconnect_indication (instance, sap, reason, skb) * - *Connection has been closed. Chech reason to find out why + *Connection has been closed. Check reason to find out why * */ static void irda_disconnect_indication(void *instance, void *sap, @@ -138,6 +138,27 @@ static void irda_disconnect_indication(v sk->state_change(sk); sk->dead = 1; } + + /* Close our TSAP. +* If we leave it open, IrLMP put it back into the list of +* unconnected LSAPs. The problem is that any incomming request +* can then be matched to this socket (and it will be, because +* it is at the head of the list). This would prevent any +* listening socket waiting on the same TSAP to get those requests. +* Some apps forget to close sockets, or hang to it a bit too long, +* so we may stay in this dead state long enough to be noticed... +* Note : all socket function do check sk->state, so we are safe... +* Jean II +*/ + irttp_close_tsap(self->tsap); + self->tsap = NULL; + + /* Note : once we are there, there is not much you want to do +* with the socket anymore, apart from closing it. +* For example, bind() and connect() won't reset sk->err, +* sk->shutdown and sk->dead to valid values... +* Jean II +*/ } /* @@ -1126,11 +1147,15 @@ void irda_destroy_socket(struct irda_soc irlmp_unregister_service(self->skey); /* Unregister with LM-IAS */ - if (self->ias_obj) + if (self->ias_obj) { irias_delete_object(self->ias_obj); + self->ias_obj = NULL; + } - if (self->iriap) + if (self->iriap) { iriap_close(self->iriap); + self->iriap = NULL; + } if (self->tsap) { irttp_disconnect_request(self->tsap, NULL, P_NORMAL); @@ -1576,9 +1601,11 @@ static int irda_shutdown(struct socket * sk->shutdown |= SEND_SHUTDOWN; sk->state_change(sk); - if (self->iriap) + if (self->iriap) { iriap_close(self->iriap); - + self->iriap = NULL; + } + if (self->tsap) { irttp_disconnect_request(self->tsap, NULL, P_NORMAL); irttp_close_tsap(self->tsap); diff -urpN old-linux/net/irda/irlmp.c linux/net/irda/irlmp.c --- old-linux/net/irda/irlmp.c Thu Nov 9 17:52:56 2000 +++ linux/net/irda/irlmp.c Thu Nov 9 17:55:35 2000 @@ -284,7 +284,7 @@ void irlmp_register_link(struct irlap_cb init_timer(&lap->idle_timer); /* -* Insert into queue of unconnected LSAPs +* Insert into queue of LMP links */ hashbin_insert(irlmp->links, (irda_queue_t *) lap, lap->saddr, NULL); diff -urpN old-linux/net/irda/irlmp_frame.c linux/net/irda/irlmp_frame.c --- old-linux/net/irda/irlmp_frame.cThu Nov 9 17:39:46 2000 +++ linux/net/irda/irlmp_frame.cThu Nov 9 17:55:35 2000 @@ -127,9 +127,11 @@ void irlmp_link_data_indication(struct l irlmp->unconnected_lsaps); /* Maybe LSAP was already connected, so try one more time */ - if (!lsap) + if (!lsap) { + IRDA_DEBUG(1, __FUNCTION__ "(), incoming connection for LSAP +already connected\n"); lsap = irlmp_find_lsap(self, dlsap_sel, slsap_sel, 0, self->lsaps); + } } else lsap = irlmp_find_lsap(self, dlsap_sel, slsap_sel, 0, self->lsaps); - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] Please read the FAQ at http://www.tux.org/lkml/
[patch] patch-2.4.0-test10-irda21 (was: Re: The IrDA patches)[patch] patch-2.4.0-test10-irda21 (was: Re: The IrDA patches)
Linus, Here are the new IrDA patches for Linux-2.4.0-test10. Please apply them to your latest 2.4 code. If you decide to apply them, then I suggest you start with the first one (irda1.diff) and work your way to the last one (irda24.diff) since most of them are not commutative. The name of this patch is irda21.diff. (Many thanks to Jean Tourrilhes for splitting up the big patch) [FEATURE] : Add a new feature to the IrDA stack [CORRECT] : Fix to have the correct/expected behaviour [CRITICA] : Fix potential kernel crash [OUPS ] : Error that will be fixed in a later patch irda21.diff : - o [CORRECT] Replace ASSERT with proper test (non DEBUG compiles) o [CORRECT] Increase BOFs value and handle xbofs_delay as delay o [FEATURE] Cleanups o [OUPS ] Broken init of self->N1 (disable case) diff -urpN old-linux/include/net/irda/irda.h linux/include/net/irda/irda.h --- old-linux/include/net/irda/irda.h Thu Nov 9 17:52:56 2000 +++ linux/include/net/irda/irda.h Thu Nov 9 17:59:48 2000 @@ -176,12 +176,14 @@ typedef union { * (must not exceed 48 bytes, check with struct sk_buff) */ struct irda_skb_cb { - magic_t magic; /* Be sure that we can trust the information */ - __u32 speed; /* The Speed this frame should be sent with */ - __u16 mtt; /* Minimum turn around time */ - int xbofs; /* Number of xbofs required, used by SIR mode */ - __u8 line; /* Used by IrCOMM in IrLPT mode */ - void (*destructor)(struct sk_buff *skb); /* Used for flow control */ + magic_t magic; /* Be sure that we can trust the information */ + __u32 speed; /* The Speed this frame should be sent with */ + __u16 mtt; /* Minimum turn around time */ + __u16 xbofs; /* Number of xbofs required, used by SIR mode */ + void*context;/* May be used by drivers */ + void(*destructor)(struct sk_buff *skb); /* Used for flow control */ + __u16 xbofs_delay; /* Number of xbofs used for generating the mtt */ + __u8line;/* Used by IrCOMM in IrLPT mode */ }; /* Misc status information */ diff -urpN old-linux/include/net/irda/irlmp.h linux/include/net/irda/irlmp.h --- old-linux/include/net/irda/irlmp.h Thu Nov 9 17:52:56 2000 +++ linux/include/net/irda/irlmp.h Thu Nov 9 17:59:48 2000 @@ -252,9 +252,12 @@ static inline hashbin_t *irlmp_get_cache static inline int irlmp_get_lap_tx_queue_len(struct lsap_cb *self) { - ASSERT(self != NULL, return 0;); - ASSERT(self->lap != NULL, return 0;); - ASSERT(self->lap->irlap != NULL, return 0;); + if (self == NULL) + return 0; + if (self->lap == NULL) + return 0; + if (self->lap->irlap == NULL) + return 0; return IRLAP_GET_TX_QUEUE_LEN(self->lap->irlap); } diff -urpN old-linux/include/net/irda/qos.h linux/include/net/irda/qos.h --- old-linux/include/net/irda/qos.hThu Nov 9 17:52:56 2000 +++ linux/include/net/irda/qos.hThu Nov 9 17:59:48 2000 @@ -107,7 +107,3 @@ void irda_qos_bits_to_value(struct qos_i #endif - - - - diff -urpN old-linux/net/irda/irlan/irlan_client.c linux/net/irda/irlan/irlan_client.c --- old-linux/net/irda/irlan/irlan_client.c Thu Nov 9 17:32:39 2000 +++ linux/net/irda/irlan/irlan_client.c Thu Nov 9 17:59:48 2000 @@ -159,7 +159,7 @@ void irlan_client_discovery_indication(d /* Find instance */ self = (struct irlan_cb *) hashbin_get_first(irlan); -if (self) { + if (self) { ASSERT(self->magic == IRLAN_MAGIC, return;); IRDA_DEBUG(1, __FUNCTION__ "(), Found instance (%08x)!\n", diff -urpN old-linux/net/irda/irlan/irlan_common.c linux/net/irda/irlan/irlan_common.c --- old-linux/net/irda/irlan/irlan_common.c Thu Nov 9 17:41:49 2000 +++ linux/net/irda/irlan/irlan_common.c Thu Nov 9 17:59:48 2000 @@ -122,6 +122,7 @@ int __init irlan_init(void) struct irlan_cb *new; __u16 hints; + IRDA_DEBUG(0, __FUNCTION__ "()\n"); /* Allocate master structure */ irlan = hashbin_new(HB_LOCAL); if (irlan == NULL) { @@ -136,7 +137,7 @@ int __init irlan_init(void) hints = irlmp_service_to_hint(S_LAN); /* Register with IrLMP as a client */ - ckey = irlmp_register_client(hints, irlan_client_discovery_indication, + ckey = irlmp_register_client(hints, &irlan_client_discovery_indication, NULL, NULL); /* Register with IrLMP as a service */ diff -urpN old-linux/net/irda/irlap.c linux/net/irda/irlap.c --- old-linux/net/irda/irlap.c Thu Nov 9 17:52:56 2000 +++ linux/net/irda/irlap.c Thu Nov 9 17:59:48 2000 @@ -1011,7 +1011,7 @@ void irlap_apply_default_connection_para irda_device_set_media_busy(self->netdev, TRUE); /* Default value in NDM */ - self->bof
[patch] patch-2.4.0-test10-irda22 (was: Re: The IrDA patches)[patch] patch-2.4.0-test10-irda22 (was: Re: The IrDA patches)
Linus, Here are the new IrDA patches for Linux-2.4.0-test10. Please apply them to your latest 2.4 code. If you decide to apply them, then I suggest you start with the first one (irda1.diff) and work your way to the last one (irda24.diff) since most of them are not commutative. The name of this patch is irda22.diff. (Many thanks to Jean Tourrilhes for splitting up the big patch) [FEATURE] : Add a new feature to the IrDA stack [CORRECT] : Fix to have the correct/expected behaviour [CRITICA] : Fix potential kernel crash [OUPS ] : Error that will be fixed in a later patch irda22.diff : - o [FEATURE] Cleaner module init o [FEATURE] Remove dependancy on irmanager o [FEATURE] Move remaining irmod.c content to irsyms.c o [FEATURE] Cleaner use of MOD_INC_USE_COUNT diff -urpN old-linux/net/irda/Makefile linux/net/irda/Makefile --- old-linux/net/irda/Makefile Sun Aug 6 11:23:41 2000 +++ linux/net/irda/Makefile Thu Nov 9 18:02:46 2000 @@ -17,7 +17,7 @@ O_OBJS := iriap.o iriap_event.o irlmp.o irlap.o irlap_event.o irlap_frame.o timer.o qos.o irqueue.o \ irttp.o irda_device.o irias_object.o crc.o wrapper.o af_irda.o \ discovery.o parameters.o -OX_OBJS := irmod.o +OX_OBJS := irsyms.o ifeq ($(CONFIG_IRDA),m) M_OBJS := $(O_TARGET) diff -urpN old-linux/net/irda/af_irda.c linux/net/irda/af_irda.c --- old-linux/net/irda/af_irda.cThu Nov 9 17:57:45 2000 +++ linux/net/irda/af_irda.cThu Nov 9 17:59:48 2000 @@ -7,7 +7,7 @@ * Author:Dag Brattli <[EMAIL PROTECTED]> * Created at:Sun May 31 10:12:43 1998 * Modified at: Sat Dec 25 21:10:23 1999 - * Modified by: Dag Brattli <[EMAIL PROTECTED]> + * Modified by: Dag Brattli <[EMAIL PROTECTED]> * Sources: af_netroom.c, af_ax25.c, af_rose.c, af_x25.c etc. * * Copyright (c) 1999 Dag Brattli <[EMAIL PROTECTED]> @@ -43,10 +43,11 @@ / #include -#include +#include #include #include #include +#include #include #include #include @@ -81,6 +82,10 @@ static struct proto_ops irda_ultra_ops; #define IRDA_MAX_HEADER (TTP_MAX_HEADER) +#ifdef CONFIG_IRDA_DEBUG +__u32 irda_debug = IRDA_DEBUG_LEVEL; +#endif + /* * Function irda_data_indication (instance, sap, skb) * @@ -1124,8 +1129,7 @@ static int irda_create(struct socket *so self->daddr = DEV_ADDR_ANY; /* Until we get connected */ self->saddr = 0x0; /* so IrLMP assign us any link */ - /* Notify that we are using the irda module, so nobody removes it */ - irda_mod_inc_use_count(); + MOD_INC_USE_COUNT; return 0; } @@ -1169,10 +1173,8 @@ void irda_destroy_socket(struct irda_soc } #endif /* CONFIG_IRDA_ULTRA */ kfree(self); - - /* Notify that we are not using the irda module anymore */ - irda_mod_dec_use_count(); - + MOD_DEC_USE_COUNT; + return; } @@ -2369,25 +2371,44 @@ static struct notifier_block irda_dev_no }; /* + * Function irda_proc_modcount (inode, fill) + * + *Use by the proc file system functions to prevent the irda module + *being removed while the use is standing in the net/irda directory + */ +void irda_proc_modcount(struct inode *inode, int fill) +{ +#ifdef MODULE +#ifdef CONFIG_PROC_FS + if (fill) + MOD_INC_USE_COUNT; + else + MOD_DEC_USE_COUNT; +#endif /* CONFIG_PROC_FS */ +#endif /* MODULE */ +} + +/* * Function irda_proto_init (pro) * *Initialize IrDA protocol layer * */ -static int __init irda_proto_init(void) +int __init irda_proto_init(void) { - MESSAGE("IrDA (tm) Protocols for Linux-2.4 (Dag Brattli)\n"); + sock_register(&irda_family_ops); -sock_register(&irda_family_ops); - -irda_packet_type.type = htons(ETH_P_IRDA); - dev_add_pack(&irda_packet_type); - -register_netdevice_notifier(&irda_dev_notifier); - + irda_packet_type.type = htons(ETH_P_IRDA); +dev_add_pack(&irda_packet_type); + + register_netdevice_notifier(&irda_dev_notifier); + + irda_init(); +#ifdef MODULE + irda_device_init(); /* Called by init/main.c when non-modular */ +#endif return 0; } -module_init(irda_proto_init); /* * Function irda_proto_cleanup (void) @@ -2395,13 +2416,24 @@ module_init(irda_proto_init); *Remove IrDA protocol layer * */ -void __exit irda_proto_cleanup(void) +#ifdef MODULE +void irda_proto_cleanup(void) { irda_packet_type.type = htons(ETH_P_IRDA); - dev_remove_pack(&irda_packet_type); +dev_remove_pack(&irda_packet_type); - unregister_netdevice_notifier(&irda_dev_notifier); +unregister_netdevice_notifier(&irda_dev_notifier); sock_unregi
[patch] patch-2.4.0-test10-irda23 (was: Re: The IrDA patches)[patch] patch-2.4.0-test10-irda23 (was: Re: The IrDA patches)
Linus, Here are the new IrDA patches for Linux-2.4.0-test10. Please apply them to your latest 2.4 code. If you decide to apply them, then I suggest you start with the first one (irda1.diff) and work your way to the last one (irda24.diff) since most of them are not commutative. The name of this patch is irda23.diff. (Many thanks to Jean Tourrilhes for splitting up the big patch) [FEATURE] : Add a new feature to the IrDA stack [CORRECT] : Fix to have the correct/expected behaviour [CRITICA] : Fix potential kernel crash [OUPS ] : Error that will be fixed in a later patch irda23.diff : - o [CRITICA] Don't crash on malformed discovery frames o [CORRECT] Don't divide self->N1, because -1/2 = 0 o [CORRECT] Correctly transmit Ultra frames sent while doing discovery diff -urpN old-linux/include/net/irda/timer.h linux/include/net/irda/timer.h --- old-linux/include/net/irda/timer.h Thu Nov 9 13:36:27 2000 +++ linux/include/net/irda/timer.h Thu Nov 9 18:26:03 2000 @@ -76,6 +76,7 @@ inline void irlap_start_wd_timer(struct inline void irlap_start_backoff_timer(struct irlap_cb *self, int timeout); void irlap_start_mbusy_timer(struct irlap_cb *); +void irlap_stop_mbusy_timer(struct irlap_cb *); struct lsap_cb; struct lap_cb; diff -urpN old-linux/net/irda/irda_device.c linux/net/irda/irda_device.c --- old-linux/net/irda/irda_device.cThu Nov 9 17:09:30 2000 +++ linux/net/irda/irda_device.cThu Nov 9 18:26:03 2000 @@ -185,7 +185,7 @@ void irda_device_set_media_busy(struct n IRDA_DEBUG( 4, "Media busy!\n"); } else { self->media_busy = FALSE; - del_timer(&self->media_busy_timer); + irlap_stop_mbusy_timer(self); } } diff -urpN old-linux/net/irda/irlap_event.c linux/net/irda/irlap_event.c --- old-linux/net/irda/irlap_event.cThu Nov 9 18:16:46 2000 +++ linux/net/irda/irlap_event.cThu Nov 9 18:26:03 2000 @@ -305,6 +305,17 @@ void irlap_next_state(struct irlap_cb *s if ((state != LAP_XMIT_P) && (state != LAP_XMIT_S)) self->bytes_left = self->line_capacity; #endif /* CONFIG_IRDA_DYNAMIC_WINDOW */ +#ifdef CONFIG_IRDA_ULTRA + /* Send any pending Ultra frames if any */ + /* The higher layers may have sent a few Ultra frames while we +* were doing discovery (either query or reply). Those frames +* have been queued, but were never sent. It is now time to +* send them... +* Jean II */ + if ((state == LAP_NDM) && (!skb_queue_empty(&self->txq_ultra))) + /* Force us to listen 500 ms before sending Ultra */ + irda_device_set_media_busy(self->netdev, TRUE); +#endif /* CONFIG_IRDA_ULTRA */ } /* @@ -1903,20 +1914,25 @@ static int irlap_state_nrm_s(struct irla /* * Wait until retry_count * n matches negotiated threshold/ * disconnect time (note 2 in IrLAP p. 82) +* +* Note : self->wd_timeout = (self->poll_timeout * 2), +* and self->final_timeout == self->poll_timeout, +* which explain why we use (self->retry_count * 2) here !!! +* Jean II */ IRDA_DEBUG(1, __FUNCTION__ "(), retry_count = %d\n", self->retry_count); - if ((self->retry_count < (self->N2/2)) && - (self->retry_count != self->N1/2)) { + if (((self->retry_count * 2) < self->N2) && + ((self->retry_count * 2) != self->N1)) { irlap_start_wd_timer(self, self->wd_timeout); - self->retry_count++; - } else if (self->retry_count == (self->N1/2)) { + self->retry_count++; + } else if ((self->retry_count * 2) == self->N1) { irlap_status_indication(self, STATUS_NO_ACTIVITY); irlap_start_wd_timer(self, self->wd_timeout); self->retry_count++; - } else if (self->retry_count >= self->N2/2) { + } else if ((self->retry_count * 2) >= self->N2) { irlap_apply_default_connection_parameters(self); /* Always switch state before calling upper layers */ diff -urpN old-linux/net/irda/irlap_frame.c linux/net/irda/irlap_frame.c --- old-linux/net/irda/irlap_frame.cThu Nov 9 18:16:46 2000 +++ linux/net/irda/irlap_frame.cThu Nov 9 18:26:03 2000 @@ -503,6 +503,12 @@ static void irlap_recv_discovery_xid_cmd * Check if last frame */ if (info->s == 0xff) { + /* Check if things are sane at this point... */ + if((discovery_info == NULL) || (skb->len < 3)) { + ERROR(__FUNCTION__ "(), discovery fra
[patch] Re: Compile and link errors in irda in test11-pre3[patch] Re: Compile and link errors in irda in test11-pre3
Linus, Here is a patch that fixes the compile and link errors in the latest IrDA code in linux-2.4.0-test11-pre3. Changes: o Fixes some errors in the change_speed name for a couple of drivers. Includes the previous patch I sent you (nsc-ircc) (me) o Fixes irport driver where the netdev timeout was set to shorter than the time required for a speed change (me) o Fixes warning in init code in irsyms.c (Rasmus Andersen) -- Dag diff -urpN linux-2.4.0-test11-pre3/drivers/net/irda/irport.c linux/drivers/net/irda/irport.c --- linux-2.4.0-test11-pre3/drivers/net/irda/irport.c Sun Nov 12 09:08:11 2000 +++ linux/drivers/net/irda/irport.c Sun Nov 12 21:56:47 2000 @@ -230,7 +230,7 @@ irport_open(int i, unsigned int iobase, dev->init= irport_net_init; dev->hard_start_xmit = irport_hard_xmit; dev->tx_timeout = irport_timeout; - dev->watchdog_timeo = HZ/20; + dev->watchdog_timeo = HZ; /* Allow time enough for speed change */ dev->open= irport_net_open; dev->stop= irport_net_close; dev->get_stats = irport_net_get_stats; @@ -496,7 +496,6 @@ static void irport_write_wakeup(struct i self->tx_buff.data += actual; self->tx_buff.len -= actual; } else { - /* * Now serial buffer is almost free & we can start * transmission of another packet. But first we must check diff -urpN linux-2.4.0-test11-pre3/drivers/net/irda/nsc-ircc.c linux/drivers/net/irda/nsc-ircc.c --- linux-2.4.0-test11-pre3/drivers/net/irda/nsc-ircc.c Sun Nov 12 09:08:11 2000 +++ linux/drivers/net/irda/nsc-ircc.c Sun Nov 12 09:57:17 2000 @@ -1129,7 +1129,7 @@ static int nsc_ircc_hard_xmit_fir(struct if ((speed = irda_get_speed(skb)) != self->io.speed) { /* Check for empty frame */ if (!skb->len) { - nsc_ircc_change_speed_complete(self, speed); + nsc_ircc_change_speed(self, speed); return 0; } else self->new_speed = speed; diff -urpN linux-2.4.0-test11-pre3/drivers/net/irda/smc-ircc.c linux/drivers/net/irda/smc-ircc.c --- linux-2.4.0-test11-pre3/drivers/net/irda/smc-ircc.c Sun Nov 12 09:08:11 2000 +++ linux/drivers/net/irda/smc-ircc.c Sun Nov 12 22:00:01 2000 @@ -7,7 +7,7 @@ * Author:Thomas Davis ([EMAIL PROTECTED]) * Created at: * Modified at: Tue Feb 22 10:05:06 2000 - * Modified by: Dag Brattli <[EMAIL PROTECTED]> + * Modified by: Dag Brattli <[EMAIL PROTECTED]> * * Copyright (c) 1999-2000 Dag Brattli * Copyright (c) 1998-1999 Thomas Davis, @@ -252,6 +252,7 @@ static int ircc_open(int i, unsigned int IR_115200|IR_576000|IR_1152000|(IR_400 << 8); irport->qos.min_turn_time.bits = 0x07; + irport->qos.window_size.bits = 0x01; irda_qos_bits_to_value(&irport->qos); irport->flags = IFF_FIR|IFF_MIR|IFF_SIR|IFF_DMA|IFF_PIO; @@ -508,6 +509,10 @@ static void ircc_change_speed(void *priv outb(0x00, iobase+IRCC_MASTER); switch (speed) { + default: + IRDA_DEBUG(0, __FUNCTION__ "(), unknown baud rate of %d\n", + speed); + /* FALLTHROUGH */ case 9600: case 19200: case 38400: @@ -535,10 +540,6 @@ static void ircc_change_speed(void *priv fast = IRCC_LCR_A_FAST; IRDA_DEBUG(0, __FUNCTION__ "(), handling baud of 400\n"); break; - default: - IRDA_DEBUG(0, __FUNCTION__ "(), unknown baud rate of %d\n", - speed); - return; } register_bank(iobase, 0); @@ -620,7 +621,7 @@ static int ircc_hard_xmit(struct sk_buff if ((speed = irda_get_speed(skb)) != self->io.speed) { /* Check for empty frame */ if (!skb->len) { - smc_ircc_change_speed(self, speed); + ircc_change_speed(self, speed); return 0; } else self->new_speed = speed; @@ -638,7 +639,7 @@ static int ircc_hard_xmit(struct sk_buff int bofs; /* -* Compute who many BOFS (STA or PA's) we need to waste the +* Compute how many BOFs (STA or PA's) we need to waste the * min turn time given the speed of the link. */ bofs = mtt * (self->io.speed / 1000) / 8000; @@ -650,7 +651,6 @@ static int ircc_hard_xmit(struct sk_buff /* Transmit frame */ ircc_dma_xmit(self, iobase, 0); } - spin_
[patch] patch-2.4.1-irda1 (irtty)
Linus, Here is a patch that fixes a kernel crash people have experiended when using IrDA dongles with Linux-2.4. The problem was that the netdev was deallocated a bit to early at close time. Please apply to your latest 2.4 code. -- Dag --- linux/drivers/net/irda/irtty.c.orig Sun Jan 21 23:35:44 2001 +++ linux/drivers/net/irda/irtty.c Sun Jan 21 23:36:30 2001 @@ -279,6 +279,11 @@ static void irtty_close(struct tty_struc tty->flags &= ~(1 << TTY_DO_WRITE_WAKEUP); tty->disc_data = 0; + /* We are not using any dongle anymore! */ + if (self->dongle) + irda_device_dongle_cleanup(self->dongle); + self->dongle = NULL; + /* Remove netdevice */ if (self->netdev) { rtnl_lock(); @@ -286,11 +291,6 @@ static void irtty_close(struct tty_struc rtnl_unlock(); } - /* We are not using any dongle anymore! */ - if (self->dongle) - irda_device_dongle_cleanup(self->dongle); - self->dongle = NULL; - /* Remove speed changing task if any */ if (self->task) irda_task_delete(self->task); - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] Please read the FAQ at http://www.tux.org/lkml/
[patch] patch-2.4.1-irda2 (irlan)
Linus, Here is a patch that fixes the problem of attaching to IrLAN devices in Linux-2.4.1. The problem was that the IrLAN driver forgot to memorize the hardware address of the remote device and instead used the broadcast address, which sometimes did work, but not always (since doing so is actually a bug) Have also added the dynalloc flag to irlan, since it does allocate it's network devices dynamically. -- Dag diff -urpN linux-2.4.1/net/irda/irlan/irlan_client.c linux/net/irda/irlan/irlan_client.c --- linux-2.4.1/net/irda/irlan/irlan_client.c Sun Nov 12 03:11:23 2000 +++ linux/net/irda/irlan/irlan_client.c Thu Feb 8 09:08:41 2001 @@ -120,8 +120,9 @@ void irlan_client_wakeup(struct irlan_cb return; } - /* Address may have changed! */ + /* Addresses may have changed! */ self->saddr = saddr; + self->daddr = daddr; if (self->disconnect_reason == LM_USER_REQUEST) { IRDA_DEBUG(0, __FUNCTION__ "(), still stopped by user\n"); diff -urpN linux-2.4.1/net/irda/irlan/irlan_eth.c linux/net/irda/irlan/irlan_eth.c --- linux-2.4.1/net/irda/irlan/irlan_eth.c Sun Nov 12 03:11:23 2000 +++ linux/net/irda/irlan/irlan_eth.cThu Feb 8 09:08:41 2001 @@ -61,6 +61,7 @@ int irlan_eth_init(struct net_device *de dev->hard_start_xmit= irlan_eth_xmit; dev->get_stats = irlan_eth_get_stats; dev->set_multicast_list = irlan_eth_set_multicast_list; + dev->features |= NETIF_F_DYNALLOC; ether_setup(dev); - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] Please read the FAQ at http://www.tux.org/lkml/
[patch] patch-2.4.1-irda4 (irlap speed)
Linus, Here is a patch that fixes some IrDA problems with speed changes in the IrLAP layer, and also a missing kfree's in all of the IrDA device drivers. This patch is also credited Jean Tourrilhes. It's been tested for a month or so by the Linux-IrDA mailing-list, and found to be working OK. Please apply to your latest 2.4 code. -- Dag diff -urpN linux-2.4.1-patch/net/irda/irlap.c linux-2.4.1-irda-patch/net/irda/irlap.c --- linux-2.4.1-patch/net/irda/irlap.c Sun Nov 12 03:11:23 2000 +++ linux-2.4.1-irda-patch/net/irda/irlap.c Thu Feb 8 22:34:14 2001 @@ -998,7 +998,7 @@ void irlap_init_qos_capabilities(struct } /* - * Function irlap_apply_default_connection_parameters (void) + * Function irlap_apply_default_connection_parameters (void, now) * *Use the default connection and transmission parameters * @@ -1010,14 +1010,16 @@ void irlap_apply_default_connection_para ASSERT(self != NULL, return;); ASSERT(self->magic == LAP_MAGIC, return;); + /* xbofs : Default value in NDM */ + self->next_bofs = 12; + self->bofs_count = 12; + + /* NDM Speed is 9600 */ irlap_change_speed(self, 9600, TRUE); /* Set mbusy when going to NDM state */ irda_device_set_media_busy(self->netdev, TRUE); - /* Default value in NDM */ - self->bofs_count = 12; - /* * Generate random connection address for this session, which must * be 7 bits wide and different from 0x00 and 0xfe @@ -1056,23 +1058,31 @@ void irlap_apply_default_connection_para } /* - * Function irlap_apply_connection_parameters (qos) + * Function irlap_apply_connection_parameters (qos, now) * *Initialize IrLAP with the negotiated QoS values * + * If 'now' is false, the speed and xbofs will be changed after the next + * frame is sent. + * If 'now' is true, the speed and xbofs is changed immediately */ -void irlap_apply_connection_parameters(struct irlap_cb *self) +void irlap_apply_connection_parameters(struct irlap_cb *self, int now) { IRDA_DEBUG(4, __FUNCTION__ "()\n"); ASSERT(self != NULL, return;); ASSERT(self->magic == LAP_MAGIC, return;); - irlap_change_speed(self, self->qos_tx.baud_rate.value, FALSE); + /* Set the negociated xbofs value */ + self->next_bofs = self->qos_tx.additional_bofs.value; + if(now) + self->bofs_count = self->next_bofs; + + /* Set the negociated link speed (may need the new xbofs value) */ + irlap_change_speed(self, self->qos_tx.baud_rate.value, now); self->window_size = self->qos_tx.window_size.value; self->window = self->qos_tx.window_size.value; - self->bofs_count = self->qos_tx.additional_bofs.value; /* * Calculate how many bytes it is possible to transmit before the diff -urpN linux-2.4.1-patch/net/irda/irlap_event.c linux-2.4.1-irda-patch/net/irda/irlap_event.c --- linux-2.4.1-patch/net/irda/irlap_event.cTue Nov 28 03:07:31 2000 +++ linux-2.4.1-irda-patch/net/irda/irlap_event.c Thu Feb 8 22:34:14 2001 @@ -684,25 +684,26 @@ static int irlap_state_conn(struct irlap irlap_initiate_connection_state(self); -#if 0 /* -* We are allowed to send two frames, but this may increase -* the connect latency, so lets not do it for now. +* Applying the parameters now will make sure we change speed +* *after* we have sent the next frame */ - irlap_send_ua_response_frame(self, &self->qos_rx); -#endif + irlap_apply_connection_parameters(self, FALSE); /* -* Applying the parameters now will make sure we change speed -* after we have sent the next frame +* Sending this frame will force a speed change after it has +* been sent (i.e. the frame will be sent at 9600). */ - irlap_apply_connection_parameters(self); + irlap_send_ua_response_frame(self, &self->qos_rx); +#if 0 /* -* Sending this frame will force a speed change after it has -* been sent +* We are allowed to send two frames, but this may increase +* the connect latency, so lets not do it for now. */ + /* What the hell is this ? - Jean II */ irlap_send_ua_response_frame(self, &self->qos_rx); +#endif /* * The WD-timer could be set to the duration of the P-timer @@ -794,8 +795,9 @@ static int irlap_state_setup(struct irla irlap_qos_negotiate(self, skb); + /* Send UA frame and then change link settings */ + irlap_apply_connection_parameters(self, FALSE); irlap_s
[patch] patch-2.4.1-irda3 (qos)
Linus, Please apply this patch to your latest 2.4 code. It contains cleanups to the irda QoS code by Jean Tourrilhes. -- Dag diff -u -p linux/include/net/irda/qos.d6.h linux/include/net/irda/qos.h --- linux/include/net/irda/qos.d6.h Thu Jan 11 14:28:26 2001 +++ linux/include/net/irda/qos.hThu Jan 11 14:29:15 2001 @@ -100,10 +100,19 @@ void irda_qos_compute_intersection(struc __u32 irlap_max_line_capacity(__u32 speed, __u32 max_turn_time); __u32 irlap_requested_line_capacity(struct qos_info *qos); -__u32 irlap_min_turn_time_in_bytes(__u32 speed, __u32 min_turn_time); int msb_index(__u16 byte); void irda_qos_bits_to_value(struct qos_info *qos); + +/* So simple, how could we not inline those two ? + * Note : one byte is 10 bits if you include start and stop bits + * Jean II */ +#define irlap_min_turn_time_in_bytes(speed, min_turn_time) ( \ + speed * min_turn_time / 1000\ +) +#define irlap_xbofs_in_usec(speed, xbofs) (\ + xbofs * 1000 / speed\ +) #endif diff -u -p linux/net/irda/qos.d6.c linux/net/irda/qos.c --- linux/net/irda/qos.d6.c Thu Jan 11 14:28:40 2001 +++ linux/net/irda/qos.cThu Jan 11 14:29:15 2001 @@ -70,10 +70,6 @@ static int irlap_param_additional_bofs(v int get); static int irlap_param_min_turn_time(void *instance, irda_param_t *param, int get); -static int value_index(__u32 value, __u32 *array, int size); -static __u32 byte_value(__u8 byte, __u32 *array); -static __u32 index_value(int index, __u32 *array); -static int value_lower_bits(__u32 value, __u32 *array, int size, __u16 *field); __u32 min_turn_times[] = { 1, 5000, 1000, 500, 100, 50, 10, 0 }; /* us */ __u32 baud_rates[] = { 2400, 9600, 19200, 38400, 57600, 115200, 576000, @@ -130,6 +126,98 @@ static pi_major_info_t pi_major_call_tab static pi_param_info_t irlap_param_info = { pi_major_call_table, 2, 0x7f, 7 }; +/* -- LOCAL SUBROUTINES -- */ +/* Note : we start with a bunch of local subroutines. + * As the compiler is "one pass", this is the only way to get them to + * inline properly... + * Jean II + */ +/* + * Function value_index (value, array, size) + * + *Returns the index to the value in the specified array + */ +static inline int value_index(__u32 value, __u32 *array, int size) +{ + int i; + + for (i=0; i < size; i++) + if (array[i] == value) + break; + return i; +} + +/* + * Function index_value (index, array) + * + *Returns value to index in array, easy! + * + */ +static inline __u32 index_value(int index, __u32 *array) +{ + return array[index]; +} + +/* + * Function msb_index (word) + * + *Returns index to most significant bit (MSB) in word + * + */ +int msb_index (__u16 word) +{ + __u16 msb = 0x8000; + int index = 15; /* Current MSB */ + + while (msb) { + if (word & msb) + break; /* Found it! */ + msb >>=1; + index--; + } + return index; +} + +static inline __u32 byte_value(__u8 byte, __u32 *array) +{ + int index; + + ASSERT(array != NULL, return -1;); + + index = msb_index(byte); + + return index_value(index, array); +} + +/* + * Function value_lower_bits (value, array) + * + *Returns a bit field marking all possibility lower than value. + *We may need a "value_higher_bits" in the future... + */ +static inline int value_lower_bits(__u32 value, __u32 *array, int size, __u16 *field) +{ + int i; + __u16 mask = 0x1; + __u16 result = 0x0; + + for (i=0; i < size; i++) { + /* Add the current value to the bit field, shift mask */ + result |= mask; + mask <<= 1; + /* Finished ? */ + if (array[i] >= value) + break; + } + /* Send back a valid index */ + if(i >= size) + i = size - 1; /* Last item */ + *field = result; + return i; +} + +/* -- MAIN CALLS -- */ + /* * Function irda_qos_compute_intersection (qos, new) * @@ -594,99 +682,6 @@ __u32 irlap_requested_line_capacity(stru line_capacity); return line_capacity; -} - -__u32 irlap_min_turn_time_in_bytes(__u32 speed, __u32 min_turn_time) -{ - __u32 bytes; - - bytes = speed * min_turn_time / 1000; - - return bytes; -} - -static __u32 byte_value(__u8 byte, __u32 *array) -{ - int index; - - ASSERT(array != NULL, return -1;); - - index = msb_index(byte); - - return index_value(index, array); -} - -/* - * Function msb_index (word) - * - *Returns index to most si