Kernel: Avoid allocations when handling network packets

This commit is contained in:
Gunnar Beutner 2021-05-15 22:45:22 +02:00 committed by Andreas Kling
parent 53d0150827
commit 006f11f23d
Notes: sideshowbarker 2024-07-18 18:01:33 +09:00
5 changed files with 8 additions and 6 deletions

View file

@ -406,7 +406,7 @@ void NE2000NetworkAdapter::receive()
dbgln_if(NE2000_DEBUG, "NE2000NetworkAdapter: Packet received {} length={}", (packet_ok ? "intact" : "damaged"), header.length);
if (packet_ok) {
auto packet = ByteBuffer::create_uninitialized(sizeof(received_packet_header) + header.length);
auto packet = NetworkByteBuffer::create_uninitialized(sizeof(received_packet_header) + header.length);
int bytes_left = packet.size();
int current_offset = 0;
int ring_offset = header_address;