Skip to contentSkip to conversation

dm9601 as ethX or usbX?

DISCUSSION Marcin Juszkiewicz 2 participants 2 messages Apr 20, 2009

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hi

I have two dm9601 based adapters. First one is recognized as 'ethX':

[269425.698235] usb 1-5.4.1: new full speed USB device using ehci_hcd and address 16
[269425.788125] usb 1-5.4.1: configuration #1 chosen from 1 choice
[269425.793478] eth1: register 'dm9601' at usb-0000:00:1a.7-5.4.1, Davicom DM9601 USB Ethernet, 00:60:6e:7f:0c:20

But second is 'usbX':

[269530.937166] usb 1-5.3: new full speed USB device using ehci_hcd and address 19
[269531.048917] usb 1-5.3: configuration #1 chosen from 1 choice
[269531.050188] dm9601: No valid MAC address in EEPROM, using 52:9f:f0:e8:44:36
[269531.054054] usb0: register 'dm9601' at usb-0000:00:1a.7-5.3, Davicom DM9601 USB Ethernet, 52:9f:f0:e8:44:36

Both has same vendor/product id:

Bus 001 Device 019: ID 0a46:9601 Davicom Semiconductor, Inc. DM9601 To Fast Ethernet Adapter Bus 001 Device 018: ID 0a46:9601 Davicom Semiconductor, Inc. DM9601 To Fast Ethernet Adapter

but they differ in details - eth1 one has iManufacturer, iProduct, iSerial fields filled, usb0 one has them empty:

  iManufacturer           1 DM9601 USB NNC                                                  
  iProduct                2 Davicom CO., LTD                                                
  iSerial                 3 9601      

Is this normal behaviour of those adapters that ones with empty eeprom ends as usbX?

I would prefer to have both as ethX as I use them in devices where usbX as usually usb-gadget (g_ether) and as such usb0 is configured in total different scheme.

I know that one of options would be using udev and renaming of interface but then I would have to remember to always copy that rule to each device.

Regards,

Signature · 3 lines
JID:      [email protected]
Website:  http://marcin.juszkiewicz.com.pl/
LinkedIn: http://www.linkedin.com/in/marcinjuszkiewicz
#1 lore raw
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Marcin" == Marcin Juszkiewicz <[email protected]> writes:

Hi,

Marcin> Is this normal behaviour of those adapters that ones with empty eeprom Marcin> ends as usbX?

Yes. The code in question is located in
drivers/net/usb/usbnet.c:usbnet_probe():

        strcpy (net->name, "usb%d");
...
                // heuristic:  "usb%d" for links we know are two-host,
                // else "eth%d" when there's reasonable doubt.  userspace
                // can rename the link if it knows better.
                if ((dev->driver_info->flags & FLAG_ETHER) != 0
                                && (net->dev_addr [0] & 0x02) == 0)
                        strcpy (net->name, "eth%d");

Bit 1 of the most significant byte of the MAC address specifies that it's a locally generated (E.G. random) MAC address, which is what dm9601.c will use if there's nothing specified in the EEPROM (or there isn't any EEPROM connected).

Marcin> I would prefer to have both as ethX as I use them in devices Marcin> where usbX as usually usb-gadget (g_ether) and as such usb0 Marcin> is configured in total different scheme.

Marcin> I know that one of options would be using udev and renaming Marcin> of interface but then I would have to remember to always copy Marcin> that rule to each device.

Sorry, other than that I don't know any other options (you could ofcourse try to convince the usbnet maintainer to change the usbnet logic, but it seems pretty sensible to me).

Signature · 1 line
Bye, Peter Korsgaard