Support for WAVE 300 Wi-Fi chip

I have tried to compile the microdriver and there were some issues for me while compiling it. First I was not able to understand what to change because it was causing errors so I dug deeper into it and found out that I needed to change a couple of makefiles because they pointed to some non-existent directories on my system.

After the compilation was part successful, the driver gets compiled but the symbol file gets a fatal error, saying unable to parse it.
There are also some notable changes:

  1. I used gcc 8.4.0 while you probably used 9.2.0
  2. Loading the driver without ap=1 asks for sta_upper_wave300.bin and if you supply one, it fails with CHI MAGIC FAILED error.
  3. For me the driver keeps crashing the router and the log is:
[  237.359886] [4294904564] mtlk2(mtlk_dfg_init:711): Starting MTLK
[  237.364592] [4294904568] mtlk0(__mtlk_print_endianess:4925): The system is Big endian (0xbeadfeed, 0xedfeadbe)
[  237.375201] [4294904580] mtlk1(mtlk_df_proc_node_create:152): Proc node root/ created
[  237.382465] [4294904588] mtlk1(mtlk_df_proc_node_create:154): Proc node root/mtlk created
[  237.391179] [4294904596] mtlk1(mtlk_df_proc_node_add_seq_entry:590): Proc entry mtlk/version created
[  237.400027] [4294904604] mtlk1(mtlk_df_proc_node_add_seq_entry:590): Proc entry mtlk/mem_alloc_dump created
[  237.409820] [4294904612] mtlk1(mtlk_df_proc_node_add_seq_entry:590): Proc entry mtlk/objpool_dump created
[  237.419200] [4294904624] mtlk1(mtlk_df_proc_node_add_seq_entry:590): Proc entry mtlk/topology created
[  237.429189] [4294904632] mtlk0(mtlk_fast_mem_print_info:114): Using normal memory for hot context
[  237.437240] [4294904640] mtlk2(_pci_probe:898): PCI 0000:00:0e.0 Initialization
[  237.444523] mtlk 0000:00:0e.0: enabling device (0000 -> 0002)
[  237.450444] [4294904656] mtlk2(_pci_mem_get:197): PCI Memory block 0: PA: 0xc0ce8c3a, VA: 0xe1419bb3, Len=0x1000
[  237.460377] [4294904664] mtlk2(_pci_mem_get:197): PCI Memory block 1: PA: 0x0b3764ae, VA: 0xe4fc443a, Len=0x800000
[  237.471267] [4294904676] mtlk1(_mtlk_print_drv_info:646): *********************************************************
[  237.482115] [4294904684] mtlk1(_mtlk_print_drv_info:647): * Driver Compilation Details:
[  237.489494] [4294904692] mtlk1(_mtlk_print_drv_info:648): *********************************************************
[  237.499694] [4294904704] mtlk1(_mtlk_print_drv_info:650): * CONFIG=PLATFORM_UGW54_VRX288 COMPONENTS LIN_DRV LINDRV_HW_PCIG3 BUS_PCI_PCIE RF_MANAGEMENT_MTLK DEBUG ENABLE_OBJPOOL TXMM_HISTORY_LENGTH=3 STAT_CNTRS_DEBUG NO_FW_RESET_ON_STOP RT_LOGGER_FUNCTIONS MAX_DLEVEL=2 USE_GENL_DEF USE_GENL DEVELOPMENT_PLATFORM ENVIRONMENT_NAME="ugw5.4-vrx288" HOST_TYPE="mips-linux" 
[  237.532181] [4294904736] mtlk1(_mtlk_print_drv_info:650): * CFLAGS=
[  237.538402] [4294904744] mtlk1(_mtlk_print_drv_info:650): * MTLK_KERNEL_CFLAGS=-mlong-calls
[  237.546806] [4294904752] mtlk1(_mtlk_print_drv_info:650): * KERNELDIR=/home/cross/openwrt12/build_dir/target-mips_34kc_musl/linux-lantiq_xrx200/linux-5.4.24/
[  237.561320] [4294904764] mtlk1(_mtlk_print_drv_info:650): * CROSS_COMPILE=/root/hardware/0_wifina/working_for_10/wave300_driver/builds/ugw5.4-vrx288/../../support/mtlkfront.sh /home/cross/openwrt12/staging_dir/toolchain-mips_34kc_gcc-9.2.0_musl/bin/mips-openwrt-linux-
[  237.584937] [4294904788] mtlk1(_mtlk_print_drv_info:650): * HOSTNAME=lenochod
[  237.592012] [4294904796] mtlk1(_mtlk_print_drv_info:653): *********************************************************
[  237.602546] [4294904808] mtlk1(_mtlk_vap_init:667): Working in normal mode
[  237.609366] [4294904812] mtlk0(_mtlk_df_user_alloc_devname:8354): NDEV Name pattern: wlan%d
[  237.617632] [4294904820] mtlk1(mtlk_df_proc_node_create:154): Proc node mtlk/wlan1 created
[  237.625735] [4294904828] mtlk1(mtlk_df_proc_node_create:154): Proc node wlan1/Debug created
[  237.635059] [4294904840] mtlk1(mtlk_df_proc_node_add_seq_entry:590): Proc entry wlan1/hw_limits created
[  237.644545] [4294904848] mtlk1(mtlk_df_proc_node_add_seq_entry:590): Proc entry wlan1/reg_limits created
[  237.654603] [4294904860] mtlk1(mtlk_df_proc_node_add_seq_entry:590): Proc entry wlan1/antenna_gain created
[  237.663293] [4294904868] mtlk1(_mtlk_df_proc_node_add_entry:378): Proc entry wlan1/do_debug_assert created
[  237.672784] [4294904876] mtlk1(_mtlk_df_proc_node_add_entry:378): Proc entry wlan1/shram created
[  237.681710] [4294904884] mtlk1(mtlk_df_proc_node_add_seq_entry:590): Proc entry Debug/General created
[  237.690653] [4294904896] mtlk1(mtlk_df_proc_node_add_seq_entry:590): Proc entry Debug/MACStats created
[  237.700461] [4294904904] mtlk1(mtlk_df_proc_node_add_seq_entry:590): Proc entry wlan1/igmp created
[  237.708994] [4294904912] mtlk1(_mtlk_df_proc_node_add_entry:378): Proc entry Debug/ResetStats created
[  237.718285] [4294904920] mtlk1(mtlk_df_proc_node_add_seq_entry:590): Proc entry wlan1/aocs_history created
[  237.728148] [4294904932] mtlk1(mtlk_df_proc_node_add_seq_entry:590): Proc entry Debug/addba_status created
[  237.737573] [4294904940] mtlk1(mtlk_df_proc_node_add_seq_entry:590): Proc entry wlan1/aocs_table created
[  237.747031] [4294904952] mtlk1(mtlk_df_proc_node_add_seq_entry:590): Proc entry wlan1/aocs_channels created
[  237.757355] [4294904960] mtlk1(mtlk_df_proc_node_add_seq_entry:590): Proc entry wlan1/aocs_penalties created
[  237.767511] [4294904972] mtlk1(_mtlk_df_proc_node_add_entry:378): Proc entry Debug/aocs_cl created
[  237.775672] [4294904980] mtlk1(mtlk_df_proc_node_add_seq_entry:590): Proc entry Debug/L2NAT created
[  237.784696] [4294904988] mtlk1(_mtlk_df_proc_node_add_entry:378): Proc entry Debug/L2NAT_ClearTable created
[  237.794645] [4294905000] mtlk1(mtlk_df_proc_node_add_seq_entry:590): Proc entry Debug/ReorderingStats created
[  237.804542] [4294905008] mtlk1(mtlk_df_proc_node_add_seq_entry:590): Proc entry wlan1/EECaps created
[  237.813645] [4294905016] mtlk1(mtlk_df_proc_node_add_seq_entry:590): Proc entry Debug/SendQueue created
[  237.822887] [4294905028] mtlk1(mtlk_df_proc_node_add_seq_entry:590): Proc entry Debug/PS created
[  237.831577] [4294905036] mtlk1(mtlk_df_proc_node_add_seq_entry:590): Proc entry Debug/serializer_dump created
[  237.841857] [4294905044] mtlk1(mtlk_df_proc_node_add_seq_entry:590): Proc entry wlan1/eeprom created
[  237.850713] [4294905056] mtlk1(mtlk_df_proc_node_add_seq_entry:590): Proc entry wlan1/eeprom_fw created
[  237.860080] [4294905064] mtlk1(mtlk_df_proc_node_add_seq_entry:590): Proc entry wlan1/version created
[  237.869885] [4294905072] mtlk1(_mtlk_df_proc_node_add_entry:378): Proc entry wlan1/lm created
[  237.877865] [4294905080] mtlk1(_mtlk_df_proc_node_add_entry:378): Proc entry wlan1/um created
[  237.886774] [4294905092] mtlk0(mtlk_core_pdb_fast_handles_open:43): Open Hot-th parameters
[  237.894750] [4294905100] mtlk3(mtlk_pdb_open:285): << open fast handle id(0) 
[  237.902109] [4294905104] mtlk3(mtlk_pdb_open:285): << open fast handle id(1) 
[  237.909553] [4294905112] mtlk3(mtlk_pdb_open:285): << open fast handle id(3) 
[  237.916415] [4294905120] mtlk3(mtlk_pdb_open:285): << open fast handle id(2) 
[  237.923497] [4294905128] mtlk3(mtlk_pdb_open:285): << open fast handle id(4) 
[  237.930483] [4294905136] mtlk3(mtlk_dfs_create:141): mtlk_dfs_create
[  237.936988] [4294905140] mtlk1(mtlk_qos_set_map:161): Set 802.11 TID-to-AC mapping
[  237.944925] [4294905148] mtlk2(_mmb_drv_irq_start:641): mtlk IRQ 0x1e
[  238.006895] mtlk 0000:00:0e.0: Direct firmware load for cal_wlan1.bin failed with error -2
[  238.014013] mtlk 0000:00:0e.0: Falling back to sysfs fallback for: cal_wlan1.bin
[  238.493902] [4294905696] mtlk3(_mtlk_df_fw_request_firmware:63): Firmware ([  238.536289] [4294905740] mtlk2(_eeprom_read_from_gpio:813): EEPROM via GPIO available (size:1024)
[  238.766586] eeprom dump 1024 1024: 
[  238.768679] fc1bcd00 00000100 800d0000 00000000  301a8006 00000000 08f0ffff 080080ff
[  238.776807] 06087e00 301a0007 ffffffff ffffffff  ffffffff ffffffff ffffffff ffffffff
[  238.784288] c0030000 00000104 80103841 41004100  09860000 00000001 01088382 0020240c
[  238.791972] 0b0d0500 05749356 726e8f52 6e728c58  6e004a5d 4a5f4e5e 00000000 0000340b
[  238.799962] 0b0d0101 01768c52 646f8a50 64718554  6200505e 4e5f525d 00000000 0000840c
[  238.808101] 0a0a0105 01708d54 6d709153 70759154  69004c5e 4a5d4c5b 00000000 00009d0b
[  238.815377] 0a0a0501 046a8b54 70638950 716c8f56  75004a5e 48604a5e 00000000 0000ff0c
[  238.823243] 0aed0101 01169ac1 6b279bcd 6f2f91e7  7000af5d b660c95f 00000000 0000ff34
[  238.830986] 14150001 058c9d63 769a9a72 7cc39a88  7800535f 565b6a4f 00000000 00000000
[  238.838504] 00000000 00077415 16010104 999f7382  9f977376 ba968f7b 0059625e 5e7b6250
[  238.846372] 4f00006e 50000000 00000000 ff004100  50bfbb1b 54ac0000 23078136 240e837b
[  238.853946] e50e8481 e23c0c80 7fd90d81 81db6409  7b7ed009 7e84d584 0a847ecf 0a7e81ce
[  238.861860] 9d058376 d6058276 de052aa3 553c28a6  56438212 ffffffff ffffffff ffffffff
[  238.869428] ffffffff ffffff00 20626f61 72642721  02fe00ff 00ff00ff 00000000 00002863
[  238.877236] 2920436f 70797269 67687420 32300030  312c2054 414c4954 5920554b 204c7464
[  238.885007] 2e00ffff ffffffff ffffffff ffffffff  ffffffff ffffffff ffffffff ffffffff
[  238.893126] fc1bcd00 00000100 800d0000 00000000  301a8006 00000000 08f0ffff 080080ff
[  238.900508] 06087e00 301a0007 ffffffff ffffffff  ffffffff ffffffff ffffffff ffffffff
[  238.908182] b9000000 00000101 80103041 45004100  50bfbb1b 54ac0000 23078136 240e837b
[  238.916343] e50e8481 e23c0c80 7fd90d81 81db6409  7b7ed009 7e84d584 0a847ecf 0a7e81ce
[  238.924469] 9d058376 d6058276 de052aa3 553c28a6  56438212 ffffffff ffffffff ffffffff
[  238.931495] ffffffff ffffff00 20626f61 72642721  02fe00ff 00ff00ff 00000000 00002863
[  238.939615] 2920436f 70797269 67687420 32300030  312c2054 414c4954 5920554b 204c7464
[  238.947138] 2e00ffff ffffffff ffffffff ffffffff  ffffffff ffffffff ffffffff ffffffff
[  238.954732] fc1bcd00 00000100 800d0000 00000000  301a8006 00000000 08f0ffff 080080ff
[  238.962461] 06087e00 301a0007 ffffffff ffffffff  ffffffff ffffffff ffffffff ffffffff
[  238.970147] b9000000 00000101 80103041 45004100  50bfbb1b 54ac0000 23078136 240e837b
[  238.977981] e50e8481 e23c0c80 7fd90d81 81db6409  7b7ed009 7e84d584 0a847ecf 0a7e81ce
[  238.985711] 9d058376 d6058276 de052aa3 553c28a6  56438212 ffffffff ffffffff ffffffff
[  238.993558] ffffffff ffffff00 20626f61 72642721  02fe00ff 00ff00ff 00000000 00002863
[  239.001218] 2920436f 70797269 67687420 32300030  312c2054 414c4954 5920554b 204c7464
[  239.008880] 2e00ffff ffffffff ffffffff ffffffff  ffffffff ffffffff ffffffff ffffffff
[  239.016867] EEPROM reading finished, 1024 bytes read.
[  239.021713] [4294906224] mtlk2(mtlk_tpcv4_init:65): Object for 4 points (32 bytes of data) created.
[  239.031048] TPC with 4 points
[  239.033597] TPC: ch=36, band=0, spectrum=1
[  239.037869] [4294906240] mtlk2(mtlk_tpcv4_init:65): Object for 4 points (32 bytes of data) created.
[  239.047018] TPC with 4 points
[  239.049770] TPC: ch=52, band=0, spectrum=1
[  239.053913] [4294906256] mtlk2(mtlk_tpcv4_init:65): Object for 4 points (32 bytes of data) created.
[  239.062999] TPC with 4 points
[  239.065778] TPC: ch=132, band=0, spectrum=1
[  239.070110] [4294906272] mtlk2(mtlk_tpcv4_init:65): Object for 4 points (32 bytes of data) created.
[  239.079317] TPC with 4 points
[  239.081968] TPC: ch=157, band=0, spectrum=1
[  239.102819] [4294906308] mtlk3(_mtlk_df_fw_request_firmware:68): ap_upper_wave300.bin firmware: size=0x2e700, data=0xc3f84c33
[  239.112833] [4294906316] mtlk2(_mtlk_mmb_load_firmware:2015): Loading 'ap_upper_wave300.bin' of 190208 bytes
[  239.143519] [4294906348] mtlk0(get_firmware_version:1161): CID-0000: ap_upper_wave300.bin: @@@ VERSIN 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 @@@
[  239.143519] 
[  239.174635] [4294906380] mtlk3(_mtlk_df_fw_request_firmware:68): contr_lm.bin firmware: size=0x16180, data=0x7dd5c6cf
[  239.183937] [4294906388] mtlk2(_mtlk_mmb_load_firmware:2015): Loading 'contr_lm.bin' of 90496 bytes
[  239.203377] [4294906408] 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 @@@
[  239.203377] 
[  239.290364] command buffer dump 828df2ac:
[  239.292937] 0000: 448a0000
[  239.295740] 0001: 7b010000
[  239.298408] 0002: 58840000
[  239.301026] 0003: 7b010000
[  239.303817] 0004: 007e0000
[  239.306523] 0005: a0000000
[  239.309123] 0006: 20680000
[  239.311942] 0007: c8000000
[  239.314626] 0008: 409c0000
[  239.317213] 0009: 0e000000
[  239.320022] 000a: e8630000
[  239.322715] 000b: 02000000
[  239.325310] 000c: 6c820000
[  239.328106] 000d: 01000000
[  239.330818] 000e: 80800000
[  239.333406] 000f: 01000000
[  239.336249] 0010: edfeadbe
[  239.338913] 0011: f0000000
[  239.341498] 0012: 00000000
[  239.344300] 0013: 00000000
[  239.347008] 0014: 00000000
[  239.349592] 0015: 00000000
[  239.352392] 0016: 00000000
[  239.355141] 0017: 00000000
[  239.357683] 0018: 00000000
[  239.360484] 0019: 00000000
[  239.363187] 001a: 00000000
[  239.365782] 001b: 00000000
[  239.368579] 001c: 00000000
[  239.371285] 001d: 00000000
[  239.373876] 001e: 00000000
[  239.376673] 001f: 00000000
[  239.379402] 0020: 00000000
[  239.381960] 0021: 00000000
[  239.384774] 0022: 00000000
[  239.387489] 0023: 00000000
[  239.390056] 0024: 00000000
[  239.392939] 0025: 00000000
[  239.395584] 0026: 00000000
[  239.398151] 0027: 00000000
[  239.400958] 0028: 00000000
[  239.403664] 0029: 00000000
[  239.406261] 002a: 00000000
[  239.408963] 002b: 00000001
[  239.411748] 002c: 00000001
[  239.414437] 002d: 00000000
[  239.417054] 002e: 00000000
[  239.419880] 002f: 00000000
[  239.422540] 0030: 00000000
[  239.425147] 0031: 00000000
[  239.427947] 0032: 00000000
[  239.430646] 0033: 00000000
[  239.433257] 0034: 00000000
[  239.436078] 0035: 00000000
[  239.438752] 0036: 00000000
[  239.441336] 0037: 00000000
[  239.444135] 0038: 00000000
[  239.446839] 0039: 00000000
[  239.449430] 003a: 00000000
[  239.452229] 003b: 00000000
[  239.454931] 003c: 00000000
[  239.457526] 003d: 00000000
[  239.460342] 003e: 00000000
[  239.463026] 003f: 00000000
[  239.465621] 0040: 00000000
[  239.468418] 0041: 00000000
[  239.471119] 0042: 00000000
[  239.473718] 0043: 00000000
[  239.476515] 0044: 00000000
[  239.479216] 0045: 00000000
[  239.481810] 0046: 00000000
[  239.484628] 0047: 00000000
[  239.487309] 0048: 00000000
[  239.489906] 0049: 00000000
[  239.492734] 004a: 00000000
[  239.495404] 004b: 00000000
[  239.498003] 004c: 00000000
[  239.500800] 004d: 00000000
[  239.503500] 004e: 00000000
[  239.506093] 004f: 00000000
[  239.508934] [4294906712] mtlk2(_mtlk_mmb_parse_chi_extensions:2144): offset = 68, CHI_ADDR = 0x00000000, sizeof(hw->chi_data) = 68
[  239.520695] [4294906724] mtlk2(_mtlk_mmb_parse_chi_extensions:2155): HOST_EXTENSION_MAGIC = 0xbeadfeed
[  239.529999] [4294906732] mtlk2(_mtlk_mmb_parse_chi_extensions:2156): ext_hdr.u32ExtensionMagic = 0xedfeadbe
[  239.539754] [4294906744] mtlk2(_mtlk_mmb_parse_chi_extensions:2164): ext_hdr.u32ExtensionID = 0x00000001
[  239.549241] [4294906752] mtlk2(_mtlk_mmb_parse_chi_extensions:2165): ext_hdr.u32ExtensionDataSize = 8
[  239.558455] [4294906764] mtlk2(_mtlk_mmb_parse_chi_extensions:2155): HOST_EXTENSION_MAGIC = 0xbeadfeed
[  239.567774] [4294906772] mtlk2(_mtlk_mmb_parse_chi_extensions:2156): ext_hdr.u32ExtensionMagic = 0xedfeadbe
[  239.577515] [4294906780] mtlk2(_mtlk_mmb_parse_chi_extensions:2164): ext_hdr.u32ExtensionID = 0x00000002
[  239.587008] [4294906792] mtlk2(_mtlk_mmb_parse_chi_extensions:2165): ext_hdr.u32ExtensionDataSize = 4
[  239.596279] [4294906800] mtlk2(_mtlk_mmb_parse_chi_extensions:2155): HOST_EXTENSION_MAGIC = 0xbeadfeed
[  239.605548] [4294906808] mtlk2(_mtlk_mmb_parse_chi_extensions:2156): ext_hdr.u32ExtensionMagic = 0xedfeadbe
[  239.615308] [4294906820] mtlk2(_mtlk_mmb_parse_chi_extensions:2164): ext_hdr.u32ExtensionID = 0x00000003
[  239.624772] [4294906828] mtlk2(_mtlk_mmb_parse_chi_extensions:2165): ext_hdr.u32ExtensionDataSize = 8
[  239.634066] [4294906836] mtlk2(_mtlk_mmb_parse_chi_extensions:2155): HOST_EXTENSION_MAGIC = 0xbeadfeed
[  239.643348] [4294906848] mtlk2(_mtlk_mmb_parse_chi_extensions:2156): ext_hdr.u32ExtensionMagic = 0xedfeadbe
[  239.653082] [4294906856] mtlk2(_mtlk_mmb_parse_chi_extensions:2164): ext_hdr.u32ExtensionID = 0x00000004
[  239.662559] [4294906868] mtlk2(_mtlk_mmb_parse_chi_extensions:2165): ext_hdr.u32ExtensionDataSize = 4
[  239.671783] [4294906876] mtlk2(_mtlk_mmb_parse_chi_extensions:2155): HOST_EXTENSION_MAGIC = 0xbeadfeed
[  239.681214] [4294906884] mtlk2(_mtlk_mmb_parse_chi_extensions:2156): ext_hdr.u32ExtensionMagic = 0xedfeadbe
[  239.690856] [4294906896] mtlk2(_mtlk_mmb_parse_chi_extensions:2164): ext_hdr.u32ExtensionID = 0x00000005
[  239.700370] [4294906904] mtlk2(_mtlk_mmb_parse_chi_extensions:2165): ext_hdr.u32ExtensionDataSize = 4
[  239.709560] [4294906912] mtlk2(_mtlk_mmb_parse_chi_extensions:2155): HOST_EXTENSION_MAGIC = 0xbeadfeed
[  239.718873] [4294906924] mtlk2(_mtlk_mmb_parse_chi_extensions:2156): ext_hdr.u32ExtensionMagic = 0xedfeadbe
[  239.728643] [4294906932] mtlk2(_mtlk_mmb_parse_chi_extensions:2164): ext_hdr.u32ExtensionID = 0x00000006
[  239.738141] [4294906940] mtlk2(_mtlk_mmb_parse_chi_extensions:2165): ext_hdr.u32ExtensionDataSize = 16
[  239.747457] [4294906952] mtlk2(_mtlk_mmb_parse_chi_extensions:2155): HOST_EXTENSION_MAGIC = 0xbeadfeed
[  239.756746] [4294906960] mtlk2(_mtlk_mmb_parse_chi_extensions:2156): ext_hdr.u32ExtensionMagic = 0xaaaaaaaa
[  239.766492] [4294906972] mtlk2(mtlk_hw_mmb_start_card:4173): CHI: sFifoQ: is=0x8a44 in=379 rs=0x8458 rn=379
239.776243] [4294906980] mtlk2(mtlk_hw_mmb_start_card:4174): CHI: sDAT: is=0x7e00 in=160 rs=0x6820 rn=200
[  239.785810] [4294906988] mtlk2(mtlk_hw_mmb_start_card:4175): CHI: sMAN: is=0x9c40 in=14 rs=0x63e8 rn=2
[  239.795122] [4294907000] mtlk2(mtlk_hw_mmb_start_card:4176): CHI: sDBG: is=0x826c in=1 rs=0x8080 rn=1
[  239.804664] [4294907008] mtlk2(_mtlk_mmb_rxque_set_default_cfg:1099): Rx Queue#d: size = 64, buffer = 114
[  239.813946] [4294907016] mtlk2(_mtlk_mmb_rxque_set_default_cfg:1099): Rx Queue#d: size = 64, buffer = 1614
[  239.823600] [4294907028] mtlk2(_mtlk_mmb_rxque_set_default_cfg:1099): Rx Queue#d: size = 32, buffer = 4096
[  239.833272] CPU 0 Unable to handle kernel paging request at virtual address f4088fa0, epc == 80023c14, ra == 80090df4
[  239.843855] Oops[#1]:
[  239.846020] CPU: 0 PID: 2255 Comm: insmod Tainted: G        W         5.4.41 #0
[  239.853301] $ 0   : 00000000 00000001 00000004 00000000
[  239.858516] $ 4   : f4088fa0 00000001 00000072 00000000
[  239.863727] $ 8   : 00000100 00000020 00000040 ffffffff
[  239.868968] $12   : 00000243 de000000 00000000 000c9130
[  239.874172] $16   : 74088fa0 828df010 82899fa0 00000072
[  239.879394] $20   : 828df3e4 00000000 82860010 81b50000
[  239.884619] $24   : 00000001 80023abc                  
[  239.889839] $28   : 82490000 82491a18 828df010 80090df4
[  239.895067] Hi    : 00000000
[  239.897930] Lo    : 00000004
[  239.900857] epc   : 80023c14 r4k_dma_cache_inv+0x158/0x340
[  239.906304] ra    : 80090df4 dma_direct_map_page+0x108/0x13c
[  239.911950] Status: 1100ff03	KERNEL EXL IE 
[  239.916127] Cause : 00800008 (ExcCode 02)
[  239.920146] BadVA : f4088fa0
[  239.923006] PrId  : 00019556 (MIPS 34Kc)
[  239.926917] Modules linked in: mtlk(+) mtlkroot ath9k ath9k_common iptable_nat ath9k_hw ath xt_state xt_nat xt_conntrack xt_REDIRECT xt_MASQUERADE xt_FLOWOFFLOAD pppoe nf_nat nf_flow_table_hw nf_flow_table nf_conntrack_rtcache nf_conntrack mac80211 ipt_REJECT cfg80211 ath9k_pci_owl_loader xt_time xt_tcpudp xt_multiport xt_mark xt_mac xt_limit xt_comment xt_TCPMSS xt_LOG pppox ppp_async nf_reject_ipv4 nf_log_ipv4 nf_defrag_ipv6 nf_defrag_ipv4 ltq_deu_vr9 iptable_mangle iptable_filter ip_tables crc_ccitt compat fuse drv_dsl_cpe_api ledtrig_usbport drv_mei_cpe nf_log_ipv6 nf_log_common ip6table_mangle ip6table_filter ip6_tables ip6t_REJECT x_tables nf_reject_ipv6 pppoatm ppp_generic slhc br2684 atm drv_ifxos usb_storage dwc2 fsl_mph_dr_of ehci_platform ehci_fsl sd_mod scsi_mod ehci_hcd gpio_button_hotplug ext4 mbcache jbd2 crc32c_geric
[  240.001033] Process insmod (pid: 2255, threadinfo=830872cb, task=8369ef45, tls=77ec8ec8)
[  240.009083] Stack : 828df3e4 80430abc 81b7925c 81a4d734 828df3e4 80090df4 81b49046 82860010
[  240.017439]         828df010 82899fa0 82860010 81a94ce8 828df3a8 82491a88 82565380 825408fc
[  240.025796]         00000002 00000000 81b24268 00000001 828df40e 81b24750 00000000 81949c10
[  240.034149]         828df010 00000000 828df010 00000000 00000000 81a95198 0000abce 81ac94d8
[  240.042518]         00000000 00000001 00000000 00000000 81b5faf8 81b49024 00000003 00000050
[  240.050874]         ...
[  240.053297] Call Trace:
[  240.055767] [<80023c14>] r4k_dma_cache_inv+0x158/0x340
[  240.060898] [<80090df4>] dma_direct_map_page+0x108/0x13c
[  240.068172] [<81a94ce8>] _mtlk_mmb_alloc_and_set_rx_buffer+0xcc/0x36c [mtlk]
[  240.077686] [<81a95198>] _mtlk_mmb_prealloc_rx_buffers+0x210/0x58c [mtlk]
[  240.086990] [<81a9e724>] mtlk_hw_mmb_start_card+0x714/0x1508 [mtlk]
[  240.095713] [<81b17df4>] _pci_probe+0x73c/0x14e4 [mtlk]
[  240.101442] [<80320718>] pci_device_probe+0xbc/0x150
[  240.104959] [<803607b0>] really_probe+0x104/0x358
[  240.109656] [<80360ef8>] device_driver_attach+0x70/0x98
[  240.114883] [<80360f80>] __driver_attach+0x60/0x100
[  240.119772] [<8035e7e0>] bus_for_each_dev+0x68/0xa4
[  240.124632] [<8035fb4c>] bus_add_driver+0x1f0/0x200
[  240.129501] [<8036160c>] driver_register+0x84/0x148
[  240.136321] [<81b18e60>] _init_module+0x1c8/0x2a8 [mtlk]
[  240.142354] [<8000261c>] do_one_initcall+0x7c/0x1dc
[  240.145788] [<800aef78>] do_init_module+0x60/0x218
[  240.150615] [<800b1134>] load_module+0x1f88/0x2500
[  240.155403] [<800b1818>] sys_init_module+0x16c/0x1a8
[  240.160334] [<800187f8>] syscall_common+0x34/0x58
[  240.165020] Code: 30430004  1060000a  30430002 <bc910000> 01242021  bc910000  01242021  bc910000  01242021 
[  240.174768] 
[  240.176583] ---[ end trace 09e9bf828262f8a7 ]---
[  240.181036] Kernel panic - not syncing: Fatal exception
[  240.186121] Rebooting in 3 seconds..

Hi,

I was "playing" with the code in order to parse the eeprom and prove if something was broken.

My findings so far is that the eeprom is properly found and content is donwloaded; so I must assume that the information (country, MAC, antennas gain etc) should be properly decoded and managed by the driver. This is yet to see.

As general information, the driver is creating some /proc directories very messy. One can make a binary dump of the eeprom by a simple cat:

root@OpenWrt:/proc/967/net/mtlk/wlan0# ls
Debug            aocs_penalties   hw_limits        um
EECaps           aocs_table       igmp             version
antenna_gain     do_debug_assert  lm
aocs_channels    eeprom           reg_limits
aocs_history     eeprom_fw        shram
root@OpenWrt:/proc/967/net/mtlk/wlan0# cat eeprom > /tmp/eeprom_dump.bin
[  442.271641] mtlk 0000:01:00.0: Direct firmware load for cal_wlan0.bin failed with error -2
[  442.278554] mtlk 0000:01:00.0: Falling back to user helper
[  442.425382] firmware cal_wlan0.bin: firmware_loading_store: map pages failed
[  442.431542] [0000142344] mtlk3(_mtlk_df_fw_request_firmware:63): Firmware (cal_wlan0.bin) is missing
[  442.470588] [0000142380] mtlk2(_eeprom_read_from_gpio:811): EEPROM via GPIO available (size:1024)
[  641.373242] [0000341284] mtlk2(_mtlk_df_ui_execute_cfg_handler:8118): IWPRIV #0x80a0 processing done

For @Smim0, I've parsed the information regarding the MAC contained in the eeprom and the last 3 octects are different to 0, as expected. So I must guess that the information provided by iwpriv wlan0 gEEPROM is censored. Also the country is clearly defined in the eeprom and not shown by the command.
In fact, the eeprom MAC matches the one with command iwpriv wlan0 gMAC

Summarizing, the eeprom is properly read, still to find if all the information isproperly managed by the driver although it looks so.

Hello

I read the subject from beginning to end but did not understand much.
I have a tplink 9980 openwrt device. Is there any easy way to run 5ghz wireless network?

I'm quite a beginner :frowning:

No, there is no free or usable driver for Lantiq WAV300 wireless.

--
There are only bits and pieces from various proprietary driver publications (shim and binary objects), which form the basis for some interested users trying to get their hardware working, but the drivers expect ancient kernels, are incomplete and buggy. Chances for this to "just work" (or work at all, longer term) are close to zero, availability in OpenWrt probably even below that. Especially if you consider yourself to be a beginner, the only reasonable expectation is to consider this fatally broken and move on to some supported hardware (respectively to use it as a wired modem with a decent router behind it).

1 Like

Any news? What is the state of the proyect?

-sorry for my bad english-

Almost dead

Hello @garlet

Here is the latest acheiving from my side.

I was able to compile this source driver for openwrt v18.06.6 (in openwrt v19 it failed) following these instructions from @suleiman.

To launch the driver you need the firmware files https://ufile.io/f/4bbft but not all of them, it depends on the hardware you are working what I did was to launch the driver at first with nothing and then check the logs everytime it crashes it asks for a specific one so I kept adding them till the driver launched correctly.

About hostapd, I managed to compile the one provided by @vittorio88 in the begining of the thread and launch it manually but I believe the one that comes with openwrt could be used if patched but as I have no idea about coding I didn't do it.

About the firmware files, the ones that worked are from version 3.4.2 and they worked fine but unfortunately the don't have the file sta_upper_wave300.bin which gives the option to have sta mode, @suleiman has done something here to make it work.

I hope this helps.
Cheers

1 Like

Thanks, do you have the 39_RevA files?
ProgModel_BG_nCB_39_RevA_wave300.bin and ProgModel_BG_nCB_wave300.bin

I found some more firmware files that contain this one and more

1 Like

(this is the updated post)
Hi, after reading this topic, and before start working on the code, I will recap what happened, so I can be in the correct path and new people can understand what is going on.

First @ vittorio88, @pc2005, @ Mandrake-Lee and @ ahmar16 made the driver connect but without encryption. For this it is required:

  • Kernel 4.9 (OpenWrt 18.06.x) compiled with debug options (or it crashes the router after: insmod mtlkroot.ko cdebug=3; insmod mtlk.ko ap=1);
  • Build the driver and copy the firmware files to /lib/firmware.

Then @pc2005 posted a new source that @Smim0 was able to build and connect with encryption enabled. For this it is required:

  • Kernel compiled with PCIE-MSI and some patches applied;
  • Additional firmware files ProgModel_BG_nCB_39_RevA_wave300.bin and ProgModel_BG_nCB_wave300.bin;
  • Compile hostapd source and wpa_supplicant with: changing CONFIG_TLS to internal, disabling all CONFIG_EAP* in hostapd/.config, removing all flags of -ltommat, and hostapd config file should have the line driver=mtlk;

Meanwhile @suleiman made the driver work with a back-port of rflib, pci express interrupt polling and hostapd_08x patches, on a standard OpenWrt image, but did not posted the patches yet.

Then I forked ahmar20 and made scripts that compiles openWrt v19.07.6 and wave300 with @suleiman instructions, being able to get a DHCP IP, but did not manage to access the internet and set encryption.

Thank you all for this hard work done.

Hi,

Successfully build OpenWrt 19.07.7, wave300 and hostapd+wpa_supplicant(new script).
I included some kernel modules (kmod-cfg80211 kmod-lib80211 kmod-mac80211 kmod-mac80211-hwsim [script is not doing this] ) on the image, because opkg complains about kernel version, even after setting the repository to my local nginx folder.

I can connect to the router, enter password and receive DHCP IP, but still not have access to internet or LAN. I am using the following commands:

insmod mtlkroot.ko cdebug=3
insmod mtlk.ko ap=1  
iwpriv wlan0 sCountry ____
iwpriv wlan0 sMAC ____
iwpriv wlan0 sBridgeMode 1 # ?
iwpriv wlan0 gBridgeMode 1 # ?
iwconfig wlan0 essid ____
iwconfig wlan0 key _____
./mtlk-ap config.conf

Does anyone had those issues? ( connectivity and opkg kernel version )

Thx

are you able to reach other devices in lan?

may I try your build @garlet?

Hi,

@targa, you can build it with: scripts remember to include kernel modules (kmod-cfg80211 kmod-lib80211 kmod-mac80211 kmod-mac80211-hwsim [script is not doing this] ), do you like me to upload the binaries?

@Smim0, with and without encryption, It does not access: internet, lan or the router.

Now LuCI is showing wireless tabs, but the configs seems to do nothing.

I didn't found anything strange on the following output and files:

root@OpenWrt:/lib/modules# ./mtlk-ap config.conf
Configuration file: config.conf
wlan2: interface state UNINITIALIZED->COUNTRY_UPDATE
Using interface wlan2 with hwaddr 12:34:56:78:90:ab and ssid "htest"
wlan2: interface state COUNTRY_UPDATE->ENABLED
wlan2: AP-ENABLED 
wlan2: STA 36:94:90:51:69:2a IEEE 802.11: associated
wlan2: AP-STA-CONNECTED 36:94:90:51:69:2a
wlan2: STA 36:94:90:51:69:2a RADIUS: starting accounting session BBCDBB3EB3057760
wlan2: STA 36:94:90:51:69:2a WPA: pairwise key handshake completed (WPA)
wlan2: STA 36:94:90:51:69:2a WPA: group key handshake completed (WPA)
root@OpenWrt:/lib/modules# rm /etc/config/wireless && wifi config && cat /etc/config/wireless

config wifi-device 'radio0'
        option type 'mac80211'
        option channel '36'
        option hwmode '11a'
        option path 'virtual/mac80211_hwsim/hwsim0'
        option htmode 'VHT80'
        option disabled '1'

config wifi-iface 'default_radio0'
        option device 'radio0'
        option network 'lan'
        option mode 'ap'
        option ssid 'OpenWrt'
        option encryption 'none'

config wifi-device 'radio1'
        option type 'mac80211'
        option channel '36'
        option hwmode '11a'
        option path 'virtual/mac80211_hwsim/hwsim1'
        option htmode 'VHT80'
        option disabled '1'

config wifi-iface 'default_radio1'
        option device 'radio1'
        option network 'lan'
        option mode 'ap'
        option ssid 'OpenWrt'
        option encryption 'none'
root@OpenWrt:/lib/modules# cat /etc/config/firewall
config defaults
        option syn_flood        1
        option input            ACCEPT
        option output           ACCEPT
        option forward          REJECT
# Uncomment this line to disable ipv6 rules
#       option disable_ipv6     1

config zone
        option name             lan
        list   network          'lan'
        option input            ACCEPT
        option output           ACCEPT
        option forward          ACCEPT

config zone
        option name             wan
        list   network          'wan'
        list   network          'wan6'
        option input            REJECT
        option output           ACCEPT
        option forward          REJECT
        option masq             1
        option mtu_fix          1

config forwarding
        option src              lan
        option dest             wan

# We need to accept udp packets on port 68,
# see https://dev.openwrt.org/ticket/4108
config rule
        option name             Allow-DHCP-Renew
        option src              wan
        option proto            udp
        option dest_port        68
        option target           ACCEPT
        option family           ipv4

# Allow IPv4 ping
config rule
        option name             Allow-Ping
        option src              wan
        option proto            icmp
        option icmp_type        echo-request
        option family           ipv4
        option target           ACCEPT

config rule
        option name             Allow-IGMP
        option src              wan
        option proto            igmp
        option family           ipv4
        option target           ACCEPT

# Allow DHCPv6 replies
# see https://dev.openwrt.org/ticket/10381
config rule
        option name             Allow-DHCPv6
        option src              wan
        option proto            udp
        option src_ip           fc00::/6
        option dest_ip          fc00::/6
        option dest_port        546
        option family           ipv6
        option target           ACCEPT

config rule
        option name             Allow-MLD
        option src              wan
        option proto            icmp
        option src_ip           fe80::/10
        list icmp_type          '130/0'
        list icmp_type          '131/0'
        list icmp_type          '132/0'
        list icmp_type          '143/0'
        option family           ipv6
        option target           ACCEPT

# Allow essential incoming IPv6 ICMP traffic
config rule
        option name             Allow-ICMPv6-Input
        option src              wan
        option proto    icmp
        list icmp_type          echo-request
        list icmp_type          echo-reply
        list icmp_type          destination-unreachable
        list icmp_type          packet-too-big
        list icmp_type          time-exceeded
        list icmp_type          bad-header
        list icmp_type          unknown-header-type
        list icmp_type          router-solicitation
        list icmp_type          neighbour-solicitation
        list icmp_type          router-advertisement
        list icmp_type          neighbour-advertisement
        option limit            1000/sec
        option family           ipv6
        option target           ACCEPT

# Allow essential forwarded IPv6 ICMP traffic
config rule
        option name             Allow-ICMPv6-Forward
        option src              wan
        option dest             *
        option proto            icmp
        list icmp_type          echo-request
        list icmp_type          echo-reply
        list icmp_type          destination-unreachable
        list icmp_type          packet-too-big
        list icmp_type          time-exceeded
        list icmp_type          bad-header
        list icmp_type          unknown-header-type
        option limit            1000/sec
        option family           ipv6
        option target           ACCEPT

config rule
        option name             Allow-IPSec-ESP
        option src              wan
        option dest             lan
        option proto            esp
        option target           ACCEPT

config rule
        option name             Allow-ISAKMP
        option src              wan
        option dest             lan
        option dest_port        500
        option proto            udp
        option target           ACCEPT

# include a file with users custom iptables rules
config include
        option path /etc/firewall.user


### EXAMPLE CONFIG SECTIONS
# do not allow a specific ip to access wan
#config rule
#       option src              lan
#       option src_ip   192.168.45.2
#       option dest             wan
#       option proto    tcp
#       option target   REJECT

# block a specific mac on wan
#config rule
#       option dest             wan
#       option src_mac  00:11:22:33:44:66
#       option target   REJECT

# block incoming ICMP traffic on a zone
#config rule
#       option src              lan
#       option proto    ICMP
#       option target   DROP

# port redirect port coming in on wan to lan
#config redirect
#       option src                      wan
#       option src_dport        80
#       option dest                     lan
#       option dest_ip          192.168.16.235
#       option dest_port        80
#       option proto            tcp

# port redirect of remapped ssh port (22001) on wan
#config redirect
#       option src              wan
#       option src_dport        22001
#       option dest             lan
#       option dest_port        22
#       option proto            tcp

### FULL CONFIG SECTIONS
#config rule
#       option src              lan
#       option src_ip   192.168.45.2
#       option src_mac  00:11:22:33:44:55
#       option src_port 80
#       option dest             wan
#       option dest_ip  194.25.2.129
#       option dest_port        120
#       option proto    tcp
#       option target   REJECT

#config redirect
#       option src              lan
#       option src_ip   192.168.45.2
#       option src_mac  00:11:22:33:44:55
#       option src_port         1024
#       option src_dport        80
#       option dest_ip  194.25.2.129
#       option dest_port        120
#       option proto    tcp

thx

for me it sounds like it is not bridged,
can you try manually

 iwpriv wlan0 sBridgeMode=1

or

 iwpriv wlan0 gBridgeMode=1

Hi, still but no connectivity yet, tried:

  • iwpriv wlan0 sBridgeMode=1; iwpriv wlan0 gBridgeMode=1

Made another script for loading and coping drivers and firmware.
I uploaded the firm-wares that I have, but I lost "ap_upper_wave300" from your set( smim0 folder).
I believe that compiling without selecting the modem, keeps opkg magic number compatible,
because it installed local packages.
The module kmod-mac80211-hwsim is a simulator, that was giving some fake functionality.
Now "wifi config" don't work, probably because "iw list" returns: nl80211 not found.

Thx

Hi,

Got connection to lan/internet without encryption with the command:

brctl addif "br-lan" "wlan0"
ifconfig wlan0 up

When I try to establish encryption with hostapd and the wlan0 added to the bridge, it reject the connection with wrong password.

The hostapd(mtlk-ap) at the benjamin repo, is a modified version of hostapd 2.7, that can accept the wave300 driver. Probably this patch may be applied to the current 2.9 version.

The command "wifi config" will not work because the driver does not provide the newer mac80211 API, it uses the WEXT API (old and only receiving bug updates).
This also means that LuCI will not interact with it, but I believe that the script mltk.sh could do that, hostapd, bridge and /etc/config/wireless.

Sorry @garlet , I missed your answer, will try.

EDIT: Maybe you can upload the binaries, please. I have no current development system ready, and haven't done a build for quite a while. Thanks a lot.

Hi, good news!!

Connection with WPA2. Speed with google test is ~ 5.5 Mbps. Did not test iperf3 yet.

Before succeed, there was a client disconnection error that vanished. hostapd error head file.
I believe I was missing a reboot, brctl command and bridge=br-lan hostapd config.

@vittorio88, @Mandrake-Lee do you remember at what point the new cfg80211 API implementation was? and do you know if the following is correct:

The hostapd(mtlk-ap) at the benjamin repo, is a modified version of hostapd 2.7, that can accept the wave300 driver. Probably this patch may be applied to the current 2.9 version.

@targa can you first test my compile script? (its built to do everything automatic)

THX

Sorry, I have too many projects running at the same time.

@garlet: I running Ubuntu 18.04 and needed to prepare some things:

  • place a softlink from libncurses.so to libncursesw.so
  • softlink from openwrt git folder to /home/cross/openwrt5
  • install a couple of libs

but apparently some of the required libs my system has installed already, but they're not recognized, seems I need some more preparations.