linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* drivers/net/usb/asix: strange numeration of eth interfaces
@ 2011-12-19  7:43 Igor Egorkin
  2011-12-19 18:37 ` Grant Grundler
  2011-12-19 19:11 ` David Miller
  0 siblings, 2 replies; 4+ messages in thread
From: Igor Egorkin @ 2011-12-19  7:43 UTC (permalink / raw)
  To: linux-kernel; +Cc: allan, grundler

Hello!

$ uname -a
Linux 2.6.32-5-amd64 #1 SMP Thu Nov 3 03:41:26 UTC 2011 x86_64 GNU/Linux

$ cat /etc/debian_version 
6.0.3

$ lsusb|grep -i asix
Bus 004 Device 014: ID 0b95:772b ASIX Electronics Corp. 


1) Driver asix.c from linux-3.2-rc6. 
   asix.c little modified for compiling in 2.6.32 . Diff is at the end of message.

  Adapter inserted to USB connector:
Dec 18 20:03:24 kernel: [492657.344037] usb 4-2: new high speed USB device using ehci_hcd and address 12
Dec 18 20:03:24 kernel: [492657.489541] usb 4-2: New USB device found, idVendor=0b95, idProduct=772b
Dec 18 20:03:24 kernel: [492657.489545] usb 4-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
Dec 18 20:03:24 kernel: [492657.489548] usb 4-2: Product: AX88772B
Dec 18 20:03:24 kernel: [492657.489550] usb 4-2: Manufacturer: ASIX Elec. Corp.
Dec 18 20:03:24 kernel: [492657.489552] usb 4-2: SerialNumber: 000001
Dec 18 20:03:24 kernel: [492657.489661] usb 4-2: configuration #1 chosen from 1 choice
Dec 18 20:03:24 kernel: [492657.802645] eth1: register 'asix' at usb-0000:01:00.2-2, ASIX AX88772 USB 2.0 Ethernet, 00:60:6e:01:0e:99

# ethtool -i eth1
Cannot get driver information: No such device

# ethtool -i eth2
driver: asix
version: 08-Nov-2011
firmware-version: ASIX AX88772 USB 2.0 Ethernet
bus-info: usb-0000:01:00.2-2

$ ip addr ls dev eth1
Device "eth1" does not exist.

$ ip addr ls dev eth2
77: eth2: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN qlen 1000
    link/ether 00:60:6e:01:0e:99 brd ff:ff:ff:ff:ff:ff

  Adapter removed from USB connector:
Dec 18 20:40:58 kernel: [494911.485333] usb 4-2: USB disconnect, address 12
Dec 18 20:40:58 kernel: [494911.485426] eth2: unregister 'asix' usb-0000:01:00.2-2, ASIX AX88772 USB 2.0 Ethernet



2) Driver AX88772B_772A_760_772_178_LINUX_Driver_v4.2.0_Source.zip from asix.com.tw . Unmodified.
Problem is the same.

  Adapter inserted to USB connector:
Dec 18 20:42:53 kernel: [495026.620036] usb 4-2: new high speed USB device using ehci_hcd and address 13
Dec 18 20:42:53 kernel: [495026.765514] usb 4-2: New USB device found, idVendor=0b95, idProduct=772b
Dec 18 20:42:53 kernel: [495026.765519] usb 4-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
Dec 18 20:42:53 kernel: [495026.765522] usb 4-2: Product: AX88772B
Dec 18 20:42:53 kernel: [495026.765523] usb 4-2: Manufacturer: ASIX Elec. Corp.
Dec 18 20:42:53 kernel: [495026.765525] usb 4-2: SerialNumber: 000001
Dec 18 20:42:53 kernel: [495026.765639] usb 4-2: configuration #1 chosen from 1 choice
Dec 18 20:42:54 kernel: [495027.399871] ASIX USB Ethernet Adapter:v4.2.0 20:17:18 Dec 17 2011
Dec 18 20:42:54 kernel: [495027.399873] <6>    http://www.asix.com.tw
Dec 18 20:42:54 kernel: [495027.399877] eth%d: status ep1in, 8 bytes period 11
Dec 18 20:42:54 kernel: [495027.400873] eth1: register 'asix' at usb-0000:01:00.2-2, ASIX AX88772B USB 2.0 Ethernet, 00:60:6e:01:0e:99

$ ip addr ls dev eth1
Device "eth1" does not exist.

$ ip addr ls dev eth2
78: eth2: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN qlen 1000
    link/ether 00:60:6e:01:0e:99 brd ff:ff:ff:ff:ff:ff


# ethtool -i eth1
Cannot get driver information: No such device

# ethtool -i eth2
driver: asix
version: 22-Aug-2005
firmware-version: ASIX AX88772B USB 2.0 Ethernet
bus-info: usb-0000:01:00.2-2

  Adapter removed from USB connector:
Dec 18 20:44:41 kernel: [495134.784792] usb 4-2: USB disconnect, address 13
Dec 18 20:44:41 kernel: [495134.784882] eth2: unregister 'asix' usb-0000:01:00.2-2, ASIX AX88772B USB 2.0 Ethernet



===============================================================================================================


  For compiling asix.c in 2.6.32  i do modification (i take it from AX88772B_772A_760_772_178_LINUX_Driver_v4.2.0_Source.zip):


$ diff -ruN asix.c.from_linux-3.2-rc6 asix.c 
--- asix.c.from_linux-3.2-rc6	2011-12-17 06:36:26.000000000 +0400
+++ asix.c	2011-12-18 20:00:46.000000000 +0400
@@ -22,7 +22,7 @@
 
 // #define	DEBUG			// error path messages, extra info
 // #define	VERBOSE			// more; success messages
-
+#include <linux/version.h>
 #include <linux/module.h>
 #include <linux/kmod.h>
 #include <linux/init.h>
@@ -593,8 +593,24 @@
 		 * for our 8 byte filter buffer
 		 * to avoid allocating memory that
 		 * is tricky to free later */
-		struct netdev_hw_addr *ha;
 		u32 crc_bits;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,35)
+		struct dev_mc_list *mc_list = net->mc_list;
+		int i;
+
+		memset(data->multi_filter, 0, AX_MCAST_FILTER_SIZE);
+
+		/* Build the multicast hash filter. */
+		for (i = 0; i < net->mc_count; i++) {
+			crc_bits =
+			    ether_crc(ETH_ALEN,
+				mc_list->dmi_addr) >> 26;
+			data->multi_filter[crc_bits >> 3] |=
+			    1 << (crc_bits & 7);
+			mc_list = mc_list->next;
+		}
+#else
+		struct netdev_hw_addr *ha;
 
 		memset(data->multi_filter, 0, AX_MCAST_FILTER_SIZE);
 
@@ -604,7 +620,7 @@
 			data->multi_filter[crc_bits >> 3] |=
 			    1 << (crc_bits & 7);
 		}
-
+#endif
 		asix_write_cmd_async(dev, AX_CMD_WRITE_MULTI_FILTER, 0, 0,
 				   AX_MCAST_FILTER_SIZE, data->multi_filter);
 
@@ -827,18 +843,33 @@
 		 * for our 8 byte filter buffer
 		 * to avoid allocating memory that
 		 * is tricky to free later */
-		struct netdev_hw_addr *ha;
 		u32 crc_bits;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,35)
+		struct dev_mc_list *mc_list = net->mc_list;
+		int i;
 
 		memset(data->multi_filter, 0, AX_MCAST_FILTER_SIZE);
 
 		/* Build the multicast hash filter. */
+		for (i = 0; i < net->mc_count; i++) {
+			crc_bits =
+			    ether_crc(ETH_ALEN,
+				mc_list->dmi_addr) >> 26;
+			data->multi_filter[crc_bits >> 3] |=
+			    1 << (crc_bits & 7);
+			mc_list = mc_list->next;
+		}
+#else
+		struct netdev_hw_addr *ha;
+		memset(data->multi_filter, 0, AX_MCAST_FILTER_SIZE);
+
+		/* Build the multicast hash filter. */
 		netdev_for_each_mc_addr(ha, net) {
 			crc_bits = ether_crc(ETH_ALEN, ha->addr) >> 26;
 			data->multi_filter[crc_bits >> 3] |=
 			    1 << (crc_bits & 7);
 		}
-
+#endif
 		asix_write_cmd_async(dev, AX_CMD_WRITE_MULTI_FILTER, 0, 0,
 				   AX_MCAST_FILTER_SIZE, data->multi_filter);



==============================================================================================


Thank you!
--
Igor E.



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: drivers/net/usb/asix: strange numeration of eth interfaces
  2011-12-19  7:43 drivers/net/usb/asix: strange numeration of eth interfaces Igor Egorkin
@ 2011-12-19 18:37 ` Grant Grundler
  2011-12-19 19:11 ` David Miller
  1 sibling, 0 replies; 4+ messages in thread
From: Grant Grundler @ 2011-12-19 18:37 UTC (permalink / raw)
  To: Igor Egorkin; +Cc: linux-kernel, Allan Chou, Freddy Xin, Mark Lord, netdev

+Freddy Xin, Mark Lord, +netdev

On Sun, Dec 18, 2011 at 11:43 PM, Igor Egorkin <igor@egorkin.ru> wrote:
> Hello!
>
> $ uname -a
> Linux 2.6.32-5-amd64 #1 SMP Thu Nov 3 03:41:26 UTC 2011 x86_64 GNU/Linux
>
> $ cat /etc/debian_version
> 6.0.3
>
> $ lsusb|grep -i asix
> Bus 004 Device 014: ID 0b95:772b ASIX Electronics Corp.
>
>
> 1) Driver asix.c from linux-3.2-rc6.
>   asix.c little modified for compiling in 2.6.32 . Diff is at the end of message.

Hi Igor!
The goal(s) of your email/patch aren't 100% clear to me.

Is the main goal to provide a backport of 3.2-rc6  asix.c driver to
pre-2.6.35 kernels?

(If so - thanks! I'm sure someone can make use of it.)

Why the comparison to ASIX v4.2.0 driver?

cheers,
grant

>  Adapter inserted to USB connector:
> Dec 18 20:03:24 kernel: [492657.344037] usb 4-2: new high speed USB device using ehci_hcd and address 12
> Dec 18 20:03:24 kernel: [492657.489541] usb 4-2: New USB device found, idVendor=0b95, idProduct=772b
> Dec 18 20:03:24 kernel: [492657.489545] usb 4-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
> Dec 18 20:03:24 kernel: [492657.489548] usb 4-2: Product: AX88772B
> Dec 18 20:03:24 kernel: [492657.489550] usb 4-2: Manufacturer: ASIX Elec. Corp.
> Dec 18 20:03:24 kernel: [492657.489552] usb 4-2: SerialNumber: 000001
> Dec 18 20:03:24 kernel: [492657.489661] usb 4-2: configuration #1 chosen from 1 choice
> Dec 18 20:03:24 kernel: [492657.802645] eth1: register 'asix' at usb-0000:01:00.2-2, ASIX AX88772 USB 2.0 Ethernet, 00:60:6e:01:0e:99
>
> # ethtool -i eth1
> Cannot get driver information: No such device
>
> # ethtool -i eth2
> driver: asix
> version: 08-Nov-2011
> firmware-version: ASIX AX88772 USB 2.0 Ethernet
> bus-info: usb-0000:01:00.2-2
>
> $ ip addr ls dev eth1
> Device "eth1" does not exist.
>
> $ ip addr ls dev eth2
> 77: eth2: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN qlen 1000
>    link/ether 00:60:6e:01:0e:99 brd ff:ff:ff:ff:ff:ff
>
>  Adapter removed from USB connector:
> Dec 18 20:40:58 kernel: [494911.485333] usb 4-2: USB disconnect, address 12
> Dec 18 20:40:58 kernel: [494911.485426] eth2: unregister 'asix' usb-0000:01:00.2-2, ASIX AX88772 USB 2.0 Ethernet
>
>
>
> 2) Driver AX88772B_772A_760_772_178_LINUX_Driver_v4.2.0_Source.zip from asix.com.tw . Unmodified.
> Problem is the same.
>
>  Adapter inserted to USB connector:
> Dec 18 20:42:53 kernel: [495026.620036] usb 4-2: new high speed USB device using ehci_hcd and address 13
> Dec 18 20:42:53 kernel: [495026.765514] usb 4-2: New USB device found, idVendor=0b95, idProduct=772b
> Dec 18 20:42:53 kernel: [495026.765519] usb 4-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
> Dec 18 20:42:53 kernel: [495026.765522] usb 4-2: Product: AX88772B
> Dec 18 20:42:53 kernel: [495026.765523] usb 4-2: Manufacturer: ASIX Elec. Corp.
> Dec 18 20:42:53 kernel: [495026.765525] usb 4-2: SerialNumber: 000001
> Dec 18 20:42:53 kernel: [495026.765639] usb 4-2: configuration #1 chosen from 1 choice
> Dec 18 20:42:54 kernel: [495027.399871] ASIX USB Ethernet Adapter:v4.2.0 20:17:18 Dec 17 2011
> Dec 18 20:42:54 kernel: [495027.399873] <6>    http://www.asix.com.tw
> Dec 18 20:42:54 kernel: [495027.399877] eth%d: status ep1in, 8 bytes period 11
> Dec 18 20:42:54 kernel: [495027.400873] eth1: register 'asix' at usb-0000:01:00.2-2, ASIX AX88772B USB 2.0 Ethernet, 00:60:6e:01:0e:99
>
> $ ip addr ls dev eth1
> Device "eth1" does not exist.
>
> $ ip addr ls dev eth2
> 78: eth2: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN qlen 1000
>    link/ether 00:60:6e:01:0e:99 brd ff:ff:ff:ff:ff:ff
>
>
> # ethtool -i eth1
> Cannot get driver information: No such device
>
> # ethtool -i eth2
> driver: asix
> version: 22-Aug-2005
> firmware-version: ASIX AX88772B USB 2.0 Ethernet
> bus-info: usb-0000:01:00.2-2
>
>  Adapter removed from USB connector:
> Dec 18 20:44:41 kernel: [495134.784792] usb 4-2: USB disconnect, address 13
> Dec 18 20:44:41 kernel: [495134.784882] eth2: unregister 'asix' usb-0000:01:00.2-2, ASIX AX88772B USB 2.0 Ethernet
>
>
>
> ===============================================================================================================
>
>
>  For compiling asix.c in 2.6.32  i do modification (i take it from AX88772B_772A_760_772_178_LINUX_Driver_v4.2.0_Source.zip):
>
>
> $ diff -ruN asix.c.from_linux-3.2-rc6 asix.c
> --- asix.c.from_linux-3.2-rc6   2011-12-17 06:36:26.000000000 +0400
> +++ asix.c      2011-12-18 20:00:46.000000000 +0400
> @@ -22,7 +22,7 @@
>
>  // #define     DEBUG                   // error path messages, extra info
>  // #define     VERBOSE                 // more; success messages
> -
> +#include <linux/version.h>
>  #include <linux/module.h>
>  #include <linux/kmod.h>
>  #include <linux/init.h>
> @@ -593,8 +593,24 @@
>                 * for our 8 byte filter buffer
>                 * to avoid allocating memory that
>                 * is tricky to free later */
> -               struct netdev_hw_addr *ha;
>                u32 crc_bits;
> +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,35)
> +               struct dev_mc_list *mc_list = net->mc_list;
> +               int i;
> +
> +               memset(data->multi_filter, 0, AX_MCAST_FILTER_SIZE);
> +
> +               /* Build the multicast hash filter. */
> +               for (i = 0; i < net->mc_count; i++) {
> +                       crc_bits =
> +                           ether_crc(ETH_ALEN,
> +                               mc_list->dmi_addr) >> 26;
> +                       data->multi_filter[crc_bits >> 3] |=
> +                           1 << (crc_bits & 7);
> +                       mc_list = mc_list->next;
> +               }
> +#else
> +               struct netdev_hw_addr *ha;
>
>                memset(data->multi_filter, 0, AX_MCAST_FILTER_SIZE);
>
> @@ -604,7 +620,7 @@
>                        data->multi_filter[crc_bits >> 3] |=
>                            1 << (crc_bits & 7);
>                }
> -
> +#endif
>                asix_write_cmd_async(dev, AX_CMD_WRITE_MULTI_FILTER, 0, 0,
>                                   AX_MCAST_FILTER_SIZE, data->multi_filter);
>
> @@ -827,18 +843,33 @@
>                 * for our 8 byte filter buffer
>                 * to avoid allocating memory that
>                 * is tricky to free later */
> -               struct netdev_hw_addr *ha;
>                u32 crc_bits;
> +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,35)
> +               struct dev_mc_list *mc_list = net->mc_list;
> +               int i;
>
>                memset(data->multi_filter, 0, AX_MCAST_FILTER_SIZE);
>
>                /* Build the multicast hash filter. */
> +               for (i = 0; i < net->mc_count; i++) {
> +                       crc_bits =
> +                           ether_crc(ETH_ALEN,
> +                               mc_list->dmi_addr) >> 26;
> +                       data->multi_filter[crc_bits >> 3] |=
> +                           1 << (crc_bits & 7);
> +                       mc_list = mc_list->next;
> +               }
> +#else
> +               struct netdev_hw_addr *ha;
> +               memset(data->multi_filter, 0, AX_MCAST_FILTER_SIZE);
> +
> +               /* Build the multicast hash filter. */
>                netdev_for_each_mc_addr(ha, net) {
>                        crc_bits = ether_crc(ETH_ALEN, ha->addr) >> 26;
>                        data->multi_filter[crc_bits >> 3] |=
>                            1 << (crc_bits & 7);
>                }
> -
> +#endif
>                asix_write_cmd_async(dev, AX_CMD_WRITE_MULTI_FILTER, 0, 0,
>                                   AX_MCAST_FILTER_SIZE, data->multi_filter);
>
>
>
> ==============================================================================================
>
>
> Thank you!
> --
> Igor E.
>
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: drivers/net/usb/asix: strange numeration of eth interfaces
  2011-12-19  7:43 drivers/net/usb/asix: strange numeration of eth interfaces Igor Egorkin
  2011-12-19 18:37 ` Grant Grundler
@ 2011-12-19 19:11 ` David Miller
  2011-12-19 20:31   ` Igor Egorkin
  1 sibling, 1 reply; 4+ messages in thread
From: David Miller @ 2011-12-19 19:11 UTC (permalink / raw)
  To: igor; +Cc: linux-kernel, allan, grundler


What you're seeing isn't strange, it depends upon what ethernet devices were
visible when you installed your machine.

'udev' in userspace remembers the mappings from ethernet addresses to
device names, and renames devices as the system comes up to what it
first saw them as, based upon the MAC address.

So one possibility is that there were 2 other ethernet or wireless devices
in your system at install time, so the one that the ASIX device got was
'eth2'.

Therefore that is the device name it will have until you tell 'udev' to
do otherwise.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: drivers/net/usb/asix: strange numeration of eth interfaces
  2011-12-19 19:11 ` David Miller
@ 2011-12-19 20:31   ` Igor Egorkin
  0 siblings, 0 replies; 4+ messages in thread
From: Igor Egorkin @ 2011-12-19 20:31 UTC (permalink / raw)
  To: linux-kernel; +Cc: David Miller, grundler

On Mon, 2011-12-19 at 14:11 -0500, David Miller wrote:
> What you're seeing isn't strange, it depends upon what ethernet devices were
> visible when you installed your machine.
> 
> 'udev' in userspace remembers the mappings from ethernet addresses to
> device names, and renames devices as the system comes up to what it
> first saw them as, based upon the MAC address.
> 
> So one possibility is that there were 2 other ethernet or wireless devices
> in your system at install time, so the one that the ASIX device got was
> 'eth2'.
> 
> Therefore that is the device name it will have until you tell 'udev' to
> do otherwise.

Dear David,
Thank you very much!
It helps.
Sorry for my stupidity.




On Mon, 2011-12-19 at 10:37 -0800, Grant Grundler wrote:
> The goal(s) of your email/patch aren't 100% clear to me.

I was told to buy a lot of these adapters, but at first to test them. In
the debian stable there is old driver which does not see these adapters.
Driver from the vendor looks suspicious. I thought it better to get
driver from the current linux-3.2-rc6. But by mistake I thought I found
a bug, and decided to tell you. Time running out, and I cannot think
anything better than write to this mailing list. The next time I'll be
more careful, I will think ten times before worry developers. Sorry!

--
Igor E.



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-12-19 20:31 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-12-19  7:43 drivers/net/usb/asix: strange numeration of eth interfaces Igor Egorkin
2011-12-19 18:37 ` Grant Grundler
2011-12-19 19:11 ` David Miller
2011-12-19 20:31   ` Igor Egorkin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).