[PATCH v4 2/2] wifi: ath11k: move update channel list to worker when wait flag is set
Kalle Valo
kvalo at kernel.org
Tue Dec 17 06:53:11 PST 2024
Kang Yang <quic_kangyang at quicinc.com> writes:
> From: Wen Gong <quic_wgong at quicinc.com>
>
> With previous patch "wifi: ath11k: move update channel list from update
> reg worker to reg notifier", ath11k_reg_update_chan_list() will be
> called during reg_process_self_managed_hint().
>
> reg_process_self_managed_hint() will hold rtnl_lock all the time.
> But ath11k_reg_update_chan_list() may increase the occupation time of
> rtnl_lock, because wait flag is set and wait_for_completion_timeout()
> will be called when 11d/hw scan is running.
>
> Should minimize the occupation time of rtnl_lock as much as possible.
>
> Move update channel list operation to a new worker, so that
> wait_for_completion_timeout() won't be called and will not increase the
> occupation time of rtnl_lock.
Maybe the last two paragraphs could be merged (and edited) like this:
We should minimize the occupation time of rtnl_lock as much as possible
to avoid interfering with rest of the system. So move the update channel
list operation to a new worker, so that wait_for_completion_timeout()
won't be called and will not increase the occupation time of rtnl_lock.
> --- a/drivers/net/wireless/ath/ath11k/core.h
> +++ b/drivers/net/wireless/ath/ath11k/core.h
> @@ -685,7 +685,7 @@ struct ath11k {
> struct mutex conf_mutex;
> /* protects the radio specific data like debug stats, ppdu_stats_info stats,
> * vdev_stop_status info, scan data, ath11k_sta info, ath11k_vif info,
> - * channel context data, survey info, test mode data.
> + * channel context data, survey info, test mode data, channel_update_queue.
> */
> spinlock_t data_lock;
Usually is best to add a comment the data you are protecting, in this
case the new fields in struct ath11k.
> @@ -743,6 +743,8 @@ struct ath11k {
> struct completion bss_survey_done;
>
> struct work_struct regd_update_work;
> + struct work_struct channel_update_work;
> + struct list_head channel_update_queue;
So here add '/* protected with data_lock */' or similar before channel_update_queue.
> @@ -231,8 +206,16 @@ int ath11k_reg_update_chan_list(struct ath11k *ar, bool wait)
> }
> }
>
> - ret = ath11k_wmi_send_scan_chan_list_cmd(ar, params);
> - kfree(params);
> + if (wait) {
> + spin_lock_bh(&ar->data_lock);
> + list_add_tail(¶ms->list, &ar->channel_update_queue);
> + spin_unlock_bh(&ar->data_lock);
> +
> + queue_work(ar->ab->workqueue, &ar->channel_update_work);
> + } else {
> + ret = ath11k_wmi_send_scan_chan_list_cmd(ar, params);
> + kfree(params);
> + }
You can avoid the else branch like this:
if (wait) {
spin_lock_bh(&ar->data_lock);
list_add_tail(¶ms->list, &ar->channel_update_queue);
spin_unlock_bh(&ar->data_lock);
queue_work(ar->ab->workqueue, &ar->channel_update_work);
return 0;
}
ret = ath11k_wmi_send_scan_chan_list_cmd(ar, params);
kfree(params);
--
https://patchwork.kernel.org/project/linux-wireless/list/
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
More information about the ath11k
mailing list