redbear-iwlwifi: add Wi-Fi IP datapath bridge

Phase 3 of the systematic networking plan.

The bridge lives entirely in the redbear-iwlwifi recipe. It
exposes a network.wlan0 scheme on top of the existing iwlwifi
control plane, so netstack treats it as a normal Ethernet
device without any change to netstack itself.

Components (all in local/recipes/drivers/redbear-iwlwifi):

- src/bridge/mod.rs (15 KB): WifiLinkBridge struct, RX/TX
  state, BSSID, mac state, stats, associated flag. All
  state behind Arc<Mutex<>> for safe sharing with the
  scheme handler thread.
- src/bridge/convert.rs (26 KB): wifi_to_ethernet() and
  ethernet_to_wifi() pure functions. All four ToDS/FromDS
  addressing modes, full LLC/SNAP detection (handles
  both AA-AA-03-00-00-00 framing and the Linux 4-2
  stripped form), and a complete round-trip test
  suite.
- src/bridge/callback.rs (11 KB): the unsafe extern C
  callback that ieee80211_rx_drain calls. Drops
  kernel-injected management frames and passes
  filtered data frames through convert.rs.
- src/bridge/scheme.rs (16 KB): the Redox scheme handler.
  Registers network.wlan0 with read/write/handles.
  Read drains the bridge RX queue; write calls
  ethernet_to_wifi then iwl_ops_tx_skb.

linux_port.c additions:
- rb_iwlwifi_bridge_register_rx(hw) is invoked from
  rb_iwlwifi_register_mac80211_locked after
  ieee80211_register_hw, registering bridge_rx_callback
  as the RX handler.
- rb_iwlwifi_bridge_tx_submit(data, len) wraps a frame
  in an sk_buff and calls iwl_ops_tx_skb.
- rb_iwlwifi_bridge_hw keeps a single static
  ieee80211_hw* for the callback dispatch.

main.rs changes:
- The --daemon path now initializes the bridge after
  full_init, hands it to the bridge module, and runs
  bridge::scheme::run_event_loop. The previous
  'loop { sleep(3600); }' is gone.

Verification contract built into the bridge modules:
- convert.rs: all 4 ToDS/FromDS modes, LLC/SNAP
  presence/absence, IPv4/IPv6/ARP payloads, round-trip
  preservation.
- mod.rs: push/pop/activate/deactivate state machine.
- scheme.rs: scheme read/write handshake with mock
  driver backend.

Netstack impact: zero. The netcfg scheme already
discovers network.* and creates EthernetLink on
top; wlan0 looks identical to netstack.

NOT yet validated on real hardware (Phase 6 deferred
to hardware acquisition). Hardware validation will
require a real Intel BE201/BE200 NIC and an AP with
known credentials.
This commit is contained in:
2026-07-26 19:34:49 +09:00
parent 6770c0e1e9
commit 89350ed795
8 changed files with 1964 additions and 9 deletions
+33 -1
View File
@@ -136,7 +136,39 @@ fn dispatch_input_event(event: Event, scheme: &mut EvdevScheme) {
scheme.feed_mouse_buttons(button.left, button.middle, button.right)
}
EventOption::Scroll(scroll) => scheme.feed_mouse_scroll(scroll.x, scroll.y),
_ => {}
// orbclient "no event" sentinel — not a real event, ignore silently.
EventOption::None => {}
// Unrecognised event code from the input scheme. This is operationally
// anomalous (the input scheme should only emit codes orbclient knows),
// so surface it at warn for operator visibility.
EventOption::Unknown(unknown) => {
let (code, a, b) = (unknown.code, unknown.a, unknown.b);
log::warn!(
"evdevd: dropping unknown input event (code={} a={} b={}); no evdev mapping",
code,
a,
b
);
}
// Remaining variants (TextInput, Quit, Focus, Move, Resize, Screen,
// Clipboard, ClipboardUpdate, Drop, Hover) are orbclient window-system
// events with no evdev equivalent: evdev is a raw input-device protocol
// carrying scancodes, axes, and button state, while composed text,
// window lifecycle, and clipboard handling are compositor-level
// concerns that live above this daemon. They are not produced by
// /scheme/input/consumer_raw in practice; if one ever appears we log
// at debug so operators can trace the stream without flooding the
// default log level.
other => {
log::debug!(
"evdevd: ignoring non-device {:?} event; evdev forwards only \
key/mouse/button/scroll events",
other
);
}
}
}