summaryrefslogtreecommitdiff
path: root/sys
AgeCommit message (Collapse)Author
2022-03-22For raw IP packets rip_input() traverses the loop of all PCBs. FromAlexander Bluhm
there it calls sbappendaddr() while holding the raw table mutex. This ends in sorwakeup() where we finally grab the kernel lock while holding a mutex. Witness detects this misuse. Use the same solution as for PCB notify. Collect the affected PCBs in a temporary list. The list is protected by exclusive net lock. syzbot+ebe3f03a472fecf5e42e@syzkaller.appspotmail.com OK claudio@
2022-03-22Fix whitespace.Alexander Bluhm
2022-03-22Nuke increasingly pointless comment. Shorten a line andKenneth R Westerback
compare pointer to NULL instead of 0. No functional change.
2022-03-22Copy the FDT into a larger buffer such that we have space to add additionalMark Kettenis
nodes and properties to it like we do on arm64 and armv7. ok patrick@
2022-03-22After copying the FDT into a new larger buffer, adjust the FDT size toMark Kettenis
reflect the size of the new buffer like we do on arm64. ok patrick@
2022-03-22Make sure kernel longjmp always returns 1 rather than what turns out to beMiod Vallat
in a register at call-time. with & ok jsg@
2022-03-22Fix wrong comment in sendsig(), and remove unused dumpframe()Miod Vallat
ok jsg@
2022-03-22Do not bother initializing a0 with a special value in setregs, that's aMiod Vallat
FreeBSDism we have no need for. ok jsg@
2022-03-22Change VM_MIN_ADDRESS to PAGE_SIZE to forbid mapping anything at virtualMiod Vallat
address zero, as done on all other platforms. ok deraadt@ kettenis@
2022-03-22Do not pretend there exist MD code for byte swapping yet provide copiesMiod Vallat
of the MI fallback code; ok deraadt@ jsg@
2022-03-21For multicast and broadcast packets udp_input() traverses the loopAlexander Bluhm
of all UDP PCBs. From there it calls udp_sbappend() while holding the UDP table mutex. This ends in sorwakeup() where we finally grab the kernel lock while holding a mutex. Witness detects this misuse. Use the same solution as for PCB notify. Collect the affected PCBs in a temporary list. The list is protected by exclusive net lock. Reported-by: syzbot+7596cb96fb9f3c9d6f4f@syzkaller.appspotmail.com OK sashan@
2022-03-21Reduce dmesg spam by nor printing the "Apple" firmware name.Mark Kettenis
ok patrick@
2022-03-21Fix whitespace. Wrap long lines. Adjust outdated comment.Alexander Bluhm
2022-03-21Constify struct {audio,midi,radio,video}_hw_if. No functional change.Miod Vallat
ok mpi@ ratchov@ "More const is good" deraadt@
2022-03-21Update hw.power whenever we refresh the AC state. This makes sure the stateMark Kettenis
doesn't get out of sync with what apm(8) reports if power is plugged or unplugged when a machine is suspended. Which in turn makes sure the machine properly goes into a low CPU P-state when requested. ok deraadt@, florian@
2022-03-21Whitespace tweaks.Kenneth R Westerback
2022-03-21Add support for XBox One gamecontroller, including report descriptor.Thomas Frohwein
Based on previous XBox 360 controller code and NetBSD's implementation. Tested by me and solene@. Input by solene@ and stsp@. ok stsp@ phessler@ ok solene@ for an earlier version.
2022-03-21Header netinet/in_pcb.h includes sys/mutex.h now. Recommit mutexAlexander Bluhm
for PCB tables. It does not break userland build anymore. pf_socket_lookup() calls in_pcbhashlookup() in the PCB layer. To run pf in parallel, make parts of the stack MP safe. Protect the list and hashes in the PCB tables with a mutex. Note that the protocol notify functions may call pf via tcp_output(). As the pf lock is a sleeping rw_lock, we must not hold a mutex. To solve this for now, collect these PCBs in inp_notify list and protect it with exclusive netlock. OK sashan@
2022-03-21Remove unused files which serve no purpose in OpenBSD; with and ok jsg@Miod Vallat
(works better with `cvs rm' prior to commit...)
2022-03-21Remove data dependency barrier from atomic_load_* functionsVisa Hankala
This makes the atomic_load_* functions relaxed in terms of memory ordering. Now it should be acceptable to use these functions in assertions. The need of the data dependency barrier is conditioned to usage. The barrier is unnecessary for the control decisions that cond_wait() and refcnt_finalize() make. READ_ONCE() and SMR_PTR_GET() use the barrier so that loaded pointers would work as excepted in lock-free contexts (some Alpha CPUs have a data cache design that can cause unusual load-load reordering if not synchronized properly). OK bluhm@
2022-03-21call in_pcbselsrc from rip_output so route sourceaddr can take effect.David Gwynne
previously things that used sendto or similar with raw sockets would ignore any configured sourceaddr. this made it inconsistent with other traffic, which in turn makes things confusing to debug if you're using ping or traceroute (which use raw sockets) to figure out what's happening to other packets. the ipv6 equiv already does this too. ok sthen@ claudio@
2022-03-21treat 255.255.255.255 like an mcast address in in_pcbselsrc.David Gwynne
this allows the IP_MULTICAST_IF sockopt to specify which address you want to send a limited broadcast (255.255.255.255) packet out of. requested by and ok claudio@
2022-03-21No point in calling scsi_link_shutdown() if link->pool is NULL.Kenneth R Westerback
Ditto config_detach() if link->device_softc is NULL. Currently just some extra paranoia, but will allow simplification of exit logic in scsi_probe_link() and other future uses of scsi_detach_link() on partially configured links. No intentional functional change.
2022-03-20Include sys/mutex.h from netinet/in_pcb.h. Struct mutex will beAlexander Bluhm
needed to make inpcb in kernel MP safe. To build sysctl and libkvm based programs, we have to export it to userland. OK claudio@
2022-03-20Always check if softraid0 is NULL before dereferencing it.Kenneth R Westerback
Avoids panic on reboot when softraid has been disabled. Discovered by, diagnosed, first diff from & fix tested by Scott Nicholas. ok bluhm@
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-20Don't announce VHT caps on 2GHz channels during iwm(4) and iwx(4) scans.Stefan Sperling
VHT capabilities were written into the "common" secion of the firmware probe request frame template. This section is used on 2GHz and 5GHz bands. Announcing VHT capabilities on 2GHz makes no sense. Move them into the 5GHz-only section. ok sthen@
2022-03-20Make background scans pick up APs on 2GHz channels while in 11ac mode.Stefan Sperling
found by landry@
2022-03-20Enable interrupt moderation, targeting around 20k interrupts per second.Jonathan Matthew
There are separate timers for rx and tx interrupts, so we can use longer timeouts for tx since that doesn't affect packet processing latency. ok dlg@
2022-03-19Fix wrongly implemented check for 5GHz access point RSSI threshold.Stefan Sperling
This check was wrong for drivers which report RSSI as a percentage, such as iwm(4) and iwx(4). Such drivers will now prefer 5GHz with 50% or greater RSSI, as was intended. ok phessler@
2022-03-19Give 11n and 11ac networks a higher score during SSID selection.Stefan Sperling
ok phessler@
2022-03-19Fix wrong logic in a check in iwm_vht_single_rate_control() to matchStefan Sperling
what was intended. ok phessler@
2022-03-19Fix attach of multiple iwm(4) or iwx(4) interfaces in the same machine.Stefan Sperling
ok kettenis@, jca@
2022-03-19Do not define RA_DEBUG; pointed out by miod@Stefan Sperling
2022-03-19Add initial 802.11ac support to the iwm(4) driver.Stefan Sperling
VHT MCS and 80MHz channels can now be used. Other 11ac features such as larger aggregates are left for later work. Tested: 3160: stsp 7260: florian, jmatthew 7265: rfreeman, mlarkin, landry, Peter J. Philip 8260: bket 8265: jturner, Marcus MERIGHI, stsp 9260: florian, matthieu, stsp 9650: kmos, sthen ok sthen@
2022-03-19Add 11ac/VHT Tx rate adaptation support to net80211.Stefan Sperling
Based on our existing RA module for 11n. The main difference is in dealing with 11ac-specific ratesets. Tx rate selection heuristics remain identical. Only supports 80MHz channels, for now. 160MHz is left for future work. ok sthen@
2022-03-18Cleanup reference counting. Remove #ifdef DIAGNOSTIC to keep theAlexander Bluhm
code similar in non DIAGNOSTIC case. Rename refcnt variable to refs for consistency with r_refs. Add KASSERT() in refcnt_finalize(). OK visa@
2022-03-18Use the refcnt API with struct plimit.Visa Hankala
OK bluhm@ dlg@
2022-03-18regenMiod Vallat
2022-03-18Add bwfm chips to sdmmcdevs in order to get symbolic constants for them.Miod Vallat
ok jsg
2022-03-18Don't bother generating (unused) CIS overrides.Miod Vallat
ok jsg
2022-03-18spellingJonathan Gray
2022-03-17Drop two variable names from function prototypes.Theo Buehler
From Martin Vahlensieck
2022-03-17fix typos; Martin VahlensieckStuart Henderson
2022-03-17Declare dtps_static array const to move it into read-only section.Alexander Bluhm
OK mpi@
2022-03-17Use the refcnt API with struct ucred.Visa Hankala
OK bluhm@
2022-03-17Use the refcnt API in bpf.Visa Hankala
OK sashan@ bluhm@
2022-03-17In swap_io() allocate the buffer before doing encryption.Martin Pieuchot
If the allocation fails due to memory pressure no time is wasted doing encryption. This also simplify the error path. Tested by sthen@. ok kn@, miod@, kettenis@, tb@
2022-03-17Fix previous commit; the FDT header is big-endian so we need to do theMark Kettenis
appropriate byte swapping.
2022-03-16When we allocate space a buffer with some extra space for the FDT, adjustMark Kettenis
the size of the FDT to reflect the size of that buffer. This prevents an FDT overflow if the original FDT doesn't have enough space for the additional properties that we add to it in our bootloader. Fixes boot on the mcbin. tested by bluhm@, ok patrick@