Kernel: Plumb packet receive timestamp from NetworkAdapter to Socket::recvfrom

Since the receiving socket isn't yet known at packet receive time,
keep timestamps for all packets.

This is useful for keeping statistics about in-kernel queue latencies
in the future, and it can be used to implement SO_TIMESTAMP.
This commit is contained in:
Nico Weber 2020-09-16 12:25:06 -04:00 committed by Andreas Kling
commit 416d470d07
Notes: sideshowbarker 2024-07-19 02:21:53 +09:00
10 changed files with 52 additions and 37 deletions

View file

@ -298,7 +298,7 @@ DoubleBuffer& LocalSocket::send_buffer_for(FileDescription& description)
ASSERT_NOT_REACHED();
}
KResultOr<size_t> LocalSocket::recvfrom(FileDescription& description, UserOrKernelBuffer& buffer, size_t buffer_size, int, Userspace<sockaddr*>, Userspace<socklen_t*>)
KResultOr<size_t> LocalSocket::recvfrom(FileDescription& description, UserOrKernelBuffer& buffer, size_t buffer_size, int, Userspace<sockaddr*>, Userspace<socklen_t*>, timeval&)
{
auto& buffer_for_me = receive_buffer_for(description);
if (!description.is_blocking()) {