summaryrefslogtreecommitdiff
path: root/sys/dev/ic/bwfm.c
AgeCommit message (Collapse)Author
2023-10-09Handle an arbitrary number of D11 cores and only disable them instead ofMark Kettenis
doing a full reset. Based on a diff from Hector Martin for Asahi Linux. ok patrick@, tobhe@
2023-03-28revert bwfm.c rev 1.108Jonathan Gray
as noted by patrick@, the txctl functions already free the buffers
2023-03-26fix memory leaks in error pathsJonathan Gray
ok miod@
2023-03-15make WEP encryption work on bwfm(4)Stefan Sperling
based on an initial diff by jsg@ brokenness pointed out by kn@ ok jsg@
2022-12-30Do not send (normal) packets before we reach the run state. Logic copiedMark Kettenis
from iwm(4), which also looks at the TX_MGMT_ONLY flag. We don't expect that flag to be ever set for bwfm(4), but it shouldn't hurt and it keeps things consistent across drivers. This fixes issues with suspend/resume (including firmware crashes seen on the M2 Macbook Air). ok patrick@, stsp@
2022-06-30Fix bwfm(4) crash during detach on USB.Stefan Sperling
The net80211 stack detach routine can trigger more tasks to be scheduled, e.g. to delete WPA keys. So let's not free the driver's taskq before net80211 has been detached. fixed with and ok by mpi@ Crash reported by mlarkin@ who yanked the USB cable to test our fix.
2022-06-27Fix bwfm(4) ifconfig media display on devices with sta_info command version 3.Stefan Sperling
ok jsg@
2022-04-21Use memset() to initialize struct ieee80211_rxinfo properly.Stefan Sperling
Sven Wolf noticed that scans on ral(4) are buggy ever since I added a new field to this struct. Turns out a lot of drivers were initializing fields one-by-one, leaving any newly added fields uninitialized by default. Affected drivers may report wrong channel numbers for received beacons. The net80211 stack will discard such beacons, assuming they were received on the wrong channel due to signal leakage. Scanning is broken as result. ok miod@
2022-03-20Introduce an alternative mechanism for wifi drivers to communicateStefan Sperling
the channel on which a frame was received. ieee80211_inputm() was expecting that ic->ic_bss->ni_chan would correspond to the channel which is currently being scanned. This dates back to older devices which are manually tuned to the next channel by the driver during SCAN->SCAN state transitions. However, this approach is very awkward for drivers which scan across a whole range of channels in firmware. Such drivers had an ugly workaround in place which tweaked ni_chan for each received frame. Introduce a channel number field in the Rx info struct which drivers can use to indicate the channel on which a frame was received. If this field is set, net80211 will use it instead of using the current channel of ic_bss. Use this new mechanism in all affected drivers. Tested by jmc@, sthen@, and myself on iwm(4) and iwx(4). Changes to iwn(4) and bwfm(4) are the same mechanical changes to get rid of the ni_chan tweak, and are therefore expected to work. ok sthen@ dlg@
2022-03-06Look for firmware for Apple Silicon devices in /etc/firmware/apple-bwfm.Mark Kettenis
ok deraadt@
2022-03-04Add support for the BCM4387. The firmware for this variant uses a new scanMark Kettenis
command, which is indicated by the "scan_ver" firmware variable. ok patrick@
2022-03-02The firmware for the bwfm(4) variants in Apple Silicon Macs has variantsMark Kettenis
for different module types, module vendors and module revisions. Make our driver use the same naming scheme as Asahi Linux. ok patrick@
2022-01-05rename ETHERTYPE_PAE to ETHERTYPE_EAPOL.David Gwynne
everyone else seems to use ETHERTYPE_EAPOL, and as a bonus it also appears to be more correct. ok deraadt@ stsp@
2021-12-27Fix off-by-one in blob download, where in the case that the blob is evenlyPatrick Wildt
divisible by 1400, the last chunk isn't marked with an end flag. ok tobhe@
2021-12-27BCM4387 needs the D11 cores to be held in reset by us, the firmwarePatrick Wildt
will take care of releasing them, as otherwise initialization would fail some of the time. That chip also contains 3 of these, so make sure we reset all of them. Necessary on Apple M1 Pro/Max.
2021-12-27Send TxCap and WiFi calibration blobs to the chip.Patrick Wildt
2021-12-27Handle trailing odd-sized 1024 byte blocks when calculating TCM RAM size.Patrick Wildt
2021-12-26Add information about TCM rambase and how to check the SR capability forPatrick Wildt
a few more chips.
2021-12-22Disable minimum power consumption in hostap mode. This improves connectionTobias Heider
reliability when bwfm is used as an access point. ok patrick@
2021-10-23Make sure we have enough space to add padding and final token to the nvramMark Kettenis
data. Also add the MAC address to the nvram data when there is a "local-mac-address" property in the device tree. This makes bwfm(4) work with the firmware/nvram/clm_blob files provided with MacOS on the Apple M1 Macs. ok patrick@
2021-08-31Implement suspend/resume for bwfm(4) with PCIe backend. We try to send thePatrick Wildt
device into D3 and do a hot-resume if possible. Otherwise we need to clean up the resources to allow complete HW re-initialization to take place.
2021-08-31Clean up the list of chips upon detach and mark us uninitialized.Patrick Wildt
2021-08-19Purge the cached nodes when we switch back to SCAN. In case we lostPatrick Wildt
the connection because an AP is gone away, this makes sure we don't end up picking a now non-existant AP over and over. Another problem this works around is that when trying to re-join that AP, the attempt to connect would not yield any event message from the firmware, and then we would get stuck. Since we now definitely choose a different AP, this issue does not show up. ok stsp@
2021-08-19Consistently use ieee80211_begin_scan() to switch to SCAN.Patrick Wildt
React to deauth/disassoc and link state events if we're already past the SCAN stage. ok stsp@
2021-08-19Fix an off-by-one in bwfm(4) SSID length checks.Stefan Sperling
SSIDs are binary data, not NUL-terminated strings. ok patrick@
2021-08-12One some access points we receive an unsolicited assoc status eventPatrick Wildt
directly after having successfully associated. In that case we should ignore the message, because otherwise we re-scan, re-associate and then get stuck in a loop. Ignoring the unsolicited assoc status even leads to a successful connection. Found by and ok gerhard@
2021-04-22Use the long version of the bwfm(4) firmware path, which includes thePatrick Wildt
board's compatible string, when printing an error about not being able to load the firmware. Since most NVRAM files are board- or package- specific, having the compatible makes it easier for us to find the correct files, so that we can add them to the bwfm-firmware port. ok kurt@
2021-02-26Refactor bwfm(4) firmware loading. The PCIe backend will need to be ablePatrick Wildt
to load the CLM blob like the SDIO backend already does. Additionally it is also helpful for the PCIe backend to try a file named after the device tree compatible. Thus refactor the SDIO code and make it available for both SDIO and PCIe.
2021-02-25Some newer chips have two D11/802.11 cores, and we need to reset both atPatrick Wildt
the same time.
2021-02-24Enumerate GCI core, which seems to contain the OTP on the Apple M1.Patrick Wildt
2021-01-31Add basic support for BCM4378 as found on the Apple M1 SoCs. There's aPatrick Wildt
little bit more to do though before it can be enabled.
2020-12-17bwfm: add a delay in bwfm_set_key_cb before talking to hardwareJoshua Stein
This works around an issue on the BCM43602 where ieee80211 calls this too quickly during authentication and triggers "unexpected pairwise key update" errors. ok patrick
2020-12-02Extract another couple of chunks from main() into helper functions,Kenneth R Westerback
get_routefd() and set_user().
2020-11-16Fix compile error on big-endian machines caused by recent multicast commit.Patrick Wildt
2020-11-16Add multicast support to bwfm(4) to make IPv6 work and to fixPatrick Wildt
promiscuous mode. ok gerhard@
2020-10-22Switch away from splsoftnet() and change the code to splnet().Claudio Jeker
splsoftnet was used for the upper layers of the network stack and should no longer be used. OK patrick@
2020-07-20The IEEE80211_F_HIDENWID flag is now part of ic_userflags, not ic_flags.Stefan Sperling
Fix code which was still looking for this flag at the old location. The 'hidenwid' feature was slightly broken as a result: The SSID was leaked in probe responses to wildcard probe requests. There are other trivial ways of snooping a "hidden" SSID however so this is not a big deal. Problem reported by Mogens Jensen.
2020-07-10Change users of IFQ_SET_MAXLEN() and IFQ_IS_EMPTY() to use the "new" API.Patrick Wildt
ok dlg@ tobhe@
2020-06-19Add support for BCM4359 SDIO variants such as the AP6359SA module foundMark Kettenis
on the RockPro64 WiFi module. Note that there is no fiirmware for this chip in the bwfm-firmware package at the moment. ok patrick@
2020-05-15Some newer bwfm(4) chips from Cypress hold their regulatoryPatrick Wildt
constraints in a separate blob, instead of in the firmware. This .clm_blob needs to be loaded as well.
2020-03-06Process the NVRAM in bwfm(4) itself. So far we have relied on somePatrick Wildt
external tool to pre-process the NVRAM, even though it's simple to do ourselves. This allows easier firmware distribution. ok kurt@
2020-02-25Make bwfm(4) call if_input() only once per interrupt.Patrick Wildt
This reduces drops caused by the ifq pressure drop mechanism and hence increases throughput. ok tobhe@
2020-01-09Convert sleeps of 1sec or more to tsleep_nsec(9).Martin Pieuchot
ok bluhm@
2019-11-09Add support for active scan to bwfm(4). So far we only have donePatrick Wildt
passive scans, which works well enough as long as you don't use hidden networks. Even without hidden networks, using an active scan seems to be quicker and feels like it works better. ok stsp@
2019-10-28Better error handling for bwfm(4) connection attempts. When we failPatrick Wildt
to connect, e.g. due to a timeout, we will switch the state to SCAN. Unfortunately this skips clearing the active channel set, which means that on a scan on all bands only the nodes on the active channel set, which is defined by whatever node we tried to connect to, are allowed and all other APs are ignored. Fix this by properly calling begin_scan(). When we fail to connect and start a scan, make sure to let the chip know that we don't want to associate anymore. Another issue existed when we interrupt a scan, for instance by setting a new nwid or wpakey. In this case we didn't abort the scan and started a new scan while the old one as still active. This could lead to a SCAN -> SCAN transition loop. Remove the "set ssid" event, since this would be an event in addition to a failed auth/assoc event, which would make us try to handle failure twice. Discussed with and ok stsp@
2019-10-09Restore BSS channel only when BSS was not changed in iee80211_input().tobhe
Synced from iwm(4). ok patrick@
2019-08-27Keep ieee80211_node structures cached across scans, rather thanStefan Sperling
wiping the entire cache every time a scan is triggered. This has benefits for userland programs trying to look at scan results, and for drivers which don't get a full view from hardware on every scan. Nodes will still be evicted from the cache in one of several ways: Add a new way of timing out inactive nodes which don't send a beacon within 10 scan iterations, for client mode only. This should get rid of stale APs if we're scanning for some time in a changing environment. If we fail to associate a few times, the corresponding node is removed. If net80211 transitions back to INIT state (e.g. because of a user-initiated configuration change) all nodes are removed. When a background scan starts all nodes will be removed. This could be revisited later but has been intentionally left as-is for now. Tested by myself, jmc@, benno@, procter@ on iwm(4), athn(4) and ral(4).
2019-07-05Since on a SCAN each node is provided in its own event,Patrick Wildt
the limited ring for asynchronous can easily overflow. Work around this by chaining the mbufs into a list. Fixes a panic for jcs@ ok stsp@
2019-05-22Print the bwfm(4)'s ethernet address on attach.Patrick Wildt
2019-05-22If we are SCANning and we want another SCAN, we don't need to purgePatrick Wildt
all nodes and set the link down, this already happened the first time we went to SCAN mode. This brings us in line with the net80211 stack and fixes an incomplete node list during ifconfig(8) scan.