more STA PS fixes and mac80211_hwsim PS support
v3 cover more STA PS fixes and mac80211_hwsim PS support
This patchset adds power save support to mac80211_hwsim, and fixes some lingering bugs in mac80211 STA PS related to (QoS) nullfunc probing.
The hostap hwsim test failures initially observed[0] have been "resolved" by disabling STA PS by default. It turns out STA PS behavior violates some assumption for eg. the bgscan_simple_beacon_loss test where a beacon loss event was expected instead of a disconnect event, which is triggered because hwsim can now do nullfunc probing. For the p2p failures I really have no idea :)
[0]:
https://lore.kernel.org/linux-wireless/[email protected]/
Thomas Pedersen (2):
mac80211_hwsim: add power save support
mac80211: add ieee80211_is_any_nullfunc()
drivers/net/wireless/mac80211_hwsim.c | 9 +++++++++ include/linux/ieee80211.h | 9 +++++++++ net/mac80211/mlme.c | 2 +- net/mac80211/rx.c | 8 +++----- net/mac80211/status.c | 5 ++--- net/mac80211/tx.c | 2 +- 6 files changed, 25 insertions(+), 10 deletions(-)
Signature · 1 line
2.20.1
PATCH v3 1/2 mac80211_hwsim: add power save support
Advertise the correct flags to mac80211 to indicate PS trigger frames and frame buffering should be handled by mac80211. This means mac80211_hwsim will now also have to release buffered multicast frames after a (DTIM) beacon.
Leave STA power save disabled by default since it causes several p2p, scanning, and rrm hostap tests to fail.
---
v3:
disable STA PS by default
--- drivers/net/wireless/mac80211_hwsim.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/net/wireless/mac80211_hwsim.c +9 -0
@@ -1595,6 +1595,11 @@ static void mac80211_hwsim_beacon_tx(void *arg, u8 *mac,mac80211_hwsim_tx_frame (hw, skb,rcu_dereference (vif->chanctx_conf)->def.chan); +while ((skb =ieee80211_get_buffered_bc (hw, vif)) !=NULL ) { +mac80211_hwsim_tx_frame (hw, skb, +rcu_dereference (vif->chanctx_conf)->def.chan); + } +if (vif->csa_active &&ieee80211_csa_is_complete (vif))ieee80211_csa_finish (vif); }
@@ -2925,11 +2930,15 @@ static int mac80211_hwsim_new_radio(struct genl_info *info,ieee80211_hw_set (hw,MFP_CAPABLE );ieee80211_hw_set (hw,SIGNAL_DBM );ieee80211_hw_set (hw,SUPPORTS_PS ); +ieee80211_hw_set (hw,REPORTS_TX_ACK_STATUS ); +ieee80211_hw_set (hw,HOST_BROADCAST_PS_BUFFERING ); +ieee80211_hw_set (hw,PS_NULLFUNC_STACK );ieee80211_hw_set (hw,TDLS_WIDER_BW );if (rctbl)ieee80211_hw_set (hw,SUPPORTS_RC_TABLE );ieee80211_hw_set (hw,SUPPORTS_MULTI_BSSID ); + hw->wiphy->flags &= ~WIPHY_FLAG_PS_ON_BY_DEFAULT ; hw->wiphy->flags |=WIPHY_FLAG_SUPPORTS_TDLS |WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL | WIPHY_FLAG_AP_UAPSD |
Signature · 1 line
2.20.1
PATCH v3 2/2 mac80211: add ieee80211_is_any_nullfunc()
In reply to Thomas Pedersencommit 08a5bdde3812 ("mac80211: consider QoS Null frames for STA_NULLFUNC_ACKED") Fixed a bug where we failed to take into account a
nullfunc frame can be either non-QoS or QoS. It turns out
there is at least one more bug inieee80211_sta_tx_notify(), introduced in
commit 7b6ddeaf27ec ("mac80211: use QoS NDP for AP probing"),
where we forgot to check for the QoS variant and so
assumed the QoS nullfunc frame never went out
Fix this by adding a helper ieee80211_is_any_nullfunc() which consolidates the check for non-QoS and QoS nullfunc frames. Replace existing compound conditionals and add a couple more missing checks for QoS variant.
--- include/linux/ieee80211.h | 9 +++++++++ net/mac80211/mlme.c | 2 +- net/mac80211/rx.c | 8 +++----- net/mac80211/status.c | 5 ++--- net/mac80211/tx.c | 2 +- 5 files changed, 16 insertions(+), 10 deletions(-)
include/linux/ieee80211.h +9 -0
@@ -619,6 +619,15 @@ static inline bool ieee80211_is_qos_nullfunc(__le16 fc)cpu_to_le16 (IEEE80211_FTYPE_DATA |IEEE80211_STYPE_QOS_NULLFUNC ); } +/** +* ieee80211_is_any_nullfunc - check if frame is regular or QoS nullfunc frame +* @fc: frame control bytes in little-endian byteorder +*/ +static inline bool ieee80211_is_any_nullfunc (__le16 fc) +{ +return (ieee80211_is_nullfunc (fc) ||ieee80211_is_qos_nullfunc (fc)); +} +/** * ieee80211_is_bufferable_mmpdu - check if frame is bufferable MMPDU * @fc: frame control field in little-endian byteorder
net/mac80211/mlme.c +1 -1
@@ -2460,7 +2460,7 @@ void ieee80211_sta_tx_notify(struct ieee80211_sub_if_data *sdata,if (!ieee80211_is_data (hdr->frame_control))return ; -if (ieee80211_is_nullfunc (hdr->frame_control) && +if (ieee80211_is_any_nullfunc (hdr->frame_control) && sdata->u.mgd.probe_send_count >0 ) {if (ack)ieee80211_sta_reset_conn_monitor (sdata);
net/mac80211/rx.c +3 -5
@@ -1450,8 +1450,7 @@ ieee80211_rx_h_check_dup(struct ieee80211_rx_data *rx)return RX_CONTINUE ;if (ieee80211_is_ctl (hdr->frame_control) || -ieee80211_is_nullfunc (hdr->frame_control) || -ieee80211_is_qos_nullfunc (hdr->frame_control) || +ieee80211_is_any_nullfunc (hdr->frame_control) ||is_multicast_ether_addr (hdr->addr1))return RX_CONTINUE ;
@@ -1838,8 +1837,7 @@ ieee80211_rx_h_sta_process(struct ieee80211_rx_data *rx)* Drop (qos-)data::nullfunc frames silently, since they * are used only to control station power saving mode. */ -if (ieee80211_is_nullfunc (hdr->frame_control) || -ieee80211_is_qos_nullfunc (hdr->frame_control)) { +if (ieee80211_is_any_nullfunc (hdr->frame_control)) {I802_DEBUG_INC (rx->local->rx_handlers_drop_nullfunc);/*
@@ -2319,7 +2317,7 @@ static int ieee80211_drop_unencrypted(struct ieee80211_rx_data *rx, __le16 fc)/* Drop unencrypted frames if key is set. */ if (unlikely (!ieee80211_has_protected (fc) && - !ieee80211_is_nullfunc (fc) && + !ieee80211_is_any_nullfunc (fc) &&ieee80211_is_data (fc) && rx->key))return -EACCES ;
net/mac80211/status.c +2 -3
@@ -643,8 +643,7 @@ static void ieee80211_report_ack_skb(struct ieee80211_local *local,rcu_read_lock (); sdata =ieee80211_sdata_from_skb (local, skb);if (sdata) { -if (ieee80211_is_nullfunc (hdr->frame_control) || -ieee80211_is_qos_nullfunc (hdr->frame_control)) +if (ieee80211_is_any_nullfunc (hdr->frame_control)) cfg80211_probe_status(sdata->dev, hdr->addr1, cookie, acked, info->status.ack_signal,
@@ -1056,7 +1055,7 @@ static void __ieee80211_tx_status(struct ieee80211_hw *hw,I802_DEBUG_INC (local->dot11FailedCount); } - if ((ieee80211_is_nullfunc(fc) || ieee80211_is_qos_nullfunc(fc)) && + if (ieee80211_is_any_nullfunc(fc) && ieee80211_has_pm(fc) && ieee80211_hw_check(&local->hw, REPORTS_TX_ACK_STATUS) && !(info->flags & IEEE80211_TX_CTL_INJECTED) &&
net/mac80211/tx.c +1 -1
@@ -297,7 +297,7 @@ ieee80211_tx_h_check_assoc(struct ieee80211_tx_data *tx)if (unlikely (test_bit (SCAN_SW_SCANNING , &tx->local->scanning)) &&test_bit (SDATA_STATE_OFFCHANNEL , &tx->sdata->state) && !ieee80211_is_probe_req (hdr->frame_control) && - !ieee80211_is_nullfunc (hdr->frame_control)) + !ieee80211_is_any_nullfunc (hdr->frame_control))/* * When software scanning only nullfunc frames (to notify * the sleep state to the AP) and probe requests (for the
Signature · 1 line
2.20.1