* [PATCH 1/9] ath6kl: remove unused A_CACHE_LINE_PAD
@ 2011-10-24 9:16 Kalle Valo
2011-10-24 9:16 ` [PATCH 2/9] ath6kl: use ath6kl prefix in credit functions Kalle Valo
` (8 more replies)
0 siblings, 9 replies; 10+ messages in thread
From: Kalle Valo @ 2011-10-24 9:16 UTC (permalink / raw)
To: kvalo; +Cc: linux-wireless
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
---
drivers/net/wireless/ath/ath6kl/common.h | 2 --
1 files changed, 0 insertions(+), 2 deletions(-)
diff --git a/drivers/net/wireless/ath/ath6kl/common.h b/drivers/net/wireless/ath/ath6kl/common.h
index b92f0e5..d2efa19 100644
--- a/drivers/net/wireless/ath/ath6kl/common.h
+++ b/drivers/net/wireless/ath/ath6kl/common.h
@@ -23,8 +23,6 @@
extern int ath6kl_printk(const char *level, const char *fmt, ...);
-#define A_CACHE_LINE_PAD 128
-
/*
* Reflects the version of binary interface exposed by ATH6KL target
* firmware. Needs to be incremented by 1 for any change in the firmware
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 2/9] ath6kl: use ath6kl prefix in credit functions
2011-10-24 9:16 [PATCH 1/9] ath6kl: remove unused A_CACHE_LINE_PAD Kalle Valo
@ 2011-10-24 9:16 ` Kalle Valo
2011-10-24 9:17 ` [PATCH 3/9] ath6kl: rename struct htc_endpoint_credit_dist.htc_rsvd to htc_ep Kalle Valo
` (7 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Kalle Valo @ 2011-10-24 9:16 UTC (permalink / raw)
To: kvalo; +Cc: linux-wireless
This is to follow the common style in the driver. Also add braces to
fix a style issue.
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
---
drivers/net/wireless/ath/ath6kl/common.h | 20 +++++-----
drivers/net/wireless/ath/ath6kl/htc.c | 22 ++++++-----
drivers/net/wireless/ath/ath6kl/init.c | 2 +
drivers/net/wireless/ath/ath6kl/main.c | 60 +++++++++++++++---------------
4 files changed, 52 insertions(+), 52 deletions(-)
diff --git a/drivers/net/wireless/ath/ath6kl/common.h b/drivers/net/wireless/ath/ath6kl/common.h
index d2efa19..fd239ea 100644
--- a/drivers/net/wireless/ath/ath6kl/common.h
+++ b/drivers/net/wireless/ath/ath6kl/common.h
@@ -78,16 +78,16 @@ struct ath6kl;
enum htc_credit_dist_reason;
struct htc_credit_state_info;
-int ath6k_setup_credit_dist(void *htc_handle,
- struct htc_credit_state_info *cred_info);
-void ath6k_credit_distribute(struct htc_credit_state_info *cred_inf,
- struct list_head *epdist_list,
- enum htc_credit_dist_reason reason);
-void ath6k_credit_init(struct htc_credit_state_info *cred_inf,
- struct list_head *ep_list,
- int tot_credits);
-void ath6k_seek_credits(struct htc_credit_state_info *cred_inf,
- struct htc_endpoint_credit_dist *ep_dist);
+int ath6kl_setup_credit_dist(void *htc_handle,
+ struct htc_credit_state_info *cred_info);
+void ath6kl_credit_distribute(struct htc_credit_state_info *cred_inf,
+ struct list_head *epdist_list,
+ enum htc_credit_dist_reason reason);
+void ath6kl_credit_init(struct htc_credit_state_info *cred_inf,
+ struct list_head *ep_list,
+ int tot_credits);
+void ath6kl_seek_credits(struct htc_credit_state_info *cred_inf,
+ struct htc_endpoint_credit_dist *ep_dist);
struct ath6kl *ath6kl_core_alloc(struct device *sdev);
int ath6kl_core_init(struct ath6kl *ar);
int ath6kl_unavail_ev(struct ath6kl *ar);
diff --git a/drivers/net/wireless/ath/ath6kl/htc.c b/drivers/net/wireless/ath/ath6kl/htc.c
index 3cd3ef5..b861fa1 100644
--- a/drivers/net/wireless/ath/ath6kl/htc.c
+++ b/drivers/net/wireless/ath/ath6kl/htc.c
@@ -105,7 +105,7 @@ static void htc_tx_comp_update(struct htc_target *target,
ath6kl_dbg(ATH6KL_DBG_HTC, "htc tx ctxt 0x%p dist 0x%p\n",
target->cred_dist_cntxt, &target->cred_dist_list);
- ath6k_credit_distribute(target->cred_dist_cntxt,
+ ath6kl_credit_distribute(target->cred_dist_cntxt,
&target->cred_dist_list,
HTC_CREDIT_DIST_SEND_COMPLETE);
@@ -237,7 +237,7 @@ static int htc_check_credits(struct htc_target *target,
ath6kl_dbg(ATH6KL_DBG_HTC, "htc creds ctxt 0x%p dist 0x%p\n",
target->cred_dist_cntxt, &ep->cred_dist);
- ath6k_seek_credits(target->cred_dist_cntxt, &ep->cred_dist);
+ ath6kl_seek_credits(target->cred_dist_cntxt, &ep->cred_dist);
ep->cred_dist.seek_cred = 0;
@@ -260,7 +260,7 @@ static int htc_check_credits(struct htc_target *target,
ath6kl_dbg(ATH6KL_DBG_HTC, "htc creds ctxt 0x%p dist 0x%p\n",
target->cred_dist_cntxt, &ep->cred_dist);
- ath6k_seek_credits(target->cred_dist_cntxt, &ep->cred_dist);
+ ath6kl_seek_credits(target->cred_dist_cntxt, &ep->cred_dist);
/* see if we were successful in getting more */
if (ep->cred_dist.credits < ep->cred_dist.cred_per_msg) {
@@ -842,9 +842,9 @@ void ath6kl_htc_indicate_activity_change(struct htc_target *target,
"htc tx activity ctxt 0x%p dist 0x%p\n",
target->cred_dist_cntxt, &target->cred_dist_list);
- ath6k_credit_distribute(target->cred_dist_cntxt,
- &target->cred_dist_list,
- HTC_CREDIT_DIST_ACTIVITY_CHANGE);
+ ath6kl_credit_distribute(target->cred_dist_cntxt,
+ &target->cred_dist_list,
+ HTC_CREDIT_DIST_ACTIVITY_CHANGE);
}
spin_unlock_bh(&target->tx_lock);
@@ -1272,9 +1272,9 @@ static void htc_proc_cred_rpt(struct htc_target *target,
ath6kl_dbg(ATH6KL_DBG_HTC, "htc creds ctxt 0x%p dist 0x%p\n",
target->cred_dist_cntxt, &target->cred_dist_list);
- ath6k_credit_distribute(target->cred_dist_cntxt,
- &target->cred_dist_list,
- HTC_CREDIT_DIST_SEND_COMPLETE);
+ ath6kl_credit_distribute(target->cred_dist_cntxt,
+ &target->cred_dist_list,
+ HTC_CREDIT_DIST_SEND_COMPLETE);
}
spin_unlock_bh(&target->tx_lock);
@@ -2338,8 +2338,8 @@ int ath6kl_htc_start(struct htc_target *target)
}
/* NOTE: the first entry in the distribution list is ENDPOINT_0 */
- ath6k_credit_init(target->cred_dist_cntxt, &target->cred_dist_list,
- target->tgt_creds);
+ ath6kl_credit_init(target->cred_dist_cntxt, &target->cred_dist_list,
+ target->tgt_creds);
dump_cred_dist_stats(target);
diff --git a/drivers/net/wireless/ath/ath6kl/init.c b/drivers/net/wireless/ath/ath6kl/init.c
index 1700423..777ee2c 100644
--- a/drivers/net/wireless/ath/ath6kl/init.c
+++ b/drivers/net/wireless/ath/ath6kl/init.c
@@ -1516,7 +1516,7 @@ static int ath6kl_init(struct net_device *dev)
ath6kl_refill_amsdu_rxbufs(ar, ATH6KL_MAX_AMSDU_RX_BUFFERS);
/* setup credit distribution */
- ath6k_setup_credit_dist(ar->htc_target, &ar->credit_state_info);
+ ath6kl_setup_credit_dist(ar->htc_target, &ar->credit_state_info);
ath6kl_cookie_init(ar);
diff --git a/drivers/net/wireless/ath/ath6kl/main.c b/drivers/net/wireless/ath/ath6kl/main.c
index e693756..f35f763 100644
--- a/drivers/net/wireless/ath/ath6kl/main.c
+++ b/drivers/net/wireless/ath/ath6kl/main.c
@@ -623,9 +623,9 @@ void ath6kl_connect_ap_mode_sta(struct ath6kl *ar, u16 aid, u8 *mac_addr,
}
/* Functions for Tx credit handling */
-void ath6k_credit_init(struct htc_credit_state_info *cred_info,
- struct list_head *ep_list,
- int tot_credits)
+void ath6kl_credit_init(struct htc_credit_state_info *cred_info,
+ struct list_head *ep_list,
+ int tot_credits)
{
struct htc_endpoint_credit_dist *cur_ep_dist;
int count;
@@ -639,7 +639,7 @@ void ath6k_credit_init(struct htc_credit_state_info *cred_info,
cur_ep_dist->cred_min = cur_ep_dist->cred_per_msg;
- if (tot_credits > 4)
+ if (tot_credits > 4) {
if ((cur_ep_dist->svc_id == WMI_DATA_BK_SVC) ||
(cur_ep_dist->svc_id == WMI_DATA_BE_SVC)) {
ath6kl_deposit_credit_to_ep(cred_info,
@@ -647,6 +647,7 @@ void ath6k_credit_init(struct htc_credit_state_info *cred_info,
cur_ep_dist->cred_min);
cur_ep_dist->dist_flags |= HTC_EP_ACTIVE;
}
+ }
if (cur_ep_dist->svc_id == WMI_CONTROL_SVC) {
ath6kl_deposit_credit_to_ep(cred_info, cur_ep_dist,
@@ -701,8 +702,8 @@ void ath6k_credit_init(struct htc_credit_state_info *cred_info,
}
/* initialize and setup credit distribution */
-int ath6k_setup_credit_dist(void *htc_handle,
- struct htc_credit_state_info *cred_info)
+int ath6kl_setup_credit_dist(void *htc_handle,
+ struct htc_credit_state_info *cred_info)
{
u16 servicepriority[5];
@@ -721,9 +722,9 @@ int ath6k_setup_credit_dist(void *htc_handle,
}
/* reduce an ep's credits back to a set limit */
-static void ath6k_reduce_credits(struct htc_credit_state_info *cred_info,
- struct htc_endpoint_credit_dist *ep_dist,
- int limit)
+static void ath6kl_reduce_credits(struct htc_credit_state_info *cred_info,
+ struct htc_endpoint_credit_dist *ep_dist,
+ int limit)
{
int credits;
@@ -737,8 +738,8 @@ static void ath6k_reduce_credits(struct htc_credit_state_info *cred_info,
cred_info->cur_free_credits += credits;
}
-static void ath6k_credit_update(struct htc_credit_state_info *cred_info,
- struct list_head *epdist_list)
+static void ath6kl_credit_update(struct htc_credit_state_info *cred_info,
+ struct list_head *epdist_list)
{
struct htc_endpoint_credit_dist *cur_dist_list;
@@ -752,19 +753,19 @@ static void ath6k_credit_update(struct htc_credit_state_info *cred_info,
cur_dist_list->cred_to_dist = 0;
if (cur_dist_list->credits >
cur_dist_list->cred_assngd)
- ath6k_reduce_credits(cred_info,
+ ath6kl_reduce_credits(cred_info,
cur_dist_list,
cur_dist_list->cred_assngd);
if (cur_dist_list->credits >
cur_dist_list->cred_norm)
- ath6k_reduce_credits(cred_info, cur_dist_list,
- cur_dist_list->cred_norm);
+ ath6kl_reduce_credits(cred_info, cur_dist_list,
+ cur_dist_list->cred_norm);
if (!(cur_dist_list->dist_flags & HTC_EP_ACTIVE)) {
if (cur_dist_list->txq_depth == 0)
- ath6k_reduce_credits(cred_info,
- cur_dist_list, 0);
+ ath6kl_reduce_credits(cred_info,
+ cur_dist_list, 0);
}
}
}
@@ -774,8 +775,8 @@ static void ath6k_credit_update(struct htc_credit_state_info *cred_info,
* HTC has an endpoint that needs credits, ep_dist is the endpoint in
* question.
*/
-void ath6k_seek_credits(struct htc_credit_state_info *cred_info,
- struct htc_endpoint_credit_dist *ep_dist)
+void ath6kl_seek_credits(struct htc_credit_state_info *cred_info,
+ struct htc_endpoint_credit_dist *ep_dist)
{
struct htc_endpoint_credit_dist *curdist_list;
int credits = 0;
@@ -827,8 +828,8 @@ void ath6k_seek_credits(struct htc_credit_state_info *cred_info,
* above it's minimum to fulfill our need try to
* take away just enough to fulfill our need.
*/
- ath6k_reduce_credits(cred_info, curdist_list,
- curdist_list->cred_assngd - need);
+ ath6kl_reduce_credits(cred_info, curdist_list,
+ curdist_list->cred_assngd - need);
if (cred_info->cur_free_credits >=
ep_dist->seek_cred)
@@ -850,8 +851,8 @@ out:
}
/* redistribute credits based on activity change */
-static void ath6k_redistribute_credits(struct htc_credit_state_info *info,
- struct list_head *ep_dist_list)
+static void ath6kl_redistribute_credits(struct htc_credit_state_info *info,
+ struct list_head *ep_dist_list)
{
struct htc_endpoint_credit_dist *curdist_list;
@@ -866,10 +867,9 @@ static void ath6k_redistribute_credits(struct htc_credit_state_info *info,
if ((curdist_list->svc_id != WMI_CONTROL_SVC) &&
!(curdist_list->dist_flags & HTC_EP_ACTIVE)) {
if (curdist_list->txq_depth == 0)
- ath6k_reduce_credits(info,
- curdist_list, 0);
+ ath6kl_reduce_credits(info, curdist_list, 0);
else
- ath6k_reduce_credits(info,
+ ath6kl_reduce_credits(info,
curdist_list,
curdist_list->cred_min);
}
@@ -884,16 +884,16 @@ static void ath6k_redistribute_credits(struct htc_credit_state_info *info,
* structures in prioritized order as defined by the call to the
* htc_set_credit_dist() api.
*/
-void ath6k_credit_distribute(struct htc_credit_state_info *cred_info,
- struct list_head *ep_dist_list,
- enum htc_credit_dist_reason reason)
+void ath6kl_credit_distribute(struct htc_credit_state_info *cred_info,
+ struct list_head *ep_dist_list,
+ enum htc_credit_dist_reason reason)
{
switch (reason) {
case HTC_CREDIT_DIST_SEND_COMPLETE:
- ath6k_credit_update(cred_info, ep_dist_list);
+ ath6kl_credit_update(cred_info, ep_dist_list);
break;
case HTC_CREDIT_DIST_ACTIVITY_CHANGE:
- ath6k_redistribute_credits(cred_info, ep_dist_list);
+ ath6kl_redistribute_credits(cred_info, ep_dist_list);
break;
default:
break;
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 3/9] ath6kl: rename struct htc_endpoint_credit_dist.htc_rsvd to htc_ep
2011-10-24 9:16 [PATCH 1/9] ath6kl: remove unused A_CACHE_LINE_PAD Kalle Valo
2011-10-24 9:16 ` [PATCH 2/9] ath6kl: use ath6kl prefix in credit functions Kalle Valo
@ 2011-10-24 9:17 ` Kalle Valo
2011-10-24 9:17 ` [PATCH 4/9] ath6kl: rename struct htc_credit_state_info to ath6kl_htc_credit_info Kalle Valo
` (6 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Kalle Valo @ 2011-10-24 9:17 UTC (permalink / raw)
To: kvalo; +Cc: linux-wireless
No need to use void pointer here.
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
---
drivers/net/wireless/ath/ath6kl/debug.c | 6 ++----
drivers/net/wireless/ath/ath6kl/htc.c | 4 ++--
drivers/net/wireless/ath/ath6kl/htc.h | 2 +-
3 files changed, 5 insertions(+), 7 deletions(-)
diff --git a/drivers/net/wireless/ath/ath6kl/debug.c b/drivers/net/wireless/ath/ath6kl/debug.c
index e109f29..a6fda09 100644
--- a/drivers/net/wireless/ath/ath6kl/debug.c
+++ b/drivers/net/wireless/ath/ath6kl/debug.c
@@ -164,8 +164,7 @@ static void dump_cred_dist(struct htc_endpoint_credit_dist *ep_dist)
ath6kl_dbg(ATH6KL_DBG_ANY, " cred_to_dist : %d\n",
ep_dist->cred_to_dist);
ath6kl_dbg(ATH6KL_DBG_ANY, " txq_depth : %d\n",
- get_queue_depth(&((struct htc_endpoint *)
- ep_dist->htc_rsvd)->txq));
+ get_queue_depth(&ep_dist->htc_ep->txq));
ath6kl_dbg(ATH6KL_DBG_ANY,
"----------------------------------\n");
}
@@ -577,8 +576,7 @@ static ssize_t read_file_credit_dist_stats(struct file *file,
print_credit_info("%9d", cred_per_msg);
print_credit_info("%14d", cred_to_dist);
len += scnprintf(buf + len, buf_len - len, "%12d\n",
- get_queue_depth(&((struct htc_endpoint *)
- ep_list->htc_rsvd)->txq));
+ get_queue_depth(&ep_list->htc_ep->txq));
}
if (len > buf_len)
diff --git a/drivers/net/wireless/ath/ath6kl/htc.c b/drivers/net/wireless/ath/ath6kl/htc.c
index b861fa1..4685a1b 100644
--- a/drivers/net/wireless/ath/ath6kl/htc.c
+++ b/drivers/net/wireless/ath/ath6kl/htc.c
@@ -619,7 +619,7 @@ static void htc_chk_ep_txq(struct htc_target *target)
* are not modifying any state.
*/
list_for_each_entry(cred_dist, &target->cred_dist_list, list) {
- endpoint = (struct htc_endpoint *)cred_dist->htc_rsvd;
+ endpoint = cred_dist->htc_ep;
spin_lock_bh(&target->tx_lock);
if (!list_empty(&endpoint->txq)) {
@@ -2119,7 +2119,7 @@ int ath6kl_htc_conn_service(struct htc_target *target,
endpoint->len_max = max_msg_sz;
endpoint->ep_cb = conn_req->ep_cb;
endpoint->cred_dist.svc_id = conn_req->svc_id;
- endpoint->cred_dist.htc_rsvd = endpoint;
+ endpoint->cred_dist.htc_ep = endpoint;
endpoint->cred_dist.endpoint = assigned_ep;
endpoint->cred_dist.cred_sz = target->tgt_cred_sz;
diff --git a/drivers/net/wireless/ath/ath6kl/htc.h b/drivers/net/wireless/ath/ath6kl/htc.h
index 69d44e3..5db4294 100644
--- a/drivers/net/wireless/ath/ath6kl/htc.h
+++ b/drivers/net/wireless/ath/ath6kl/htc.h
@@ -393,7 +393,7 @@ struct htc_endpoint_credit_dist {
int cred_per_msg;
/* reserved for HTC use */
- void *htc_rsvd;
+ struct htc_endpoint *htc_ep;
/*
* current depth of TX queue , i.e. messages waiting for credits
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 4/9] ath6kl: rename struct htc_credit_state_info to ath6kl_htc_credit_info
2011-10-24 9:16 [PATCH 1/9] ath6kl: remove unused A_CACHE_LINE_PAD Kalle Valo
2011-10-24 9:16 ` [PATCH 2/9] ath6kl: use ath6kl prefix in credit functions Kalle Valo
2011-10-24 9:17 ` [PATCH 3/9] ath6kl: rename struct htc_endpoint_credit_dist.htc_rsvd to htc_ep Kalle Valo
@ 2011-10-24 9:17 ` Kalle Valo
2011-10-24 9:17 ` [PATCH 5/9] ath6kl: move all credit distribution code to htc.c Kalle Valo
` (5 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Kalle Valo @ 2011-10-24 9:17 UTC (permalink / raw)
To: kvalo; +Cc: linux-wireless
Also rename cred_dist_cntxt to credit_info in struct htc_target.
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
---
drivers/net/wireless/ath/ath6kl/common.h | 10 +++++-----
drivers/net/wireless/ath/ath6kl/core.h | 4 ++--
drivers/net/wireless/ath/ath6kl/debug.c | 10 +++++-----
drivers/net/wireless/ath/ath6kl/htc.c | 31 +++++++++++++++---------------
drivers/net/wireless/ath/ath6kl/htc.h | 11 ++++++++---
drivers/net/wireless/ath/ath6kl/main.c | 17 +++++++++-------
6 files changed, 45 insertions(+), 38 deletions(-)
diff --git a/drivers/net/wireless/ath/ath6kl/common.h b/drivers/net/wireless/ath/ath6kl/common.h
index fd239ea..4fb2ccf 100644
--- a/drivers/net/wireless/ath/ath6kl/common.h
+++ b/drivers/net/wireless/ath/ath6kl/common.h
@@ -76,17 +76,17 @@ enum crypto_type {
struct htc_endpoint_credit_dist;
struct ath6kl;
enum htc_credit_dist_reason;
-struct htc_credit_state_info;
+struct ath6kl_htc_credit_info;
int ath6kl_setup_credit_dist(void *htc_handle,
- struct htc_credit_state_info *cred_info);
-void ath6kl_credit_distribute(struct htc_credit_state_info *cred_inf,
+ struct ath6kl_htc_credit_info *cred_info);
+void ath6kl_credit_distribute(struct ath6kl_htc_credit_info *cred_inf,
struct list_head *epdist_list,
enum htc_credit_dist_reason reason);
-void ath6kl_credit_init(struct htc_credit_state_info *cred_inf,
+void ath6kl_credit_init(struct ath6kl_htc_credit_info *cred_inf,
struct list_head *ep_list,
int tot_credits);
-void ath6kl_seek_credits(struct htc_credit_state_info *cred_inf,
+void ath6kl_seek_credits(struct ath6kl_htc_credit_info *cred_inf,
struct htc_endpoint_credit_dist *ep_dist);
struct ath6kl *ath6kl_core_alloc(struct device *sdev);
int ath6kl_core_init(struct ath6kl *ar);
diff --git a/drivers/net/wireless/ath/ath6kl/core.h b/drivers/net/wireless/ath/ath6kl/core.h
index 31e5c7e..f8135a4 100644
--- a/drivers/net/wireless/ath/ath6kl/core.h
+++ b/drivers/net/wireless/ath/ath6kl/core.h
@@ -447,7 +447,7 @@ struct ath6kl {
u8 hiac_stream_active_pri;
u8 ep2ac_map[ENDPOINT_MAX];
enum htc_endpoint_id ctrl_ep;
- struct htc_credit_state_info credit_state_info;
+ struct ath6kl_htc_credit_info credit_state_info;
u32 connect_ctrl_flags;
u32 user_key_ctrl;
u8 usr_bss_filter;
@@ -545,7 +545,7 @@ static inline void *ath6kl_priv(struct net_device *dev)
return wdev_priv(dev->ieee80211_ptr);
}
-static inline void ath6kl_deposit_credit_to_ep(struct htc_credit_state_info
+static inline void ath6kl_deposit_credit_to_ep(struct ath6kl_htc_credit_info
*cred_info,
struct htc_endpoint_credit_dist
*ep_dist, int credits)
diff --git a/drivers/net/wireless/ath/ath6kl/debug.c b/drivers/net/wireless/ath/ath6kl/debug.c
index a6fda09..324fdb3 100644
--- a/drivers/net/wireless/ath/ath6kl/debug.c
+++ b/drivers/net/wireless/ath/ath6kl/debug.c
@@ -180,11 +180,11 @@ void dump_cred_dist_stats(struct htc_target *target)
dump_cred_dist(ep_list);
ath6kl_dbg(ATH6KL_DBG_HTC, "ctxt:%p dist:%p\n",
- target->cred_dist_cntxt, NULL);
+ target->credit_info, NULL);
ath6kl_dbg(ATH6KL_DBG_HTC,
"credit distribution, total : %d, free : %d\n",
- target->cred_dist_cntxt->total_avail_credits,
- target->cred_dist_cntxt->cur_free_credits);
+ target->credit_info->total_avail_credits,
+ target->credit_info->cur_free_credits);
}
static int ath6kl_debugfs_open(struct inode *inode, struct file *file)
@@ -554,10 +554,10 @@ static ssize_t read_file_credit_dist_stats(struct file *file,
len += scnprintf(buf + len, buf_len - len, "%25s%5d\n",
"Total Avail Credits: ",
- target->cred_dist_cntxt->total_avail_credits);
+ target->credit_info->total_avail_credits);
len += scnprintf(buf + len, buf_len - len, "%25s%5d\n",
"Free credits :",
- target->cred_dist_cntxt->cur_free_credits);
+ target->credit_info->cur_free_credits);
len += scnprintf(buf + len, buf_len - len,
" Epid Flags Cred_norm Cred_min Credits Cred_assngd"
diff --git a/drivers/net/wireless/ath/ath6kl/htc.c b/drivers/net/wireless/ath/ath6kl/htc.c
index 4685a1b..24dfc02 100644
--- a/drivers/net/wireless/ath/ath6kl/htc.c
+++ b/drivers/net/wireless/ath/ath6kl/htc.c
@@ -103,11 +103,11 @@ static void htc_tx_comp_update(struct htc_target *target,
endpoint->cred_dist.txq_depth = get_queue_depth(&endpoint->txq);
ath6kl_dbg(ATH6KL_DBG_HTC, "htc tx ctxt 0x%p dist 0x%p\n",
- target->cred_dist_cntxt, &target->cred_dist_list);
+ target->credit_info, &target->cred_dist_list);
- ath6kl_credit_distribute(target->cred_dist_cntxt,
- &target->cred_dist_list,
- HTC_CREDIT_DIST_SEND_COMPLETE);
+ ath6kl_credit_distribute(target->credit_info,
+ &target->cred_dist_list,
+ HTC_CREDIT_DIST_SEND_COMPLETE);
spin_unlock_bh(&target->tx_lock);
}
@@ -235,9 +235,9 @@ static int htc_check_credits(struct htc_target *target,
ep->cred_dist.seek_cred = *req_cred - ep->cred_dist.credits;
ath6kl_dbg(ATH6KL_DBG_HTC, "htc creds ctxt 0x%p dist 0x%p\n",
- target->cred_dist_cntxt, &ep->cred_dist);
+ target->credit_info, &ep->cred_dist);
- ath6kl_seek_credits(target->cred_dist_cntxt, &ep->cred_dist);
+ ath6kl_seek_credits(target->credit_info, &ep->cred_dist);
ep->cred_dist.seek_cred = 0;
@@ -258,9 +258,9 @@ static int htc_check_credits(struct htc_target *target,
ep->cred_dist.cred_per_msg - ep->cred_dist.credits;
ath6kl_dbg(ATH6KL_DBG_HTC, "htc creds ctxt 0x%p dist 0x%p\n",
- target->cred_dist_cntxt, &ep->cred_dist);
+ target->credit_info, &ep->cred_dist);
- ath6kl_seek_credits(target->cred_dist_cntxt, &ep->cred_dist);
+ ath6kl_seek_credits(target->credit_info, &ep->cred_dist);
/* see if we were successful in getting more */
if (ep->cred_dist.credits < ep->cred_dist.cred_per_msg) {
@@ -698,13 +698,13 @@ static int htc_setup_tx_complete(struct htc_target *target)
}
void ath6kl_htc_set_credit_dist(struct htc_target *target,
- struct htc_credit_state_info *cred_dist_cntxt,
+ struct ath6kl_htc_credit_info *credit_info,
u16 srvc_pri_order[], int list_len)
{
struct htc_endpoint *endpoint;
int i, ep;
- target->cred_dist_cntxt = cred_dist_cntxt;
+ target->credit_info = credit_info;
list_add_tail(&target->endpoint[ENDPOINT_0].cred_dist.list,
&target->cred_dist_list);
@@ -840,9 +840,9 @@ void ath6kl_htc_indicate_activity_change(struct htc_target *target,
ath6kl_dbg(ATH6KL_DBG_HTC,
"htc tx activity ctxt 0x%p dist 0x%p\n",
- target->cred_dist_cntxt, &target->cred_dist_list);
+ target->credit_info, &target->cred_dist_list);
- ath6kl_credit_distribute(target->cred_dist_cntxt,
+ ath6kl_credit_distribute(target->credit_info,
&target->cred_dist_list,
HTC_CREDIT_DIST_ACTIVITY_CHANGE);
}
@@ -1270,9 +1270,9 @@ static void htc_proc_cred_rpt(struct htc_target *target,
* operations note, this is done with the lock held
*/
ath6kl_dbg(ATH6KL_DBG_HTC, "htc creds ctxt 0x%p dist 0x%p\n",
- target->cred_dist_cntxt, &target->cred_dist_list);
+ target->credit_info, &target->cred_dist_list);
- ath6kl_credit_distribute(target->cred_dist_cntxt,
+ ath6kl_credit_distribute(target->credit_info,
&target->cred_dist_list,
HTC_CREDIT_DIST_SEND_COMPLETE);
}
@@ -2176,6 +2176,7 @@ static void reset_ep_state(struct htc_target *target)
}
/* reset distribution list */
+ /* FIXME: free existing entries */
INIT_LIST_HEAD(&target->cred_dist_list);
}
@@ -2338,7 +2339,7 @@ int ath6kl_htc_start(struct htc_target *target)
}
/* NOTE: the first entry in the distribution list is ENDPOINT_0 */
- ath6kl_credit_init(target->cred_dist_cntxt, &target->cred_dist_list,
+ ath6kl_credit_init(target->credit_info, &target->cred_dist_list,
target->tgt_creds);
dump_cred_dist_stats(target);
diff --git a/drivers/net/wireless/ath/ath6kl/htc.h b/drivers/net/wireless/ath/ath6kl/htc.h
index 5db4294..47a588c 100644
--- a/drivers/net/wireless/ath/ath6kl/htc.h
+++ b/drivers/net/wireless/ath/ath6kl/htc.h
@@ -414,9 +414,11 @@ enum htc_credit_dist_reason {
HTC_CREDIT_DIST_SEEK_CREDITS,
};
-struct htc_credit_state_info {
+struct ath6kl_htc_credit_info {
int total_avail_credits;
int cur_free_credits;
+
+ /* list of lowest priority endpoints */
struct list_head lowestpri_ep_dist;
};
@@ -508,10 +510,13 @@ struct ath6kl_device;
/* our HTC target state */
struct htc_target {
struct htc_endpoint endpoint[ENDPOINT_MAX];
+
+ /* contains struct htc_endpoint_credit_dist */
struct list_head cred_dist_list;
+
struct list_head free_ctrl_txbuf;
struct list_head free_ctrl_rxbuf;
- struct htc_credit_state_info *cred_dist_cntxt;
+ struct ath6kl_htc_credit_info *credit_info;
int tgt_creds;
unsigned int tgt_cred_sz;
spinlock_t htc_lock;
@@ -542,7 +547,7 @@ struct htc_target {
void *ath6kl_htc_create(struct ath6kl *ar);
void ath6kl_htc_set_credit_dist(struct htc_target *target,
- struct htc_credit_state_info *cred_info,
+ struct ath6kl_htc_credit_info *cred_info,
u16 svc_pri_order[], int len);
int ath6kl_htc_wait_target(struct htc_target *target);
int ath6kl_htc_start(struct htc_target *target);
diff --git a/drivers/net/wireless/ath/ath6kl/main.c b/drivers/net/wireless/ath/ath6kl/main.c
index f35f763..bc9ec6c 100644
--- a/drivers/net/wireless/ath/ath6kl/main.c
+++ b/drivers/net/wireless/ath/ath6kl/main.c
@@ -623,7 +623,7 @@ void ath6kl_connect_ap_mode_sta(struct ath6kl *ar, u16 aid, u8 *mac_addr,
}
/* Functions for Tx credit handling */
-void ath6kl_credit_init(struct htc_credit_state_info *cred_info,
+void ath6kl_credit_init(struct ath6kl_htc_credit_info *cred_info,
struct list_head *ep_list,
int tot_credits)
{
@@ -659,6 +659,7 @@ void ath6kl_credit_init(struct htc_credit_state_info *cred_info,
cur_ep_dist->dist_flags |= HTC_EP_ACTIVE;
} else if (cur_ep_dist->svc_id == WMI_DATA_BK_SVC)
/* this is the lowest priority data endpoint */
+ /* FIXME: this looks fishy, check */
cred_info->lowestpri_ep_dist = cur_ep_dist->list;
/*
@@ -703,11 +704,11 @@ void ath6kl_credit_init(struct htc_credit_state_info *cred_info,
/* initialize and setup credit distribution */
int ath6kl_setup_credit_dist(void *htc_handle,
- struct htc_credit_state_info *cred_info)
+ struct ath6kl_htc_credit_info *cred_info)
{
u16 servicepriority[5];
- memset(cred_info, 0, sizeof(struct htc_credit_state_info));
+ memset(cred_info, 0, sizeof(struct ath6kl_htc_credit_info));
servicepriority[0] = WMI_CONTROL_SVC; /* highest */
servicepriority[1] = WMI_DATA_VO_SVC;
@@ -722,7 +723,7 @@ int ath6kl_setup_credit_dist(void *htc_handle,
}
/* reduce an ep's credits back to a set limit */
-static void ath6kl_reduce_credits(struct htc_credit_state_info *cred_info,
+static void ath6kl_reduce_credits(struct ath6kl_htc_credit_info *cred_info,
struct htc_endpoint_credit_dist *ep_dist,
int limit)
{
@@ -738,7 +739,7 @@ static void ath6kl_reduce_credits(struct htc_credit_state_info *cred_info,
cred_info->cur_free_credits += credits;
}
-static void ath6kl_credit_update(struct htc_credit_state_info *cred_info,
+static void ath6kl_credit_update(struct ath6kl_htc_credit_info *cred_info,
struct list_head *epdist_list)
{
struct htc_endpoint_credit_dist *cur_dist_list;
@@ -775,7 +776,7 @@ static void ath6kl_credit_update(struct htc_credit_state_info *cred_info,
* HTC has an endpoint that needs credits, ep_dist is the endpoint in
* question.
*/
-void ath6kl_seek_credits(struct htc_credit_state_info *cred_info,
+void ath6kl_seek_credits(struct ath6kl_htc_credit_info *cred_info,
struct htc_endpoint_credit_dist *ep_dist)
{
struct htc_endpoint_credit_dist *curdist_list;
@@ -851,7 +852,7 @@ out:
}
/* redistribute credits based on activity change */
-static void ath6kl_redistribute_credits(struct htc_credit_state_info *info,
+static void ath6kl_redistribute_credits(struct ath6kl_htc_credit_info *info,
struct list_head *ep_dist_list)
{
struct htc_endpoint_credit_dist *curdist_list;
@@ -884,7 +885,7 @@ static void ath6kl_redistribute_credits(struct htc_credit_state_info *info,
* structures in prioritized order as defined by the call to the
* htc_set_credit_dist() api.
*/
-void ath6kl_credit_distribute(struct htc_credit_state_info *cred_info,
+void ath6kl_credit_distribute(struct ath6kl_htc_credit_info *cred_info,
struct list_head *ep_dist_list,
enum htc_credit_dist_reason reason)
{
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 5/9] ath6kl: move all credit distribution code to htc.c
2011-10-24 9:16 [PATCH 1/9] ath6kl: remove unused A_CACHE_LINE_PAD Kalle Valo
` (2 preceding siblings ...)
2011-10-24 9:17 ` [PATCH 4/9] ath6kl: rename struct htc_credit_state_info to ath6kl_htc_credit_info Kalle Valo
@ 2011-10-24 9:17 ` Kalle Valo
2011-10-24 9:17 ` [PATCH 6/9] ath6kl: use ath6kl_credit prefix consistently Kalle Valo
` (4 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Kalle Valo @ 2011-10-24 9:17 UTC (permalink / raw)
To: kvalo; +Cc: linux-wireless
As htc is the only user there's no reason to keep it in main.c.
No functional changes.
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
---
drivers/net/wireless/ath/ath6kl/common.h | 10 -
drivers/net/wireless/ath/ath6kl/core.h | 10 -
drivers/net/wireless/ath/ath6kl/htc.c | 292 ++++++++++++++++++++++++++++++
drivers/net/wireless/ath/ath6kl/htc.h | 3
drivers/net/wireless/ath/ath6kl/main.c | 282 -----------------------------
5 files changed, 295 insertions(+), 302 deletions(-)
diff --git a/drivers/net/wireless/ath/ath6kl/common.h b/drivers/net/wireless/ath/ath6kl/common.h
index 4fb2ccf..a9fa057 100644
--- a/drivers/net/wireless/ath/ath6kl/common.h
+++ b/drivers/net/wireless/ath/ath6kl/common.h
@@ -78,16 +78,6 @@ struct ath6kl;
enum htc_credit_dist_reason;
struct ath6kl_htc_credit_info;
-int ath6kl_setup_credit_dist(void *htc_handle,
- struct ath6kl_htc_credit_info *cred_info);
-void ath6kl_credit_distribute(struct ath6kl_htc_credit_info *cred_inf,
- struct list_head *epdist_list,
- enum htc_credit_dist_reason reason);
-void ath6kl_credit_init(struct ath6kl_htc_credit_info *cred_inf,
- struct list_head *ep_list,
- int tot_credits);
-void ath6kl_seek_credits(struct ath6kl_htc_credit_info *cred_inf,
- struct htc_endpoint_credit_dist *ep_dist);
struct ath6kl *ath6kl_core_alloc(struct device *sdev);
int ath6kl_core_init(struct ath6kl *ar);
int ath6kl_unavail_ev(struct ath6kl *ar);
diff --git a/drivers/net/wireless/ath/ath6kl/core.h b/drivers/net/wireless/ath/ath6kl/core.h
index f8135a4..ae731e0 100644
--- a/drivers/net/wireless/ath/ath6kl/core.h
+++ b/drivers/net/wireless/ath/ath6kl/core.h
@@ -545,16 +545,6 @@ static inline void *ath6kl_priv(struct net_device *dev)
return wdev_priv(dev->ieee80211_ptr);
}
-static inline void ath6kl_deposit_credit_to_ep(struct ath6kl_htc_credit_info
- *cred_info,
- struct htc_endpoint_credit_dist
- *ep_dist, int credits)
-{
- ep_dist->credits += credits;
- ep_dist->cred_assngd += credits;
- cred_info->cur_free_credits -= credits;
-}
-
static inline u32 ath6kl_get_hi_item_addr(struct ath6kl *ar,
u32 item_offset)
{
diff --git a/drivers/net/wireless/ath/ath6kl/htc.c b/drivers/net/wireless/ath/ath6kl/htc.c
index 24dfc02..5cb0327 100644
--- a/drivers/net/wireless/ath/ath6kl/htc.c
+++ b/drivers/net/wireless/ath/ath6kl/htc.c
@@ -22,6 +22,298 @@
#define CALC_TXRX_PADDED_LEN(dev, len) (__ALIGN_MASK((len), (dev)->block_mask))
+/* Functions for Tx credit handling */
+static void ath6kl_deposit_credit_to_ep(struct ath6kl_htc_credit_info
+ *cred_info,
+ struct htc_endpoint_credit_dist
+ *ep_dist, int credits)
+{
+ ep_dist->credits += credits;
+ ep_dist->cred_assngd += credits;
+ cred_info->cur_free_credits -= credits;
+}
+
+static void ath6kl_credit_init(struct ath6kl_htc_credit_info *cred_info,
+ struct list_head *ep_list,
+ int tot_credits)
+{
+ struct htc_endpoint_credit_dist *cur_ep_dist;
+ int count;
+
+ cred_info->cur_free_credits = tot_credits;
+ cred_info->total_avail_credits = tot_credits;
+
+ list_for_each_entry(cur_ep_dist, ep_list, list) {
+ if (cur_ep_dist->endpoint == ENDPOINT_0)
+ continue;
+
+ cur_ep_dist->cred_min = cur_ep_dist->cred_per_msg;
+
+ if (tot_credits > 4) {
+ if ((cur_ep_dist->svc_id == WMI_DATA_BK_SVC) ||
+ (cur_ep_dist->svc_id == WMI_DATA_BE_SVC)) {
+ ath6kl_deposit_credit_to_ep(cred_info,
+ cur_ep_dist,
+ cur_ep_dist->cred_min);
+ cur_ep_dist->dist_flags |= HTC_EP_ACTIVE;
+ }
+ }
+
+ if (cur_ep_dist->svc_id == WMI_CONTROL_SVC) {
+ ath6kl_deposit_credit_to_ep(cred_info, cur_ep_dist,
+ cur_ep_dist->cred_min);
+ /*
+ * Control service is always marked active, it
+ * never goes inactive EVER.
+ */
+ cur_ep_dist->dist_flags |= HTC_EP_ACTIVE;
+ } else if (cur_ep_dist->svc_id == WMI_DATA_BK_SVC)
+ /* this is the lowest priority data endpoint */
+ /* FIXME: this looks fishy, check */
+ cred_info->lowestpri_ep_dist = cur_ep_dist->list;
+
+ /*
+ * Streams have to be created (explicit | implicit) for all
+ * kinds of traffic. BE endpoints are also inactive in the
+ * beginning. When BE traffic starts it creates implicit
+ * streams that redistributes credits.
+ *
+ * Note: all other endpoints have minimums set but are
+ * initially given NO credits. credits will be distributed
+ * as traffic activity demands
+ */
+ }
+
+ WARN_ON(cred_info->cur_free_credits <= 0);
+
+ list_for_each_entry(cur_ep_dist, ep_list, list) {
+ if (cur_ep_dist->endpoint == ENDPOINT_0)
+ continue;
+
+ if (cur_ep_dist->svc_id == WMI_CONTROL_SVC)
+ cur_ep_dist->cred_norm = cur_ep_dist->cred_per_msg;
+ else {
+ /*
+ * For the remaining data endpoints, we assume that
+ * each cred_per_msg are the same. We use a simple
+ * calculation here, we take the remaining credits
+ * and determine how many max messages this can
+ * cover and then set each endpoint's normal value
+ * equal to 3/4 this amount.
+ */
+ count = (cred_info->cur_free_credits /
+ cur_ep_dist->cred_per_msg)
+ * cur_ep_dist->cred_per_msg;
+ count = (count * 3) >> 2;
+ count = max(count, cur_ep_dist->cred_per_msg);
+ cur_ep_dist->cred_norm = count;
+
+ }
+ }
+}
+
+/* initialize and setup credit distribution */
+int ath6kl_setup_credit_dist(void *htc_handle,
+ struct ath6kl_htc_credit_info *cred_info)
+{
+ u16 servicepriority[5];
+
+ memset(cred_info, 0, sizeof(struct ath6kl_htc_credit_info));
+
+ servicepriority[0] = WMI_CONTROL_SVC; /* highest */
+ servicepriority[1] = WMI_DATA_VO_SVC;
+ servicepriority[2] = WMI_DATA_VI_SVC;
+ servicepriority[3] = WMI_DATA_BE_SVC;
+ servicepriority[4] = WMI_DATA_BK_SVC; /* lowest */
+
+ /* set priority list */
+ ath6kl_htc_set_credit_dist(htc_handle, cred_info, servicepriority, 5);
+
+ return 0;
+}
+
+/* reduce an ep's credits back to a set limit */
+static void ath6kl_reduce_credits(struct ath6kl_htc_credit_info *cred_info,
+ struct htc_endpoint_credit_dist *ep_dist,
+ int limit)
+{
+ int credits;
+
+ ep_dist->cred_assngd = limit;
+
+ if (ep_dist->credits <= limit)
+ return;
+
+ credits = ep_dist->credits - limit;
+ ep_dist->credits -= credits;
+ cred_info->cur_free_credits += credits;
+}
+
+static void ath6kl_credit_update(struct ath6kl_htc_credit_info *cred_info,
+ struct list_head *epdist_list)
+{
+ struct htc_endpoint_credit_dist *cur_dist_list;
+
+ list_for_each_entry(cur_dist_list, epdist_list, list) {
+ if (cur_dist_list->endpoint == ENDPOINT_0)
+ continue;
+
+ if (cur_dist_list->cred_to_dist > 0) {
+ cur_dist_list->credits +=
+ cur_dist_list->cred_to_dist;
+ cur_dist_list->cred_to_dist = 0;
+ if (cur_dist_list->credits >
+ cur_dist_list->cred_assngd)
+ ath6kl_reduce_credits(cred_info,
+ cur_dist_list,
+ cur_dist_list->cred_assngd);
+
+ if (cur_dist_list->credits >
+ cur_dist_list->cred_norm)
+ ath6kl_reduce_credits(cred_info, cur_dist_list,
+ cur_dist_list->cred_norm);
+
+ if (!(cur_dist_list->dist_flags & HTC_EP_ACTIVE)) {
+ if (cur_dist_list->txq_depth == 0)
+ ath6kl_reduce_credits(cred_info,
+ cur_dist_list, 0);
+ }
+ }
+ }
+}
+
+/*
+ * HTC has an endpoint that needs credits, ep_dist is the endpoint in
+ * question.
+ */
+static void ath6kl_seek_credits(struct ath6kl_htc_credit_info *cred_info,
+ struct htc_endpoint_credit_dist *ep_dist)
+{
+ struct htc_endpoint_credit_dist *curdist_list;
+ int credits = 0;
+ int need;
+
+ if (ep_dist->svc_id == WMI_CONTROL_SVC)
+ goto out;
+
+ if ((ep_dist->svc_id == WMI_DATA_VI_SVC) ||
+ (ep_dist->svc_id == WMI_DATA_VO_SVC))
+ if ((ep_dist->cred_assngd >= ep_dist->cred_norm))
+ goto out;
+
+ /*
+ * For all other services, we follow a simple algorithm of:
+ *
+ * 1. checking the free pool for credits
+ * 2. checking lower priority endpoints for credits to take
+ */
+
+ credits = min(cred_info->cur_free_credits, ep_dist->seek_cred);
+
+ if (credits >= ep_dist->seek_cred)
+ goto out;
+
+ /*
+ * We don't have enough in the free pool, try taking away from
+ * lower priority services The rule for taking away credits:
+ *
+ * 1. Only take from lower priority endpoints
+ * 2. Only take what is allocated above the minimum (never
+ * starve an endpoint completely)
+ * 3. Only take what you need.
+ */
+
+ list_for_each_entry_reverse(curdist_list,
+ &cred_info->lowestpri_ep_dist,
+ list) {
+ if (curdist_list == ep_dist)
+ break;
+
+ need = ep_dist->seek_cred - cred_info->cur_free_credits;
+
+ if ((curdist_list->cred_assngd - need) >=
+ curdist_list->cred_min) {
+ /*
+ * The current one has been allocated more than
+ * it's minimum and it has enough credits assigned
+ * above it's minimum to fulfill our need try to
+ * take away just enough to fulfill our need.
+ */
+ ath6kl_reduce_credits(cred_info, curdist_list,
+ curdist_list->cred_assngd - need);
+
+ if (cred_info->cur_free_credits >=
+ ep_dist->seek_cred)
+ break;
+ }
+
+ if (curdist_list->endpoint == ENDPOINT_0)
+ break;
+ }
+
+ credits = min(cred_info->cur_free_credits, ep_dist->seek_cred);
+
+out:
+ /* did we find some credits? */
+ if (credits)
+ ath6kl_deposit_credit_to_ep(cred_info, ep_dist, credits);
+
+ ep_dist->seek_cred = 0;
+}
+
+/* redistribute credits based on activity change */
+static void ath6kl_redistribute_credits(struct ath6kl_htc_credit_info *info,
+ struct list_head *ep_dist_list)
+{
+ struct htc_endpoint_credit_dist *curdist_list;
+
+ list_for_each_entry(curdist_list, ep_dist_list, list) {
+ if (curdist_list->endpoint == ENDPOINT_0)
+ continue;
+
+ if ((curdist_list->svc_id == WMI_DATA_BK_SVC) ||
+ (curdist_list->svc_id == WMI_DATA_BE_SVC))
+ curdist_list->dist_flags |= HTC_EP_ACTIVE;
+
+ if ((curdist_list->svc_id != WMI_CONTROL_SVC) &&
+ !(curdist_list->dist_flags & HTC_EP_ACTIVE)) {
+ if (curdist_list->txq_depth == 0)
+ ath6kl_reduce_credits(info, curdist_list, 0);
+ else
+ ath6kl_reduce_credits(info,
+ curdist_list,
+ curdist_list->cred_min);
+ }
+ }
+}
+
+/*
+ *
+ * This function is invoked whenever endpoints require credit
+ * distributions. A lock is held while this function is invoked, this
+ * function shall NOT block. The ep_dist_list is a list of distribution
+ * structures in prioritized order as defined by the call to the
+ * htc_set_credit_dist() api.
+ */
+static void ath6kl_credit_distribute(struct ath6kl_htc_credit_info *cred_info,
+ struct list_head *ep_dist_list,
+ enum htc_credit_dist_reason reason)
+{
+ switch (reason) {
+ case HTC_CREDIT_DIST_SEND_COMPLETE:
+ ath6kl_credit_update(cred_info, ep_dist_list);
+ break;
+ case HTC_CREDIT_DIST_ACTIVITY_CHANGE:
+ ath6kl_redistribute_credits(cred_info, ep_dist_list);
+ break;
+ default:
+ break;
+ }
+
+ WARN_ON(cred_info->cur_free_credits > cred_info->total_avail_credits);
+ WARN_ON(cred_info->cur_free_credits < 0);
+}
+
static void ath6kl_htc_tx_buf_align(u8 **buf, unsigned long len)
{
u8 *align_addr;
diff --git a/drivers/net/wireless/ath/ath6kl/htc.h b/drivers/net/wireless/ath/ath6kl/htc.h
index 47a588c..c68e834 100644
--- a/drivers/net/wireless/ath/ath6kl/htc.h
+++ b/drivers/net/wireless/ath/ath6kl/htc.h
@@ -570,6 +570,9 @@ int ath6kl_htc_add_rxbuf_multiple(struct htc_target *target,
int ath6kl_htc_rxmsg_pending_handler(struct htc_target *target,
u32 msg_look_ahead, int *n_pkts);
+int ath6kl_setup_credit_dist(void *htc_handle,
+ struct ath6kl_htc_credit_info *cred_info);
+
static inline void set_htc_pkt_info(struct htc_packet *packet, void *context,
u8 *buf, unsigned int len,
enum htc_endpoint_id eid, u16 tag)
diff --git a/drivers/net/wireless/ath/ath6kl/main.c b/drivers/net/wireless/ath/ath6kl/main.c
index bc9ec6c..8d9a8f3 100644
--- a/drivers/net/wireless/ath/ath6kl/main.c
+++ b/drivers/net/wireless/ath/ath6kl/main.c
@@ -622,288 +622,6 @@ void ath6kl_connect_ap_mode_sta(struct ath6kl *ar, u16 aid, u8 *mac_addr,
netif_wake_queue(ar->net_dev);
}
-/* Functions for Tx credit handling */
-void ath6kl_credit_init(struct ath6kl_htc_credit_info *cred_info,
- struct list_head *ep_list,
- int tot_credits)
-{
- struct htc_endpoint_credit_dist *cur_ep_dist;
- int count;
-
- cred_info->cur_free_credits = tot_credits;
- cred_info->total_avail_credits = tot_credits;
-
- list_for_each_entry(cur_ep_dist, ep_list, list) {
- if (cur_ep_dist->endpoint == ENDPOINT_0)
- continue;
-
- cur_ep_dist->cred_min = cur_ep_dist->cred_per_msg;
-
- if (tot_credits > 4) {
- if ((cur_ep_dist->svc_id == WMI_DATA_BK_SVC) ||
- (cur_ep_dist->svc_id == WMI_DATA_BE_SVC)) {
- ath6kl_deposit_credit_to_ep(cred_info,
- cur_ep_dist,
- cur_ep_dist->cred_min);
- cur_ep_dist->dist_flags |= HTC_EP_ACTIVE;
- }
- }
-
- if (cur_ep_dist->svc_id == WMI_CONTROL_SVC) {
- ath6kl_deposit_credit_to_ep(cred_info, cur_ep_dist,
- cur_ep_dist->cred_min);
- /*
- * Control service is always marked active, it
- * never goes inactive EVER.
- */
- cur_ep_dist->dist_flags |= HTC_EP_ACTIVE;
- } else if (cur_ep_dist->svc_id == WMI_DATA_BK_SVC)
- /* this is the lowest priority data endpoint */
- /* FIXME: this looks fishy, check */
- cred_info->lowestpri_ep_dist = cur_ep_dist->list;
-
- /*
- * Streams have to be created (explicit | implicit) for all
- * kinds of traffic. BE endpoints are also inactive in the
- * beginning. When BE traffic starts it creates implicit
- * streams that redistributes credits.
- *
- * Note: all other endpoints have minimums set but are
- * initially given NO credits. credits will be distributed
- * as traffic activity demands
- */
- }
-
- WARN_ON(cred_info->cur_free_credits <= 0);
-
- list_for_each_entry(cur_ep_dist, ep_list, list) {
- if (cur_ep_dist->endpoint == ENDPOINT_0)
- continue;
-
- if (cur_ep_dist->svc_id == WMI_CONTROL_SVC)
- cur_ep_dist->cred_norm = cur_ep_dist->cred_per_msg;
- else {
- /*
- * For the remaining data endpoints, we assume that
- * each cred_per_msg are the same. We use a simple
- * calculation here, we take the remaining credits
- * and determine how many max messages this can
- * cover and then set each endpoint's normal value
- * equal to 3/4 this amount.
- */
- count = (cred_info->cur_free_credits /
- cur_ep_dist->cred_per_msg)
- * cur_ep_dist->cred_per_msg;
- count = (count * 3) >> 2;
- count = max(count, cur_ep_dist->cred_per_msg);
- cur_ep_dist->cred_norm = count;
-
- }
- }
-}
-
-/* initialize and setup credit distribution */
-int ath6kl_setup_credit_dist(void *htc_handle,
- struct ath6kl_htc_credit_info *cred_info)
-{
- u16 servicepriority[5];
-
- memset(cred_info, 0, sizeof(struct ath6kl_htc_credit_info));
-
- servicepriority[0] = WMI_CONTROL_SVC; /* highest */
- servicepriority[1] = WMI_DATA_VO_SVC;
- servicepriority[2] = WMI_DATA_VI_SVC;
- servicepriority[3] = WMI_DATA_BE_SVC;
- servicepriority[4] = WMI_DATA_BK_SVC; /* lowest */
-
- /* set priority list */
- ath6kl_htc_set_credit_dist(htc_handle, cred_info, servicepriority, 5);
-
- return 0;
-}
-
-/* reduce an ep's credits back to a set limit */
-static void ath6kl_reduce_credits(struct ath6kl_htc_credit_info *cred_info,
- struct htc_endpoint_credit_dist *ep_dist,
- int limit)
-{
- int credits;
-
- ep_dist->cred_assngd = limit;
-
- if (ep_dist->credits <= limit)
- return;
-
- credits = ep_dist->credits - limit;
- ep_dist->credits -= credits;
- cred_info->cur_free_credits += credits;
-}
-
-static void ath6kl_credit_update(struct ath6kl_htc_credit_info *cred_info,
- struct list_head *epdist_list)
-{
- struct htc_endpoint_credit_dist *cur_dist_list;
-
- list_for_each_entry(cur_dist_list, epdist_list, list) {
- if (cur_dist_list->endpoint == ENDPOINT_0)
- continue;
-
- if (cur_dist_list->cred_to_dist > 0) {
- cur_dist_list->credits +=
- cur_dist_list->cred_to_dist;
- cur_dist_list->cred_to_dist = 0;
- if (cur_dist_list->credits >
- cur_dist_list->cred_assngd)
- ath6kl_reduce_credits(cred_info,
- cur_dist_list,
- cur_dist_list->cred_assngd);
-
- if (cur_dist_list->credits >
- cur_dist_list->cred_norm)
- ath6kl_reduce_credits(cred_info, cur_dist_list,
- cur_dist_list->cred_norm);
-
- if (!(cur_dist_list->dist_flags & HTC_EP_ACTIVE)) {
- if (cur_dist_list->txq_depth == 0)
- ath6kl_reduce_credits(cred_info,
- cur_dist_list, 0);
- }
- }
- }
-}
-
-/*
- * HTC has an endpoint that needs credits, ep_dist is the endpoint in
- * question.
- */
-void ath6kl_seek_credits(struct ath6kl_htc_credit_info *cred_info,
- struct htc_endpoint_credit_dist *ep_dist)
-{
- struct htc_endpoint_credit_dist *curdist_list;
- int credits = 0;
- int need;
-
- if (ep_dist->svc_id == WMI_CONTROL_SVC)
- goto out;
-
- if ((ep_dist->svc_id == WMI_DATA_VI_SVC) ||
- (ep_dist->svc_id == WMI_DATA_VO_SVC))
- if ((ep_dist->cred_assngd >= ep_dist->cred_norm))
- goto out;
-
- /*
- * For all other services, we follow a simple algorithm of:
- *
- * 1. checking the free pool for credits
- * 2. checking lower priority endpoints for credits to take
- */
-
- credits = min(cred_info->cur_free_credits, ep_dist->seek_cred);
-
- if (credits >= ep_dist->seek_cred)
- goto out;
-
- /*
- * We don't have enough in the free pool, try taking away from
- * lower priority services The rule for taking away credits:
- *
- * 1. Only take from lower priority endpoints
- * 2. Only take what is allocated above the minimum (never
- * starve an endpoint completely)
- * 3. Only take what you need.
- */
-
- list_for_each_entry_reverse(curdist_list,
- &cred_info->lowestpri_ep_dist,
- list) {
- if (curdist_list == ep_dist)
- break;
-
- need = ep_dist->seek_cred - cred_info->cur_free_credits;
-
- if ((curdist_list->cred_assngd - need) >=
- curdist_list->cred_min) {
- /*
- * The current one has been allocated more than
- * it's minimum and it has enough credits assigned
- * above it's minimum to fulfill our need try to
- * take away just enough to fulfill our need.
- */
- ath6kl_reduce_credits(cred_info, curdist_list,
- curdist_list->cred_assngd - need);
-
- if (cred_info->cur_free_credits >=
- ep_dist->seek_cred)
- break;
- }
-
- if (curdist_list->endpoint == ENDPOINT_0)
- break;
- }
-
- credits = min(cred_info->cur_free_credits, ep_dist->seek_cred);
-
-out:
- /* did we find some credits? */
- if (credits)
- ath6kl_deposit_credit_to_ep(cred_info, ep_dist, credits);
-
- ep_dist->seek_cred = 0;
-}
-
-/* redistribute credits based on activity change */
-static void ath6kl_redistribute_credits(struct ath6kl_htc_credit_info *info,
- struct list_head *ep_dist_list)
-{
- struct htc_endpoint_credit_dist *curdist_list;
-
- list_for_each_entry(curdist_list, ep_dist_list, list) {
- if (curdist_list->endpoint == ENDPOINT_0)
- continue;
-
- if ((curdist_list->svc_id == WMI_DATA_BK_SVC) ||
- (curdist_list->svc_id == WMI_DATA_BE_SVC))
- curdist_list->dist_flags |= HTC_EP_ACTIVE;
-
- if ((curdist_list->svc_id != WMI_CONTROL_SVC) &&
- !(curdist_list->dist_flags & HTC_EP_ACTIVE)) {
- if (curdist_list->txq_depth == 0)
- ath6kl_reduce_credits(info, curdist_list, 0);
- else
- ath6kl_reduce_credits(info,
- curdist_list,
- curdist_list->cred_min);
- }
- }
-}
-
-/*
- *
- * This function is invoked whenever endpoints require credit
- * distributions. A lock is held while this function is invoked, this
- * function shall NOT block. The ep_dist_list is a list of distribution
- * structures in prioritized order as defined by the call to the
- * htc_set_credit_dist() api.
- */
-void ath6kl_credit_distribute(struct ath6kl_htc_credit_info *cred_info,
- struct list_head *ep_dist_list,
- enum htc_credit_dist_reason reason)
-{
- switch (reason) {
- case HTC_CREDIT_DIST_SEND_COMPLETE:
- ath6kl_credit_update(cred_info, ep_dist_list);
- break;
- case HTC_CREDIT_DIST_ACTIVITY_CHANGE:
- ath6kl_redistribute_credits(cred_info, ep_dist_list);
- break;
- default:
- break;
- }
-
- WARN_ON(cred_info->cur_free_credits > cred_info->total_avail_credits);
- WARN_ON(cred_info->cur_free_credits < 0);
-}
-
void disconnect_timer_handler(unsigned long ptr)
{
struct net_device *dev = (struct net_device *)ptr;
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 6/9] ath6kl: use ath6kl_credit prefix consistently
2011-10-24 9:16 [PATCH 1/9] ath6kl: remove unused A_CACHE_LINE_PAD Kalle Valo
` (3 preceding siblings ...)
2011-10-24 9:17 ` [PATCH 5/9] ath6kl: move all credit distribution code to htc.c Kalle Valo
@ 2011-10-24 9:17 ` Kalle Valo
2011-10-24 9:17 ` [PATCH 7/9] ath6kl: remove unused debug levels Kalle Valo
` (3 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Kalle Valo @ 2011-10-24 9:17 UTC (permalink / raw)
To: kvalo; +Cc: linux-wireless
Not all credit functions used that prefix, fix that.
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
---
drivers/net/wireless/ath/ath6kl/htc.c | 63 ++++++++++++++++----------------
drivers/net/wireless/ath/ath6kl/htc.h | 4 +-
drivers/net/wireless/ath/ath6kl/init.c | 2 +
3 files changed, 34 insertions(+), 35 deletions(-)
diff --git a/drivers/net/wireless/ath/ath6kl/htc.c b/drivers/net/wireless/ath/ath6kl/htc.c
index 5cb0327..511eebd 100644
--- a/drivers/net/wireless/ath/ath6kl/htc.c
+++ b/drivers/net/wireless/ath/ath6kl/htc.c
@@ -23,10 +23,9 @@
#define CALC_TXRX_PADDED_LEN(dev, len) (__ALIGN_MASK((len), (dev)->block_mask))
/* Functions for Tx credit handling */
-static void ath6kl_deposit_credit_to_ep(struct ath6kl_htc_credit_info
- *cred_info,
- struct htc_endpoint_credit_dist
- *ep_dist, int credits)
+static void ath6kl_credit_deposit(struct ath6kl_htc_credit_info *cred_info,
+ struct htc_endpoint_credit_dist *ep_dist,
+ int credits)
{
ep_dist->credits += credits;
ep_dist->cred_assngd += credits;
@@ -52,16 +51,16 @@ static void ath6kl_credit_init(struct ath6kl_htc_credit_info *cred_info,
if (tot_credits > 4) {
if ((cur_ep_dist->svc_id == WMI_DATA_BK_SVC) ||
(cur_ep_dist->svc_id == WMI_DATA_BE_SVC)) {
- ath6kl_deposit_credit_to_ep(cred_info,
- cur_ep_dist,
- cur_ep_dist->cred_min);
+ ath6kl_credit_deposit(cred_info,
+ cur_ep_dist,
+ cur_ep_dist->cred_min);
cur_ep_dist->dist_flags |= HTC_EP_ACTIVE;
}
}
if (cur_ep_dist->svc_id == WMI_CONTROL_SVC) {
- ath6kl_deposit_credit_to_ep(cred_info, cur_ep_dist,
- cur_ep_dist->cred_min);
+ ath6kl_credit_deposit(cred_info, cur_ep_dist,
+ cur_ep_dist->cred_min);
/*
* Control service is always marked active, it
* never goes inactive EVER.
@@ -113,8 +112,8 @@ static void ath6kl_credit_init(struct ath6kl_htc_credit_info *cred_info,
}
/* initialize and setup credit distribution */
-int ath6kl_setup_credit_dist(void *htc_handle,
- struct ath6kl_htc_credit_info *cred_info)
+int ath6kl_credit_setup(void *htc_handle,
+ struct ath6kl_htc_credit_info *cred_info)
{
u16 servicepriority[5];
@@ -133,9 +132,9 @@ int ath6kl_setup_credit_dist(void *htc_handle,
}
/* reduce an ep's credits back to a set limit */
-static void ath6kl_reduce_credits(struct ath6kl_htc_credit_info *cred_info,
- struct htc_endpoint_credit_dist *ep_dist,
- int limit)
+static void ath6kl_credit_reduce(struct ath6kl_htc_credit_info *cred_info,
+ struct htc_endpoint_credit_dist *ep_dist,
+ int limit)
{
int credits;
@@ -164,19 +163,19 @@ static void ath6kl_credit_update(struct ath6kl_htc_credit_info *cred_info,
cur_dist_list->cred_to_dist = 0;
if (cur_dist_list->credits >
cur_dist_list->cred_assngd)
- ath6kl_reduce_credits(cred_info,
+ ath6kl_credit_reduce(cred_info,
cur_dist_list,
cur_dist_list->cred_assngd);
if (cur_dist_list->credits >
cur_dist_list->cred_norm)
- ath6kl_reduce_credits(cred_info, cur_dist_list,
- cur_dist_list->cred_norm);
+ ath6kl_credit_reduce(cred_info, cur_dist_list,
+ cur_dist_list->cred_norm);
if (!(cur_dist_list->dist_flags & HTC_EP_ACTIVE)) {
if (cur_dist_list->txq_depth == 0)
- ath6kl_reduce_credits(cred_info,
- cur_dist_list, 0);
+ ath6kl_credit_reduce(cred_info,
+ cur_dist_list, 0);
}
}
}
@@ -186,7 +185,7 @@ static void ath6kl_credit_update(struct ath6kl_htc_credit_info *cred_info,
* HTC has an endpoint that needs credits, ep_dist is the endpoint in
* question.
*/
-static void ath6kl_seek_credits(struct ath6kl_htc_credit_info *cred_info,
+static void ath6kl_credit_seek(struct ath6kl_htc_credit_info *cred_info,
struct htc_endpoint_credit_dist *ep_dist)
{
struct htc_endpoint_credit_dist *curdist_list;
@@ -239,8 +238,8 @@ static void ath6kl_seek_credits(struct ath6kl_htc_credit_info *cred_info,
* above it's minimum to fulfill our need try to
* take away just enough to fulfill our need.
*/
- ath6kl_reduce_credits(cred_info, curdist_list,
- curdist_list->cred_assngd - need);
+ ath6kl_credit_reduce(cred_info, curdist_list,
+ curdist_list->cred_assngd - need);
if (cred_info->cur_free_credits >=
ep_dist->seek_cred)
@@ -256,14 +255,14 @@ static void ath6kl_seek_credits(struct ath6kl_htc_credit_info *cred_info,
out:
/* did we find some credits? */
if (credits)
- ath6kl_deposit_credit_to_ep(cred_info, ep_dist, credits);
+ ath6kl_credit_deposit(cred_info, ep_dist, credits);
ep_dist->seek_cred = 0;
}
/* redistribute credits based on activity change */
-static void ath6kl_redistribute_credits(struct ath6kl_htc_credit_info *info,
- struct list_head *ep_dist_list)
+static void ath6kl_credit_redistribute(struct ath6kl_htc_credit_info *info,
+ struct list_head *ep_dist_list)
{
struct htc_endpoint_credit_dist *curdist_list;
@@ -278,11 +277,11 @@ static void ath6kl_redistribute_credits(struct ath6kl_htc_credit_info *info,
if ((curdist_list->svc_id != WMI_CONTROL_SVC) &&
!(curdist_list->dist_flags & HTC_EP_ACTIVE)) {
if (curdist_list->txq_depth == 0)
- ath6kl_reduce_credits(info, curdist_list, 0);
+ ath6kl_credit_reduce(info, curdist_list, 0);
else
- ath6kl_reduce_credits(info,
- curdist_list,
- curdist_list->cred_min);
+ ath6kl_credit_reduce(info,
+ curdist_list,
+ curdist_list->cred_min);
}
}
}
@@ -304,7 +303,7 @@ static void ath6kl_credit_distribute(struct ath6kl_htc_credit_info *cred_info,
ath6kl_credit_update(cred_info, ep_dist_list);
break;
case HTC_CREDIT_DIST_ACTIVITY_CHANGE:
- ath6kl_redistribute_credits(cred_info, ep_dist_list);
+ ath6kl_credit_redistribute(cred_info, ep_dist_list);
break;
default:
break;
@@ -529,7 +528,7 @@ static int htc_check_credits(struct htc_target *target,
ath6kl_dbg(ATH6KL_DBG_HTC, "htc creds ctxt 0x%p dist 0x%p\n",
target->credit_info, &ep->cred_dist);
- ath6kl_seek_credits(target->credit_info, &ep->cred_dist);
+ ath6kl_credit_seek(target->credit_info, &ep->cred_dist);
ep->cred_dist.seek_cred = 0;
@@ -552,7 +551,7 @@ static int htc_check_credits(struct htc_target *target,
ath6kl_dbg(ATH6KL_DBG_HTC, "htc creds ctxt 0x%p dist 0x%p\n",
target->credit_info, &ep->cred_dist);
- ath6kl_seek_credits(target->credit_info, &ep->cred_dist);
+ ath6kl_credit_seek(target->credit_info, &ep->cred_dist);
/* see if we were successful in getting more */
if (ep->cred_dist.credits < ep->cred_dist.cred_per_msg) {
diff --git a/drivers/net/wireless/ath/ath6kl/htc.h b/drivers/net/wireless/ath/ath6kl/htc.h
index c68e834..57672e1 100644
--- a/drivers/net/wireless/ath/ath6kl/htc.h
+++ b/drivers/net/wireless/ath/ath6kl/htc.h
@@ -570,8 +570,8 @@ int ath6kl_htc_add_rxbuf_multiple(struct htc_target *target,
int ath6kl_htc_rxmsg_pending_handler(struct htc_target *target,
u32 msg_look_ahead, int *n_pkts);
-int ath6kl_setup_credit_dist(void *htc_handle,
- struct ath6kl_htc_credit_info *cred_info);
+int ath6kl_credit_setup(void *htc_handle,
+ struct ath6kl_htc_credit_info *cred_info);
static inline void set_htc_pkt_info(struct htc_packet *packet, void *context,
u8 *buf, unsigned int len,
diff --git a/drivers/net/wireless/ath/ath6kl/init.c b/drivers/net/wireless/ath/ath6kl/init.c
index 777ee2c..d161862 100644
--- a/drivers/net/wireless/ath/ath6kl/init.c
+++ b/drivers/net/wireless/ath/ath6kl/init.c
@@ -1516,7 +1516,7 @@ static int ath6kl_init(struct net_device *dev)
ath6kl_refill_amsdu_rxbufs(ar, ATH6KL_MAX_AMSDU_RX_BUFFERS);
/* setup credit distribution */
- ath6kl_setup_credit_dist(ar->htc_target, &ar->credit_state_info);
+ ath6kl_credit_setup(ar->htc_target, &ar->credit_state_info);
ath6kl_cookie_init(ar);
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 7/9] ath6kl: remove unused debug levels
2011-10-24 9:16 [PATCH 1/9] ath6kl: remove unused A_CACHE_LINE_PAD Kalle Valo
` (4 preceding siblings ...)
2011-10-24 9:17 ` [PATCH 6/9] ath6kl: use ath6kl_credit prefix consistently Kalle Valo
@ 2011-10-24 9:17 ` Kalle Valo
2011-10-24 9:17 ` [PATCH 8/9] ath6kl: add debug messages for credit handling Kalle Valo
` (2 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Kalle Valo @ 2011-10-24 9:17 UTC (permalink / raw)
To: kvalo; +Cc: linux-wireless
Few levels had only one user so I changed them to use WLAN_CFG.
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
---
drivers/net/wireless/ath/ath6kl/debug.h | 8 ++++----
drivers/net/wireless/ath/ath6kl/main.c | 5 ++---
2 files changed, 6 insertions(+), 7 deletions(-)
diff --git a/drivers/net/wireless/ath/ath6kl/debug.h b/drivers/net/wireless/ath/ath6kl/debug.h
index cbabc25..afb747b 100644
--- a/drivers/net/wireless/ath/ath6kl/debug.h
+++ b/drivers/net/wireless/ath/ath6kl/debug.h
@@ -20,16 +20,16 @@
#include "hif.h"
enum ATH6K_DEBUG_MASK {
- ATH6KL_DBG_WLAN_CONNECT = BIT(0), /* wlan connect */
- ATH6KL_DBG_WLAN_SCAN = BIT(1), /* wlan scan */
+ /* hole */
+ /* hole */
ATH6KL_DBG_WLAN_TX = BIT(2), /* wlan tx */
ATH6KL_DBG_WLAN_RX = BIT(3), /* wlan rx */
ATH6KL_DBG_BMI = BIT(4), /* bmi tracing */
ATH6KL_DBG_HTC = BIT(5),
ATH6KL_DBG_HIF = BIT(6),
ATH6KL_DBG_IRQ = BIT(7), /* interrupt processing */
- ATH6KL_DBG_PM = BIT(8), /* power management */
- ATH6KL_DBG_WLAN_NODE = BIT(9), /* general wlan node tracing */
+ /* hole */
+ /* hole */
ATH6KL_DBG_WMI = BIT(10), /* wmi tracing */
ATH6KL_DBG_TRC = BIT(11), /* generic func tracing */
ATH6KL_DBG_SCATTER = BIT(12), /* hif scatter tracing */
diff --git a/drivers/net/wireless/ath/ath6kl/main.c b/drivers/net/wireless/ath/ath6kl/main.c
index 8d9a8f3..9db86e3 100644
--- a/drivers/net/wireless/ath/ath6kl/main.c
+++ b/drivers/net/wireless/ath/ath6kl/main.c
@@ -742,7 +742,7 @@ void ath6kl_scan_complete_evt(struct ath6kl *ar, int status)
ath6kl_wmi_bssfilter_cmd(ar->wmi, NONE_BSS_FILTER, 0);
}
- ath6kl_dbg(ATH6KL_DBG_WLAN_SCAN, "scan complete: %d\n", status);
+ ath6kl_dbg(ATH6KL_DBG_WLAN_CFG, "scan complete: %d\n", status);
}
void ath6kl_connect_event(struct ath6kl *ar, u16 channel, u8 *bssid,
@@ -1089,8 +1089,7 @@ void ath6kl_disconnect_event(struct ath6kl *ar, u8 reason, u8 *bssid,
del_timer(&ar->disconnect_timer);
- ath6kl_dbg(ATH6KL_DBG_WLAN_CONNECT,
- "disconnect reason is %d\n", reason);
+ ath6kl_dbg(ATH6KL_DBG_WLAN_CFG, "disconnect reason is %d\n", reason);
/*
* If the event is due to disconnect cmd from the host, only they
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 8/9] ath6kl: add debug messages for credit handling
2011-10-24 9:16 [PATCH 1/9] ath6kl: remove unused A_CACHE_LINE_PAD Kalle Valo
` (5 preceding siblings ...)
2011-10-24 9:17 ` [PATCH 7/9] ath6kl: remove unused debug levels Kalle Valo
@ 2011-10-24 9:17 ` Kalle Valo
2011-10-24 9:18 ` [PATCH 9/9] ath6kl: add more boot debug messages Kalle Valo
2011-10-26 8:33 ` [PATCH 1/9] ath6kl: remove unused A_CACHE_LINE_PAD Kalle Valo
8 siblings, 0 replies; 10+ messages in thread
From: Kalle Valo @ 2011-10-24 9:17 UTC (permalink / raw)
To: kvalo; +Cc: linux-wireless
Also take few from htc debug level which are more suitable for credit.
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
---
drivers/net/wireless/ath/ath6kl/debug.c | 33 +++++++++++-----------
drivers/net/wireless/ath/ath6kl/debug.h | 2 +
drivers/net/wireless/ath/ath6kl/htc.c | 46 ++++++++++++++++---------------
3 files changed, 41 insertions(+), 40 deletions(-)
diff --git a/drivers/net/wireless/ath/ath6kl/debug.c b/drivers/net/wireless/ath/ath6kl/debug.c
index 324fdb3..7bc2656 100644
--- a/drivers/net/wireless/ath/ath6kl/debug.c
+++ b/drivers/net/wireless/ath/ath6kl/debug.c
@@ -142,47 +142,46 @@ void ath6kl_dump_registers(struct ath6kl_device *dev,
static void dump_cred_dist(struct htc_endpoint_credit_dist *ep_dist)
{
- ath6kl_dbg(ATH6KL_DBG_ANY,
+ ath6kl_dbg(ATH6KL_DBG_CREDIT,
"--- endpoint: %d svc_id: 0x%X ---\n",
ep_dist->endpoint, ep_dist->svc_id);
- ath6kl_dbg(ATH6KL_DBG_ANY, " dist_flags : 0x%X\n",
+ ath6kl_dbg(ATH6KL_DBG_CREDIT, " dist_flags : 0x%X\n",
ep_dist->dist_flags);
- ath6kl_dbg(ATH6KL_DBG_ANY, " cred_norm : %d\n",
+ ath6kl_dbg(ATH6KL_DBG_CREDIT, " cred_norm : %d\n",
ep_dist->cred_norm);
- ath6kl_dbg(ATH6KL_DBG_ANY, " cred_min : %d\n",
+ ath6kl_dbg(ATH6KL_DBG_CREDIT, " cred_min : %d\n",
ep_dist->cred_min);
- ath6kl_dbg(ATH6KL_DBG_ANY, " credits : %d\n",
+ ath6kl_dbg(ATH6KL_DBG_CREDIT, " credits : %d\n",
ep_dist->credits);
- ath6kl_dbg(ATH6KL_DBG_ANY, " cred_assngd : %d\n",
+ ath6kl_dbg(ATH6KL_DBG_CREDIT, " cred_assngd : %d\n",
ep_dist->cred_assngd);
- ath6kl_dbg(ATH6KL_DBG_ANY, " seek_cred : %d\n",
+ ath6kl_dbg(ATH6KL_DBG_CREDIT, " seek_cred : %d\n",
ep_dist->seek_cred);
- ath6kl_dbg(ATH6KL_DBG_ANY, " cred_sz : %d\n",
+ ath6kl_dbg(ATH6KL_DBG_CREDIT, " cred_sz : %d\n",
ep_dist->cred_sz);
- ath6kl_dbg(ATH6KL_DBG_ANY, " cred_per_msg : %d\n",
+ ath6kl_dbg(ATH6KL_DBG_CREDIT, " cred_per_msg : %d\n",
ep_dist->cred_per_msg);
- ath6kl_dbg(ATH6KL_DBG_ANY, " cred_to_dist : %d\n",
+ ath6kl_dbg(ATH6KL_DBG_CREDIT, " cred_to_dist : %d\n",
ep_dist->cred_to_dist);
- ath6kl_dbg(ATH6KL_DBG_ANY, " txq_depth : %d\n",
+ ath6kl_dbg(ATH6KL_DBG_CREDIT, " txq_depth : %d\n",
get_queue_depth(&ep_dist->htc_ep->txq));
- ath6kl_dbg(ATH6KL_DBG_ANY,
+ ath6kl_dbg(ATH6KL_DBG_CREDIT,
"----------------------------------\n");
}
+/* FIXME: move to htc.c */
void dump_cred_dist_stats(struct htc_target *target)
{
struct htc_endpoint_credit_dist *ep_list;
- if (!AR_DBG_LVL_CHECK(ATH6KL_DBG_TRC))
+ if (!AR_DBG_LVL_CHECK(ATH6KL_DBG_CREDIT))
return;
list_for_each_entry(ep_list, &target->cred_dist_list, list)
dump_cred_dist(ep_list);
- ath6kl_dbg(ATH6KL_DBG_HTC, "ctxt:%p dist:%p\n",
- target->credit_info, NULL);
- ath6kl_dbg(ATH6KL_DBG_HTC,
- "credit distribution, total : %d, free : %d\n",
+ ath6kl_dbg(ATH6KL_DBG_CREDIT,
+ "credit distribution total %d free %d\n",
target->credit_info->total_avail_credits,
target->credit_info->cur_free_credits);
}
diff --git a/drivers/net/wireless/ath/ath6kl/debug.h b/drivers/net/wireless/ath/ath6kl/debug.h
index afb747b..491485e 100644
--- a/drivers/net/wireless/ath/ath6kl/debug.h
+++ b/drivers/net/wireless/ath/ath6kl/debug.h
@@ -20,7 +20,7 @@
#include "hif.h"
enum ATH6K_DEBUG_MASK {
- /* hole */
+ ATH6KL_DBG_CREDIT = BIT(0),
/* hole */
ATH6KL_DBG_WLAN_TX = BIT(2), /* wlan tx */
ATH6KL_DBG_WLAN_RX = BIT(3), /* wlan rx */
diff --git a/drivers/net/wireless/ath/ath6kl/htc.c b/drivers/net/wireless/ath/ath6kl/htc.c
index 511eebd..a971c2f 100644
--- a/drivers/net/wireless/ath/ath6kl/htc.c
+++ b/drivers/net/wireless/ath/ath6kl/htc.c
@@ -27,6 +27,9 @@ static void ath6kl_credit_deposit(struct ath6kl_htc_credit_info *cred_info,
struct htc_endpoint_credit_dist *ep_dist,
int credits)
{
+ ath6kl_dbg(ATH6KL_DBG_CREDIT, "credit deposit ep %d credits %d\n",
+ ep_dist->endpoint, credits);
+
ep_dist->credits += credits;
ep_dist->cred_assngd += credits;
cred_info->cur_free_credits -= credits;
@@ -39,6 +42,8 @@ static void ath6kl_credit_init(struct ath6kl_htc_credit_info *cred_info,
struct htc_endpoint_credit_dist *cur_ep_dist;
int count;
+ ath6kl_dbg(ATH6KL_DBG_CREDIT, "credit init total %d\n", tot_credits);
+
cred_info->cur_free_credits = tot_credits;
cred_info->total_avail_credits = tot_credits;
@@ -108,6 +113,15 @@ static void ath6kl_credit_init(struct ath6kl_htc_credit_info *cred_info,
cur_ep_dist->cred_norm = count;
}
+
+ ath6kl_dbg(ATH6KL_DBG_CREDIT,
+ "credit ep %d svc_id %d credits %d per_msg %d norm %d min %d\n",
+ cur_ep_dist->endpoint,
+ cur_ep_dist->svc_id,
+ cur_ep_dist->credits,
+ cur_ep_dist->cred_per_msg,
+ cur_ep_dist->cred_norm,
+ cur_ep_dist->cred_min);
}
}
@@ -138,6 +152,9 @@ static void ath6kl_credit_reduce(struct ath6kl_htc_credit_info *cred_info,
{
int credits;
+ ath6kl_dbg(ATH6KL_DBG_CREDIT, "credit reduce ep %d limit %d\n",
+ ep_dist->endpoint, limit);
+
ep_dist->cred_assngd = limit;
if (ep_dist->credits <= limit)
@@ -515,7 +532,7 @@ static int htc_check_credits(struct htc_target *target,
*req_cred = (len > target->tgt_cred_sz) ?
DIV_ROUND_UP(len, target->tgt_cred_sz) : 1;
- ath6kl_dbg(ATH6KL_DBG_HTC, "htc creds required %d got %d\n",
+ ath6kl_dbg(ATH6KL_DBG_CREDIT, "credit check need %d got %d\n",
*req_cred, ep->cred_dist.credits);
if (ep->cred_dist.credits < *req_cred) {
@@ -525,16 +542,13 @@ static int htc_check_credits(struct htc_target *target,
/* Seek more credits */
ep->cred_dist.seek_cred = *req_cred - ep->cred_dist.credits;
- ath6kl_dbg(ATH6KL_DBG_HTC, "htc creds ctxt 0x%p dist 0x%p\n",
- target->credit_info, &ep->cred_dist);
-
ath6kl_credit_seek(target->credit_info, &ep->cred_dist);
ep->cred_dist.seek_cred = 0;
if (ep->cred_dist.credits < *req_cred) {
- ath6kl_dbg(ATH6KL_DBG_HTC,
- "htc creds not enough credits for ep %d\n",
+ ath6kl_dbg(ATH6KL_DBG_CREDIT,
+ "credit not found for ep %d\n",
eid);
return -EINVAL;
}
@@ -548,9 +562,6 @@ static int htc_check_credits(struct htc_target *target,
ep->cred_dist.seek_cred =
ep->cred_dist.cred_per_msg - ep->cred_dist.credits;
- ath6kl_dbg(ATH6KL_DBG_HTC, "htc creds ctxt 0x%p dist 0x%p\n",
- target->credit_info, &ep->cred_dist);
-
ath6kl_credit_seek(target->credit_info, &ep->cred_dist);
/* see if we were successful in getting more */
@@ -558,7 +569,8 @@ static int htc_check_credits(struct htc_target *target,
/* tell the target we need credits ASAP! */
*flags |= HTC_FLAGS_NEED_CREDIT_UPDATE;
ep->ep_st.cred_low_indicate += 1;
- ath6kl_dbg(ATH6KL_DBG_HTC, "htc creds host needs credits\n");
+ ath6kl_dbg(ATH6KL_DBG_CREDIT,
+ "credit we need credits asap\n");
}
}
@@ -1495,9 +1507,6 @@ static void htc_proc_cred_rpt(struct htc_target *target,
int tot_credits = 0, i;
bool dist = false;
- ath6kl_dbg(ATH6KL_DBG_HTC,
- "htc creds report entries %d\n", n_entries);
-
spin_lock_bh(&target->tx_lock);
for (i = 0; i < n_entries; i++, rpt++) {
@@ -1509,8 +1518,8 @@ static void htc_proc_cred_rpt(struct htc_target *target,
endpoint = &target->endpoint[rpt->eid];
- ath6kl_dbg(ATH6KL_DBG_HTC,
- "htc creds report ep %d credits %d\n",
+ ath6kl_dbg(ATH6KL_DBG_CREDIT,
+ "credit report ep %d credits %d\n",
rpt->eid, rpt->credits);
endpoint->ep_st.tx_cred_rpt += 1;
@@ -1551,18 +1560,11 @@ static void htc_proc_cred_rpt(struct htc_target *target,
tot_credits += rpt->credits;
}
- ath6kl_dbg(ATH6KL_DBG_HTC,
- "htc creds report tot_credits %d\n",
- tot_credits);
-
if (dist) {
/*
* This was a credit return based on a completed send
* operations note, this is done with the lock held
*/
- ath6kl_dbg(ATH6KL_DBG_HTC, "htc creds ctxt 0x%p dist 0x%p\n",
- target->credit_info, &target->cred_dist_list);
-
ath6kl_credit_distribute(target->credit_info,
&target->cred_dist_list,
HTC_CREDIT_DIST_SEND_COMPLETE);
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 9/9] ath6kl: add more boot debug messages
2011-10-24 9:16 [PATCH 1/9] ath6kl: remove unused A_CACHE_LINE_PAD Kalle Valo
` (6 preceding siblings ...)
2011-10-24 9:17 ` [PATCH 8/9] ath6kl: add debug messages for credit handling Kalle Valo
@ 2011-10-24 9:18 ` Kalle Valo
2011-10-26 8:33 ` [PATCH 1/9] ath6kl: remove unused A_CACHE_LINE_PAD Kalle Valo
8 siblings, 0 replies; 10+ messages in thread
From: Kalle Valo @ 2011-10-24 9:18 UTC (permalink / raw)
To: kvalo; +Cc: linux-wireless
Move some of the debug logs to boot level because they are more
interesting when debugging boot issues.
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
---
drivers/net/wireless/ath/ath6kl/htc.c | 8 ++++----
drivers/net/wireless/ath/ath6kl/sdio.c | 22 +++++++++++++---------
2 files changed, 17 insertions(+), 13 deletions(-)
diff --git a/drivers/net/wireless/ath/ath6kl/htc.c b/drivers/net/wireless/ath/ath6kl/htc.c
index a971c2f..976e352 100644
--- a/drivers/net/wireless/ath/ath6kl/htc.c
+++ b/drivers/net/wireless/ath/ath6kl/htc.c
@@ -2499,7 +2499,7 @@ static void htc_setup_msg_bndl(struct htc_target *target)
target->msg_per_bndl_max = min(target->max_scat_entries,
target->msg_per_bndl_max);
- ath6kl_dbg(ATH6KL_DBG_HTC,
+ ath6kl_dbg(ATH6KL_DBG_BOOT,
"htc bundling allowed msg_per_bndl_max %d\n",
target->msg_per_bndl_max);
@@ -2509,7 +2509,7 @@ static void htc_setup_msg_bndl(struct htc_target *target)
target->max_tx_bndl_sz = min(HIF_MBOX0_EXT_WIDTH,
target->max_xfer_szper_scatreq);
- ath6kl_dbg(ATH6KL_DBG_HTC, "htc max_rx_bndl_sz %d max_tx_bndl_sz %d\n",
+ ath6kl_dbg(ATH6KL_DBG_BOOT, "htc max_rx_bndl_sz %d max_tx_bndl_sz %d\n",
target->max_rx_bndl_sz, target->max_tx_bndl_sz);
if (target->max_tx_bndl_sz)
@@ -2563,7 +2563,7 @@ int ath6kl_htc_wait_target(struct htc_target *target)
target->tgt_creds = le16_to_cpu(rdy_msg->ver2_0_info.cred_cnt);
target->tgt_cred_sz = le16_to_cpu(rdy_msg->ver2_0_info.cred_sz);
- ath6kl_dbg(ATH6KL_DBG_HTC,
+ ath6kl_dbg(ATH6KL_DBG_BOOT,
"htc target ready credits %d size %d\n",
target->tgt_creds, target->tgt_cred_sz);
@@ -2578,7 +2578,7 @@ int ath6kl_htc_wait_target(struct htc_target *target)
target->msg_per_bndl_max = 0;
}
- ath6kl_dbg(ATH6KL_DBG_HTC, "htc using protocol %s (%d)\n",
+ ath6kl_dbg(ATH6KL_DBG_BOOT, "htc using protocol %s (%d)\n",
(target->htc_tgt_ver == HTC_VERSION_2P0) ? "2.0" : ">= 2.1",
target->htc_tgt_ver);
diff --git a/drivers/net/wireless/ath/ath6kl/sdio.c b/drivers/net/wireless/ath/ath6kl/sdio.c
index 58e31f6..b7bbe56 100644
--- a/drivers/net/wireless/ath/ath6kl/sdio.c
+++ b/drivers/net/wireless/ath/ath6kl/sdio.c
@@ -471,6 +471,8 @@ static int ath6kl_sdio_power_on(struct ath6kl_sdio *ar_sdio)
if (!ar_sdio->is_disabled)
return 0;
+ ath6kl_dbg(ATH6KL_DBG_BOOT, "sdio power on\n");
+
sdio_claim_host(func);
ret = sdio_enable_func(func);
@@ -500,6 +502,8 @@ static int ath6kl_sdio_power_off(struct ath6kl_sdio *ar_sdio)
if (ar_sdio->is_disabled)
return 0;
+ ath6kl_dbg(ATH6KL_DBG_BOOT, "sdio power off\n");
+
/* Disable the card */
sdio_claim_host(ar_sdio->func);
ret = sdio_disable_func(ar_sdio->func);
@@ -678,8 +682,8 @@ static int ath6kl_sdio_enable_scatter(struct ath6kl *ar)
MAX_SCATTER_REQUESTS, virt_scat);
if (!ret) {
- ath6kl_dbg(ATH6KL_DBG_SCATTER,
- "hif-scatter enabled: max scatter req : %d entries: %d\n",
+ ath6kl_dbg(ATH6KL_DBG_BOOT,
+ "hif-scatter enabled requests %d entries %d\n",
MAX_SCATTER_REQUESTS,
MAX_SCATTER_ENTRIES_PER_REQ);
@@ -703,8 +707,8 @@ static int ath6kl_sdio_enable_scatter(struct ath6kl *ar)
return ret;
}
- ath6kl_dbg(ATH6KL_DBG_SCATTER,
- "Vitual scatter enabled, max_scat_req:%d, entries:%d\n",
+ ath6kl_dbg(ATH6KL_DBG_BOOT,
+ "virtual scatter enabled requests %d entries %d\n",
ATH6KL_SCATTER_REQS, ATH6KL_SCATTER_ENTRIES_PER_REQ);
target->max_scat_entries = ATH6KL_SCATTER_ENTRIES_PER_REQ;
@@ -778,8 +782,8 @@ static int ath6kl_sdio_probe(struct sdio_func *func,
struct ath6kl *ar;
int count;
- ath6kl_dbg(ATH6KL_DBG_SDIO,
- "new func %d vendor 0x%x device 0x%x block 0x%x/0x%x\n",
+ ath6kl_dbg(ATH6KL_DBG_BOOT,
+ "sdio new func %d vendor 0x%x device 0x%x block 0x%x/0x%x\n",
func->num, func->vendor, func->device,
func->max_blksize, func->cur_blksize);
@@ -840,7 +844,7 @@ static int ath6kl_sdio_probe(struct sdio_func *func,
goto err_cfg80211;
}
- ath6kl_dbg(ATH6KL_DBG_SDIO, "4-bit async irq mode enabled\n");
+ ath6kl_dbg(ATH6KL_DBG_BOOT, "4-bit async irq mode enabled\n");
}
/* give us some time to enable, in ms */
@@ -888,8 +892,8 @@ static void ath6kl_sdio_remove(struct sdio_func *func)
{
struct ath6kl_sdio *ar_sdio;
- ath6kl_dbg(ATH6KL_DBG_SDIO,
- "removed func %d vendor 0x%x device 0x%x\n",
+ ath6kl_dbg(ATH6KL_DBG_BOOT,
+ "sdio removed func %d vendor 0x%x device 0x%x\n",
func->num, func->vendor, func->device);
ar_sdio = sdio_get_drvdata(func);
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH 1/9] ath6kl: remove unused A_CACHE_LINE_PAD
2011-10-24 9:16 [PATCH 1/9] ath6kl: remove unused A_CACHE_LINE_PAD Kalle Valo
` (7 preceding siblings ...)
2011-10-24 9:18 ` [PATCH 9/9] ath6kl: add more boot debug messages Kalle Valo
@ 2011-10-26 8:33 ` Kalle Valo
8 siblings, 0 replies; 10+ messages in thread
From: Kalle Valo @ 2011-10-26 8:33 UTC (permalink / raw)
To: Kalle Valo; +Cc: linux-wireless
On 10/24/2011 12:16 PM, Kalle Valo wrote:
> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
All nine patches applied. There were some conflicts but git was able to
handle that.
Kalle
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2011-10-26 8:33 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-24 9:16 [PATCH 1/9] ath6kl: remove unused A_CACHE_LINE_PAD Kalle Valo
2011-10-24 9:16 ` [PATCH 2/9] ath6kl: use ath6kl prefix in credit functions Kalle Valo
2011-10-24 9:17 ` [PATCH 3/9] ath6kl: rename struct htc_endpoint_credit_dist.htc_rsvd to htc_ep Kalle Valo
2011-10-24 9:17 ` [PATCH 4/9] ath6kl: rename struct htc_credit_state_info to ath6kl_htc_credit_info Kalle Valo
2011-10-24 9:17 ` [PATCH 5/9] ath6kl: move all credit distribution code to htc.c Kalle Valo
2011-10-24 9:17 ` [PATCH 6/9] ath6kl: use ath6kl_credit prefix consistently Kalle Valo
2011-10-24 9:17 ` [PATCH 7/9] ath6kl: remove unused debug levels Kalle Valo
2011-10-24 9:17 ` [PATCH 8/9] ath6kl: add debug messages for credit handling Kalle Valo
2011-10-24 9:18 ` [PATCH 9/9] ath6kl: add more boot debug messages Kalle Valo
2011-10-26 8:33 ` [PATCH 1/9] ath6kl: remove unused A_CACHE_LINE_PAD Kalle Valo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).