Commit Graph
100 Commits
Author SHA1 Message Date
Augustin Cavalier dad66ad308 OptionalPackages: Re-add perl. 2024-08-11 00:05:33 -04:00
Augustin Cavalier 39d510f7dd HaikuPorts/x86_gcc2: Synchronize.
Still TODO: libtiff.
2024-08-10 17:35:12 -04:00
Augustin Cavalier 050c34d5d1 Updates in preparation for package sync on gcc2h. 2024-08-10 17:34:55 -04:00
Augustin Cavalier 5a09cea418 FAT: Fix type of volumeCluster.
pcbmap takes a u_long.

Fixes #18958.
2024-08-10 00:53:24 -04:00
Augustin Cavalier 7dea48f378 HaikuPorts/x86_64: Synchronize.
Includes OpenSSL 3.0, Python 3.10, and more.
2024-08-09 22:49:52 -04:00
Augustin Cavalier 101769a583 BuildFeatures: Updates for libtiff >= 6.0. 2024-08-09 22:49:51 -04:00
Augustin Cavalier a79f10b8d1 JPEG2000Translator: Tweaks for usage with the new JasPer version. 2024-08-09 22:49:51 -04:00
Augustin Cavalier 3ecbb34240 IORequest: Correct major oversight in finished callback API.
The IORequest internally likes to deal with transferEndOffset
not transferredBytes because of sub-requests potentially being
prepared all at once (in some paths in the I/O scheduler),
thus fTransferSize can get incremented in Advance() before we have
actually executed that transfer.

But external consumers much prefer just knowing transferredBytes
not transferEndOffset. And many of them actually named their
variables that (or "bytesTransferred") and just passed the
transferEndOffset through to variables with that name! That's
obviously wrong, and it's surprising it wasn't discovered before now.

The problem was uncovered by repeated KDLs in PrecacheIO.
That method used the "bytesTransferred" value as a count of
pages transferred, which would then run past the end of the array
if the transfer start offset was not 0 (which the majority
of the time it would be, since this method gets called on
the first mmap() of a file, probably before any pages are read in.)

Most other consumers of this API did not check the value, it seems,
or otherwise had some mitigating factor that prevented it from
causing more problems. An exception is the page code, which
may have spuriously considered writes as successful when they
really weren't.

May fix some of the "invalid concurrent access to page" KDLs.
2024-08-09 18:04:27 -04:00
Augustin Cavalier 4909eb2091 app_server: Move user-path management more into GlobalFontManager.
The Desktop instance is currently a singleton, and by the time it starts
the GlobalFontManager's initial scan is already running, so if we
register the user paths then it will spend a long time waiting for
the lock. GlobalFontManager didn't even use the provided UID,
so just move the add-user-paths logic into the constructor.

This helps with #18669 on systems that have the default fonts set
and no font settings file. (On systems that do, the global font
manager lock will be acquired in desktop settings initialization.)
2024-08-09 17:10:13 -04:00
Augustin Cavalier 382f18110f DebugAnalyzer: Fix scrollbars in the scheduling view.
It's scroll-view-aware.
2024-08-09 17:09:49 -04:00
Augustin Cavalier 27462aa0c7 virtio_net: Received length includes net_hdr length.
This wasn't noticed until now because the IPv4 module would just
truncate packets to their actual length, but the extra data would
appear in packet captures.
2024-08-08 21:16:13 -04:00
Augustin Cavalier e3e02efb63 device_manager: Only scan busses/scsi in the default case for virtio.
Otherwise we load and unload the SCSI module thousands of times,
which is expensive. It was only added to this section for virtio
in d3b108c53d, so avoid scanning
it here except in that case.

Confirmed that virtio_scsi still works as a boot device.

While at it, remove an unused get_attr.

Change-Id: I0882fcb3465809d6bcdd8ed45e66a4dbfe91f7ac
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7965
Haiku-Format: Haiku-format Bot <[email protected]>
Reviewed-by: waddlesplash <[email protected]>
2024-08-09 00:42:25 +00:00
Augustin Cavalier b134a498f6 kernel/vm: The kernel can transfer any area.
Necessary to get the system profiler to work properly.

Change-Id: Id9c1a0bedaef18680361c5de449d293ff053940c
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7964
Reviewed-by: waddlesplash <[email protected]>
2024-08-09 00:42:25 +00:00
Augustin Cavalier 686e891cd2 system_profiler: Add a mode for scheduling_recorder -r like profile -r.
And add the necessary logic in scheduling_recorder. This way we can
track scheduling profiling during the boot process.

Also remove B_SYSTEM_PROFILER_IO_SCHEDULING_EVENTS as it can't be
activated this early in the boot process.

Change-Id: If32f9b5d61c8cd2b3b36a4e6f8065301abd46149
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7963
Reviewed-by: waddlesplash <[email protected]>
2024-08-09 00:42:25 +00:00
Augustin Cavalier 5ee32555f1 freebsd_network: Use the correct buffer length in receive.
Should fix #18966.

Change-Id: I05e35ecbdc4c269501980c18cedfc69d99618ae6
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7961
Reviewed-by: waddlesplash <[email protected]>
(cherry picked from commit 813c5e2fdee3d506a77a7b265a227ef6f68c4ab8)
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7976
2024-08-08 16:11:52 +00:00
Augustin Cavalier a1d79e238e Versioning: Add BETA_5 and PRE_BETA_6 version constants.
* PRE_BETA_6 is now the default in master.
2024-08-08 10:42:41 -04:00
Augustin Cavalier de1f1b5de5 BColumnListView: Use make_color for GCC2 compatibility. 2024-08-07 23:07:12 -04:00
Augustin Cavalier dbc6b2061e kernel/timer: Reset the hardware timer on every cancellation.
This reverts c5a499a74b
(except for the style fixes in that commit.)

See inline comment. Even after the fix to realtime events,
it seems there are still some lingering bugs causing freezes
on some systems. For now, remove the check again.
2024-08-07 23:03:04 -04:00
Augustin Cavalier efc43c5270 mixer: Add initialization to appease GCC2. 2024-08-07 21:25:52 -04:00
Augustin Cavalier 32bdd3c01d freebsd_network: After freeing the bounce buffer, clear its size.
Otherwise the check just above will succeed incorrectly in cases where
we failed to allocate a buffer (possibly due to the instructions not
to wait.)
2024-08-07 21:04:32 -04:00
Augustin Cavalier 7cb6c1c23f freebsd_network: Correct handling of dmamem allocation flags.
_prepare_bounce_buffer also calls _allocate_dmamem and needs to have
the passed BUS_* flags handled properly, so just move the handling
to _allocate_dmamem directly.
2024-08-07 21:03:16 -04:00
Augustin Cavalier 58137a628d multi_audio: Fix logging print.
The value is really "lateness" not "how_early".
2024-08-07 20:45:13 -04:00
Augustin Cavalier 1513e5484e mixer: Allow stopping the mixer before it's even been started. 2024-08-07 20:44:06 -04:00
Augustin Cavalier 1352dfe46a mixer: Don't stop the mixer in Disconnect().
The logic in the mixer will automatically stop the mix thread but
leave the "Started" flag set in this case.

While at it, clean up that logic.

This suffices to get the mixer to connect and disconnect from
the same output, at least, and have audio output still work.
2024-08-07 20:44:06 -04:00
Augustin Cavalier 424086eeef multi_audio: Tolerate played_real_time less than TimeComputer's RealTime.
See inline comment. As we initialize the TimeComputer with the current
system_time(), if the driver reports the played_real_time of its last
buffer exchange (which, if we're restarting media_server, could be
non-zero), we need to just ignore it.

Fixes assertion failures when using usb_audio. And now that we have
this check in here, we can remove the assert from TimeComputer.

Also add a cast in _GetControlName to appease GCC2 while at it.
2024-08-07 20:44:06 -04:00
Augustin Cavalier 940d017a2f mixer: Just use absolute timeouts rather than "scheduling" runs.
Also refactor the logic to not need goto.

The previous design (from 2016) generated an event and wrote to the
control port to queue it, and then the control thread woke up our
semaphore at the appointed time. Rather than have this inefficency,
just use a timeout to the acquire_sem (which is more similar to the
pre-2016 design.)

This should not affect mixer behavior (as we wait for buffers
inside this logic already), it should only reduce the latency
of actual mixer runs.
2024-08-07 20:44:06 -04:00
Augustin Cavalier a21e32ecc5 mixer: Basic cleanup.
* Remove ERROR differences on DEBUG vs. non-DEBUG.

 * Cleanup checks.
2024-08-07 20:44:06 -04:00
Augustin Cavalier 9d694bc9eb multi_audio: Guard against overreads in _GetControlName.
May fix a crash X512 reported.
2024-08-07 14:52:07 -04:00
Augustin Cavalier fe5fc031dd profile: Report dropped events from the system profiler.
Otherwise there is no indication how many were dropped.
2024-08-07 14:51:38 -04:00
Augustin Cavalier 37201dc1df sdhci_pci: Disable tracing.
Reduces syslog spam. It was already disabled for sdhci_acpi.
2024-08-07 14:50:19 -04:00
Augustin Cavalier bd05c92198 kernel: Check != not < B_INFINITE_TIMEOUT.
As it's INT64_MAX, so anything "larger" is really overflowed into negative.
2024-08-07 14:49:48 -04:00
Augustin Cavalier 4d2ab928c6 OS.h: Define B_INFINITE_TIMEOUT in hexadecimal.
Makes it clearer that this is INT64_MAX at a glance.
No functional change.
2024-08-07 14:49:05 -04:00
Augustin Cavalier 424abd4d57 BClipboard: Don't wait forever for a clipboard download.
Time out after waiting at most for 10 seconds. After 81e50deece,
this should only happen when the registrar succeeds in sending the
message but we fail in receiving it for whatever reason, so really
this is just a guard against infinite hangs.
2024-08-07 14:45:48 -04:00
Augustin Cavalier 7c4915c1e6 ramfs: Also set type and flags in ramfs_get_vnode.
Necessary for proper functioning after the vnodes were purged
and then re-created on the VFS side.
2024-08-07 14:42:49 -04:00
Augustin Cavalier b6d006ca91 kernel/fs: Initialize type/flags before invoking get_vnode.
Otherwise, if the filesystem doesn't set them, we will have garbage
values and act wrongly.

This fixes the second KDL and the underlying cause of #18838:
when the system gets into a low memory state, VFS purges unused vnodes.
But of course RAMFS keeps those nodes around. When the VFS went to
retrieve the nodes for reuse, the flags would sometimes randomly
have the "removed" flag set, and the VFS would then try to delete
the node. But of course it wasn't really removed, so we would hit
an assertion failure in RAMFS.
2024-08-07 14:42:15 -04:00
Augustin Cavalier 00908dbb0f ramfs: Minor code cleanup. 2024-08-07 14:38:27 -04:00
Augustin Cavalier 70f7a613af ramfs: Style cleanup in Node.
No functional change.
2024-08-07 11:45:40 -04:00
Augustin Cavalier 420c9a5a44 ramfs: Use check_access_permissions in Node.
This does check owning groups properly.
2024-08-07 11:45:22 -04:00
Augustin Cavalier 43feec0105 ramfs: Use VM_PRIORITY_USER not VM_PRIORITY_SYSTEM.
This way, allocation failures on ramfs have a chance of
not bringing down the whole system with them.
2024-08-06 18:42:22 -04:00
Augustin Cavalier 81e50deece registrar: Handle clipboard download messages failing to send.
The sender is waiting for a reply, so if the reply fails to send
the target will hang forever. Send back an error in that case.

Should fix hangs of Tracker and Deskbar under low memory conditions
with a very large clipboard.
2024-08-06 18:42:05 -04:00
Augustin Cavalier ab262541db kernel/user_debugger: Check the debugged team ID properly.
If it's B_CURRENT_TEAM we need to fetch the real ID before doing
the check.
2024-08-06 18:14:10 -04:00
Augustin Cavalier c4eef57349 mixer: Fix TRACE in delay starting of the mixer.
Thanks jmairboeck for the review!
2024-08-06 16:41:17 -04:00
Augustin Cavalier 104a4a7cfc packagefs: Improve errors and print a message when failing to add a package node...
... due to conflicts in the node type.

This allows for better diagnosing #18591.
2024-08-06 16:36:12 -04:00
Augustin Cavalier 9c8a78e8ca kernel/timer: Remove another volatile.
Previously missed.
2024-08-06 14:11:20 -04:00
Augustin Cavalier eca25eef72 packagefs: Assert that the directory is locked when adding children. 2024-08-06 14:11:00 -04:00
Augustin Cavalier 39fc954151 packagefs: Ensure the root directory is locked when creating shine-throughs.
Found by the ASSERT added in the following commit.
2024-08-06 14:10:44 -04:00
Augustin Cavalier 8f4ba40520 tcp_shell: Fix following latest changes. 2024-08-05 23:55:20 -04:00
Augustin Cavalier a51aed0242 Zydis: Handle OPERAND_TYPE_REGISTER in ZydisCalcAbsoluteAddressEx.
Fixes "Step over" in Debugger following the switch to Zydis.
2024-08-05 23:50:31 -04:00
Augustin Cavalier 517fca7da7 BTimeSource: Protect against values too large to fit in a float.
This can only happen if the real time or performance time values
specified are very large (more than 24 bits), which should only
happen if the time specified is system_time() and the "last" time
is 0. Under that circumstance, last_drift should be 1.0f,
so we can avoid using it at all. Otherwise, invoke debugger().

This would have caught some (but not all) of the problems fixed
in preceding commits.
2024-08-05 23:33:34 -04:00
Augustin Cavalier eb3126cba7 mixer: Delay starting until we have a valid time source.
BTimeSource::Now() uses the current real time to compute the
performance time, so if the performance time and last real time
are 0 in the time source data, we get a positive value that is
the same as the system time. That means we wind up waiting
a while to start the mixer unnecessarily, often equal to the
current system_time() when the mixer was started.

So, rather than checking the computed Now(), we instead check the
raw performance and real time values from the time source, and
wait for those to be valid before starting.

Also remove a comment about the BeOS R5 multi_audio node. It seems
that ours generates valid time values more quickly, but still starts
off with performance and real times of 0 (which are the default in
the time source anyway.) The new code would still work under such
broken nodes regardless.

This seems to fix sound output taking a long time to start after boot
(or even longer after restarting media services.)
2024-08-05 23:29:20 -04:00
Augustin Cavalier b5142f7645 multi_audio: Add assertion in TimeComputer that realTime didn't go backwards.
Would have caught the problem fixed in the previous commit.
2024-08-05 23:24:06 -04:00
Augustin Cavalier a62032d8d5 multi_audio: Don't add/publish timestamps of 0.
Otherwise they will mess up the time computer and then the published
times, giving huge or miniscule drift values (since the time computer
already has a non-zero real-time by this point, so it will compute
a negative difference if passed 0 for the current real time.)
2024-08-05 23:23:34 -04:00
Augustin Cavalier 30e70f48c1 multi_audio: Disable some unneeded prints. 2024-08-05 23:21:53 -04:00
Augustin Cavalier ddffecccca BTimeSource: Call debugger() if someone tries to Publish a drift of 0.
Would have caught the problems fixed in the last commit.
2024-08-05 16:49:01 -04:00
Augustin Cavalier dc718d1a4e media-add-ons: Do not publish times with drifts of 0.
The "drift" value is the ratio between performance and real time,
so it must never be 0. Specifying it as such would mean that the
consumers of the time source would wind up with wait times that were
extremely large, due to doing a float divide-by-zero.
2024-08-05 16:46:39 -04:00
Augustin Cavalier 8cfa2d5f89 app_server: Fix timeout computation in DelayedMessageSender.
While working on the kernel timer fixes, I noticed some timer events
that had very large, but not quite infinite, timeouts; and this was
one of them.

Should not constitute a behavioral change (since the nearly-infinite
timeouts would never be hit.)
2024-08-05 16:44:09 -04:00
Augustin Cavalier 6d1478af8c kernel/timer: The list does not need to be volatile.
We only access and modify these fields with the spinlock held,
so there's no need for volatile here.
2024-08-05 16:42:00 -04:00
Augustin Cavalier f9f6083f41 kernel/timer: Fix scheduling of absolute-real-time timers.
The logic in add_timer was scheduling the timer using "scheduleTime",
the originally passed value, not "event->schedule_time", which
is adjusted inside add_timer to be relative to the system_time.
This meant that if the event was the first added to the list,
we would set the hardware clock for a very long time in the future
rather than the correct duration.

Since until recently cancel_timer reset the hardware clock every run
even if the cancelled timer wasn't at the head of the list, this
problem was covered up by that one, as usually the scheduler would
cancel a timer relatively frequently, and thus the hardware timer
would usually get set to the correct value relatively frequently.

But after c5a499a74b, this was not
the case anymore as we skip updating the hardware timer if we cancelled
any timer other than the one at the head of the list, exposing this bug.

The fix is simple: don't bother storing a local "scheduleTime" variable
separate from the event->schedule_time. This makes things less confusing
anyway.

Fixes #18967.
2024-08-05 15:42:25 -04:00
Augustin Cavalier 352548d0a3 kernel/thread: Do not rely on B_TIMED_OUT to cancel the unblock timer.
As anything can specify it as an unblock error code, not just the
unblock timer code. Also check < B_INFINITE_TIMEOUT not !=.
2024-08-05 15:36:25 -04:00
Augustin Cavalier 8266f4d7aa HaikuDepot: Shift pkg data fetch into processes
HD currently fetches changelog and user ratings for packages using
a thread from the window. In this change, the fetching of this
data is instead performed using process coordinators in order to
make background processing behaviour consistent and to prep for
future changes.

Change-Id: I7fd0f33c4b9a63fa4b999e2909ce320296db59b9
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7928
Reviewed-by: waddlesplash <[email protected]>
Tested-by: Commit checker robot <[email protected]>
2024-08-05 16:22:15 +00:00
Augustin Cavalier 070b7ca96d TCP: Tolerate zero round-trip time.
TCP times are measured in milliseconds, and so on LAN (or on two
VMs on the same host) we can wind up with round trip times of
less than 1 ms, which thus come out to 0. Tolerate this appropriately
rather than taking 0 to be a magic value meaning "unknown".

Change-Id: Ica827ee4ea353208291cf4348e9da8af6214b507
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7926
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: waddlesplash <[email protected]>
2024-08-05 04:29:58 +00:00
Augustin Cavalier b60ddcdff1 TCP: Implement dynamic receive window sizing.
The basic idea: target a window size large enough to fit one
second's worth of data in it, using the round-trip time to
condition when we make the computations.

If we don't have SACK (to reduce retransmissions on packet loss)
or the user has specified a specific receive buffer size, then don't
scale at all.

Send window scaling isn't implemented yet, as that more-or-less
requires more careful management of congestion windows and SACK
processing which we do not currently implement.

Part of #15886.

Change-Id: Ia2480e6981324d2663e47cb17e8fc47ccc5f9aa0
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6364
Reviewed-by: waddlesplash <[email protected]>
2024-08-05 04:29:58 +00:00
Augustin Cavalier c2f5d5c290 TCP: Only send a window update in ReadData() if there's less than half left.
This is more important when window scaling is enabled as otherwise
we will send large amounts of window-update ACKs needlessly.

Ideally we would just use fReceiveWindow here, but due to a
TODO it stays constant (or increases only) at present, so we
have to compute the window size remainder inline. Another
similar computation elsewhere failed to take the case when
the window is 0 into account, so fix that too while at it.

Change-Id: Ibcca258472940d7de2d1adc9f986ddb7245438be
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7924
Reviewed-by: waddlesplash <[email protected]>
Tested-by: Commit checker robot <[email protected]>
Haiku-Format: Haiku-format Bot <[email protected]>
2024-08-05 04:29:58 +00:00
Augustin Cavalier e028d3f303 ethernet: Disable frame sizes larger than the ethernet maximum.
The network stack (TCP in particular) does not handle path MTU
discovery properly (or at all), so we should avoid trying to
send (or advertise support for) frames that large.

Now that we use net_buffers for receiving and sending directly,
this value really is only the "MTU"; it is entirely possible
to receive frames larger than this successfully. So this should
only fix things and not break anything at present.
2024-08-02 22:31:11 -04:00
Augustin Cavalier 7bdc5201fe ICMP: Remove an unused declaration.
This is already declared elsewhere as ICMP_CODE_FRAGMENTATION_NEEDED
and handled inline appropriately.
2024-08-02 22:28:25 -04:00
Augustin Cavalier 8b414b6da0 freebsd_network: if_mtu is reported only sans ETHER_HDR_LEN.
The CRC is handled within the driver and does not need to be accounted
for here (despite the fact that some of the constants used in MTU
assignment do include it in their computations.)
2024-08-02 22:20:42 -04:00
Augustin Cavalier 1139c01276 ethernet: Assign MTU from constants rather than a magic value.
ETHER_MAX_FRAME_SIZE - ETHER_HEADER_LENGTH is still 1500.
2024-08-02 22:19:47 -04:00
Augustin Cavalier 6cfbbceec3 ramfs: Style fixes to DataContainer.
No functional change.
2024-08-02 22:16:03 -04:00
Augustin Cavalier 3d393797ba ram_disk & ramfs: Use BStackOrHeapArray for the vm_page* arrays. 2024-08-02 22:15:45 -04:00
Augustin Cavalier 838fb559cb ram_disk & ramfs: Allocate cleared pages.
We need to not expose arbitrary previously-used memory contents
to userspace applications, but this also fixes a bug in that
POSIX specified partial pages in mmaped files should be zero-filled,
and without this, RAMFS did not adhere to that.

Should fix https://github.com/haikuports/haikuports/issues/10463
(which was earlier reported as #18903.)
2024-08-02 22:09:10 -04:00
Augustin Cavalier ddfd8f81bc ram_disk & ramfs: Unify the _GetPages/_PutPages code.
Solves a TODO. No functional change intended.
2024-08-02 22:06:07 -04:00
Augustin Cavalier 71c7a4a482 WeakReferenceable: Remove magic value from Get().
"-11" looks like a special magic value, but as the first thing
the loop does is reset it, it's just a dead store. (Debugging leftover?)
2024-08-01 22:51:13 -04:00
Augustin Cavalier d8405312ab TCP: Minor code and comment cleanups.
No functional change.
2024-08-01 22:31:07 -04:00
Augustin Cavalier cb5415fa29 TCP: Print the socket pointer in Dump().
So that it can also be inspected in KDL.
2024-08-01 22:31:07 -04:00
Augustin Cavalier 1981214cd7 TCP: Initiate a send if the new window is larger than 3 default segments.
If the send maximum segment size is very large (as it is on loopback)
and we have receive scaling enabled, we can wind up in situations where
the advertised window will basically always be smaller than the maximum
segment size. In order to avoid stalling until timeouts occur in
this case, check the advertised window against the default segment
size times 3 (which is around the size of ethernet MTU.)
2024-08-01 22:31:07 -04:00
Augustin Cavalier de6a7a3edf TCP: Do not start the TIME_WAIT timer in Free() if we are about to delete.
The TIME_WAIT timer, when it fires, either sets FLAG_DELETE_ON_CLOSE
(if FLAG_CLOSED is not set), or releases the socket reference directly
(if it is set.) As we set FLAG_CLOSED in Free(), we only want to start
the TIME_WAIT timer if FLAG_DELETE_ON_CLOSE is not set yet.

Probably harmless since the timer was cancelled on deletion anyway,
but it doesn't hurt to be clearer here.
2024-08-01 22:31:07 -04:00
Augustin Cavalier cb98c7928c TCP: Send immediate ACKs for every out-of-order packet, plus...
...in-order packets following out-of-order ones.

This more or less undoes 04468d614b.
A closer reading of the specs indicates we should send duplicate ACKs
for every out-of-order packet even when SACK is enabled (and of course
send up-to-date SACK information with each duplicate ACK in that case.)
2024-08-01 22:31:07 -04:00
Augustin Cavalier 0f73d13bda virtio_net: Fix logic inversion in VIRTIO_NET_CTRL_RX.
The onoff value should be set to 1 for "on" and 0 for "off",
based on the FreeBSD code.

Change-Id: I8da7c905bc4af815f51563b6d9696692b29771db
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7919
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: waddlesplash <[email protected]>
Haiku-Format: Haiku-format Bot <[email protected]>
2024-08-01 04:23:26 +00:00
Augustin Cavalier 173fb65a91 virtio_net: Implement receive checksum offloading.
virtio can pass us packets with some of the checksums incomplete.
For now we just pass these to the stack without completing their
checksums; the stack will check only the CHECKSUM_VALID flags.

Tested with QEMU on Linux (IPv4, UDP, TCP, ICMP), seems to work.

Change-Id: Ifc13d931278849b6c4eec550444344e7f1bf53d1
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7918
Reviewed-by: waddlesplash <[email protected]>
Reviewed-by: Jérôme Duval <[email protected]>
Tested-by: Commit checker robot <[email protected]>
2024-08-01 04:23:26 +00:00
Augustin Cavalier 9888c3ce83 TCP: Skip updating round-trip time if it's <= 0.
Taken from https://review.haiku-os.org/c/haiku/+/6364.
2024-07-31 16:20:17 -04:00
Augustin Cavalier 04468d614b TCP: Don't send extra duplicate ACKs with SACK enabled.
If SACK is enabled, then we do not need to send a duplicate ACK
for every out-of-sequence packet, just the first one; following
ones will get delayed-acknowledge'd with SACK information.

Under those conditions, this reduces duplicate ACKs significantly.
2024-07-31 16:19:14 -04:00
Augustin Cavalier e86e0ee4fd TCP: Fix operator precedence in SACK in _PrepareSendSegment().
?: is lower precedence than -.
Spotted by Clang.
2024-07-31 16:17:07 -04:00
Augustin Cavalier 587c5ecdac kernel/fs: Check for missing vnode fields in get_vnode.
And issue a panic if they're unset on KDEBUG kernels.
This would've made the cause of #18838 much more apparent.
2024-07-30 20:57:31 -04:00
Augustin Cavalier 61f7048ea3 RAMFS: Properly set node->ops in ramfs_get_vnode.
Fixes #18838.
2024-07-30 20:54:33 -04:00
Augustin Cavalier ff890d04b3 app_server: Acquire the lock in GlobalFontManager::GetStyle().
On debug builds, the assertion failed on picture playback.
So just use a BAutolock to acquire the lock (again) for
this method.
2024-07-30 20:54:00 -04:00
Augustin Cavalier 4448758b3e app_server & Interface Kit: Rework cursor reference management.
We can't allow applications to reference/unreference cursors,
this is a safety/security violation, and it being done improperly
lead to the reference counts becoming incorrect on the app_server
side.

Change AS_REFERENCE_CURSOR to AS_CLONE_CURSOR and adjust the Cursor
code appropriately. (In the future, copying BCursor without Clone'ing
the data in the case of custom cursors could be accomplished with
client-side reference counting.)

Then rework CursorManager to remove cursors at once on team deletion,
and otherwise clean up cursor reference management to let the
reference counting handle things.
2024-07-30 20:51:53 -04:00
Augustin Cavalier 917dcdfe75 app_server: Fix reference counting for cursors in Desktop class.
We need to acquire our own references to these Cursors.
Fixes assert failures after the addition of more Referenceable asserts,
and may help with #13464 and #18275.
2024-07-30 19:40:58 -04:00
Augustin Cavalier ae302bcf80 launch_daemon: Change permissions of tmp and shared_memory to 0777.
This matches Linux. New files created in these folders will still
have rwxr-xr-x by default, of course, but the directories themselves
should be usable by all users.
2024-07-30 17:04:48 -04:00
Augustin Cavalier 5ab32f699d BReferenceable: Add checks that the reference count is not <= 0.
If it is, that could indicate a use-after-free (0xdeadbeef has the
sign bit set), or at least that something else strange is happening.

May help with catching/diagnosing KDLs in the network stack.
2024-07-30 17:03:30 -04:00
Augustin Cavalier 9addf8749c kernel/slab: Add slab_object KDL command.
This takes an address and tells you what object_cache it's inside.
2024-07-30 16:50:50 -04:00
Augustin Cavalier bdd2bf295f freebsd_network: Implement receive checksum offloading.
The drivers enable it by default, so just pass the flags up
the stack if set.

Part of #18744.
2024-07-30 13:23:05 -04:00
Augustin Cavalier 63ea85a225 virtio_net: Update virtio_net.h from FreeBSD.
No functional change intended.
2024-07-30 13:16:27 -04:00
Augustin Cavalier e49b2154fe ethernet: Get rid of the read/write buffers for scattered I/O.
This (mostly) reverts commit 3ea7c99119.

We no longer need this code after introducing the calls to send
net_buffers to drivers directly.

Change-Id: I31a2fdbbbe8203c53dbcc1e3b1fab2492c8651bd
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7914
Reviewed-by: waddlesplash <[email protected]>
2024-07-30 17:03:36 +00:00
Augustin Cavalier b07cf30aee freebsd_network: Implement the new send/receive ioctls.
It would be nice to reuse the data_nodes as ext_bufs directly
and save another copy. However, we can't do that at the moment,
because while data_nodes and MCLBYTES are the same size (2048),
the data_nodes contain a header structure at the beginning of
that data.

(Perhaps we should consider reworking net_buffer to store data
differently to make that possible. It would also have the advantage
that data_nodes would start on a page boundary or a half-page boundary,
which would make doing direct DMA with them much easier in this
and other drivers as well.)

Change-Id: I8cd3b82a90f328c7a5d2437e3e95413bd74537ae
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7913
Reviewed-by: waddlesplash <[email protected]>
2024-07-30 17:03:36 +00:00
Augustin Cavalier 1485e71d8c ethernet: Make it possible for ethernet drivers to send/receive net_buffers.
This paves the way for a variety of more interesting interactions
between drivers and the stack which are currently not possible
(e.g. checksum offload, #18744). The main advantage for the moment
is that we will save a memcpy of the buffer on each send/receive.

Adapt the virtio_net driver so that at least one driver is using
the new interface. Network still seems to work OK with it.

Change-Id: Ic5832e4865e3e1bed7462583ca1ffd16418d7cab
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7912
Reviewed-by: waddlesplash <[email protected]>
2024-07-30 17:03:36 +00:00
Augustin Cavalier 60e949faf8 fs_shell: Add ASSERT_ALWAYS definition. 2024-07-30 13:02:54 -04:00
Augustin Cavalier be4e927eed FAT: Just use braces in lockmgr_assert.
Otherwise we encounter a different problem under KDEBUG_LEVEL=2.
2024-07-30 13:02:44 -04:00
Augustin Cavalier f99ca9a5a2 FAT: Fix build under KDEBUG_LEVEL < 2.
For now, use ASSERT_ALWAYS in a few places.
2024-07-30 10:56:37 -04:00
Augustin Cavalier a05359e4dd USB: Change some ASSERT to ASSERT_ALWAYS.
Otherwise we get Werrors when trying to build with KDEBUG_LEVEL < 2.
We might as well check these statuses always and panic even on release
builds.
2024-07-30 10:56:10 -04:00
Augustin Cavalier 2a2f213fde network/protocols: Set and check L3/L4_CHECKSUM_VALID flags.
iperf3 TCP on loopback, 1 core (in VMware) goes from ~7.2 Gbits/sec
to ~9.4 Gbits/sec.

Change-Id: I0c93254fab9ee1b5040ef5f71000982bac1a5d15
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7917
Haiku-Format: Haiku-format Bot <[email protected]>
Reviewed-by: waddlesplash <[email protected]>
2024-07-30 14:54:49 +00:00