ath10k: fixes
cover ath10k: fixes
Here's a bunch of fixes that get rid of a few
FIXMEs and plug some memleaks on driver setup
failure paths.
Michal Kazior (8):
ath10k: cleanup ath10k_core_unregister()
ath10k: document some spinlocks
ath10k: remove old irrelevant FIXMEs
ath10k: handle CE init failure
ath10k: handle rx pipe post failure
ath10k: handle CE start failure
ath10k: print warning on ep0 htc rx
ath10k: free skb if ath10k_htc_send() fails
drivers/net/wireless/ath/ath10k/ce.c | 2 + drivers/net/wireless/ath/ath10k/core.c | 16 ++----- drivers/net/wireless/ath/ath10k/hif.h | 4 +- drivers/net/wireless/ath/ath10k/htc.c | 39 ++++++++++++----- drivers/net/wireless/ath/ath10k/htt.h | 7 +-- drivers/net/wireless/ath/ath10k/pci.c | 74 ++++++++++++++++++++++++-------- 6 files changed, 94 insertions(+), 48 deletions(-)
Signature · 1 line
1.7.9.5
PATCH 1/8 ath10k: cleanup ath10k_core_unregister()
--- drivers/net/wireless/ath/ath10k/core.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-)
drivers/net/wireless/ath/ath10k/core.c +4 -12
@@ -615,21 +615,13 @@ EXPORT_SYMBOL(ath10k_core_register);void ath10k_core_unregister (struct ath10k *ar) { -/* -* FIXME: the ordering here may be broken! -* mac_unregister must be done before htc is stopped, -* since it might want to remove interfaces -> vdev_remove -*/ +/* We must unregister from mac80211 before we stop HTC and HIF. +* Otherwise we will fail to submit commands to FW and mac80211 will be +* unhappy about callback failures. */ ath10k_mac_unregister (ar); - -if (!WARN_ON (!ar->htc)) -ath10k_htc_stop (ar->htc); - -/* FIXME: we may need to free up htt tx desc here too */ +ath10k_htc_stop (ar->htc);ath10k_htt_detach (ar->htt); -ath10k_wmi_detach (ar); -ath10k_htc_destroy (ar->htc); }EXPORT_SYMBOL (ath10k_core_unregister);
Signature · 1 line
1.7.9.5
PATCH 2/8 ath10k: document some spinlocks
In reply to Michal Kazior--- drivers/net/wireless/ath/ath10k/htt.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/net/wireless/ath/ath10k/htt.h +2 -3
@@ -1254,15 +1254,14 @@ struct ath10k_htt {*/ struct timer_list refill_retry_timer; -/* FIXME: document what this protects */ +/* Protects access to all rx ring buffer state variables */ spinlock_t lock; } rx_ring;unsigned int prefetch_len; -/* FIXME: document what this protects */ +/* Protects access to %pending_tx, %used_msdu_ids */ spinlock_t tx_lock; -struct sk_buff *pending_tx[HTT_MAX_NUM_PENDING_TX ];DECLARE_BITMAP (used_msdu_ids,HTT_MAX_NUM_PENDING_TX );wait_queue_head_t empty_tx_wq;
Signature · 1 line
1.7.9.5
PATCH 3/8 ath10k: remove old irrelevant FIXMEs
In reply to Michal Kazior--- drivers/net/wireless/ath/ath10k/htt.h | 2 -- drivers/net/wireless/ath/ath10k/pci.c | 1 - 2 files changed, 3 deletions(-)
drivers/net/wireless/ath/ath10k/htt.h +0 -2
@@ -1332,8 +1332,6 @@ struct htt_rx_desc {#define HTT_LOG2_MAX_CACHE_LINE_SIZE 7/* 2^7 = 128 */ #define HTT_MAX_CACHE_LINE_SIZE_MASK ((1 << HTT_LOG2_MAX_CACHE_LINE_SIZE) - 1) -/* FIXME: add htt_tx_desc_init() */ -struct ath10k_htt *ath10k_htt_attach (struct ath10k *ar);int ath10k_htt_attach_target (struct ath10k_htt *htt);void ath10k_htt_detach (struct ath10k_htt *htt);
drivers/net/wireless/ath/ath10k/pci.c +0 -1
@@ -2142,7 +2142,6 @@ static int ath10k_pci_probe(struct pci_dev *pdev,*/ ret =pci_assign_resource (pdev,BAR_NUM );if (ret) { -/* FIXME: do we need to free something in error path? */ ath10k_err ("cannot assign PCI space: %d\n" , ret); goto err_ar; }
Signature · 1 line
1.7.9.5
PATCH 4/8 ath10k: handle CE init failure
In reply to Michal KaziorFixes possible memleak.
--- drivers/net/wireless/ath/ath10k/ce.c | 2 ++ drivers/net/wireless/ath/ath10k/pci.c | 14 +++++++++++--- 2 files changed, 13 insertions(+), 3 deletions(-)
drivers/net/wireless/ath/ath10k/ce.c +2 -0
@@ -1134,6 +1134,7 @@ struct ce_state *ath10k_ce_init(struct ath10k *ar,if (ath10k_ce_init_src_ring (ar, ce_id, ce_state, attr)) {ath10k_err ("Failed to initialize CE src ring for ID: %d\n" , ce_id); +ath10k_ce_deinit (ce_state);return NULL ; } }
@@ -1142,6 +1143,7 @@ struct ce_state *ath10k_ce_init(struct ath10k *ar,if (ath10k_ce_init_dest_ring (ar, ce_id, ce_state, attr)) {ath10k_err ("Failed to initialize CE dest ring for ID: %d\n" , ce_id); +ath10k_ce_deinit (ce_state);return NULL ; } }
drivers/net/wireless/ath/ath10k/pci.c +11 -3
@@ -1618,7 +1618,7 @@ static int ath10k_pci_init_config(struct ath10k *ar) -static void ath10k_pci_ce_init (struct ath10k *ar) +static int ath10k_pci_ce_init (struct ath10k *ar) {struct ath10k_pci *ar_pci =ath10k_pci_priv (ar);struct hif_ce_pipe_info *pipe_info;
@@ -1633,9 +1633,13 @@ static void ath10k_pci_ce_init(struct ath10k *ar) pipe_info->ce_hdl =ath10k_ce_init (ar, pipe_num, attr);if (pipe_info->ce_hdl ==NULL ) { -/* FIXME: Handle error */ ath10k_err ("Unable to initialize CE for pipe: %d\n" , pipe_num); + +/* It is safe to call it here. It checks if ce_hdl is +* valid for each pipe */ +ath10k_pci_ce_deinit (ar); +return -1 ; }if (pipe_num == ar_pci->ce_count -1 ) {
@@ -1662,6 +1666,8 @@ static void ath10k_pci_ce_init(struct ath10k *ar) pipe_info = &ar_pci->pipe_info[BMI_CE_NUM_TO_HOST ];ath10k_ce_recv_cb_register (pipe_info->ce_hdl, ath10k_pci_bmi_recv_data); + +return 0 ; }static void ath10k_pci_fw_interrupt_handler (struct ath10k *ar)
@@ -2229,7 +2235,9 @@ static int ath10k_pci_probe(struct pci_dev *pdev,ath10k_do_pci_wake (ar); } -ath10k_pci_ce_init (ar); + ret =ath10k_pci_ce_init (ar); +if (ret) + goto err_intr; ret =ath10k_pci_init_config (ar);if (ret)
Signature · 1 line
1.7.9.5
PATCH 5/8 ath10k: handle rx pipe post failure
In reply to Michal KaziorFixes possible memleak.
--- drivers/net/wireless/ath/ath10k/hif.h | 4 +-- drivers/net/wireless/ath/ath10k/htc.c | 23 ++++++++++++----- drivers/net/wireless/ath/ath10k/pci.c | 45 ++++++++++++++++++++++++--------- 3 files changed, 52 insertions(+), 20 deletions(-)
drivers/net/wireless/ath/ath10k/hif.h +2 -2
@@ -46,7 +46,7 @@ struct ath10k_hif_ops { void *request, u32 request_len, void *response, u32 *response_len); -void (*start)(struct ath10k *ar); +int (*start)(struct ath10k *ar);void (*stop)(struct ath10k *ar);
@@ -89,7 +89,7 @@ static inline int ath10k_hif_exchange_bmi_msg(struct ath10k *ar, response, response_len); } -static inline void ath10k_hif_start (struct ath10k *ar) +static inline int ath10k_hif_start (struct ath10k *ar) {return ar->hif.ops->start (ar); }
drivers/net/wireless/ath/ath10k/htc.c +17 -6
@@ -708,7 +708,11 @@ int ath10k_htc_wait_target(struct ath10k_htc *htc)INIT_COMPLETION (htc->ctl_resp); -ath10k_hif_start (htc->ar); + status =ath10k_hif_start (htc->ar); +if (status) { +ath10k_err ("could not start HIF (%d)\n" , status); + goto err_start; + } status =wait_for_completion_timeout (&htc->ctl_resp,ATH10K_HTC_WAIT_TIMEOUT_HZ );
@@ -717,7 +721,7 @@ int ath10k_htc_wait_target(struct ath10k_htc *htc) status = -ETIMEDOUT ;ath10k_err ("ctl_resp never came in (%d)\n" , status); - goto fail_wait_target; + goto err_target; }if (htc->control_resp_len <sizeof (msg->hdr) +sizeof (msg->ready)) {
@@ -725,7 +729,7 @@ int ath10k_htc_wait_target(struct ath10k_htc *htc) htc->control_resp_len); status = -ECOMM ; - goto fail_wait_target; + goto err_target; } msg = (struct ath10k_htc_msg *)htc->control_resp_buffer;
@@ -736,7 +740,7 @@ int ath10k_htc_wait_target(struct ath10k_htc *htc)if (message_id !=ATH10K_HTC_MSG_READY_ID ) {ath10k_err ("Invalid HTC ready msg: 0x%x\n" , message_id); status = -ECOMM ; - goto fail_wait_target; + goto err_target; } htc->total_transmit_credits = credit_count;
@@ -751,7 +755,7 @@ int ath10k_htc_wait_target(struct ath10k_htc *htc) (htc->target_credit_size == 0)) { status = -ECOMM ;ath10k_err ("Invalid credit size received\n" ); - goto fail_wait_target; + goto err_target; }ath10k_htc_setup_target_buffer_assignments (htc);
@@ -766,8 +770,15 @@ int ath10k_htc_wait_target(struct ath10k_htc *htc)/* connect fake service */ status =ath10k_htc_connect_service (htc, &conn_req, &conn_resp); +if (status) { +ath10k_err ("could not connect to htc service (%d)\n" , status); + goto err_target; + } -fail_wait_target: +return 0 ; +err_target: +ath10k_hif_stop (htc->ar); +err_start:return status; }
drivers/net/wireless/ath/ath10k/pci.c +33 -12
90 lines not on this page · raw message
Signature · 1 line
1.7.9.5
PATCH 6/8 ath10k: handle CE start failure
In reply to Michal KaziorFixes possible memleak.
--- drivers/net/wireless/ath/ath10k/pci.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-)
drivers/net/wireless/ath/ath10k/pci.c +11 -3
@@ -53,6 +53,7 @@ static int ath10k_pci_post_rx(struct ath10k *ar);static int ath10k_pci_post_rx_pipe (struct hif_ce_pipe_info *pipe_info,int num);static void ath10k_pci_rx_pipe_cleanup (struct hif_ce_pipe_info *pipe_info); +static void ath10k_pci_stop_ce (struct ath10k *ar);static const struct ce_attr host_ce_config_wlan[] = {/* host->target HTC control and raw streams */
@@ -756,7 +757,7 @@ static void ath10k_pci_hif_post_init(struct ath10k *ar, sizeof(ar_pci->msg_callbacks_current)); } -static void ath10k_pci_start_ce (struct ath10k *ar) +static int ath10k_pci_start_ce (struct ath10k *ar) {struct ath10k_pci *ar_pci =ath10k_pci_priv (ar);struct ce_state *ce_diag = ar_pci->ce_diag;
@@ -804,13 +805,16 @@ static void ath10k_pci_start_ce(struct ath10k *ar) GFP_KERNEL);if (!compl) {ath10k_warn ("No memory for completion state\n" ); -break ; +ath10k_pci_stop_ce (ar); +return -ENOMEM ; } compl->send_or_recv =HIF_CE_COMPLETE_FREE ;list_add_tail (&compl->list, &pipe_info->compl_free); } } + +return 0 ; }static void ath10k_pci_stop_ce (struct ath10k *ar)
@@ -1113,7 +1117,11 @@ static int ath10k_pci_hif_start(struct ath10k *ar)struct ath10k_pci *ar_pci =ath10k_pci_priv (ar);int ret; -ath10k_pci_start_ce (ar); + ret =ath10k_pci_start_ce (ar); +if (ret) { +ath10k_warn ("could not start CE (%d)\n" , ret); +return ret; + }/* Post buffers once to start things off. */ ret =ath10k_pci_post_rx (ar);
Signature · 1 line
1.7.9.5
PATCH 7/8 ath10k: print warning on ep0 htc rx
In reply to Michal KaziorFixes possible memleak.
--- drivers/net/wireless/ath/ath10k/htc.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/net/wireless/ath/ath10k/htc.c +4 -2
@@ -608,8 +608,10 @@ out:static void ath10k_htc_control_rx_complete (struct ath10k *ar,struct sk_buff *skb) { -/* TODO, can't receive HTC control messages yet */ -ath10k_dbg (ATH10K_DBG_HTC ,"Invalid call to %s\n" , __func__); +/* This is unexpected. FW is not supposed to send regular rx on this +* endpoint. */ +ath10k_warn ("unexpected htc rx\n" ); +kfree_skb (skb); }/***************/
Signature · 1 line
1.7.9.5
PATCH 8/8 ath10k: free skb if ath10k_htc_send() fails
In reply to Michal Kazior--- drivers/net/wireless/ath/ath10k/htc.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/net/wireless/ath/ath10k/htc.c +8 -2
@@ -845,8 +845,10 @@ int ath10k_htc_connect_service(struct ath10k_htc *htc,INIT_COMPLETION (htc->ctl_resp); status =ath10k_htc_send (htc,ATH10K_HTC_EP_0 , skb); -if (status) +if (status) { +kfree_skb (skb);return status; + }/* wait for response */ status = wait_for_completion_timeout(&htc->ctl_resp,
@@ -989,8 +991,12 @@ int ath10k_htc_start(struct ath10k_htc *htc)ath10k_dbg (ATH10K_DBG_HTC ,"HTC is using TX credit flow control\n" ); status =ath10k_htc_send (htc,ATH10K_HTC_EP_0 , skb); +if (status) { +kfree_skb (skb); +return status; + } -return status; +return 0 ; }/*
Signature · 1 line
1.7.9.5
cover ath10k: fixes
In reply to Michal KaziorQuoted 4 lines · Michal Kazior
Here's a bunch of fixes that get rid of a few
FIXMEs and plug some memleaks on driver setup
failure paths.
Quoted 9 lines
Michal Kazior (8):
ath10k: cleanupath10k_core_unregister()
ath10k: document some spinlocks
ath10k: remove old irrelevant FIXMEs
ath10k: handle CE init failure
ath10k: handle rx pipe post failure
ath10k: handle CE start failure
ath10k: print warning on ep0 htc rx
ath10k: free skb ifath10k_htc_send()fails
Thanks, all applied.
Signature · 1 line
Kalle Valo