ath10k: cleanups
cover ath10k: cleanups
Michal Kazior (5):
ath10k: replace debug_mtx with conf_mutex
ath10k: change wmi structure access
ath10k: fix coding style
ath10k: use ath10k_warn() instead of ath10k_info()
ath10k: fix function prototype argument name
drivers/net/wireless/ath/ath10k/core.h | 19 ++++-- drivers/net/wireless/ath/ath10k/debug.c | 10 +-- drivers/net/wireless/ath/ath10k/debug.h | 4 +- drivers/net/wireless/ath/ath10k/htc.h | 5 +- drivers/net/wireless/ath/ath10k/mac.c | 10 +-- drivers/net/wireless/ath/ath10k/txrx.c | 16 ++--- drivers/net/wireless/ath/ath10k/wmi.c | 104 +++++++++++-------------------- 7 files changed, 76 insertions(+), 92 deletions(-)
Signature · 1 line
1.7.9.5
PATCH 1/5 ath10k: replace debug_mtx with conf_mutex
It's not a good to have too many mutexes. The
patch simplifies locking of debufs to useconf_mutex.
--- drivers/net/wireless/ath/ath10k/core.h | 1 - drivers/net/wireless/ath/ath10k/debug.c | 10 +++++----- drivers/net/wireless/ath/ath10k/debug.h | 4 ++-- 3 files changed, 7 insertions(+), 8 deletions(-)
drivers/net/wireless/ath/ath10k/core.h +0 -1
@@ -240,7 +240,6 @@ struct ath10k_debug {u32 wmi_service_bitmap[WMI_SERVICE_BM_SIZE ];struct completion event_stats_compl; -struct mutex debug_mtx; };struct ath10k {
drivers/net/wireless/ath/ath10k/debug.c +5 -5
@@ -113,7 +113,7 @@ static ssize_t ath10k_read_wmi_services(struct file *file,if (!buf)return -ENOMEM ; -mutex_lock (&ar->debug.debug_mtx); +mutex_lock (&ar->conf_mutex);if (len > buf_len) len = buf_len;
@@ -134,7 +134,7 @@ static ssize_t ath10k_read_wmi_services(struct file *file, ret_cnt =simple_read_from_buffer (user_buf, count, ppos, buf, len); -mutex_unlock (&ar->debug.debug_mtx); +mutex_unlock (&ar->conf_mutex);kfree (buf);return ret_cnt;
@@ -176,7 +176,7 @@ static ssize_t ath10k_read_fw_stats(struct file *file, char __user *user_buf,return -ETIMEDOUT ; } -mutex_lock (&ar->debug.debug_mtx); +mutex_lock (&ar->conf_mutex); len +=scnprintf (buf + len, buf_len - len,"\n" ); len += scnprintf(buf + len, buf_len - len, "%30s\n",
@@ -306,7 +306,7 @@ static ssize_t ath10k_read_fw_stats(struct file *file, char __user *user_buf, ret_cnt =simple_read_from_buffer (user_buf, count, ppos, buf, len); -mutex_unlock (&ar->debug.debug_mtx); +mutex_unlock (&ar->conf_mutex);kfree (buf);return ret_cnt;
@@ -328,7 +328,7 @@ int ath10k_debug_create(struct ath10k *ar)return -ENOMEM ;init_completion (&ar->debug.event_stats_compl); -mutex_init (&ar->debug.debug_mtx); +mutex_init (&ar->conf_mutex);debugfs_create_file ("fw_stats" ,S_IRUSR , ar->debug.debugfs_phy, ar, &fops_fw_stats);
drivers/net/wireless/ath/ath10k/debug.h +2 -2
@@ -61,7 +61,7 @@ static inline void ath10k_debug_read_target_stats(struct ath10k *ar,int num_pdev_stats, num_vdev_stats, num_peer_stats;int i; -mutex_lock (&ar->debug.debug_mtx); +mutex_lock (&ar->conf_mutex); fw_stats = &ar->debug.target_stats;
@@ -149,7 +149,7 @@ static inline void ath10k_debug_read_target_stats(struct ath10k *ar, } } -mutex_unlock (&ar->debug.debug_mtx); +mutex_unlock (&ar->conf_mutex);complete (&ar->debug.event_stats_compl); }
Signature · 1 line
1.7.9.5
PATCH 1/5 ath10k: replace debug_mtx with conf_mutex
Quoted 5 lines · Michal Kazior
It's not a good to have too many mutexes. The
patch simplifies locking of debufs to useconf_mutex.Signed-off-by Michal Kazior <[email protected]>
[...]
drivers/net/wireless/ath/ath10k/debug.c int ath10k_debug_create(struct ath10k *ar) · line 331
Quoted 6 lines
drivers/net/wireless/ath/ath10k/debug.c +1
-1@@ -328,7 +328,7 @@ int ath10k_debug_create(struct ath10k *ar)return -ENOMEM ;init_completion (&ar->debug.event_stats_compl); -mutex_init (&ar->debug.debug_mtx); +mutex_init (&ar->conf_mutex);
Can this be right? We already initialise conf_mutex in core.c.
Signature · 1 line
Kalle Valo
PATCH 1/5 ath10k: replace debug_mtx with conf_mutex
Quoted 10 lines · Kalle Valo
Quoted 5 lines · Michal Kazior
It's not a good to have too many mutexes. The
patch simplifies locking of debufs to useconf_mutex.Signed-off-by Michal Kazior <[email protected]>[...]
Quoted 8 lines
drivers/net/wireless/ath/ath10k/debug.c int ath10k_debug_create(struct ath10k *ar) · line 331
Quoted 6 lines
drivers/net/wireless/ath/ath10k/debug.c +1
-1@@ -328,7 +328,7 @@ int ath10k_debug_create(struct ath10k *ar)return -ENOMEM ;init_completion (&ar->debug.event_stats_compl); -mutex_init (&ar->debug.debug_mtx); +mutex_init (&ar->conf_mutex);Can this be right? We already initialise
conf_mutexincore.c.
Good catch, thanks! The mutex_init() is already initialized elsewhere. No need to re-initialize it here.
-- Pozdrawiam / Best regards, Michal Kazior.
PATCH 2/5 ath10k: change wmi structure access
In reply to Michal KaziorWMI structure shouldn't be a magic void pointer.
--- drivers/net/wireless/ath/ath10k/core.h | 18 +++++- drivers/net/wireless/ath/ath10k/htc.h | 3 +- drivers/net/wireless/ath/ath10k/wmi.c | 104 +++++++++++--------------------- 3 files changed, 53 insertions(+), 72 deletions(-)
drivers/net/wireless/ath/ath10k/core.h +15 -3
@@ -23,6 +23,7 @@#include <linux/types.h> #include <linux/pci.h> +#include "htc.h" #include "hw.h" #include "targaddrs.h" #include "regtable.h"
@@ -114,6 +115,19 @@ struct ath10k_bmi {bool done_sent; }; +struct ath10k_wmi { +struct ath10k *ar; + +enum htc_endpoint_id eid; +struct completion service_ready; +struct completion unified_ready; +atomic_t pending_tx_count; +wait_queue_head_t wq; + +struct sk_buff_head wmi_event_list; +struct work_struct wmi_event_work; +}; +struct ath10k_peer_stat {u8 peer_macaddr[ETH_ALEN ];u32 peer_rssi;
@@ -271,9 +285,7 @@ struct ath10k {const struct ath10k_hif_ops *ops; } hif; -struct { -void *wmi; - } modules; +struct ath10k_wmi wmi;#if defined(CONFIG_PM_SLEEP )wait_queue_head_t event_queue;
drivers/net/wireless/ath/ath10k/htc.h +2 -1
@@ -21,8 +21,9 @@#include <linux/kernel.h> #include <linux/list.h> #include <linux/bug.h> -#include "core.h" +#include <linux/skbuff.h> +struct ath10k ;#define MAKE_SERVICE_ID (group, index) \ (int)(((int)(group) << 8) | (int)(index))
drivers/net/wireless/ath/ath10k/wmi.c +36 -68
259 lines not on this page · raw message
Signature · 1 line
1.7.9.5
PATCH 3/5 ath10k: fix coding style
In reply to Michal Kazior--- drivers/net/wireless/ath/ath10k/mac.c | 8 +++++--- drivers/net/wireless/ath/ath10k/txrx.c | 16 +++++++++------- 2 files changed, 14 insertions(+), 10 deletions(-)
drivers/net/wireless/ath/ath10k/mac.c +5 -3
@@ -1232,10 +1232,12 @@ static void ath10k_tx_h_update_wep_key(struct sk_buff *skb) ret =wmi_vdev_set_param (ar, arvif->vdev_id,WMI_VDEV_PARAM_DEF_KEYID , key->keyidx); -if (!ret) - arvif->def_wep_key_index = key->keyidx; -else +if (ret) {ath10k_warn ("could not update wep keyidx (%d)\n" , ret); +return ; + } + + arvif->def_wep_key_index = key->keyidx; }static void ath10k_tx_h_add_p2p_noa_ie (struct ath10k *ar,struct sk_buff *skb)
drivers/net/wireless/ath/ath10k/txrx.c +9 -7
@@ -31,14 +31,16 @@ static void ath10k_report_offchan_tx(struct ath10k *ar, struct sk_buff *skb)* offchan_tx_completed for a different skb. Prevent this by using * offchan_tx_skb. */ spin_lock_bh (&ar->data_lock); -if (ar->offchan_tx_skb == skb) { -complete (&ar->offchan_tx_completed); - ar->offchan_tx_skb =NULL ;/* just for sanity */ - -ath10k_dbg (ATH10K_DBG_HTT ,"completed offchannel skb %p\n" , skb); +if (ar->offchan_tx_skb != skb) { +ath10k_warn ("completed old offchannel frame\n" ); + goto out; } -else -ath10k_warn ("completed late offchannel skb %p\n" , skb); + +complete (&ar->offchan_tx_completed); + ar->offchan_tx_skb =NULL ;/* just for sanity */ + +ath10k_dbg (ATH10K_DBG_HTT ,"completed offchannel skb %p\n" , skb); +out:spin_unlock_bh (&ar->data_lock); }
Signature · 1 line
1.7.9.5
PATCH 4/5 ath10k: use ath10k_warn() instead of ath10k_info()
In reply to Michal Kazior--- drivers/net/wireless/ath/ath10k/mac.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/ath/ath10k/mac.c +1 -1
@@ -1327,7 +1327,7 @@ void ath10k_offchan_tx_work(struct work_struct *work)spin_unlock_bh (&ar->data_lock);if (peer) -ath10k_info ("peer %pM on vdev %d already present\n" , +ath10k_dbg (ATH10K_DBG_MAC ,"peer %pM on vdev %d already present\n" , peer_addr, vdev_id);if (!peer) {
Signature · 1 line
1.7.9.5
PATCH 5/5 ath10k: fix function prototype argument name
In reply to Michal KaziorThis argument is used to specify how much data we
want to pack up into a skbuff, no just headroom.
--- drivers/net/wireless/ath/ath10k/htc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/ath/ath10k/htc.h +1 -1
@@ -112,6 +112,6 @@ int ath10k_htc_send(struct htc_target *target, enum htc_endpoint_id eid, struct sk_buff *packet);void ath10k_htc_stop (struct htc_target *target);void ath10k_htc_destroy (struct htc_target *target); -struct sk_buff *ath10k_htc_alloc_skb (int extra_headroom); +struct sk_buff *ath10k_htc_alloc_skb (int size);#endif
Signature · 1 line
1.7.9.5
cover ath10k: cleanups
In reply to Michal KaziorQuoted 6 lines · Michal Kazior
Michal Kazior (5):
ath10k: replacedebug_mtxwithconf_mutex
ath10k: change wmi structure access
ath10k: fix coding style
ath10k: useath10k_warn()instead ofath10k_info()
ath10k: fix function prototype argument name
When you resend can you also rebase the patches, please? Quite a lot of conflicts in wmi.c
Signature · 1 line
Kalle Valo
v2 cover ath10k: cleanups
Rebased on top of latest master branch
(https://github.com/kvalo/ath10k)
Patch #1 updated.
Michal Kazior (5):
ath10k: replace debug_mtx with conf_mutex
ath10k: change wmi structure access
ath10k: fix coding style
ath10k: use ath10k_warn() instead of ath10k_info()
ath10k: fix function prototype argument name
drivers/net/wireless/ath/ath10k/core.h | 19 ++++-- drivers/net/wireless/ath/ath10k/debug.c | 9 ++- drivers/net/wireless/ath/ath10k/debug.h | 4 +- drivers/net/wireless/ath/ath10k/htc.h | 5 +- drivers/net/wireless/ath/ath10k/mac.c | 10 +-- drivers/net/wireless/ath/ath10k/txrx.c | 16 ++--- drivers/net/wireless/ath/ath10k/wmi.c | 105 +++++++++++-------------------- 7 files changed, 75 insertions(+), 93 deletions(-)
Signature · 1 line
1.7.9.5
PATCH v2 1/5 ath10k: replace debug_mtx with conf_mutex
It's not a good to have too many mutexes. The
patch simplifies locking of debufs to useconf_mutex.
---
v2: removed unnecessary mutex_init()
drivers/net/wireless/ath/ath10k/core.h | 1 - drivers/net/wireless/ath/ath10k/debug.c | 9 ++++----- drivers/net/wireless/ath/ath10k/debug.h | 4 ++-- 3 files changed, 6 insertions(+), 8 deletions(-)
drivers/net/wireless/ath/ath10k/core.h +0 -1
@@ -240,7 +240,6 @@ struct ath10k_debug {u32 wmi_service_bitmap[WMI_SERVICE_BM_SIZE ];struct completion event_stats_compl; -struct mutex debug_mtx; };struct ath10k {
drivers/net/wireless/ath/ath10k/debug.c +4 -5
@@ -113,7 +113,7 @@ static ssize_t ath10k_read_wmi_services(struct file *file,if (!buf)return -ENOMEM ; -mutex_lock (&ar->debug.debug_mtx); +mutex_lock (&ar->conf_mutex);if (len > buf_len) len = buf_len;
@@ -134,7 +134,7 @@ static ssize_t ath10k_read_wmi_services(struct file *file, ret_cnt =simple_read_from_buffer (user_buf, count, ppos, buf, len); -mutex_unlock (&ar->debug.debug_mtx); +mutex_unlock (&ar->conf_mutex);kfree (buf);return ret_cnt;
@@ -176,7 +176,7 @@ static ssize_t ath10k_read_fw_stats(struct file *file, char __user *user_buf,return -ETIMEDOUT ; } -mutex_lock (&ar->debug.debug_mtx); +mutex_lock (&ar->conf_mutex); len +=scnprintf (buf + len, buf_len - len,"\n" ); len += scnprintf(buf + len, buf_len - len, "%30s\n",
@@ -306,7 +306,7 @@ static ssize_t ath10k_read_fw_stats(struct file *file, char __user *user_buf, ret_cnt =simple_read_from_buffer (user_buf, count, ppos, buf, len); -mutex_unlock (&ar->debug.debug_mtx); +mutex_unlock (&ar->conf_mutex);kfree (buf);return ret_cnt;
@@ -328,7 +328,6 @@ int ath10k_debug_create(struct ath10k *ar)return -ENOMEM ;init_completion (&ar->debug.event_stats_compl); -mutex_init (&ar->debug.debug_mtx);debugfs_create_file ("fw_stats" ,S_IRUSR , ar->debug.debugfs_phy, ar, &fops_fw_stats);
drivers/net/wireless/ath/ath10k/debug.h +2 -2
@@ -61,7 +61,7 @@ static inline void ath10k_debug_read_target_stats(struct ath10k *ar,int num_pdev_stats, num_vdev_stats, num_peer_stats;int i; -mutex_lock (&ar->debug.debug_mtx); +mutex_lock (&ar->conf_mutex); fw_stats = &ar->debug.target_stats;
@@ -149,7 +149,7 @@ static inline void ath10k_debug_read_target_stats(struct ath10k *ar, } } -mutex_unlock (&ar->debug.debug_mtx); +mutex_unlock (&ar->conf_mutex);complete (&ar->debug.event_stats_compl); }
Signature · 1 line
1.7.9.5
PATCH v2 2/5 ath10k: change wmi structure access
In reply to Michal KaziorWMI structure shouldn't be a magic void pointer.
--- drivers/net/wireless/ath/ath10k/core.h | 18 +++++- drivers/net/wireless/ath/ath10k/htc.h | 3 +- drivers/net/wireless/ath/ath10k/wmi.c | 105 +++++++++++--------------------- 3 files changed, 53 insertions(+), 73 deletions(-)
drivers/net/wireless/ath/ath10k/core.h +15 -3
@@ -23,6 +23,7 @@#include <linux/types.h> #include <linux/pci.h> +#include "htc.h" #include "hw.h" #include "targaddrs.h" #include "regtable.h"
@@ -114,6 +115,19 @@ struct ath10k_bmi {bool done_sent; }; +struct ath10k_wmi { +struct ath10k *ar; + +enum htc_endpoint_id eid; +struct completion service_ready; +struct completion unified_ready; +atomic_t pending_tx_count; +wait_queue_head_t wq; + +struct sk_buff_head wmi_event_list; +struct work_struct wmi_event_work; +}; +struct ath10k_peer_stat {u8 peer_macaddr[ETH_ALEN ];u32 peer_rssi;
@@ -271,9 +285,7 @@ struct ath10k {const struct ath10k_hif_ops *ops; } hif; -struct { -void *wmi; - } modules; +struct ath10k_wmi wmi;#if defined(CONFIG_PM_SLEEP )wait_queue_head_t event_queue;
drivers/net/wireless/ath/ath10k/htc.h +2 -1
@@ -21,8 +21,9 @@#include <linux/kernel.h> #include <linux/list.h> #include <linux/bug.h> -#include "core.h" +#include <linux/skbuff.h> +struct ath10k ;#define MAKE_SERVICE_ID (group, index) \ (int)(((int)(group) << 8) | (int)(index))
drivers/net/wireless/ath/ath10k/wmi.c +36 -69
260 lines not on this page · raw message
Signature · 1 line
1.7.9.5
PATCH v2 3/5 ath10k: fix coding style
In reply to Michal Kazior--- drivers/net/wireless/ath/ath10k/mac.c | 8 +++++--- drivers/net/wireless/ath/ath10k/txrx.c | 16 +++++++++------- 2 files changed, 14 insertions(+), 10 deletions(-)
drivers/net/wireless/ath/ath10k/mac.c +5 -3
@@ -1235,10 +1235,12 @@ static void ath10k_tx_h_update_wep_key(struct sk_buff *skb) ret =ath10k_wmi_vdev_set_param (ar, arvif->vdev_id,WMI_VDEV_PARAM_DEF_KEYID , key->keyidx); -if (!ret) - arvif->def_wep_key_index = key->keyidx; -else +if (ret) {ath10k_warn ("could not update wep keyidx (%d)\n" , ret); +return ; + } + + arvif->def_wep_key_index = key->keyidx; }static void ath10k_tx_h_add_p2p_noa_ie (struct ath10k *ar,struct sk_buff *skb)
drivers/net/wireless/ath/ath10k/txrx.c +9 -7
@@ -31,14 +31,16 @@ static void ath10k_report_offchan_tx(struct ath10k *ar, struct sk_buff *skb)* offchan_tx_completed for a different skb. Prevent this by using * offchan_tx_skb. */ spin_lock_bh (&ar->data_lock); -if (ar->offchan_tx_skb == skb) { -complete (&ar->offchan_tx_completed); - ar->offchan_tx_skb =NULL ;/* just for sanity */ - -ath10k_dbg (ATH10K_DBG_HTT ,"completed offchannel skb %p\n" , skb); +if (ar->offchan_tx_skb != skb) { +ath10k_warn ("completed old offchannel frame\n" ); + goto out; } -else -ath10k_warn ("completed late offchannel skb %p\n" , skb); + +complete (&ar->offchan_tx_completed); + ar->offchan_tx_skb =NULL ;/* just for sanity */ + +ath10k_dbg (ATH10K_DBG_HTT ,"completed offchannel skb %p\n" , skb); +out:spin_unlock_bh (&ar->data_lock); }
Signature · 1 line
1.7.9.5
PATCH v2 4/5 ath10k: use ath10k_warn() instead of ath10k_info()
In reply to Michal Kazior--- drivers/net/wireless/ath/ath10k/mac.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/ath/ath10k/mac.c +1 -1
@@ -1330,7 +1330,7 @@ void ath10k_ath10k_offchan_tx_work(struct work_struct *work)spin_unlock_bh (&ar->data_lock);if (peer) -ath10k_info ("peer %pM on vdev %d already present\n" , +ath10k_dbg (ATH10K_DBG_MAC ,"peer %pM on vdev %d already present\n" , peer_addr, vdev_id);if (!peer) {
Signature · 1 line
1.7.9.5
PATCH v2 5/5 ath10k: fix function prototype argument name
In reply to Michal KaziorThis argument is used to specify how much data we
want to pack up into a skbuff, no just headroom.
--- drivers/net/wireless/ath/ath10k/htc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/ath/ath10k/htc.h +1 -1
@@ -112,6 +112,6 @@ int ath10k_htc_send(struct htc_target *target, enum htc_endpoint_id eid, struct sk_buff *packet);void ath10k_htc_stop (struct htc_target *target);void ath10k_htc_destroy (struct htc_target *target); -struct sk_buff *ath10k_htc_alloc_skb (int extra_headroom); +struct sk_buff *ath10k_htc_alloc_skb (int size);#endif
Signature · 1 line
1.7.9.5
v2 cover ath10k: cleanups
In reply to Michal KaziorQuoted 6 lines · Michal Kazior
Rebased on top of latest master branch
(https://github.com/kvalo/ath10k)Patch #1 updated.
Quoted 6 lines
Michal Kazior (5):
ath10k: replacedebug_mtxwithconf_mutex
ath10k: change wmi structure access
ath10k: fix coding style
ath10k: useath10k_warn()instead ofath10k_info()
ath10k: fix function prototype argument name
Thanks, all five applied.
Signature · 1 line
Kalle Valo