Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"MA_NOTOWNED undefined" and cannot find files after kernel compilation #11

Open
Emrion opened this issue Mar 20, 2019 · 63 comments
Open

Comments

@Emrion
Copy link

Emrion commented Mar 20, 2019

I think they are obvious problems but... I can't make it to work.

The script build_modules seems to need a 13 kernel version not a 12 (it complains about undefined symbols: MA_NOTOWNED and MA_OWNED)... Is it possible to use it with a 12 version?

With a 13 kernel, I follow the instructions (no errors): running ./build_modules, building the kernel and installing it... But I can't find any file .ko or .bin in athp/otus/freebsd/src/sys/modules/athpfw/.

What I did wrong?

@Emrion
Copy link
Author

Emrion commented Mar 22, 2019

I found where lie the compiled files (and it was actually obvious).
Nevertheless, I still get stuck on trying to compile this code on a 12 kernel version.

@Geramy
Copy link
Contributor

Geramy commented Mar 22, 2019

Sorry we havn't gotten back to you, I will review your issue later today and see what I can come up with.

@Emrion
Copy link
Author

Emrion commented Mar 27, 2019

For your information, on a 13-CURRENT, I get a kernel page fault when I load if_athp. It also complains that it cannot load some firmwares; it's very close to what bradleythughes got. I tried master, NEW_ATHP_ARVIF_LOCK (same as master?) and tx_power_change branches. Same results each time.

I have a QCA6174, so I copy only the .ko and .bin from the corresponding folders. Is this ok so?
I saw that it tried to load the 3.0 firmwares.

pciconf -lv:
none3@pci0:1:0:0: class=0x028000 card=0x86cd1043 chip=0x003e168c rev=0x32 hdr=0x00
vendor = 'Qualcomm Atheros'
device = 'QCA6174 802.11ac Wireless Network Adapter'
class = network

@Geramy
Copy link
Contributor

Geramy commented Mar 30, 2019

Is this a Surface Go? I can solve these issues, you need a specific board.bin, board-2.bin and firmware-6.bin.

@Geramy
Copy link
Contributor

Geramy commented Mar 30, 2019

Try these files: https://drive.google.com/file/d/107PePJLBYtp8AhbbDAKTpDERePvMO5x5/view?usp=sharing
Also remove the hw2.0 folder.

@Emrion
Copy link
Author

Emrion commented Mar 30, 2019

Is this a Surface Go? I can solve these issues, you need a specific board.bin, board-2.bin and firmware-6.bin.

No. It's a PC based on Asus H170I-PRO / i3 7100T. My goal is to make use the QCA6174 device by pfSense (build on a 12 FreeBSD version) as host access point. But to be clear, up to now, I only tried to compile athp under pure FreeBSD.

There is only one file in your link (board.bin), shall I place it in /boot/module? Do I have to rename it?

Reading the error generated when it loads if_athp under 13-CURRENT, I see:

  • Try loading athp_cal-pci-athp0.bin but this file doesn't exist.
  • Loads athp_QCA6174_hw3.0_board.bin (no complain).
  • Try to load athp_QCA6174_hw3.0_firmare-5.bin but this file doesn't exist.
  • Try loading athp_QCA6174_hw3.0/athp_QCA6174_hw3.0_firmare-5.bin. This file doen't exist.
  • Loads athp_QCA6174_hw3.0_firmare-4.bin (no complain).

Then, it crashes soon after with a page fault.

But I would like to compile athp under a 12-RELEASE. This is my main concern at the moment.

@Geramy
Copy link
Contributor

Geramy commented Mar 30, 2019

Can you get me a full log please.

@Geramy
Copy link
Contributor

Geramy commented Mar 30, 2019

Did you replace the board file in the athp_QCA6174_hw3.0_board folder when you compiled, or after you compiled? You need to replace the file before you compile so that it compiles the .ko for that board file.

@Emrion
Copy link
Author

Emrion commented Mar 31, 2019

So, I wiped out all my precedent trials to be sure to take the master branch. I copied the file you provided board.bin in athp/otus/freebsd/src/sys/modules/athpfw/athp_QCA6174_hw3.0_board. Then, I compiled athp.
After that, I copied in /boot/modules and /boot/kernel the *.ko and *.bin files from athp/otus/freebsd/src/sys/modules/athpfw/athp_QCA6174_hw3.0_board and athp/otus/freebsd/src/sys/modules/athpfw/athp_QCA6174_hw3.0_firmware-4.
Finally, I typed: kldload if_athp.
The kernel crashes as well but the error isn't the same as before. Now, it's a general protection fault. I can't take all the output in a single picture (sorry for the poor quality, can't do better with my phone). Tell me if something important is missing.

20190331_200509

@erikarn
Copy link
Owner

erikarn commented Mar 31, 2019 via email

@Geramy
Copy link
Contributor

Geramy commented Mar 31, 2019

That stuff below is more important if you can get me an image of the rx ring calls at the bottom I would like that.

@Emrion
Copy link
Author

Emrion commented Mar 31, 2019

I reloaded if_athp but the error changed and returned to "page fault".
I have no file in /var/crash (I set dumpdev="AUTO" in rc.conf) except minfree.
I attach two pictures, hoping they will have the informations you need.

20190331_204927
20190331_205021

@Geramy
Copy link
Contributor

Geramy commented Mar 31, 2019

Do me a favour, Try my branch out. https://github.com/Geramy/athp/tree/NEW_ATHP_ARVIF_LOCK it looks like wmi is using the conf lock. I have removed the conf lock from wmi it will be in master once we confirm it's working 100% I tested it last night and it was working. Let me know if this fixes the issue.

@Emrion
Copy link
Author

Emrion commented Mar 31, 2019

I already tried this branch. But this time, I used your board.bin. Here is what I get:

20190331_204927
20190331_220358

@Geramy
Copy link
Contributor

Geramy commented Mar 31, 2019

As of last night I did new commits, as of when did you try this branch, and have you tried the parent master branch, please make sure your on the latest revision.

@Emrion
Copy link
Author

Emrion commented Mar 31, 2019

I cloned your code just before with: git clone --branch NEW_ATHP_ARVIF_LOCK https://github.com/Geramy/athp

Should I try without adding board.bin?

@Geramy
Copy link
Contributor

Geramy commented Mar 31, 2019

You could give that a shot but I have a feeling that the card isnt finishing one of the startup procedures and we either arnt sleeping on something we need to or something like that. This is a lock issue. I'll have to purchase that card to verify. Can you provide me the cards model and manufacturer? When I get home in 20 minutes I'll try to patch my branch with a fix also I might be able to find it in a few trys with what you sent me.

@Emrion
Copy link
Author

Emrion commented Apr 1, 2019

I tried NEW_ATHP_ARVIF_LOCK without adding build.bin but it crashed with the same error as above.
The wifi module is embedded in the motherboard (Asus H170I-PRO). I believe it is this hardware: https://www.qualcomm.com/products/qca6174a-dual-band-wi-fi

Many thanks for all you do to get it works.

@Geramy
Copy link
Contributor

Geramy commented Apr 4, 2019

Hey were you able to compile this for freebsd 12? I was able to get it to compile with some changes. But there are no iw tools for pfsense.

@Emrion
Copy link
Author

Emrion commented Apr 4, 2019

Alas, no. Always these symbols undefined (they should for they come from sys/mutex.h, IIRC). Do you have a branch compilable under freebsd 12? If not, can you tell me the changes you made? I would like to test it just to be sure that the crash doesn't come from an instable feature in freebsd CURRENT.

Also, I tried to enable the bluetooth module (I disabled it at the base), but no dice again under freebsd 13.

I don't know precisely concerning iw tools but one can set a host AP with pfSense (I thought it used iw). I just lack a suitable interface up to now. :-)

@Emrion
Copy link
Author

Emrion commented Apr 4, 2019

I'm doing something that can interrest you: a debian 9.8 install. It have the driver but it doesn't work because some firmware files are missing. Could it be just that?

Seems, concerning debian, I have to install a package that provide them: firmware-atheros.

debian

@Geramy
Copy link
Contributor

Geramy commented Apr 5, 2019

I have submitted the changes to get it to compile for freebsd 12.0
https://github.com/Geramy/athp/tree/NEW_ATHP_ARVIF_LOCK

@Geramy
Copy link
Contributor

Geramy commented Apr 5, 2019

@Emrion have you compiled pfsense before? if_athp also requires alq.so module just so you know.
I am working on compiling pfsense from source i'm not sure how exactly but i'll get through it.

@Emrion
Copy link
Author

Emrion commented Apr 5, 2019

Concerning FreeBSD 12: the good new is it compiles now like a charm; the bad one is I get the same crash when I load if_athp. Anyway, it generated a core file and here is the result of kgdb / bt:

#0  __curthread () at ./machine/pcpu.h:230
#1  doadump (textdump=<optimized out>) at /usr/src/sys/kern/kern_shutdown.c:366
#2  0xffffffff80b9b14b in kern_reboot (howto=260) at /usr/src/sys/kern/kern_shutdown.c:446
#3  0xffffffff80b9b5c3 in vpanic (fmt=<optimized out>, ap=0xfffffe004e8ea310) at /usr/src/sys/kern/kern_shutdown.c:872
#4  0xffffffff80b9b3b3 in panic (fmt=<unavailable>) at /usr/src/sys/kern/kern_shutdown.c:799
#5  0xffffffff8107496f in trap_fatal (frame=0xfffffe004e8ea500, eva=0) at /usr/src/sys/amd64/amd64/trap.c:929
#6  0xffffffff810749c9 in trap_pfault (frame=0xfffffe004e8ea500, usermode=0) at /usr/src/sys/amd64/amd64/trap.c:765
#7  0xffffffff81073fee in trap (frame=0xfffffe004e8ea500) at /usr/src/sys/amd64/amd64/trap.c:441
#8  <signal handler called>
#9  0xffffffff83376189 in __ath10k_htt_rx_ring_fill_n () from /boot/kernel/if_athp.ko
#10 0xffffffff8337373b in ath10k_htt_rx_ring_fill_n () from /boot/kernel/if_athp.ko
#11 0xffffffff833736c5 in ath10k_htt_rx_ring_refill () from /boot/kernel/if_athp.ko
#12 0xffffffff8333e16c in ath10k_core_start () from /boot/kernel/if_athp.ko
#13 0xffffffff8333f837 in ath10k_core_probe_fw () from /boot/kernel/if_athp.ko
#14 0xffffffff83342c88 in attempt_ath10k_core_probe_fw () from /boot/kernel/if_athp.ko
#15 0xffffffff83340c97 in ath10k_core_register_work () from /boot/kernel/if_athp.ko
#16 0xffffffff80bf9cb4 in taskqueue_run_locked (queue=0xfffff800049bc700) at /usr/src/sys/kern/subr_taskqueue.c:465
#17 0xffffffff80bfae18 in taskqueue_thread_loop (arg=<optimized out>) at /usr/src/sys/kern/subr_taskqueue.c:757
#18 0xffffffff80b5bf33 in fork_exit (callout=0xffffffff80bfad80 <taskqueue_thread_loop>, arg=0xfffffe00003b40f0, 
    frame=0xfffffe004e8ea9c0) at /usr/src/sys/kern/kern_fork.c:1057

I don't know if it'll be of some use.

About pfSense: I never compiled it. I think it isn't easy. However, my first trial would be to load the driver compiled under pure FreeBSD 12 into pfSense (the development version which is based on a 12 FreeBSD).

@Geramy
Copy link
Contributor

Geramy commented Apr 6, 2019

It's the same issue I'll have to think about this more.

@Geramy
Copy link
Contributor

Geramy commented Apr 10, 2019

I think the firmware probe is still failing, I did a checkup on the failure and it looks like it could be because the firmware fails to load. Maybe try another board, can you get the firmware files from the original driver or operating system?

@Geramy
Copy link
Contributor

Geramy commented Apr 10, 2019

Try one of these qca6174 bin files one is a board-1 the smaller one and one is board-2 the bigger file. https://drive.google.com/folderview?id=1jSiXYUCR6TtTdveW4dD7NzF1rwh4jdEo

@Emrion
Copy link
Author

Emrion commented Apr 10, 2019

Thanks but I can't dl them. It asks me a google account... Can you make them public?
Where should I place the file I'm testing? I have to recompile athp?

PS: I somewhat solved my problem by a bhyve VM with debian as guest. It receives the device QCA6174 as passthru and connects it on virtual bridges. But I would prefer a driver that can work under pfSense (upcoming version based on 12.0 FreeBSD).

@Geramy
Copy link
Contributor

Geramy commented Apr 10, 2019

@kiokoman
Copy link

20190513_220416
Screenshot_20190513-220349_Settings

Tnx for your hard work, it's working on my freebsd 12 after following all your directions here, now i need to find a way to port this on pfsense somehow, it's not working if i move the modules on my pfsense box, missing alq and firmware say "image firmware table full", @Geramy were you able to compile the kernel for pfsense?

@kiokoman
Copy link

i don't have any iso, i compiled only the kernel and it's in my google drive, i have installed from original iso that you can download from netgate website and with scp i copied inside my kernel

@Geramy
Copy link
Contributor

Geramy commented May 15, 2019

Are you able to send me the logs to pfsense? syslog and the like?

@kiokoman
Copy link

kiokoman commented May 15, 2019

all the logs are here -> https://drive.google.com/open?id=1fM-Jlmf8BY21kIEGueSxFWmrISZqcDj3
take in mind that i have 2 wifi card ath0 and athp0
with ath0 (AR9485) i can see the interface in the gui to configure the wifi but not with ath0p (QCA988X)

in the meantime i have created a script
/root/hostapd_athp0_wlan0.conf

interface=athp0_wlan0
driver=bsd
logger_syslog=-1
logger_syslog_level=0
dump_file=/tmp/hostapd_athp0_wlan0.dump
ctrl_interface=/var/run/hostapd_wlan0
ctrl_interface_group=wheel
ssid=pfSense-5G
debug=
wpa=2
wpa_key_mgmt=WPA-PSK
wpa_pairwise=CCMP
wpa_group_rekey=3600
wpa_strict_rekey=
wpa_passphrase=yourpasswordhere

after this i created a script inside /usr/local/etc/rc.d/hostapd-5g.sh

#/bin/sh
/usr/local/sbin/hostapd -B -P /var/run/hostapd_athp0_wlan0.pid /root/hostapd_athp0_wlan0.conf

wifi go up and running at startup

@kiokoman
Copy link

i'm going on with my test, i have 144Mbps at 2,4Ghz channel 11 ht40- but if i change mode to 11a channel 161 i have only 54Mbps
ifconfig athp0_wlan0 channel 161:ht40- does not work, no error message and no 40Mhz only 20Mhz width
i have tried other channel inside 5g range but same results

@Geramy
Copy link
Contributor

Geramy commented May 16, 2019

Have you tried channel 40? I operate my stuff at channel 40 and I believe n worked great. Oh it has to be in n mode only too. Also what is the normal statistics of that card?

@kiokoman
Copy link

i found out that it was set as 11a instead of 11na but as soon as i start hostapd it go to 11a again even on channel 40

@erikarn
Copy link
Owner

erikarn commented May 16, 2019

lemme go see if I have some uncommitted regdomain.xml changes to enable it for at least the US. Sorry!

@kiokoman
Copy link

kiokoman commented May 16, 2019

i found that setting channel=48 inside hostapd and start it , it change mode to 11a
if i use ifconfig and remove the channel= from hostapd it work
in short

/usr/local/etc/rc.d/hostapd-5g.sh

#/bin/sh
ifconfig athp0_wlan0 mode 11na
ifconfig athp0_wlan0 channel 48:ht/40-
/usr/local/sbin/hostapd -B -P /var/run/hostapd_athp0_wlan0.pid /root/hostapd_athp0_wlan0.conf

and inside /root/hostapd_athp_wlan0.conf

interface=athp0_wlan0
logger_syslog=-1
logger_syslog_level=0
dump_file=/tmp/hostapd_athp0_wlan0.dump
ctrl_interface=/var/run/hostapd_wlan0
ctrl_interface_group=wheel
ssid=pfSense-5G
beacon_int=100
dtim_period=2
max_num_sta=255
rts_threshold=2347
fragm_threshold=2346
auth_algs=3
wmm_enabled=1
wme_enabled=1
wpa=2
wpa_key_mgmt=WPA-PSK
wpa_pairwise=CCMP
rsn_pairwise=CCMP
wpa_group_rekey=3600
wpa_passphrase=somepassword

the problem was that i had channel=48:ht/40- before inside hostapd conf and starting it resulted in mode changed to 11a without 40 width

now i have a 300Mpbs connection on my phone
Screenshot_20190516-215107_Wi-Fi SweetSpots
20190516_215750

[2.5.0-DEVELOPMENT][root@pfSense.localdomain]/root: ifconfig -v athp0_wlan0
athp0_wlan0: flags=8902<BROADCAST,PROMISC,SIMPLEX,MULTICAST> metric 0 mtu 1500
ether 00:0e:8e:5a:c6:f6
inet6 fe80::20e:8eff:fe5a:c6f6%athp0_wlan0 prefixlen 64 tentative scopeid 0xa
groups: wlan
ssid pfSense-5G channel 48 (5240 MHz 11a) bssid 00:00:00:00:00:00
regdomain FCC country US anywhere -ecm authmode WPA2/802.11i -wps
-tsn privacy MIXED deftxkey 2
AES-CCM 2:128-bit powersavemode OFF powersavesleep 100 txpower 17
txpowmax 50.0 -dotd rtsthreshold 2346 fragthreshold 2346 bmiss 7
11a ucast NONE mgmt 6 Mb/s mcast 6 Mb/s maxretry 6
11b ucast NONE mgmt 1 Mb/s mcast 1 Mb/s maxretry 6
11g ucast NONE mgmt 1 Mb/s mcast 1 Mb/s maxretry 6
turboA ucast NONE mgmt 6 Mb/s mcast 6 Mb/s maxretry 6
turboG ucast NONE mgmt 1 Mb/s mcast 1 Mb/s maxretry 6
sturbo ucast NONE mgmt 6 Mb/s mcast 6 Mb/s maxretry 6
11na ucast NONE mgmt 12 MCS mcast 12 MCS maxretry 6
11ng ucast NONE mgmt 2 MCS mcast 2 MCS maxretry 6
half ucast NONE mgmt 3 Mb/s mcast 3 Mb/s maxretry 6
quarter ucast NONE mgmt 1 Mb/s mcast 1 Mb/s maxretry 6
11acg ucast NONE mgmt 1 Mb/s mcast 1 Mb/s maxretry 6
11ac ucast NONE mgmt 6 Mb/s mcast 6 Mb/s maxretry 6
scanvalid 60 -bgscan bgscanintvl 300 bgscanidle 250
roam:11a rssi 7dBm rate 12 Mb/s
roam:11b rssi 7dBm rate 1 Mb/s
roam:11g rssi 7dBm rate 5 Mb/s
roam:turboA rssi 7dBm rate 12 Mb/s
roam:turboG rssi 7dBm rate 12 Mb/s
roam:sturbo rssi 7dBm rate 12 Mb/s
roam:11na rssi 7dBm MCS 1
roam:11ng rssi 7dBm MCS 1
roam:half rssi 7dBm rate 6 Mb/s
roam:quarter rssi 7dBm rate 3 Mb/s
roam:11acg rssi 7dBm rate 64 Mb/s
roam:11ac rssi 7dBm rate 64 Mb/s
-pureg protmode CTS ht htcompat ampdu ampdulimit 64k ampdudensity 8
amsdu shortgi htprotmode RTSCTS -puren -smps -rifs stbc -ldpctx ldpcrx
vht vht40 vht80 -vht80p80 -vht160 wme -burst -dwds -hidessid apbridge
dtimperiod 1 doth -dfs inact bintval 100
AC_BE cwmin 4 cwmax 6 aifs 3 txopLimit 0 -acm ack
cwmin 4 cwmax 10 aifs 3 txopLimit 0 -acm
AC_BK cwmin 4 cwmax 10 aifs 7 txopLimit 0 -acm ack
cwmin 4 cwmax 10 aifs 7 txopLimit 0 -acm
AC_VI cwmin 3 cwmax 4 aifs 1 txopLimit 94 -acm ack
cwmin 3 cwmax 4 aifs 2 txopLimit 94 -acm
AC_VO cwmin 2 cwmax 3 aifs 1 txopLimit 47 -acm ack
cwmin 2 cwmax 3 aifs 2 txopLimit 47 -acm
media: IEEE 802.11 Wireless Ethernet autoselect mode 11a
status: no carrier
nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>

[2.5.0-DEVELOPMENT][root@pfSense.localdomain]/root: ifconfig athp0_wlan0 list regdomain
:regdomain FCC country US anywhere -ecm
Channel 1 : 2412 MHz 11b Channel 9 : 2452 MHz 11g
Channel 1 : 2412 MHz 11g Channel 9 : 2452 MHz 11g ht/20
Channel 1 : 2412 MHz 11g ht/20 Channel 9 : 2452 MHz 11g ht/40-
Channel 1 : 2412 MHz 11g ht/40+ Channel 10 : 2457 MHz 11b
Channel 2 : 2417 MHz 11b Channel 10 : 2457 MHz 11g
Channel 2 : 2417 MHz 11g Channel 10 : 2457 MHz 11g ht/20
Channel 2 : 2417 MHz 11g ht/20 Channel 10 : 2457 MHz 11g ht/40-
Channel 2 : 2417 MHz 11g ht/40+ Channel 11 : 2462 MHz 11b
Channel 3 : 2422 MHz 11b Channel 11 : 2462 MHz 11g
Channel 3 : 2422 MHz 11g Channel 11 : 2462 MHz 11g ht/20
Channel 3 : 2422 MHz 11g ht/20 Channel 11 : 2462 MHz 11g ht/40-
Channel 3 : 2422 MHz 11g ht/40+ Channel 36 : 5180 MHz 11a
Channel 4 : 2427 MHz 11b Channel 36 : 5180 MHz 11a ht/20
Channel 4 : 2427 MHz 11g Channel 36 : 5180 MHz 11a ht/40+
Channel 4 : 2427 MHz 11g ht/20 Channel 40 : 5200 MHz 11a
Channel 4 : 2427 MHz 11g ht/40+ Channel 40 : 5200 MHz 11a ht/20
Channel 5 : 2432 MHz 11b Channel 40 : 5200 MHz 11a ht/40-
Channel 5 : 2432 MHz 11g Channel 44 : 5220 MHz 11a
Channel 5 : 2432 MHz 11g ht/20 Channel 44 : 5220 MHz 11a ht/20
Channel 5 : 2432 MHz 11g ht/40+ Channel 44 : 5220 MHz 11a ht/40+
Channel 5 : 2432 MHz 11g ht/40- Channel 48 : 5240 MHz 11a
Channel 6 : 2437 MHz 11b Channel 48 : 5240 MHz 11a ht/20
Channel 6 : 2437 MHz 11g Channel 48 : 5240 MHz 11a ht/40-
Channel 6 : 2437 MHz 11g ht/20 Channel 149 : 5745 MHz 11a
Channel 6 : 2437 MHz 11g ht/40+ Channel 149 : 5745 MHz 11a ht/20
Channel 6 : 2437 MHz 11g ht/40- Channel 149 : 5745 MHz 11a ht/40+
Channel 7 : 2442 MHz 11b Channel 153 : 5765 MHz 11a
Channel 7 : 2442 MHz 11g Channel 153 : 5765 MHz 11a ht/20
Channel 7 : 2442 MHz 11g ht/20 Channel 153 : 5765 MHz 11a ht/40-
Channel 7 : 2442 MHz 11g ht/40+ Channel 157 : 5785 MHz 11a
Channel 7 : 2442 MHz 11g ht/40- Channel 157 : 5785 MHz 11a ht/20
Channel 8 : 2447 MHz 11b Channel 157 : 5785 MHz 11a ht/40+
Channel 8 : 2447 MHz 11g Channel 161 : 5805 MHz 11a
Channel 8 : 2447 MHz 11g ht/20 Channel 161 : 5805 MHz 11a ht/20
Channel 8 : 2447 MHz 11g ht/40- Channel 161 : 5805 MHz 11a ht/40-
Channel 9 : 2452 MHz 11b Channel 165 : 5825* MHz 11a

@Geramy
Copy link
Contributor

Geramy commented May 23, 2019

Have you tried selecting a channel that is actually ac?

@stephenw10
Copy link

I'm also testing this. What channel do you suggest? I don't see anything listed that is specifically .11ac.
What should be possible in FreeBSD 12?
Works great in .11n mode though.

@kiokoman
Copy link

kiokoman commented May 25, 2019

i have tried all the channel available from 1 to 165, fcc / etsi of every country ....
i have compiled also hostapd for freebsd with 802.11ac support and i put this on the config when following an howto that i found for linux,

channel=36
ieee80211n=1
ieee80211ac=1
vht_oper_chwidth=1
vht_oper_centr_freq_seg0_idx=42

no error from hostapd but as before it work only as 802.11n

@Geramy
Copy link
Contributor

Geramy commented May 25, 2019

Thank you all for your hard work, I will take a look into this and make any change necessary to get ac working, I will make an implementation and test ticket and please if you could follow up with that ticket in the coming up weeks. I'll submit an update on the ticket once I have it working or once I believe its working.

@k0pernicus
Copy link

Hello everyone!
I had the same issue as @Emrion so I followed your work and I built the bin/ko files for the kernel and modules.

Unfortunately, I had the same crashes than @Emrion, so I tried to download the bin files from your Google Drive @Geramy and... I really don't understand what I am supposed to do with those files :-/

Do I need to rename all of them to match the ko files?
Do I need to remove the previous bin files I built and moved to /boot/modules?
Are all of those files important or only the board ones?

Sorry but I am completely lost here :-(

Thanks in avance for your response!

@nerzhul
Copy link

nerzhul commented Feb 23, 2020

@Geramy

Try one of these qca6174 bin files one is a board-1 the smaller one and one is board-2 the bigger file. https://drive.google.com/folderview?id=1jSiXYUCR6TtTdveW4dD7NzF1rwh4jdEo

What do you mean we need to do ? i face to the same problem, compil is okay but i got the same problem

@marcelbonnet
Copy link

Hi. Can someone point me why it is not compiling with FreeBSD 12 (revision 344331, a little ahead from 12.0.0 RELEASE ) ?

I'm using the branch indicated by @Geramy : https://github.com/Geramy/athp/tree/NEW_ATHP_ARVIF_LOCK

In file included from /usr/home/marcelbonnet/devel/device-drivers/athp-geramy/otus/freebsd/src/sys/modules/athp/../../dev/athp/if_athp_pci.c:80:                                              
/usr/home/marcelbonnet/devel/device-drivers/athp-geramy/otus/freebsd/src/sys/modules/athp/../../dev/athp/if_athp_var.h:73:12: error: use of undeclared identifier 'MA_NOTOWNED'
        if (op == MA_NOTOWNED)                 
                  ^                                                                     
/usr/home/marcelbonnet/devel/device-drivers/athp-geramy/otus/freebsd/src/sys/modules/athp/../../dev/athp/if_athp_var.h:79:12: error: use of undeclared identifier 'MA_OWNED'
            op == MA_OWNED ? "owned" : "not-owned");     
                  ^    
2 errors generated.                                         
*** Error code 1

My hardware and kernel:

$ pciconf -l -v
none6@pci0:2:0:0:       class=0x028000 card=0x03101028 chip=0x003e168c rev=0x32 hdr=0x00
    vendor     = 'Qualcomm Atheros'
    device     = 'QCA6174 802.11ac Wireless Network Adapter'
    class      = network

$  uname -a
FreeBSD machine.STUDIO 12.0-STABLE FreeBSD 12.0-STABLE #2 r344331M: Fri Mar  8 08:36:23 -03 2019     marcelbonnet@machine.STUDIO:/usr/obj/usr/src/amd64.amd64/sys/MACHINE-12  amd64

SVN INFO (FreeBSD sources):
URL: svn://svn.freebsd.org/base/stable/12
Revision: 344331
Last Change:  2019-02-19 15:22:55

@marcelbonnet
Copy link

I found a dirty way to compile.

diff --git a/otus/freebsd/src/sys/dev/athp/if_athp_pci.h b/otus/freebsd/src/sys/dev/athp/if_athp_pci.h
index 0340018..e9a3753 100644
--- a/otus/freebsd/src/sys/dev/athp/if_athp_pci.h
+++ b/otus/freebsd/src/sys/dev/athp/if_athp_pci.h
@@ -19,6 +19,7 @@
 #ifndef	__IF_ATHP_PCI_H__
 #define	__IF_ATHP_PCI_H__
 
+
 #define	ATHP_PCI_PS_LOCK(psc)		mtx_lock(&(psc)->ps_mtx)
 #define	ATHP_PCI_PS_UNLOCK(psc)		mtx_unlock(&(psc)->ps_mtx)
 #define	ATHP_PCI_PS_LOCK_ASSERT(psc)	mtx_assert(&(psc)->ps_mtx, MA_OWNED)
diff --git a/otus/freebsd/src/sys/dev/athp/if_athp_var.h b/otus/freebsd/src/sys/dev/athp/if_athp_var.h
index ef00c51..4ce05b4 100644
--- a/otus/freebsd/src/sys/dev/athp/if_athp_var.h
+++ b/otus/freebsd/src/sys/dev/athp/if_athp_var.h
@@ -37,6 +37,9 @@
 #define	ATHP_RX_LIST_COUNT	2048
 #define	ATHP_TX_LIST_COUNT	1024
 
+#define MA_NOTOWNED 0x00000000
+#define MA_OWNED 0x00000004
+
 /*
  * XXX TODO: key updates with the vap pointer like this is
  * a disaster waiting to happen.  Instead we should modify
diff --git a/otus/freebsd/src/sys/modules/athp/Makefile b/otus/freebsd/src/sys/modules/athp/Makefile
index 6efd722..13fd92e 100644
--- a/otus/freebsd/src/sys/modules/athp/Makefile
+++ b/otus/freebsd/src/sys/modules/athp/Makefile
@@ -5,7 +5,8 @@
 KMOD    = if_athp
 
 # Ok, I'll start using more linux-y things soon.
-CFLAGS+=	-I${SYSDIR}/compat/linuxkpi/common/include/
+CFLAGS+=	-I${SYSDIR}/compat/linuxkpi/common/include/ -w
+#-Wno-error=unused-variable
 
 # Top-level FreeBSD glue (device, netif, busdma, etc)
 SRCS    = if_athp_pci.c if_athp_main.c			\
diff --git a/otus/freebsd/src/sys/modules/build_module b/otus/freebsd/src/sys/modules/build_module
index 54ad88c..bd113ba 100755
--- a/otus/freebsd/src/sys/modules/build_module
+++ b/otus/freebsd/src/sys/modules/build_module
@@ -1,9 +1,9 @@
 #!/bin/sh
 
-X_SRCDIR=${X_SRCDIR:="/home/adrian/work/freebsd/head/src/"}
-X_KERNDIR=${X_KERNDIR:="/home/adrian/work/freebsd/head/obj/usr/home/adrian/work/freebsd/head/src/sys/GERTRUDE/"}
-X_KMODOWN=${X_KMODOWN:="adrian"}
-X_KMODGRP=${X_KMODGRP:="adrian"}
+X_SRCDIR=${X_SRCDIR:="/usr/src"}
+X_KERNDIR=${X_KERNDIR:="/usr/obj/usr/src/amd64.amd64/sys/MACHINE-12"}
+X_KMODOWN=${X_KMODOWN:="marcelbonnet"}
+X_KMODGRP=${X_KMODGRP:="marcelbonnet"}
 
 # This allows for -HEAD includes for net80211 ..
 env CFLAGS="-I../../../sys/" \
@@ -11,7 +11,7 @@ make \
 	MODULES_OVERRIDE="" \
 	DEBUG_FLAGS="-g" \
 	DEBUG_FLAGS="-g" \
-	KMODDIR="/home/adrian/git/github/erikarn/athp/otus/freebsd/modules/" \
+	KMODDIR="/usr/home/marcelbonnet/devel/device-drivers/athp-geramy/otus/freebsd/modules/" \
 	KMODOWN="${X_KMODOWN}" \
 	KMODGRP="${X_KMODGRP}" \
 	MAKESYSPATH="${X_SRCDIR}/share/mk" \

@nupfel
Copy link

nupfel commented Apr 25, 2020

! 20190513_220416
! Screenshot_20190513-220349_Settings

Tnx for your hard work, it's working on my freebsd 12 after following all your directions here, now i need to find a way to port this on pfsense somehow, it's not working if i move the modules on my pfsense box, missing alq and firmware say "image firmware table full", @Geramy were you able to compile the kernel for pfsense?

which combination of board and firmware file worked for you? i have exactly the same issue (crashing in during ring_fill).

@Geramy
Copy link
Contributor

Geramy commented Apr 25, 2020

I was not able to get it to work because the firmware driver isn’t capable of multiple vif commands pfsense won’t be able to use the driver until we add vif

@Geramy
Copy link
Contributor

Geramy commented Apr 25, 2020

I believe I submitted the correct firmware and board files in my repository. We are still working on merging my changes

@nupfel
Copy link

nupfel commented May 2, 2020

Thanks, @Geramy!

I also seem to have the same QCA6174 rev=32 card as @Emrion, however I could not get my card to work even after trying a lot of different board.bin and firmware(4|5).bin file replacements.

I dug deep into the windows 10 and linux drivers for my card and found out the firmware, that the latest ubuntu mate uses is this exact firmware6.bin
however this driver only ever askes for a firmware5.bin and if it doesn't find it tries a firmware4.bin
i have tried about 6 different firmware files in combination with about the same amount of board.bin files extracted from the netathr windows 10 driver (which i later found, were identical to some extractions i made from the board2.bin.
None of the combinations worked, but it seems that as soon as I used a board.bin that seemed to be matching my card I got to the same ath10k_htt_rx_ring_fill_n () error instead of crashing before at probing the fw.

unfortunately the combination of board.bin and firmware4.bin that worked for @Emrion was never mentioned. I would love to help getting this card to work, it seems like this project is so close :)


@nupfel
Copy link

nupfel commented May 7, 2020

@Geramy

I believe I submitted the correct firmware and board files in my repository. We are still working on merging my changes

those definitely don't work for me, and didn't for @kiokoman either if I read the comments correctly.

is there something I can do to help test and debug things in the meantime?

@Geramy
Copy link
Contributor

Geramy commented May 7, 2020

The fault is due to a lock that will never unlock basically, it needs some further work on the mutex inside the rx ring involving the buffers. Have you tried my repository?

@nupfel
Copy link

nupfel commented May 7, 2020

yes, I have actually only tried your repository given that it is a bit ahead of this one. I also read every issue on here multiple times.

@Geramy
Copy link
Contributor

Geramy commented May 7, 2020

Give me some time and I can attempt to fix the issue, I need to purchase a device in Mexico as I am there now, I will need to buy a few AC cards and a device for them to go in to.

@Geramy
Copy link
Contributor

Geramy commented Dec 28, 2021

For anyone who is attached to this thread and can see the messages. I will be working on merging the master of this into my branches and see if I can get it to work. I believe master is a lot more stable and ahead of my branch by a lot.

@fearedbliss
Copy link

fearedbliss commented Jun 17, 2022

Hello. I was also having issues building the kernels modules on FreeBSD 13.1-STABLE #0 stable/13-n251124-026e19496cc using the GENERIC kernel. It was complaining about the MA_OWNED symbol not being found. Doing some searching in the code I found that the definition was in the sys/mutex.h file wrapped in a #ifdef around INVARIANTS / INVARIANT_SUPPORT. After recompiling my kernel, I was able to build the modules/firmware successfully. The problem for me now is that none of the modules load.

(This was when I tried loading if_athp before the other files).

# dmesg
athp0: ath10k_fetch_fw_file: firmware_get: athp_cal-pci-athp0.bin
athp_cal-pci-athp0.bin: could not load firmware image, error 2
athp0: ath10k_fetch_fw_file: firmware_get: athp_QCA6174_hw3.0_board.bin
athp_QCA6174_hw3.0_board.bin: could not load firmware image, error 2
athp0: failed to fetch generic board data: -1
athp0: failed to fetch board file: -1
athp0: could not fetch firmware files (-1)
athp0: could not probe fw, clean up allocations, memory and retry. (-1)

Just loading the firmware directly as stated in the README.

# cd /boot/modules
# kldload -v *.bin
kldload: an error occurred while loading module athp_QCA6174_hw2.1_board.bin. Please check dmesg(8) for more details.
kldload: an error occurred while loading module athp_QCA6174_hw2.1_firmware-5.bin. Please check dmesg(8) for more details.
kldload: an error occurred while loading module athp_QCA6174_hw3.0_board.bin. Please check dmesg(8) for more details.
kldload: an error occurred while loading module athp_QCA6174_hw3.0_firmware-4.bin. Please check dmesg(8) for more details.
kldload: an error occurred while loading module athp_QCA6174_hw3.0_firmware-6.bin. Please check dmesg(8) for more details.

Permissions in /boot/modules

root@leslie:/boot/modules # ls -l
total 15208
-r-xr-xr-x  1 root  wheel  7156616 Jun 16 19:27 amdgpu.ko
-r-xr-xr-x  1 root  wheel     8124 Jun 16 19:35 athp_QCA6174_hw2.1_board.bin
-r-xr-xr-x  1 root  wheel   499232 Jun 16 19:35 athp_QCA6174_hw2.1_firmware-5.bin
-r-xr-xr-x  1 root  wheel     8124 Jun 16 19:33 athp_QCA6174_hw3.0_board.bin
-r-xr-xr-x  1 root  wheel   733784 Jun 16 19:34 athp_QCA6174_hw3.0_firmware-4.bin
-r-xr-xr-x  1 root  wheel   702844 Jun 16 19:34 athp_QCA6174_hw3.0_firmware-6.bin
-r-xr-xr-x  1 root  wheel    53840 Jun 16 19:27 dmabuf.ko
-r-xr-xr-x  1 root  wheel   819912 Jun 16 19:27 drm.ko
-r-xr-xr-x  1 root  wheel  2657416 Jun 16 19:27 i915kms.ko
-r-xr-xr-x  1 root  wheel   144176 Jun 16 19:27 if_wg.ko
-rw-r--r--  1 root  wheel    22844 Jun 16 19:27 linker.hints
-r-xr-xr-x  1 root  wheel    42392 Jun 16 19:27 linuxkpi_gplv2.ko
-r-xr-xr-x  1 root  wheel  2387080 Jun 16 19:27 radeonkms.ko
-r-xr-xr-x  1 root  wheel    14432 Apr  7 15:03 sysctlbyname_improved.ko
-r-xr-xr-x  1 root  wheel    24288 Apr  7 13:15 sysctlinfo.ko
-r-xr-xr-x  1 root  wheel    95016 Jun 16 19:27 ttm.ko

Originally I thought it was a permission issue since the files previously were built having other permissions than 555. Since the other .ko files were 555, I decided to replicate that.. maybe it was just the execute permission I thought. But it still failed. Before I even did this, I was actually (mistakingly) just loading the if_athp file directly and after a few min the computer would always lock up. Luckily I found this comment from 2018.

So now I'm back to trying to load the bin files before loading the if_athp module, as was documented in the README.

For the record, this is my card:

none9@pci0:170:0:0:	class=0x028000 rev=0x32 hdr=0x00 vendor=0x168c device=0x003e subvendor=0x1a56 subdevice=0x1435
    vendor     = 'Qualcomm Atheros'
    device     = 'QCA6174 802.11ac Wireless Network Adapter'
    class      = network

I'm also posting here since this repo is the most active one. The master branch hasn't had an update for over a year.

EDIT:

This might be fine but I also did notice the following:

root@leslie:/boot/modules # file athp_QCA6174_hw3.0_board.bin
athp_QCA6174_hw3.0_board.bin: data

root@leslie:/boot/modules # file ttm.ko
ttm.ko: ELF 64-bit LSB relocatable, x86-64, version 1 (FreeBSD), BuildID[sha1]=9d371956cb5b4beea854a317fca833f5e926a8ae, not stripped

It makes sense since it's a firmware blob and also man kldload mentions that .ko is just a naming convention but it doesn't have to be used (hence .bin). The checksums also match the ones in the repo's athp/otus/freebsd/src/sys/contrib/dev/athp/QCA6174_hw3.0/firmware-4.bin so that should be working as intended.

I've also tried downloading and loading all the bin files for this chip from linux-firmware but they failed as well (Even though it worked when I booted from a Fedora 36 USB).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants