AP SUPPORT FOR POWERSAVING CLIENTS(9)
AP support for powersaving clients(9) π β¨
okay bestie, welcome to the Kernel API Manual entry for AP support for powersaving clients β the (9) one, and this is part 1. π«Ά
So, in order to implement AP and P2P GO modes, mac80211 has support for client powersaving, both "legacy" PS (PS-Poll/null data) and uAPSD. There currently is no support for sAPSD. Not a thing rn, periodt. π
vibe check β the one assumption: mac80211 makes exactly one assumption, bestie: a client will not poll with PS-Poll and trigger with uAPSD at the same time. Both are supported, and both can be used by the same client, but they can't be used concurrently by the same client. This simplifies the driver code, no cap. fr fr.
First thing to keep in mind, and it's lowkey huge: there is a flag for complete driver implementation, IEEE80211_HW_AP_LINK_PS. If this flag is set, mac80211 expects the driver to handle most of the state machine for powersaving clients and will ignore the PM bit in incoming frames. Drivers then use ieee80211_sta_ps_transition to inform mac80211 of stations' powersave transitions. In this mode, the driver is main character energy; mac80211 also doesn't handle PS-Poll/uAPSD. π
In the mode without IEEE80211_HW_AP_LINK_PS, mac80211 will check the PM bit in incoming frames for client powersave transitions. When a station goes to sleep, we will stop transmitting to it. There is, however, a race condition: a station might go to sleep while there is data buffered on hardware queues.
race condition alert π¨ If the device has support for this it will reject frames, and the driver should give the frames back to mac80211 with theIEEE80211_TX_STAT_TX_FILTEREDflag set β which will cause mac80211 to retry the frame when the station wakes up. The driver is also notified of powersave transitions by calling itssta_notifycallback.
When the station is asleep, it has three choices:
- it can wake up
- it can
PS-Poll - it can possibly start a uAPSD service period
Waking up is implemented by simply transmitting all buffered (and filtered) frames to the station. This is the easiest case. π
When the station sends a PS-Poll or a uAPSD trigger frame, mac80211 will inform the driver of this with the allow_buffered_frames callback; this callback is optional. mac80211 will then transmit the frames as usual and set the IEEE80211_TX_CTL_NO_PS_BUFFER on each frame. The last frame in the service period (or the only response to a PS-Poll) also has IEEE80211_TX_STATUS_EOSP set to indicate that it ends the service period; as this frame must have TX status report it also sets IEEE80211_TX_CTL_REQ_TX_STATUS. When TX status is reported for this frame, the service period is marked as having ended and a new one can be started by the peer. β¨
Additionally, non-bufferable MMPDUs can also be transmitted by mac80211 with the IEEE80211_TX_CTL_NO_PS_BUFFER set in them.
another race condition can happen on some devices like iwlwifi when there are frames queued for the station and it wakes up or polls; the frames that are already queued could end up being transmitted first instead, causing reordering and/or wrong processing of the EOSP. The cause is that allowing frames to be transmitted to a certain station is out-of-band communication to the device. To allow this problem to be solved, the driver can call ieee80211_sta_block_awake if frames are buffered when it is notified that the station went to sleep. When all these frames have been filtered (see above), it must call the function again to indicate that the station is no longer blocked. π«Ά
If the driver buffers frames in the driver for aggregation in any way, it must use the ieee80211_sta_set_buffered call when it is notified of the station going to sleep to inform mac80211 of any TIDs that have frames buffered. Note that when a station wakes up this information is reset (hence the requirement to call it when informed of the station going to sleep). Then, when a service period starts for any reason, release_buffered_frames is called with the number of frames to be released and which TIDs they are to come from. In this case, the driver is responsible for setting the EOSP (for uAPSD) and MORE_DATA bits in the released frames. To help the more_data parameter is passed to tell the driver if there is more data on other TIDs -- the TIDs to release frames from are ignored since mac80211 doesn't know how many frames the buffers for those TIDs contain.
If the driver also implements GO mode, where absence periods may shorten service periods (or abort PS-Poll responses), it must filter those response frames except in the case of frames that are buffered in the driver -- those must remain buffered to avoid reordering. Because it is possible that no frames are released in this case, the driver must call ieee80211_sta_eosp to indicate to mac80211 that the service period ended anyway. π
Finally, if frames from multiple TIDs are released from mac80211 but the driver might reorder them, it must clear & set the flags appropriately (only the last frame may have IEEE80211_TX_STATUS_EOSP) and also take care of the EOSP and MORE_DATA bits in the frame. The driver may also use ieee80211_sta_eosp in this case.
Note that if the driver ever buffers frames other than QoS-data frames, it must take care to never send a non-QoS-data frame as the last frame in a service period, adding a QoS-nulldata frame after a non-QoS-data frame if needed. π
SEE ALSO πΈ
okay bestie, this is the part where they hand you the entire guest list π literally every cross-reference in the mac80211 universe is down here, and we are not skipping a single one. consider this your group chat roster. iykyk π
where everything lives
./include/net/mac80211.hβ the kernel file that started it all, home of every declaration below πIntroduction(9)Calling mac80211 from interrupts(9)Warning(9)Frame format(9)mac80211 workqueue(9)mac80211 software tx queueing(9)HW timestamping(9)
queues, channels & contexts
enum ieee80211_max_queues(9)enum ieee80211_ac_numbers(9)struct ieee80211_tx_queue_params(9)enum ieee80211_chanctx_change(9)struct ieee80211_chan_req(9)struct ieee80211_chanctx_conf(9)enum ieee80211_chanctx_switch_mode(9)struct ieee80211_vif_chanctx_switch(9)enum ieee80211_bss_change(9)
events, all the events π¦
enum ieee80211_event_type(9)enum ieee80211_rssi_event_data(9)struct ieee80211_rssi_event(9)enum ieee80211_mlme_event_data(9)enum ieee80211_mlme_event_status(9)struct ieee80211_mlme_event(9)struct ieee80211_ba_event(9)struct ieee80211_event(9)
BSS conf era β¨
struct ieee80211_mu_group_data(9)struct ieee80211_ftm_responder_params(9)struct ieee80211_fils_discovery(9)struct ieee80211_parsed_tpe(9)struct ieee80211_bss_npca_params(9)struct ieee80211_bss_conf(9)struct ieee80211_nan_channel(9)struct ieee80211_nan_peer_map(9)struct ieee80211_nan_peer_sched(9)
tx info & status vibes
enum mac80211_tx_info_flags(9)enum mac80211_tx_control_flags(9)enum mac80211_tx_status_flags(9)enum mac80211_rate_control_flags(9)struct ieee80211_tx_rate(9)struct ieee80211_tx_info(9)struct ieee80211_tx_status(9)struct ieee80211_scan_ies(9)ieee80211_tx_info_clear_status(9)
rx side, no cap
enum mac80211_rx_flags(9)enum mac80211_rx_encoding_flags(9)struct ieee80211_rx_status(9)
conf & smps π§
enum ieee80211_conf_flags(9)enum ieee80211_conf_changed(9)enum ieee80211_smps_mode(9)struct ieee80211_conf(9)struct ieee80211_channel_switch(9)
the VIF cinematic universe π
enum ieee80211_vif_flags(9)enum ieee80211_offload_flags(9)struct ieee80211_eml_params(9)struct ieee80211_nan_sched_cfg(9)struct ieee80211_vif_cfg(9)struct ieee80211_neg_ttlm(9)enum ieee80211_neg_ttlm_res(9)struct ieee80211_vif(9)ieee80211_vif_usable_links(9)ieee80211_vif_is_mld(9)ieee80211_vif_link_active(9)wdev_to_ieee80211_vif(9)ieee80211_vif_to_wdev(9)
keys & stations π
enum ieee80211_key_flags(9)struct ieee80211_key_conf(9)struct ieee80211_key_seq(9)enum set_key_cmd(9)enum ieee80211_sta_state(9)enum ieee80211_sta_rx_bandwidth(9)struct ieee80211_sta_rates(9)struct ieee80211_sta_txpwr(9)struct ieee80211_sta_aggregates(9)struct ieee80211_link_sta(9)struct ieee80211_sta(9)enum sta_notify_cmd(9)struct ieee80211_tx_control(9)struct ieee80211_txq(9)
hardware & friends π»
enum ieee80211_hw_flags(9)struct ieee80211_hw(9)struct ieee80211_scan_request(9)struct ieee80211_tdls_ch_sw_params(9)wiphy_to_ieee80211_hw(9)SET_IEEE80211_DEV(9)SET_IEEE80211_PERM_ADDR(9)ieee80211_free_txskb(9)ieee80211_purge_tx_queue(9)
the "support" explainers (yes, your page's siblings) π«Ά
Hardware crypto acceleration(9)Powersave support(9)Beacon filter support(9)Spatial multiplexing power save(9)Frame filtering(9)HW queue control(9)
ops & registration π
enum ieee80211_filter_flags(9)enum ieee80211_ampdu_mlme_action(9)struct ieee80211_ampdu_params(9)enum ieee80211_frame_release_type(9)enum ieee80211_rate_control_changed(9)enum ieee80211_roc_type(9)enum ieee80211_reconfig_type(9)struct ieee80211_prep_tx_info(9)struct ieee80211_ops(9)ieee80211_alloc_hw_nm(9)ieee80211_alloc_hw(9)ieee80211_register_hw(9)
LED trigger slay π
struct ieee80211_tpt_blink(9)enum ieee80211_tpt_led_trigger_flags(9)ieee80211_get_tx_led_name(9)ieee80211_get_rx_led_name(9)ieee80211_get_assoc_led_name(9)ieee80211_get_radio_led_name(9)ieee80211_create_tpt_led_trigger(9)ieee80211_unregister_hw(9)ieee80211_free_hw(9)ieee80211_restart_hw(9)
receive path besties
ieee80211_rx_list(9)ieee80211_rx_napi(9)ieee80211_rx(9)ieee80211_rx_irqsafe(9)ieee80211_rx_ni(9)
powersave & buffering (the actual theme of the page π)
ieee80211_sta_ps_transition(9)ieee80211_sta_ps_transition_ni(9)ieee80211_sta_pspoll(9)ieee80211_sta_uapsd_trigger(9)ieee80211_sta_set_buffered(9)
tx rates & tx status π₯
ieee80211_get_tx_rates(9)ieee80211_tx_rate_update(9)ieee80211_tx_status_skb(9)ieee80211_tx_status_ext(9)ieee80211_tx_status_noskb(9)ieee80211_tx_status_ni(9)ieee80211_tx_status_irqsafe(9)ieee80211_report_low_ack(9)
beacon stuff β
struct ieee80211_mutable_offsets(9)ieee80211_beacon_get_template(9)ieee80211_beacon_get_template_ema_index(9)struct ieee80211_ema_beacons(9)ieee80211_beacon_get_template_ema_list(9)ieee80211_beacon_free_ema_list(9)ieee80211_beacon_get_tim(9)ieee80211_beacon_get(9)ieee80211_beacon_update_cntdwn(9)ieee80211_beacon_set_cntdwn(9)ieee80211_csa_finish(9)ieee80211_beacon_cntdwn_is_complete(9)ieee80211_color_change_finish(9)
frame getters & duration math π§
ieee80211_proberesp_get(9)ieee80211_pspoll_get(9)ieee80211_nullfunc_get(9)ieee80211_probereq_get(9)ieee80211_rts_get(9)ieee80211_rts_duration(9)ieee80211_ctstoself_get(9)ieee80211_ctstoself_duration(9)ieee80211_generic_frame_duration(9)ieee80211_get_buffered_bc(9)
tkip era π
ieee80211_get_tkip_p1k_iv(9)ieee80211_get_tkip_p1k(9)ieee80211_get_tkip_rx_p1k(9)ieee80211_get_tkip_p2k(9)ieee80211_tkip_add_iv(9)
key seq & GTK rekey π
ieee80211_get_key_rx_seq(9)ieee80211_set_key_rx_seq(9)ieee80211_gtk_rekey_add(9)ieee80211_gtk_rekey_notify(9)ieee80211_key_mic_failure(9)ieee80211_key_replay(9)
queue control π
ieee80211_wake_queue(9)ieee80211_stop_queue(9)ieee80211_queue_stopped(9)ieee80211_stop_queues(9)ieee80211_wake_queues(9)
scan reporting πΈ
iteration nation π¦
enum ieee80211_interface_iteration_flags(9)ieee80211_iterate_interfaces(9)ieee80211_iterate_active_interfaces(9)ieee80211_iterate_active_interfaces_atomic(9)for_each_interface(9)for_each_active_interface(9)ieee80211_iterate_active_interfaces_mtx(9)ieee80211_iterate_stations_atomic(9)for_each_station(9)ieee80211_iterate_stations_mtx(9)
workqueue helpers
block-ack (tx) sessions β¨
ieee80211_refresh_tx_agg_session_timer(9)ieee80211_start_tx_ba_session(9)ieee80211_start_tx_ba_cb_irqsafe(9)ieee80211_stop_tx_ba_session(9)ieee80211_stop_tx_ba_cb_irqsafe(9)
finding stations & airtime π
ieee80211_find_sta(9)ieee80211_find_sta_by_ifaddr(9)ieee80211_find_sta_by_link_addrs(9)ieee80211_sta_block_awake(9)ieee80211_sta_eosp(9)ieee80211_send_eosp_nullfunc(9)ieee80211_sta_recalc_aggregates(9)ieee80211_sta_register_airtime(9)ieee80211_txq_airtime_check(9)ieee80211_txq_aql_pending(9)
iterating keys & chanctxs
ieee80211_iter_keys(9)ieee80211_iter_keys_rcu(9)ieee80211_iter_chan_contexts_atomic(9)ieee80211_iter_chan_contexts_mtx(9)
things going wrong (loss, disconnect, radar) π
ieee80211_ap_probereq_get(9)ieee80211_beacon_loss(9)ieee80211_connection_loss(9)ieee80211_disconnect(9)ieee80211_resume_disconnect(9)ieee80211_hw_restart_disconnect(9)ieee80211_cqm_rssi_notify(9)ieee80211_cqm_beacon_loss_notify(9)ieee80211_radar_detected(9)ieee80211_chswitch_done(9)ieee80211_channel_switch_disconnect(9)ieee80211_request_smps(9)ieee80211_ready_on_channel(9)ieee80211_remain_on_channel_expired(9)
rx block-ack offload π
ieee80211_stop_rx_ba_session(9)ieee80211_mark_rx_ba_filtered_frames(9)ieee80211_send_bar(9)ieee80211_manage_rx_ba_offl(9)ieee80211_start_rx_ba_session_offl(9)ieee80211_stop_rx_ba_session_offl(9)ieee80211_rx_ba_timer_expired(9)
rate control π
struct ieee80211_tx_rate_control(9)enum rate_control_capabilities(9)rate_control_set_rates(9)
capability lookups & helpers π§
ieee80211_get_he_iftype_cap_vif(9)ieee80211_get_he_6ghz_capa_vif(9)ieee80211_get_eht_iftype_cap_vif(9)ieee80211_get_uhr_iftype_cap_vif(9)ieee80211_update_mu_groups(9)ieee80211_ave_rssi(9)ieee80211_calculate_rx_timestamp(9)ieee80211_report_wowlan_wakeup(9)ieee80211_tx_prepare_skb(9)ieee80211_parse_tx_radiotap(9)
P2P NOA & TDLS π¦
struct ieee80211_noa_data(9)ieee80211_parse_p2p_noa(9)ieee80211_update_p2p_noa(9)ieee80211_tdls_oper_request(9)ieee80211_reserve_tid(9)ieee80211_unreserve_tid(9)
txq scheduling, main character energy π
ieee80211_tx_dequeue(9)ieee80211_tx_dequeue_ni(9)ieee80211_handle_wake_tx_queue(9)ieee80211_next_txq(9)ieee80211_txq_schedule_start(9)ieee80211_schedule_txq(9)ieee80211_return_txq(9)ieee80211_txq_may_transmit(9)ieee80211_txq_get_depth(9)
NAN functions π
ieee80211_nan_func_terminated(9)ieee80211_nan_func_match(9)ieee80211_nan_sched_update_done(9)ieee80211_nan_cluster_joined(9)ieee80211_nan_try_evacuate(9)
airtime, templates & the finale β
ieee80211_calc_rx_airtime(9)ieee80211_calc_tx_airtime(9)ieee80211_get_fils_discovery_tmpl(9)ieee80211_get_unsol_bcast_probe_resp_tmpl(9)ieee80211_obss_color_collision_notify(9)ieee80211_is_tx_data(9)ieee80211_set_active_links(9)ieee80211_set_active_links_async(9)ieee80211_send_teardown_neg_ttlm(9)ieee80211_chan_width_to_rx_bw(9)ieee80211_prepare_rx_omi_bw(9)ieee80211_finalize_rx_omi_bw(9)ieee80211_vif_nan_started(9)ieee80211_encrypt_tx_skb(9)
bestie that was a lot of names and every single one of them made it in, no cap ππ«Ά
and that's a wrap on part 2!! this page comes to you from the kernel source path ./include/net, dated October 2026 β genuinely iconic of it. go read some of those (9) pages, i'll be right here cheering you on πβ¨π
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms