ath10k: use local memory instead of shadow descriptor in ce_send
[firefly-linux-kernel-4.4.55.git] / drivers / net / wireless / ath / ath10k / ce.c
index cf28fbebaedcfc9b372d509c6a88fcbc2d808773..f63376b3e258535b5145e92004a272da193e5c62 100644 (file)
@@ -274,7 +274,7 @@ int ath10k_ce_send_nolock(struct ath10k_ce_pipe *ce_state,
 {
        struct ath10k *ar = ce_state->ar;
        struct ath10k_ce_ring *src_ring = ce_state->src_ring;
-       struct ce_desc *desc, *sdesc;
+       struct ce_desc *desc, sdesc;
        unsigned int nentries_mask = src_ring->nentries_mask;
        unsigned int sw_index = src_ring->sw_index;
        unsigned int write_index = src_ring->write_index;
@@ -294,7 +294,6 @@ int ath10k_ce_send_nolock(struct ath10k_ce_pipe *ce_state,
 
        desc = CE_SRC_RING_TO_DESC(src_ring->base_addr_owner_space,
                                   write_index);
-       sdesc = CE_SRC_RING_TO_DESC(src_ring->shadow_base, write_index);
 
        desc_flags |= SM(transfer_id, CE_DESC_FLAGS_META_DATA);
 
@@ -303,11 +302,11 @@ int ath10k_ce_send_nolock(struct ath10k_ce_pipe *ce_state,
        if (flags & CE_SEND_FLAG_BYTE_SWAP)
                desc_flags |= CE_DESC_FLAGS_BYTE_SWAP;
 
-       sdesc->addr   = __cpu_to_le32(buffer);
-       sdesc->nbytes = __cpu_to_le16(nbytes);
-       sdesc->flags  = __cpu_to_le16(desc_flags);
+       sdesc.addr   = __cpu_to_le32(buffer);
+       sdesc.nbytes = __cpu_to_le16(nbytes);
+       sdesc.flags  = __cpu_to_le16(desc_flags);
 
-       *desc = *sdesc;
+       *desc = sdesc;
 
        src_ring->per_transfer_context[write_index] = per_transfer_context;
 
@@ -413,7 +412,7 @@ int __ath10k_ce_rx_post_buf(struct ath10k_ce_pipe *pipe, void *ctx, u32 paddr)
        lockdep_assert_held(&ar_pci->ce_lock);
 
        if (CE_RING_DELTA(nentries_mask, write_index, sw_index - 1) == 0)
-               return -EIO;
+               return -ENOSPC;
 
        desc->addr = __cpu_to_le32(paddr);
        desc->nbytes = 0;
@@ -614,7 +613,7 @@ int ath10k_ce_completed_send_next_nolock(struct ath10k_ce_pipe *ce_state,
        if (read_index == sw_index)
                return -EIO;
 
-       sbase = src_ring->shadow_base;
+       sbase = src_ring->base_addr_owner_space;
        sdesc = CE_SRC_RING_TO_DESC(sbase, sw_index);
 
        /* Return data from completed source descriptor */
@@ -1076,9 +1075,7 @@ void ath10k_ce_deinit_pipe(struct ath10k *ar, unsigned int ce_id)
 }
 
 int ath10k_ce_alloc_pipe(struct ath10k *ar, int ce_id,
-                        const struct ce_attr *attr,
-                        void (*send_cb)(struct ath10k_ce_pipe *),
-                        void (*recv_cb)(struct ath10k_ce_pipe *))
+                        const struct ce_attr *attr)
 {
        struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
        struct ath10k_ce_pipe *ce_state = &ar_pci->ce_states[ce_id];
@@ -1104,10 +1101,10 @@ int ath10k_ce_alloc_pipe(struct ath10k *ar, int ce_id,
        ce_state->src_sz_max = attr->src_sz_max;
 
        if (attr->src_nentries)
-               ce_state->send_cb = send_cb;
+               ce_state->send_cb = attr->send_cb;
 
        if (attr->dest_nentries)
-               ce_state->recv_cb = recv_cb;
+               ce_state->recv_cb = attr->recv_cb;
 
        if (attr->src_nentries) {
                ce_state->src_ring = ath10k_ce_alloc_src_ring(ar, ce_id, attr);