summaryrefslogtreecommitdiffstats
path: root/sys/dev/ic/bwfm.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Add basic support for BCM4378 as found on the Apple M1 SoCs. There's apatrick2021-01-311-1/+6
| | | | little bit more to do though before it can be enabled.
* bwfm: add a delay in bwfm_set_key_cb before talking to hardwarejcs2020-12-171-1/+3
| | | | | | | | 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
* Extract another couple of chunks from main() into helper functions,krw2020-12-021-2/+14
| | | | get_routefd() and set_user().
* Fix compile error on big-endian machines caused by recent multicast commit.patrick2020-11-161-2/+2
|
* Add multicast support to bwfm(4) to make IPv6 work and to fixpatrick2020-11-161-6/+52
| | | | | | promiscuous mode. ok gerhard@
* Switch away from splsoftnet() and change the code to splnet().claudio2020-10-221-7/+7
| | | | | | splsoftnet was used for the upper layers of the network stack and should no longer be used. OK patrick@
* The IEEE80211_F_HIDENWID flag is now part of ic_userflags, not ic_flags.stsp2020-07-201-2/+2
| | | | | | | | | | 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.
* Change users of IFQ_SET_MAXLEN() and IFQ_IS_EMPTY() to use the "new" API.patrick2020-07-101-2/+2
| | | | ok dlg@ tobhe@
* Add support for BCM4359 SDIO variants such as the AP6359SA module foundkettenis2020-06-191-2/+7
| | | | | | | | | on the RockPro64 WiFi module. Note that there is no fiirmware for this chip in the bwfm-firmware package at the moment. ok patrick@
* Some newer bwfm(4) chips from Cypress hold their regulatorypatrick2020-05-151-1/+48
| | | | | constraints in a separate blob, instead of in the firmware. This .clm_blob needs to be loaded as well.
* Process the NVRAM in bwfm(4) itself. So far we have relied on somepatrick2020-03-061-1/+50
| | | | | | | external tool to pre-process the NVRAM, even though it's simple to do ourselves. This allows easier firmware distribution. ok kurt@
* Make bwfm(4) call if_input() only once per interrupt.patrick2020-02-251-11/+8
| | | | | | | This reduces drops caused by the ifq pressure drop mechanism and hence increases throughput. ok tobhe@
* Convert sleeps of 1sec or more to tsleep_nsec(9).mpi2020-01-091-2/+2
| | | | ok bluhm@
* Add support for active scan to bwfm(4). So far we only have donepatrick2019-11-091-9/+26
| | | | | | | | 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@
* Better error handling for bwfm(4) connection attempts. When we failpatrick2019-10-281-11/+53
| | | | | | | | | | | | | | | | | | | | | | 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@
* Restore BSS channel only when BSS was not changed in iee80211_input().tobhe2019-10-091-9/+14
| | | | | | Synced from iwm(4). ok patrick@
* Keep ieee80211_node structures cached across scans, rather thanstsp2019-08-271-2/+2
| | | | | | | | | | | | | | | | | | | | | | | 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).
* Since on a SCAN each node is provided in its own event,patrick2019-07-051-8/+19
| | | | | | | | 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@
* Print the bwfm(4)'s ethernet address on attach.patrick2019-05-221-1/+3
|
* If we are SCANning and we want another SCAN, we don't need to purgepatrick2019-05-221-1/+6
| | | | | | 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.
* Follow up on jmatthew's suggestion:kevlo2019-04-251-2/+2
| | | | | | | in x_media_change(), return the errno from ieee80211_media_change() and do the error check from x_init(). ok stsp@, jmatthew@, phessler@
* Correctly extract the RSSI information from the structure. It'spatrick2019-04-011-2/+2
| | | | | | | | a 16-bit value, so we have to use letoh16() instead of letoh32(). Also properly cast it to signed, so that it can be sign-extended properly. ok stsp@
* Make ifconfig(8) display whether bwfm(4) firmware is using 802.11ac.stsp2019-02-191-27/+51
| | | | ok patrick@ mpi@
* Consistently use m_freem(9). This fixes possible leaks in a fewpatrick2019-02-071-4/+4
| | | | error cases.
* There's a task ring for executing commands in a sleep-safe context.patrick2019-02-071-1/+2
| | | | | | This task is used to deliver mbufs (for events, not data), but it's possible that the queue overruns. In that case it does leak mbufs. For now, assert the size to see if we hit the issue.
* Make bwfm(4) query firmware for RSSI levels and current transmit rate whenstsp2019-01-301-1/+137
| | | | | ifconfig asks for such information. ok patrick@
* On authentication we don't need to create the node before callingpatrick2018-07-251-14/+2
| | | | | | | | the network stack since the stack will create the node for us if we pass the ibss stack. On assocation request the node already has to exist, so we error out if we don't have a record of the node. Fixes hostap on 5 GHz channels, since now the node's channel is recorded correctly.
* TX packets, which can be either Ethernet or control packets, must bepatrick2018-07-171-4/+2
| | | | | | | | | sent in order. Otherwise it is possible that the key is set before we send out the EAPOL packet, or that packets are sent out before the key is set. Thus modify the SDIO backend to put both types into the same internal TX queue, which will be sent asynchronously. Discussed with bluhm@
* Add support for the BCM43455 SDIO chip to bwfm(4).patrick2018-07-161-1/+2
|
* Re-set the pointer to the bwfm event after the strict alignmentpatrick2018-07-161-2/+3
| | | | check.
* Move mbuf alignment for strict aligned architectures from the BCDCpatrick2018-07-061-19/+15
| | | | | specific receive path into the generic receive path, since PCIe supplied packets can be misaligned as well.
* Move allocation behind sanity check to address possible memory leak aspatrick2018-07-041-4/+4
| | | | | | | | seen by Coverity CID 1470240. Cast the ieee80211_frame struct pointer to uint8_t to address concerns raised by Coverity CID 1470239 and CID 1470237. ok stsp@
* Only react to deauthentication/disassociation and link changes if we arepatrick2018-05-231-4/+7
| | | | | not in INIT state. Otherwise we can have bogus state changes on ifconfig down. Also don't try to end a scan if we were not scanning.
* Select correct channel in Host AP mode. One part of that is creatingpatrick2018-05-231-2/+65
| | | | | | | | | | | the channel specification (channel, freq, bandwidth, control channel) which is parsed and understood by the bwfm(4) firmware. Another part is that we shouldn't start a scan if the channel is selected by the user, otherwise we override the chosen channel. The remaining part is bringing the device down properly. If it's not disabled properly, we cannot bring it up again. ok stsp@
* Implement a separate initialization stage so that we can still usepatrick2018-05-231-35/+77
| | | | | | | and initialize bwfm(4) later in the case that the firmware was not available on bootup and was only later installed. ok stsp@
* Recent Broadcom chipsets have a dedicated PMU core and it can't bepatrick2018-05-171-2/+5
| | | | accessed using the Chipcommon core anymore.
* Implement a BCDC control packet mechanism based on the command requestpatrick2018-05-161-61/+102
| | | | | | | | | ids. So far we were only able to have one command in flight at a time and race conditions could easily lead to unexpected behaviour, especia- lly combined with a slow bus and timeouts. With this rework we send or enqueue a control packet command and wait for replies to happen. Thus we can have multiple control packets in flight and a reply with the correct id will wake us up.
* Some drivers handle settting a new wifi link state manually, so make surephessler2018-04-281-1/+3
| | | | | | | they flush old nodes and set the interface link state to down, like the framework does. OK stsp@ pirofti@
* net80211: stub SIOCS80211SCAN, make ifconfig scan instant.pirofti2018-04-261-4/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The following removes the functionality of the SIOCS80211SCAN ioctl. After long discussions with stps@, mpi@, and deraadt@ we decided that this was the correct way of fixing ifconfig scan from blocking the network stack. The kernel will continue scanning in the background and filling the nodes array, but ifconfig scan commands will now basically do just a SIOCG80211ALLNODES and pretty print the array. So the output stays the same but is instant. In fact, when the interface is freshly brought up, if you type fast enough, you can see the array being filled by running multiple ifconfig scans in sequence. The SIOCS80211SCAN ioctl stays for now as wi(4), pgt(4) and malo(4) still need it around. But not for long... Another change that this introduces is the fact that ifconfig scan no longer plays with UP and DOWN. If the interface is down it complains and exits. This is needed in order to maintain the nodes list. Works on iwm(4), iwn(4), urtwn(4), run(4) and athn(4). Tested by mpi@, landry@, florian@, thanks! OK mpi@.
* Copy the scan results into a new buffer to re-align the data so that wepatrick2018-02-111-3/+15
| | | | don't fault on strict alignment architectures.
* Since the BCDC header has a variable data offset, so the ethernet packetpatrick2018-02-111-1/+20
| | | | | alignment can be variable, it's better to move taking care of alignment into the BCDC receive code.
* Move bwfm(4) from ifq begin/commit/rollback semantics to the newerpatrick2018-02-081-15/+10
| | | | | | | | | | | | | | | ifq dequeue semantics. This basically means we need to check for available space before dequeuing a packet. As soon as we dequeue a packet we commit to it. On the PCIe backend this check can not be done easily since the flowring depends on the packet contents and we cannot take a peek. When there is no flowring we cache the mbuf and send it out as soon as the flowring opened up. Then the ifq can be restarted and traffic can flow. Typically we usually run out of packet ids, which can be checked without consulting the packet. The flowring probably never becomes full as the bwfm(4) firmware takes the packets off the ring without actually sending them out. Discussed with dlg@
* Move parsing the BCDC header on RX into a protocol specific RXpatrick2018-02-071-1/+21
| | | | function so it can be shared with the SDIO attachment driver.
* Add helper to find out if the chip supports Save/Restore. Will be usedpatrick2018-02-071-1/+44
| | | | in the SDIO bus glue.
* Add support for chips which use SYSMEM memory. Code is a simplifiedpatrick2018-02-061-2/+26
| | | | version of the SOCRAM one.
* Support setting the Cortex-M3 cores to active mode.patrick2018-02-061-2/+13
|
* Move event packet handling into a serialized process context to removepatrick2018-02-051-27/+35
| | | | | | | | | | | | | a state transitioning race condition. Event packets, like completing authentication and the following association completion, are usually received shortly after another. The code that handles those events is scheduled using a task, so it can easily happen that the state change caused by the authentication packet was not done before the following association event arrived. By moving the event packet handling into the same context as the state task we serialize the processing and remove the race condition. Fixes connecting to the 5GHz WiFi AP used at a2k18. ok stsp@
* Some wifi drivers don't call ieee80211_newstate() during some statestsp2018-01-311-8/+12
| | | | | | transitions, which means those state transition won't be shown in dmesg in interface debug mode. Make drivers print these transitions themselves. ok patrick@
* Put the default case, which prints information about an event we do not yetpatrick2018-01-241-4/+4
| | | | | | | handle, into a debug printf. Also do not print a pointer to kernel buffers so that we don't leak kernel addresses. Spotted by and ok stsp@
* We don't do booleans in the kernel, so replace a few occurrences of 'true'patrick2018-01-241-4/+4
| | | | | | with nicer integer equivalents. Spotted by and ok stsp@