linux-kpi: expand Ieee80211Ops to 47 callbacks + MLO fields on Vif/Sta/BssConf (Phase 6.2)

Phase 2 of mac80211 integration: expand the Rust mac80211.rs to match the
expanded C header.

Ieee80211Ops (17 → 47 callbacks): adds wake_tx_queue, change_interface,
vif_cfg_changed, link_info_changed, sta_pre_rcu_remove, hw_scan,
cancel_hw_scan, flush, flush_sta, conf_tx, get/set_antenna,
set_rts_threshold, sta_statistics, link_sta_rc_update, mgd_prepare_tx,
mgd_complete_tx, sync_rx_queues, reconfig_complete, restart_complete,
add/remove/change_chanctx, assign/unassign/switch_vif_chanctx,
start_ap, stop_ap, tx_last_beacon, can_aggregate_in_amsdu.

sta_state expanded from 4 args (u32 new) to 5 args (u32 old, u32 new).

Ieee80211Vif: adds is_mld + valid_links for MLO.
Ieee80211Sta: adds mld_addr, wme, mfp, tdls, is_mld, valid_links.
Ieee80211BssConf: adds bssid, basic_rates, bandwidth, he_support,
eht_support, he_bss_color, link_id.

Tests updated with new field initializers. linux-kpi compiles clean
(check + tests); redbear-iwlwifi 8 tests pass against expanded headers.
This commit is contained in:
2026-07-24 23:01:18 +09:00
parent cbcb238af6
commit 8de4d0eea5
@@ -42,35 +42,59 @@ pub type RxCallback = unsafe extern "C" fn(*mut Ieee80211Hw, *mut SkBuff);
#[repr(C)]
pub struct Ieee80211Ops {
pub tx: Option<extern "C" fn(*mut Ieee80211Hw, *mut SkBuff)>,
pub tx: Option<extern "C" fn(*mut Ieee80211Hw, *mut c_void)>,
pub wake_tx_queue: Option<extern "C" fn(*mut Ieee80211Hw, *mut c_void)>,
pub start: Option<extern "C" fn(*mut Ieee80211Hw) -> i32>,
pub stop: Option<extern "C" fn(*mut Ieee80211Hw)>,
pub add_interface: Option<extern "C" fn(*mut Ieee80211Hw, *mut Ieee80211Vif) -> i32>,
pub change_interface: Option<extern "C" fn(*mut Ieee80211Hw, *mut Ieee80211Vif, u32, bool) -> i32>,
pub remove_interface: Option<extern "C" fn(*mut Ieee80211Hw, *mut Ieee80211Vif)>,
pub config: Option<extern "C" fn(*mut Ieee80211Hw, u32) -> i32>,
pub bss_info_changed:
Option<extern "C" fn(*mut Ieee80211Hw, *mut Ieee80211Vif, *mut Ieee80211BssConf, u32)>,
Option<extern "C" fn(*mut Ieee80211Hw, *mut Ieee80211Vif, *mut Ieee80211BssConf, u64)>,
pub vif_cfg_changed: Option<extern "C" fn(*mut Ieee80211Hw, *mut Ieee80211Vif, u64)>,
pub link_info_changed: Option<extern "C" fn(*mut Ieee80211Hw, *mut Ieee80211Vif, *mut Ieee80211BssConf, u64)>,
pub sta_state:
Option<extern "C" fn(*mut Ieee80211Hw, *mut Ieee80211Vif, *mut Ieee80211Sta, u32) -> i32>,
Option<extern "C" fn(*mut Ieee80211Hw, *mut Ieee80211Vif, *mut Ieee80211Sta, u32, u32) -> i32>,
pub sta_pre_rcu_remove: Option<extern "C" fn(*mut Ieee80211Hw, *mut Ieee80211Vif, *mut Ieee80211Sta)>,
pub set_key: Option<
extern "C" fn(
*mut Ieee80211Hw,
*mut Ieee80211Vif,
i32,
*mut Ieee80211Sta,
*mut KeyParams,
) -> i32,
extern "C" fn(*mut Ieee80211Hw, i32, *mut Ieee80211Vif, *mut Ieee80211Sta, *mut c_void) -> i32,
>,
pub ampdu_action: Option<
extern "C" fn(*mut Ieee80211Hw, *mut Ieee80211Vif, *mut Ieee80211Sta, u16, u16, u16) -> i32,
extern "C" fn(*mut Ieee80211Hw, *mut Ieee80211Vif, *mut Ieee80211Sta, u32, *mut c_void) -> i32,
>,
pub can_aggregate_in_amsdu: Option<extern "C" fn(*mut Ieee80211Hw, *mut c_void, *mut c_void) -> bool>,
pub sw_scan_start: Option<extern "C" fn(*mut Ieee80211Hw, *mut Ieee80211Vif, *const u8)>,
pub sw_scan_complete: Option<extern "C" fn(*mut Ieee80211Hw, *mut Ieee80211Vif)>,
pub prepare_multicast: Option<extern "C" fn(*mut Ieee80211Hw, *mut c_void) -> u64>,
pub configure_filter: Option<extern "C" fn(*mut Ieee80211Hw, u32, *mut u32, u64)>,
pub hw_scan: Option<extern "C" fn(*mut Ieee80211Hw, *mut Ieee80211Vif, *mut c_void) -> i32>,
pub cancel_hw_scan: Option<extern "C" fn(*mut Ieee80211Hw, *mut Ieee80211Vif)>,
pub sched_scan_start:
Option<extern "C" fn(*mut Ieee80211Hw, *mut Ieee80211Vif, *mut c_void) -> i32>,
pub sched_scan_stop: Option<extern "C" fn(*mut Ieee80211Hw, *mut Ieee80211Vif)>,
pub flush: Option<extern "C" fn(*mut Ieee80211Hw, *mut Ieee80211Vif, u32, bool)>,
pub flush_sta: Option<extern "C" fn(*mut Ieee80211Hw, *mut Ieee80211Vif, *mut Ieee80211Sta)>,
pub configure_filter: Option<extern "C" fn(*mut Ieee80211Hw, u32, *mut u32, u64)>,
pub prepare_multicast: Option<extern "C" fn(*mut Ieee80211Hw, *mut c_void) -> u64>,
pub conf_tx: Option<extern "C" fn(*mut Ieee80211Hw, *mut Ieee80211Vif, u32, u8, *mut c_void) -> i32>,
pub get_antenna: Option<extern "C" fn(*mut Ieee80211Hw, *mut u32, *mut u32) -> i32>,
pub set_antenna: Option<extern "C" fn(*mut Ieee80211Hw, u32, u32) -> i32>,
pub set_rts_threshold: Option<extern "C" fn(*mut Ieee80211Hw, u32) -> i32>,
pub sta_statistics: Option<extern "C" fn(*mut Ieee80211Hw, *mut Ieee80211Vif, *mut Ieee80211Sta, *mut c_void)>,
pub link_sta_rc_update: Option<extern "C" fn(*mut Ieee80211Hw, *mut Ieee80211Vif, *mut c_void)>,
pub mgd_prepare_tx: Option<extern "C" fn(*mut Ieee80211Hw, *mut Ieee80211Vif, *mut c_void)>,
pub mgd_complete_tx: Option<extern "C" fn(*mut Ieee80211Hw, *mut Ieee80211Vif, *mut c_void)>,
pub sync_rx_queues: Option<extern "C" fn(*mut Ieee80211Hw, *mut Ieee80211Vif)>,
pub reconfig_complete: Option<extern "C" fn(*mut Ieee80211Hw, u32)>,
pub restart_complete: Option<extern "C" fn(*mut Ieee80211Hw)>,
pub add_chanctx: Option<extern "C" fn(*mut Ieee80211Hw, *mut c_void) -> i32>,
pub remove_chanctx: Option<extern "C" fn(*mut Ieee80211Hw, *mut c_void)>,
pub change_chanctx: Option<extern "C" fn(*mut Ieee80211Hw, *mut c_void, u32)>,
pub assign_vif_chanctx: Option<extern "C" fn(*mut Ieee80211Hw, *mut Ieee80211Vif, *mut c_void) -> i32>,
pub unassign_vif_chanctx: Option<extern "C" fn(*mut Ieee80211Hw, *mut Ieee80211Vif, *mut c_void)>,
pub switch_vif_chanctx: Option<extern "C" fn(*mut Ieee80211Hw, *mut Ieee80211Vif, *mut c_void, *mut c_void, u32)>,
pub start_ap: Option<extern "C" fn(*mut Ieee80211Hw, *mut Ieee80211Vif, *mut Ieee80211BssConf) -> i32>,
pub stop_ap: Option<extern "C" fn(*mut Ieee80211Hw, *mut Ieee80211Vif, *mut Ieee80211BssConf)>,
pub tx_last_beacon: Option<extern "C" fn(*mut Ieee80211Hw) -> bool>,
}
#[repr(C)]
@@ -91,14 +115,22 @@ pub struct Ieee80211Vif {
pub drv_priv: *mut c_void,
pub type_: u32,
pub cfg_assoc: bool,
pub is_mld: bool,
pub valid_links: u16,
}
#[repr(C)]
#[derive(Debug)]
pub struct Ieee80211Sta {
pub addr: [u8; 6],
pub mld_addr: [u8; 6],
pub drv_priv: *mut c_void,
pub aid: u16,
pub wme: bool,
pub mfp: bool,
pub tdls: bool,
pub is_mld: bool,
pub valid_links: u16,
}
#[repr(C)]
@@ -106,6 +138,13 @@ pub struct Ieee80211BssConf {
pub assoc: bool,
pub aid: u16,
pub beacon_int: u16,
pub bssid: [u8; 6],
pub basic_rates: u32,
pub bandwidth: u8,
pub he_support: bool,
pub eht_support: bool,
pub he_bss_color: u8,
pub link_id: u8,
}
pub const BSS_CHANGED_ASSOC: u32 = 1;
@@ -689,7 +728,7 @@ pub extern "C" fn ieee80211_sta_state(
}
match unsafe { (*ops).sta_state } {
Some(callback) => callback(hw, vif, sta, new_state),
Some(callback) => callback(hw, vif, sta, _old_state, new_state),
None => 0,
}
}
@@ -744,6 +783,7 @@ mod tests {
_hw: *mut Ieee80211Hw,
_vif: *mut Ieee80211Vif,
_sta: *mut Ieee80211Sta,
_old: u32,
state: u32,
) -> i32 {
STA_CALLBACKS.store(state as i32, Ordering::Release);
@@ -784,6 +824,8 @@ mod tests {
drv_priv: ptr::null_mut(),
type_: 0,
cfg_assoc: true,
is_mld: false,
valid_links: 0,
};
ieee80211_connection_loss(&mut vif);
assert!(!vif.cfg_assoc);
@@ -815,21 +857,51 @@ mod tests {
fn ieee80211_sta_registry_and_ba_sessions_work() {
let ops = Ieee80211Ops {
tx: None,
wake_tx_queue: None,
start: None,
stop: None,
add_interface: None,
change_interface: None,
remove_interface: None,
config: None,
bss_info_changed: None,
vif_cfg_changed: None,
link_info_changed: None,
sta_state: Some(test_sta_state),
sta_pre_rcu_remove: None,
set_key: None,
ampdu_action: None,
can_aggregate_in_amsdu: None,
sw_scan_start: None,
sw_scan_complete: None,
prepare_multicast: None,
configure_filter: None,
hw_scan: None,
cancel_hw_scan: None,
sched_scan_start: None,
sched_scan_stop: None,
flush: None,
flush_sta: None,
configure_filter: None,
prepare_multicast: None,
conf_tx: None,
get_antenna: None,
set_antenna: None,
set_rts_threshold: None,
sta_statistics: None,
link_sta_rc_update: None,
mgd_prepare_tx: None,
mgd_complete_tx: None,
sync_rx_queues: None,
reconfig_complete: None,
restart_complete: None,
add_chanctx: None,
remove_chanctx: None,
change_chanctx: None,
assign_vif_chanctx: None,
unassign_vif_chanctx: None,
switch_vif_chanctx: None,
start_ap: None,
stop_ap: None,
tx_last_beacon: None,
};
let hw = ieee80211_alloc_hw_nm(
0,
@@ -844,11 +916,19 @@ mod tests {
drv_priv: ptr::null_mut(),
type_: 0,
cfg_assoc: false,
is_mld: false,
valid_links: 0,
};
let mut sta = Ieee80211Sta {
addr: [1, 2, 3, 4, 5, 6],
mld_addr: [1, 2, 3, 4, 5, 6],
drv_priv: ptr::null_mut(),
aid: 1,
wme: false,
mfp: false,
tdls: false,
is_mld: false,
valid_links: 0,
};
STA_CALLBACKS.store(0, Ordering::Release);