fix a STA PS bug and add PS support to mac80211_hwsim
Subsystems (2)
cover fix a STA PS bug and add PS support to mac80211_hwsim
This patchset tries to make mac80211 power save testable with the hostap hwsim tests, and fixes a bug in STA power save.
Basic tests for AP and STA power save will be submitted to hostap separately.
Thomas Pedersen (3):
mac80211_hwsim: add power save support
mac80211: expose HW conf flags through debugfs
mac80211: consider QoS Null frames for STA_NULLFUNC_ACKED
drivers/net/wireless/mac80211_hwsim.c | 8 ++++++++ net/mac80211/debugfs.c | 3 +++ net/mac80211/status.c | 3 ++- 3 files changed, 13 insertions(+), 1 deletion(-)
Signature · 1 line
2.20.1
PATCH 1/3 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.
--- drivers/net/wireless/mac80211_hwsim.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/net/wireless/mac80211_hwsim.c +8 -0
@@ -1574,6 +1574,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); }
@@ -2804,6 +2809,9 @@ 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 );/* We only have SW crypto and only implement the A-MPDU API
Signature · 1 line
2.20.1
PATCH 2/3 mac80211: expose HW conf flags through debugfs
In reply to Thomas PedersenThis is useful during testing to eg. check the currently configured HW power save state.
--- net/mac80211/debugfs.c | 3 +++ 1 file changed, 3 insertions(+)
net/mac80211/debugfs.c +3 -0
@@ -59,6 +59,8 @@ static const struct file_operations name## _ops = { \ debugfs_create_file(#name, mode, phyd, local, &name## _ops); +DEBUGFS_READONLY_FILE (hw_conf,"%x" , + local->hw.conf.flags);DEBUGFS_READONLY_FILE (user_power,"%d" , local->user_power_level); DEBUGFS_READONLY_FILE(power, "%d",
@@ -434,6 +436,7 @@ void debugfs_hw_add(struct ieee80211_local *local)DEBUGFS_ADD (hwflags);DEBUGFS_ADD (user_power);DEBUGFS_ADD (power); +DEBUGFS_ADD (hw_conf);DEBUGFS_ADD_MODE (force_tx_status,0600 );if (local->ops->wake_tx_queue)
Signature · 1 line
2.20.1
PATCH 3/3 mac80211: consider QoS Null frames for STA_NULLFUNC_ACKED
In reply to Thomas PedersenCommit 7b6ddeaf27ec ("mac80211: use QoS NDP for AP probing") let STAs send QoS Null frames as PS triggers if the AP was a QoS STA. However, the mac80211 PS stack relies on an interface flag IEEE80211_STA_NULLFUNC_ACKED for determining trigger frame ACK, which was not being set for acked non-QoS Null frames. The effect is an inability to trigger hardware sleep via IEEE80211_CONF_PS since the QoS Null frame was seemingly never acked.
This bug only applies to drivers which set bothIEEE80211_HW_REPORTS_TX_ACK_STATUS andIEEE80211_HW_PS_NULLFUNC_STACK.
Detect the acked QoS Null frame to restore STA power save.
--- net/mac80211/status.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/mac80211/status.c +2 -1
@@ -870,7 +870,8 @@ static void __ieee80211_tx_status(struct ieee80211_hw *hw,I802_DEBUG_INC (local->dot11FailedCount); } -if (ieee80211_is_nullfunc (fc) &&ieee80211_has_pm (fc) && +if ((ieee80211_is_nullfunc (fc) ||ieee80211_is_qos_nullfunc (fc)) && +ieee80211_has_pm (fc) &&ieee80211_hw_check (&local->hw,REPORTS_TX_ACK_STATUS ) && !(info->flags &IEEE80211_TX_CTL_INJECTED ) && local->ps_sdata && !(local->scanning)) {
Signature · 1 line
2.20.1
PATCH 1/1 mac80211: consider QoS Null frames for STA_NULLFUNC_ACKED
In reply to Thomas PedersenCommit 7b6ddeaf27ec ("mac80211: use QoS NDP for AP probing") let STAs send QoS Null frames as PS triggers if the AP was a QoS STA. However, the mac80211 PS stack relies on an interface flag IEEE80211_STA_NULLFUNC_ACKED for determining trigger frame ACK, which was not being set for acked non-QoS Null frames. The effect is an inability to trigger hardware sleep via IEEE80211_CONF_PS since the QoS Null frame was seemingly never acked.
This bug only applies to drivers which set bothIEEE80211_HW_REPORTS_TX_ACK_STATUS andIEEE80211_HW_PS_NULLFUNC_STACK.
Detect the acked QoS Null frame to restore STA power save.
--- net/mac80211/status.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/mac80211/status.c +2 -1
@@ -1030,7 +1030,8 @@ static void __ieee80211_tx_status(struct ieee80211_hw *hw,I802_DEBUG_INC (local->dot11FailedCount); } -if (ieee80211_is_nullfunc (fc) &&ieee80211_has_pm (fc) && +if ((ieee80211_is_nullfunc (fc) ||ieee80211_is_qos_nullfunc (fc)) && +ieee80211_has_pm (fc) &&ieee80211_hw_check (&local->hw,REPORTS_TX_ACK_STATUS ) && !(info->flags &IEEE80211_TX_CTL_INJECTED ) && local->ps_sdata && !(local->scanning)) {
Signature · 1 line
2.20.1