mac80211: add pending ath9k/ath10k patches
[openwrt/staging/chunkeey.git] / package / kernel / mac80211 / patches / 308-ath10k-cleanup-copy-engine-send-completion.patch
1 From: Rajkumar Manoharan <rmanohar@qti.qualcomm.com>
2 Date: Fri, 23 Oct 2015 18:01:05 +0530
3 Subject: [PATCH] ath10k: cleanup copy engine send completion
4
5 The physical address necessary to unmap DMA ('bufferp') is stored
6 in ath10k_skb_cb as 'paddr'. ath10k doesn't rely on the meta/transfer_id
7 when handling send completion (htc ep id is stored in sk_buff control
8 buffer). So the unused output arguments {bufferp, nbytesp and transfer_idp}
9 are removed from CE send completion. This change is needed before removing
10 the shadow copy of copy engine (CE) descriptors in follow up patch.
11
12 Signed-off-by: Rajkumar Manoharan <rmanohar@qti.qualcomm.com>
13 Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
14 ---
15
16 --- a/drivers/net/wireless/ath/ath10k/ce.c
17 +++ b/drivers/net/wireless/ath/ath10k/ce.c
18 @@ -578,17 +578,13 @@ int ath10k_ce_revoke_recv_next(struct at
19 * The caller takes responsibility for any necessary locking.
20 */
21 int ath10k_ce_completed_send_next_nolock(struct ath10k_ce_pipe *ce_state,
22 - void **per_transfer_contextp,
23 - u32 *bufferp,
24 - unsigned int *nbytesp,
25 - unsigned int *transfer_idp)
26 + void **per_transfer_contextp)
27 {
28 struct ath10k_ce_ring *src_ring = ce_state->src_ring;
29 u32 ctrl_addr = ce_state->ctrl_addr;
30 struct ath10k *ar = ce_state->ar;
31 unsigned int nentries_mask = src_ring->nentries_mask;
32 unsigned int sw_index = src_ring->sw_index;
33 - struct ce_desc *sdesc, *sbase;
34 unsigned int read_index;
35
36 if (src_ring->hw_index == sw_index) {
37 @@ -613,15 +609,6 @@ int ath10k_ce_completed_send_next_nolock
38 if (read_index == sw_index)
39 return -EIO;
40
41 - sbase = src_ring->base_addr_owner_space;
42 - sdesc = CE_SRC_RING_TO_DESC(sbase, sw_index);
43 -
44 - /* Return data from completed source descriptor */
45 - *bufferp = __le32_to_cpu(sdesc->addr);
46 - *nbytesp = __le16_to_cpu(sdesc->nbytes);
47 - *transfer_idp = MS(__le16_to_cpu(sdesc->flags),
48 - CE_DESC_FLAGS_META_DATA);
49 -
50 if (per_transfer_contextp)
51 *per_transfer_contextp =
52 src_ring->per_transfer_context[sw_index];
53 @@ -696,10 +683,7 @@ int ath10k_ce_cancel_send_next(struct at
54 }
55
56 int ath10k_ce_completed_send_next(struct ath10k_ce_pipe *ce_state,
57 - void **per_transfer_contextp,
58 - u32 *bufferp,
59 - unsigned int *nbytesp,
60 - unsigned int *transfer_idp)
61 + void **per_transfer_contextp)
62 {
63 struct ath10k *ar = ce_state->ar;
64 struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
65 @@ -707,9 +691,7 @@ int ath10k_ce_completed_send_next(struct
66
67 spin_lock_bh(&ar_pci->ce_lock);
68 ret = ath10k_ce_completed_send_next_nolock(ce_state,
69 - per_transfer_contextp,
70 - bufferp, nbytesp,
71 - transfer_idp);
72 + per_transfer_contextp);
73 spin_unlock_bh(&ar_pci->ce_lock);
74
75 return ret;
76 --- a/drivers/net/wireless/ath/ath10k/ce.h
77 +++ b/drivers/net/wireless/ath/ath10k/ce.h
78 @@ -192,16 +192,10 @@ int ath10k_ce_completed_recv_next(struct
79 * Pops 1 completed send buffer from Source ring.
80 */
81 int ath10k_ce_completed_send_next(struct ath10k_ce_pipe *ce_state,
82 - void **per_transfer_contextp,
83 - u32 *bufferp,
84 - unsigned int *nbytesp,
85 - unsigned int *transfer_idp);
86 + void **per_transfer_contextp);
87
88 int ath10k_ce_completed_send_next_nolock(struct ath10k_ce_pipe *ce_state,
89 - void **per_transfer_contextp,
90 - u32 *bufferp,
91 - unsigned int *nbytesp,
92 - unsigned int *transfer_idp);
93 + void **per_transfer_contextp);
94
95 /*==================CE Engine Initialization=======================*/
96
97 --- a/drivers/net/wireless/ath/ath10k/pci.c
98 +++ b/drivers/net/wireless/ath/ath10k/pci.c
99 @@ -910,9 +910,8 @@ static int ath10k_pci_diag_read_mem(stru
100 goto done;
101
102 i = 0;
103 - while (ath10k_ce_completed_send_next_nolock(ce_diag, NULL, &buf,
104 - &completed_nbytes,
105 - &id) != 0) {
106 + while (ath10k_ce_completed_send_next_nolock(ce_diag,
107 + NULL) != 0) {
108 mdelay(1);
109 if (i++ > DIAG_ACCESS_CE_TIMEOUT_MS) {
110 ret = -EBUSY;
111 @@ -1073,9 +1072,8 @@ static int ath10k_pci_diag_write_mem(str
112 goto done;
113
114 i = 0;
115 - while (ath10k_ce_completed_send_next_nolock(ce_diag, NULL, &buf,
116 - &completed_nbytes,
117 - &id) != 0) {
118 + while (ath10k_ce_completed_send_next_nolock(ce_diag,
119 + NULL) != 0) {
120 mdelay(1);
121
122 if (i++ > DIAG_ACCESS_CE_TIMEOUT_MS) {
123 @@ -1139,13 +1137,9 @@ static void ath10k_pci_htc_tx_cb(struct
124 struct ath10k *ar = ce_state->ar;
125 struct sk_buff_head list;
126 struct sk_buff *skb;
127 - u32 ce_data;
128 - unsigned int nbytes;
129 - unsigned int transfer_id;
130
131 __skb_queue_head_init(&list);
132 - while (ath10k_ce_completed_send_next(ce_state, (void **)&skb, &ce_data,
133 - &nbytes, &transfer_id) == 0) {
134 + while (ath10k_ce_completed_send_next(ce_state, (void **)&skb) == 0) {
135 /* no need to call tx completion for NULL pointers */
136 if (skb == NULL)
137 continue;
138 @@ -1215,12 +1209,8 @@ static void ath10k_pci_htt_tx_cb(struct
139 {
140 struct ath10k *ar = ce_state->ar;
141 struct sk_buff *skb;
142 - u32 ce_data;
143 - unsigned int nbytes;
144 - unsigned int transfer_id;
145
146 - while (ath10k_ce_completed_send_next(ce_state, (void **)&skb, &ce_data,
147 - &nbytes, &transfer_id) == 0) {
148 + while (ath10k_ce_completed_send_next(ce_state, (void **)&skb) == 0) {
149 /* no need to call tx completion for NULL pointers */
150 if (!skb)
151 continue;
152 @@ -1796,12 +1786,8 @@ err_dma:
153 static void ath10k_pci_bmi_send_done(struct ath10k_ce_pipe *ce_state)
154 {
155 struct bmi_xfer *xfer;
156 - u32 ce_data;
157 - unsigned int nbytes;
158 - unsigned int transfer_id;
159
160 - if (ath10k_ce_completed_send_next(ce_state, (void **)&xfer, &ce_data,
161 - &nbytes, &transfer_id))
162 + if (ath10k_ce_completed_send_next(ce_state, (void **)&xfer))
163 return;
164
165 xfer->tx_done = true;