summaryrefslogtreecommitdiff
path: root/sys/dev/ic/qwx.c
AgeCommit message (Collapse)Author
2024-09-01spelling; checked by jmc@, ok miod@ mglocker@ krw@Jonathan Gray
2024-08-19avoid NULL deref if malloc failsJonathan Gray
ok stsp@
2024-08-18plug a memory leak in qwx(4) by freeing vifs when the interface goes downStefan Sperling
2024-08-17enable qwx(4) ext irqs earlier for suspend/resumeStefan Sperling
Enable ext IRQs like the Linux driver does it, not later. I did this differently due to problems in early development that have since been fixed. Fixes an interrupt storm during resume which prevents things like key installation from working, leaving the network link dead.
2024-06-11Make sure qwx(4) always calls refcnt_init() before other refcnt functions.Stefan Sperling
I recently enabled automatic recovery from firmware crashes. if loading firmware at boot would fail with a firmware error then the init task would call refcnt_finalize() via qwx_stop() before refcnt_init() was called and trigger a KASSERT in the refcnt code. ok patrick@, who also reported the problem to me and tested the fix
2024-05-29repair qwx(4) WEP and TKIP via software cryptoStefan Sperling
It is difficult to make WEP and WPA1/TKIP work with hardware crypto. Add a comment which explains why. Ensure that setkey task state is properly cleared when the interface goes down. This issue was found while trying to add WEP keys for hw crypto, but is still worth fixing in general. Also, use m_makespace to append trailing padding for the MIC when hardware crypto is used in combination with "raw" frame mode (not the default), instead of blindly adjusting m_len. ok kevlo@
2024-05-28return type on a dedicated line when declaring functionsJonathan Gray
ok stsp@
2024-05-28Make qwx(4) offload TKIP and CCMP crypto to hardware.Stefan Sperling
This reduces CPU load during interrupts, but more importantly works around an apparent firmware bug where incoming encrypted broadcast and multicast frames are dropped by firmware if the hardware crypto engine is unused. (This problem also affects Linux ath11k upstream.) Offloading CCMP to hardware hence fixes ARP and IPv6 multicast with WPA2. However, there are known issues with WPA1 and WEP: While the WPA1 pairwise handshake succeeds, the TKIP group key handshake fails for unknown reasons, resulting in association failure. WEP is broken because software crypto is skipped entirely when the driver uses the "native wifi" frame mode. This results in all packets being sent in plaintext while WEP is active. In the future, we should be able to fix this by offloading WEP to hardware as well, or by setting the frame mode back to "raw" if WEP is used. If the TKIP/WEP issues affect you badly then take this as an opportunity to upgrade the access point to WPA2/AES where possible. Tested by kettenis, kevlo, and myself. ok kevlo@
2024-05-03Make qwx(4) call into ifmedia more like iwx(4) does it.Stefan Sperling
Fixes weird media: lines in ifconfig which show a mix of 802.11 modes after switching APs, such as: media: IEEE802.11 autoselect mode 11a (OFDM18 mode 11g)
2024-03-09Ensure that qwx(4) clears the OACTIVE flag when Tx rings have space again.Stefan Sperling
Issue found and fix tested by dv@
2024-03-02implement qwx(4) monitor status ring pollingStefan Sperling
On QCNFA765 the monitor status ring does not trigger any interrupts. Unless the driver keeps polling this ring from a timer the device will eventually lock up if this ring is enabled. Even though we're not using this ring yet, add the tiny bits of code required to poll it so that the next person who enables this code won't have to waste time figuring out why the device stops working. The monitor status ring provides details about received frames in special TLV-format packets which the driver can parse and update statistics with. Interesting info includes per-frame RSSI. Which we already learn from beacons, so we don't need to enable an entire extra ring just for that. Another reason to keep this disabled is that it triggers mbuf corruption for reasons I haven't been able to figure out. Help welcome.
2024-03-02silently ignore update-stats events from qwx(4) firmwareStefan Sperling
Reduces noise with QWX_DEBUG enabled.
2024-03-02repair QWX_DEBUG buildStefan Sperling
2024-02-29align qwx_ce_rx error code checking with linux ath11k driverStefan Sperling
This silences warnings about a full Rx ring which the Linux driver is likewise suppressing. They appeared because I used the wrong error code, ENOBUF vs. ENOSPC.
2024-02-29plug a node reference leak in qwx_mgmt_rx_event()Stefan Sperling
This leak is of little consequence in station mode, but would be problematic in hostap mode.
2024-02-24qwx(4): qwx_dp_rx_tid_del_func: fix dp_reo_cache_flush_elem expiration logicScott Soule Cheloha
Tweak a few things in qwx_dp_rx_tid_del_func() to make it behave correctly on OpenBSD: - struct dp_reo_cache_flush_elem: make ts a 64-bit count of nanoseconds Linux uses jiffies to timestamp dp_reo_cache_flush_elem. Although OpenBSD has a global jiffies variable, we shouldn't use it outside of drm(4). I would rather not use our global ticks variable, either. We can use getnsecuptime(9), a low-res 64-bit nanosecond timestamp, as a substitute. - qwx_dp_rx_tid_del_func: replace gettime(9) with getnsecuptime(9) - qwx_dp_rx_tid_del_func: convert DP_REO_DESC_FREE_TIMEOUT_MS to nanoseconds - qwx_dp_rx_tid_del_func: reverse timestamp comparison operator This comparison is backwards. Linux uses the time_after() macro to test whether a given entry has expired, so our ported code needs to test whether the current uptime is greater than or equal to a given entry's expiration time. Joint effort with stsp@. Tested by stsp@. ok stsp@
2024-02-22make qwx(4) ignore ESHUTDOWN while printing errors to dmesgStefan Sperling
ESHUTDOWN is an expected thread-synchronization condition which can be triggered via ifconfig commands. Don't warn about this. Reported by Marco van Hulten on misc@
2024-02-22cache qwx(4) firmware images in memory across suspend/resume cyclesStefan Sperling
testing + ok phessler@
2024-02-22add suspend/resume support to qwx(4)Stefan Sperling
testing + ok phessler@ deraadt@
2024-02-20implement disassociation (RUN->AUTH/INIT) in the qwx(4) driver state machineStefan Sperling
2024-02-20implement qwx_dp_reo_cmd_list_cleanup()Stefan Sperling
2024-02-20fix a double-free in qwx(4) that occurred when removing a peer from firmwareStefan Sperling
It was not yet possible to hit this code path outside of an error path. But upcoming changes would easily trigger this and crash the kernel.
2024-02-16implement qwx_init_task(), which will reset the hardware when it getsPeter Hessler
confused OK stsp@
2024-02-16fix qwx(4) not coming up on first try if firmware was missing from disk at bootStefan Sperling
2024-02-16remove high-level error messages that cause noise when qwx fw is missingStefan Sperling
2024-02-16prevent memory leaks from duplicate/spurious qwx(4) fw memory requestsStefan Sperling
The request_mem_indication event handler would always allocate a new buffer to store the firmware's request, potentially leaking an already existing copy. Ensure that this buffer is always freed, and avoid allocating it in the first place if we're not currently expecting this event to occur. All this would have surfaced the previously fixed bug with the missing wakeup much earlier. The wakeup was always missed but when the driver retried it would find the stale buffer from the previous event and not even enter tsleep.
2024-02-16start moving some developmental printfs to be DEBUG DPRINTFsPeter Hessler
requested and OK by stsp@
2024-02-15fix wrong tsleep waiting address in qwx_qmi_mem_seg_send()Stefan Sperling
Fixes spurious "qwx0: failed to send qmi memory segments: -1" error with associated lag during 'ifconfig qwx0 down up'
2024-02-15make qwx(4) clean up ic_bss and set link down when moving into SCAN stateStefan Sperling
This matches what iwx(4) is doing.
2024-02-15fix datapath Rx buffer management in qwx(4)Stefan Sperling
Fixes Tx/Rx stalls where the device ran out of free Rx buffers to use. The device consumes buffers on the Rx refill ring out of order, which the ring management code I wrote intially would not handle properly. Instead of using an index into the ring where we would expect to see a free slot which was in fact occupied, keep track of free buffers via a bitmap.
2024-02-14make qwx(4) work with custom MAC addresses set via ifconfig(8)Stefan Sperling
ok phessler@
2024-02-09implement qwx_dp_process_rxdma_err()Stefan Sperling
2024-02-09implement qwx_dp_rx_process_wbm_err()Stefan Sperling
2024-02-09implement qwx_dp_process_reo_status()Stefan Sperling
2024-02-09implement qwx_dp_process_rx_err()Stefan Sperling
2024-02-09avoid uninitialised var use if qwx_core_fetch_bdf() errorsJonathan Gray
ok stsp@
2024-02-09make ifconfig display the Tx rate selected by qwx firmwareStefan Sperling
2024-02-09add missing node reference counting to qwx's Tx completion pathStefan Sperling
2024-02-09remove qwx debug prints for management frame events we are already handlingStefan Sperling
2024-02-08repair QWX_DEBUG buildStefan Sperling
2024-02-08implement qwx_dp_tx_process_htt_tx_complete()Stefan Sperling
2024-02-08fix qwx_dp_shadow_start_timer()Stefan Sperling
We must count all Tx attempts in order to avoid the Tx shadow timeout handler resetting Tx ring pointers when it shouldn't.
2024-02-08remove qwx(4) dp_tx debug prints which should not have been committedStefan Sperling
2024-02-08handle qwx(4) firmware roaming eventsStefan Sperling
Gets rid of 'qwx_wmi_tlv_op_rx: unsupported event id 0xb001' in dmesg. However, roaming does not work yet because the driver's newstate handler does not handle resulting state transitions.
2024-02-08mark full qwx(4) Tx queues, such that the OACTIVE mechanism will be usedStefan Sperling
Not quite tested yet. It is very hard to fill the queues at present because Tx operation will freeze when we try. To be investigated next.
2024-02-08fix use of uninitialized variable m in qwx_dp_rx_reap_mon_status_ring()Stefan Sperling
Found by jsg@
2024-02-08fix uninitialized return from qwx_qmi_load_file_target_mem()Stefan Sperling
Fortunately this case could only be reached with an empty firmware file. Found by jsg@
2024-02-08handle fragmented mbuf DMA segments in the qwx(4) Tx pathStefan Sperling
Fixes qwx0: failed to map Tx buffer: 27
2024-02-08set the mbuf length for received data frames in qwx(4)Stefan Sperling
Fixes CCMP decryption errors in the Rx path.
2024-02-06implement basic bpf(4) support for qwx(4)Stefan Sperling
This is sufficient to capture 802.11 frames with tcpdump -y IEEE802_11_RADIO. Meta-data such as RSSI and channel number is not yet recorded.