Support for WAVE 300 Wi-Fi chip


#105

I think that's why rflib is in binary
lq-wave-300-Source03.05.00.00.31.35323c99ad43.wls.src distribution Part Binary/Part Source Licence GPL_BSD

08/Feature_Support UGW_Rel6.1.1_CS_Rev1.0.pdf pag 11

Exists Addon CDs with Premium Licenses available for distribution and need specific license agreement with Lantiq before being distributed to customers:
UGW-6.1.1-WLAN-CD.zip This CD is a Premium Package and contains the sources for the Lantiq Wireless Subsystem.

01_Getting_Started/UGW_Rel6.1.1_GS_Rev1.0.pdf pag9

Contents of WLAN_CD

lq-wave-300-03.05.00.00.31.35323c99ad43.wls.src License GPL_BSD Distribution Source

lq-wave-300-03.04.02.00.25.c9c85872fd07.rflib.wls.src License Lantiq Distribution Source

08/Feature_Support UGW_Rel6.1.1_CS_Rev1.0.pdf pag 18

Licence Type Lantiq Lantiq – Lantiq Productive: License Grant: Evaluation and Demonstration License Grant & Productive Use License Grant

In UGW_6.10 there is the driver 3.4.2

02/Release_Notes/UGW_Rel6.1.1_RN_Rev1.0.pdf pag 14


#106

The question is what has higher priority GPL, where you are permitted to obtain/modify/reshare the source code for any GPL binary (including its original statically linked libraries) or Lantiq premium license. The later one may apply before making mtlkroot.ko module. But I've started the work on wave300 from my tplink module (GPL).

The best way would be clean room design, but you need two coders for it (one to understand original code and write specs, second to code the new kernel driver).

For me I can do that two git repo thing, but it will be hell for anyone else to use :smiley:.

edit: Still the best way would be to integrate it into a single repo if this driver will be actively developed. I'm not sure if any part of rflib is used by hostapd patches yet, but I was it to split it to its own repo ( = 3 repos which needs to be synchronised).


#107

@pc2005
rflib is a low level library and I doubt hostapd needs anything from it (but I am not sure).

The one thing I can help is a posting wifi script, that does device initialisation basing on /etc/config/wireless. Some patches need to be done for LUCI. I had even patches for iwinfo (allows to get stats for connected devices) - but I am not sure if I still have them.


#108

Finished!
I've made a mistake to base the final git on @kikox1 code from arcadyan homebox GPL :smiley: . It seems the two new functions which this version adds will crash the chip and afterwards the kernel. After that I've made another mistake to try to fix "RT Logger Components for Linux" option. NO! it won't even compile, don't use it. There is a bash script which generates perl script, which generates .c and .h code, which are missing some includes. And then it generates another versions for all directories (!).

Interestingly this arcadyan version wil crash when you try to unload the driver. The older version was fine (and they are practically same!).

OK enough ranting, I've made a git on server fro my country (as a test, and because it's opensource). Will mirror on github soon.

https://repo.or.cz/wave300.git
https://repo.or.cz/wave300_rflib.git


#109

I am not able to build it so far. Seems to be some kind of error in include directive.

ahmar@ahmar-Inspiron-3521:~/Desktop/wave300-source/wave300$ make nconfig
make[1]: Entering directory '/home/ahmar/Desktop/wave300-source/wave300/tools/kconfig'
[zconf.tab.c]
gcc -O2 -c -MD -Wall -Wstrict-prototypes -fomit-frame-pointer -MF"zconf.tab.d" -MT"zconf.tab.d" -o zconf.tab.o zconf.tab.c
zconf.tab.c:2466:10: fatal error: zconf.lex.c: No such file or directory
 #include "zconf.lex.c"
          ^~~~~~~~~~~~~
compilation terminated.
make[1]: *** [Makefile:197: zconf.tab.o] Error 1
make[1]: Leaving directory '/home/ahmar/Desktop/wave300-source/wave300/tools/kconfig'
make: *** [Makefile:112: .build_nconf] Error 2

#110

Is the file tools/kconfig/zconf.lex.c missing?

Probably got it. Delete file zconf.tab.c in the same directory. It seems the makefile generates zconf.lex.c only when it has to generate zconf.tab.c too.


#111

Yes that would be right.

So if I delete the file zconf.tab.c I get this error:

make[1]: Entering directory '/home/ahmar/Desktop/wave300-source/wave300/tools/kconfig'
make[1]: bison: Command not found
make[1]: *** [Makefile:33: zconf.tab.c] Error 127
make[1]: Leaving directory '/home/ahmar/Desktop/wave300-source/wave300/tools/kconfig'
make: *** [Makefile:112: .build_nconf] Error 2

I think maybe we need to add that zconf.lex.c file or remove the include directive altogether.


#112

Seems you are missing bison parser compiler:

sudo apt-get install bison flex

or similar command if not ubuntu/debian.

zconf.lex.c is compiled from flex (lexer) and zconf.tab.c is compiled from bison/yacc parser.


#113

Sorry for the hiccup but I am fairly new to Linux but anyway is this supposed to happen after make nconfig?

Even pressing Esc for default config and I dont know where is yes or no located. It seems an out-of-this-world-language ;).


#114

Did the original driver do the same? There is probably some problem with ncurses library. Does openwrt menuconfig works or fails this way too?

Try make menuconfig for the older menu. Or just text based make config.


#115

OpenWrt menuconfig works flawlessly and even now that you mentioned (I had no idea if I could do this even with the driver) I tried make menuconfig and it works just fine as for OpenWrt. So I am just gonna go and build it now but I think you should change the readme file a little so newbies like me dont run into problems and also remove the zconf file from the git so it doesnt get included in the first place.

One more thing is that build system was not able to map ~ to the /home/user directory but I think it should have. Anyway I changed it in the file so it's building now. Thanks


#116

Yeah I will change README as we find problems on the fly :smiley: . Menuconfig vs nconfig is most likely a configuration problem on your device. Anyway you don't need that menu too much. Useful config is included in the default values.


#117

So I insmod the driver with latest TpLink W8980 firmware found on their website. Obviously they dont have the cal_wlan1.bin because this info should be within the firmware maybe idk. But anyway the router did not crash. On the other hand I dont have an additional WiFi device so maybe it's not yet initialized. Here is the log:

Log
Sun Mar 10 01:01:21 2019 kern.warn kernel: [128829.247721] [0128534352] mtlk0(mtlk_cdev_init:355): Max nodes set to 1048575
Sun Mar 10 01:01:32 2019 kern.warn kernel: [128840.825411] [0128545932] mtlk0(__mtlk_print_endianess:4926): The system is Big endian (0xbeadfeed, 0xedfeadbe)
Sun Mar 10 01:01:32 2019 kern.warn kernel: [128840.834511] [0128545940] mtlk0(mtlk_fast_mem_print_info:114): Using normal memory for hot context
Sun Mar 10 01:01:32 2019 kern.warn kernel: [128840.843227] PCI: Enabling device 0000:00:0e.0 (0000 -> 0002)
Sun Mar 10 01:01:32 2019 kern.warn kernel: [128840.849920] [0128545956] mtlk0(_mtlk_df_user_alloc_devname:8348): NDEV Name pattern: wlan%d
Sun Mar 10 01:01:32 2019 kern.warn kernel: [128840.857827] [0128545964] mtlk0(mtlk_core_pdb_fast_handles_open:42): Open Hot-path parameters
Sun Mar 10 01:01:32 2019 kern.warn kernel: [128840.893765] mtlk 0000:00:0e.0: Direct firmware load for cal_wlan1.bin failed with error -2
Sun Mar 10 01:01:32 2019 kern.warn kernel: [128840.900788] mtlk 0000:00:0e.0: Falling back to user helper
Sun Mar 10 01:01:33 2019 daemon.err procd: Could not find firmware /lib/firmware/cal_wlan1.bin: No such file or directory
Sun Mar 10 01:01:33 2019 daemon.err procd: failed to write to /sys//devices/pci0000:00/0000:00:0e.0/firmware/cal_wlan1.bin/loading: Out of memory
Sun Mar 10 01:01:33 2019 kern.err kernel: [128841.808426] firmware cal_wlan1.bin: firmware_loading_store: map pages failed
Sun Mar 10 01:01:33 2019 kern.warn kernel: [128841.814611] [0128546920] mtlk3(_mtlk_df_fw_request_firmware:63): Firmware (cal_wlan1.bin) is missing
Sun Mar 10 01:01:34 2019 kern.info kernel: [128842.075628] eeprom dump 1024 1024:
Sun Mar 10 01:01:34 2019 kern.info kernel: [128842.077863] fc1bcd00 00000100 800d0000 00000000  301a8006 00000000 08f0ffff 080080ff
Sun Mar 10 01:01:34 2019 kern.info kernel: [128842.085724] 06087e00 301a0007 ffffffff ffffffff  ffffffff ffffffff ffffffff ffffffff
Sun Mar 10 01:01:34 2019 kern.info kernel: [128842.093551] c0030000 00000104 80103841 41004100  09860000 00000001 01088382 0020240c
Sun Mar 10 01:01:34 2019 kern.info kernel: [128842.101360] 0b0d0500 05749356 726e8f52 6e728c58  6e004a5d 4a5f4e5e 00000000 0000340b
Sun Mar 10 01:01:34 2019 kern.info kernel: [128842.109231] 0b0d0101 01768c52 646f8a50 64718554  6200505e 4e5f525d 00000000 0000840c
Sun Mar 10 01:01:34 2019 kern.info kernel: [128842.117041] 0a0a0105 01708d54 6d709153 70759154  69004c5e 4a5d4c5b 00000000 00009d0b
Sun Mar 10 01:01:34 2019 kern.info kernel: [128842.124855] 0a0a0501 046a8b54 70638950 716c8f56  75004a5e 48604a5e 00000000 0000ff0c
Sun Mar 10 01:01:34 2019 kern.info kernel: [128842.132694] 0aed0101 01169ac1 6b279bcd 6f2f91e7  7000af5d b660c95f 00000000 0000ff34
Sun Mar 10 01:01:34 2019 kern.info kernel: [128842.140536] 14150001 058c9d63 769a9a72 7cc39a88  7800535f 565b6a4f 00000000 00000000
Sun Mar 10 01:01:34 2019 kern.info kernel: [128842.148353] 00000000 00077415 16010104 999f7382  9f977376 ba968f7b 0059625e 5e7b6250
Sun Mar 10 01:01:34 2019 kern.info kernel: [128842.156187] 4f00006e 50000000 00000000 ff004100  50bfbb1b 54ac0000 23078136 240e837b
Sun Mar 10 01:01:34 2019 kern.info kernel: [128842.164026] e50e8481 e23c0c80 7fd90d81 81db6409  7b7ed009 7e84d584 0a847ecf 0a7e81ce
Sun Mar 10 01:01:34 2019 kern.info kernel: [128842.171858] 9d058376 d6058276 de052aa3 553c28a6  56438212 ffffffff ffffffff ffffffff
Sun Mar 10 01:01:34 2019 kern.info kernel: [128842.179693] ffffffff ffffff00 20626f61 72642721  02fe00ff 00ff00ff 00000000 00002863
Sun Mar 10 01:01:34 2019 kern.info kernel: [128842.187523] 2920436f 70797269 67687420 32300030  312c2054 414c4954 5920554b 204c7464
Sun Mar 10 01:01:34 2019 kern.info kernel: [128842.195441] 2e00ffff ffffffff ffffffff ffffffff  ffffffff ffffffff ffffffff ffffffff
Sun Mar 10 01:01:34 2019 kern.info kernel: [128842.203188] fc1bcd00 00000100 800d0000 00000000  301a8006 00000000 08f0ffff 080080ff
Sun Mar 10 01:01:34 2019 kern.info kernel: [128842.211024] 06087e00 301a0007 ffffffff ffffffff  ffffffff ffffffff ffffffff ffffffff
Sun Mar 10 01:01:34 2019 kern.info kernel: [128842.218886] b9000000 00000101 80103041 45004100  50bfbb1b 54ac0000 23078136 240e837b
Sun Mar 10 01:01:34 2019 kern.info kernel: [128842.226706] e50e8481 e23c0c80 7fd90d81 81db6409  7b7ed009 7e84d584 0a847ecf 0a7e81ce
Sun Mar 10 01:01:34 2019 kern.info kernel: [128842.234525] 9d058376 d6058276 de052aa3 553c28a6  56438212 ffffffff ffffffff ffffffff
Sun Mar 10 01:01:34 2019 kern.info kernel: [128842.242353] ffffffff ffffff00 20626f61 72642721  02fe00ff 00ff00ff 00000000 00002863
Sun Mar 10 01:01:34 2019 kern.info kernel: [128842.250191] 2920436f 70797269 67687420 32300030  312c2054 414c4954 5920554b 204c7464
Sun Mar 10 01:01:34 2019 kern.info kernel: [128842.258041] 2e00ffff ffffffff ffffffff ffffffff  ffffffff ffffffff ffffffff ffffffff
Sun Mar 10 01:01:34 2019 kern.info kernel: [128842.265852] fc1bcd00 00000100 800d0000 00000000  301a8006 00000000 08f0ffff 080080ff
Sun Mar 10 01:01:34 2019 kern.info kernel: [128842.273691] 06087e00 301a0007 ffffffff ffffffff  ffffffff ffffffff ffffffff ffffffff
Sun Mar 10 01:01:34 2019 kern.info kernel: [128842.281522] b9000000 00000101 80103041 45004100  50bfbb1b 54ac0000 23078136 240e837b
Sun Mar 10 01:01:34 2019 kern.info kernel: [128842.289378] e50e8481 e23c0c80 7fd90d81 81db6409  7b7ed009 7e84d584 0a847ecf 0a7e81ce
Sun Mar 10 01:01:34 2019 kern.info kernel: [128842.297236] 9d058376 d6058276 de052aa3 553c28a6  56438212 ffffffff ffffffff ffffffff
Sun Mar 10 01:01:34 2019 kern.info kernel: [128842.305026] ffffffff ffffff00 20626f61 72642721  02fe00ff 00ff00ff 00000000 00002863
Sun Mar 10 01:01:34 2019 kern.info kernel: [128842.312866] 2920436f 70797269 67687420 32300030  312c2054 414c4954 5920554b 204c7464
Sun Mar 10 01:01:34 2019 kern.info kernel: [128842.320700] 2e00ffff ffffffff ffffffff ffffffff  ffffffff ffffffff ffffffff ffffffff
Sun Mar 10 01:01:34 2019 kern.warn kernel: [128842.365628] [0128547472] mtlk0(get_firmware_version:1161): CID-0000: ap_upper_wave300.bin: @@@ VERSION INFO @@@ version number: FW_3.4.2_r3444 MIPS:  Upper CPU(TMC AGG AP) interface: PCI  phy type: real phy on Feb 12 2014 at 17:30:38@@@ END @@@
Sun Mar 10 01:01:34 2019 kern.warn kernel: [128842.365628]
Sun Mar 10 01:01:34 2019 kern.warn kernel: [128842.405866] [0128547512] mtlk0(get_firmware_version:1161): CID-0000: contr_lm.bin: @@@ VERSION INFO @@@ version number: FW_3.4.2_r3444 MIPS:  Lower MAC  interface: --  phy type: real phy on Feb 12 2014 at 17:29:55@@@ END @@@
Sun Mar 10 01:01:34 2019 kern.warn kernel: [128842.405866]
Sun Mar 10 01:01:34 2019 kern.info kernel: [128842.493372] command buffer dump 8258e2ac:
Sun Mar 10 01:01:34 2019 kern.info kernel: [128842.496077] 0000: 448a0000
Sun Mar 10 01:01:34 2019 kern.info kernel: [128842.499073] 0001: 7b010000
Sun Mar 10 01:01:34 2019 kern.info kernel: [128842.501733] 0002: 58840000
Sun Mar 10 01:01:34 2019 kern.info kernel: [128842.504431] 0003: 7b010000
Sun Mar 10 01:01:34 2019 kern.info kernel: [128842.507311] 0004: 007e0000
Sun Mar 10 01:01:34 2019 kern.info kernel: [128842.510073] 0005: a0000000
Sun Mar 10 01:01:34 2019 kern.info kernel: [128842.512879] 0006: 20680000
Sun Mar 10 01:01:34 2019 kern.info kernel: [128842.515685] 0007: c8000000
Sun Mar 10 01:01:34 2019 kern.info kernel: [128842.518434] 0008: 409c0000
Sun Mar 10 01:01:34 2019 kern.info kernel: [128842.521132] 0009: 0e000000
Sun Mar 10 01:01:34 2019 kern.info kernel: [128842.523907] 000a: e8630000
Sun Mar 10 01:01:34 2019 kern.info kernel: [128842.526868] 000b: 02000000
Sun Mar 10 01:01:34 2019 kern.info kernel: [128842.529564] 000c: 6c820000
Sun Mar 10 01:01:34 2019 kern.info kernel: [128842.532261] 000d: 01000000
Sun Mar 10 01:01:34 2019 kern.info kernel: [128842.535152] 000e: 80800000
Sun Mar 10 01:01:34 2019 kern.info kernel: [128842.537980] 000f: 01000000
Sun Mar 10 01:01:34 2019 kern.info kernel: [128842.540629] 0010: edfeadbe
Sun Mar 10 01:01:34 2019 kern.info kernel: [128842.543513] 0011: f0000000
Sun Mar 10 01:01:34 2019 kern.info kernel: [128842.546287] 0012: 00000000
Sun Mar 10 01:01:34 2019 kern.info kernel: [128842.549009] 0013: 00000000
Sun Mar 10 01:01:34 2019 kern.info kernel: [128842.551963] 0014: 00000000
Sun Mar 10 01:01:34 2019 kern.info kernel: [128842.554626] 0015: 00000000
Sun Mar 10 01:01:34 2019 kern.info kernel: [128842.557458] 0016: 00000000
Sun Mar 10 01:01:34 2019 kern.info kernel: [128842.560115] 0017: 00000000
Sun Mar 10 01:01:34 2019 kern.info kernel: [128842.563069] 0018: 00000000
Sun Mar 10 01:01:34 2019 kern.info kernel: [128842.565765] 0019: 00000000
Sun Mar 10 01:01:34 2019 kern.info kernel: [128842.568439] 001a: 00000000
Sun Mar 10 01:01:34 2019 kern.info kernel: [128842.571343] 001b: 00000000
Sun Mar 10 01:01:34 2019 kern.info kernel: [128842.574120] 001c: 00000000
Sun Mar 10 01:01:34 2019 kern.info kernel: [128842.576858] 001d: 00000000
Sun Mar 10 01:01:34 2019 kern.info kernel: [128842.579707] 001e: 00000000
Sun Mar 10 01:01:34 2019 kern.info kernel: [128842.582461] 001f: 00000000
Sun Mar 10 01:01:34 2019 kern.info kernel: [128842.585259] 0020: 00000000
Sun Mar 10 01:01:34 2019 kern.info kernel: [128842.587966] 0021: 00000000
Sun Mar 10 01:01:34 2019 kern.info kernel: [128842.590888] 0022: 00000000
Sun Mar 10 01:01:34 2019 kern.info kernel: [128842.593615] 0023: 00000000
Sun Mar 10 01:01:34 2019 kern.info kernel: [128842.596299] 0024: 00000000
Sun Mar 10 01:01:34 2019 kern.info kernel: [128842.599197] 0025: 00000000
Sun Mar 10 01:01:34 2019 kern.info kernel: [128842.602054] 0026: 00000000
Sun Mar 10 01:01:34 2019 kern.info kernel: [128842.604646] 0027: 0000000e
Sun Mar 10 01:01:34 2019 kern.info kernel: [128842.607560] 0028: c1012900
Sun Mar 10 01:01:34 2019 kern.info kernel: [128842.610586] 0029: 00000000
Sun Mar 10 01:01:34 2019 kern.info kernel: [128842.613282] 002a: 00050005
Sun Mar 10 01:01:34 2019 kern.info kernel: [128842.615968] 002b: 00000001
Sun Mar 10 01:01:34 2019 kern.info kernel: [128842.618691] 002c: 00000001
Sun Mar 10 01:01:34 2019 kern.info kernel: [128842.621472] 002d: 00000000
Sun Mar 10 01:01:34 2019 kern.info kernel: [128842.624157] 002e: 00000000
Sun Mar 10 01:01:34 2019 kern.info kernel: [128842.627115] 002f: 00000000
Sun Mar 10 01:01:34 2019 kern.info kernel: [128842.629825] 0030: 00000000
Sun Mar 10 01:01:34 2019 kern.info kernel: [128842.632508] 0031: 00000000
Sun Mar 10 01:01:34 2019 kern.info kernel: [128842.635405] 0032: 00000000
Sun Mar 10 01:01:34 2019 kern.info kernel: [128842.638187] 0033: 00000000
Sun Mar 10 01:01:34 2019 kern.info kernel: [128842.640945] 0034: 00000000
Sun Mar 10 01:01:34 2019 kern.info kernel: [128842.643815] 0035: 00000000
Sun Mar 10 01:01:34 2019 kern.info kernel: [128842.646565] 0036: 00000000
Sun Mar 10 01:01:34 2019 kern.info kernel: [128842.649367] 0037: 00000000
Sun Mar 10 01:01:34 2019 kern.info kernel: [128842.652078] 0038: 00000000
Sun Mar 10 01:01:34 2019 kern.info kernel: [128842.654983] 0039: 00000000
Sun Mar 10 01:01:34 2019 kern.info kernel: [128842.657716] 003a: 00000000
Sun Mar 10 01:01:34 2019 kern.info kernel: [128842.660430] 003b: 00000000
Sun Mar 10 01:01:34 2019 kern.info kernel: [128842.663305] 003c: 00000000
Sun Mar 10 01:01:34 2019 kern.info kernel: [128842.666125] 003d: 00000000
Sun Mar 10 01:01:34 2019 kern.info kernel: [128842.668775] 003e: 00000000
Sun Mar 10 01:01:34 2019 kern.info kernel: [128842.671650] 003f: 00000000
Sun Mar 10 01:01:34 2019 kern.info kernel: [128842.674443] 0040: 00000000
Sun Mar 10 01:01:34 2019 kern.info kernel: [128842.677095] 0041: 00000000
Sun Mar 10 01:01:34 2019 kern.info kernel: [128842.680053] 0042: 00000000
Sun Mar 10 01:01:34 2019 kern.info kernel: [128842.682731] 0043: 00000000
Sun Mar 10 01:01:34 2019 kern.info kernel: [128842.685540] 0044: 00000000
Sun Mar 10 01:01:34 2019 kern.info kernel: [128842.688243] 0045: 00000000
Sun Mar 10 01:01:34 2019 kern.info kernel: [128842.691174] 0046: 00000000
Sun Mar 10 01:01:34 2019 kern.info kernel: [128842.693899] 0047: 00000000
Sun Mar 10 01:01:34 2019 kern.info kernel: [128842.696608] 0048: 00000000
Sun Mar 10 01:01:34 2019 kern.info kernel: [128842.699476] 0049: 00000000
Sun Mar 10 01:01:34 2019 kern.info kernel: [128842.702255] 004a: 00000000
Sun Mar 10 01:01:34 2019 kern.info kernel: [128842.704967] 004b: 00000000
Sun Mar 10 01:01:34 2019 kern.info kernel: [128842.707816] 004c: 00000000
Sun Mar 10 01:01:34 2019 kern.info kernel: [128842.710593] 004d: 00000000
Sun Mar 10 01:01:34 2019 kern.info kernel: [128842.713600] 004e: 00000000
Sun Mar 10 01:01:34 2019 kern.info kernel: [128842.716090] 004f: 00000000
Sun Mar 10 01:01:34 2019 kern.warn kernel: [128842.744925] [0128547848] mtlk0(mtlk_eeprom_check_ee_data:1371): Options mask is 0x00
Sun Mar 10 01:01:34 2019 kern.warn kernel: [128842.752533] [0128547856] mtlk0(load_default_hw_table:2128): HW configuration is 3X3

So what am I missing?


#118

Nothing, all fine, do the next step from README.


#119

iw list only shows wlan0 which is not WAVE300 device because it has two separate chips for 2.4G and 5G. 2.4G already works from Atheros chip but now after loading the firmware for WAVE300 there is no device enabled yet. Also /etc/config/wireless shows only one wifi. Doing the next steps doesnt work because there is no wlan1 device, or a phy1 device.

root@AhmarRouter:~# iw list | grep phy0
Wiphy phy0
root@AhmarRouter:~# iw list | grep phy1
root@AhmarRouter:~#

Edit: System -> LED config shows wlan1 but I cant seem to find it in iw list or anything else.
Edit2: Never mind, I was missing wireless-tools package.


#120

So after some desperate attempts to work it out I am here again because the wifi wont come up. LuCI shows a wlan1 interface in LED config but LED doesnt turn on. There is no phy1 interface anywhere that I know of.

Executing iwpriv wlan1 shows a tremendous amount of options that can be set up but I dont think they have any effect yet.

Here is the output
root@AhmarRouter:~# iwpriv wlan1
wlan1     Available private ioctls :
          sMAC             (8BF0) : set   1 addr  & get   0
          gMAC             (8BF1) : set   0       & get   1 addr
# I had to trim a lot here due to post constraints.
          gVI.TXOPAP       (805F) : set   0       & get   1 int
          sVO.BAUse        (8024) : set   1 int   & get   0
          gVO.BAUse        (8024) : set   0       & get   1 int
          sVO.BAAccept     (8028) : set   1 int   & get   0
          gVO.BAAccept     (8028) : set   0       & get   1 int
          sVO.BATimeout    (802C) : set   1 int   & get   0
          gVO.BATimeout    (802C) : set   0       & get   1 int
          sVO.BAWinSize    (8030) : set   1 int   & get   0
          gVO.BAWinSize    (8030) : set   0       & get   1 int
          sVO.AggrMaxBts   (8034) : set   1 int   & get   0
          gVO.AggrMaxBts   (8034) : set   0       & get   1 int
          sVO.AggrMaxPkts  (8038) : set   1 int   & get   0
          gVO.AggrMaxPkts  (8038) : set   0       & get   1 int
          sVO.AggrMinPtSz  (803C) : set   1 int   & get   0
          gVO.AggrMinPtSz  (803C) : set   0       & get   1 int
          sVO.AggrTimeout  (8040) : set   1 int   & get   0
          gVO.AggrTimeout  (8040) : set   0       & get   1 int
          sVO.AIFSN        (8044) : set   1 int   & get   0
          gVO.AIFSN        (8044) : set   0       & get   1 int
          sVO.AIFSNAP      (8054) : set   1 int   & get   0
          gVO.AIFSNAP      (8054) : set   0       & get   1 int
          sVO.CWMax        (8048) : set   1 int   & get   0
          gVO.CWMax        (8048) : set   0       & get   1 int
          sVO.CWMaxAP      (8058) : set   1 int   & get   0
          gVO.CWMaxAP      (8058) : set   0       & get   1 int
          sVO.CWMin        (804C) : set   1 int   & get   0
          gVO.CWMin        (804C) : set   0       & get   1 int
          sVO.CWMinAP      (805C) : set   1 int   & get   0
          gVO.CWMinAP      (805C) : set   0       & get   1 int
          sVO.TXOP         (8050) : set   1 int   & get   0
          gVO.TXOP         (8050) : set   0       & get   1 int
          sVO.TXOPAP       (8060) : set   1 int   & get   0
          gVO.TXOPAP       (8060) : set   0       & get   1 int
          sL2NATAgeTO      (8069) : set   1 int   & get   0
          gL2NATAgeTO      (8069) : set   0       & get   1 int
          sL2NATDefHost    (806B) : set   1 addr  & get   0
          gL2NATDefHost    (806B) : set   0       & get   1 addr
          sAddPeerAP       (806C) : set   1 addr  & get   0
          sDelPeerAP       (806D) : set   1 addr  & get   0
          sPeerAPkeyIdx    (806E) : set   1 int   & get   0
          gPeerAPkeyIdx    (806E) : set   0       & get   1 int
          gPeerAPs         (806F) : set   0       & get 2047 char
          sPeerAPDBG       (8070) : set   1 int   & get   0
          s11dActive       (8071) : set   1 int   & get   0
          g11dActive       (8071) : set   0       & get   1 int
          s11dReset        (8072) : set   1 int   & get   0
          sMACWdTimeoutMs  (8073) : set   1 int   & get   0
          gMACWdTimeoutMs  (8073) : set   0       & get   1 int
          sMACWdPeriodMs   (8074) : set   1 int   & get   0
          gMACWdPeriodMs   (8074) : set   0       & get   1 int
          sStaKeepaliveTO  (8075) : set   1 int   & get   0
          gStaKeepaliveTO  (8075) : set   0       & get   1 int
          sStaKeepaliveIN  (8076) : set   1 int   & get   0
          gStaKeepaliveIN  (8076) : set   0       & get   1 int
          sAggrOpenThrsh   (8077) : set   1 int   & get   0
          gAggrOpenThrsh   (8077) : set   0       & get   1 int
          sSQLimits        (8078) : set  32 int   & get   0
          gSQLimits        (8078) : set   0       & get  32 int
          sSQPeerLimits    (8079) : set  32 int   & get   0
          gSQPeerLimits    (8079) : set   0       & get  32 int
          sBridgeMode      (807A) : set   1 int   & get   0
          gBridgeMode      (807A) : set   0       & get   1 int
          sReliableMcast   (807C) : set   1 int   & get   0
          gReliableMcast   (807C) : set   0       & get   1 int
          sAPforwarding    (807D) : set   1 int   & get   0
          gAPforwarding    (807D) : set   0       & get   1 int
          sFortyMHzOpMode  (807E) : set   1 int   & get   0
          gFortyMHzOpMode  (807E) : set   0       & get   1 int
          sPowerSelection  (8083) : set   1 int   & get   0
          gPowerSelection  (8083) : set   0       & get   1 int
          sDebugTPC        (8084) : set   1 int   & get   0
          gDebugTPC        (8084) : set   0       & get   1 int
          sNetworkMode     (807F) : set   1 int   & get   0
          gNetworkMode     (807F) : set   0       & get   1 int
          sIsBGScan        (809E) : set   1 int   & get   0
          gIsBGScan        (809E) : set   0       & get   1 int
          sBasicRates      (8085) : set   1 int   & get   0
          gBasicRates      (8085) : set   0       & get   1 int
          sSupportedRates  (8086) : set   1 int   & get   0
          gSupportedRates  (8086) : set   0       & get   1 int
          sExtendedRates   (8087) : set   1 int   & get   0
          gExtendedRates   (8087) : set   0       & get   1 int
          sHiddenSSID      (8081) : set   1 int   & get   0
          gHiddenSSID      (8081) : set   0       & get   1 int
          sUpRescanExmpTm  (8091) : set   1 int   & get   0
          gUpRescanExmpTm  (8091) : set   0       & get   1 int
          sSetRxTH         (8096) : set   1 int   & get   0
          gSetRxTH         (8096) : set   0       & get   1 int
          sCcaTH           (8098) : set   1 int   & get   0
          gCcaTH           (8098) : set   0       & get   1 int
          sFwLogSeverity   (8082) : set  32 int   & get   0
          sAggRateLimit    (8092) : set  32 int   & get   0
          gAggRateLimit    (8092) : set   0       & get  32 int
          sRxDutyCyc       (8097) : set  32 int   & get   0
          gRxDutyCyc       (8097) : set   0       & get  32 int
          sFixedRate       (808C) : set 2047 char  & get   0
          gFixedRate       (808C) : set   0       & get 2047 char
          sFixedHTRate     (808D) : set 2047 char  & get   0
          gFixedHTRate     (808D) : set   0       & get 2047 char
          gCountries       (8088) : set   0       & get 2047 char
          sACL             (808E) : set  64 addr  & get   0
          gACL             (808E) : set   0       & get  64 addr
          sDelACL          (808F) : set  64 addr  & get   0
          sACLRange        (8090) : set  64 addr  & get   0
          gACLRange        (8090) : set   0       & get  64 addr
          sWDSHostTO       (8099) : set   1 int   & get   0
          gWDSHostTO       (8099) : set   0       & get   1 int
          sL2NATLocMAC     (809A) : set   1 addr  & get   0
          gL2NATLocMAC     (809A) : set   0       & get   1 addr
          sScanCacheLifeT  (809B) : set   1 int   & get   0
          gScanCacheLifeT  (809B) : set   0       & get   1 int
          sBGScanChLimit   (809C) : set   1 int   & get   0
          gBGScanChLimit   (809C) : set   0       & get   1 int
          sBGScanPause     (809D) : set   1 int   & get   0
          gBGScanPause     (809D) : set   0       & get   1 int
          sActiveScanSSID  (809F) : set 2047 char  & get   0
          gActiveScanSSID  (809F) : set   0       & get 2047 char
          gEEPROM          (80A0) : set   0       & get 2047 char
          sHWLimit         (80A1) : set 2047 char  & get   0
          sAntGain         (80A2) : set 2047 char  & get   0
          sUse1QMap        (80A4) : set   1 int   & get   0
          gUse1QMap        (80A4) : set   0       & get   1 int
          sCoCPower        (80A5) : set  32 int   & get   0
          gCoCPower        (80A5) : set   0       & get  32 int
          sCoCAutoCfg      (80A6) : set  32 int   & get   0
          gCoCAutoCfg      (80A6) : set   0       & get  32 int
          sAddVap          (80A7) : set   1 int   & get   0
          sDelVap          (80A8) : set   1 int   & get   0
          sVapSTALimits    (80A9) : set  32 int   & get   0
          gVapSTALimits    (80A9) : set   0       & get  32 int
          sTxPowerLimOpt   (80A3) : set  32 int   & get   0
          gTxPowerLimOpt   (80A3) : set   0       & get  32 int
          sExtLnaGains     (8095) : set  32 int   & get   0
          gExtLnaGains     (8095) : set   0       & get  32 int
          sCoexMode        (80C3) : set   1 int   & get   0
          gCoexMode        (80C3) : set   0       & get   1 int
          sCoexThreshold   (80C4) : set   1 int   & get   0
          gCoexThreshold   (80C4) : set   0       & get   1 int
          sCoexIntolMode   (80C5) : set   1 int   & get   0
          gCoexIntolMode   (80C5) : set   0       & get   1 int
          sCoexAPForcePms  (80C6) : set   1 int   & get   0
          gCoexAPForcePms  (80C6) : set   0       & get   1 int
          sCoexScnResWait  (80C7) : set   1 int   & get   0
          gCoexScnResWait  (80C7) : set   0       & get   1 int
          sCoexExemptReq   (80C8) : set   1 int   & get   0
          gCoexExemptReq   (80C8) : set   0       & get   1 int
          sCoexMinNoExmSta (80C9) : set   1 int   & get   0
          gCoexMinNoExmSta (80C9) : set   0       & get   1 int
          sCoexDelayFactor (80CA) : set   1 int   & get   0
          gCoexDelayFactor (80CA) : set   0       & get   1 int
          sCoexScanIntrvl  (80CB) : set   1 int   & get   0
          gCoexScanIntrvl  (80CB) : set   0       & get   1 int
          sCoexActTrshold  (80CC) : set   1 int   & get   0
          gCoexActTrshold  (80CC) : set   0       & get   1 int
          sCoexPasvDwell   (80CD) : set   1 int   & get   0
          gCoexPasvDwell   (80CD) : set   0       & get   1 int
          sCoexActvDwell   (80CE) : set   1 int   & get   0
          gCoexActvDwell   (80CE) : set   0       & get   1 int
          sCoexPasvPerChnl (80CF) : set   1 int   & get   0
          gCoexPasvPerChnl (80CF) : set   0       & get   1 int
          sCoexActvPerChnl (80D0) : set   1 int   & get   0
          gCoexActvPerChnl (80D0) : set   0       & get   1 int
          sInterfDetTime   (80D1) : set  32 int   & get   0
          sInterfDetThresh (80D2) : set  32 int   & get   0
          sInterfDetScan   (80D3) : set  32 int   & get   0
          gInterfDetMode   (80D4) : set   0       & get   1 int
          gAPCapsMaxSTAs   (8001) : set   0       & get   1 int
          gAPCapsMaxVAPs   (8002) : set   0       & get   1 int
          gAPCapsMaxACLs   (8003) : set   0       & get   1 int
          sFWCfgLEDGPIO    (8004) : set  32 int   & get   0
          gFWCfgLEDGPIO    (8004) : set   0       & get  32 int
          sFWCfgLEDState   (8005) : set  32 int   & get   0
          s11bAntSelection (80D8) : set  32 int   & get   0
          g11bAntSelection (80D8) : set   0       & get  32 int
          sDoSimpleCLI     (80DF) : set  32 int   & get   0
          sDoFwDebug       (80E0) : set  32 int   & get   0
          sTATimerRes      (80D5) : set   1 int   & get   0
          gTATimerRes      (80D5) : set   0       & get   1 int
          gTADbg           (80D6) : set   0       & get 2047 char
          sEnhanced11bTh   (80D7) : set  32 int   & get   0
          gEnhanced11bTh   (80D7) : set   0       & get  32 int
          sPmfActivated    (80D9) : set   1 int   & get   0
          gPmfActivated    (80D9) : set   0       & get   1 int
          sPmfRequired     (80DA) : set   1 int   & get   0
          gPmfRequired     (80DA) : set   0       & get   1 int
          sSAQRetrTmout    (80DB) : set   1 int   & get   0
          gSAQRetrTmout    (80DB) : set   0       & get   1 int
          sSAQMaxTmout     (80DC) : set   1 int   & get   0
          gSAQMaxTmout     (80DC) : set   0       & get   1 int
          sFWRecovery      (8000) : set  32 int   & get   0
          gFWRecovery      (8000) : set   0       & get  32 int
          sMcPSsize        (80E1) : set   1 int   & get   0
          gMcPSsize        (80E1) : set   0       & get   1 int
          sUAPSDMode       (80DD) : set   1 int   & get   0
          gUAPSDMode       (80DD) : set   0       & get   1 int
          sUAPSDMaxSP      (80DE) : set   1 int   & get   0
          gUAPSDMaxSP      (80DE) : set   0       & get   1 int
          gGenlFamilyId    (80E2) : set   0       & get   1 int
          sRAprotection    (80E3) : set   1 int   & get   0
          gRAprotection    (80E3) : set   0       & get   1 int
          sForceNcb        (80E4) : set   1 int   & get   0
          gForceNcb        (80E4) : set   0       & get   1 int
          sNratesBOs       (80E5) : set  32 int   & get   0
          gNratesBOs       (80E5) : set   0       & get  32 int

iwconfig shows some info about the device but there is no TX power so far so nothing pops up in the Wifi list on my phone.

root@AhmarRouter:~# iwconfig wlan1
wlan1     802.11an  ESSID:"test"
          Mode:Master  Channel:0  Access Point: 00:09:86:00:00:00
          Tx-Power=off
          RTS thr=2347 B
          Encryption key:off
          Link Quality:0  Signal level:0  Noise level:0
          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
          Tx excessive retries:0  Invalid misc:0   Missed beacon:0

Also ifconfig has no idea if a wlan1 device exists. Any pointers on how to go forward?

Edit: I have done some more tests and now ifconfig does show wlan1 but cant bring it up. It throws a kernel panic. I use following commands in /etc/rc.local to initiate the device:

insmod /usb/wave*/mtlkroot.ko
sleep 1
insmod /usb/wave*/mtlk.ko ap=1
sleep 2
iwpriv wlan1 sCountry US
iwconfig wlan1 essid test
iwconfig wlan1 channel 161
iwconfig wlan1 txpower 30

Since my interface is a 5GHz one I am using ProgModel files from Tp-Link official firmware and tried ap and contr_lm files from W8980 and VR200 but same thing happens.

Kernel Panic
root@AhmarRouter:/# ifconfig wlan1 up
[  433.064229] [0000133008] mtlk0(mtlk_mbss_init:3457): CID-0000: _mtlk_core_mbss_check_activation_params returned successfully
[  433.074144] [0000133020] mtlk0(_mtlk_mbss_preactivate:2917): CID-0000: Pre-activation configured parameters:
[  433.084019] [0000133028] mtlk0(mtlk_core_configuration_dump:4938): CID-0000: Country             : US
[  433.093276] [0000133036] mtlk0(mtlk_core_configuration_dump:4939): CID-0000: Domain              : 16
[  433.102435] [0000133048] mtlk0(mtlk_core_configuration_dump:4940): CID-0000: Network mode        : 802.11an
[  433.112180] [0000133056] mtlk0(mtlk_core_configuration_dump:4941): CID-0000: Band                : 5.2
[  433.121501] [0000133068] mtlk0(mtlk_core_configuration_dump:4942): CID-0000: Prog Model Spectrum : 40 MHz
[  433.131070] [0000133076] mtlk0(mtlk_core_configuration_dump:4943): CID-0000: Selected Spectrum   : 40 MHz
[  433.140642] [0000133084] mtlk0(mtlk_core_configuration_dump:4944): CID-0000: User Sel. Spectrum  : 40 MHz
[  433.150252] [0000133096] mtlk0(mtlk_core_configuration_dump:4945): CID-0000: Bonding             : lower
[  433.159706] [0000133104] mtlk0(mtlk_core_configuration_dump:4946): CID-0000: HT mode             : enabled
[  433.169366] [0000133112] mtlk0(mtlk_core_configuration_dump:4948): CID-0000: SM enabled          : enabled
[  433.179054] [0000133124] mtlk0(_mtlk_mbss_preactivate:2932): CID-0000: Start AOCS
[  433.187138] [0000133132] mtlk0(_mtlk_mbss_preactivate:2945): CID-0000: ap_scan_band_cfg = 0
[  433.194883] [0000133140] mtlk0(_mtlk_core_perform_initial_scan:2714): CID-0000: AOCS and 20/40 Coexistence are completely OFF (ch=161 type=0 20/40=0): skipping the Initial Scan
[  433.228274] [0000133172] mtlk0(prepare_progmodel_string:2061): CID-0000: ProgModel: ProgModel_A_CB_38_RevA_wave300.bin version 1668
[  433.228274]
[  433.240454] [0000133184] mtlk0(_mtlk_mbss_preactivate:3044): CID-0000: Pre-activation selected parameters:
[  433.249933] [0000133196] mtlk0(mtlk_core_configuration_dump:4938): CID-0000: Country             : US
[  433.259152] [0000133204] mtlk0(mtlk_core_configuration_dump:4939): CID-0000: Domain              : 16
[  433.268376] [0000133212] mtlk0(mtlk_core_configuration_dump:4940): CID-0000: Network mode        : 802.11an
[  433.278156] [0000133224] mtlk0(mtlk_core_configuration_dump:4941): CID-0000: Band                : 5.2
[  433.287452] [0000133232] mtlk0(mtlk_core_configuration_dump:4942): CID-0000: Prog Model Spectrum : 40 MHz
[  433.297011] [0000133240] mtlk0(mtlk_core_configuration_dump:4943): CID-0000: Selected Spectrum   : 40 MHz
[  433.306587] [0000133252] mtlk0(mtlk_core_configuration_dump:4944): CID-0000: User Sel. Spectrum  : 40 MHz
[  433.316154] [0000133260] mtlk0(mtlk_core_configuration_dump:4945): CID-0000: Bonding             : lower
[  433.325650] [0000133272] mtlk0(mtlk_core_configuration_dump:4946): CID-0000: HT mode             : enabled
[  433.335332] [0000133280] mtlk0(mtlk_core_configuration_dump:4948): CID-0000: SM enabled          : enabled
[  433.347407] _mtlk_core_send_current_debug_tpc 0
[  433.350905] _mtlk_core_send_lna_gains_on_preactivate 0
[  433.355867] [0000133300] mtlk0(_mtlk_channels_frequency_element_dump:3117): CID-0000: Channel        : 161
[  433.365397] [0000133308] mtlk0(_mtlk_channels_frequency_element_dump:3118): CID-0000: ChannelACT     : 0
[  433.374894] [0000133320] mtlk0(_mtlk_channels_frequency_element_dump:3119): CID-0000: ScanType       : 0
[  433.384364] [0000133328] mtlk0(_mtlk_channels_frequency_element_dump:3120): CID-0000: ChannelSwCnt   : 0
[  433.393864] [0000133340] mtlk0(_mtlk_channels_frequency_element_dump:3121): CID-0000: SwitchMode     : 48
[  433.403425] [0000133348] mtlk0(_mtlk_channels_frequency_element_dump:3122): CID-0000: SmRequired     : 0
[  433.412931] [0000133356] mtlk0(_mtlk_channels_frequency_element_dump:3123): CID-0000: CbTxPowerLim   : 194
[  433.422572] [0000133368] mtlk0(_mtlk_channels_frequency_element_dump:3124): CID-0000: nCbTxPowerLim  : 194
[  433.432264] [0000133376] mtlk0(_mtlk_channels_frequency_element_dump:3125): CID-0000: AntennaGain    : 0
[  433.441729] [0000133388] mtlk0(_mtlk_channels_frequency_element_dump:3126): CID-0000: ChannelLoad    : 0
[  433.451236] [0000133396] mtlk0(_mtlk_channels_frequency_element_dump:3128): CID-0000: MaxTxPwr[0]    : 0
[  433.460734] [0000133404] mtlk0(_mtlk_channels_frequency_element_dump:3129): CID-0000: MaxTxPwrIdx[0] : 0
[  433.470216] [0000133416] mtlk0(_mtlk_channels_frequency_element_dump:3128): CID-0000: MaxTxPwr[1]    : 0
[  433.479685] [0000133424] mtlk0(_mtlk_channels_frequency_element_dump:3129): CID-0000: MaxTxPwrIdx[1] : 0
[  433.489176] [0000133432] mtlk0(_mtlk_channels_frequency_element_dump:3128): CID-0000: MaxTxPwr[2]    : 0
[  433.498667] [0000133444] mtlk0(_mtlk_channels_frequency_element_dump:3129): CID-0000: MaxTxPwrIdx[2] : 0
[  433.508152] [0000133452] mtlk0(_mtlk_channels_frequency_element_dump:3131): CID-0000: SwitchType     : 0
[  433.517632] [0000133464] mtlk0(_mtlk_mbss_send_preactivate_req:2829): CID-0000: Sending UMI FW Preactivation
[  433.727041] _mtlk_mbss_send_preactivate_req 0
[  433.730362] mtlk_set_power_limit 0
[  433.733739] [0000133680] mtlk4(mtlk_cc_handle_mac_fatal:71): CID-0000: MAC event: From upper : MAC fatal error: [GroupID: 20, FileID: 3, Line: 926], TS 0x1768346f
[  433.748163] [0000133692] mtlk4(_txm_msg_timed_out:4296): CID-0000: Resetting FW because of message timeout. Message ID is 0x45F
[  433.759656] [0000133704] mtlk3(_mtlk_txmm_send_blocked:884): send (b): wait failed (id=0x045f). Err#-4 (req=6041 cfm=6040)
[  433.770782] [0000133716] mtlk3(_mtlk_txmm_err_print_err_sent_que:298): Unconfirmed messages:
[  433.779344] [0000133724] mtlk3(_mtlk_txmm_err_print_que_block:293):  MSG: id = 0x045f, size = 2
[  433.788128] [0000133732] mtlk3(_mtlk_txmm_history_print_unsafe:151): MSG[0]: id=0x0444 clbR=0 bwtR=0
[  433.797335] [0000133740] mtlk3(_mtlk_txmm_history_print_unsafe:154):     ts[0] = 133676
[  433.805478] [0000133748] mtlk3(_mtlk_txmm_history_print_unsafe:154):     ts[1] = 133676
[  433.813494] [0000133760] mtlk3(_mtlk_txmm_history_print_unsafe:154):     ts[2] = 133676
[  433.821606] [0000133768] mtlk3(_mtlk_txmm_history_print_unsafe:154):     ts[3] = 133676
[  433.829719] [0000133776] mtlk3(_mtlk_txmm_history_print_unsafe:151): MSG[1]: id=0x0444 clbR=0 bwtR=0
[  433.838985] [0000133784] mtlk3(_mtlk_txmm_history_print_unsafe:154):     ts[0] = 133676
[  433.847050] [0000133792] mtlk3(_mtlk_txmm_history_print_unsafe:154):     ts[1] = 133676
[  433.855141] [0000133800] mtlk3(_mtlk_txmm_history_print_unsafe:154):     ts[2] = 133676
[  433.863221] [0000133808] mtlk3(_mtlk_txmm_history_print_unsafe:154):     ts[3] = 133676
[  433.871333] [0000133816] mtlk3(_mtlk_txmm_history_print_unsafe:151): MSG[2]: id=0x045F clbR=4 bwtR=-4
[  433.880629] [0000133824] mtlk3(_mtlk_txmm_history_print_unsafe:154):     ts[0] = 133676
[  433.888737] [0000133832] mtlk3(_mtlk_txmm_history_print_unsafe:154):     ts[1] = 133676
[  433.896818] [0000133840] mtlk3(_mtlk_txmm_history_print_unsafe:154):     ts[2] = 0
[  433.904493] [0000133848] mtlk3(_mtlk_txmm_history_print_unsafe:154):     ts[3] = 133692
[  433.912620] [0000133856] mtlk3(mtlk_core_set_ra_protection:6582): CID-0000: Can't send UMI_RA_PROTECTION request to MAC (err=-4)
[  433.924272] mtlk_core_set_ra_protection -4
[  433.928409] [0000133872] mtlk3(mtlk_core_set_force_ncb:6634): CID-0000: Can't send UMI_FORCE_NCB request to MAC (err=-4)
[  433.939331] mtlk_core_set_force_ncb -4
[  433.943111] [0000133888] mtlk3(mtlk_core_set_n_rate_bo:6689): CID-0000: Can't send UMI_N_RATES_BO request to MAC (err=-4)
[  433.954120] mtlk_core_set_n_rate_bo -4
[  433.957849] [0000133904] mtlk3(_mtlk_mbss_preactivate:3091): CID-0000: _mtlk_mbss_preactivate returned with error
[  433.968226] [0000133912] mtlk3(mtlk_mbss_init:3461): CID-0000: mtlk_mbss_init: call to _mtlk_mbss_preactivate_if_needed returned with error
[  433.980843] [0000133924] mtlk0(mtlk_mbss_init:3477): CID-0000: before _mtlk_mbss_undo_preactivate
[  433.989913] [0000133936] mtlk0(mtlk_mbss_init:3482): CID-0000: after _mtlk_mbss_undo_preactivate
[  433.998490] [0000133944] mtlk3(_mtlk_core_activate:4285): CID-0000: Failed to activate the core
[  434.007448] [0000133952] mtlk3(_mtlk_core_mac_get_stats:6383): CID-0000: MAC Get Stat sending failure (-4)
i[  434.017194] [0000133960] mtlk3(_mtlk_process_mac_fatal_log:3921): Unable to notify LogServer
[  434.025653] [0000133972] mtlk3(mtlk_core_set_net_state:776): CID-0000: Going to net state HALTED (net_state=4)
f[  434.035793] [0000133980] mtlk0(rcvry_initiate:1114): CID-0000: FAST recovery initiated
[  434.043764] [0000133988] mtlk0(rcvry_initiate:1118): CID-0000: Fast: 1 (3), Full: 0 (1)
[  434.051846] [0000133996] mtlk3(_mtlk_hw_set_prop:4593): CID-0000: Asserting FW: hw_state=3
[  434.060119] [0000134004] mtlk4(_mtlk_mmb_cause_mac_assert:1756): FW MAC assert is done
[  434.068159] [0000134012] mtlk4(_mtlk_process_mac_hang:3883): CID-0000: MAC Hang detected, event = 6
[  434.077277] [0000134020] mtlk4(mtlk_df_ui_notify_notify_fw_hang:4758): CID-0000: FW CPU#1 hang detected
[  434.086775] [0000134032] mtlk0(master_recovery:963): CID-0000: Master Recovery Started
[  434.094725] [0000134040] mtlk3(_rcvry_start_notify:886): CID-0000: Unable to notify application: message = 6
[  434.104608] [0000134048] mtlk0(_rcvry_isolate:389): CID-0000: Isolation started
[  434.112015] [0000134056] mtlk0(_rcvry_fw_dump:179): CID-0000: FW dump started
[  434.119092] [0000134064] mtlk4(_rcvry_fw_dump:228): Cannot notify application about RECOVERY process initiation
[  434.129243] [0000134072] mtlk0(_rcvry_restore:356): CID-0000: Restoration started
[  434.136717] [0000134080] mtlk4(_mtlk_mmb_cleanup_reset_mac:3256): FW CPU reset is done
config: SIOCSIFFLAGS: Resource temporarily unavailable
root@AhmarRouter:/# [  434.220301] [0000134164] mtlk0(get_firmware_version:1161): CID-0000: ap_upper_wave300.bin: @@@ VERSION INFO @@@ version number: 3.4.2.40.05_NoPsTxCancel_r4005 MIPS:  Upper CPU(TMC AGG AP) interface: PCI  phy type: real phy on Jul  2 2014 at 16:00:39@@@ END @@@
[  434.220301]
[  434.254891] [0000134200] mtlk0(get_firmware_version:1161): CID-0000: contr_lm.bin: @@@ VERSION INFO @@@ version number: 3.4.2.40.05_NoPsTxCancel_r4005 MIPS:  Lower MAC  interface: --  phy type: real phy on Jul  2 2014 at 15:59:50@@@ END @@@
[  434.254891]
[  434.341502] command buffer dump 8253f2ac:
...
[  434.560122] Unhandled kernel unaligned access[#1]:
[  434.564724] CPU: 1 PID: 2653 Comm: mtlk Not tainted 4.9.152 #0
[  434.570540] task: 83322340 task.stack: 826cc000
...
[  434.791085]         8052f0a0 825d4cc0 81740000 80311b60 82fff490 8171a5e4 00000001 8253f010
[  434.799440]         8253f010 81683d84 817407a0 0f0000c4 00000000 00000044 83322340 0f0000c4
[  434.807795]         010000c4 82fff490 8253f010 8253f010 00000003 81720000 8253f414 8173f0f8
[  434.816151]         81746460 00000c15 8253f450 8168c128 8171c6a0 00000000 00008100 00000001
[  434.824507]         ...
[  434.826944] Call Trace:[  434.829229] [<82720900>] 0x82720900 [mtlkroot@82720000+0x1a940]
[  434.835232] [<80311b60>] 0x80311b60
[  434.838676] [<81683d84>] 0x81683d84 [mtlk@81600000+0x16db30]
[  434.844373] [<8168c128>] 0x8168c128 [mtlk@81600000+0x16db30]
[  434.849942] [<80069f00>] 0x80069f00
[  434.853541] [<816c9e44>] 0x816c9e44 [mtlk@81600000+0x16db30]
[  434.859210] [<8160029c>] 0x8160029c [mtlk@81600000+0x16db30]
[  434.864760] [<80083450>] 0x80083450
[  434.868280] [<816b8668>] 0x816b8668 [mtlk@81600000+0x16db30]
[  434.873909] [<80050000>] 0x80050000
[  434.877400] [<80050000>] 0x80050000
[  434.880837] [<8004abb0>] 0x8004abb0
[  434.884326] [<8164cc80>] 0x8164cc80 [mtlk@81600000+0x16db30]
[  434.889999] [<80069ffc>] 0x80069ffc
[  434.893507] [<8164cb60>] 0x8164cb60 [mtlk@81600000+0x16db30]
[  434.899139] [<8006a4c4>] 0x8006a4c4
[  434.902630] [<8004abb0>] 0x8004abb0
[  434.906119] [<8164cb60>] 0x8164cb60 [mtlk@81600000+0x16db30]
[  434.911759] [<8004acc8>] 0x8004acc8
[  434.915288] [<8004abb0>] 0x8004abb0
[  434.918734] [<8000a4d8>] 0x8000a4d8
[  434.922181]
[  434.923646] Code: 1000ffe8  00000000  8e640000 <8c820014> 30430001  10600002  00000000  2444ffff  8e82000c
[  434.933395]
[  434.935014] ---[ end trace 162bb27623a7e3b5 ]---
[  434.949098] Kernel panic - not syncing: Fatal exception
[  434.959842] Rebooting in 3 seconds..

My guess is that WAVE300 is failing to get MAC address and then it tries to load the firmware again and it somehow fails and so the kernel panic.

Edit2: Using files from last official firmware does make the WiFi appear for a few moments but it crashed after that. I was able to see the SSID on my phone.
Edit3: Maybe not
Edit4: I am finally able to bring the Wifi up and it stays active for a while until I try to see it from my phone and then it crashes. Maybe my phone probes it while scanning for possible networks and thats why it crashes. BTW I am using v18.06.2. This is what happens when I scan for the ssid on my phone:

[  365.156728] [0000065032] mtlk3(handle_rx_ind:1066): CID-0000: msdulen > nbuf size ->> 130 > 0
[  365.163965] [0000065040] mtlk4(mtlk_process_man_frame:820): Protected Management Frame received from unknown STA
[  365.174326] Unhandled kernel unaligned access[#1]:
# it continues further

#121

Message id 0x045f, that is sRAprotection, on my setup it works with the same firmware, it gets enabled. Try a different channel. Does anybody know what "RA protection" means?

After that the driver is unusable. The error will propagate forward and eventually crash the kernel. The driver code is not designed to handle that.

I will look at it, try to use a linux machine. For example with NetworkManager. A phone may try to initialize encryptions etc, which will most likely crash the driver.


#122

insmod mtlk.ko ap=1,1 fastpath=1,1 ahb_off=1
one band ap=1
two bands ap=1,1
three bands ap=1,1,1


#123

Well I think I forgot to mention that the driver works with VR200 firmware. I am using ProgModel files from W8980 (official firmware), sta_upper.bin (official firmware from 131012 - found on softpedia) and ap_upper, contr_lm from VR200 and it lets the WAVE300 come up and stay that way. I can not change txpower manually unless I turn it down through ifconfig, still not much options though.

Well for now I only have 1 client device, my phone, that is 5 ghz capable. But I do have HH5A and I tried to scan for the wifi from there and it also resulted in crashing the WAVE300. Even turning on the HH5A 5G wifi resulted in crashing the WAVE300 (maybe it probed for nearby networks).

Anyway I got a few crash dumps.

Crash dump when some other 5G device is already on:

[  883.184000] [0000582964] mtlk0(_mtlk_mbss_send_preactivate_req:2829): CID-0000: Sending UMI FW Preactivation
[  883.395537] _mtlk_mbss_send_preactivate_req 0
[  883.398855] mtlk_set_power_limit 0
[  883.402263] mtlk_core_set_ra_protection 0
[  883.406247] [0000583188] mtlk3(mtlk_core_set_force_ncb:6640): CID-0000: Error returned for UMI_FORCE_NCB request to MAC (err=2)
[  883.410399] [0000583192] mtlk3(handle_rx_inding request at virtual address 00000014, epc == 80[  883.410485] CPU 0 Unable to handle kernel paging request at virtual address 00000014, epc == 80311a8c, ra == 80311b60
[  883.410494] Oops[#1]:
[  883.410511] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.9.152 #0

# also this

[  111.574357] [4294778748] mtlk0(_mtlk_mbss_send_preactivate_req:2829): CID-0000: Sending UMI FW Preactivation
[  111.785977] _mtlk_mbss_send_preactivate_req 0
[  111.789235] mtlk_set_power_limit 0
[  111.792931] mtlk_core_set_ra_protection 0
[  111.797061] [4294778968] mtlk3(mtlk_core_set_force_ncb:6640): CID-0000: Error returned for UMI_FORCE_NCB request to MAC (err=2)
[  111.807990] mtlk_core_set_force_ncb -9
[  111.812296] mtlk_core_set_n_rate_bo 0
[  111.815382] [4294778988] mtlk0(_mtlk_mbss_preactivate:3088): CID-0000: _mtlk_mbss_preactivate returned successfully
[  111.825797] [4294779000] mtlk0(mtlk_mbss_init:3464): CID-0000: _mtlk_mbss_preactivate_if_needed returned successfully
[  111.836394] [4294779008] mtlk0(mtlk_mbss_send_vap_activate:3152): CID-0000: Entering mtlk_mbss_send_vap_activate
[  111.846577] [4294779020] mtlk0(mtlk_mbss_send_vap_activate:3159): CID-0000: Start activation
[  111.855138] [4294779028] mtlk0(__mtlk_dump:69): dump of UMI_ACTIVATE_VAP:
[  111.861890] [4294779036] mtlk3(handle_rx_ind:1066): CID-0000: msdulen > nbuf size ->> 208 > 0
[  111.870479] CPU 0 Unable to handle kernel paging request at virtual address 00000014, epc == 80311a8c, ra == 80311b60
[  111.881070] Oops[#1]:
[  111.883256] CPU: 0 PID: 2417 Comm: mtlk Not tainted 4.9.152 #0

Now If there is no 5G device already on:

# wave300 gets initiated successfully
[0000128352] mtlk0(mtlk_mbss_send_vap_activate:3228): CID-0000: mtlk_txmm_msg_send, MsgId = 0x453, ESSID = test-5ghz
[  428.481851] [0000128364] mtlk0(mtlk_mbss_init:3471): CID-0000: mtlk_mbss_send_vap_activate returned successfully

# then comes the error if I turn on HH5A

[  212.008315] [4294879172] mtlk3(handle_rx_ind:1066): CID-0000: msdulen > nbuf size ->> 208 > 0
[  212.015598] CPU 0 Unable to handle kernel paging request at virtual address 00000014, epc == 80311a8c, ra == 80311b60
[  212.026167] Oops[#1]:
[  212.028365] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.9.152 #0

I think even if the above log says the error relates to mtlk, maybe there could be bugs in ProgModel or other files which are necessary for this driver to work. I personally think a driver re-write would be far much better only if it didnt have to rely upon any external files which are not part of the re-written driver. But of course it would require much more time and brains to make it work.


#124

Rebuild the openwrt kernel with CONFIG_KERNEL_KALLSYMS (you can find the location by pressing "\" and inserting the name/string), without it I cannot see any function names, in which the code crashes. You can enable CONFIG_KERNEL_DEVMEM too if you want to poke around the hardware yourself. My kernel has CONFIG_KERNEL_DEBUG_INFO too.

Then the driver fails, please to paste full logs, these shortened are no use for searching the buggy code (there should not be any error from your logs). There can be a parallel thread on a second VPE, so we need as much informations as possible.

Also don't use any of my IRQ/eth patches, they are incomplete and makes the debugging less deterministic (as I don't use the last published version anymore). The kernel needs to be recompiled after removal/addition or it can throw weird bugs like yours Unaligned data above.

The progmodel should be fine I'm using the same version. Same with the upper/lower firmware. There would be no way to fix them anyway.

BTW how are you able to start the wifi on 161 channel? My setup doesn't allow to set 161 channel. According to wiki, the 161 channel should be 20MHz, but logs shows 40MHz. Probably it is because I'm in a different country. I hope it is not the reason for your bugs (country oriented settings :-/ ).

Rewrite of the driver can be done, but it would took a lot's of resources for 1 guy alone :smiley: .

P.S. yeah most of iwpriv parameters can be set only when the interface is down. They are changing the lowlevel behaviour of the device.

P.P.S. Hmm my second 5GHz device (rockpro64) doesn't work either :frowning: .

edit: fixed my bad english + more info

Edit2: repo updated https://repo.or.cz/wave300.git