summaryrefslogtreecommitdiff
path: root/kernel/network/ethernet.h
diff options
context:
space:
mode:
authorAnton Kling <anton@kling.gg>2024-10-06 11:12:16 +0200
committerAnton Kling <anton@kling.gg>2024-10-06 11:12:16 +0200
commitf18beba3cb3d85ed6e0f44fdff9256c50adcc5e1 (patch)
tree42e15026c9a0154269e5c7de71cd829866d6d564 /kernel/network/ethernet.h
parent6dc2637972f93dea8cc831d7ee225daefb74b8ab (diff)
Kernel/Networking: Modify outgoing packet in place
This avoids creation of new buffers and unnecessary memcpys. The old interface still exists for UDP but will be removed when I am less lazy. From testing it does not appear to have any performance improvement but this is most likely due to other bottlenecks as extra copies should always be worse.
Diffstat (limited to 'kernel/network/ethernet.h')
-rw-r--r--kernel/network/ethernet.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/kernel/network/ethernet.h b/kernel/network/ethernet.h
index ffb7893..6534a64 100644
--- a/kernel/network/ethernet.h
+++ b/kernel/network/ethernet.h
@@ -1,5 +1,15 @@
+#ifndef ETHERNET_H
+#define ETHERNET_H
#include <typedefs.h>
+struct EthernetHeader {
+ u8 mac_dst[6];
+ u8 mac_src[6];
+ u16 type;
+};
+
void handle_ethernet(const u8 *packet, u64 packet_length);
+void send_ethernet_packet2(u8 mac_dst[6], u16 type, u64 payload_length);
void send_ethernet_packet(u8 mac_dst[6], u16 type, u8 *payload,
u64 payload_length);
+#endif // ETHERNET_H