Files
RedBear-OS/netstack/Cargo.toml
T
Red Bear OS 00b4c141b2 netstack: complete CORE-C12 per-scheme worker pool + Phase 7 main loop integration
Adds the full second half of the CORE-C12 fix:

- scheme_pool::SchemePool: a per-scheme worker pool that takes
  closures and dispatches SchemeWork items to dedicated worker
  threads via mpsc channels. Each worker calls the closure under
  Arc<Mutex<Smolnetd>> so the smolnetd state is held briefly per
  event but the workers run in parallel. The pool also tracks
  per-scheme statistics (events_processed, bytes_processed,
  pending, events_dropped) via atomics for observability.

- scheme_pool_init::register_all: a helper that registers the
  standard netstack scheme set (ip, udp, tcp, icmp) against a
  SchemePool, mapping each scheme to its on_X_scheme_event
  method on the smolnetd.

- corec12_integration: the main loop integration layer. The
  new run_corec12_main_loop function drains a ReaderPool
  (per-NIC packet reads), routes the bytes into the smolnetd
  via per-scheme submit, then calls on_network_scheme_event
  on the smolnetd. End-to-end test pipeline mirrors the real
  flow with a Mock-style smolnetd.

- worker_pool::OwnedFd: a small adapter that wraps a raw file
  descriptor in std::fs::File via dup. The reader pool now
  accepts any Read + Send + 'static input, so both std::fs::File
  and the OwnedFd bridge work. The pool stays generic.

Phase 7 has the corresponding proptest + reader-pool unit
tests for parallel I/O (4 worker threads complete in <200ms
even though each has 50ms-sleep payload).

The smolnetd currently uses Rc<RefCell<...>> internally which
is not Send, so a small refactor of Smolnetd's state model
(Arc<Mutex<Smolnetd>> for cross-thread access) is the next
step. The scheme_pool_init closure captures Arc<Mutex<Smolnetd>>
and the worker takes the lock briefly per event; once Smolnetd's
internal state uses std::sync::Mutex instead of RefCell, the
worker threads can take the lock without Send issues. This is
a separate refactor that lives as a follow-up patch.
2026-07-27 10:53:56 +09:00

46 lines
967 B
TOML

[package]
name = "netstack"
description = "Network stack daemons"
version = "0.1.0"
edition = "2021"
[[bin]]
name = "netstack"
path = "src/main.rs"
[dependencies]
redox_event.workspace = true
daemon = { path = "../daemon" }
redox_syscall = { workspace = true, features = ["std"] }
redox-log.workspace = true
libredox = { workspace = true, features = ["mkns"] }
anyhow.workspace = true
redox-scheme.workspace = true
scheme-utils = { path = "../scheme-utils" }
libc.workspace = true
[dependencies.log]
workspace = true
default-features = false
features = ["release_max_level_warn"]
[dependencies.smoltcp]
version = "0.13.1"
default-features = false
features = [
"std",
"medium-ethernet", "medium-ip",
"proto-ipv4",
"proto-ipv6",
"socket-raw", "socket-icmp", "socket-udp", "socket-tcp", "socket-tcp-cubic",
"iface-max-addr-count-8",
"log"
]
#For debugging: "log", "verbose"
[dev-dependencies]
proptest = "1.11"
[lints]
workspace = true