Skip to content

Commit 24d9ef5

Browse files
Rajkumar Manoharankvalo
authored andcommitted
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 <[email protected]> Signed-off-by: Kalle Valo <[email protected]>
1 parent e3a91f8 commit 24d9ef5

File tree

3 files changed

+22
-52
lines changed

3 files changed

+22
-52
lines changed

drivers/net/wireless/ath/ath10k/ce.c

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -444,14 +444,10 @@ int ath10k_ce_rx_post_buf(struct ath10k_ce_pipe *pipe, void *ctx, u32 paddr)
444444
*/
445445
int ath10k_ce_completed_recv_next_nolock(struct ath10k_ce_pipe *ce_state,
446446
void **per_transfer_contextp,
447-
u32 *bufferp,
448-
unsigned int *nbytesp,
449-
unsigned int *transfer_idp,
450-
unsigned int *flagsp)
447+
unsigned int *nbytesp)
451448
{
452449
struct ath10k_ce_ring *dest_ring = ce_state->dest_ring;
453450
unsigned int nentries_mask = dest_ring->nentries_mask;
454-
struct ath10k *ar = ce_state->ar;
455451
unsigned int sw_index = dest_ring->sw_index;
456452

457453
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,
476472
desc->nbytes = 0;
477473

478474
/* Return data from completed destination descriptor */
479-
*bufferp = __le32_to_cpu(sdesc.addr);
480475
*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;
487476

488477
if (per_transfer_contextp)
489478
*per_transfer_contextp =
@@ -501,10 +490,7 @@ int ath10k_ce_completed_recv_next_nolock(struct ath10k_ce_pipe *ce_state,
501490

502491
int ath10k_ce_completed_recv_next(struct ath10k_ce_pipe *ce_state,
503492
void **per_transfer_contextp,
504-
u32 *bufferp,
505-
unsigned int *nbytesp,
506-
unsigned int *transfer_idp,
507-
unsigned int *flagsp)
493+
unsigned int *nbytesp)
508494
{
509495
struct ath10k *ar = ce_state->ar;
510496
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,
513499
spin_lock_bh(&ar_pci->ce_lock);
514500
ret = ath10k_ce_completed_recv_next_nolock(ce_state,
515501
per_transfer_contextp,
516-
bufferp, nbytesp,
517-
transfer_idp, flagsp);
502+
nbytesp);
518503
spin_unlock_bh(&ar_pci->ce_lock);
519504

520505
return ret;

drivers/net/wireless/ath/ath10k/ce.h

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -177,10 +177,7 @@ int ath10k_ce_rx_post_buf(struct ath10k_ce_pipe *pipe, void *ctx, u32 paddr);
177177
*/
178178
int ath10k_ce_completed_recv_next(struct ath10k_ce_pipe *ce_state,
179179
void **per_transfer_contextp,
180-
u32 *bufferp,
181-
unsigned int *nbytesp,
182-
unsigned int *transfer_idp,
183-
unsigned int *flagsp);
180+
unsigned int *nbytesp);
184181
/*
185182
* Supply data for the next completed unprocessed send descriptor.
186183
* Pops 1 completed send buffer from Source ring.
@@ -212,10 +209,7 @@ int ath10k_ce_revoke_recv_next(struct ath10k_ce_pipe *ce_state,
212209

213210
int ath10k_ce_completed_recv_next_nolock(struct ath10k_ce_pipe *ce_state,
214211
void **per_transfer_contextp,
215-
u32 *bufferp,
216-
unsigned int *nbytesp,
217-
unsigned int *transfer_idp,
218-
unsigned int *flagsp);
212+
unsigned int *nbytesp);
219213

220214
/*
221215
* Support clean shutdown by allowing the caller to cancel

drivers/net/wireless/ath/ath10k/pci.c

Lines changed: 17 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -870,10 +870,8 @@ static int ath10k_pci_diag_read_mem(struct ath10k *ar, u32 address, void *data,
870870
{
871871
struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
872872
int ret = 0;
873-
u32 buf;
873+
u32 *buf;
874874
unsigned int completed_nbytes, orig_nbytes, remaining_bytes;
875-
unsigned int id;
876-
unsigned int flags;
877875
struct ath10k_ce_pipe *ce_diag;
878876
/* Host buffer address in CE space */
879877
u32 ce_data;
@@ -909,7 +907,7 @@ static int ath10k_pci_diag_read_mem(struct ath10k *ar, u32 address, void *data,
909907
nbytes = min_t(unsigned int, remaining_bytes,
910908
DIAG_TRANSFER_LIMIT);
911909

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);
913911
if (ret != 0)
914912
goto done;
915913

@@ -940,9 +938,10 @@ static int ath10k_pci_diag_read_mem(struct ath10k *ar, u32 address, void *data,
940938
}
941939

942940
i = 0;
943-
while (ath10k_ce_completed_recv_next_nolock(ce_diag, NULL, &buf,
944-
&completed_nbytes,
945-
&id, &flags) != 0) {
941+
while (ath10k_ce_completed_recv_next_nolock(ce_diag,
942+
(void **)&buf,
943+
&completed_nbytes)
944+
!= 0) {
946945
mdelay(1);
947946

948947
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,
956955
goto done;
957956
}
958957

959-
if (buf != ce_data) {
958+
if (*buf != ce_data) {
960959
ret = -EIO;
961960
goto done;
962961
}
@@ -1026,10 +1025,8 @@ int ath10k_pci_diag_write_mem(struct ath10k *ar, u32 address,
10261025
{
10271026
struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
10281027
int ret = 0;
1029-
u32 buf;
1028+
u32 *buf;
10301029
unsigned int completed_nbytes, orig_nbytes, remaining_bytes;
1031-
unsigned int id;
1032-
unsigned int flags;
10331030
struct ath10k_ce_pipe *ce_diag;
10341031
void *data_buf = NULL;
10351032
u32 ce_data; /* Host buffer address in CE space */
@@ -1078,7 +1075,7 @@ int ath10k_pci_diag_write_mem(struct ath10k *ar, u32 address,
10781075
nbytes = min_t(int, remaining_bytes, DIAG_TRANSFER_LIMIT);
10791076

10801077
/* 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);
10821079
if (ret != 0)
10831080
goto done;
10841081

@@ -1103,9 +1100,10 @@ int ath10k_pci_diag_write_mem(struct ath10k *ar, u32 address,
11031100
}
11041101

11051102
i = 0;
1106-
while (ath10k_ce_completed_recv_next_nolock(ce_diag, NULL, &buf,
1107-
&completed_nbytes,
1108-
&id, &flags) != 0) {
1103+
while (ath10k_ce_completed_recv_next_nolock(ce_diag,
1104+
(void **)&buf,
1105+
&completed_nbytes)
1106+
!= 0) {
11091107
mdelay(1);
11101108

11111109
if (i++ > DIAG_ACCESS_CE_TIMEOUT_MS) {
@@ -1119,7 +1117,7 @@ int ath10k_pci_diag_write_mem(struct ath10k *ar, u32 address,
11191117
goto done;
11201118
}
11211119

1122-
if (buf != address) {
1120+
if (*buf != address) {
11231121
ret = -EIO;
11241122
goto done;
11251123
}
@@ -1181,15 +1179,11 @@ static void ath10k_pci_process_rx_cb(struct ath10k_ce_pipe *ce_state,
11811179
struct sk_buff *skb;
11821180
struct sk_buff_head list;
11831181
void *transfer_context;
1184-
u32 ce_data;
11851182
unsigned int nbytes, max_nbytes;
1186-
unsigned int transfer_id;
1187-
unsigned int flags;
11881183

11891184
__skb_queue_head_init(&list);
11901185
while (ath10k_ce_completed_recv_next(ce_state, &transfer_context,
1191-
&ce_data, &nbytes, &transfer_id,
1192-
&flags) == 0) {
1186+
&nbytes) == 0) {
11931187
skb = transfer_context;
11941188
max_nbytes = skb->len + skb_tailroom(skb);
11951189
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)
18351829
{
18361830
struct ath10k *ar = ce_state->ar;
18371831
struct bmi_xfer *xfer;
1838-
u32 ce_data;
18391832
unsigned int nbytes;
1840-
unsigned int transfer_id;
1841-
unsigned int flags;
18421833

1843-
if (ath10k_ce_completed_recv_next(ce_state, (void **)&xfer, &ce_data,
1844-
&nbytes, &transfer_id, &flags))
1834+
if (ath10k_ce_completed_recv_next(ce_state, (void **)&xfer,
1835+
&nbytes))
18451836
return;
18461837

18471838
if (WARN_ON_ONCE(!xfer))

0 commit comments

Comments
 (0)