Implement Ethernet subsystem with unified NIC abstraction (AI)
- Created src/ethernet.h: eth_iface_t interface struct, Ethernet header type, htons/ntohs/htonl/ntohl byte-order helpers, EtherType constants, send/recv with automatic header construction/stripping - Created src/ethernet.c: interface table, char device ops routed through ethernet layer, sysfs /sys/net namespace exposing per-iface mac/ip/netmask/gateway/link files, IPv4 address parse/format - NE2000 and 3C509B drivers now register through ethernet_register() instead of directly via devicefs_register_char(); removed redundant char device ops from both drivers - Kernel calls ethernet_init() before init_drivers() so the subsystem is ready when NIC drivers probe - Tested: NE2000 detected with NIC, 'eth1' registered via ethernet subsystem; clean boot without NIC
This commit is contained in:
@@ -22,6 +22,7 @@
|
||||
#include "mbr.h"
|
||||
#include "fat32.h"
|
||||
#include "keyboard.h"
|
||||
#include "ethernet.h"
|
||||
#include "framebuffer.h"
|
||||
|
||||
/* Global framebuffer info, parsed from multiboot2 tags. */
|
||||
@@ -415,6 +416,9 @@ void kernel_main(uint32_t magic, uint32_t addr) {
|
||||
fb_info.pitch = 80 * 2;
|
||||
}
|
||||
|
||||
ethernet_init();
|
||||
offset_print("Ethernet subsystem initialized\n");
|
||||
|
||||
init_drivers();
|
||||
EARLY_PRINT("DRV ");
|
||||
offset_print("Drivers initialized\n");
|
||||
|
||||
Reference in New Issue
Block a user