]> Projects (at) Tadryanom (dot) Me - AdrOS.git/commit
feat: interrupt-driven E1000 RX, non-blocking TX, root= cmdline param
authorTulio A M Mendes <[email protected]>
Fri, 13 Feb 2026 10:01:48 +0000 (07:01 -0300)
committerTulio A M Mendes <[email protected]>
Fri, 13 Feb 2026 10:01:48 +0000 (07:01 -0300)
commit6faa26d01b41062e5d32fbe994ea175f48ef65b2
tree6b49f614c843c25d65192b8e615401f85ed34903
parent0515d8e0c2b5fdcbcf944bab52e2eaeb07dafcc7
feat: interrupt-driven E1000 RX, non-blocking TX, root= cmdline param

E1000 networking overhaul — replace polling with proper interrupt-driven I/O:

1. RX interrupt-driven:
   - IRQ handler (e1000_irq_handler) now signals e1000_rx_sem on
     RXT0/RXDMT0/RXO events instead of being a no-op.
   - Dedicated kernel thread (e1000_rx_thread) blocks on the
     semaphore, drains all available packets via e1000_recv(),
     and delivers them to lwIP via tcpip_input().
   - Latency: immediate wake on packet arrival (was 20ms polling).

2. TX non-blocking:
   - e1000_send() checks the DD bit immediately and returns -1 if
     the descriptor is not ready (was: busy-wait up to 100K iters).
   - lwIP's linkoutput callback returns ERR_IF on ring-full.

3. Idle loop cleanup:
   - net_poll() removed from kernel_main's idle loop.
   - net_poll() is now a no-op (kept for backward compat).
   - PID 0 idle loop is pure hlt — no wasted CPU cycles.

4. root= kernel command line parameter:
   - Syntax: root=/dev/hdX (e.g. root=/dev/hda)
   - Auto-detects filesystem (tries diskfs, fat, ext2 in order)
   - Mounts at /disk on success
   - Processed after ATA init, before /etc/fstab parsing
   - Example GRUB entry:
     multiboot2 /boot/adros-x86.bin root=/dev/hda quiet

Files changed:
- src/drivers/e1000.c: add sync.h, ksem_init/signal, non-blocking TX
- include/e1000.h: export e1000_rx_sem
- src/net/e1000_netif.c: rewrite with rx_thread, remove polling
- src/kernel/main.c: remove net_poll() from idle loop
- src/kernel/init.c: add root= auto-mount logic

Build: clean, cppcheck: clean, smoke: 19/19 pass
Stress: 10/10 boots without ring3 — zero panics
include/e1000.h
src/drivers/e1000.c
src/kernel/init.c
src/kernel/main.c
src/net/e1000_netif.c