mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 14:47:44 +00:00
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:
parent
b36a2d6686
commit
416d470d07
10 changed files with 52 additions and 37 deletions
|
@ -67,7 +67,7 @@ public:
|
|||
int send_ipv4(const MACAddress&, const IPv4Address&, IPv4Protocol, const UserOrKernelBuffer& payload, size_t payload_size, u8 ttl);
|
||||
int send_ipv4_fragmented(const MACAddress&, const IPv4Address&, IPv4Protocol, const UserOrKernelBuffer& payload, size_t payload_size, u8 ttl);
|
||||
|
||||
size_t dequeue_packet(u8* buffer, size_t buffer_size);
|
||||
size_t dequeue_packet(u8* buffer, size_t buffer_size, timeval& packet_timestamp);
|
||||
|
||||
bool has_queued_packets() const { return !m_packet_queue.is_empty(); }
|
||||
|
||||
|
@ -93,7 +93,13 @@ private:
|
|||
IPv4Address m_ipv4_address;
|
||||
IPv4Address m_ipv4_netmask;
|
||||
IPv4Address m_ipv4_gateway;
|
||||
SinglyLinkedList<KBuffer> m_packet_queue;
|
||||
|
||||
struct PacketWithTimestamp {
|
||||
KBuffer packet;
|
||||
timeval timestamp;
|
||||
};
|
||||
|
||||
SinglyLinkedList<PacketWithTimestamp> m_packet_queue;
|
||||
SinglyLinkedList<KBuffer> m_unused_packet_buffers;
|
||||
size_t m_unused_packet_buffers_count { 0 };
|
||||
String m_name;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue