RPi zero connected via g_ether on usb on lantiq

I have an RPi zero which I want to use as 'co-processor' for my ZyXEL P2812HNU-F1 (lantiq xrx200). I installed the ethernet gadget on the zero, and when connecting to my laptop it works fine. (Mageia, kernel 4.14.70).
Connecting it to my router doesn't work. The relevant dmesg lines:

[   13.290772] usb 1-1: new high-speed USB device number 2 using dwc2
[   13.545694] cdc_ether 1-1:1.0 usb0: register 'cdc_ether' at usb-1e101000.ifxhcd-1, CDC Ethernet Device, 3e:71:5e:58:32:27
[   22.216116] cdc_ether 1-1:1.0 usb0: kevent 11 may have been dropped
[   22.221289] cdc_ether 1-1:1.0 usb0: kevent 12 may have been dropped

I get an usb0 device, and can assign an ip. When I try to ping it, I see this in tcpdump:

root@OpenWrt:/etc/config# root@OpenWrt:/etc/config# tcpdump -i usb0
[  950.885524] device usb0 entered promiscuous mode
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on usb0, link-type EN10MB (Ethernet), capture size 262144 bytes
09:48:32.563460 ARP, Request who-has 192.168.0.10 tell 192.168.0.254, length 28
09:48:32.564011 00:00:00:00:00:00 (oui Ethernet) > 00:00:00:00:00:00 (oui Ethernet) Null Information, send seq 0, rcv seq 0, Flags [Command], length 28
	0x0000:  0000 0000 0000 0000 0000 0000 0000 0000  ................
	0x0010:  0000 0000 0000 0000 0000 0000            ............
09:48:33.588781 ARP, Request who-has 192.168.0.10 tell 192.168.0.254, length 28
09:48:33.589207 00:00:00:00:00:00 (oui Ethernet) > 00:00:00:00:00:00 (oui Ethernet) Null Information, send seq 0, rcv seq 0, Flags [Command], length 28
	0x0000:  0000 0000 0000 0000 0000 0000 0000 0000  ................
	0x0010:  0000 0000 0000 0000 0000 0000            ............
09:48:34.612795 ARP, Request who-has 192.168.0.10 tell 192.168.0.254, length 28
09:48:34.613294 00:00:00:00:00:00 (oui Ethernet) > 00:00:00:00:00:00 (oui Ethernet) Null Information, send seq 0, rcv seq 0, Flags [Command], length 28
	0x0000:  0000 0000 0000 0000 0000 0000 0000 0000  ................
	0x0010:  0000 0000 0000 0000 0000 0000            ............
09:48:36.566273 ARP, Request who-has 192.168.0.10 tell 192.168.0.254, length 28
09:48:36.566659 00:00:00:00:00:00 (oui Ethernet) > 00:00:00:00:00:00 (oui Ethernet) Null Information, send seq 0, rcv seq 0, Flags [Command], length 28
	0x0000:  0000 0000 0000 0000 0000 0000 0000 0000  ................
	0x0010:  0000 0000 0000 0000 0000 0000            ............

When I quit tcpdump, the router reboots:

30 packets capture[  991.448665] device usb0 left promiscuous mode
d
30 packets received by filter
0 packets dropped by kernel
root@OpenWrt:/etc/config# [ 1045.939467] Data bus error, epc == 80205174, ra == 875e3048
[ 1045.943597] Oops[#1]:
[ 1045.945850] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.9.120 #0
[ 1045.951857] task: 80529da0 task.stack: 8051a000
[ 1045.956385] $ 0   : 00000000 80680000 9f9ba8a4 fff0ffff
[ 1045.961596] $ 4   : 9f9ba8c4 86af5820 000005ca 00000002
[ 1045.966820] $ 8   : ea2eef48 c0a8000a 10c0f6a7 08060001
[ 1045.972040] $12   : 08000604 7fb758cc 00000000 0002669b
[ 1045.977265] $16   : 87354c00 00000200 86af5800 000005ea
[ 1045.982485] $20   : 80571200 00010000 00000002 00000000
[ 1045.987711] $24   : 0000000a 875e3088                  
[ 1045.992930] $28   : 8051a000 87c0dea0 00000100 875e3048
[ 1045.998155] Hi    : 00000016
[ 1046.001028] Lo    : 00000001
[ 1046.003908] epc   : 80205174 0x80205174

ROM VER: 1.0.5
CFG 06
NAND
NAND Read OK

Or actually it doesn't reboot:

Hit any key to stop autoboot:  2  1  0 

NAND read: device 0 offset 0x60000, size 0x200000
NAND read from offset 60000 failed -74
 0 bytes read: ERROR
Wrong Image Format for bootm command
ERROR: can't get kernel image!

This can be related to dsl. The box won't reboot if the dsl is in certain state. I never looked at the serial log, when that happened.

The router runs OpenWrt 18.06.1, kernel 4.9.120.

Any suggestions?

BTW, maybe related, I first tried to install OpenWrt on the zero, in combination with g_ether. But it didn't work. The usb device gave errors, and was not recognized. Sorry, didn't save a log. Using Raspbian it worked (with my laptop)

I am not sure exactly what you meant by a co-processor here. But, if you meant to configure your Lantiq as an ethernet host for your Rpi0 so that your Rpi0 will be able to get an (dual-stack) IP Address from your router and also be able to surf the Internet, then perhaps the link inside this Dockstar as a host bridge for a Rpi0 configured as a USB gadget will be able to shed some lights?

I am not sure exactly what you meant by a co-processor here.

The P2812HNU is a great modem/router, but it just hasn't enough ram to host a tor relay. So I want to connect the RPi as low-cost and low-power tor host.

perhaps the link inside this will be able to shed some lights?

I'm afraid not. The ethernet over USB connection is actually working, when connected to my laptop, and the connection also works on my router, as in I get an usb0 device, which can have assigned an IP address, and the ARP layer can access it. Unfortunately the answers from the PI are then bogus, somehow.
And that router reboot isn't nice either. So I think there is a bug in the cdc_ether kernel module or one of it's dependencies.

That is the idea to have the Rpi0 configured as a USB network gadget and hosted on any unused USBx ports on a host. I haven't done this, yet, but am planning to implement it once my USB adapter has arrived.

I would also think perhaps there is some bugs in the g_ether Linux driver. Unfortunately the poster in Dockstar as a host bridge for a Rpi0 configured as a USB gadget post did not provide more information on this.

If I may ask for some clarifications. In your OP, you said usb0 got assigned with an IP Address. I supposed you meant the usb0 on the Rpi0. If so, then I also supposed you had tcpdump run on the Rpi0, din't you? If so, then I probably can speculate that perhaps your router reboots when tcpdump exited correlates to what was reported in Dockstar as a host bridge for a Rpi0 configured as a USB gadget post where the Dockstar crashes with a useless shell prompt during the Rpi0 boots (from a reboot process).

No, it's on the router. After plugging in the RPi it has an ethernet device usb0, which I assign a static IP address matching the same subnet as the static IP of the RPi.
I don't have access to the RPi other than the not working ethernet over usb connection, so I don't really know what is going on at the other side, but I know it works fine when connected to my laptop.
I also tried a 4.4.114 kernel, which also worked fine.

So if it's a module bug, it shows up on 4.12.1 on Arm, and on 4.9.120 on Mips, but not on 4.4.114 or 4.14.70 on amd64.
Of course it could also be a bug in the driver of the usb port.

If the usb0 on your router and not Rpi0 is assigned with an IP Address, then this sounded like your configuration is in reversed. Can you please post your network configuration related to this setup, i.e.
/etc/network/interfaces.d/usb0 (from both your Rpi0 and router) and /etc/network/interfaces.d/br0 (from router). I am assuming your /etc/network/interfaces (on both devices) should contain the following line load any configuration files found in /etc/network/interfaces.d directory.

source /etc/network/interfaces.d/*

Neither of the devices have that file.

The only configuration at the pi side is in /etc/dhcpcd.conf (besides the configuration on the boot partition to get g_ether running):

interface usb0
static ip_address=192.168.0.10/24

BTW, the relevant bootlog is (when connected to my laptop)

[    5.243606] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002
[    5.243619] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    5.243628] usb usb1: Product: DWC OTG Controller
[    5.243636] usb usb1: Manufacturer: Linux 4.14.50+ dwc2_hsotg
[    5.243644] usb usb1: SerialNumber: 20980000.usb
[    5.244773] hub 1-0:1.0: USB hub found
[    5.246039] hub 1-0:1.0: 1 port detected
[    5.405837] using random self ethernet address
[    5.405850] using random host ethernet address
[    5.407055] usb0: HOST MAC 02:fd:7e:e3:a2:ff
[    5.407161] usb0: MAC 52:0d:77:70:85:ad
[    5.407216] using random self ethernet address
[    5.407225] using random host ethernet address
[    5.407341] g_ether gadget: Ethernet Gadget, version: Memorial Day 2008
[    5.407350] g_ether gadget: g_ether ready
[    5.407365] dwc2 20980000.usb: bound driver g_ether
[    7.716554] dwc2 20980000.usb: new device is high-speed
[    7.792616] dwc2 20980000.usb: new device is high-speed
[    7.853651] dwc2 20980000.usb: new address 13
[    7.867358] g_ether gadget: high-speed config #1: CDC Ethernet (ECM)

According to /var/log/kern.log this is not significant different when connected to my router.

On the laptop there is no configuration. The kernel log says:

[ 2156.451944] usb 2-5: new full-speed USB device number 18 using xhci_hcd
[ 2156.565980] usb 2-5: device descriptor read/64, error -71
[ 2156.787982] usb 2-5: device descriptor read/64, error -71
[ 2157.003942] usb 2-5: new full-speed USB device number 19 using xhci_hcd
[ 2157.118039] usb 2-5: device descriptor read/64, error -71
[ 2157.339910] usb 2-5: device descriptor read/64, error -71
[ 2157.441889] usb usb2-port5: attempt power cycle
[ 2158.069942] usb 2-5: new full-speed USB device number 20 using xhci_hcd
[ 2158.070167] usb 2-5: Device not responding to setup address.
[ 2158.274160] usb 2-5: Device not responding to setup address.
[ 2158.481939] usb 2-5: device not accepting address 20, error -71
[ 2158.595943] usb 2-5: new full-speed USB device number 21 using xhci_hcd
[ 2158.596169] usb 2-5: Device not responding to setup address.
[ 2158.802124] usb 2-5: Device not responding to setup address.
[ 2159.009939] usb 2-5: device not accepting address 21, error -71
[ 2159.009970] usb usb2-port5: unable to enumerate USB device
[ 2159.213938] usb 2-3.1: new high-speed USB device number 22 using xhci_hcd
[ 2159.303382] usb 2-3.1: New USB device found, idVendor=0525, idProduct=a4a2
[ 2159.303387] usb 2-3.1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[ 2159.303389] usb 2-3.1: Product: RNDIS/Ethernet Gadget
[ 2159.303391] usb 2-3.1: Manufacturer: Linux 4.14.50+ with 20980000.usb
[ 2159.328559] cdc_subset: probe of 2-3.1:1.0 failed with error -22
[ 2159.329329] cdc_subset 2-3.1:1.1 usb0: register 'cdc_subset' at usb-0000:00:14.0-3.1, Linux Device, f2:e6:50:3b:f3:a8
[ 2159.329585] usbcore: registered new interface driver cdc_subset
[ 2159.329599] cdc_ether: probe of 2-3.1:1.0 failed with error -16
[ 2159.329917] usbcore: registered new interface driver cdc_ether
[ 2159.334565] cdc_subset 2-3.1:1.1 enp0s20u3u1i1: renamed from usb0

I brought the network interface manually up:
ifconfig enp0s20u3u1i1 192.168.0.50 netmask 255.255.255.0 up
(Which idiot decided that enp0s20u3u1i1 is better than usb0?)

On the router the configuration in /etc/config/network is

config interface 'Zero'
	option proto 'static'
	option ifname 'usb0'
	option ipaddr '192.168.0.254'
	option netmask '255.255.255.0'

And it shows up this way:

root@OpenWrt:~# ifconfig usb0
usb0      Link encap:Ethernet  HWaddr D6:BD:DA:FC:F4:28  
          inet addr:192.168.0.254  Bcast:192.168.0.255  Mask:255.255.255.0
          inet6 addr: fe80::d4bd:daff:fefc:f428/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:26 errors:0 dropped:6 overruns:0 frame:0
          TX packets:7 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:2724 (2.6 KiB)  TX bytes:738 (738.0 B)

I apologize for asking the above question. My mind was on the Rpi0 (configured as a networked USB gadget) as pointed out in the Dockstar as a host bridge for a Rpi0 configured as a USB gadget post.

AFAICT, that looks just fine.

[quote="Mijzelf, post:7, topic:21962, full:true"]
On the laptop there is no configuration. The kernel log says:

[ 2156.451944] usb 2-5: new full-speed USB device number 18 using xhci_hcd
[ 2156.565980] usb 2-5: device descriptor read/64, error -71
[ 2156.787982] usb 2-5: device descriptor read/64, error -71
[ 2157.003942] usb 2-5: new full-speed USB device number 19 using xhci_hcd
[ 2157.118039] usb 2-5: device descriptor read/64, error -71
[ 2157.339910] usb 2-5: device descriptor read/64, error -71
[ 2157.441889] usb usb2-port5: attempt power cycle
[ 2158.069942] usb 2-5: new full-speed USB device number 20 using xhci_hcd
[ 2158.070167] usb 2-5: Device not responding to setup address.
[ 2158.274160] usb 2-5: Device not responding to setup address.
[ 2158.481939] usb 2-5: device not accepting address 20, error -71
[ 2158.595943] usb 2-5: new full-speed USB device number 21 using xhci_hcd
[ 2158.596169] usb 2-5: Device not responding to setup address.
[ 2158.802124] usb 2-5: Device not responding to setup address.
[ 2159.009939] usb 2-5: device not accepting address 21, error -71
[ 2159.009970] usb usb2-port5: unable to enumerate USB device
[ 2159.213938] usb 2-3.1: new high-speed USB device number 22 using xhci_hcd
[ 2159.303382] usb 2-3.1: New USB device found, idVendor=0525, idProduct=a4a2
[ 2159.303387] usb 2-3.1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[ 2159.303389] usb 2-3.1: Product: RNDIS/Ethernet Gadget
[ 2159.303391] usb 2-3.1: Manufacturer: Linux 4.14.50+ with 20980000.usb
[ 2159.328559] cdc_subset: probe of 2-3.1:1.0 failed with error -22
[ 2159.329329] cdc_subset 2-3.1:1.1 usb0: register 'cdc_subset' at usb-0000:00:14.0-3.1, Linux Device, f2:e6:50:3b:f3:a8
[ 2159.329585] usbcore: registered new interface driver cdc_subset
[ 2159.329599] cdc_ether: probe of 2-3.1:1.0 failed with error -16
[ 2159.329917] usbcore: registered new interface driver cdc_ether
[ 2159.334565] cdc_subset 2-3.1:1.1 enp0s20u3u1i1: renamed from usb0

/quote]
This looks OK to me, too, except I would worry more about this line ([ 2159.329599] cdc_ether: probe of 2-3.1:1.0 failed with error -16)

On your router, ifconfig should show a br0 and/or usb0 interfaces. If not, then perhaps you will need to configure your router to bridge its eht0 interface to its usb port for your Rpi0 to connect to your LAN.

Why specifically that line among the other errors in that log? BTW, the connection is running fine, AFAICS.

It's not my intention to connect the RPi to the lan, so I gave it it's own network, Zero. And as long as I can't ping the zero through the usb0 device, I don't think adding just another layer will solve the issues I have.

If you peruse the Dockstar as a host bridge for a Rpi0 configured as a USB gadget post, you will see the OP on that post also encountered this error and ran into problem when his/her Rpi0 reboots.

OK.