aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRajkumar Manoharan <rmanohar@qti.qualcomm.com>2016-03-22 07:52:17 -0400
committerKalle Valo <kvalo@qca.qualcomm.com>2016-04-04 10:03:21 -0400
commit24d9ef5eff5057bb6339ed1cf852a2b2a7be324d (patch)
tree7fcba08891904054dd43d4558cfad21e0161a9f3
parente3a91f877c60ce8b29d8cd180c23f3de33a7d7e1 (diff)
ath10k: cleanup copy engine receive next completion
The physical address necessary to unmap DMA ('bufferp') is stored in ath10k_skb_cb as 'paddr'. For diag register read and write operations, 'paddr' is stored in transfer context. ath10k doesn't rely on the meta/transfer_id. So the unused output arguments {bufferp, nbytesp and transfer_idp} are removed from CE recv_next completion. Signed-off-by: Rajkumar Manoharan <rmanohar@qti.qualcomm.com> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
-rw-r--r--drivers/net/wireless/ath/ath10k/ce.c21
-rw-r--r--drivers/net/wireless/ath/ath10k/ce.h10
-rw-r--r--drivers/net/wireless/ath/ath10k/pci.c43
3 files changed, 22 insertions, 52 deletions
diff --git a/drivers/net/wireless/ath/ath10k/ce.c b/drivers/net/wireless/ath/ath10k/ce.c
index edf3629288bc..d6da404c9fa7 100644
--- a/drivers/net/wireless/ath/ath10k/ce.c
+++ b/drivers/net/wireless/ath/ath10k/ce.c
@@ -444,14 +444,10 @@ int ath10k_ce_rx_post_buf(struct ath10k_ce_pipe *pipe, void *ctx, u32 paddr)
444 */ 444 */
445int ath10k_ce_completed_recv_next_nolock(struct ath10k_ce_pipe *ce_state, 445int ath10k_ce_completed_recv_next_nolock(struct ath10k_ce_pipe *ce_state,
446 void **per_transfer_contextp, 446 void **per_transfer_contextp,
447 u32 *bufferp, 447 unsigned int *nbytesp)
448 unsigned int *nbytesp,
449 unsigned int *transfer_idp,
450 unsigned int *flagsp)
451{ 448{
452 struct ath10k_ce_ring *dest_ring = ce_state->dest_ring; 449 struct ath10k_ce_ring *dest_ring = ce_state->dest_ring;
453 unsigned int nentries_mask = dest_ring->nentries_mask; 450 unsigned int nentries_mask = dest_ring->nentries_mask;
454 struct ath10k *ar = ce_state->ar;
455 unsigned int sw_index = dest_ring->sw_index; 451 unsigned int sw_index = dest_ring->sw_index;
456 452
457 struct ce_desc *base = dest_ring->base_addr_owner_space; 453 struct ce_desc *base = dest_ring->base_addr_owner_space;
@@ -476,14 +472,7 @@ int ath10k_ce_completed_recv_next_nolock(struct ath10k_ce_pipe *ce_state,
476 desc->nbytes = 0; 472 desc->nbytes = 0;
477 473
478 /* Return data from completed destination descriptor */ 474 /* Return data from completed destination descriptor */
479 *bufferp = __le32_to_cpu(sdesc.addr);
480 *nbytesp = nbytes; 475 *nbytesp = nbytes;
481 *transfer_idp = MS(__le16_to_cpu(sdesc.flags), CE_DESC_FLAGS_META_DATA);
482
483 if (__le16_to_cpu(sdesc.flags) & CE_DESC_FLAGS_BYTE_SWAP)
484 *flagsp = CE_RECV_FLAG_SWAPPED;
485 else
486 *flagsp = 0;
487 476
488 if (per_transfer_contextp) 477 if (per_transfer_contextp)
489 *per_transfer_contextp = 478 *per_transfer_contextp =
@@ -501,10 +490,7 @@ int ath10k_ce_completed_recv_next_nolock(struct ath10k_ce_pipe *ce_state,
501 490
502int ath10k_ce_completed_recv_next(struct ath10k_ce_pipe *ce_state, 491int ath10k_ce_completed_recv_next(struct ath10k_ce_pipe *ce_state,
503 void **per_transfer_contextp, 492 void **per_transfer_contextp,
504 u32 *bufferp, 493 unsigned int *nbytesp)
505 unsigned int *nbytesp,
506 unsigned int *transfer_idp,
507 unsigned int *flagsp)
508{ 494{
509 struct ath10k *ar = ce_state->ar; 495 struct ath10k *ar = ce_state->ar;
510 struct ath10k_pci *ar_pci = ath10k_pci_priv(ar); 496 struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
@@ -513,8 +499,7 @@ int ath10k_ce_completed_recv_next(struct ath10k_ce_pipe *ce_state,
513 spin_lock_bh(&ar_pci->ce_lock); 499 spin_lock_bh(&ar_pci->ce_lock);
514 ret = ath10k_ce_completed_recv_next_nolock(ce_state, 500 ret = ath10k_ce_completed_recv_next_nolock(ce_state,
515 per_transfer_contextp, 501 per_transfer_contextp,
516 bufferp, nbytesp, 502 nbytesp);
517 transfer_idp, flagsp);
518 spin_unlock_bh(&ar_pci->ce_lock); 503 spin_unlock_bh(&ar_pci->ce_lock);
519 504
520 return ret; 505 return ret;
diff --git a/drivers/net/wireless/ath/ath10k/ce.h b/drivers/net/wireless/ath/ath10k/ce.h
index dac676817532..68717e5b9d89 100644
--- a/drivers/net/wireless/ath/ath10k/ce.h
+++ b/drivers/net/wireless/ath/ath10k/ce.h
@@ -177,10 +177,7 @@ int ath10k_ce_rx_post_buf(struct ath10k_ce_pipe *pipe, void *ctx, u32 paddr);
177 */ 177 */
178int ath10k_ce_completed_recv_next(struct ath10k_ce_pipe *ce_state, 178int ath10k_ce_completed_recv_next(struct ath10k_ce_pipe *ce_state,
179 void **per_transfer_contextp, 179 void **per_transfer_contextp,
180 u32 *bufferp, 180 unsigned int *nbytesp);
181 unsigned int *nbytesp,
182 unsigned int *transfer_idp,
183 unsigned int *flagsp);
184/* 181/*
185 * Supply data for the next completed unprocessed send descriptor. 182 * Supply data for the next completed unprocessed send descriptor.
186 * Pops 1 completed send buffer from Source ring. 183 * Pops 1 completed send buffer from Source ring.
@@ -212,10 +209,7 @@ int ath10k_ce_revoke_recv_next(struct ath10k_ce_pipe *ce_state,
212 209
213int ath10k_ce_completed_recv_next_nolock(struct ath10k_ce_pipe *ce_state, 210int ath10k_ce_completed_recv_next_nolock(struct ath10k_ce_pipe *ce_state,
214 void **per_transfer_contextp, 211 void **per_transfer_contextp,
215 u32 *bufferp, 212 unsigned int *nbytesp);
216 unsigned int *nbytesp,
217 unsigned int *transfer_idp,
218 unsigned int *flagsp);
219 213
220/* 214/*
221 * Support clean shutdown by allowing the caller to cancel 215 * Support clean shutdown by allowing the caller to cancel
diff --git a/drivers/net/wireless/ath/ath10k/pci.c b/drivers/net/wireless/ath/ath10k/pci.c
index b3cff1d3364a..290a61afde1a 100644
--- a/drivers/net/wireless/ath/ath10k/pci.c
+++ b/drivers/net/wireless/ath/ath10k/pci.c
@@ -870,10 +870,8 @@ static int ath10k_pci_diag_read_mem(struct ath10k *ar, u32 address, void *data,
870{ 870{
871 struct ath10k_pci *ar_pci = ath10k_pci_priv(ar); 871 struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
872 int ret = 0; 872 int ret = 0;
873 u32 buf; 873 u32 *buf;
874 unsigned int completed_nbytes, orig_nbytes, remaining_bytes; 874 unsigned int completed_nbytes, orig_nbytes, remaining_bytes;
875 unsigned int id;
876 unsigned int flags;
877 struct ath10k_ce_pipe *ce_diag; 875 struct ath10k_ce_pipe *ce_diag;
878 /* Host buffer address in CE space */ 876 /* Host buffer address in CE space */
879 u32 ce_data; 877 u32 ce_data;
@@ -909,7 +907,7 @@ static int ath10k_pci_diag_read_mem(struct ath10k *ar, u32 address, void *data,
909 nbytes = min_t(unsigned int, remaining_bytes, 907 nbytes = min_t(unsigned int, remaining_bytes,
910 DIAG_TRANSFER_LIMIT); 908 DIAG_TRANSFER_LIMIT);
911 909
912 ret = __ath10k_ce_rx_post_buf(ce_diag, NULL, ce_data); 910 ret = __ath10k_ce_rx_post_buf(ce_diag, &ce_data, ce_data);
913 if (ret != 0) 911 if (ret != 0)
914 goto done; 912 goto done;
915 913
@@ -940,9 +938,10 @@ static int ath10k_pci_diag_read_mem(struct ath10k *ar, u32 address, void *data,
940 } 938 }
941 939
942 i = 0; 940 i = 0;
943 while (ath10k_ce_completed_recv_next_nolock(ce_diag, NULL, &buf, 941 while (ath10k_ce_completed_recv_next_nolock(ce_diag,
944 &completed_nbytes, 942 (void **)&buf,
945 &id, &flags) != 0) { 943 &completed_nbytes)
944 != 0) {
946 mdelay(1); 945 mdelay(1);
947 946
948 if (i++ > DIAG_ACCESS_CE_TIMEOUT_MS) { 947 if (i++ > DIAG_ACCESS_CE_TIMEOUT_MS) {
@@ -956,7 +955,7 @@ static int ath10k_pci_diag_read_mem(struct ath10k *ar, u32 address, void *data,
956 goto done; 955 goto done;
957 } 956 }
958 957
959 if (buf != ce_data) { 958 if (*buf != ce_data) {
960 ret = -EIO; 959 ret = -EIO;
961 goto done; 960 goto done;
962 } 961 }
@@ -1026,10 +1025,8 @@ int ath10k_pci_diag_write_mem(struct ath10k *ar, u32 address,
1026{ 1025{
1027 struct ath10k_pci *ar_pci = ath10k_pci_priv(ar); 1026 struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
1028 int ret = 0; 1027 int ret = 0;
1029 u32 buf; 1028 u32 *buf;
1030 unsigned int completed_nbytes, orig_nbytes, remaining_bytes; 1029 unsigned int completed_nbytes, orig_nbytes, remaining_bytes;
1031 unsigned int id;
1032 unsigned int flags;
1033 struct ath10k_ce_pipe *ce_diag; 1030 struct ath10k_ce_pipe *ce_diag;
1034 void *data_buf = NULL; 1031 void *data_buf = NULL;
1035 u32 ce_data; /* Host buffer address in CE space */ 1032 u32 ce_data; /* Host buffer address in CE space */
@@ -1078,7 +1075,7 @@ int ath10k_pci_diag_write_mem(struct ath10k *ar, u32 address,
1078 nbytes = min_t(int, remaining_bytes, DIAG_TRANSFER_LIMIT); 1075 nbytes = min_t(int, remaining_bytes, DIAG_TRANSFER_LIMIT);
1079 1076
1080 /* Set up to receive directly into Target(!) address */ 1077 /* Set up to receive directly into Target(!) address */
1081 ret = __ath10k_ce_rx_post_buf(ce_diag, NULL, address); 1078 ret = __ath10k_ce_rx_post_buf(ce_diag, &address, address);
1082 if (ret != 0) 1079 if (ret != 0)
1083 goto done; 1080 goto done;
1084 1081
@@ -1103,9 +1100,10 @@ int ath10k_pci_diag_write_mem(struct ath10k *ar, u32 address,
1103 } 1100 }
1104 1101
1105 i = 0; 1102 i = 0;
1106 while (ath10k_ce_completed_recv_next_nolock(ce_diag, NULL, &buf, 1103 while (ath10k_ce_completed_recv_next_nolock(ce_diag,
1107 &completed_nbytes, 1104 (void **)&buf,
1108 &id, &flags) != 0) { 1105 &completed_nbytes)
1106 != 0) {
1109 mdelay(1); 1107 mdelay(1);
1110 1108
1111 if (i++ > DIAG_ACCESS_CE_TIMEOUT_MS) { 1109 if (i++ > DIAG_ACCESS_CE_TIMEOUT_MS) {
@@ -1119,7 +1117,7 @@ int ath10k_pci_diag_write_mem(struct ath10k *ar, u32 address,
1119 goto done; 1117 goto done;
1120 } 1118 }
1121 1119
1122 if (buf != address) { 1120 if (*buf != address) {
1123 ret = -EIO; 1121 ret = -EIO;
1124 goto done; 1122 goto done;
1125 } 1123 }
@@ -1181,15 +1179,11 @@ static void ath10k_pci_process_rx_cb(struct ath10k_ce_pipe *ce_state,
1181 struct sk_buff *skb; 1179 struct sk_buff *skb;
1182 struct sk_buff_head list; 1180 struct sk_buff_head list;
1183 void *transfer_context; 1181 void *transfer_context;
1184 u32 ce_data;
1185 unsigned int nbytes, max_nbytes; 1182 unsigned int nbytes, max_nbytes;
1186 unsigned int transfer_id;
1187 unsigned int flags;
1188 1183
1189 __skb_queue_head_init(&list); 1184 __skb_queue_head_init(&list);
1190 while (ath10k_ce_completed_recv_next(ce_state, &transfer_context, 1185 while (ath10k_ce_completed_recv_next(ce_state, &transfer_context,
1191 &ce_data, &nbytes, &transfer_id, 1186 &nbytes) == 0) {
1192 &flags) == 0) {
1193 skb = transfer_context; 1187 skb = transfer_context;
1194 max_nbytes = skb->len + skb_tailroom(skb); 1188 max_nbytes = skb->len + skb_tailroom(skb);
1195 dma_unmap_single(ar->dev, ATH10K_SKB_RXCB(skb)->paddr, 1189 dma_unmap_single(ar->dev, ATH10K_SKB_RXCB(skb)->paddr,
@@ -1835,13 +1829,10 @@ static void ath10k_pci_bmi_recv_data(struct ath10k_ce_pipe *ce_state)
1835{ 1829{
1836 struct ath10k *ar = ce_state->ar; 1830 struct ath10k *ar = ce_state->ar;
1837 struct bmi_xfer *xfer; 1831 struct bmi_xfer *xfer;
1838 u32 ce_data;
1839 unsigned int nbytes; 1832 unsigned int nbytes;
1840 unsigned int transfer_id;
1841 unsigned int flags;
1842 1833
1843 if (ath10k_ce_completed_recv_next(ce_state, (void **)&xfer, &ce_data, 1834 if (ath10k_ce_completed_recv_next(ce_state, (void **)&xfer,
1844 &nbytes, &transfer_id, &flags)) 1835 &nbytes))
1845 return; 1836 return;
1846 1837
1847 if (WARN_ON_ONCE(!xfer)) 1838 if (WARN_ON_ONCE(!xfer))