ath10k: Add debugfs support to get power save state change of STA
PATCH 1/1 ath10k: Add debugfs support to get power save state change of STA
This patch helps to get the power save state change of each peer connected to the AP. With WMI_10_4_PEER_STA_PS_STATECHG_EVENTID event, ps state of each peer is reported to user space via debugfs.
Use the below command to get the ps state of each sta:
cat /sys/kernel/debug/ieee80211/phyX/netdev::wlanX/stations/ XX:XX:XX:XX:XX:XX/peer_ps_state
If STA is in power save state, we get the peer_ps_state value as 1. if STA is not in power save state, we get the peer_ps_state value as 0. If ps_state event is disabled, we get the peer_ps_state value as 2.
We can enable/disable the ps_state events using the debugfs flag "ps_state_enable"
echo Y > /sys/kernel/debug/ieee80211/phyX/ath10k/ps_state_enable
Y = 1 to enable and Y = 0 to disable
Tested in QCA4019 with firmware ver 10.4-3.2.1.1-00011
--- drivers/net/wireless/ath/ath10k/core.h | 4 ++ drivers/net/wireless/ath/ath10k/debug.c | 82 +++++++++++++++++++++++++++ drivers/net/wireless/ath/ath10k/debugfs_sta.c | 29 ++++++++++ drivers/net/wireless/ath/ath10k/mac.c | 1 + drivers/net/wireless/ath/ath10k/wmi.c | 39 ++++++++++++- drivers/net/wireless/ath/ath10k/wmi.h | 7 +++ 6 files changed, 161 insertions(+), 1 deletion(-)
drivers/net/wireless/ath/ath10k/core.h +4 -0
@@ -505,6 +505,8 @@ struct ath10k_sta {/* Protected with ar->data_lock */ struct ath10k_sta_tid_stats tid_stats[IEEE80211_NUM_TIDS +1 ];#endif +/* Protected with ar->data_lock */ +u32 peer_ps_state; };#define ATH10K_VDEV_SETUP_TIMEOUT_HZ (5 * HZ)
@@ -946,6 +948,8 @@ struct ath10k {u32 low_5ghz_chan;u32 high_5ghz_chan;bool ani_enabled; +/* protected by conf_mutex */ +u8 ps_state_enable;bool p2p;
drivers/net/wireless/ath/ath10k/debug.c +82 -0
94 lines not on this page · raw message
drivers/net/wireless/ath/ath10k/debugfs_sta.c +29 -0
@@ -460,6 +460,33 @@ static ssize_t ath10k_dbg_sta_read_peer_debug_trigger(struct file *file, .llseek = default_llseek, }; +static ssize_t ath10k_dbg_sta_read_peer_ps_state (struct file *file, +char __user *user_buf, +size_t count,loff_t *ppos) +{ +struct ieee80211_sta *sta = file->private_data; +struct ath10k_sta *arsta = (struct ath10k_sta *)sta->drv_priv; +struct ath10k *ar = arsta->arvif->ar; +char buf[20 ]; +int len =0 ; + +spin_lock_bh (&ar->data_lock); + + len =scnprintf (buf,sizeof (buf) - len,"%d\n" , + arsta->peer_ps_state); + +spin_unlock_bh (&ar->data_lock); + +return simple_read_from_buffer (user_buf, count, ppos, buf, len); +} + +static const struct file_operations fops_peer_ps_state = { + .open = simple_open, + .read = ath10k_dbg_sta_read_peer_ps_state, + .owner =THIS_MODULE , + .llseek = default_llseek, +}; +static char *get_err_str (enum ath10k_pkt_rx_err i) {switch (i) {
@@ -738,4 +765,6 @@ void ath10k_sta_add_debugfs(struct ieee80211_hw *hw, struct ieee80211_vif *vif, ath10k_debug_is_extd_tx_stats_enabled(ar))debugfs_create_file ("tx_stats" ,0400 , dir, sta, &fops_tx_stats); +debugfs_create_file ("peer_ps_state" ,0400 , dir, sta, + &fops_peer_ps_state); }
drivers/net/wireless/ath/ath10k/mac.c +1 -0
@@ -6216,6 +6216,7 @@ static int ath10k_sta_state(struct ieee80211_hw *hw, new_state == IEEE80211_STA_NONE) {memset (arsta,0 ,sizeof (*arsta)); arsta->arvif = arvif; + arsta->peer_ps_state =WMI_PEER_PS_STATE_DISABLED ;INIT_WORK (&arsta->update_wk, ath10k_sta_rc_update_wk);for (i =0 ; i <ARRAY_SIZE (sta->txq); i++)
drivers/net/wireless/ath/ath10k/wmi.c +38 -1
@@ -1307,7 +1307,8 @@ .set_mcast2ucast_mode = WMI_PDEV_PARAM_UNSUPPORTED, .set_mcast2ucast_buffer = WMI_PDEV_PARAM_UNSUPPORTED, .remove_mcast2ucast_buffer = WMI_PDEV_PARAM_UNSUPPORTED, - .peer_sta_ps_statechg_enable = WMI_PDEV_PARAM_UNSUPPORTED, + .peer_sta_ps_statechg_enable = + WMI_10X_PDEV_PARAM_PEER_STA_PS_STATECHG_ENABLE, .igmpmld_ac_override = WMI_PDEV_PARAM_UNSUPPORTED, .block_interbss = WMI_PDEV_PARAM_UNSUPPORTED, .set_disable_reset_cmdid = WMI_PDEV_PARAM_UNSUPPORTED,
@@ -5030,6 +5031,36 @@ void ath10k_wmi_event_tpc_final_table(struct ath10k *ar, struct sk_buff *skb) } } +void +ath10k_wmi_event_peer_sta_ps_state_chg (struct ath10k *ar,struct sk_buff *skb) +{ +struct wmi_peer_sta_ps_state_chg_event *ev; +struct ieee80211_sta *sta; +struct ath10k_sta *arsta; +u8 peer_addr[ETH_ALEN ]; + +lockdep_assert_held (&ar->data_lock); + + ev = (struct wmi_peer_sta_ps_state_chg_event *)skb->data; +ether_addr_copy (peer_addr, ev->peer_macaddr.addr); + +rcu_read_lock (); + + sta =ieee80211_find_sta_by_ifaddr (ar->hw, peer_addr,NULL ); + +if (!sta) { +ath10k_warn (ar,"failed to find station entry %pM\n" , + peer_addr); + goto exit; + } + + arsta = (struct ath10k_sta *)sta->drv_priv; + arsta->peer_ps_state =__le32_to_cpu (ev->peer_ps_state); + +exit: +rcu_read_unlock (); +} +void ath10k_wmi_event_pdev_ftm_intg (struct ath10k *ar,struct sk_buff *skb) {ath10k_dbg (ar,ATH10K_DBG_WMI ,"WMI_PDEV_FTM_INTG_EVENTID\n" );
@@ -5960,6 +5991,9 @@ static void ath10k_wmi_10_2_op_rx(struct ath10k *ar, struct sk_buff *skb)ath10k_dbg (ar,ATH10K_DBG_WMI ,"received event id %d not implemented\n" , id);break ; +case WMI_10_2_PEER_STA_PS_STATECHG_EVENTID : +ath10k_wmi_event_peer_sta_ps_state_chg (ar, skb); +break ;default :ath10k_warn (ar,"Unknown eventid: %d\n" , id);break ;
@@ -6077,6 +6111,9 @@ static void ath10k_wmi_10_4_op_rx(struct ath10k *ar, struct sk_buff *skb)case WMI_10_4_DFS_STATUS_CHECK_EVENTID :ath10k_wmi_event_dfs_status_check (ar, skb);break ; +case WMI_10_4_PEER_STA_PS_STATECHG_EVENTID : +ath10k_wmi_event_peer_sta_ps_state_chg (ar, skb); +break ;default :ath10k_warn (ar,"Unknown eventid: %d\n" , id);break ;
drivers/net/wireless/ath/ath10k/wmi.h +7 -0
@@ -4170,6 +4170,13 @@ enum wmi_tpc_pream_5ghz { WMI_TPC_PREAM_5GHZ_HTCUP, }; +#define WMI_PEER_PS_STATE_DISABLED 2 + +struct wmi_peer_sta_ps_state_chg_event { +struct wmi_mac_addr peer_macaddr; +__le32 peer_ps_state; +} __packed; +struct wmi_pdev_chanlist_update_event {/* number of channels */ __le32 num_chan;
Signature · 7 lines
1.9.1 _______________________________________________ ath10k mailing list [email protected] http://lists.infradead.org/mailman/listinfo/ath10k
Quoted 16 lines · Maharaja Kennadyrajan
This patch helps to get the power save state change of each peer connected to the AP. With
WMI_10_4_PEER_STA_PS_STATECHG_EVENTIDevent, ps state of each peer is reported to user space via debugfs.Use the below command to get the ps state of each sta:
cat /sys/kernel/debug/ieee80211/phyX/netdev::wlanX/stations/ XX:XX:XX:XX:XX:XX/peer_ps_stateIf STA is in power save state, we get the
peer_ps_statevalue as 1. if STA is not in power save state, we get thepeer_ps_statevalue as 0. Ifps_stateevent is disabled, we get thepeer_ps_statevalue as 2.We can enable/disable the
ps_stateevents using the debugfs flag "ps_state_enable"
Quoted 8 lines
echo Y >
/sys/kernel/debug/ieee80211/phyX/ath10k/ps_state_enableY = 1 to enable and Y = 0 to disable
Tested in QCA4019 with firmware ver 10.4-3.2.1.1-00011
Signed-off-by Maharaja Kennadyrajan <[email protected]>Signed-off-by Kalle Valo <[email protected]>
This introduced a new warning:
drivers/net/wireless/ath/ath10k/wmi.c:5061:1: warning: symbol 'ath10k_wmi_event_peer_sta_ps_state_chg' was not declared. Should it be static?
I fixed this in the pending branch.
Signature · 3 lines
https://patchwork.kernel.org/patch/10603779/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
Quoted 16 lines · Maharaja Kennadyrajan
This patch helps to get the power save state change of each peer connected to the AP. With
WMI_10_4_PEER_STA_PS_STATECHG_EVENTIDevent, ps state of each peer is reported to user space via debugfs.Use the below command to get the ps state of each sta:
cat /sys/kernel/debug/ieee80211/phyX/netdev::wlanX/stations/ XX:XX:XX:XX:XX:XX/peer_ps_stateIf STA is in power save state, we get the
peer_ps_statevalue as 1. if STA is not in power save state, we get thepeer_ps_statevalue as 0. Ifps_stateevent is disabled, we get thepeer_ps_statevalue as 2.We can enable/disable the
ps_stateevents using the debugfs flag "ps_state_enable"
Quoted 8 lines
echo Y >
/sys/kernel/debug/ieee80211/phyX/ath10k/ps_state_enableY = 1 to enable and Y = 0 to disable
Tested in QCA4019 with firmware ver 10.4-3.2.1.1-00011
Signed-off-by Maharaja Kennadyrajan <[email protected]>Signed-off-by Kalle Valo <[email protected]>
This introduced a new warning:
drivers/net/wireless/ath/ath10k/wmi.c:5061:1: warning: symbol 'ath10k_wmi_event_peer_sta_ps_state_chg' was not declared. Should it be static?
I fixed this in the pending branch.
Signature · 9 lines
https://patchwork.kernel.org/patch/10603779/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches _______________________________________________ ath10k mailing list [email protected] http://lists.infradead.org/mailman/listinfo/ath10k
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 24 lines · Kalle Valo
Quoted 22 lines · Maharaja Kennadyrajan
This patch helps to get the power save state change of each peer connected to the AP. With
WMI_10_4_PEER_STA_PS_STATECHG_EVENTIDevent, ps state of each peer is reported to user space via debugfs.Use the below command to get the ps state of each sta:
cat /sys/kernel/debug/ieee80211/phyX/netdev::wlanX/stations/ XX:XX:XX:XX:XX:XX/peer_ps_stateIf STA is in power save state, we get the
peer_ps_statevalue as 1. if STA is not in power save state, we get thepeer_ps_statevalue as 0. Ifps_stateevent is disabled, we get thepeer_ps_statevalue as 2.We can enable/disable the
ps_stateevents using the debugfs flag "ps_state_enable"echo Y >
/sys/kernel/debug/ieee80211/phyX/ath10k/ps_state_enableY = 1 to enable and Y = 0 to disable
Tested in QCA4019 with firmware ver 10.4-3.2.1.1-00011
Quoted 8 lines
Quoted 2 lines
Signed-off-by Maharaja Kennadyrajan <[email protected]>Signed-off-by Kalle Valo <[email protected]>This introduced a new warning:
drivers/net/wireless/ath/ath10k/wmi.c:5061:1: warning: symbol 'ath10k_wmi_event_peer_sta_ps_state_chg' was not declared. Should it be static?
[Maha]: Yes, it should be static.
Quoted 1 line
I fixed this in the pending branch.
[Maha]: Thanks Kalle.
Signature · 2 lines
Regards, Maha
Quoted 16 lines · Maharaja Kennadyrajan
This patch helps to get the power save state change of each peer connected to the AP. With
WMI_10_4_PEER_STA_PS_STATECHG_EVENTIDevent, ps state of each peer is reported to user space via debugfs.Use the below command to get the ps state of each sta:
cat /sys/kernel/debug/ieee80211/phyX/netdev::wlanX/stations/ XX:XX:XX:XX:XX:XX/peer_ps_stateIf STA is in power save state, we get the
peer_ps_statevalue as 1. if STA is not in power save state, we get thepeer_ps_statevalue as 0. Ifps_stateevent is disabled, we get thepeer_ps_statevalue as 2.We can enable/disable the
ps_stateevents using the debugfs flag "ps_state_enable"
Quoted 8 lines
echo Y >
/sys/kernel/debug/ieee80211/phyX/ath10k/ps_state_enableY = 1 to enable and Y = 0 to disable
Tested in QCA4019 with firmware ver 10.4-3.2.1.1-00011
Signed-off-by Maharaja Kennadyrajan <[email protected]>Signed-off-by Kalle Valo <[email protected]>
Patch applied to ath-next branch of ath.git, thanks.
d70c0d463f9d ath10k: add debugfs support to get power save state change of STA
Signature · 3 lines
https://patchwork.kernel.org/patch/10603779/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
Quoted 16 lines · Maharaja Kennadyrajan
This patch helps to get the power save state change of each peer connected to the AP. With
WMI_10_4_PEER_STA_PS_STATECHG_EVENTIDevent, ps state of each peer is reported to user space via debugfs.Use the below command to get the ps state of each sta:
cat /sys/kernel/debug/ieee80211/phyX/netdev::wlanX/stations/ XX:XX:XX:XX:XX:XX/peer_ps_stateIf STA is in power save state, we get the
peer_ps_statevalue as 1. if STA is not in power save state, we get thepeer_ps_statevalue as 0. Ifps_stateevent is disabled, we get thepeer_ps_statevalue as 2.We can enable/disable the
ps_stateevents using the debugfs flag "ps_state_enable"
Quoted 8 lines
echo Y >
/sys/kernel/debug/ieee80211/phyX/ath10k/ps_state_enableY = 1 to enable and Y = 0 to disable
Tested in QCA4019 with firmware ver 10.4-3.2.1.1-00011
Signed-off-by Maharaja Kennadyrajan <[email protected]>Signed-off-by Kalle Valo <[email protected]>
Patch applied to ath-next branch of ath.git, thanks.
d70c0d463f9d ath10k: add debugfs support to get power save state change of STA
Signature · 9 lines
https://patchwork.kernel.org/patch/10603779/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches _______________________________________________ ath10k mailing list [email protected] http://lists.infradead.org/mailman/listinfo/ath10k