From f18beba3cb3d85ed6e0f44fdff9256c50adcc5e1 Mon Sep 17 00:00:00 2001 From: Anton Kling Date: Sun, 6 Oct 2024 11:12:16 +0200 Subject: 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. --- kernel/network/ethernet.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'kernel/network/ethernet.h') 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 +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 -- cgit v1.2.3