diff options
author | Conrad Pankoff <deoxxa@fknsrs.biz> | 2019-08-22 01:06:55 +1000 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2019-08-21 17:10:34 +0200 |
commit | 4afe9e4f2a461eb75dc3373280d0c889971b62ea (patch) | |
tree | 2e8400f7a6ab69dec59b4b0a620fc634fd7b7b3d /Kernel/Net/NetworkTask.cpp | |
parent | 286bafbb19a8c8278b44427b15fb21f86ee3db0c (diff) | |
download | serenity-4afe9e4f2a461eb75dc3373280d0c889971b62ea.zip |
Kernel: Implement rtl8139 network interface driver
Diffstat (limited to 'Kernel/Net/NetworkTask.cpp')
-rw-r--r-- | Kernel/Net/NetworkTask.cpp | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/Kernel/Net/NetworkTask.cpp b/Kernel/Net/NetworkTask.cpp index b150353c7d..bf911eb6cd 100644 --- a/Kernel/Net/NetworkTask.cpp +++ b/Kernel/Net/NetworkTask.cpp @@ -7,6 +7,7 @@ #include <Kernel/Net/IPv4.h> #include <Kernel/Net/IPv4Socket.h> #include <Kernel/Net/LoopbackAdapter.h> +#include <Kernel/Net/RTL8139NetworkAdapter.h> #include <Kernel/Net/TCP.h> #include <Kernel/Net/TCPSocket.h> #include <Kernel/Net/UDP.h> @@ -38,12 +39,17 @@ void NetworkTask_main() { LoopbackAdapter::the(); - auto adapter = E1000NetworkAdapter::the(); - if (!adapter) + auto e1000 = E1000NetworkAdapter::the(); + if (!e1000) dbgprintf("E1000 network card not found!\n"); + if (e1000) + e1000->set_ipv4_address(IPv4Address(192, 168, 5, 2)); - if (adapter) - adapter->set_ipv4_address(IPv4Address(192, 168, 5, 2)); + auto rtl8139 = RTL8139NetworkAdapter::the(); + if (!rtl8139) + dbgprintf("RTL8139 network card not found!\n"); + if (rtl8139) + rtl8139->set_ipv4_address(IPv4Address(192, 168, 13, 201)); auto dequeue_packet = [&]() -> Optional<KBuffer> { auto packet = LoopbackAdapter::the().dequeue_packet(); @@ -51,8 +57,10 @@ void NetworkTask_main() dbgprintf("Receive loopback packet (%d bytes)\n", packet.value().size()); return packet.value(); } - if (adapter && adapter->has_queued_packets()) - return adapter->dequeue_packet(); + if (e1000 && e1000->has_queued_packets()) + return e1000->dequeue_packet(); + if (rtl8139 && rtl8139->has_queued_packets()) + return rtl8139->dequeue_packet(); return {}; }; @@ -67,6 +75,10 @@ void NetworkTask_main() if (e1000->has_queued_packets()) return true; } + if (auto* rtl8139 = RTL8139NetworkAdapter::the()) { + if (rtl8139->has_queued_packets()) + return true; + } return false; }); continue; |