Divide Error if more than two devices are used

Live forum: http://rt2x00.serialmonkey.com/viewtopic.php?t=4708

inffu

31-03-2008 15:21:26

Hello everyone,

once I connect a third USB wlan stick to my host, the following message/trace is displayed.

[codeqthfrgho]divide error: 0000 [#1]
Modules linked in: ipv6 loop rt73 firmware_class ohci_hcd ehci_hcd cs5535_gpio usbcore
CPU: 0
EIP: 0060:[<d088ee0a>] Not tainted VLI
EFLAGS: 00010246 (2.6.22.9 #44)
EIP is at RTUSBMlmeHardTransmit+0x1c2/0x1e1 [rt73]
eax: 0000004a ebx: cf4c0000 ecx: 0000004a edx: 00000000
esi: 00000000 edi: cf0c304a ebp: 00000032 esp: cf061e5c
ds: 007b es: 007b fs: 0000 gs: 0000 ss: 0068
Process rt73 (pid: 1824, ti=cf060000 task=c1260070 task.ti=cf060000)
Stack: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000001
00000032 00000000 00000082 00000000 000003e8 cf4dd2c8 cf0c3000 014cb1d9
cf4c0160 cf4c0164 cf4c0000 cf4caaf9 d088ee85 00000001 cf4c0000 c0035000
Call Trace:
[<d088ee85>] RTUSBDequeueMLMEPacket+0x5c/0x96 [rt73]
[<d08905d2>] MiniportMMRequest+0x6c/0x93 [rt73]
[<d088a261>] ScanNextChannel+0x4c5/0x4d7 [rt73]
[<d088bf8b>] MlmeScanReqAction+0x13b/0x178 [rt73]
[<d0881c99>] StateMachinePerformAction+0x16/0x19 [rt73]
[<d088574f>] MlmeHandler+0xb1/0xe7 [rt73]
[<d08814d2>] MlmeThread+0x60/0x78 [rt73]
[<d0881472>] MlmeThread+0x0/0x78 [rt73]
[<c0102abf>] kernel_thread_helper+0x7/0x10
=======================
Code: 44 24 04 00 00 00 00 c7 04 24 00 00 00 00 e8 87 f7 ff ff 8d 4d 18 f6 c1 01 74 03 8d 4d 19 0f b7 93 9c d1 01 00 89 c8 89 d6 31 d2 <f7> f6 85 d2 75 03 83 c1 02 8b 44 24 34 89 48 0c 83 8b bc e3 01
EIP: [<d088ee0a>] RTUSBMlmeHardTransmit+0x1c2/0x1e1 [rt73] SS:ESP 0068:cf061e5c[/codeqthfrgho]

I am using rt73-cvs-2008011706 and a 2.6.22.9 kernel.

Can anybody reproduce this problem or even provide a fix?

Greetings,

inffu

edit rt73-cvs-2008033109 generates the same error

inffu

01-04-2008 07:33:20

It seems that [i1zuvwim7]pAd->BulkOutMaxPacketSize[/i1zuvwim7] has a value of zero leading to a NaN result for [i1zuvwim7]TransferBufferLength % pAd->BulkOutMaxPacketSize[/i1zuvwim7].

inffu

02-04-2008 07:00:39

It seems like the reported wMaxPacketSize (in [i1ylmglub]usb_rtusb_probe()[/i1ylmglub]) of the usb host end point is zero. That seems to be very strange. I'm not sure if this is a kernel or module related bug as I have very little experience in this domain.

As a quick (and dirty) patch I caught every case where [i1ylmglub]BulkOutMaxPacketSize[/i1ylmglub] has a zero value and set it to 512 and everything seems to work as expected.
Once I get hold of another usb NIC, I will test if the error occurs even for the forth, fifth, ... device.


inffu

Vern

02-04-2008 21:42:22

Hi inffu,

If you're getting wMaxPacketSize == 0, something else is wrong. That value is provided by the USB subsystem (may be worthwhile putting a paranoia check in the driver) If the USB subsystem is operating as it should, then there is *always* a valid value for this.

What is your machine architecture?

Thanks,

IvD

02-04-2008 21:50:51


If you're getting wMaxPacketSize == 0, something else is wrong. That value is provided by the USB subsystem (may be worthwhile putting a paranoia check in the driver) If the USB subsystem is operating as it should, then there is *always* a valid value for this.
[/quotexlbibyl0]

No it isn't, for rt2x00 is have observed 0 values for multiple users. For rt2x00 this was solved by requesting the macPacketSize during module load only, and sets it to 1 in case the value was 0.

Vern

03-04-2008 01:37:48

... for rt2x00 is have observed 0 values for multiple users. For rt2x00 this was solved by requesting the macPacketSize during module load only, ...[/quote1p5rqezc]Veddy interestink. As far as I can tell, that's the only time the legacy rt73 driver gets that item, too.

When I plug my freebie rt73 dongle in - even without loading the driver - "lsusb" gives me a vendorproduct code. If I then say - e.g.[code1p5rqezc]lsusb -d14b2:3c22 -v[/code1p5rqezc], I get[code1p5rqezc]blah, blah ...
wMaxPacketSize 0x0200 1x 512 bytes
more blah, blah
...[/code1p5rqezc] so I don't see how there can be a zero if all is working as it should in the USB subsystem.

Now one funny thing I do notice is that occasionally when I plug the dongle in, the USB subsystem doesn't detect it at all until I unplug it, then plug it in again. But I *think* that in the non-detect case the probe function is not called either.

Thoughts?

Thanks,

Vern

03-04-2008 01:40:17

Hey inffu,

What does "lsusb -dvendorproduct -v" say for *your* device?

Thanks,

inffu

03-04-2008 12:10:21

That's even more interesting. The wMaxPacketSize is 512 in all cases.

Output for the two Hercules HWGUSB2-54
[code3jqtwafu]
Bus 001 Device 005: ID 06f8:e010 Guillemot Corp.
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 2.00
bDeviceClass 0 (Defined at Interface level)
bDeviceSubClass 0
bDeviceProtocol 0
bMaxPacketSize0 64
idVendor 0x06f8 Guillemot Corp.
idProduct 0xe010
bcdDevice 0.01
iManufacturer 1 Ralink
iProduct 2 802.11 bg WLAN
iSerial 0
bNumConfigurations 1
Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength 32
bNumInterfaces 1
bConfigurationValue 1
iConfiguration 0
bmAttributes 0x80
(Bus Powered)
MaxPower 300mA
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 0
bNumEndpoints 2
bInterfaceClass 255 Vendor Specific Class
bInterfaceSubClass 255 Vendor Specific Subclass
bInterfaceProtocol 255 Vendor Specific Protocol
iInterface 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x81 EP 1 IN
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0200 1x 512 bytes
bInterval 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x01 EP 1 OUT
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0200 1x 512 bytes
bInterval 0
Device Qualifier (for other device speed):
bLength 10
bDescriptorType 6
bcdUSB 2.00
bDeviceClass 0 (Defined at Interface level)
bDeviceSubClass 0
bDeviceProtocol 0
bMaxPacketSize0 64
bNumConfigurations 1
Device Status: 0x0000
(Bus Powered)

Bus 001 Device 004: ID 06f8:e010 Guillemot Corp.
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 2.00
bDeviceClass 0 (Defined at Interface level)
bDeviceSubClass 0
bDeviceProtocol 0
bMaxPacketSize0 64
idVendor 0x06f8 Guillemot Corp.
idProduct 0xe010
bcdDevice 0.01
iManufacturer 1 Ralink
iProduct 2 802.11 bg WLAN
iSerial 0
bNumConfigurations 1
Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength 32
bNumInterfaces 1
bConfigurationValue 1
iConfiguration 0
bmAttributes 0x80
(Bus Powered)
MaxPower 300mA
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 0
bNumEndpoints 2
bInterfaceClass 255 Vendor Specific Class
bInterfaceSubClass 255 Vendor Specific Subclass
bInterfaceProtocol 255 Vendor Specific Protocol
iInterface 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x81 EP 1 IN
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0200 1x 512 bytes
bInterval 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x01 EP 1 OUT
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0200 1x 512 bytes
bInterval 0
Device Qualifier (for other device speed):
bLength 10
bDescriptorType 6
bcdUSB 2.00
bDeviceClass 0 (Defined at Interface level)
bDeviceSubClass 0
bDeviceProtocol 0
bMaxPacketSize0 64
bNumConfigurations 1
Device Status: 0x0000
(Bus Powered)
[/code3jqtwafu]

Output for one LogiLink WL0025
[code3jqtwafu]
Bus 001 Device 003: ID 148f:2573 Ralink Technology, Corp.
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 2.00
bDeviceClass 0 (Defined at Interface level)
bDeviceSubClass 0
bDeviceProtocol 0
bMaxPacketSize0 64
idVendor 0x148f Ralink Technology, Corp.
idProduct 0x2573
bcdDevice 0.01
iManufacturer 1 Ralink
iProduct 2 802.11 bg WLAN
iSerial 0
bNumConfigurations 1
Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength 32
bNumInterfaces 1
bConfigurationValue 1
iConfiguration 0
bmAttributes 0x80
(Bus Powered)
MaxPower 300mA
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 0
bNumEndpoints 2
bInterfaceClass 255 Vendor Specific Class
bInterfaceSubClass 255 Vendor Specific Subclass
bInterfaceProtocol 255 Vendor Specific Protocol
iInterface 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x81 EP 1 IN
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0200 1x 512 bytes
bInterval 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x01 EP 1 OUT
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0200 1x 512 bytes
bInterval 0
Device Qualifier (for other device speed):
bLength 10
bDescriptorType 6
bcdUSB 2.00
bDeviceClass 0 (Defined at Interface level)
bDeviceSubClass 0
bDeviceProtocol 0
bMaxPacketSize0 64
bNumConfigurations 1
Device Status: 0x0000
(Bus Powered)
[/code3jqtwafu]

I am using an Alix2c2 embedded PC board with an AMD Geode LX800 CPU.

Vern

04-04-2008 15:50:02

Hi inffu,

Could you generate a debug log and attach a gzipped copy of it to a posting on this thread?

Thanks,

inffu

08-04-2008 07:54:21

Hi inffu,

Could you generate a debug log and attach a gzipped copy of it to a posting on this thread?

Thanks,[/quote1idld11n]

Hi,

here's the log. I hope that's what you requested. If more information is needed just tell me.
I cut most of the output after the call trace.

inffu

Vern

08-04-2008 19:43:22

Hi inffu,

Thanks for the log. Looking at it, I see that wlan2 is the bad guy. Here's an extract[code19jnzeaa] rt73: usb device name wlan0
BulkOutMaxPacketSize 512, i = 0
rt73: BulkOutMaxPacketSize 512
rt73: usb device name wlan1
BulkOutMaxPacketSize 512, i = 1
rt73: BulkOutMaxPacketSize 512
rt73: usb device name wlan2
BulkOutMaxPacketSize 0, i = 2
rt73: BulkOutMaxPacketSize 0[/code19jnzeaa]Could you find out what happens if you change which receptacles you plug the devices in to? I'm trying to figure out if the problem follows the bus, or follows the device.

Thanks,

inffu

09-04-2008 09:28:46

Hi inffu,

Thanks for the log. Looking at it, I see that wlan2 is the bad guy. Here's an extract[code2uafjul4] rt73: usb device name wlan0
BulkOutMaxPacketSize 512, i = 0
rt73: BulkOutMaxPacketSize 512
rt73: usb device name wlan1
BulkOutMaxPacketSize 512, i = 1
rt73: BulkOutMaxPacketSize 512
rt73: usb device name wlan2
BulkOutMaxPacketSize 0, i = 2
rt73: BulkOutMaxPacketSize 0[/code2uafjul4]Could you find out what happens if you change which receptacles you plug the devices in to? I'm trying to figure out if the problem follows the bus, or follows the device.

Thanks,[/quote2uafjul4]

Hi,

I will try to do some more tests. But right now I can tell you, that the same problem happened even for the forth connected device. In my setup it did use the second on board USB port (4th NIC) as well as a powered USB hub (first 3 NICs).
One time the reported wMaxPacketSize of the 4th NIC has been 8 and other times zero.

I could reproduce the problem on another PC. The 3rd NIC produced the divide error, but the 4th did not. lsusb did show a wMaxPacketSize of 512 Byte for all NICs.

inffu