OPNsense Forum

Archive => 17.1 Legacy Series => Topic started by: alphastar on February 05, 2017, 04:29:18 pm

Title: [SOLVED] USB/WiFi 802.11n capability in 17.1 kernel/if_run(4)
Post by: alphastar on February 05, 2017, 04:29:18 pm
Trying to connect to a mixed-mode AP in 802.11n mode (300Mbps) does not seem possible with run0_wlan1 interface (USB Linksys AE1000):

dmesg
Code: [Select]
run0: <Linksys Linksys AE1000, class 0/0, rev 2.00/1.01, addr 1> on usbus0
run0: MAC/BBP RT3572 (rev 0x0221), RF RT3052 (MIMO 2T2R), address 00:25:9c:f8:41:3e
wlan1: changing name to 'run0_wlan1'
run0: firmware RT3071 ver. 0.33 loaded
run0: firmware RT3071 ver. 0.33 loaded
run0_wlan1: link state changed to UP

ifconfig
Code: [Select]
run0_wlan1: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
        ether 00:25:9c:f8:41:3e
        inet6 fe80::225:9cff:fef8:413e%run0_wlan1 prefixlen 64 scopeid 0x9
        inet 192.168.0.56 netmask 0xffffff00 broadcast 192.168.0.255
        nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>
        media: IEEE 802.11 Wireless Ethernet DS/11Mbps mode 11b
        status: associated
        ssid ISP channel 6 (2437 MHz 11b) bssid 12:34:65:a3:ac:ca:fe
        regdomain FCC country CA authmode WPA2/802.11i privacy ON
        deftxkey UNDEF AES-CCM 2:128-bit AES-CCM 3:128-bit txpower 30 bmiss 7
        scanvalid 60 roaming MANUAL
        groups: wlan

# ifconfig run0_wlan1 list caps
drivercaps=d85c501<STA,IBSS,HOSTAP,SHSLOT,SHPREAMBLE,MONITOR,MBSS,WPA1,WPA2,WME,WDS>
cryptocaps=1b<WEP,TKIP,AES_CCM,TKIPMIC>

Note the line that says media: IEEE 802.11 Wireless Ethernet DS/11Mbps mode 11b.

Under Interfaces, the Speed and duplex is set to Default (no preference, typically autoselect) (DS and OFDM options for b, g, and n are options) and Standard is set to 802.11a (802.11b and 802.11g are options).

wpa_supplicant
Code: [Select]
ctrl_interface=/var/run/wpa_supplicant
ctrl_interface_group=0
ap_scan=1
#fast_reauth=1
network={
ssid="ISP"
scan_ssid=1
priority=5
key_mgmt=WPA-PSK
psk="password"
pairwise=CCMP
group=CCMP

Does the if_run(4) USB driver support 802.11n in OPNsense 17.1?
Title: Re: USB/WiFi 802.11n capability in 17.1 kernel/if_run(4)
Post by: alphastar on February 09, 2017, 01:15:25 pm
Found the answers to my own question(s):

https://wiki.freebsd.org/WiFi
https://en.wikipedia.org/wiki/Comparison_of_open-source_wireless_drivers#Driver_capabilities_2
https://man.freebsd.org/if_run/4

The Linksys AE1000 is supported out of the box.  For Linksys AE3000 and AE6000 adapter support, see https://github.com/opnsense/tools (edit /usr/src/sys/dev/usb/usbdevs to add the following):

Code: [Select]
product CISCOLINKSYS AE3000     0x003b  AE3000
product CISCOLINKSYS AE6000     0x003e  AE6000

...then edit /usr/src/sys/dev/usb/wlan/if_run.c:

Code: [Select]
RUN_DEV(CISCOLINKSYS,             AE3000),
RUN_DEV(CISCOLINKSYS,             AE6000),

 and then make kernel)

Note: 802.11 speed is still limited to supported speed for if_run(4) + WiFi in FreeBSD.
Title: Re: [SOLVED] USB/WiFi 802.11n capability in 17.1 kernel/if_run(4)
Post by: franco on February 09, 2017, 01:23:22 pm
Hey,

Thanks for the pointers. We can add this to the kernel, no problem:

https://github.com/opnsense/src/issues/17


Cheers,
Franco
Title: Re: [SOLVED] USB/WiFi 802.11n capability in 17.1 kernel/if_run(4)
Post by: alphastar on February 09, 2017, 01:34:51 pm
Thanks Franco,

Can't wait to test it out in the next version!

A.
Title: Re: [SOLVED] USB/WiFi 802.11n capability in 17.1 kernel/if_run(4)
Post by: franco on February 16, 2017, 05:42:48 pm
Hi there,

This will be part of 17.1.2. We can't provide guarantees the devices work error Free without further driver adjustments/fixes, but having the devices recognised is a first step to actually find out. ;)


Cheers,
Franco
Title: Re: [SOLVED] USB/WiFi 802.11n capability in 17.1 kernel/if_run(4)
Post by: alphastar on May 19, 2017, 09:30:19 pm
Update [17.1.7]

Just got around to testing this with 17.1.7 and AE6000.  Plugged the AE6000 via rear USB 3.0 port (APU2C4) and a new run0 device appears in <GUI>Wireless, and although the config is nearly identical to the ath0 device (Compex WLE200NX, working fine), there is no activity light on the AE6000 adapter.

This is with the Linksys AE6000, aka AC580 connected,  from the System: Log File:

Code: [Select]
May 19 05:05:34 kernel: run0: could not load 8051 microcode
May 19 05:05:34 kernel: run0: timeout waiting for MCU to initialize
May 19 05:05:19 kernel: run0: could not load 8051 microcode
May 19 05:05:19 kernel: run0: timeout waiting for MCU to initialize
May 19 05:05:04 kernel: run0: could not load 8051 microcode
May 19 05:05:04 kernel: run0: timeout waiting for MCU to initialize
May 19 05:04:49 kernel: run0: could not load 8051 microcode
May 19 05:04:49 kernel: run0: timeout waiting for MCU to initialize
May 19 05:04:34 kernel: wlan1: changing name to 'run0_wlan1'
May 19 05:04:34 opnsense: /usr/local/etc/rc.bootup: Cloning new wireless interface run0_wlan1
May 19 05:04:33 kernel: run0: MAC/BBP RT7650 (rev 0x2000), RF RT3053 (MIMO 1T1R), address c8:d7:19:d4:e5:f6
May 19 05:04:33 kernel: run0: <vendor 0x13b1 product 0x003e, class 0/0, rev 2.00/1.00, addr 1> on usbus0


This discussion (24 Mar 2017) (https://www.mail-archive.com/tech@openbsd.org/msg38006.html) suggests that it could be an error with FreeBSD mis-identification of the built-in chip (i.e. inability to match the firmware to the device).  The run0: firmware RT3071 does support the MT7610U chip in the AE6000.

For comparison, here is a successful initialization of the Linksys AE1000, aka WUSB600Nv2, tested in AP mode:

Code: [Select]
May 19 09:18:05 kernel: run0_wlan1: promiscuous mode enabled
May 19 09:17:57 kernel: run0: firmware RT3071 ver. 0.33 loaded
May 19 09:17:55 kernel: run0: firmware RT3071 ver. 0.33 loaded
May 19 09:17:52 kernel: run0: firmware RT3071 ver. 0.33 loaded
May 19 09:17:49 kernel: run0: firmware RT3071 ver. 0.33 loaded
May 19 09:17:45 kernel: wlan1: changing name to 'run0_wlan1'
May 19 09:17:44 opnsense: /usr/local/etc/rc.bootup: Cloning new wireless interface run0_wlan1
May 19 09:17:44 kernel: run0: MAC/BBP RT3572 (rev 0x0221), RF RT3052 (MIMO 2T2R), address 00:25:9c:a1:b2:c3
May 19 09:17:44 kernel: run0: <Linksys Linksys AE1000, class 0/0, rev 2.00/1.01, addr 1> on usbus0

and the Linksys AE3000 aka N900 (also successful, AP mode):

Code: [Select]
May 19 14:21:02 kernel: run0_wlan1: promiscuous mode enabled
May 19 14:20:54 kernel: run0: firmware RT3071 ver. 0.33 loaded
May 19 14:20:52 kernel: run0: firmware RT3071 ver. 0.33 loaded
May 19 14:20:49 kernel: run0: firmware RT3071 ver. 0.33 loaded
May 19 14:20:46 kernel: run0: firmware RT3071 ver. 0.33 loaded
May 19 14:20:42 kernel: wlan1: changing name to 'run0_wlan1'
May 19 14:20:42 opnsense: /usr/local/etc/rc.bootup: Cloning new wireless interface run0_wlan1
May 19 14:20:41 kernel: run0: MAC/BBP RT3593 (rev 0x0402), RF RT3053 (MIMO 3T3R), address c8:d7:19:01:0b:03
May 19 14:20:41 kernel: run0: <Linksys> on usbus0

While the AE1000 and AE3000 work, only 802.11b/g/a is supported (the run(4) FreeBSD driver does not support 802.11n features, see this link (https://www.freebsd.org/cgi/man.cgi?run(4)).)

Finally, the following messages appear to be common to all adapters (these appear to be random, at least in 17.1.7.  Not sure it causes any problems, but may require further investigation.):

Code: [Select]
May 19 05:30:25 kernel: run0_wlan1: ieee80211_new_state_locked: pending RUN -> SCAN transition lost
May 19 05:30:25 kernel: ieee80211_new_state_locked: pending RUN -> SCAN transition lost
May 19 05:15:10 opnsense: /interfaces_assign.php: The command `/sbin/ifconfig -m 'run0'' failed to execute ifconfig: interface run0 does not exist
May 19 05:14:42 kernel: run0_wlan1: promiscuous mode enabled
May 19 05:14:41 kernel: run0_wlan1: promiscuous mode disabled
May 19 05:11:14 opnsense: /interfaces_wireless_edit.php: The command `/sbin/ifconfig -m 'run0'' failed to execute ifconfig: interface run0 does not exist
May 19 05:05:41 kernel: run0_wlan1: promiscuous mode enabled

A.
Title: Re: [SOLVED] USB/WiFi 802.11n capability in 17.1 kernel/if_run(4)
Post by: franco on May 22, 2017, 08:01:21 am
Hmm, so what shall we do?
Title: Re: [SOLVED] USB/WiFi 802.11n capability in 17.1 kernel/if_run(4)
Post by: alphastar on December 20, 2017, 11:10:46 am
Bumping (revisiting) this to provide more info, as I had to review to refresh my memory on what was going on with WiFi on my APU again.  To summarize:

Interfaces > Assignments
OPT1: ath0_wlan1()
OPT2: run0_wlan1()

Interfaces > [OPT1]
Standard: 802.11b, 802.11ng, 802.11g, 802.11a, 802.11na

Interfaces > [OPT2]
Standard: 802.11b, 802.11g, 802.11a

Although the links explain it above, the issue remains that my [OPT2]Linksys AE3000 (USB, 3T3R) should be at least equivalent to the [OPT1]Compex WLE200NX (miniPCIe, 2T2R) - but it isn't because of the FreeBSD driver.  (For those who haven't read above: It's not an OPNSense issue AT ALL)



In terms of next steps IMHO...well...looks like most of us are waiting on this guy:
http://adrianchadd.blogspot.ca/2017/04/bringing-up-80211ac-on-freebsd.html

If I might though, perhaps an OPNsense hardware (detection) GUI page might be useful? 

[EDIT:] It appears that I hadn't paid close enough attention to the GUI before.  On 17.7.10, Lobby > Dashboard > Interface List (bottom right corner) clearly shows which interfaces are WiFi (nice icons!), and the current operating rates (802.11 mode).  Coupled with Interfaces > Overview it should be everything you need to get things figured out.