vikram balaji | 1 Sep 2006 08:20
Picon

hp compaq nc6230 infra red not configured/ working

Hi all,
i am using hp compaq nc 6230 laptop. From the specification i found that it has a Fast IR.It is working fine in windows. i am using ubuntu(dapper drake) in my laptop with irda-utils latest version installed via synaptic. when i do an ifconfig it returns me this value on infrared.
 
irda0     Link encap:IrLAP  HWaddr 00:00:00:00
          UP RUNNING NOARP  MTU:2048  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:8
          RX bytes:0 (0.0 b)  TX bytes:14 (14.0 b)
 
i tried the irdadump and there was no response or packets transfered from the system/mobile. there was no message on the console window when i run irdadump.
I queried my local LUG and they said that my dmesg log says some kernel failure.Can anyone help me in fixing and making things work?
below is the message when i ran dmesg.
Thanks in advance for your help.
Vicky
 

dmesg log

4294709.237000] ACPI: Video Device [C0F9] (multi-head: yes  rom: no  post: no)
[4294712.460000] eth0: no IPv6 routers present
[4294713.172000] [drm] Initialized drm 1.0.1 20051102
[4294713.185000 ] ACPI: PCI Interrupt 0000:01:00.0[A] -> GSI 16 (level, low) -> IRQ 169
[4294713.185000] [drm] Initialized radeon 1.24.0 20060225 on minor 0
[4294713.657000] apm: BIOS not found.
[4294714.703000] [drm] Setting GART location based on new memory map
[4294714.704000] [drm] Loading R300 Microcode
[4294714.704000] [drm] writeback test succeeded in 1 usecs
[4294715.885000] sirdev_get_instance - ttyS2
[4294715.885000] irtty_open - ttyS2: irda line discipline opened
[4294715.961000] Unable to handle kernel NULL pointer dereference at virtual address 00000004
[4294715.961000]  printing eip:
[4294715.961000] c013112f
[4294715.961000] *pde = 00000000
[4294715.961000] Oops: 0002 [#1]
[4294715.961000] PREEMPT
[4294715.961000] Modules linked in: irtty_sir sir_dev radeon drm speedstep_centrino cpufreq_userspace cpufreq_stats freq_table cpufreq_powersave cpufreq_ondemand cpufreq_conservative video tc1100_wmi sony_acpi pcc_acpi hotkey dev_acpi container button acpi_sbs battery i2c_acpi_ec i2c_core ac irda crc_ccitt nls_utf8 ntfs ipv6 dm_mod md_mod lp af_packet pcmcia sdhci joydev tsdev mmc_core parport_pc parport pcspkr tpm_infineon tpm rtc yenta_socket rsrc_nonstatic pcmcia_core ipw2200 tg3 ieee80211 ieee80211_crypt snd_intel8x0 snd_ac97_codec snd_ac97_bus snd_pcm_oss snd_mixer_oss snd_pcm snd_timer psmouse serio_raw snd soundcore intel_agp agpgart shpchp pci_hotplug snd_page_alloc evdev ext3 jbd ide_generic ehci_hcd uhci_hcd usbcore ide_cd cdrom ide_disk piix generic thermal processor fan capability commoncap vga16fb vgastate fbcon tileblit font bitblit softcurs or
[4294715.961000] CPU:    0
[4294715.961000] EIP:    0060:[<c013112f>]    Not tainted VLI
[4294715.961000] EFLAGS: 00010002   (2.6.15-23-386)
[4294715.961000] EIP is at finish_wait+0x2f/0x70
[4294715.961000 ] eax: d9e40000   ebx: 00000286   ecx: 00000000   edx: 00000000
[4294715.961000] esi: d9e41fd8   edi: d9e41fcc   ebp: 00000000   esp: d9e41fbc
[4294715.961000] ds: 007b   es: 007b   ss: 0068
[4294715.961000] Process kIrDAd (pid: 4776, threadinfo=d9e40000 task=d8d5da70)
[4294715.961000] Stack: d9e40000 00000000 00000000 e0d9a840 00000000 d8d5da70 c0118940 00000000
[4294715.961000]        00000000 e0d9a790 00000000 c0101385 d84ddf98 00000000 00000000 ffffffff
[4294715.961000]        ffffffff
[4294715.961000] Call Trace:
[4294715.961000]  [<e0d9a840>] irda_thread+0xb0/0xf0 [sir_dev]
[4294715.961000]  [<c0118940>] default_wake_function+0x0/0x20
[4294715.961000]  [<e0d9a790>] irda_thread+0x0/0xf0 [sir_dev]
[4294715.961000]  [<c0101385>] kernel_thread_helper+0x5/0x10
[4294715.961000] Code: d7 b8 00 e0 ff ff 21 e0 8b 00 c7 00 00 00 00 00 8d 72 0c 3b 72 0c 74 34 9c 5b fa b8 00 e0 ff ff 21 e0 ff 40 14 8b 4f 0c 8b 56 04 <89> 51 04 89 0a 89 77 0c 89 76 04 53 9d ff 48 14 8b 40 08 a8 08
[4294715.961000]  <6>note: kIrDAd[4776] exited with preempt_count 1
[4294716.892000] irlap_change_speed(), setting speed to 9600
[4294721.938000] Bluetooth: Core ver 2.8
[4294721.938000] NET: Registered protocol family 31
[4294721.938000] Bluetooth: HCI device and connection manager initialized
[4294721.938000] Bluetooth: HCI socket layer initialized
[4294721.977000] Bluetooth: L2CAP ver 2.8
[4294721.977000] Bluetooth: L2CAP socket layer initialized
[4294722.002000] Bluetooth: RFCOMM socket layer initialized
[4294722.002000] Bluetooth: RFCOMM TTY layer initialized
[4294722.002000] Bluetooth: RFCOMM ver 1.7
[4294759.761000] NET: Registered protocol family 4
[4294759.827000] NET: Registered protocol family 3
[4294759.900000] NET: Registered protocol family 5
 
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
irda-users mailing list
irda-users@...
http://lists.sourceforge.net/lists/listinfo/irda-users
Samuel Ortiz | 3 Sep 2006 03:14

Re: General protection fault with aborted ircomm FIR connection

Hi,

On Wed, Aug 30, 2006 at 01:15:34AM +0200, Carl-Daniel Hailfinger wrote:
> Hi,
> 
> first of all, no proprietary modules have ever been loaded. The "Tainted"
> refers to "SUSE unsupported" modules. Machine is a Samsung P35 laptop (x86).
> Kernel is 2.6.16.21 with SUSE patches (which don't touch IRDA afaics).
> FIR chipset is served by nsc-ircc dongle_id=0x08.
> 
> The crash happened when I used gammu to connect to my nokia mobile phone
> over /dev/ircomm0. I moved the phone out of the IR beam by accident and
> then killed gammu with Ctrl-C while it still had the connection open.
> At that moment, the kernel spewed a general protection fault on me.
I think I managed to reproduce (and maybe fix) this bug.
Could you please check if the following patch fixes it for you as it does
for me:

diff --git a/net/irda/af_irda.c b/net/irda/af_irda.c
index 17699ee..7b7cd5b 100644
--- a/net/irda/af_irda.c
+++ b/net/irda/af_irda.c
 <at>  <at>  -132,13 +132,14  <at>  <at>  static void irda_disconnect_indication(v

 	/* Prevent race conditions with irda_release() and irda_shutdown() */
 	if (!sock_flag(sk, SOCK_DEAD) && sk->sk_state != TCP_CLOSE) {
+		lock_sock(sk);
 		sk->sk_state     = TCP_CLOSE;
 		sk->sk_err       = ECONNRESET;
 		sk->sk_shutdown |= SEND_SHUTDOWN;

 		sk->sk_state_change(sk);
-		/* Uh-oh... Should use sock_orphan ? */
-                sock_set_flag(sk, SOCK_DEAD);
+                sock_orphan(sk);
+		release_sock(sk);

 		/* Close our TSAP.
 		 * If we leave it open, IrLMP put it back into the list of
 <at>  <at>  -1212,6 +1213,7  <at>  <at>  static int irda_release(struct socket *s
         if (sk == NULL)
 		return 0;

+	lock_sock(sk);
 	sk->sk_state       = TCP_CLOSE;
 	sk->sk_shutdown   |= SEND_SHUTDOWN;
 	sk->sk_state_change(sk);
 <at>  <at>  -1221,6 +1223,7  <at>  <at>  static int irda_release(struct socket *s

 	sock_orphan(sk);
 	sock->sk   = NULL;
+	release_sock(sk);

 	/* Purge queues (see sock_init_data()) */
 	skb_queue_purge(&sk->sk_receive_queue);
 <at>  <at>  -1353,6 +1356,7  <at>  <at>  static int irda_recvmsg_dgram(struct kio
 	IRDA_DEBUG(4, "%s()\n", __FUNCTION__);

 	IRDA_ASSERT(self != NULL, return -1;);
+	IRDA_ASSERT(!sock_error(sk), return -1;);

 	skb = skb_recv_datagram(sk, flags & ~MSG_DONTWAIT,
 				flags & MSG_DONTWAIT, &err);
 <at>  <at>  -1405,6 +1409,7  <at>  <at>  static int irda_recvmsg_stream(struct ki
 	IRDA_DEBUG(3, "%s()\n", __FUNCTION__);

 	IRDA_ASSERT(self != NULL, return -1;);
+	IRDA_ASSERT(!sock_error(sk), return -1;);

 	if (sock->flags & __SO_ACCEPTCON)
 		return(-EINVAL);

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
Hariett Jones | 6 Sep 2006 17:02
Picon
Favicon

HP LaserJet 6P - cant detect it

Hello,
        I looked in lots of places to learn how to print via IR port under linux, but 
didnt succeed. I've managed to load modules 
(ircomm_tty,ircomm,irtty_sir,sir_dev,irda), to irattach /dev/ttyS1, to have 
ifconfig irda0 up and irdadump. But although my printer or cellphone are 5cm 
from my laptops ir port nothing happens. Please tell me what may be the 
issue !

        Here is my system's description :
                -slackware 10.2
                -kernel 2.6.16.18
                -laptop is Acer TravelMate 4400
                -HP LaserJet 6P printer
        
        irdadump produces following :
14:59:11.165359 xid:cmd b20bb9d1 > ffffffff S=6 s=* pink hint=0400 [ 
Computer ] (20)
14:59:13.205562 xid:cmd b20bb9d1 > ffffffff S=6 s=0 (14)
14:59:13.365557 xid:cmd b20bb9d1 > ffffffff S=6 s=1 (14)
14:59:13.525562 xid:cmd b20bb9d1 > ffffffff S=6 s=2 (14)
14:59:13.685518 xid:cmd b20bb9d1 > ffffffff S=6 s=3 (14)
14:59:13.845527 xid:cmd b20bb9d1 > ffffffff S=6 s=4 (14)
14:59:14.005538 xid:cmd b20bb9d1 > ffffffff S=6 s=5 (14)
14:59:14.165549 xid:cmd b20bb9d1 > ffffffff S=6 s=* pink hint=0400 [ 
Computer ] (20)

and it goes forever this way.

Please help.

----------------------------------------------------
Interaktywna wystawa HI-TECH z Tokio ODKRYWANIE CZASU 
nauka, eksperyment, zabawa -> Warszawa, Pałac Kultury i Nauki
do 29.11.2006 wspaniała rozrywka dla całej rodziny!
http://klik.wp.pl/?adr=http%3A%2F%2Fadv.reklama.wp.pl%2Fas%2Fczas.html&sid=865

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
Samuel Ortiz | 7 Sep 2006 05:29

Error linking 2.6.17 with irda

----- Forwarded message from
irda-users-owner@... -----
Hi All,

I'm attempting to build the latest code from Linus' git tree and I'm getting 
the following error during linking.

LD      .tmp_vmlinux1
drivers/built-in.o: In function `stir421x_patch_device':
drivers/net/irda/irda-usb.c:1103: undefined reference to `request_firmware'
drivers/net/irda/irda-usb.c:1159: undefined reference to `release_firmware'
make: *** [.tmp_vmlinux1] Error 1

My .config is located  <at>  http://vranix.com/configs/config.linus-git

Any ideas?

Thanks,
Shaw

From: irda-users-request@...
Subject: confirm e94ba9679af07d18ee7ed673ca445dd509d7e4b6

If you reply to this message, keeping the Subject: header intact,
Mailman will discard the held message.  Do this if the message is
spam.  If you reply to this message and include an Approved: header
with the list password in it, the message will be approved for posting
to the list.  The Approved: header can also appear in the first line
of the body of the reply.

----- End forwarded message -----

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
Samuel Ortiz | 7 Sep 2006 05:38

Re: Error linking 2.6.17 with irda

On Thu, Sep 07, 2006 at 06:29:32AM +0300, Samuel Ortiz wrote:
> ----- Forwarded message from
irda-users-owner@... -----
> Hi All,
> 
> I'm attempting to build the latest code from Linus' git tree and I'm getting 
> the following error during linking.
> 
> LD      .tmp_vmlinux1
> drivers/built-in.o: In function `stir421x_patch_device':
> drivers/net/irda/irda-usb.c:1103: undefined reference to `request_firmware'
> drivers/net/irda/irda-usb.c:1159: undefined reference to `release_firmware'
> make: *** [.tmp_vmlinux1] Error 1
> 
> My .config is located  <at>  http://vranix.com/configs/config.linus-git
CONFIG_FW_LOADER=m and CONFIG_USB_IRDA=y is the problem. When you build
your irda-usb module, the firware loader code is not built yet.
It's a driver bug, and it will be fixed, but you can fix it by compiling
the firmware loader in kernel:
CONFIG_FW_LOADER=y

Cheers,
Samuel.

> 
> Any ideas?
> 
> Thanks,
> Shaw
> 
> 
> From: irda-users-request@...
> Subject: confirm e94ba9679af07d18ee7ed673ca445dd509d7e4b6
> 
> If you reply to this message, keeping the Subject: header intact,
> Mailman will discard the held message.  Do this if the message is
> spam.  If you reply to this message and include an Approved: header
> with the list password in it, the message will be approved for posting
> to the list.  The Approved: header can also appear in the first line
> of the body of the reply.
> 
> ----- End forwarded message -----
> 
> -------------------------------------------------------------------------
> Using Tomcat but need to do more? Need to support web services, security?
> Get stuff done quickly with pre-integrated technology to make your job easier
> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> _______________________________________________
> irda-users mailing list
> irda-users@...
> http://lists.sourceforge.net/lists/listinfo/irda-users

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
surfzoid surfzoid | 7 Sep 2006 21:37
Picon
Favicon

*** buffer overflow detected ***: irdadump terminated

hi
first of all i m a poor frenchi and so my english is
poor to, so sory by advance.
There 1 or two YEAR i try to get my picture on my phone
with my linux distrib (mandriva 2006 and the last
Kubuntu) whit a STIR4200 usb dongle.
My phone is a mitsubichi M341i with MT170 Modem and
obex capability.
I try so many soft to communicate with my phone and
finaly the two best was Wammu/gammu but only AT command
works great, Kbeam work wonderfull to get/put file with
my memory phone but as the same as windoze it s one by
one and directly with the phone software.
So i try to use obexftp, first with command line only
and one time not succesfull :
I have good connection to my phone (kbeam icon was
blue) and ability to put file on my phone with the cmd :
obexftp -i -p myfile.test
i see in the irdadump debug windows evrything is good,
but when i try, the more important for me, to list the
directory with :
obexftp -i -l /
irdadump write a "*** buffer overflow detected ***:
irdadump terminated"
Complete debug here :
19:18:04.165483 xid:rsp 51b83f65 < 3604993f S=6 s=4
MT170 hint=9024 [ Modem IrCOMM IrOBEX ] (22)
19:18:04.183005 xid:cmd 51b83f65 > ffffffff S=6 s=5 (14)
19:18:04.282992 xid:cmd 51b83f65 > ffffffff S=6 s=*
surfzoid-PC hint=c420 [ Computer LAN Access IrOBEX ] (28)
19:18:04.703088 snrm:cmd ca=fe pf=1 51b83f65 > 3604993f
new-ca=f2
LAP QoS: Baud Rate=19200bps Max Turn Time=500ms
Data Size=2048B Window Size=7 Add BOFS=0 Min Turn
Time=10us Link Disc=12s (32)
19:18:04.811380 ua:rsp ca=f2 pf=1 51b83f65 < 3604993f
LAP QoS: Baud Rate=19200bps Max Turn Time=500ms
Data Size=256B Window Size=1 Add BOFS=0 Min Turn
Time=10000us Link Disc=12s (31)
19:18:04.811914 rr:cmd > ca=f2 pf=1 nr=0 (2)
19:18:04.846372 rr:rsp < ca=f2 pf=1 nr=0 (2)
19:18:04.846398 i:cmd > ca=f2 pf=1 nr=0 ns=0 LM
slsap=2d dlsap=00 CONN_CMD (6)
19:18:04.876368 i:rsp < ca=f2 pf=1 nr=1 ns=0 LM
slsap=00 dlsap=2d CONN_RSP (6)
19:18:04.876399 i:cmd > ca=f2 pf=1 nr=1 ns=1 LM
slsap=2d dlsap=00 GET_VALUE_BY_CLASS: "OBEX"
"IrDA:TinyTP:LsapSel" (30)
19:18:04.922362 i:rsp < ca=f2 pf=1 nr=2 ns=1 LM
slsap=00 dlsap=2d GET_VALUE_BY_CLASS: Success Integer:
05 (15)
19:18:04.922404 i:cmd > ca=f2 pf=1 nr=2 ns=2 LM
slsap=2d dlsap=00 DISC (6)
19:18:04.952354 rr:rsp < ca=f2 pf=1 nr=3 (2)
19:18:04.952389 i:cmd > ca=f2 pf=1 nr=2 ns=3 LM
slsap=2e dlsap=05 CONN_CMD TTP credits=16 (7)
19:18:04.982350 i:rsp < ca=f2 pf=1 nr=4 ns=2 LM
slsap=05 dlsap=2e CONN_RSP TTP credits=1 (7)
19:18:04.982380 rr:cmd > ca=f2 pf=1 nr=3 (2)
19:18:05.007349 rr:rsp < ca=f2 pf=1 nr=4 (2)
19:18:05.007381 i:cmd > ca=f2 pf=1 nr=3 ns=4 LM
slsap=2e dlsap=05 TTP credits=0
OBEX CONNECT len=26 (31)
*** buffer overflow detected ***: irdadump terminated
======= Backtrace: =========
/lib/i686/libc.so.6(__chk_fail+0x41)[0xb7eb6c41]
irdadump[0x804c8be]
irdadump[0x804d1d1]
irdadump[0x804c282]
irdadump[0x804ab05]
irdadump[0x804b81d]
irdadump[0x8048f86]
/lib/i686/libc.so.6(__libc_start_main+0xdc)[0xb7dee75c]
irdadump[0x8048b11]
======= Memory map: ========
08048000-08050000 r-xp 00000000 08:07 784704
/usr/bin/irdadump
08050000-08051000 rw-p 00007000 08:07 784704
/usr/bin/irdadump
08051000-08072000 rw-p 08051000 00:00 0 [heap]
b7d83000-b7d8d000 r-xp 00000000 08:07 1974804
/lib/libgcc_s-4.0.1.so.1
b7d8d000-b7d8e000 rw-p 00009000 08:07 1974804
/lib/libgcc_s-4.0.1.so.1
b7dbb000-b7dbd000 rw-p b7dbb000 00:00 0
b7dbd000-b7dcc000 r-xp 00000000 08:07 1980802
/lib/i686/libpthread-2.4.so
b7dcc000-b7dce000 rw-p 0000e000 08:07 1980802
/lib/i686/libpthread-2.4.so
b7dce000-b7dd0000 rw-p b7dce000 00:00 0
b7dd0000-b7dd7000 r-xp 00000000 08:07 1980803
/lib/i686/librt-2.4.so
b7dd7000-b7dd9000 rw-p 00006000 08:07 1980803
/lib/i686/librt-2.4.so
b7dd9000-b7f00000 r-xp 00000000 08:07 1981262
/lib/i686/libc-2.4.so
b7f00000-b7f01000 r--p 00126000 08:07 1981262
/lib/i686/libc-2.4.so
b7f01000-b7f03000 rw-p 00127000 08:07 1981262
/lib/i686/libc-2.4.so
b7f03000-b7f06000 rw-p b7f03000 00:00 0
b7f06000-b7fa1000 r-xp 00000000 08:07 783488
/usr/lib/libglib-2.0.so.0.1200.3
b7fa1000-b7fa2000 rw-p 0009b000 08:07 783488
/usr/lib/libglib-2.0.so.0.1200.3
b7fce000-b7fd0000 rw-p b7fce000 00:00 0
b7fd0000-b7fe8000 r-xp 00000000 08:07 1974731
/lib/ld-2.4.so
b7fe8000-b7fe9000 r--p 00017000 08:07 1974731
/lib/ld-2.4.so
b7fe9000-b7fea000 rw-p 00018000 08:07 1974731
/lib/ld-2.4.so
bfdd3000-bfde8000 rw-p bfdd3000 00:00 0 [stack]
ffffe000-fffff000 ---p 00000000 00:00 0 [vdso]
Abandon
[root <at> surfzoid-PC obextool]#

I find on the web my phone have not a standart AT
command to put it in connect mode, it use AT+CPROT=0
but kbeam work with obex and it was good so it s a
little "mysterioius" lol

_________________________________________________________________
Découvrez Windows Live Messenger : le futur de MSN Messenger ! 
www.windowslivemessenger.fr

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
Samuel Ortiz | 11 Sep 2006 07:46

[PATCH 1/3] [IrDA] af_irda.c cleanups

Hi Dave,

We lock the socket when both releasing and getting a disconnected
notification. In the latter case, we also ste the socket as orphan.
This fixes a potential kernel bug that can be triggered when we get the
disconnection notification before closing the socket.

Signed-off-by: Samuel Ortiz <samuel <at> sortiz.org>
---
 net/irda/af_irda.c |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/net/irda/af_irda.c b/net/irda/af_irda.c
index 17699ee..7b7cd5b 100644
--- a/net/irda/af_irda.c
+++ b/net/irda/af_irda.c
 <at>  <at>  -132,13 +132,14  <at>  <at>  static void irda_disconnect_indication(v

 	/* Prevent race conditions with irda_release() and irda_shutdown() */
 	if (!sock_flag(sk, SOCK_DEAD) && sk->sk_state != TCP_CLOSE) {
+		lock_sock(sk);
 		sk->sk_state     = TCP_CLOSE;
 		sk->sk_err       = ECONNRESET;
 		sk->sk_shutdown |= SEND_SHUTDOWN;

 		sk->sk_state_change(sk);
-		/* Uh-oh... Should use sock_orphan ? */
-                sock_set_flag(sk, SOCK_DEAD);
+                sock_orphan(sk);
+		release_sock(sk);

 		/* Close our TSAP.
 		 * If we leave it open, IrLMP put it back into the list of
 <at>  <at>  -1212,6 +1213,7  <at>  <at>  static int irda_release(struct socket *s
         if (sk == NULL)
 		return 0;

+	lock_sock(sk);
 	sk->sk_state       = TCP_CLOSE;
 	sk->sk_shutdown   |= SEND_SHUTDOWN;
 	sk->sk_state_change(sk);
 <at>  <at>  -1221,6 +1223,7  <at>  <at>  static int irda_release(struct socket *s

 	sock_orphan(sk);
 	sock->sk   = NULL;
+	release_sock(sk);

 	/* Purge queues (see sock_init_data()) */
 	skb_queue_purge(&sk->sk_receive_queue);
 <at>  <at>  -1353,6 +1356,7  <at>  <at>  static int irda_recvmsg_dgram(struct kio
 	IRDA_DEBUG(4, "%s()\n", __FUNCTION__);

 	IRDA_ASSERT(self != NULL, return -1;);
+	IRDA_ASSERT(!sock_error(sk), return -1;);

 	skb = skb_recv_datagram(sk, flags & ~MSG_DONTWAIT,
 				flags & MSG_DONTWAIT, &err);
 <at>  <at>  -1405,6 +1409,7  <at>  <at>  static int irda_recvmsg_stream(struct ki
 	IRDA_DEBUG(3, "%s()\n", __FUNCTION__);

 	IRDA_ASSERT(self != NULL, return -1;);
+	IRDA_ASSERT(!sock_error(sk), return -1;);

 	if (sock->flags & __SO_ACCEPTCON)
 		return(-EINVAL);
--

-- 
1.4.1.1

-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo <at> vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Samuel Ortiz | 11 Sep 2006 07:46

[PATCH 2/3] [IrDA] irda-usb needs firmware loader

With the inclusion of the stir421x code, we now need to select FW_LOADER
whenever we try to build the irda-usb code.

Signed-off-by: Samuel Ortiz <samuel <at> sortiz.org>
---
 drivers/net/irda/Kconfig |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/drivers/net/irda/Kconfig b/drivers/net/irda/Kconfig
index e9e6d99..7c8ccc0 100644
--- a/drivers/net/irda/Kconfig
+++ b/drivers/net/irda/Kconfig
 <at>  <at>  -287,6 +287,7  <at>  <at>  comment "FIR device drivers"
 config USB_IRDA
 	tristate "IrDA USB dongles"
 	depends on IRDA && USB
+	select FW_LOADER
 	---help---
 	  Say Y here if you want to build support for the USB IrDA FIR Dongle
 	  device driver.  To compile it as a module, choose M here: the module
--

-- 
1.4.1.1

-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo <at> vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Samuel Ortiz | 11 Sep 2006 07:47

[PATCH 3/3] [IrDA] Memory allocations cleanups

This patch replaces the bunch of arbitrary 64 and 128 bytes alloc_skb() calls
with more accurate allocation sizes.

Signed-off-by: Samuel Ortiz <samuel <at> sortiz.org>
---
 include/net/irda/irlan_common.h |   10 ++++++-
 include/net/irda/irlap_frame.h  |   31 +++++++++++++++++++-
 include/net/irda/irlmp.h        |    2 +
 net/irda/af_irda.c              |    3 +-
 net/irda/ircomm/ircomm_lmp.c    |    4 +--
 net/irda/iriap.c                |    9 +++---
 net/irda/iriap_event.c          |    2 +
 net/irda/irlan/irlan_common.c   |   46 ++++++++++++++++++++++++------
 net/irda/irlan/irlan_provider.c |   12 ++++++--
 net/irda/irlap_frame.c          |   59 +++++++++++++++++++++------------------
 net/irda/irlmp.c                |    2 +
 net/irda/irttp.c                |   14 +++++----
 12 files changed, 136 insertions(+), 58 deletions(-)

diff --git a/include/net/irda/irlan_common.h b/include/net/irda/irlan_common.h
index 1c73bdb..9592c37 100644
--- a/include/net/irda/irlan_common.h
+++ b/include/net/irda/irlan_common.h
 <at>  <at>  -98,7 +98,15  <at>  <at>  #define IRLAN_BYTE   0
 #define IRLAN_SHORT  1
 #define IRLAN_ARRAY  2

-#define IRLAN_MAX_HEADER (TTP_HEADER+LMP_HEADER+LAP_MAX_HEADER)
+/* IrLAN sits on top if IrTTP */
+#define IRLAN_MAX_HEADER (TTP_HEADER+LMP_HEADER)
+/* 1 byte for the command code and 1 byte for the parameter count */
+#define IRLAN_CMD_HEADER 2
+
+#define IRLAN_STRING_PARAMETER_LEN(name, value) (1 + strlen((name)) + 2 \
+						+ strlen ((value)))
+#define IRLAN_BYTE_PARAMETER_LEN(name)          (1 + strlen((name)) + 2 + 1)
+#define IRLAN_SHORT_PARAMETER_LEN(name)         (1 + strlen((name)) + 2 + 2)

 /*
  *  IrLAN client
diff --git a/include/net/irda/irlap_frame.h b/include/net/irda/irlap_frame.h
index 3452ae2..9dd54a5 100644
--- a/include/net/irda/irlap_frame.h
+++ b/include/net/irda/irlap_frame.h
 <at>  <at>  -74,6 +74,19  <at>  <at>  #define RSP_FRAME 0x00

 #define PF_BIT    0x10 /* Poll/final bit */

+/* Some IrLAP field lengths */
+/*
+ * Only baud rate triplet is 4 bytes (PV can be 2 bytes).
+ * All others params (7) are 3 bytes, so that's 7*3 + 1*4 bytes.
+ */
+#define IRLAP_NEGOCIATION_PARAMS_LEN 25
+#define IRLAP_DISCOVERY_INFO_LEN     32
+
+struct disc_frame {
+	__u8 caddr;          /* Connection address */
+	__u8 control;
+} IRDA_PACK;
+
 struct xid_frame {
 	__u8  caddr; /* Connection address */
 	__u8  control;
 <at>  <at>  -95,11 +108,25  <at>  <at>  struct test_frame {
 struct ua_frame {
 	__u8 caddr;
 	__u8 control;
-
 	__u32 saddr; /* Source device address */
 	__u32 daddr; /* Dest device address */
 } IRDA_PACK;
-	
+
+struct dm_frame {
+	__u8 caddr;          /* Connection address */
+	__u8 control;
+} IRDA_PACK;
+
+struct rd_frame {
+	__u8 caddr;          /* Connection address */
+	__u8 control;
+} IRDA_PACK;
+
+struct rr_frame {
+	__u8 caddr;          /* Connection address */
+	__u8 control;
+} IRDA_PACK;
+
 struct i_frame {
 	__u8 caddr;
 	__u8 control;
diff --git a/include/net/irda/irlmp.h b/include/net/irda/irlmp.h
index 11ecfa5..e212b9b 100644
--- a/include/net/irda/irlmp.h
+++ b/include/net/irda/irlmp.h
 <at>  <at>  -48,7 +48,7  <at>  <at>  #define LSAP_CONNLESS 0x70 /* Connection
 #define DEV_ADDR_ANY  0xffffffff

 #define LMP_HEADER          2    /* Dest LSAP + Source LSAP */
-#define LMP_CONTROL_HEADER  4
+#define LMP_CONTROL_HEADER  4    /* LMP_HEADER + opcode + parameter */
 #define LMP_PID_HEADER      1    /* Used by Ultra */
 #define LMP_MAX_HEADER      (LMP_CONTROL_HEADER+LAP_MAX_HEADER)

diff --git a/net/irda/af_irda.c b/net/irda/af_irda.c
index 7b7cd5b..7e1aea8 100644
--- a/net/irda/af_irda.c
+++ b/net/irda/af_irda.c
 <at>  <at>  -309,7 +309,8  <at>  <at>  static void irda_connect_response(struct

 	IRDA_ASSERT(self != NULL, return;);

-	skb = alloc_skb(64, GFP_ATOMIC);
+	skb = alloc_skb(TTP_MAX_HEADER + TTP_SAR_HEADER,
+			GFP_ATOMIC);
 	if (skb == NULL) {
 		IRDA_DEBUG(0, "%s() Unable to allocate sk_buff!\n",
 			   __FUNCTION__);
diff --git a/net/irda/ircomm/ircomm_lmp.c b/net/irda/ircomm/ircomm_lmp.c
index 959874b..c8e0d89 100644
--- a/net/irda/ircomm/ircomm_lmp.c
+++ b/net/irda/ircomm/ircomm_lmp.c
 <at>  <at>  -81,7 +81,7  <at>  <at>  static int ircomm_lmp_connect_response(s
 	
 	/* Any userdata supplied? */
 	if (userdata == NULL) {
-		tx_skb = alloc_skb(64, GFP_ATOMIC);
+		tx_skb = alloc_skb(LMP_MAX_HEADER, GFP_ATOMIC);
 		if (!tx_skb)
 			return -ENOMEM;

 <at>  <at>  -115,7 +115,7  <at>  <at>  static int ircomm_lmp_disconnect_request
 	IRDA_DEBUG(0, "%s()\n", __FUNCTION__ );

         if (!userdata) {
-		tx_skb = alloc_skb(64, GFP_ATOMIC);
+		tx_skb = alloc_skb(LMP_MAX_HEADER, GFP_ATOMIC);
 		if (!tx_skb)
 			return -ENOMEM;
 		
diff --git a/net/irda/iriap.c b/net/irda/iriap.c
index 61128aa..415cf4e 100644
--- a/net/irda/iriap.c
+++ b/net/irda/iriap.c
 <at>  <at>  -345,10 +345,11  <at>  <at>  static void iriap_disconnect_request(str
 	IRDA_ASSERT(self != NULL, return;);
 	IRDA_ASSERT(self->magic == IAS_MAGIC, return;);

-	tx_skb = alloc_skb(64, GFP_ATOMIC);
+	tx_skb = alloc_skb(LMP_MAX_HEADER, GFP_ATOMIC);
 	if (tx_skb == NULL) {
-		IRDA_DEBUG(0, "%s(), Could not allocate an sk_buff of length %d\n", 
-			__FUNCTION__, 64);
+		IRDA_DEBUG(0,
+			   "%s(), Could not allocate an sk_buff of length %d\n",
+			   __FUNCTION__, LMP_MAX_HEADER);
 		return;
 	}

 <at>  <at>  -701,7 +702,7  <at>  <at>  void iriap_send_ack(struct iriap_cb *sel
 	IRDA_ASSERT(self != NULL, return;);
 	IRDA_ASSERT(self->magic == IAS_MAGIC, return;);

-	tx_skb = alloc_skb(64, GFP_ATOMIC);
+	tx_skb = alloc_skb(LMP_MAX_HEADER + 1, GFP_ATOMIC);
 	if (!tx_skb)
 		return;

diff --git a/net/irda/iriap_event.c b/net/irda/iriap_event.c
index da17395..99b18dc 100644
--- a/net/irda/iriap_event.c
+++ b/net/irda/iriap_event.c
 <at>  <at>  -365,7 +365,7  <at>  <at>  static void state_r_disconnect(struct ir

 	switch (event) {
 	case IAP_LM_CONNECT_INDICATION:
-		tx_skb = alloc_skb(64, GFP_ATOMIC);
+		tx_skb = alloc_skb(LMP_MAX_HEADER, GFP_ATOMIC);
 		if (tx_skb == NULL) {
 			IRDA_WARNING("%s: unable to malloc!\n", __FUNCTION__);
 			return;
diff --git a/net/irda/irlan/irlan_common.c b/net/irda/irlan/irlan_common.c
index 7dd0a2f..9b962f2 100644
--- a/net/irda/irlan/irlan_common.c
+++ b/net/irda/irlan/irlan_common.c
 <at>  <at>  -636,7 +636,8  <at>  <at>  void irlan_get_provider_info(struct irla
 	IRDA_ASSERT(self != NULL, return;);
 	IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;);

-	skb = alloc_skb(64, GFP_ATOMIC);
+	skb = alloc_skb(IRLAN_MAX_HEADER + IRLAN_CMD_HEADER,
+			GFP_ATOMIC);
 	if (!skb)
 		return;

 <at>  <at>  -668,7 +669,10  <at>  <at>  void irlan_open_data_channel(struct irla
 	IRDA_ASSERT(self != NULL, return;);
 	IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;);
 	
-	skb = alloc_skb(64, GFP_ATOMIC);
+	skb = alloc_skb(IRLAN_MAX_HEADER + IRLAN_CMD_HEADER +
+			IRLAN_STRING_PARAMETER_LEN("MEDIA", "802.3") +
+			IRLAN_STRING_PARAMETER_LEN("ACCESS_TYPE", "DIRECT"),
+			GFP_ATOMIC);
 	if (!skb)
 		return;

 <at>  <at>  -704,7 +708,9  <at>  <at>  void irlan_close_data_channel(struct irl
 	if (self->client.tsap_ctrl == NULL)
 		return;

-	skb = alloc_skb(64, GFP_ATOMIC);
+	skb = alloc_skb(IRLAN_MAX_HEADER + IRLAN_CMD_HEADER +
+			IRLAN_BYTE_PARAMETER_LEN("DATA_CHAN"),
+			GFP_ATOMIC);
 	if (!skb)
 		return;

 <at>  <at>  -715,7 +721,7  <at>  <at>  void irlan_close_data_channel(struct irl
 	
 	/* Build frame */
  	frame[0] = CMD_CLOSE_DATA_CHAN;
-	frame[1] = 0x01; /* Two parameters */
+	frame[1] = 0x01; /* One parameter */

 	irlan_insert_byte_param(skb, "DATA_CHAN", self->dtsap_sel_data);

 <at>  <at>  -739,7 +745,11  <at>  <at>  static void irlan_open_unicast_addr(stru
 	IRDA_ASSERT(self != NULL, return;);
 	IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;);	
 	
-	skb = alloc_skb(128, GFP_ATOMIC);
+	skb = alloc_skb(IRLAN_MAX_HEADER + IRLAN_CMD_HEADER +
+			IRLAN_BYTE_PARAMETER_LEN("DATA_CHAN") +
+			IRLAN_STRING_PARAMETER_LEN("FILTER_TYPE", "DIRECTED") +
+			IRLAN_STRING_PARAMETER_LEN("FILTER_MODE", "FILTER"),
+			GFP_ATOMIC);
 	if (!skb)
 		return;

 <at>  <at>  -777,7 +787,12  <at>  <at>  void irlan_set_broadcast_filter(struct i
 	IRDA_ASSERT(self != NULL, return;);
 	IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;);
 	
- 	skb = alloc_skb(128, GFP_ATOMIC);
+ 	skb = alloc_skb(IRLAN_MAX_HEADER + IRLAN_CMD_HEADER +
+			IRLAN_BYTE_PARAMETER_LEN("DATA_CHAN") +
+			IRLAN_STRING_PARAMETER_LEN("FILTER_TYPE", "BROADCAST") +
+			/* We may waste one byte here...*/
+			IRLAN_STRING_PARAMETER_LEN("FILTER_MODE", "FILTER"),
+			GFP_ATOMIC);
 	if (!skb)
 		return;

 <at>  <at>  -816,7 +831,12  <at>  <at>  void irlan_set_multicast_filter(struct i
 	IRDA_ASSERT(self != NULL, return;);
 	IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;);

- 	skb = alloc_skb(128, GFP_ATOMIC);
+	skb = alloc_skb(IRLAN_MAX_HEADER + IRLAN_CMD_HEADER +
+			IRLAN_BYTE_PARAMETER_LEN("DATA_CHAN") +
+			IRLAN_STRING_PARAMETER_LEN("FILTER_TYPE", "MULTICAST") +
+			/* We may waste one byte here...*/
+			IRLAN_STRING_PARAMETER_LEN("FILTER_MODE", "NONE"),
+			GFP_ATOMIC);
 	if (!skb)
 		return;
 	
 <at>  <at>  -856,7 +876,12  <at>  <at>  static void irlan_get_unicast_addr(struc
 	IRDA_ASSERT(self != NULL, return;);
 	IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;);
 	
-	skb = alloc_skb(128, GFP_ATOMIC);
+	skb = alloc_skb(IRLAN_MAX_HEADER + IRLAN_CMD_HEADER +
+			IRLAN_BYTE_PARAMETER_LEN("DATA_CHAN") +
+			IRLAN_STRING_PARAMETER_LEN("FILTER_TYPE", "DIRECTED") +
+			IRLAN_STRING_PARAMETER_LEN("FILTER_OPERATION",
+						   "DYNAMIC"),
+			GFP_ATOMIC);
 	if (!skb)
 		return;

 <at>  <at>  -891,7 +916,10  <at>  <at>  void irlan_get_media_char(struct irlan_c
 	IRDA_ASSERT(self != NULL, return;);
 	IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;);
 	
-	skb = alloc_skb(64, GFP_ATOMIC);
+	skb = alloc_skb(IRLAN_MAX_HEADER + IRLAN_CMD_HEADER +
+			IRLAN_STRING_PARAMETER_LEN("MEDIA", "802.3"),
+			GFP_ATOMIC);
+
 	if (!skb)
 		return;

diff --git a/net/irda/irlan/irlan_provider.c b/net/irda/irlan/irlan_provider.c
index 9c0df86..58efde9 100644
--- a/net/irda/irlan/irlan_provider.c
+++ b/net/irda/irlan/irlan_provider.c
 <at>  <at>  -296,7 +296,14  <at>  <at>  void irlan_provider_send_reply(struct ir
 	IRDA_ASSERT(self != NULL, return;);
 	IRDA_ASSERT(self->magic == IRLAN_MAGIC, return;);

-	skb = alloc_skb(128, GFP_ATOMIC);
+	skb = alloc_skb(IRLAN_MAX_HEADER + IRLAN_CMD_HEADER +
+			/* Bigger param length comes from CMD_GET_MEDIA_CHAR */
+			IRLAN_STRING_PARAMETER_LEN("FILTER_TYPE", "DIRECTED") +
+			IRLAN_STRING_PARAMETER_LEN("FILTER_TYPE", "BORADCAST") +
+			IRLAN_STRING_PARAMETER_LEN("FILTER_TYPE", "MULTICAST") +
+			IRLAN_STRING_PARAMETER_LEN("ACCESS_TYPE", "HOSTED"),
+			GFP_ATOMIC);
+
 	if (!skb)
 		return;

 <at>  <at>  -354,8 +361,7  <at>  <at>  void irlan_provider_send_reply(struct ir
 		} else
 			skb->data[1] = 0x02; /* 2 parameters */
 		irlan_insert_byte_param(skb, "DATA_CHAN", self->stsap_sel_data);
-		irlan_insert_array_param(skb, "RECONNECT_KEY", "LINUX RULES!",
-					 12);
+		irlan_insert_string_param(skb, "RECONNECT_KEY", "LINUX RULES!");
 		break;
 	case CMD_FILTER_OPERATION:
 		irlan_filter_request(self, skb);
diff --git a/net/irda/irlap_frame.c b/net/irda/irlap_frame.c
index ccb983b..dba349c 100644
--- a/net/irda/irlap_frame.c
+++ b/net/irda/irlap_frame.c
 <at>  <at>  -117,7 +117,9  <at>  <at>  void irlap_send_snrm_frame(struct irlap_
 	IRDA_ASSERT(self->magic == LAP_MAGIC, return;);

 	/* Allocate frame */
-	tx_skb = alloc_skb(64, GFP_ATOMIC);
+	tx_skb = alloc_skb(sizeof(struct snrm_frame) +
+			   IRLAP_NEGOCIATION_PARAMS_LEN,
+			   GFP_ATOMIC);
 	if (!tx_skb)
 		return;

 <at>  <at>  -136,7 +138,7  <at>  <at>  void irlap_send_snrm_frame(struct irlap_
 	 *  If we are establishing a connection then insert QoS paramerters
 	 */
 	if (qos) {
-		skb_put(tx_skb, 9); /* 21 left */
+		skb_put(tx_skb, 9); /* 25 left */
 		frame->saddr = cpu_to_le32(self->saddr);
 		frame->daddr = cpu_to_le32(self->daddr);

 <at>  <at>  -210,7 +212,9  <at>  <at>  void irlap_send_ua_response_frame(struct
 	IRDA_ASSERT(self->magic == LAP_MAGIC, return;);

 	/* Allocate frame */
-	tx_skb = alloc_skb(64, GFP_ATOMIC);
+	tx_skb = alloc_skb(sizeof(struct ua_frame) +
+			   IRLAP_NEGOCIATION_PARAMS_LEN,
+			   GFP_ATOMIC);
 	if (!tx_skb)
 		return;

 <at>  <at>  -245,23 +249,23  <at>  <at>  void irlap_send_ua_response_frame(struct
 void irlap_send_dm_frame( struct irlap_cb *self)
 {
 	struct sk_buff *tx_skb = NULL;
-	__u8 *frame;
+	struct dm_frame *frame;

 	IRDA_ASSERT(self != NULL, return;);
 	IRDA_ASSERT(self->magic == LAP_MAGIC, return;);

-	tx_skb = alloc_skb(32, GFP_ATOMIC);
+	tx_skb = alloc_skb(sizeof(struct dm_frame), GFP_ATOMIC);
 	if (!tx_skb)
 		return;

-	frame = skb_put(tx_skb, 2);
+	frame = (struct dm_frame *)skb_put(tx_skb, 2);

 	if (self->state == LAP_NDM)
-		frame[0] = CBROADCAST;
+		frame->caddr = CBROADCAST;
 	else
-		frame[0] = self->caddr;
+		frame->caddr = self->caddr;

-	frame[1] = DM_RSP | PF_BIT;
+	frame->control = DM_RSP | PF_BIT;

 	irlap_queue_xmit(self, tx_skb);
 }
 <at>  <at>  -275,21 +279,21  <at>  <at>  void irlap_send_dm_frame( struct irlap_c
 void irlap_send_disc_frame(struct irlap_cb *self)
 {
 	struct sk_buff *tx_skb = NULL;
-	__u8 *frame;
+	struct disc_frame *frame;

 	IRDA_DEBUG(3, "%s()\n", __FUNCTION__);

 	IRDA_ASSERT(self != NULL, return;);
 	IRDA_ASSERT(self->magic == LAP_MAGIC, return;);

-	tx_skb = alloc_skb(16, GFP_ATOMIC);
+	tx_skb = alloc_skb(sizeof(struct disc_frame), GFP_ATOMIC);
 	if (!tx_skb)
 		return;

-	frame = skb_put(tx_skb, 2);
+	frame = (struct disc_frame *)skb_put(tx_skb, 2);

-	frame[0] = self->caddr | CMD_FRAME;
-	frame[1] = DISC_CMD | PF_BIT;
+	frame->caddr = self->caddr | CMD_FRAME;
+	frame->control = DISC_CMD | PF_BIT;

 	irlap_queue_xmit(self, tx_skb);
 }
 <at>  <at>  -315,7 +319,8  <at>  <at>  void irlap_send_discovery_xid_frame(stru
 	IRDA_ASSERT(self->magic == LAP_MAGIC, return;);
 	IRDA_ASSERT(discovery != NULL, return;);

-	tx_skb = alloc_skb(64, GFP_ATOMIC);
+	tx_skb = alloc_skb(sizeof(struct xid_frame) + IRLAP_DISCOVERY_INFO_LEN,
+			   GFP_ATOMIC);
 	if (!tx_skb)
 		return;

 <at>  <at>  -573,18 +578,18  <at>  <at>  static void irlap_recv_discovery_xid_cmd
 void irlap_send_rr_frame(struct irlap_cb *self, int command)
 {
 	struct sk_buff *tx_skb;
-	__u8 *frame;
+	struct rr_frame *frame;

-	tx_skb = alloc_skb(16, GFP_ATOMIC);
+	tx_skb = alloc_skb(sizeof(struct rr_frame), GFP_ATOMIC);
 	if (!tx_skb)
 		return;

-	frame = skb_put(tx_skb, 2);
+	frame = (struct rr_frame *)skb_put(tx_skb, 2);

-	frame[0] = self->caddr;
-	frame[0] |= (command) ? CMD_FRAME : 0;
+	frame->caddr = self->caddr;
+	frame->caddr |= (command) ? CMD_FRAME : 0;

-	frame[1] = RR | PF_BIT | (self->vr << 5);
+	frame->control = RR | PF_BIT | (self->vr << 5);

 	irlap_queue_xmit(self, tx_skb);
 }
 <at>  <at>  -598,16 +603,16  <at>  <at>  void irlap_send_rr_frame(struct irlap_cb
 void irlap_send_rd_frame(struct irlap_cb *self)
 {
 	struct sk_buff *tx_skb;
-	__u8 *frame;
+	struct rd_frame *frame;

-	tx_skb = alloc_skb(16, GFP_ATOMIC);
+	tx_skb = alloc_skb(sizeof(struct rd_frame), GFP_ATOMIC);
 	if (!tx_skb)
 		return;

-	frame = skb_put(tx_skb, 2);
+	frame = (struct rd_frame *)skb_put(tx_skb, 2);

-	frame[0] = self->caddr;
-	frame[1] = RD_RSP | PF_BIT;
+	frame->caddr = self->caddr;
+	frame->caddr = RD_RSP | PF_BIT;

 	irlap_queue_xmit(self, tx_skb);
 }
 <at>  <at>  -1214,7 +1219,7  <at>  <at>  void irlap_send_test_frame(struct irlap_
 	struct test_frame *frame;
 	__u8 *info;

-	tx_skb = alloc_skb(cmd->len+sizeof(struct test_frame), GFP_ATOMIC);
+	tx_skb = alloc_skb(cmd->len + sizeof(struct test_frame), GFP_ATOMIC);
 	if (!tx_skb)
 		return;

diff --git a/net/irda/irlmp.c b/net/irda/irlmp.c
index c440913..5073261 100644
--- a/net/irda/irlmp.c
+++ b/net/irda/irlmp.c
 <at>  <at>  -392,7 +392,7  <at>  <at>  int irlmp_connect_request(struct lsap_cb

 	/* Any userdata? */
 	if (tx_skb == NULL) {
-		tx_skb = alloc_skb(64, GFP_ATOMIC);
+		tx_skb = alloc_skb(LMP_MAX_HEADER, GFP_ATOMIC);
 		if (!tx_skb)
 			return -ENOMEM;

diff --git a/net/irda/irttp.c b/net/irda/irttp.c
index 42acf1c..3c2e70b 100644
--- a/net/irda/irttp.c
+++ b/net/irda/irttp.c
 <at>  <at>  -804,12 +804,12  <at>  <at>  static inline void irttp_give_credit(str
 		   self->send_credit, self->avail_credit, self->remote_credit);

 	/* Give credit to peer */
-	tx_skb = alloc_skb(64, GFP_ATOMIC);
+	tx_skb = alloc_skb(TTP_MAX_HEADER, GFP_ATOMIC);
 	if (!tx_skb)
 		return;

 	/* Reserve space for LMP, and LAP header */
-	skb_reserve(tx_skb, self->max_header_size);
+	skb_reserve(tx_skb, LMP_MAX_HEADER);

 	/*
 	 *  Since we can transmit and receive frames concurrently,
 <at>  <at>  -1093,7 +1093,8  <at>  <at>  int irttp_connect_request(struct tsap_cb

 	/* Any userdata supplied? */
 	if (userdata == NULL) {
-		tx_skb = alloc_skb(64, GFP_ATOMIC);
+		tx_skb = alloc_skb(TTP_MAX_HEADER + TTP_SAR_HEADER,
+				   GFP_ATOMIC);
 		if (!tx_skb)
 			return -ENOMEM;

 <at>  <at>  -1341,7 +1342,8  <at>  <at>  int irttp_connect_response(struct tsap_c

 	/* Any userdata supplied? */
 	if (userdata == NULL) {
-		tx_skb = alloc_skb(64, GFP_ATOMIC);
+		tx_skb = alloc_skb(TTP_MAX_HEADER + TTP_SAR_HEADER,
+				   GFP_ATOMIC);
 		if (!tx_skb)
 			return -ENOMEM;

 <at>  <at>  -1540,14 +1542,14  <at>  <at>  int irttp_disconnect_request(struct tsap

 	if (!userdata) {
 		struct sk_buff *tx_skb;
-		tx_skb = alloc_skb(64, GFP_ATOMIC);
+		tx_skb = alloc_skb(LMP_MAX_HEADER, GFP_ATOMIC);
 		if (!tx_skb)
 			return -ENOMEM;

 		/*
 		 *  Reserve space for MUX and LAP header
 		 */
-		skb_reserve(tx_skb, TTP_MAX_HEADER);
+		skb_reserve(tx_skb, LMP_MAX_HEADER);

 		userdata = tx_skb;
 	}
--

-- 
1.4.1.1

-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo <at> vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Andreas Gick | 11 Sep 2006 13:18
Picon

problems with irda on a hp nx7010 laptop

Hi everybody,
according to some pages referring to my laptop model, the irda chip used in my 
laptop is a toshiba satellite 1800. For the configuration I followed this 
link http://personal.eunet.fi/pp/joakim/nx7010.html#irda. With the 
appropriate changes for my distribution (gentoo with a 2.6.17 kernel, smcinit 
version 0.4). Having a look at my logs and dmesg, is more or less confusing: 

/var/log/everything/current:
Sep 11 12:09:50 [tosh1800-smcinit] LPC47N227 chip (ver 0x5a, rev 0x0) found. 
Configuring:
Sep 11 12:09:50 [tosh1800-smcinit] set sirbase=0x2e8, firbase=0x2f8, dma=3, 
irq=7
Sep 11 12:09:50 [tosh1800-smcinit] set UART 2 IR mode to IrDA, auto powerdown 
on and powered up
Sep 11 12:09:50 [tosh1800-smcinit] LPC47N227 chip (ver 0x5a, rev 0x0) 
configuration successfully ended
Sep 11 12:09:50 [tosh1800-smcinit] PCI device 0x10b9:0x1533 not found

dmesg:
smsc_ircc_present: can't get sir_base of 0x3f8
 Overriding FIR address 0x0130
 Overriding SIR address 0x03f8

It seems that the chip is being found, but the device is missing... Maybe 
someone could shed some light into this.

Thanks in advance,
Andreas

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642

Gmane