mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-14 13:32:23 +00:00
Kernel/net: Add tracking of dropped packets per adapter
This commit is contained in:
parent
f164e18a55
commit
3d2fcf4244
Notes:
sideshowbarker
2024-07-17 03:03:37 +09:00
Author: https://github.com/menisisaac 🔰
Commit: 3d2fcf4244
Pull-request: https://github.com/SerenityOS/serenity/pull/24262
Reviewed-by: https://github.com/AtkinsSJ
3 changed files with 4 additions and 1 deletions
|
@ -44,6 +44,7 @@ ErrorOr<void> SysFSNetworkAdaptersStats::try_generate(KBufferBuilder& builder)
|
||||||
TRY(obj.add("link_speed"sv, adapter.link_speed()));
|
TRY(obj.add("link_speed"sv, adapter.link_speed()));
|
||||||
TRY(obj.add("link_full_duplex"sv, adapter.link_full_duplex()));
|
TRY(obj.add("link_full_duplex"sv, adapter.link_full_duplex()));
|
||||||
TRY(obj.add("mtu"sv, adapter.mtu()));
|
TRY(obj.add("mtu"sv, adapter.mtu()));
|
||||||
|
TRY(obj.add("packets_dropped"sv, adapter.packets_dropped()));
|
||||||
TRY(obj.finish());
|
TRY(obj.finish());
|
||||||
return {};
|
return {};
|
||||||
}));
|
}));
|
||||||
|
|
|
@ -76,7 +76,7 @@ void NetworkAdapter::did_receive(ReadonlyBytes payload)
|
||||||
m_bytes_in += payload.size();
|
m_bytes_in += payload.size();
|
||||||
|
|
||||||
if (m_packet_queue_size == max_packet_buffers) {
|
if (m_packet_queue_size == max_packet_buffers) {
|
||||||
// FIXME: Keep track of the number of dropped packets
|
m_packets_dropped++;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -90,6 +90,7 @@ public:
|
||||||
u32 bytes_in() const { return m_bytes_in; }
|
u32 bytes_in() const { return m_bytes_in; }
|
||||||
u32 packets_out() const { return m_packets_out; }
|
u32 packets_out() const { return m_packets_out; }
|
||||||
u32 bytes_out() const { return m_bytes_out; }
|
u32 bytes_out() const { return m_bytes_out; }
|
||||||
|
u32 packets_dropped() const { return m_packets_dropped; }
|
||||||
|
|
||||||
RefPtr<PacketWithTimestamp> acquire_packet_buffer(size_t);
|
RefPtr<PacketWithTimestamp> acquire_packet_buffer(size_t);
|
||||||
void release_packet_buffer(PacketWithTimestamp&);
|
void release_packet_buffer(PacketWithTimestamp&);
|
||||||
|
@ -126,6 +127,7 @@ private:
|
||||||
u32 m_packets_out { 0 };
|
u32 m_packets_out { 0 };
|
||||||
u32 m_bytes_out { 0 };
|
u32 m_bytes_out { 0 };
|
||||||
u32 m_mtu { 1500 };
|
u32 m_mtu { 1500 };
|
||||||
|
u32 m_packets_dropped { 0 };
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue