Re: backport of 2.6.22.1 g_ether to 2.6.16?

Aras Vaichas <[email protected]>
Newsgroups gmane.linux.usb.devel
Message-ID <[email protected]>
David Brownell wrote:
> On Tuesday 24 July 2007, Aras Vaichas wrote:
>> Hello,
>>
>> does anyone know of a reason why I wouldn't be able to backport the 2.6.22.1 
>> drivers/usb/gadget/ether.c to work with a 2.6.16 kernel?
> 
> Nothing beyond potential minor backport issues; the kernel has
> changed a bit since then!  But I can't think of anything major,
> and skimming the GIT history for that file doesn't raise any flags
> either.  Header file changes might be annoying of course.
 >
> Give it a try, and let us know how it goes!

Hi,

I'll just say in advance that I'm not going to try too hard on backporting this 
driver. If upgrading the whole kernel is the best option, then I will do that 
instead.

I obtained a development copy of the MCCI CDC-MDLM "SAFE" drivers and made the 
backport changes to drivers/usb/gadget/ether.c. The changes seemed fairly 
straight forward and there weren't many at all.

I assume that I had to choose SUBSET over CDC, e.g.

#ifdef CONFIG_USB_GADGET_AT91
//#define DEV_CONFIG_CDC
#define DEV_CONFIG_SUBSET
#endif


I then added my VID/PID pair like so:

#define SIMPLE_VENDOR_NUM       0x16c0
#define SIMPLE_PRODUCT_NUM      0x0910

Is this correct?


I have had limited success. Upon first connecting the device, Windows asked for 
drivers and I installed the MCCI drivers and Windows created a network device 
and then it sent a request for an IP address. This is when things broke down 
and I got a kernel panic.


This is the log from boot to Boom!

(*) Boot messages:

Device says:
Linux version 2.6.16-magarm (name) (gcc version 3.4.4) #52 PREEMPT Tue Aug 14 
17:01:46 EST 2007
CPU: ARM920Tid(wb) [41129200] revision 0 (ARMv4T)
...
ether gadget: using random self ethernet address
ether gadget: using random host ethernet address
usb0: Ethernet Gadget, version: May Day 2005
usb0: using at91_udc, OUT ep2 IN ep1
usb0: MAC ca:f1:8e:2f:a9:26


(*) I logged in to my development board

Device says:
/root # tail -f /var/log/messages &


(*) I plugged my USB ethernet gadget in to the Linux host (I'm running a Linux 
host with a VMware Windows XP guest)

Linux host says:
Aug 15 12:04:28 kernel: [4661086.642721] usbcore: registered new interface 
driver cdc_ether
Aug 15 12:04:28 kernel: [4661086.643538] usb 5-2: unsupported MDLM descriptors
Aug 15 12:04:28 kernel: [4661086.643546] usbcore: registered new interface 
driver zaurus


(*) Check for network device, none found for usb0

Linux host says:
# ifconfig usb0
usb0: error fetching interface information: Device not found


Device says:
Jan  1 00:00:55 user.info kernel: usb0: using at91_udc, OUT ep2 IN ep1
Jan  1 00:00:55 user.info kernel: usb0: MAC ca:f1:8e:2f:a9:26
Jan  1 00:00:55 user.debug kernel: usb0: eth_open
Jan  1 00:00:55 local0.info udhcpd[2013]: udhcpd (v0.9.9-pre) started
Jan  1 00:01:21 user.debug kernel: usb0: suspend
Jan  1 00:01:21 user.debug kernel: usb0: resume
Jan  1 00:01:21 user.debug kernel: usb0: suspend
Jan  1 00:01:21 user.debug kernel: usb0: resume
Jan  1 00:01:21 user.debug kernel: usb0: setup complete --> 0, 16/18
Jan  1 00:01:22 user.debug kernel: usb0: eth_start
Jan  1 00:01:22 user.debug kernel: usb0: qlen 2
Jan  1 00:01:22 user.info kernel: usb0: full speed config #1: 100 mA, Ethernet 
Gadget, using CDC Ethernet Subset
Jan  1 00:01:24 user.debug kernel: usb0: suspend


(*) Check USB gadget network device

Device says:
/root # ifconfig usb0

usb0      Link encap:Ethernet  HWaddr CA:F1:8E:2F:A9:26
           inet addr:169.254.0.1  Bcast:169.254.255.255  Mask:255.255.0.0
           UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
           RX packets:0 errors:0 dropped:0 overruns:0 frame:0
           TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
           collisions:0 txqueuelen:1000
           RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)


Jan  1 00:05:58 user.debug kernel: usb0: resume
Jan  1 00:05:58 user.debug kernel: usb0: suspend
ether gadget: set_interface ignored!


(*) I disable the network connection, and then connect the device to Windows Host

Device says:
/root # ifconfig usb0 down

Windows Host says:
"Local area connection 6 ... acquiring network address ... MCCI USB Networking 
driver", etc


(*) I re-enable the network device  ... and Boom!

Device says:
/root # ifconfig usb0 up

Unable to handle kernel NULL pointer dereference at virtual address 00000158
pgd = c0004000
[00000158] *pgd=00000000
Internal error: Oops: 17 [#1]
Modules linked in: g_ether
CPU: 0
PC is at netif_rx+0x80/0x1d0
LR is at netif_rx+0x14c/0x1d0
pc : [<c0145054>]    lr : [<c0145120>]    Not tainted
sp : c01c7e04  ip : c01c7e04  fp : c01c7e20
r10: c1f3d942  r9 : fefb0038  r8 : 000004c0
r7 : 60000093  r6 : c020d9e0  r5 : 60000093  r4 : c1e53820
r3 : 20000093  r2 : 00000000  r1 : 20000093  r0 : 00000000
Flags: nzCv  IRQs off  FIQs on  Mode SVC_32  Segment kernel
Control: C000317F  Table: 21F80000  DAC: 00000017
Process swapper (pid: 0, stack limit = 0xc01c6198)
Stack: (0xc01c7e04 to 0xc01c8000)
7e00:          00000000 c1e53820 c1812a60 c18f3ca0 c01c7e48 c01c7e24 bf00076c
7e20: c0144fe4 c0039244 c0022b74 00000000 c01d7630 c18f3ca0 c18f3ca0 c01c7e64
7e40: c01c7e4c c0129f70 bf000678 00000001 00000016 c01d7630 c01c7e94 c01c7e68
7e60: c012a098 c0129f24 fefb0058 00000003 c01d74a8 00000000 0000000b 00000000
7e80: c01c6000 00000004 c01c7ea4 c01c7e98 c012ab54 c0129fb8 c01c7ee4 c01c7ea8
7ea0: c012b264 c012aac0 c01d7660 00000004 00000004 c01c7ec0 c003dd18 c02e07c0
7ec0: 00000000 00000000 0000000b c01c7f58 c01c6000 c0205e40 c01c7f08 c01c7ee8
7ee0: c001eb0c c012ab70 c020607c 0000000b c01c7f58 00000002 c01c7f58 c01c7f24
7f00: c01c7f0c c001ed70 c001eab4 0000000b c020607c 0000000b c01c7f54 c01c7f28
7f20: c001ee18 c001ed10 c01c7f64 c01c7f38 ffffffff fefff000 0000000b 00000002
7f40: 00000001 2001adf0 c01c7fac c01c7f58 c001d998 c001edd4 00000000 00000001
7f60: 00000000 60000013 c01c6000 c001f900 c01c9f5c c0217eaa 2001ae20 41129200
7f80: 2001adf0 c01c7fac c01c7fb0 c01c7fa0 c001f940 c001f94c 60000013 ffffffff
7fa0: c01c7fc8 c01c7fb0 c001f9ac c001f910 c02101bc c0207f3c c01c9c90 c01c7fd8
7fc0: c01c7fcc c001d038 c001f964 c01c7ff4 c01c7fdc c00087b8 c001d010 c00082e4
7fe0: c0207fc8 c0003175 00000000 c01c7ff8 20008094 c0008688 00000000 00000000
Backtrace:
[<c0144fd4>] (netif_rx+0x0/0x1d0) from [<bf00076c>] (rx_complete+0x104/0x354 
[g_ether])
  r7 = C18F3CA0  r6 = C1812A60  r5 = C1E53820  r4 = 00000000
[<bf000668>] (rx_complete+0x0/0x354 [g_ether]) from [<c0129f70>] (done+0x5c/0x94)
  r7 = C18F3CA0  r6 = C18F3CA0  r5 = C01D7630  r4 = 00000000
[<c0129f14>] (done+0x0/0x94) from [<c012a098>] (read_fifo+0xf0/0x114)
  r6 = C01D7630  r5 = 00000016  r4 = 00000001
[<c0129fa8>] (read_fifo+0x0/0x114) from [<c012ab54>] (handle_ep+0xa4/0xb0)
[<c012aab0>] (handle_ep+0x0/0xb0) from [<c012b264>] (at91_udc_irq+0x704/0x748)
[<c012ab60>] (at91_udc_irq+0x0/0x748) from [<c001eb0c>] (__do_irq+0x68/0xac)
[<c001eaa4>] (__do_irq+0x0/0xac) from [<c001ed70>] (do_level_IRQ+0x70/0xc4)
  r8 = C01C7F58  r7 = 00000002  r6 = C01C7F58  r5 = 0000000B
  r4 = C020607C
[<c001ed00>] (do_level_IRQ+0x0/0xc4) from [<c001ee18>] (asm_do_IRQ+0x54/0x16c)
  r6 = 0000000B  r5 = C020607C  r4 = 0000000B
[<c001edc4>] (asm_do_IRQ+0x0/0x16c) from [<c001d998>] (__irq_svc+0x38/0x64)
[<c001f900>] (default_idle+0x0/0x54) from [<c001f9ac>] (cpu_idle+0x58/0x8c)
[<c001f954>] (cpu_idle+0x0/0x8c) from [<c001d038>] (__init_end+0x38/0x40)
  r6 = C01C9C90  r5 = C0207F3C  r4 = C02101BC
[<c001d000>] (__init_end+0x0/0x40) from [<c00087b8>] (start_kernel+0x140/0x178)
[<c0008678>] (start_kernel+0x0/0x178) from [<20008094>] (0x20008094)
Code: e5942014 e10f1000 e3813080 e121f003 (e5923158)
  <0>Kernel panic - not syncing: Aiee, killing interrupt handler!


Any hints? Or should I just upgrade my whole kernel?


regards,

Aras Vaichas

______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
______________________________________________________________________

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.