diff options
author | Michal Kazior <michal.kazior@tieto.com> | 2013-07-05 09:15:14 -0400 |
---|---|---|
committer | Kalle Valo <kvalo@qca.qualcomm.com> | 2013-07-30 11:01:18 -0400 |
commit | edb8236df4d0429d973e093062a4806471f5efa2 (patch) | |
tree | 501bffd05fe6c5593663d93d16f84af70f584e49 | |
parent | cd003fad17d9258efdc5dd658666731377cfebd1 (diff) |
ath10k: embed HTT struct inside ath10k
This reduces number of allocations and simplifies
memory managemnt.
Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
-rw-r--r-- | drivers/net/wireless/ath/ath10k/core.c | 12 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath10k/core.h | 7 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath10k/htt.c | 25 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath10k/htt.h | 3 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath10k/htt_rx.c | 3 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath10k/htt_tx.c | 2 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath10k/mac.c | 16 |
7 files changed, 34 insertions, 34 deletions
diff --git a/drivers/net/wireless/ath/ath10k/core.c b/drivers/net/wireless/ath/ath10k/core.c index 4199560b4693..f1312fae8056 100644 --- a/drivers/net/wireless/ath/ath10k/core.c +++ b/drivers/net/wireless/ath/ath10k/core.c | |||
@@ -556,9 +556,9 @@ int ath10k_core_register(struct ath10k *ar) | |||
556 | if (status) | 556 | if (status) |
557 | goto err_wmi_detach; | 557 | goto err_wmi_detach; |
558 | 558 | ||
559 | ar->htt = ath10k_htt_attach(ar); | 559 | status = ath10k_htt_attach(ar); |
560 | if (!ar->htt) { | 560 | if (status) { |
561 | status = -ENOMEM; | 561 | ath10k_err("could not attach htt (%d)\n", status); |
562 | goto err_wmi_detach; | 562 | goto err_wmi_detach; |
563 | } | 563 | } |
564 | 564 | ||
@@ -585,7 +585,7 @@ int ath10k_core_register(struct ath10k *ar) | |||
585 | goto err_disconnect_htc; | 585 | goto err_disconnect_htc; |
586 | } | 586 | } |
587 | 587 | ||
588 | status = ath10k_htt_attach_target(ar->htt); | 588 | status = ath10k_htt_attach_target(&ar->htt); |
589 | if (status) | 589 | if (status) |
590 | goto err_disconnect_htc; | 590 | goto err_disconnect_htc; |
591 | 591 | ||
@@ -606,7 +606,7 @@ err_unregister_mac: | |||
606 | err_disconnect_htc: | 606 | err_disconnect_htc: |
607 | ath10k_htc_stop(&ar->htc); | 607 | ath10k_htc_stop(&ar->htc); |
608 | err_htt_detach: | 608 | err_htt_detach: |
609 | ath10k_htt_detach(ar->htt); | 609 | ath10k_htt_detach(&ar->htt); |
610 | err_wmi_detach: | 610 | err_wmi_detach: |
611 | ath10k_wmi_detach(ar); | 611 | ath10k_wmi_detach(ar); |
612 | err: | 612 | err: |
@@ -621,7 +621,7 @@ void ath10k_core_unregister(struct ath10k *ar) | |||
621 | * unhappy about callback failures. */ | 621 | * unhappy about callback failures. */ |
622 | ath10k_mac_unregister(ar); | 622 | ath10k_mac_unregister(ar); |
623 | ath10k_htc_stop(&ar->htc); | 623 | ath10k_htc_stop(&ar->htc); |
624 | ath10k_htt_detach(ar->htt); | 624 | ath10k_htt_detach(&ar->htt); |
625 | ath10k_wmi_detach(ar); | 625 | ath10k_wmi_detach(ar); |
626 | } | 626 | } |
627 | EXPORT_SYMBOL(ath10k_core_unregister); | 627 | EXPORT_SYMBOL(ath10k_core_unregister); |
diff --git a/drivers/net/wireless/ath/ath10k/core.h b/drivers/net/wireless/ath/ath10k/core.h index dfd4fe1e82fb..2f7065c48f57 100644 --- a/drivers/net/wireless/ath/ath10k/core.h +++ b/drivers/net/wireless/ath/ath10k/core.h | |||
@@ -23,6 +23,7 @@ | |||
23 | #include <linux/types.h> | 23 | #include <linux/types.h> |
24 | #include <linux/pci.h> | 24 | #include <linux/pci.h> |
25 | 25 | ||
26 | #include "htt.h" | ||
26 | #include "htc.h" | 27 | #include "htc.h" |
27 | #include "hw.h" | 28 | #include "hw.h" |
28 | #include "targaddrs.h" | 29 | #include "targaddrs.h" |
@@ -273,15 +274,13 @@ struct ath10k { | |||
273 | const struct ath10k_hif_ops *ops; | 274 | const struct ath10k_hif_ops *ops; |
274 | } hif; | 275 | } hif; |
275 | 276 | ||
276 | struct ath10k_wmi wmi; | ||
277 | |||
278 | wait_queue_head_t event_queue; | 277 | wait_queue_head_t event_queue; |
279 | bool is_target_paused; | 278 | bool is_target_paused; |
280 | 279 | ||
281 | struct ath10k_bmi bmi; | 280 | struct ath10k_bmi bmi; |
281 | struct ath10k_wmi wmi; | ||
282 | struct ath10k_htc htc; | 282 | struct ath10k_htc htc; |
283 | 283 | struct ath10k_htt htt; | |
284 | struct ath10k_htt *htt; | ||
285 | 284 | ||
286 | struct ath10k_hw_params { | 285 | struct ath10k_hw_params { |
287 | u32 id; | 286 | u32 id; |
diff --git a/drivers/net/wireless/ath/ath10k/htt.c b/drivers/net/wireless/ath/ath10k/htt.c index 2bfb9b488e09..39342c5cfcb2 100644 --- a/drivers/net/wireless/ath/ath10k/htt.c +++ b/drivers/net/wireless/ath/ath10k/htt.c | |||
@@ -16,6 +16,7 @@ | |||
16 | */ | 16 | */ |
17 | 17 | ||
18 | #include <linux/slab.h> | 18 | #include <linux/slab.h> |
19 | #include <linux/if_ether.h> | ||
19 | 20 | ||
20 | #include "htt.h" | 21 | #include "htt.h" |
21 | #include "core.h" | 22 | #include "core.h" |
@@ -47,15 +48,11 @@ static int ath10k_htt_htc_attach(struct ath10k_htt *htt) | |||
47 | return 0; | 48 | return 0; |
48 | } | 49 | } |
49 | 50 | ||
50 | struct ath10k_htt *ath10k_htt_attach(struct ath10k *ar) | 51 | int ath10k_htt_attach(struct ath10k *ar) |
51 | { | 52 | { |
52 | struct ath10k_htt *htt; | 53 | struct ath10k_htt *htt = &ar->htt; |
53 | int ret; | 54 | int ret; |
54 | 55 | ||
55 | htt = kzalloc(sizeof(*htt), GFP_KERNEL); | ||
56 | if (!htt) | ||
57 | return NULL; | ||
58 | |||
59 | htt->ar = ar; | 56 | htt->ar = ar; |
60 | htt->max_throughput_mbps = 800; | 57 | htt->max_throughput_mbps = 800; |
61 | 58 | ||
@@ -65,8 +62,11 @@ struct ath10k_htt *ath10k_htt_attach(struct ath10k *ar) | |||
65 | * since ath10k_htt_rx_attach involves sending a rx ring configure | 62 | * since ath10k_htt_rx_attach involves sending a rx ring configure |
66 | * message to the target. | 63 | * message to the target. |
67 | */ | 64 | */ |
68 | if (ath10k_htt_htc_attach(htt)) | 65 | ret = ath10k_htt_htc_attach(htt); |
66 | if (ret) { | ||
67 | ath10k_err("could not attach htt htc (%d)\n", ret); | ||
69 | goto err_htc_attach; | 68 | goto err_htc_attach; |
69 | } | ||
70 | 70 | ||
71 | ret = ath10k_htt_tx_attach(htt); | 71 | ret = ath10k_htt_tx_attach(htt); |
72 | if (ret) { | 72 | if (ret) { |
@@ -74,8 +74,11 @@ struct ath10k_htt *ath10k_htt_attach(struct ath10k *ar) | |||
74 | goto err_htc_attach; | 74 | goto err_htc_attach; |
75 | } | 75 | } |
76 | 76 | ||
77 | if (ath10k_htt_rx_attach(htt)) | 77 | ret = ath10k_htt_rx_attach(htt); |
78 | if (ret) { | ||
79 | ath10k_err("could not attach htt rx (%d)\n", ret); | ||
78 | goto err_rx_attach; | 80 | goto err_rx_attach; |
81 | } | ||
79 | 82 | ||
80 | /* | 83 | /* |
81 | * Prefetch enough data to satisfy target | 84 | * Prefetch enough data to satisfy target |
@@ -89,13 +92,12 @@ struct ath10k_htt *ath10k_htt_attach(struct ath10k *ar) | |||
89 | 8 + /* llc snap */ | 92 | 8 + /* llc snap */ |
90 | 2; /* ip4 dscp or ip6 priority */ | 93 | 2; /* ip4 dscp or ip6 priority */ |
91 | 94 | ||
92 | return htt; | 95 | return 0; |
93 | 96 | ||
94 | err_rx_attach: | 97 | err_rx_attach: |
95 | ath10k_htt_tx_detach(htt); | 98 | ath10k_htt_tx_detach(htt); |
96 | err_htc_attach: | 99 | err_htc_attach: |
97 | kfree(htt); | 100 | return ret; |
98 | return NULL; | ||
99 | } | 101 | } |
100 | 102 | ||
101 | #define HTT_TARGET_VERSION_TIMEOUT_HZ (3*HZ) | 103 | #define HTT_TARGET_VERSION_TIMEOUT_HZ (3*HZ) |
@@ -148,5 +150,4 @@ void ath10k_htt_detach(struct ath10k_htt *htt) | |||
148 | { | 150 | { |
149 | ath10k_htt_rx_detach(htt); | 151 | ath10k_htt_rx_detach(htt); |
150 | ath10k_htt_tx_detach(htt); | 152 | ath10k_htt_tx_detach(htt); |
151 | kfree(htt); | ||
152 | } | 153 | } |
diff --git a/drivers/net/wireless/ath/ath10k/htt.h b/drivers/net/wireless/ath/ath10k/htt.h index a7a7aa040536..318be4629cde 100644 --- a/drivers/net/wireless/ath/ath10k/htt.h +++ b/drivers/net/wireless/ath/ath10k/htt.h | |||
@@ -20,7 +20,6 @@ | |||
20 | 20 | ||
21 | #include <linux/bug.h> | 21 | #include <linux/bug.h> |
22 | 22 | ||
23 | #include "core.h" | ||
24 | #include "htc.h" | 23 | #include "htc.h" |
25 | #include "rx_desc.h" | 24 | #include "rx_desc.h" |
26 | 25 | ||
@@ -1317,7 +1316,7 @@ struct htt_rx_desc { | |||
1317 | #define HTT_LOG2_MAX_CACHE_LINE_SIZE 7 /* 2^7 = 128 */ | 1316 | #define HTT_LOG2_MAX_CACHE_LINE_SIZE 7 /* 2^7 = 128 */ |
1318 | #define HTT_MAX_CACHE_LINE_SIZE_MASK ((1 << HTT_LOG2_MAX_CACHE_LINE_SIZE) - 1) | 1317 | #define HTT_MAX_CACHE_LINE_SIZE_MASK ((1 << HTT_LOG2_MAX_CACHE_LINE_SIZE) - 1) |
1319 | 1318 | ||
1320 | struct ath10k_htt *ath10k_htt_attach(struct ath10k *ar); | 1319 | int ath10k_htt_attach(struct ath10k *ar); |
1321 | int ath10k_htt_attach_target(struct ath10k_htt *htt); | 1320 | int ath10k_htt_attach_target(struct ath10k_htt *htt); |
1322 | void ath10k_htt_detach(struct ath10k_htt *htt); | 1321 | void ath10k_htt_detach(struct ath10k_htt *htt); |
1323 | 1322 | ||
diff --git a/drivers/net/wireless/ath/ath10k/htt_rx.c b/drivers/net/wireless/ath/ath10k/htt_rx.c index de058d7adca8..04f08d946479 100644 --- a/drivers/net/wireless/ath/ath10k/htt_rx.c +++ b/drivers/net/wireless/ath/ath10k/htt_rx.c | |||
@@ -15,6 +15,7 @@ | |||
15 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
16 | */ | 16 | */ |
17 | 17 | ||
18 | #include "core.h" | ||
18 | #include "htc.h" | 19 | #include "htc.h" |
19 | #include "htt.h" | 20 | #include "htt.h" |
20 | #include "txrx.h" | 21 | #include "txrx.h" |
@@ -1036,7 +1037,7 @@ end: | |||
1036 | 1037 | ||
1037 | void ath10k_htt_t2h_msg_handler(struct ath10k *ar, struct sk_buff *skb) | 1038 | void ath10k_htt_t2h_msg_handler(struct ath10k *ar, struct sk_buff *skb) |
1038 | { | 1039 | { |
1039 | struct ath10k_htt *htt = ar->htt; | 1040 | struct ath10k_htt *htt = &ar->htt; |
1040 | struct htt_resp *resp = (struct htt_resp *)skb->data; | 1041 | struct htt_resp *resp = (struct htt_resp *)skb->data; |
1041 | 1042 | ||
1042 | /* confirm alignment */ | 1043 | /* confirm alignment */ |
diff --git a/drivers/net/wireless/ath/ath10k/htt_tx.c b/drivers/net/wireless/ath/ath10k/htt_tx.c index fa568f10e9dd..dc3f3e8de32b 100644 --- a/drivers/net/wireless/ath/ath10k/htt_tx.c +++ b/drivers/net/wireless/ath/ath10k/htt_tx.c | |||
@@ -153,7 +153,7 @@ void ath10k_htt_tx_detach(struct ath10k_htt *htt) | |||
153 | void ath10k_htt_htc_tx_complete(struct ath10k *ar, struct sk_buff *skb) | 153 | void ath10k_htt_htc_tx_complete(struct ath10k *ar, struct sk_buff *skb) |
154 | { | 154 | { |
155 | struct ath10k_skb_cb *skb_cb = ATH10K_SKB_CB(skb); | 155 | struct ath10k_skb_cb *skb_cb = ATH10K_SKB_CB(skb); |
156 | struct ath10k_htt *htt = ar->htt; | 156 | struct ath10k_htt *htt = &ar->htt; |
157 | 157 | ||
158 | if (skb_cb->htt.is_conf) { | 158 | if (skb_cb->htt.is_conf) { |
159 | dev_kfree_skb_any(skb); | 159 | dev_kfree_skb_any(skb); |
diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c index 87fa3c2d9382..f91701c6963c 100644 --- a/drivers/net/wireless/ath/ath10k/mac.c +++ b/drivers/net/wireless/ath/ath10k/mac.c | |||
@@ -1397,15 +1397,15 @@ static void ath10k_tx_htt(struct ath10k *ar, struct sk_buff *skb) | |||
1397 | int ret; | 1397 | int ret; |
1398 | 1398 | ||
1399 | if (ieee80211_is_mgmt(hdr->frame_control)) | 1399 | if (ieee80211_is_mgmt(hdr->frame_control)) |
1400 | ret = ath10k_htt_mgmt_tx(ar->htt, skb); | 1400 | ret = ath10k_htt_mgmt_tx(&ar->htt, skb); |
1401 | else if (ieee80211_is_nullfunc(hdr->frame_control)) | 1401 | else if (ieee80211_is_nullfunc(hdr->frame_control)) |
1402 | /* FW does not report tx status properly for NullFunc frames | 1402 | /* FW does not report tx status properly for NullFunc frames |
1403 | * unless they are sent through mgmt tx path. mac80211 sends | 1403 | * unless they are sent through mgmt tx path. mac80211 sends |
1404 | * those frames when it detects link/beacon loss and depends on | 1404 | * those frames when it detects link/beacon loss and depends on |
1405 | * the tx status to be correct. */ | 1405 | * the tx status to be correct. */ |
1406 | ret = ath10k_htt_mgmt_tx(ar->htt, skb); | 1406 | ret = ath10k_htt_mgmt_tx(&ar->htt, skb); |
1407 | else | 1407 | else |
1408 | ret = ath10k_htt_tx(ar->htt, skb); | 1408 | ret = ath10k_htt_tx(&ar->htt, skb); |
1409 | 1409 | ||
1410 | if (ret) { | 1410 | if (ret) { |
1411 | ath10k_warn("tx failed (%d). dropping packet.\n", ret); | 1411 | ath10k_warn("tx failed (%d). dropping packet.\n", ret); |
@@ -2659,12 +2659,12 @@ static void ath10k_flush(struct ieee80211_hw *hw, u32 queues, bool drop) | |||
2659 | if (drop) | 2659 | if (drop) |
2660 | return; | 2660 | return; |
2661 | 2661 | ||
2662 | ret = wait_event_timeout(ar->htt->empty_tx_wq, ({ | 2662 | ret = wait_event_timeout(ar->htt.empty_tx_wq, ({ |
2663 | bool empty; | 2663 | bool empty; |
2664 | spin_lock_bh(&ar->htt->tx_lock); | 2664 | spin_lock_bh(&ar->htt.tx_lock); |
2665 | empty = bitmap_empty(ar->htt->used_msdu_ids, | 2665 | empty = bitmap_empty(ar->htt.used_msdu_ids, |
2666 | ar->htt->max_num_pending_tx); | 2666 | ar->htt.max_num_pending_tx); |
2667 | spin_unlock_bh(&ar->htt->tx_lock); | 2667 | spin_unlock_bh(&ar->htt.tx_lock); |
2668 | (empty); | 2668 | (empty); |
2669 | }), ATH10K_FLUSH_TIMEOUT_HZ); | 2669 | }), ATH10K_FLUSH_TIMEOUT_HZ); |
2670 | if (ret <= 0) | 2670 | if (ret <= 0) |