portal: add WIFI_CREATE op (portal-bridged cfg80211 wiphy)#93
Open
lacraig2 wants to merge 2 commits into
Open
Conversation
Register a real cfg80211 wiphy + netdev on a host WIFI_CREATE portal op, mirroring portal_mtd.c's create-with-callbacks pattern. Its .scan op calls back to a host plugin that reports a modeled set of BSSes, so a rehosted target can perceive a scriptable Wi-Fi RF environment during emulation with no mac80211_hwsim and no kernel rebuild (links against cfg80211, already =y). - portal_op_list.h: X(wifi_create, WIFI_CREATE) (auto-declares + dispatches) - portal_wifi.c: handle_op_wifi_create + delayed-work .scan bridge that packs host-provided BSS entries via cfg80211_inform_bss / cfg80211_scan_done
Extend the portal-bridged wiphy with three more nl80211 ops so a host plugin can model the channel picture and connected-client link stats, not just scan results: - .dump_survey → per-channel noise floor + active/busy time (SURVEY_INFO_*). - .dump_station → per-peer signal, inactive/connected time, rx/tx bytes64+packets. - .get_station → resolve a MAC by walking the idx-based station callback. Wiring mirrors the existing scan callback: portal_wifi_create_req gains cb_survey_ptr + cb_station_ptr (host trampolines), and a small per-device scratch buffer (PW_OP_BUF_SZ) backs the one-entry-per-call .dump_* iteration. No new portal op — reuses WIFI_CREATE. New on-wire structs portal_wifi_survey / portal_wifi_station (packed) carry the entries; the driver's DWARF-derived ISF exposes them so the host resolves the layouts by name.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds a new portal device type: a portal-bridged virtual cfg80211 wiphy, mirroring how MTD is done (
portal_mtd.c).On a host
WIFI_CREATEportal op,handle_op_wifi_createregisters a real cfg80211wiphy+ netdev (station mode, 2.4 GHz band). Its.scanop schedules work that calls a host-provided callback, then reports the returned BSSes viacfg80211_inform_bss/cfg80211_scan_done.Why
Lets a rehosted target perceive a scriptable Wi-Fi RF environment (neighbor APs, SSID/channel/signal) during emulation — the Wi-Fi analog of a host-modeled control plane — where the real radio driver can't load. Needs no
mac80211_hwsimand no kernel rebuild: it links againstcfg80211, which is already=yin the donor kernels, and ships entirely in the driver + a host plugin.Changes
portal_op_list.h:X(wifi_create, WIFI_CREATE)— the X-macro auto-declares the handler prototype and auto-wires the dispatch table, so this one line is the whole op wiring.portal_wifi.c(new; Makefile auto-globsportal/*.c): the create handler, request struct (ifname/mac + scan callback ptr), a packed on-wire BSS entry format, a minimal netdev, and the delayed-work.scanbridge.Testing
Built for mipsel/6.13 (MODPOST clean — cfg80211 symbols resolve; module is GPL). On a live rehost the host plugin creates the wiphy at boot, and
iw dev <if> scan/iwinfo <if> scanreturn the host-modeled BSSes.Follow-ups
.dump_survey(channel noise/utilization) and AP-mode.get_station/.dump_station(connected-client RSSI).