Message ID | 20230320164334.3325886-5-quic_mkenna@quicinc.com |
---|---|
State | Superseded |
Headers | show |
Series | Add AP power save support | expand |
Hi Maharaja, Thank you for the patch! Perhaps something to improve: [auto build test WARNING on wireless-next/main] [also build test WARNING on kvalo-ath/ath-next next-20230320] [cannot apply to wireless/main linus/master v6.3-rc3] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/Maharaja-Kennadyrajan/wifi-nl80211-rename-NL80211_CMD_SET_BEACON-to-NL80211_CMD_UDPATE_AP/20230321-005501 base: https://git.kernel.org/pub/scm/linux/kernel/git/wireless/wireless-next.git main patch link: https://lore.kernel.org/r/20230320164334.3325886-5-quic_mkenna%40quicinc.com patch subject: [PATCH v2 4/4] wifi: ath11k: add AP power save support config: i386-buildonly-randconfig-r006-20230320 (https://download.01.org/0day-ci/archive/20230321/202303210807.4SdWf5Ix-lkp@intel.com/config) compiler: clang version 14.0.6 (https://github.com/llvm/llvm-project f28c006a5895fc0e329fe15fead81e37457cb1d1) reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # https://github.com/intel-lab-lkp/linux/commit/289c49facf48da5a221a3c8072f97c4641eca9f0 git remote add linux-review https://github.com/intel-lab-lkp/linux git fetch --no-tags linux-review Maharaja-Kennadyrajan/wifi-nl80211-rename-NL80211_CMD_SET_BEACON-to-NL80211_CMD_UDPATE_AP/20230321-005501 git checkout 289c49facf48da5a221a3c8072f97c4641eca9f0 # save the config file mkdir build_dir && cp config build_dir/.config COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=i386 olddefconfig COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=i386 SHELL=/bin/bash drivers/net/wireless/ath/ath11k/ If you fix the issue, kindly add following tag where applicable | Reported-by: kernel test robot <lkp@intel.com> | Link: https://lore.kernel.org/oe-kbuild-all/202303210807.4SdWf5Ix-lkp@intel.com/ All warnings (new ones prefixed by >>): >> drivers/net/wireless/ath/ath11k/mac.c:3218:6: warning: no previous prototype for function 'ath11k_mac_ap_ps_recalc' [-Wmissing-prototypes] void ath11k_mac_ap_ps_recalc(struct ath11k *ar) ^ drivers/net/wireless/ath/ath11k/mac.c:3218:1: note: declare 'static' if the function is not intended to be used outside of this translation unit void ath11k_mac_ap_ps_recalc(struct ath11k *ar) ^ static 1 warning generated. vim +/ath11k_mac_ap_ps_recalc +3218 drivers/net/wireless/ath/ath11k/mac.c 3217 > 3218 void ath11k_mac_ap_ps_recalc(struct ath11k *ar) 3219 { 3220 struct ath11k_vif *arvif; 3221 enum ath11k_ap_ps_state state = ATH11K_AP_PS_STATE_OFF; 3222 int ret; 3223 bool allow_ap_ps = true; 3224 3225 lockdep_assert_held(&ar->conf_mutex); 3226 3227 list_for_each_entry(arvif, &ar->arvifs, list) { 3228 if (arvif->vdev_type == WMI_VDEV_TYPE_STA || 3229 !arvif->vif_ap_ps_enabled) { 3230 allow_ap_ps = false; 3231 break; 3232 } 3233 } 3234 3235 if (!allow_ap_ps) 3236 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "ap ps is not allowed\n"); 3237 3238 if (allow_ap_ps && !ar->num_stations && ar->ap_ps_enabled) 3239 state = ATH11K_AP_PS_STATE_ON; 3240 3241 if (ar->ap_ps_state == state) 3242 return; 3243 3244 ret = ath11k_wmi_pdev_ap_ps_cmd_send(ar, ar->pdev->pdev_id, state); 3245 if (ret) { 3246 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, 3247 "failed to send ap ps command pdev_id %u state %u\n", 3248 ar->pdev->pdev_id, state); 3249 return; 3250 } 3251 3252 ar->ap_ps_state = state; 3253 } 3254
Hi Maharaja, Thank you for the patch! Perhaps something to improve: [auto build test WARNING on wireless-next/main] [also build test WARNING on kvalo-ath/ath-next next-20230320] [cannot apply to wireless/main linus/master v6.3-rc3] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/Maharaja-Kennadyrajan/wifi-nl80211-rename-NL80211_CMD_SET_BEACON-to-NL80211_CMD_UDPATE_AP/20230321-005501 base: https://git.kernel.org/pub/scm/linux/kernel/git/wireless/wireless-next.git main patch link: https://lore.kernel.org/r/20230320164334.3325886-5-quic_mkenna%40quicinc.com patch subject: [PATCH v2 4/4] wifi: ath11k: add AP power save support config: i386-randconfig-a005 (https://download.01.org/0day-ci/archive/20230321/202303210910.Ag8f94jv-lkp@intel.com/config) compiler: gcc-11 (Debian 11.3.0-8) 11.3.0 reproduce (this is a W=1 build): # https://github.com/intel-lab-lkp/linux/commit/289c49facf48da5a221a3c8072f97c4641eca9f0 git remote add linux-review https://github.com/intel-lab-lkp/linux git fetch --no-tags linux-review Maharaja-Kennadyrajan/wifi-nl80211-rename-NL80211_CMD_SET_BEACON-to-NL80211_CMD_UDPATE_AP/20230321-005501 git checkout 289c49facf48da5a221a3c8072f97c4641eca9f0 # save the config file mkdir build_dir && cp config build_dir/.config make W=1 O=build_dir ARCH=i386 olddefconfig make W=1 O=build_dir ARCH=i386 SHELL=/bin/bash drivers/net/wireless/ath/ath11k/ If you fix the issue, kindly add following tag where applicable | Reported-by: kernel test robot <lkp@intel.com> | Link: https://lore.kernel.org/oe-kbuild-all/202303210910.Ag8f94jv-lkp@intel.com/ All warnings (new ones prefixed by >>): >> drivers/net/wireless/ath/ath11k/mac.c:3218:6: warning: no previous prototype for 'ath11k_mac_ap_ps_recalc' [-Wmissing-prototypes] 3218 | void ath11k_mac_ap_ps_recalc(struct ath11k *ar) | ^~~~~~~~~~~~~~~~~~~~~~~ vim +/ath11k_mac_ap_ps_recalc +3218 drivers/net/wireless/ath/ath11k/mac.c 3217 > 3218 void ath11k_mac_ap_ps_recalc(struct ath11k *ar) 3219 { 3220 struct ath11k_vif *arvif; 3221 enum ath11k_ap_ps_state state = ATH11K_AP_PS_STATE_OFF; 3222 int ret; 3223 bool allow_ap_ps = true; 3224 3225 lockdep_assert_held(&ar->conf_mutex); 3226 3227 list_for_each_entry(arvif, &ar->arvifs, list) { 3228 if (arvif->vdev_type == WMI_VDEV_TYPE_STA || 3229 !arvif->vif_ap_ps_enabled) { 3230 allow_ap_ps = false; 3231 break; 3232 } 3233 } 3234 3235 if (!allow_ap_ps) 3236 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "ap ps is not allowed\n"); 3237 3238 if (allow_ap_ps && !ar->num_stations && ar->ap_ps_enabled) 3239 state = ATH11K_AP_PS_STATE_ON; 3240 3241 if (ar->ap_ps_state == state) 3242 return; 3243 3244 ret = ath11k_wmi_pdev_ap_ps_cmd_send(ar, ar->pdev->pdev_id, state); 3245 if (ret) { 3246 ath11k_dbg(ar->ab, ATH11K_DBG_MAC, 3247 "failed to send ap ps command pdev_id %u state %u\n", 3248 ar->pdev->pdev_id, state); 3249 return; 3250 } 3251 3252 ar->ap_ps_state = state; 3253 } 3254
diff --git a/drivers/net/wireless/ath/ath11k/core.c b/drivers/net/wireless/ath/ath11k/core.c index 75fdbe4ef83a..5cf9203b751e 100644 --- a/drivers/net/wireless/ath/ath11k/core.c +++ b/drivers/net/wireless/ath/ath11k/core.c @@ -117,6 +117,7 @@ static const struct ath11k_hw_params ath11k_hw_params[] = { .tx_ring_size = DP_TCL_DATA_RING_SIZE, .smp2p_wow_exit = false, .ftm_responder = true, + .supports_ap_ps = true, }, { .hw_rev = ATH11K_HW_IPQ6018_HW10, @@ -200,6 +201,7 @@ static const struct ath11k_hw_params ath11k_hw_params[] = { .smp2p_wow_exit = false, .support_fw_mac_sequence = false, .ftm_responder = true, + .supports_ap_ps = true, }, { .name = "qca6390 hw2.0", @@ -285,6 +287,7 @@ static const struct ath11k_hw_params ath11k_hw_params[] = { .smp2p_wow_exit = false, .support_fw_mac_sequence = true, .ftm_responder = false, + .supports_ap_ps = false, }, { .name = "qcn9074 hw1.0", @@ -367,6 +370,7 @@ static const struct ath11k_hw_params ath11k_hw_params[] = { .smp2p_wow_exit = false, .support_fw_mac_sequence = false, .ftm_responder = true, + .supports_ap_ps = true, }, { .name = "wcn6855 hw2.0", @@ -452,6 +456,7 @@ static const struct ath11k_hw_params ath11k_hw_params[] = { .smp2p_wow_exit = false, .support_fw_mac_sequence = true, .ftm_responder = false, + .supports_ap_ps = false, }, { .name = "wcn6855 hw2.1", @@ -535,6 +540,7 @@ static const struct ath11k_hw_params ath11k_hw_params[] = { .smp2p_wow_exit = false, .support_fw_mac_sequence = true, .ftm_responder = false, + .supports_ap_ps = false, }, { .name = "wcn6750 hw1.0", @@ -616,6 +622,7 @@ static const struct ath11k_hw_params ath11k_hw_params[] = { .smp2p_wow_exit = true, .support_fw_mac_sequence = true, .ftm_responder = false, + .supports_ap_ps = false, }, { .hw_rev = ATH11K_HW_IPQ5018_HW10, @@ -696,6 +703,7 @@ static const struct ath11k_hw_params ath11k_hw_params[] = { .smp2p_wow_exit = false, .support_fw_mac_sequence = false, .ftm_responder = true, + .supports_ap_ps = true, }, }; diff --git a/drivers/net/wireless/ath/ath11k/core.h b/drivers/net/wireless/ath/ath11k/core.h index 0830276e5028..fefb1fb5220d 100644 --- a/drivers/net/wireless/ath/ath11k/core.h +++ b/drivers/net/wireless/ath/ath11k/core.h @@ -363,6 +363,7 @@ struct ath11k_vif { struct ieee80211_chanctx_conf chanctx; struct ath11k_arp_ns_offload arp_ns_offload; struct ath11k_rekey_data rekey_data; + bool vif_ap_ps_enabled; #ifdef CONFIG_ATH11K_DEBUGFS struct dentry *debugfs_twt; @@ -589,6 +590,11 @@ struct ath11k_per_peer_tx_stats { #define ATH11K_FLUSH_TIMEOUT (5 * HZ) #define ATH11K_VDEV_DELETE_TIMEOUT_HZ (5 * HZ) +enum ath11k_ap_ps_state { + ATH11K_AP_PS_STATE_OFF, + ATH11K_AP_PS_STATE_ON, +}; + struct ath11k { struct ath11k_base *ab; struct ath11k_pdev *pdev; @@ -732,6 +738,8 @@ struct ath11k { /* protected by conf_mutex */ bool ps_state_enable; bool ps_timekeeper_enable; + bool ap_ps_enabled; + enum ath11k_ap_ps_state ap_ps_state; }; struct ath11k_band_cap { diff --git a/drivers/net/wireless/ath/ath11k/hw.h b/drivers/net/wireless/ath/ath11k/hw.h index 0be4e1232384..40953e117cc5 100644 --- a/drivers/net/wireless/ath/ath11k/hw.h +++ b/drivers/net/wireless/ath/ath11k/hw.h @@ -225,6 +225,7 @@ struct ath11k_hw_params { bool smp2p_wow_exit; bool support_fw_mac_sequence; bool ftm_responder; + bool supports_ap_ps; }; struct ath11k_hw_ops { diff --git a/drivers/net/wireless/ath/ath11k/mac.c b/drivers/net/wireless/ath/ath11k/mac.c index cad832e0e6b8..db0d772ff7c7 100644 --- a/drivers/net/wireless/ath/ath11k/mac.c +++ b/drivers/net/wireless/ath/ath11k/mac.c @@ -3215,6 +3215,43 @@ static int ath11k_mac_config_obss_pd(struct ath11k *ar, return 0; } +void ath11k_mac_ap_ps_recalc(struct ath11k *ar) +{ + struct ath11k_vif *arvif; + enum ath11k_ap_ps_state state = ATH11K_AP_PS_STATE_OFF; + int ret; + bool allow_ap_ps = true; + + lockdep_assert_held(&ar->conf_mutex); + + list_for_each_entry(arvif, &ar->arvifs, list) { + if (arvif->vdev_type == WMI_VDEV_TYPE_STA || + !arvif->vif_ap_ps_enabled) { + allow_ap_ps = false; + break; + } + } + + if (!allow_ap_ps) + ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "ap ps is not allowed\n"); + + if (allow_ap_ps && !ar->num_stations && ar->ap_ps_enabled) + state = ATH11K_AP_PS_STATE_ON; + + if (ar->ap_ps_state == state) + return; + + ret = ath11k_wmi_pdev_ap_ps_cmd_send(ar, ar->pdev->pdev_id, state); + if (ret) { + ath11k_dbg(ar->ab, ATH11K_DBG_MAC, + "failed to send ap ps command pdev_id %u state %u\n", + ar->pdev->pdev_id, state); + return; + } + + ar->ap_ps_state = state; +} + static void ath11k_mac_op_bss_info_changed(struct ieee80211_hw *hw, struct ieee80211_vif *vif, struct ieee80211_bss_conf *info, @@ -3567,6 +3604,16 @@ static void ath11k_mac_op_bss_info_changed(struct ieee80211_hw *hw, vif->addr, arvif->arp_ns_offload.ipv4_addr); } + if ((changed & BSS_CHANGED_PS) && vif->type == NL80211_IFTYPE_AP) { + if (!info->ap_ps_enable) + arvif->vif_ap_ps_enabled = false; + else + arvif->vif_ap_ps_enabled = true; + + ar->ap_ps_enabled = info->ap_ps_enable; + ath11k_mac_ap_ps_recalc(ar); + } + mutex_unlock(&ar->conf_mutex); } @@ -4651,6 +4698,8 @@ static int ath11k_mac_station_add(struct ath11k *ar, ath11k_dbg(ab, ATH11K_DBG_MAC, "Added peer: %pM for VDEV: %d\n", sta->addr, arvif->vdev_id); + ath11k_mac_ap_ps_recalc(ar); + if (ath11k_debugfs_is_extd_tx_stats_enabled(ar)) { arsta->tx_stats = kzalloc(sizeof(*arsta->tx_stats), GFP_KERNEL); if (!arsta->tx_stats) { @@ -4810,6 +4859,8 @@ static int ath11k_mac_op_sta_state(struct ieee80211_hw *hw, kfree(arsta->rx_stats); arsta->rx_stats = NULL; + + ath11k_mac_ap_ps_recalc(ar); } else if (old_state == IEEE80211_STA_AUTH && new_state == IEEE80211_STA_ASSOC && (vif->type == NL80211_IFTYPE_AP || @@ -6599,6 +6650,8 @@ static int ath11k_mac_op_add_interface(struct ieee80211_hw *hw, ret); } + ath11k_mac_ap_ps_recalc(ar); + mutex_unlock(&ar->conf_mutex); return 0; @@ -6703,6 +6756,8 @@ static void ath11k_mac_op_remove_interface(struct ieee80211_hw *hw, ath11k_debugfs_remove_interface(arvif); + ath11k_mac_ap_ps_recalc(ar); + /* TODO: recal traffic pause state based on the available vdevs */ mutex_unlock(&ar->conf_mutex); @@ -9122,6 +9177,9 @@ static int __ath11k_mac_register(struct ath11k *ar) ieee80211_hw_set(ar->hw, USES_RSS); } + if (ar->ab->hw_params.supports_ap_ps) + ieee80211_hw_set(ar->hw, SUPPORTS_AP_PS); + ar->hw->wiphy->features |= NL80211_FEATURE_STATIC_SMPS; ar->hw->wiphy->flags |= WIPHY_FLAG_IBSS_RSN; diff --git a/drivers/net/wireless/ath/ath11k/wmi.c b/drivers/net/wireless/ath/ath11k/wmi.c index 27f3fceb33c5..02b14ba6ad45 100644 --- a/drivers/net/wireless/ath/ath11k/wmi.c +++ b/drivers/net/wireless/ath/ath11k/wmi.c @@ -1290,6 +1290,38 @@ ath11k_wmi_rx_reord_queue_remove(struct ath11k *ar, return ret; } +int ath11k_wmi_pdev_ap_ps_cmd_send(struct ath11k *ar, u32 pdev_id, + u32 param_value) +{ + struct ath11k_pdev_wmi *wmi = ar->wmi; + struct wmi_pdev_ap_ps_cmd *cmd; + struct sk_buff *skb; + int ret; + + skb = ath11k_wmi_alloc_skb(wmi->wmi_ab, sizeof(*cmd)); + if (!skb) + return -ENOMEM; + + cmd = (struct wmi_pdev_ap_ps_cmd *)skb->data; + cmd->tlv_header = FIELD_PREP(WMI_TLV_TAG, + WMI_TAG_PDEV_GREEN_AP_PS_ENABLE_CMD) | + FIELD_PREP(WMI_TLV_LEN, sizeof(*cmd) - TLV_HDR_SIZE); + cmd->pdev_id = pdev_id; + cmd->param_value = param_value; + + ret = ath11k_wmi_cmd_send(wmi, skb, WMI_PDEV_GREEN_AP_PS_ENABLE_CMDID); + if (ret) { + ath11k_warn(ar->ab, "failed to send ap ps enable/disable cmd\n"); + dev_kfree_skb(skb); + } + + ath11k_dbg(ar->ab, ATH11K_DBG_WMI, + "wmi pdev ap ps set pdev id %d value %d\n", + pdev_id, param_value); + + return ret; +} + int ath11k_wmi_pdev_set_param(struct ath11k *ar, u32 param_id, u32 param_value, u8 pdev_id) { diff --git a/drivers/net/wireless/ath/ath11k/wmi.h b/drivers/net/wireless/ath/ath11k/wmi.h index b23b7a22bc9a..8b37dd935a95 100644 --- a/drivers/net/wireless/ath/ath11k/wmi.h +++ b/drivers/net/wireless/ath/ath11k/wmi.h @@ -3037,6 +3037,12 @@ struct wmi_fwtest_set_param_cmd_param { u32 param_value; }; +struct wmi_pdev_ap_ps_cmd { + u32 tlv_header; + u32 pdev_id; + u32 param_value; +} __packed; + struct wmi_pdev_set_param_cmd { u32 tlv_header; u32 pdev_id; @@ -6445,5 +6451,7 @@ int ath11k_wmi_pdev_set_bios_sar_table_param(struct ath11k *ar, const u8 *sar_va int ath11k_wmi_pdev_set_bios_geo_table_param(struct ath11k *ar); int ath11k_wmi_sta_keepalive(struct ath11k *ar, const struct wmi_sta_keepalive_arg *arg); +int ath11k_wmi_pdev_ap_ps_cmd_send(struct ath11k *ar, u32 pdev_id, + u32 value); #endif