openwrt / mt76

mac80211 driver for MediaTek MT76x0e, MT76x2e, MT7603, MT7615, MT7628 and MT7688
749 stars 341 forks source link

MT7612U support #139

Closed pellerb closed 6 years ago

pellerb commented 6 years ago

Hi, I bought EDUP EP-AC1605 WiFi adapters and these are equipped with MediaTek MT7612U controllers. I would like to use them with OpenWRT-based routers and USB3 connection (to have an additional WiFi device). It seems that this driver doesn't support MT7612U controller yet. The router detects a new USB device connection when I plug in, but it doesn't recognize this adapter even if kmod-mt76x2 driver package is installed. Could you please add MT7612U support in parallel with MT7612E? It would be also very nice to distribute compiled version of the package too. Thanks, Balázs

benVolatiles commented 6 years ago

Did you try this driver?

https://github.com/ulli-kroll/mt7612u

LorenzoBianconi commented 6 years ago

Did you try this driver?

https://github.com/ulli-kroll/mt7612u

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/openwrt/mt76/issues/139#issuecomment-375620200, or mute the thread https://github.com/notifications/unsubscribe-auth/ABwNCdy5i05U7HBfb3guvnz7O7grNBJvks5thNJwgaJpZM4RS8Yv .

I started adding usb support to mt76/mt76x2 driver, I will keep you updated. Regards,

Lorenzo

-- UNIX is Sexy: who | grep -i blonde | talk; cd ~; wine; talk; touch; unzip; touch; strip; gasp; finger; gasp; mount; fsck; more; yes; gasp; umount; make clean; sleep

LorenzoBianconi commented 6 years ago

https://github.com/LorenzoBianconi/mt76/tree/mt76x2u Here I added mt76x2u support to mt76 driver. What are the idVendor and idProduct of your device? At the moment I added just the support for Netgear A6210

cyangy commented 6 years ago

@LorenzoBianconi I have tried https://github.com/ulli-kroll/mt7612u and https://github.com/genodeftest/Netgear-A6210 on latest Openwrt these days but it can not work ,you're so nice.

LorenzoBianconi commented 6 years ago

@cyangy: could you please provide me the idVendor and idProduct used by your device? (just plug-in the usb dongle and type lsusb). Please note fw images are not included yet, you can use the ones from mtk driver. Moreover you need to change openwrt mt76 package Makefile in order to compile mt76x2u module

cyangy commented 6 years ago

@LorenzoBianconi I use the NetGear A6210 , and I found that the idVendor and idProduct has been included in the { USB_DEVICE(0x0846, 0x9053) }, /* Netgear A6210 */ Now I am modfying the OpenWRT mt76 package Makefile to compile the module , I will tell you as soon as I finish it.

cyangy commented 6 years ago

@LorenzoBianconi : I had tested the driver on Linksys EA4500 v1 with latest LEDE use my Netgear A6210 and the 2.4G STA mode works fine , except a little problem described here . I'll be appreciated if these issues can be solved. Thanks again. also these are known idVendor and idProduct from here

{USB_DEVICE(0x0846, 0x9014)}, /* Netgear WNDA3100v3 */
{USB_DEVICE(0x0B05, 0x180B)}, /* ASUS USB-N53 */
{USB_DEVICE(0x0B05, 0x17EB)}, /* ASUS USB-AC55 */
{USB_DEVICE(0x045e, 0x02e6)}, /* Microsoft XBox One Wireless Adapter */
LorenzoBianconi commented 6 years ago

Cool, thx @cyangy for testing. For the moment ap mode is not supported. Does boot hang happen with dongle configured in ap or in sta?

Orfait commented 6 years ago

May i suggest you to look at this list. You will find a list of all known MT7612U vendorid and deviceid :

{USB_DEVICE(0x0e8d, 0x7612)}, // ALFA Network AWUS036ACM {USB_DEVICE(0x0b05, 0x1833)}, // ASUS USB-AC54 {USB_DEVICE(0x0b05, 0x17eb)}, // ASUS USB-AC55 {USB_DEVICE(0x0b05, 0x180b)}, // ASUS USB-N53 B1 {USB_DEVICE(0x0e8d, 0x7612)}, // EDUP EP-AC1601 {USB_DEVICE(0x0e8d, 0x7612)}, // EDUP EP-AC1605 {USB_DEVICE(0x7392, 0xb711)}, // Edimax EW-7722UAC {USB_DEVICE(0x0846, 0x9053)}, // Netgear A6210

LorenzoBianconi commented 6 years ago

@orfai: sure, for the moment I added just the device I was able to test. Are you able to test other devices?

Orfait commented 6 years ago

@LorenzoBianconi : I was try to help for the list of @cyangy. I only own a A6210 and I am still learning how to compile and add modules to openwrt. So, I can help for testing as soon as I can build by myself :)

cyangy commented 6 years ago

@LorenzoBianconi boot never hang, but if I keep USB insert , then power on the router, error message appears like mt76x2u 1-1:1.0: MAC RX failed to stop mt76x2u 1-1:1.0: error: mt76x2u_mcu_wait_resp timed out and the router become very slow I wonder if the timeout value too small , so after I use this patch , ` --- a/mt76x2u_mcu.c 2018-05-07 04:47:54.000000000 +0800 +++ b/mt76x2u_mcu.c 2018-05-09 15:00:56.063299831 +0800 @@ -59,7 +59,7 @@

for (i = 0; i < 5; i++) {
    if (!wait_for_completion_timeout(&dev->mcu.resp_cmpl,
-                        msecs_to_jiffies(300)))
+                        msecs_to_jiffies(30000)))

` the problem seems solved. Since I'm a newbee , I don't know if it's really solved

LorenzoBianconi commented 6 years ago

@cyangy ok, thx for the info. What is the mode configured in '/etc/config/wireless'? 30s seems to much, what about 500?

@Orfait any tests is very welcome. You can use the Makefile provided by @cyangy

cyangy commented 6 years ago

@LorenzoBianconi my /etc/config/wireless part related to mt7612u is

config wifi-device 'radio2' option type 'mac80211' option channel 'auto' option hwmode '11a' option path 'platform/ocp@f1000000/f1050000.ehci/usb1/1-1/1-1:1.0' option htmode 'HT40' option disabled '0'

config wifi-iface option device 'radio2' option network 'wan' option mode 'sta' option ssid 'CUG' option encryption 'none' option disabled '0'

which CUG is a router that provide both 5G and 2.4G signal. BUT it seems the frequence alaways 2.4G band the iwconfig shows

      IEEE 802.11  ESSID:"CUG"  
      Mode:Managed  Frequency:2.462 GHz  Access Point: 38:ED:18:CF:91:E0   
      Bit Rate=144.4 Mb/s   Tx-Power=19 dBm   
      RTS thr:off   Fragment thr:off
      Encryption key:off
      Power Management:off
      Link Quality=45/70  Signal level=-65 dBm  
      Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
      Tx excessive retries:1  Invalid misc:383   Missed beacon:0
LorenzoBianconi commented 6 years ago

@cyangy ok, thx. Does it hang at bootstrap with this configuration? 2.4GHz band only is something related to openwrt wpa_supplicant since plugging the dongle in my laptop works fine @5GHz as well.

cyangy commented 6 years ago

@LorenzoBianconi this configuration works fine except 5ghz not work.

LorenzoBianconi commented 6 years ago

@cyangy: I mean, does it hang at bootstrap if the dongle is plugged-in? The issue is that wpa_supplicant does not scan @5GHz. I will work on it

cyangy commented 6 years ago

@LorenzoBianconi NO, bootstrap is work well . sorry for my poor english hence I'm not a native english speaker.

LorenzoBianconi commented 6 years ago

In which condition bootstrap hangs? I mean using standard fw (mcu timeout set to 300ms)

cyangy commented 6 years ago

@LorenzoBianconi sorry for that, I mean the route become very slow like it hangs but not really . If I use standard fw (mcu timeout set to 300ms) , and keep the dongle plugged-in , power on it , then the message

      mt76x2u 1-1:1.0: MAC RX failed to stop
      mt76x2u 1-1:1.0: error: mt76x2u_mcu_wait_resp timed out

will appear continuously , the other process still output log to stdout, if mcu timeout set to 30000ms ,it works well.

Orfait commented 6 years ago

@LorenzoBianconi, @cyangy : I don't have such output in dmesg, but I am not able to join any network (the page /cgi-bin/luci/admin/network/wireless_join is empty).

cyangy commented 6 years ago

@Orfait may be you should add wireless config manually like I posted before.

did you find the wlanX after run ifconfig -a

LorenzoBianconi commented 6 years ago

@Orfait @cyangy : please use iw instead

iw dev wlanX scan

cyangy commented 6 years ago

OK.

Orfait commented 6 years ago

@LorenzoBianconi : Client mode seems to be working for me.

In fact, I am waiting for AP 😊 , but I can test client mode...

cyangy commented 6 years ago

@Orfait : Me too , does 5ghz work for you ?

LorenzoBianconi commented 6 years ago

@Orfait https://github.com/Orfait : Me too , does 5ghz work for you ?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/openwrt/mt76/issues/139#issuecomment-387736858, or mute the thread https://github.com/notifications/unsubscribe-auth/ABwNCfKxAG2p_Se09GcLimLxfR_XPDMVks5twu3UgaJpZM4RS8Yv .

@cyangy @Orfait https://github.com/Orfait: 5GHz works if you run the scan manually (e.g; iw dev wlanX scan). It is something related to wpa_supplicant not only driver related since running the diver on a laptop works properly @5GHz

Lorenzo

-- UNIX is Sexy: who | grep -i blonde | talk; cd ~; wine; talk; touch; unzip; touch; strip; gasp; finger; gasp; mount; fsck; more; yes; gasp; umount; make clean; sleep

Orfait commented 6 years ago

@cyangy : I cannot test 5 GHz, my actual router is 2.4 GHz only.

At the moment, I have 144 Mbits/s in RX, only 6.5 Mbits/s in TX (why ?)

cyangy commented 6 years ago

@Orfait : Actually, It doesn't matter, On my router there is a wlan interface (not A6210) which only shows 1.0 Mbit/s Tx rate , but it work well.

The A6210 on my router is

     Rx  300.0 Mbit/s, 40MHz, MCS 15, Short GI
     Tx   216.0 Mbit/s, 40MHz, MCS 13

By the way , the firmware has been updated, you shoud try it.

cyangy commented 6 years ago

@LorenzoBianconi : Thanks for your great work. I am live in GMT+8 ,so I have to go to sleep now. Bye @Orfait

araujorm commented 6 years ago

Hi.

I've been following this thread. I've got a EP-AC1601 dongle also. Managed to compile this driver on Fedora 26, kernel 4.15.15-200.fc26.x86_64, and I'm testing it.

For the device to be recognized, I had to had the 0e8d:7612 ID to the code, I ended up using:

diff --git a/mt76x2_usb.c b/mt76x2_usb.c
index 3cbd3ee..69a1b60 100644
--- a/mt76x2_usb.c
+++ b/mt76x2_usb.c
@@ -21,6 +21,11 @@

 static const struct usb_device_id mt76x2u_device_table[] = {
        { USB_DEVICE(0x0846, 0x9053) },         /* Netgear A6210 */
+       { USB_DEVICE(0x0b05, 0x1833) },         /* ASUS USB-AC54 */
+       { USB_DEVICE(0x0b05, 0x17eb) },         /* ASUS USB-AC55 */
+       { USB_DEVICE(0x0b05, 0x180b) },         /* ASUS USB-N53 B1 */
+       { USB_DEVICE(0x0e8d, 0x7612) },         /* EDUP EP-AC1601, EDUP EP-AC1605, ALFA Network AWUS036ACM */
+       { USB_DEVICE(0x7392, 0xb711) },         /* Edimax EW-7722UAC */
        { },
 };

As for the tests, the driver doesn't seem to support AC radio as it doesn't see my 5 GHz networks. Please tell me if you add anything you want me to test on that regard.

Regarding 2.4 GHz, I was able to achieve peaks of 60 Mbps on speedtest dot net, ending with 50 Mbps reported speed, which isn't bad at all (my Internet speed is 100 Mbps fibre, but we're talking 2.4 Ghz here).

Problems found:

Anything else you need me to test, please feel free to ask. If you prefer to discuss it on another issue on your repo (since I'm not using the USB driver with openwrt) please say, although I don't think it will make much difference.

cyangy commented 6 years ago

@araujorm Are you use the firmwre THIS COMMIT , Sorry for that , It seems the latest firmware have some problem ,I just restore to previous version firmware,you could try it

LorenzoBianconi commented 6 years ago

@cyangy , @araujorm , @Orfait could you please try: mt76x2u_testing commit 2e04878bc5ebb5cc56257a0e879d744a8e506adc.

5GHz scanning should be fixed now

Orfait commented 6 years ago

@LorenzoBianconi : I cannot test 5 GHZ as I don't have any AP in this band.

cyangy commented 6 years ago

@LorenzoBianconi I'm testing...

cyangy commented 6 years ago

@LorenzoBianconi @Orfait : I have test the 5GHz, now even from the LUCI web interface , I can scan and join a network no matter it is 2.4GHz or 5GHz. Let me show you the evidence

iwlist wlan2 channel
shows wlan2 32 channels in total; available frequencies : Channel 01 : 2.412 GHz Channel 02 : 2.417 GHz Channel 03 : 2.422 GHz Channel 04 : 2.427 GHz Channel 05 : 2.432 GHz Channel 06 : 2.437 GHz Channel 07 : 2.442 GHz Channel 08 : 2.447 GHz Channel 09 : 2.452 GHz Channel 10 : 2.457 GHz Channel 11 : 2.462 GHz Channel 12 : 2.467 GHz Channel 13 : 2.472 GHz Channel 14 : 2.484 GHz Channel 36 : 5.18 GHz Channel 40 : 5.2 GHz Channel 44 : 5.22 GHz Channel 48 : 5.24 GHz Channel 52 : 5.26 GHz Channel 56 : 5.28 GHz Channel 60 : 5.3 GHz Channel 64 : 5.32 GHz Channel 100 : 5.5 GHz Channel 104 : 5.52 GHz Channel 108 : 5.54 GHz Channel 112 : 5.56 GHz Channel 116 : 5.58 GHz Channel 120 : 5.6 GHz Channel 124 : 5.62 GHz Channel 128 : 5.64 GHz Channel 132 : 5.66 GHz Channel 136 : 5.68 GHz Current Frequency:5.18 GHz (Channel 36)

:+1:

LorenzoBianconi commented 6 years ago

@cyangy thx for testing, I will push the commits to mt76x2u

cyangy commented 6 years ago

@LorenzoBianconi : OK :1st_place_medal:

Orfait commented 6 years ago

@cyangy : Do you plan to make also AP mode ?

cyangy commented 6 years ago

@Orfait : Sorry, I'm newbee in linux, I just can write some short and basic function , so I can not do something like write driver for a device . I hope someday I can write a driver for a device after learning .

LorenzoBianconi commented 6 years ago

@araujorm if you prefer to test the driver on your pc you can use https://github.com/LorenzoBianconi/wireless-drivers-next/tree/mt76x2u

araujorm commented 6 years ago

Great, I will try later. Thanks.

On 05/10/2018 05:10 PM, Lorenzo Bianconi wrote:

@araujorm https://github.com/araujorm if you prefer to test the driver on your pc you can use https://github.com/LorenzoBianconi/wireless-drivers-next/tree/mt76x2u

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub , or mute the thread .
Orfait commented 6 years ago

@cyangy : Sorry, the question about AP mode was for @LorenzoBianconi 😉

pellerb commented 6 years ago

Hi, My EDUP EP-AC1605 WiFi adapter has MediaTek MT7612U controller. Its VendorID=0E8D and ProductID=7612. Thanks for your help, regards, Balázs

LorenzoBianconi commented 6 years ago

@pellerb it is already supported

pellerb commented 6 years ago

Ok, I can see that it's the same as Aukey USB-AC1200. Thanks, I will try it with EDUP EP-AC1605.

araujorm commented 6 years ago

Hello.

I confirm that 5 GHz networks are now visible and connectable.

However after a while it all stops working, as if the already established connection freezes for about 10 seconds or more, until it starts works again. A ping test even reported 15000 ms response time once, so it doesn't seem to be packet loss but something that hangs for a while. Nothing on dmesg while it happens. Is there any debug setting one should activate to try to understand what's going wrong?

Also, after a cold boot, the problem I mentioned earlier with the module hanging after inserted still persists. I have to unplug the device for modprobe to return. Here's journalctl -f output while it happened (kept going until I unplugged the device):

May 10 21:00:02 zoo.localdomain kernel: cfg80211: Loading compiled-in X.509 certificates for regulatory database
May 10 21:00:02 zoo.localdomain kernel: cfg80211: Loaded X.509 cert 'sforshee: 00b28ddf47aef9cea7'
May 10 21:00:02 zoo.localdomain kernel: platform regulatory.0: Direct firmware load for regulatory.db failed with error -2
May 10 21:00:02 zoo.localdomain kernel: cfg80211: failed to load regulatory.db
May 10 21:00:02 zoo.localdomain kernel: usb 2-1.5: reset high-speed USB device number 6 using ehci-pci
May 10 21:00:02 zoo.localdomain kernel: mt76x2u 2-1.5:1.0: ASIC revision: 76120044
May 10 21:00:02 zoo.localdomain kernel: mt76x2u 2-1.5:1.0: ROM patch build: 20140408060640a
May 10 21:00:05 zoo.localdomain kernel: mt76x2u 2-1.5:1.0: vendor request req:07 off:09a8 failed:-110
May 10 21:00:09 zoo.localdomain kernel: mt76x2u 2-1.5:1.0: vendor request req:06 off:09a8 failed:-110
May 10 21:00:12 zoo.localdomain kernel: mt76x2u 2-1.5:1.0: vendor request req:42 off:0230 failed:-110
May 10 21:00:15 zoo.localdomain kernel: mt76x2u 2-1.5:1.0: vendor request req:42 off:0232 failed:-110
May 10 21:00:18 zoo.localdomain kernel: mt76x2u 2-1.5:1.0: vendor request req:42 off:0234 failed:-110
May 10 21:00:21 zoo.localdomain kernel: mt76x2u 2-1.5:1.0: vendor request req:42 off:0236 failed:-110
May 10 21:00:25 zoo.localdomain kernel: mt76x2u 2-1.5:1.0: vendor request req:07 off:09a8 failed:-110
May 10 21:00:28 zoo.localdomain kernel: mt76x2u 2-1.5:1.0: vendor request req:06 off:09a8 failed:-110
May 10 21:00:31 zoo.localdomain kernel: mt76x2u 2-1.5:1.0: vendor request req:42 off:0230 failed:-110
May 10 21:00:34 zoo.localdomain kernel: mt76x2u 2-1.5:1.0: vendor request req:42 off:0232 failed:-110

Plugging the device with the module already loaded, it started working (with the occasional freezings I mentioned first).

Finally, when doing rmmod mt76x2u mt76x2_common mt76 I get:

May 10 21:39:43 zoo.localdomain kernel: rx urb mismatch
May 10 21:39:43 zoo.localdomain kernel: WARNING: CPU: 0 PID: 0 at /home/rod/mt76/mt76/usb.c:345 mt76_usb_complete_rx+0xc9/0xe0 [mt76]
May 10 21:39:43 zoo.localdomain kernel: Modules linked in: mt76x2u(OE-) mt76x2_common(OE) mt76(OE) ccm arc4 mac80211 cfg80211 rfcomm ip6t_rpfilter ip6t_REJECT nf_reject_ipv6 xt_conntrack ip_set nfnetlink ebtable_nat ebtable_broute bridge stp llc ip6table_nat nf_conntrack_ipv6 nf_defrag_ipv6 nf_nat_ipv6 ip6table_mangle ip6table_raw ip6table_security iptable_nat nf_conntrack_ipv4 nf_defrag_ipv4 nf_nat_ipv4 nf_nat nf_conntrack libcrc32c iptable_mangle iptable_raw iptable_security ebtable_filter ebtables ip6table_filter ip6_tables cmac bnep sunrpc vfat fat fuse nvidia_drm(POE) nvidia_modeset(POE) nvidia(POE) btusb btrtl btbcm btintel bluetooth snd_usb_audio ecdh_generic snd_usbmidi_lib snd_rawmidi intel_rapl snd_hda_codec_hdmi x86_pkg_temp_thermal intel_powerclamp coretemp kvm_intel snd_hda_codec_realtek kvm snd_hda_codec_generic
May 10 21:39:43 zoo.localdomain kernel:  snd_hda_intel irqbypass snd_hda_codec drm_kms_helper snd_hda_core crct10dif_pclmul crc32_pclmul snd_hwdep iTCO_wdt ghash_clmulni_intel iTCO_vendor_support snd_seq drm intel_cstate snd_seq_device intel_uncore eeepc_wmi snd_pcm asus_wmi intel_rapl_perf ipmi_devintf ipmi_msghandler snd_timer sparse_keymap rfkill snd mei_me wmi_bmof i2c_i801 soundcore mei shpchp lpc_ich binfmt_misc mxm_wmi firewire_ohci r8169 firewire_core crc32c_intel serio_raw mii crc_itu_t wmi video uas usb_storage analog gameport joydev vboxpci(OE) vboxnetadp(OE) vboxnetflt(OE) vboxdrv(OE) [last unloaded: mt76]
May 10 21:39:43 zoo.localdomain kernel: CPU: 0 PID: 0 Comm: swapper/0 Tainted: P        W  OE    4.15.15-200.fc26.x86_64 #1
May 10 21:39:43 zoo.localdomain kernel: Hardware name: System manufacturer System Product Name/P8P67-M PRO, BIOS 3701 11/30/2012
May 10 21:39:43 zoo.localdomain kernel: RIP: 0010:mt76_usb_complete_rx+0xc9/0xe0 [mt76]
May 10 21:39:43 zoo.localdomain kernel: RSP: 0018:ffff9ba51ec03ea0 EFLAGS: 00010086
May 10 21:39:43 zoo.localdomain kernel: RAX: 0000000000000000 RBX: ffff9ba491f51520 RCX: ffffffffa2253848
May 10 21:39:43 zoo.localdomain kernel: RDX: 0000000000000001 RSI: 0000000000000086 RDI: 0000000000000087
May 10 21:39:43 zoo.localdomain kernel: RBP: ffff9ba491f52310 R08: 00000000000004ab R09: ffffffffa295b600
May 10 21:39:43 zoo.localdomain kernel: R10: ffff9ba51ec03f20 R11: 0000000000000000 R12: ffff9ba4921d3600
May 10 21:39:43 zoo.localdomain kernel: R13: 0000000000000000 R14: ffff9ba514c459a4 R15: ffff9ba4921d3600
May 10 21:39:43 zoo.localdomain kernel: FS:  0000000000000000(0000) GS:ffff9ba51ec00000(0000) knlGS:0000000000000000
May 10 21:39:43 zoo.localdomain kernel: CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
May 10 21:39:43 zoo.localdomain kernel: CR2: 000055d4d39347b0 CR3: 000000004320a002 CR4: 00000000000606f0
May 10 21:39:43 zoo.localdomain kernel: Call Trace:
May 10 21:39:43 zoo.localdomain kernel:  <IRQ>
May 10 21:39:43 zoo.localdomain kernel:  __usb_hcd_giveback_urb+0x9c/0x140
May 10 21:39:43 zoo.localdomain kernel:  usb_giveback_urb_bh+0xaa/0x110
May 10 21:39:43 zoo.localdomain kernel:  tasklet_action+0x5f/0x110
May 10 21:39:43 zoo.localdomain kernel:  __do_softirq+0xe7/0x2cb
May 10 21:39:43 zoo.localdomain kernel:  irq_exit+0xf1/0x100
May 10 21:39:43 zoo.localdomain kernel:  do_IRQ+0x7d/0xc0
May 10 21:39:43 zoo.localdomain kernel:  common_interrupt+0x87/0x87
May 10 21:39:43 zoo.localdomain kernel:  </IRQ>
May 10 21:39:43 zoo.localdomain kernel: RIP: 0010:cpuidle_enter_state+0x9f/0x2e0
May 10 21:39:43 zoo.localdomain kernel: RSP: 0018:ffffffffa2203e88 EFLAGS: 00000246 ORIG_RAX: ffffffffffffffdc
May 10 21:39:43 zoo.localdomain kernel: RAX: ffff9ba51ec20a80 RBX: 00000291100288b2 RCX: 000000000000001f
May 10 21:39:43 zoo.localdomain kernel: RDX: 00000291100288b2 RSI: fffffffb39e0dc61 RDI: 0000000000000000
May 10 21:39:43 zoo.localdomain kernel: RBP: ffff9ba51ec2a400 R08: 000000000000036e R09: 0000000000000477
May 10 21:39:43 zoo.localdomain kernel: R10: ffffffffa2203e68 R11: 00000000000002b6 R12: 0000000000000004
May 10 21:39:43 zoo.localdomain kernel: R13: ffffffffa22d1438 R14: 0000000000000000 R15: 000002910fe3028a
May 10 21:39:43 zoo.localdomain kernel:  ? cpuidle_enter_state+0x92/0x2e0
May 10 21:39:43 zoo.localdomain kernel:  do_idle+0x17b/0x1d0
May 10 21:39:43 zoo.localdomain kernel:  cpu_startup_entry+0x6f/0x80
May 10 21:39:43 zoo.localdomain kernel:  start_kernel+0x4e0/0x500
May 10 21:39:43 zoo.localdomain kernel:  secondary_startup_64+0xa5/0xb0
May 10 21:39:43 zoo.localdomain kernel: Code: d4 18 6e c0 e8 a9 e7 ea e0 eb 81 80 3d 64 51 00 00 00 75 d5 48 c7 c7 aa 18 6e c0 48 89 34 24 c6 05 50 51 00 00 01 e8 67 a8 9c e0 <0f> 0b 48 8b 34 24 eb b6 0f 1f 44 00 00 66 2e 0f 1f 84 00 00 00 

After that, trying to modprobe mt76x2u again doesn't hang, but still has the connection freezings issue.

All this was tried the new firmware, the old and the one from https://github.com/ulli-kroll/mt7612u, I didn't notice any difference.

Any thing I should try? Remember, Fedora 26 x86_64 here.

Thanks and best regards.

LorenzoBianconi commented 6 years ago

@araujorm thx a lot for testing 1- Are you using the kernel source from my github repo or have you backported just the mt76 driver? Huge ping delay seems related to this issue 2- If I understood correctly, if the dongle is plugged in your pc at device bootstrap it will properly work just once, if you reboot the pc without unplugging the dongle it will not be loaded properly. Correct? 3- Before rmmod mt76x2u mt76x2_common, have you stopped wpa_supplicant? (I agree it should not crash even if wpa_supplicant is still running)

araujorm commented 6 years ago

@LorenzoBianconi:

1- Are you using the kernel source from my github repo or have you backported just the mt76 driver? Huge ping delay seems related to this issue

Compiled the mt76 driver only for my kernel, taken from your mt76/tree/mt76x2u. Kernel is Fedora's 4.15.15-200.fc26.x86_64.

2- If I understood correctly, if the dongle is plugged in your pc at device bootstrap it will properly work just once, if you reboot the pc without unplugging the dongle it will not be loaded properly. Correct?

I've done some more testing. It seems to only happen if I power off the machine, wait a while and then power it up, then the first time the module is inserted with the dongle already plugged in the firmware upload hangs with the mentioned errors. If I just reboot having previously used the device, even if I reboot from Windows, it doesn't hang, at least it didn't just now. I may also mention that the device works without issues from Windows non-stop, so it doesn't seem to be a hardware failure, and USB support seems stable for other devices on my machine on both Windows and Linux.

3- Before rmmod mt76x2u mt76x2_common, have you stopped wpa_supplicant? (I agree it should not crash even if wpa_supplicant is still running)

Well, wpa_supplicant was running. I did some more testing and disconnected, and if wpa_supplicant is running, even if it (supposedly) isn't doing anything, I get that crash when doing rmmod. But if I stop wpa_supplicant, I don't get the crash.

Are there any printk I could add anywhere, or any debug mode I could activate to provide more info? Any other suggestions or anything, please feel free to ask.

cyangy commented 6 years ago

@LorenzoBianconi : When bootup , rx urb mismatch problem bother me days. if I reboot the router without unplugging the dongle , sometimes(about 90%) the problem happens,and sometimes is just fine

when the issuse happens , the log realated it is

[    8.603478] usb 1-1: reset high-speed USB device number 2 using orion-ehci
[    8.804468] mt76x2u 1-1:1.0: ASIC revision: 76120044
[    8.836158] mt76x2u 1-1:1.0: ROM patch build: 20140408060640a
[    8.910710] ------------[ cut here ]------------
[    8.915372] WARNING: CPU: 0 PID: 0 at /home/myname/LEDE/build_dir/target-arm_xscale_musl_eabi/linux-kirkwood/mt76-mt76x2u-758f64a1/usb.c:345 mt76_usb_complete_rx+0x90/0x100 [mt76]
[    8.931345] rx urb mismatch
[    8.931349] Modules linked in: mt76x2u(+) mt76x2_common mt76 mac80211 iptable_nat ipt_REJECT ipt_MASQUERADE cfg80211 xt_time xt_tcpudp xt_state xt_nat xt_multiport xt_mark xt_mac xt_limit xt_conntrack 
xt_comment xt_TCPMSS xt_REDIRECT xt_LOG xt_FLOWOFFLOAD slhc nf_reject_ipv4 nf_nat_redirect nf_nat_masquerade_ipv4 nf_conntrack_ipv4 nf_nat_ipv4 nf_nat nf_log_ipv4 nf_flow_table_hw nf_flow_table nf_defrag_
ipv6 nf_defrag_ipv4 nf_conntrack_rtcache nf_conntrack_netlink nf_conntrack iptable_mangle iptable_filter ip_tables crc_itu_t crc_ccitt compat xt_set ip_set_list_set ip_set_hash_netiface ip_set_hash_netpor
t ip_set_hash_netnet ip_set_hash_net ip_set_hash_netportnet ip_set_hash_mac ip_set_hash_ipportnet ip_set_hash_ipportip ip_set_hash_ipport ip_set_hash_ipmark ip_set_hash_ip ip_set_bitmap_port ip_set_bitmap
_ipmac
[    9.006136]  ip_set_bitmap_ip ip_set nfnetlink ip6t_REJECT nf_reject_ipv6 nf_log_ipv6 nf_log_common ip6table_mangle ip6table_filter ip6_tables x_tables tun xhci_plat_hcd xhci_pci xhci_hcd ehci_platform
[    9.024149] CPU: 0 PID: 0 Comm: swapper Not tainted 4.14.37 #0
[    9.030004] Hardware name: Marvell Kirkwood (Flattened Device Tree)
[    9.036291] Backtrace: 
[    9.038765] [<c0105e1c>] (dump_backtrace) from [<c0106104>] (show_stack+0x18/0x1c)
[    9.046367]  r7:bf3a30f0 r6:00000000 r5:bf3a4f30 r4:c0801d90
[    9.052064] [<c01060ec>] (show_stack) from [<c05886c0>] (dump_stack+0x20/0x28)
[    9.059328] [<c05886a0>] (dump_stack) from [<c01103d8>] (__warn+0xe0/0x10c)
[    9.066320] [<c01102f8>] (__warn) from [<c0110444>] (warn_slowpath_fmt+0x40/0x48)
[    9.073837]  r9:00000040 r8:ffffe000 r7:60000093 r6:c6969b90 r5:c69f0080 r4:bf3a4f20
[    9.081623] [<c0110408>] (warn_slowpath_fmt) from [<bf3a30f0>] (mt76_usb_complete_rx+0x90/0x100 [mt76])
[    9.091054]  r3:bf3a610c r2:bf3a4f20
[    9.094636]  r4:c6969460
[    9.097196] [<bf3a3060>] (mt76_usb_complete_rx [mt76]) from [<c0428f5c>] (__usb_hcd_giveback_urb+0xac/0x104)
[    9.107067]  r7:c6a558e0 r6:00000000 r5:60000013 r4:c69f0080
[    9.112757] [<c0428eb0>] (__usb_hcd_giveback_urb) from [<c0429044>] (usb_giveback_urb_bh+0x90/0xd4)
[    9.121838]  r7:c6a558e0 r6:00000000 r5:c0801df8 r4:c6a558dc
[    9.127526] [<c0428fb4>] (usb_giveback_urb_bh) from [<c01141b8>] (tasklet_action+0x84/0xcc)
[    9.135911]  r7:00000100 r6:00000000 r5:c0808fa0 r4:00000000
[    9.141598] [<c0114134>] (tasklet_action) from [<c01014d0>] (__do_softirq+0x118/0x2fc)
[    9.149550]  r7:00000100 r6:00000018 r5:00000006 r4:c084d138
[    9.155236] [<c01013b8>] (__do_softirq) from [<c0113d98>] (irq_exit+0xa4/0xf8)
[    9.162492]  r10:00000000 r9:c0801f00 r8:c7809400 r7:00000001 r6:00000000 r5:c0847824
[    9.170351]  r4:00000000
[    9.172903] [<c0113cf4>] (irq_exit) from [<c013f548>] (__handle_domain_irq+0x8c/0xa8)
[    9.180771] [<c013f4bc>] (__handle_domain_irq) from [<c010138c>] (orion_handle_irq+0x74/0xa0)
[    9.189333]  r9:c0801f00 r8:00000001 r7:c087a87c r6:c781a01c r5:00080000 r4:00000013
[    9.197112] [<c0101318>] (orion_handle_irq) from [<c0106be8>] (__irq_svc+0x68/0x84)
[    9.204797] Exception stack(0xc0801f00 to 0xc0801f48)
[    9.209869] 1f00: 00000000 00000000 00000000 60000013 00000000 ffffe000 c0803088 c083ebf0
[    9.218082] 1f20: c080c2fa c0669220 00000000 c0801f5c c0801f50 c0801f50 c0102f60 c05a4464
[    9.226292] 1f40: 60000013 ffffffff
[    9.229794]  r10:00000000 r9:c0800000 r8:c080c2fa r7:c0801f34 r6:ffffffff r5:60000013
[    9.237653]  r4:c05a4464
[    9.240208] [<c05a442c>] (default_idle_call) from [<c0138c28>] (do_idle+0x84/0x144)
[    9.247895] [<c0138ba4>] (do_idle) from [<c0138f48>] (cpu_startup_entry+0x14/0x18)
[    9.255500]  r10:00735474 r9:c0736a20 r8:c7ffca60 r7:00000000 r6:c0803020 r5:ffffffff
[    9.263360]  r4:c080a90c r3:40000013
[    9.266948] [<c0138f34>] (cpu_startup_entry) from [<c059f238>] (rest_init+0x74/0x94)
[    9.274729] [<c059f1c4>] (rest_init) from [<c0700d54>] (start_kernel+0x3a4/0x428)
[    9.282240]  r5:ffffffff r4:c084caa0
[    9.285828] [<c07009b0>] (start_kernel) from [<00008048>] (0x8048)
[    9.292031] ---[ end trace 0e412fa249281f90 ]---
[    9.354707] mt76x2u 1-1:1.0: Firmware Version: 0.0.00
[    9.359789] mt76x2u 1-1:1.0: Build: 1
[    9.363534] mt76x2u 1-1:1.0: Build Time: 201406241830____
[   10.299574] usbcore: registered new interface driver mt76x2u
                       ............................

[   23.451087] mt76x2u 1-1:1.0: error: mt76x2u_mcu_wait_resp timed out
[   25.043805] mt76x2u 1-1:1.0: error: mt76x2u_mcu_wait_resp timed out
[   26.623541] mt76x2u 1-1:1.0: error: mt76x2u_mcu_wait_resp timed out
[   29.743608] mt76x2u 1-1:1.0: error: mt76x2u_mcu_wait_resp timed out
[   31.303541] mt76x2u 1-1:1.0: error: mt76x2u_mcu_wait_resp timed out
                       ............................

even I increase the value of MT_VEND_REQ_MAX_RETRY and MT_VEND_REQ_TOUT_MS in usb.c can not solve it. In my humble opinion, is it something related to the USB init ? How about init the USB device more than one time to avoid this issuse?