mirror of
https://github.com/RGBCube/serenity
synced 2025-05-17 16:15:08 +00:00
Kernel: Add a NetworkTask and a received network packet queue.
It will be easier to deal with incoming packets in a separate task.
This commit is contained in:
parent
47b096feb4
commit
35098cbde1
10 changed files with 90 additions and 11 deletions
|
@ -21,3 +21,17 @@ void NetworkAdapter::send(const MACAddress& destination, const ARPPacket& packet
|
|||
send_raw((byte*)eth, size_in_bytes);
|
||||
kfree(eth);
|
||||
}
|
||||
|
||||
void NetworkAdapter::did_receive(const byte* data, int length)
|
||||
{
|
||||
InterruptDisabler disabler;
|
||||
m_packet_queue.append(ByteBuffer::copy(data, length));
|
||||
}
|
||||
|
||||
ByteBuffer NetworkAdapter::dequeue_packet()
|
||||
{
|
||||
InterruptDisabler disabler;
|
||||
if (m_packet_queue.is_empty())
|
||||
return { };
|
||||
return m_packet_queue.take_first();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue