Commit Graph

63945 Commits

Author SHA1 Message Date
PulkoMandy d5af5c5521 iaxwifi200: disable background scans for now
It crashes the firmware after 40 scans. The issue has been reported to
OpenBSD, until then we can leave this disabled. The consequence is that
the wifi network list will not refresh while already connected to a
network. But at least the connection remains online.
2022-06-09 21:26:47 +02:00
Augustin Cavalier 5797a8dec5 graphics/nvidia: Fix another instance of missing READ/WRITE protection flags.
Related to #17766.
2022-06-09 13:53:49 -04:00
Augustin Cavalier 0bee9ee711 openbsd_wlan: Refactor implementation of IEEE80211_IOC_SCAN_RESULTS.
* Do not allocate an equally-sized buffer for all scan results,
   but just alloca() a buffer for a single result, and copy this
   back to userland at the end of each iteration.

 * Check remaining space correctly with respect to IE data.

May fix incorrect scan results or userland memory corruptions
seen with the previous code. Also should be faster since it
does not need to allocate large kernel-side temporary buffers.
2022-06-09 13:35:48 -04:00
Augustin Cavalier 5a4ad3a00d openbsd_wlan: Print state changes if bootverbose is enabled.
This will make debugging in nightly syslogs a bit easier when things
do not work as expected.
2022-06-09 01:28:56 -04:00
Augustin Cavalier ea7c830790 openbsd_wlan: Implement IEEE80211_IOC_MLME for leaving networks. 2022-06-09 01:28:56 -04:00
Augustin Cavalier 2f7936a683 openbsd_wlan: Add a Haiku-specific "FreeBSD-style" ioctl for joining networks.
In the long run it may make more sense to have Haiku-style ioctls for
this purpose, but since we are currently coexisting with FreeBSD-style
ioctls, just add this as another FreeBSD-style ioctl for now (we already
have two custom ones anyway.)

This ioctl pretty much just consists of the same parameters we pass
to wpa_supplicant using the Haiku-specific constants already, with one
notable difference: the PSK must be in proper WPA format, i.e. already
hashed. Hence we will submit this ioctl, for now, from our own code in
our wpa_supplicant port.

WPS is not implemented in this commit, but it could be if someone actually
needs to connect to WPS networks for some reason...

Tested and verified as working along with the wpa_supplicant changes.
2022-06-09 01:28:56 -04:00
Augustin Cavalier 7cb5a6d24f NetworkDevice.h: Make it possible to include from _KERNEL_MODE and/or non-C++.
This file contains a set of constants and flags which are already passed
between applications, net_server, and wpa_supplicant to indicate network
security, connection modes, and a variety of other things.

As the OpenBSD net80211 stack does not need wpa_supplicant for WPA2/PSK,
it only makes sense that we would pass the same information we pass
to wpa_supplicant into the stack instead. Rather than expose yet another
set of constants and flags to userland besides the FreeBSD and these
Haiku native ones, just make it so this file can be included in the kernel,
and the constants thus used directly.
2022-06-09 01:28:56 -04:00
Augustin Cavalier bcb089f6c3 openbsd_wlan (and FreeBSD ieee80211_ioctl.h): Initial ioctl compatibility.
* Introduce IEEE80211_IOCTLS_ABBREVIATED to FreeBSD's ieee80211_ioctl.h,
   so that the FreeBSD header can be included along with the OpenBSD
   net80211 stack without triggering lots of errors, so we can use
   these structs in openbsd_wlan ieee80211_haiku.cpp.

 * Implement basic ieee80211req handling machinery. We aren't going
   to handle anything but SIOCG80211 and SIOCS80211 in this method,
   so we can simplify it a bit at the same time.

 * Implement IEEE80211_IOC_SCAN_RESULTS to return scan results from
   the OpenBSD WiFi stack in FreeBSD ioctl format.

   This change adds two minor "features" (noted with #ifdefs) to the
   OpenBSD net80211 stack: one to specify what node index to return
   when returning known nodes (scan results), as this way we do not
   have to allocate a huge buffer to store the scan results in before
   sending them back to userland, but can instead get and convert
   a single one at a time.

   (We store the converted values in kernel mode all at once, though,
    so this is not as efficient as it could be. More improvement possible.)

 * Implement IEEE80211_IOC_BSSID and IEEE80211_IOC_SSID while we are at it.
   This actually may make joining open networks possible, but I didn't
   really test it. (They are used with SIOCG80211 to see what network
   the device is currently connecting/connected to.)
2022-06-09 01:28:56 -04:00
Augustin Cavalier fba0315889 idualwifi7260 & iaxwifi200: Adaptations for FreeBSD/Haiku support.
Mostly a few #ifdefs for the dmamem API, if_alloc, probe, and attach hooks.
Basically the same changes in both drivers.

The firmware name map is not really needed anymore; the OpenBSD drivers
have unique firmware names and do not generally use ".ucode" extensions.
So just use the filenames as-is and drop the map.
2022-06-09 01:28:55 -04:00
Augustin Cavalier eb56146603 openbsd_wlan: Basic adaptations to the net80211 layer.
The stack now compiles and links. Combining this with adaptations to
the driver gets things to the point where it runs scans, but we do
not yet implement ioctls so they can be returned to userland.
2022-06-09 01:28:55 -04:00
Augustin Cavalier 27a20680c5 iaxwifi200: Import ("iwx" from OpenBSD.)
Not yet modified to build nor wired into the build yet.
2022-06-09 01:28:55 -04:00
Augustin Cavalier d87dd30a38 idualwifi7260: Delete FreeBSD driver, import OpenBSD driver.
Again not wired into the build, nor yet modified in any way.
2022-06-09 01:28:55 -04:00
Augustin Cavalier 04171cfc5c openbsd_wlan: Import OpenBSD net80211 layer and base dependencies.
Not yet wired into the build, of course.
2022-06-09 01:28:55 -04:00
Augustin Cavalier 668a169a62 OpenBSD-to-FreeBSD/Haiku compatibility headers.
OpenBSD's and FreeBSD's kernel APIs are very similar, but there are
still some differences. Fortunately these are small enough that we
can take care of most of them with a header-only shim layer.

(The files and functions implemented by this commit were implemented
and tested against the modules and drivers imported and adapted in
the following commits. Some of this took quite a bit of time to get
right, especially where the APIs have diverged in very subtle ways.)
2022-06-09 01:28:55 -04:00
Augustin Cavalier 8548a4adc6 freebsd_network: Adaptations in preparation for the OpenBSD layer.
Most of these changes however add things that FreeBSD has (with a few
exceptions noted in comments) which the OpenBSD shim layer merely needs
to make use of.

(FreeBSD used to have support for IFF_NEEDSGIANT but removed it. The
support instated here is very similar to what FreeBSD used to have.)
2022-06-09 01:28:54 -04:00
Jessica Hamilton 6a9406a172 loader/efi: fix handling of serial devices.
Fixes a regression introduced in hrev55297, fixes #17670.

Change-Id: Icc157e093b8fa3f5e0c2a59ab84c81b780933d46
2022-06-09 02:52:09 +00:00
Jim906 f386770953 Tracker: Restore search criteria when edit query
* Have FindPanel::AttachedToWindow check to see if a MIME type is
  already selected, before it sets MIME type to the default value.
* Fixes #14946.

Change-Id: Iab3b9058bbc3ef1f055475ed54a72d4032643632
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5357
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2022-06-08 21:31:01 +00:00
Jim906 c90d79f03a tracker/FindPanel: style cleanup
* No functional change.

Change-Id: I8e5e941fe626a77134036e3828f23ab245d2f5c7
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5358
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2022-06-08 21:30:34 +00:00
Augustin Cavalier 44d08ffc4a freebsd_network: Add another MTU to attempt to set devices to.
IEEE 802.11 has its own maximum MTU which is smaller than PAGESIZE
but larger than the ETHERMTU default. So we now attempt to set this
as well. In doing so, refactor the set into a loop based off an array
of possible MTUs.
2022-06-07 23:50:54 -04:00
Augustin Cavalier d765574fdb freebsd_network: Adjust too-large packet handling in read().
Before ca6a44c133, this function returned
whatever amount of the buffer it could and silently discarded the rest.
After that change and before this one, it would refuse to return anything,
which meant that as soon as we got one packet too large to handle,
we would never receive any more packets (and the errors displayed in
e.g. ifconfig would go up forever.)

Now, we discard too-large packets so RX will not stall completely
and still return E2BIG (so error counts will go up), but we also
print an error to syslog, so that precisely what has gone wrong
will be easily known.
2022-06-07 23:49:17 -04:00
Augustin Cavalier 68f0117d83 freebsd_network: Disable IFMEDIA_DEBUG.
It is not really that useful to print most of this information
by default and it just fills up syslogs unnecessarily.
2022-06-07 23:46:25 -04:00
Augustin Cavalier db1800ca17 graphics/nvidia: Add missing kernel protection flags.
This may be the real cause of #17766.
2022-06-07 23:18:01 -04:00
Augustin Cavalier 1cef8ebf6e freebsd_network: Fix ticks check in callout_reset.
"ticks" is the name of the global variable indicating time since
system start; "_ticks" is the local variable. The confusion between
the two caused every callout to be invoked as soon as it was instantiated.

I am pretty surprised this was not noticed before. I only discovered
it just now while working on the OpenBSD WiFi driver ports. Seems
it has been broken like this for multiple years...
2022-06-07 14:41:15 -04:00
Augustin Cavalier c146183167 devfs: Do not perform synchronous requests in devfs_io.
In some circumstances, we can wind up iterating on requests
by recursing through this function once per "iteration" due to
how vfs_synchronous_io works. This can run out of stack, as
was seen in #9900 and potentially other tickets.

An initial attempt was made to fix the problem in hrev45906,
but it was quickly reverted because it seems to have broken
I/O for all devices that do not support the "IO" hook.

This solution is much simpler: the VFS layer already can handle
vnodes' IO hooks returning B_UNSUPPORTED and then falling back
to synchronous I/O just as if they had no IO hook at all.
This should hopefully cause iteration to occur without recursion.

Tested by booting off a USB drive (the usb_disk driver does not
support the IO hook, so all requests must be translated.)

May fix #9900.
2022-06-07 14:30:21 -04:00
Augustin Cavalier 25742b78fb nforce: Disable MTU changes.
Strange KDLs showed up on at least one system with this driver after
the enabling of jumbo frames, so it seems probable that was the cause.
Disable MTU changes to hopefully prevent this problem for now.

Should hopefully stop #17766.
2022-06-06 13:44:54 -04:00
Andrew Lindesay 8467457050 HaikuDepot: Delayed Increment View Counter
Performs the increment of the view counter
after a delay of three seconds; otherwise
a number of "false views" can be stored as
people use keyboard navigation.

Relates to #16879

Change-Id: I6f3440e1e3132c832cd807e48105022d22df9abf
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5356
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
2022-06-06 07:29:17 +00:00
Jérôme Duval 85344c112c intel_extreme: also set hw_cdclk on Broadwell
this needed for dp aux before skylake, only for DP A (eDP).
should help with #17771

Change-Id: I4bdcca1fdc05294fb5b56c5c96164b6936a5881e
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5355
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2022-06-05 14:29:17 +00:00
Jessica Hamilton e9e00b80c0 cross_tools: allow specifying a custom sysroot path
* Use with --sysroot /path/to/sysroot; useful for CI
  environments and cross-building.

Change-Id: I27a93a5d209cd5324591587e85fce9b47c18172d
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5318
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2022-06-05 09:08:20 +00:00
Jessica Hamilton 8a30322767 libroot: move catopen/catgets/catclose out of libbe 2022-06-04 11:04:40 +12:00
Jessica Hamilton f892047183 kernel.h: don't include user address tests in boot loader 2022-06-04 10:31:05 +12:00
Augustin Cavalier 2823fe54e1 kernel/heap: Check for multiplication overflows in calloc.
Logic inspired by musl's.
2022-06-03 17:18:55 -04:00
Augustin Cavalier eb26002b47 kernel/util: Remove kqueue.h.
It is not used anymore, and we have more advanced queuing facilities now.
2022-06-03 17:18:32 -04:00
Augustin Cavalier 679a91d179 network/stack: Simplify access to msg_iov in socket_send.
As the TODO comment noted, msg_iov has already been copied to the kernel
at this point (it is done in the syscall handler), so we do not need to
use the user memory access functions.

(I verified that the iovecs passed from userland are indeed copied to
the kernel, but I did not find anything that actually posts more than
a single iov, so this is not tested especially thoroughly.)
2022-06-03 17:16:52 -04:00
Augustin Cavalier 8af65cc461 strace: Fix and enable tracing of msghdr structures.
Useful for sendmsg/recvmsg. However at present it only works for recvmsg,
as sendmsg's parameter is const, and this is not automatically matched.
2022-06-03 17:10:31 -04:00
Augustin Cavalier 00f1e7c5e4 kernel: Rework iovec copying from userland.
Create a utility function which performs all necessary checks,
allocates memory, and copies the structures, and then make use of it
in the three places in the kernel which did all this manually.

None of them were previously complete: the fd and socket code only
checked iov_base and not iov_len, while the port code did not check
anything at all.

Part of #14961.
2022-06-03 16:32:11 -04:00
Augustin Cavalier e52da6c73b kernel/fs: Invoke the new is_user_address_range on more I/O buffers.
We do not access these buffers directly here but pass them deeper
into the kernel, where they may be used in IO operations that do
not invoke user_* functions at all, so we have to validate them fully here.

Part of #14961.
2022-06-03 16:15:47 -04:00
Augustin Cavalier 77694f9225 kernel: Move validate_user_memory_range to kernel.h and rename it.
It has more general use than just in the VM code; basically anything
which receives buffers from userland should be invoking this if it
does anything besides user_memcpy (which alreay does it.)
2022-06-03 15:35:17 -04:00
Augustin Cavalier 3e9b842151 freebsd_network: bus_dmamap_load_mbuf_sg is always NOWAIT.
This matches FreeBSD.
2022-06-03 13:57:10 -04:00
Augustin Cavalier 04d2f987a6 freebsd_network: Put extern "C" in front of all public busdma functions.
Should catch the problem the previous commit fixed earlier.
2022-06-03 13:56:38 -04:00
Augustin Cavalier 92d0fd610b freebsd_network: Fix definition of bus_dma_tag_create.
Fixes the build under 32-bit.
2022-06-03 13:55:50 -04:00
Augustin Cavalier 9a6815fbfa freebsd_network: Adjust copyright headers in two files.
These were completely rewritten by me some years ago and contain nothing
from Hugo or Colin anymore.

Change-Id: I07f95b79c08f93b7630f73b6ff60634e3fc95599
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5353
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2022-06-03 17:39:59 +00:00
X512 b69a359e11 freebsd_network: implement missing generic bus access functions.
Change-Id: I9ed7b0f4187d659df798eac1d01c4f0e1f978e73
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5352
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2022-06-03 17:39:59 +00:00
Augustin Cavalier 15253c90c3 freebsd_network: Retry dmamap loads with a bounce buffer in more cases.
Instead of just on ERANGE, also do it for EFBIG and other such errors.

Related to #17763 and #17766.
2022-06-03 13:13:14 -04:00
Augustin Cavalier 4eac62eb9f freebsd_network: Allow destruction of dmamaps with BUFFER_PROHIBITED. 2022-06-03 13:03:42 -04:00
Augustin Cavalier cb7e50e0a3 freebsd_network: Propagate alignment restrictions from parent dma_tags.
FreeBSD does the same.
2022-06-02 22:24:34 -04:00
Augustin Cavalier 654b4f976b freebsd_network: Ensure BUFFER_PROHIBITED status is "sticky."
That is, do not reset it on bus_dmamap_unload.
2022-06-02 21:43:25 -04:00
Augustin Cavalier d66ceb73f8 freebsd_network: Implement bouncing and address validation in bus_dma.
This has been missing since the rewrite in 26b95c15f2.

Until now it seems to not have been a problem since buffer sizes
were generally small enough and did not cross page boundaries due
to alignment guarantees. However, now that we have enabled jumbo
frames by default, some drivers do hit DMA limits without bouncing,
as these frames cross pages.

So, now we implement a basic bouncing system. Unlike FreeBSD which
maintains a global "bounce pages" cache that it pulls from,
we use per-dmamap bounce buffers, lazily allocated only if needed.
I tested this by forcing all non-"prohibited" dmamaps to bounce all
transactions, and the rtl81xx driver still worked that way (though
not all drivers may as they have expectations about contiguously
allocated memory never getting bounced.)

This should fix #17763. Hopefully it will also fix #17766 as well.
2022-06-02 21:08:26 -04:00
Jérôme Duval 6ba3c443a2 atheros813x: apply fix from OpenBSD
* 10fd7e3817
"Force maximum payload size to 128 bytes for AR816X/AR817x as it triggers"
* could help for #16978

Change-Id: I626e364adcabaa9b3d7e4c1078067c1d82c7d4e3
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5340
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2022-06-01 20:11:00 +00:00
milek7 748b488347 ACPI: Make it compile on architectures other than x86.
Change-Id: Ie72dd2c6a571234399dc99d3573a5de19252737e
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5269
Reviewed-by: Fredrik Holmqvist <fredrik.holmqvist@gmail.com>
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
2022-05-31 18:22:22 +00:00
Andrew Lindesay 409af93462 HaikuDepot: Fix Crash on Shutdown
The MainWindow itself was a BReferencable via a listener
virtual class.  It looks like the error has come from a
conflict between the MainWindow's own deletion and the
state of the reference count.  This change moves the
listener / BReferencable out of the MainWindow so that
the lifecycle of the BReferenable can be managed
correctly.

A further problem here is that the new listener
was leaked from the MainWindow class on shutdown.
To resolve this problem requires a considerable
change to the "process coordinator" system.

Fixes #17689

Change-Id: I7230843ba05537015f4a597b4a616b96c6db3dde
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5285
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Andrew Lindesay <apl@lindesay.co.nz>
2022-05-31 06:15:02 +00:00