athp
athp copied to clipboard
Implementation for QCA9377?
Hello, I have a Dell G3 with a QCA9377, and I can't make it work with this driver. As far as I understood, the QCA9377 isn't in the supported models in the core.c, so I added the definitions and the required code to identify, reset and run it (copying the needed definitions from the driver in the Linux kernel).
The diff of my changes in the project and the dmesg from the boot with debug=on is attached.
If you need more information or may send me directions to what I'm missing in the source code let me know.
uname -a
FreeBSD freebsd-g3 12.0-RELEASE-p10 FreeBSD 12.0-RELEASE-p10 GENERIC amd64
Thanks dmesg.txt qca9377_defs.patch.txt
Hi,
I'm pretty sure the QCA9377 requires the new/updated data path too :(
-a
On Tue, 27 Aug 2019 at 06:56, marioolofo [email protected] wrote:
Hello, I have a Dell G3 with a QCA9377, and I can't make it work with this driver. As far as I understood, the QCA9377 isn't in the supported models in the core.c, so I added the definitions and the required code to identify, reset and run it (copying the needed definitions from the driver in the Linux kernel).
The diff of my changes in the project and the dmesg from the boot with debug=on is attached.
If you need more information or may send me directions to what I'm missing in the source code let me know.
uname -a FreeBSD freebsd-g3 12.0-RELEASE-p10 FreeBSD 12.0-RELEASE-p10 GENERIC amd64
Thanks dmesg.txt https://github.com/erikarn/athp/files/3546393/dmesg.txt qca9377_defs.patch.txt https://github.com/erikarn/athp/files/3546467/qca9377_defs.patch.txt
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/erikarn/athp/issues/23?email_source=notifications&email_token=AAI2L3LOKSJ3PUII4UDKVE3QGUXBVA5CNFSM4IQEZZLKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HHVEL4A, or mute the thread https://github.com/notifications/unsubscribe-auth/AAI2L3N7MGZB236JGOJGLBDQGUXBVANCNFSM4IQEZZLA .
Hi @erikarn,
May you give me more hints on what I need to look/change?
When you say it need a new data path, you mean the communication data or the board/firmware data loader?
Thanks
Hi again, With a little more understanding of the internals of the driver, I added the verification for the model of my card in the athp_pci_probe(), and now I can sigfault the kernel after the firmware is uploaded :smile: Will try latter to check if I can solve this, here is the log of the crash:
athp0: <QCA9377> mem 0xa4200000-0xa43fffff irq 18 at device 0.0 on pci3
athp_pci_attach: msicount=8, msixcount=0
athp0: athp_pci_attach: 8 MSI interrupts
athp0: ath10k_pci_alloc_pipes: WARNING: configuring 4k dmamap size for pipe 5; figure out what to do instead
athp0: ath10k_pci_alloc_pipes: WARNING: configuring 4k dmamap size for pipe 6; figure out what to do instead
athp0: athp_pci_attach: chipid: 0x003821ff
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_QCA9377_hw1.0_board.bin
athp0: ath10k_fetch_fw_file: firmware_get: athp_QCA9377_hw1.0_firmware-5.bin
athp0: ath10k_core_init_firmware_features: hardware crypto
athp0: ath10k_download_cal_dt: TODO: device tree check
athp0: ath10k_wmi_event_service_ready_work: TODO: EEPROM code: 0x0000006c
athp0: qca9377 hw1.1 (0x05020001, 0x003821ff) fw WLAN.TF.1.0-00267-1 api 5 htt-ver 3.1 wmi-op 4 htt-op 3 cal o
tp max-sta 32 raw 0 hwcrypto 1 features ignore-otp
athp0: ath10k_core_stop: state=0
athp0: ath10k_wait_for_suspend: state=0
athp0: ath10k_wmi_pdev_suspend_target: called
Fatal trap 12: page fault while in kernel mode
cpuid = 4; apic id = 04
fault virtual address = 0x0
fault code = supervisor write data, page not present
instruction pointer = 0x20:0xffffffff837ae5a8
stack pointer = 0x28:0xfffffe0058872460
frame pointer = 0x28:0xfffffe0058872480
code segment = base 0x0, limit 0xfffff, type 0x1b
= DPL 0, pres 1, long 1, def32 0, gran 1
processor eflags = interrupt enabled, resume, IOPL = 0
current process = 12 (irq271: athp0)
trap number = 12
panic: page fault
cpuid = 4
time = 1566964395
KDB: stack backtrace:
#0 0xffffffff80be7857 at kdb_backtrace+0x67
#1 0xffffffff80b9b433 at vpanic+0x1a3
#2 0xffffffff80b9b283 at panic+0x43
#3 0xffffffff81074bff at trap_fatal+0x35f
#4 0xffffffff81074c59 at trap_pfault+0x49
#5 0xffffffff8107427e at trap+0x29e
#6 0xffffffff8104f5a5 at calltrap+0x8
#7 0xffffffff83785685 at ath10k_wmi_event_debug_mesg+0x55
#8 0xffffffff83779bab at ath10k_wmi_tlv_op_rx+0x4db
#9 0xffffffff83789ec7 at ath10k_wmi_rx+0x97
#10 0xffffffff837886bd at ath10k_wmi_process_rx+0x1d
#11 0xffffffff83778e63 at ath10k_htc_rx_completion_handler+0x753
#12 0xffffffff8376c74c at ath10k_pci_ce_recv_data+0x3ac
#13 0xffffffff8376a7ae at ath10k_ce_per_engine_service+0xce
#14 0xffffffff8375cdf5 at ath10k_pci_ce_tasklet+0xa5
#15 0xffffffff80b5ece7 at ithread_loop+0x1a7
#16 0xffffffff80b5be03 at fork_exit+0x83
#17 0xffffffff8105059e at fork_trampoline+0xe
Hello again, Fixed the crash removing the return in the handling of the wmi_event_debug_msg(), letting it go through the switch and release the buffer in the end of the function. The driver now loads, upload the firmware and I can do commands like
sudo ifconfig wlan0 create wlandev athp0
sudo ifconfig wlan0 up scan
with successful execution, however I can't connect to my access point with wpa and dhcp.
My /etc/rc.conf
wlans_athp0="wlan1"
ifconfig_wlan1="WPA DHCP"
kld_list="athp_QCA9377_hw1.0_board.bin athp_QCA9377_hw1.0_firmware-5.bin if_athp"
After loading the driver and running the command sudo service netif restart
, I got the following messages:
athp0: athp_pci_detach: called
athp0: ath10k_core_unregister: TODO
athp0: ath10k_mac_unregister: called
athp0: athp_detach_net80211: called
athp0: detached
pci3: <network> at device 0.0 (no driver attached)
otus0: otus_cmd_rxeof: received notification code=0xc9 len=0
athp0: <QCA9377> mem 0xa4200000-0xa43fffff irq 18 at device 0.0 on pci3
athp_pci_attach: msicount=8, msixcount=0
athp0: athp_pci_attach: 8 MSI interrupts
athp0: ath10k_pci_alloc_pipes: WARNING: configuring 4k dmamap size for pipe 5; figure out what to do instead
athp0: ath10k_pci_alloc_pipes: WARNING: configuring 4k dmamap size for pipe 6; figure out what to do instead
athp0: athp_pci_attach: chipid: 0x003821ff
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_QCA9377_hw1.0_board.bin
athp0: ath10k_fetch_fw_file: firmware_get: athp_QCA9377_hw1.0_firmware-5.bin
athp0: ath10k_core_init_firmware_features: hardware crypto
athp0: ath10k_download_cal_dt: TODO: device tree check
athp0: ath10k_wmi_event_service_ready_work: TODO: EEPROM code: 0x0000006c
athp0: qca9377 hw1.1 (0x05020001, 0x003821ff) fw WLAN.TF.1.0-00267-1 api 5 htt-ver 3.1 wmi-op 4 htt-op 3 cal otp max-sta 32 raw 0 hwcrypto 1 features ignore-otp
athp0: ath10k_core_stop: state=0
athp0: ath10k_wait_for_suspend: state=0
athp0: ath10k_wmi_pdev_suspend_target: called
athp0: ath10k_pci_irq_sync: TODO
athp0: ath10k_pci_kill_tasklet: called
athp0: ath10k_htt_tx_free: called
athp0: ath10k_htt_tx_free: tearing down htt locks
athp0: ath10k_mac_register: called
athp0: athp_attach_net80211: called
athp_getradiocaps: called; maxchans=1024
athp0: athp_getradiocaps: enabling HT/VHT rates
athp_getradiocaps: done; maxchans=1024, nchans=278
athp0: athp_attach_11n: 1 tx streams, 1 rx streams
athp0: 11a rates: 6Mbps 9Mbps 12Mbps 18Mbps 24Mbps 36Mbps 48Mbps 54Mbps
athp0: 11b rates: 1Mbps 2Mbps 5.5Mbps 11Mbps
athp0: 11g rates: 1Mbps 2Mbps 5.5Mbps 11Mbps 6Mbps 9Mbps 12Mbps 18Mbps 24Mbps 36Mbps 48Mbps 54Mbps
athp0: 1T1R
athp0: 11na MCS 20MHz
athp0: MCS 0-7: 6.5Mbps - 65Mbps
athp0: 11na MCS 20MHz SGI
athp0: MCS 0-7: 7Mbps - 72Mbps
athp0: 11na MCS 40MHz:
athp0: MCS 0-7: 13.5Mbps - 135Mbps
athp0: 11na MCS 40MHz SGI:
athp0: MCS 0-7: 15Mbps - 150Mbps
athp0: 11ng MCS 20MHz
athp0: MCS 0-7: 6.5Mbps - 65Mbps
athp0: 11ng MCS 20MHz SGI
athp0: MCS 0-7: 7Mbps - 72Mbps
athp0: 11ng MCS 40MHz:
athp0: MCS 0-7: 13.5Mbps - 135Mbps
athp0: 11ng MCS 40MHz SGI:
athp0: MCS 0-7: 15Mbps - 150Mbps
athp0: [VHT] Channel Widths: 20MHz, 40MHz, 80MHz
athp0: [VHT] Features: 339011b2<MPDU11454,RXLDPC,SHORTGI80,RXSTBC1,RXSTBC2,BFEECAP>
athp0: [VHT] NSS 1: TX MCS 0..9, RX MCS 0..9
in6_purgeaddr: err=65, destination address delete failed
lo0: link state changed to DOWN
wlan0: link state changed to DOWN
athp0: ath10k_start: called; state=0
athp0: ath10k_start: state=1
athp0: ath10k_download_cal_dt: TODO: device tree check
athp0: ath10k_wmi_event_service_ready_work: TODO: EEPROM code: 0x0000006c
athp0: ath10k_regd_update: TODO: finish setup/chanlist!
athp0: ath10k_start: finished; state is now 1
athp0: athp_update_slot: TODO; need to update!
athp0: athp_node_alloc: called; mac=00:0x:xx:xx:xx:xx
wlan1: Ethernet address: 00:05:16:61:81:69
athp_getradiocaps: called; maxchans=1536
athp0: athp_getradiocaps: enabling HT/VHT rates
athp_getradiocaps: done; maxchans=1536, nchans=278
athp0: athp_set_regdomain: called; rd 16 cc 840 location
athp0: athp_set_regdomain: nchans=72
athp0: ath10k_regd_update: TODO: finish setup/chanlist!
athp0: athp_update_slot: TODO; need to update!
wlan0: Ethernet address: 00:25:86:f0:42:46
athp_getradiocaps: called; maxchans=1
athp0: athp_getradiocaps: enabling HT/VHT rates
athp_getradiocaps: done; maxchans=1, nchans=1
lo0: link state changed to UP
athp0: athp_parent: called; nrunning=1
athp0: athp_vap_newstate: INIT -> SCAN (is_setup=0) (is_dying=0)
athp0: athp_vap_newstate: adding interface
athp0: ath10k_add_interface: called
athp0: ath10k_add_interface: TODO: initialise vap supported bitrates?
athp0: athp_vap_newstate: interface add done: vdev id=1
athp0: athp_vap_newstate: pausing/flushing queues
athp0: failed to flush transmit queue (skip 0 ar-state 1): 0
athp0: ath10k_hw_scan: TODO: add scan request from net80211!
athp0: ath10k_wmi_event_scan_started: TODO: ready_on_channel
I guess I'm close to make it work right?
Hello @marioolofo .
Any news on your progress ? I'm in the same boat and I'd love to be able to use wifi on my laptop ;p
Hi @OnigamiSama,
I switch back to Linux because I had problems with both filesystems in FreeBSD, I think my SSD is not fully supported, causing some weird corruptions. As I use my notebook to work and I'm working a lot, I didn't had time to create another installation on a secondary drive to finish the wifi driver, but I was able to start, scan and join an access point, but was unable to keep connected. As soon as I have time I'll try to port again but using the most recent version of the driver from Linux, most of the implementation is different from the actual reference in this port.
@marioolofo thank you for taking the time to answer me!
Hey everyone, please if you can get me a link on eBay to the cards you are using I will purchase then and start working on this next weekend sorry I have been MIA, work has been crazy over here.
Where can I find the latest code on getting this to work? I'm getting a new laptop, and it seems the card in it is a QCA9377. I'd like to hack around and try to get things working. I see the original patch from @marioolofo, but it seems some progress was made after that.
@amshafer what model laptop has that card if you dont mind me asking. @marioolofo freebsd should be no different on any ssd its all the same standard protocols.
@Geramy Acer aspire A114-32-P7E5. My progress so far is here: https://github.com/amshafer/athp
I've got it loading and connecting, it fails to scan.
@amshafer how long did it take you to compile ath10k and freebsd?
I followed (I think your) instructions on how to build. It took an hour or so one night to bring in @marioolofo's patch and get it compiling. Another hour of updating the pci ids and attempting to fix a hash function.
If you mean the time to literally compile, just a couple minutes for ath10k. I already have current built.
that's what I was referring that and FreeBSD
Well I've narrowed things down a little bit. The latest is in master at https://github.com/amshafer/athp.
The odd thing is that I don't see any scan events being generated, even though I can see in the logs that stuff is being received. I expect there to be something like the following as ath10k_wmi_tlv_op_rx
is called to handle new events:
# expected scan event output. I think 0x3001 should be WMI_TLV_SCAN_EVENTID
athp0: ath10k_wmi_tlv_op_rx: event; id=0x3001
In reality I don't see this, it only receives a diagnostic event. I've tried bumping the timeouts to give it a chance, but that doesn't help.
I also tried rebasing on top of @Geramy's latest branch, the results of which are in my "experimental" branch. This didn't help either, I was hoping it would get rid of some of the lock warnings.
I have a few high level questions, that hopefully someone will be able to advise me on:
- Am I correct in expecting WMI_TLV_SCAN_EVENTID to be generated?
- What's the best way to debug why events are/are not generated?
- There are multiple firmware-5 versions in the ath10k firmware repo. I load modules for the board-2 and firmware-6 fw, but neither of them are loaded? Any descriptions of the difference between all of these.
- If the command sending/copy engine/pci/high level bits are all working, why is the scan command not generating anything?
Here's part of dmesg with all debug options on. It starts about when ath10k_hw_scan is called: https://pastebin.com/m7X21dZB
Thanks! Maybe my progress will be helpful to someone else and hopefully one of you can give me a push in the right direction.
I would recommend everyone stick with this main repository and experiment with any others Adrian right now is working on the locks I’ve isolated as issues and merging in some of my changes him and I work together quite a bit
I just bought a laptop to use to develop, build and test on
Hi!
The 9377 needs a lot more work in the driver. IIRC it needs a bunch more driver changes; including some new tlv ops and maybe the replacement TX credit stuff that showed up a few years ago.
Let's land this code with the AR9880, QCA6174 and Cascade (AR9888?) first and get it stable. Then yeah, I'll help y'all tackle the new tx credit stuff needed for besra, IPQ4019 ARM+wifi and this thing.
Great to hear y'all are working on wifi again! Just let us know when you start looking at 9377 and I'm happy to test/help however I can.
Just out of curiosity, what resources are you using to understand all this stuff? For example I don't know how to find out that new tlv ops were added. Just the linux history or are there datasheets? I couldn't find much online but maybe I'm not looking in the right place.
Thanks for all the work on this!
@amshafer it would help to have a 9377 chip. Would you be able to obtain one and ship it? I could provide the money for it. But I am in Mexico right now so it's very hard to obtain anything fast.
Hello guys, sorry for my hiatus in reply, I'm working so much (working right now btw) and really didn't had time to check this again. After I tried to make the driver work, I found that ZFS didn't install correctly on my SSD, so my whole system was corrupted because some block size params that was missing on 12.0. Could make it work only a little time ago. I'm afraid to say that I lost the code that I was changing, so unfortunatelly what left from my changes was the patch added to this thread. In this time I started to read the FreeBSD Device Drivers and The Design and Implementation of FreeBSD books, and now I'm able to understand better what I was doing. If you guys need any help, let me know and I'll try to do my best.
Any progress?
Progress?