]> git.karo-electronics.de Git - linux-beck.git/commitdiff
ath10k: remove num_sends_allowed
authorMichal Kazior <michal.kazior@tieto.com>
Wed, 2 Oct 2013 09:03:41 +0000 (11:03 +0200)
committerKalle Valo <kvalo@qca.qualcomm.com>
Mon, 7 Oct 2013 12:28:02 +0000 (15:28 +0300)
The value provided by num_sends_allowed is now
derived from CE source ringbuffer state.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
drivers/net/wireless/ath/ath10k/ce.c
drivers/net/wireless/ath/ath10k/ce.h
drivers/net/wireless/ath/ath10k/pci.c
drivers/net/wireless/ath/ath10k/pci.h

index 9e6daa9c28b8f0b7200defa79add0753e76dcf26..e46951b8fb925df8a4cd4bb4ed14a738871175b2 100644 (file)
@@ -283,7 +283,7 @@ static int ath10k_ce_send_nolock(struct ath10k_ce_pipe *ce_state,
 
        if (unlikely(CE_RING_DELTA(nentries_mask,
                                   write_index, sw_index - 1) <= 0)) {
-               ret = -EIO;
+               ret = -ENOSR;
                goto exit;
        }
 
@@ -338,6 +338,21 @@ int ath10k_ce_send(struct ath10k_ce_pipe *ce_state,
        return ret;
 }
 
+int ath10k_ce_num_free_src_entries(struct ath10k_ce_pipe *pipe)
+{
+       struct ath10k *ar = pipe->ar;
+       struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
+       int delta;
+
+       spin_lock_bh(&ar_pci->ce_lock);
+       delta = CE_RING_DELTA(pipe->src_ring->nentries_mask,
+                             pipe->src_ring->write_index,
+                             pipe->src_ring->sw_index - 1);
+       spin_unlock_bh(&ar_pci->ce_lock);
+
+       return delta;
+}
+
 int ath10k_ce_recv_buf_enqueue(struct ath10k_ce_pipe *ce_state,
                               void *per_recv_context,
                               u32 buffer)
index 949b1744870b3d2d50c17bdc5244a363b5c6ea43..15d45b5b76153b60133502be39b1803eb86c8517 100644 (file)
@@ -156,6 +156,7 @@ void ath10k_ce_send_cb_register(struct ath10k_ce_pipe *ce_state,
                                void (*send_cb)(struct ath10k_ce_pipe *),
                                int disable_interrupts);
 
+int ath10k_ce_num_free_src_entries(struct ath10k_ce_pipe *pipe);
 
 /*==================Recv=======================*/
 
index 4f6a9787e2d32ad62e7381f126be76de37dc2269..f8d59c7b90821a69b3401a7ec143bd6d8e0fc367 100644 (file)
@@ -720,16 +720,6 @@ static int ath10k_pci_hif_send_head(struct ath10k *ar, u8 pipe_id,
                        "ath10k tx: data: ",
                        nbuf->data, nbuf->len);
 
-       /* Make sure we have resources to handle this request */
-       spin_lock_bh(&pipe_info->pipe_lock);
-       if (!pipe_info->num_sends_allowed) {
-               ath10k_warn("Pipe: %d is full\n", pipe_id);
-               spin_unlock_bh(&pipe_info->pipe_lock);
-               return -ENOSR;
-       }
-       pipe_info->num_sends_allowed--;
-       spin_unlock_bh(&pipe_info->pipe_lock);
-
        ret = ath10k_ce_send(ce_hdl, nbuf, skb_cb->paddr, len, transfer_id,
                             flags);
        if (ret)
@@ -741,14 +731,7 @@ static int ath10k_pci_hif_send_head(struct ath10k *ar, u8 pipe_id,
 static u16 ath10k_pci_hif_get_free_queue_number(struct ath10k *ar, u8 pipe)
 {
        struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
-       struct ath10k_pci_pipe *pipe_info = &(ar_pci->pipe_info[pipe]);
-       int ret;
-
-       spin_lock_bh(&pipe_info->pipe_lock);
-       ret = pipe_info->num_sends_allowed;
-       spin_unlock_bh(&pipe_info->pipe_lock);
-
-       return ret;
+       return ath10k_ce_num_free_src_entries(ar_pci->pipe_info[pipe].ce_hdl);
 }
 
 static void ath10k_pci_hif_dump_area(struct ath10k *ar)
@@ -863,7 +846,6 @@ static int ath10k_pci_start_ce(struct ath10k *ar)
                                                   ath10k_pci_ce_send_done,
                                                   disable_interrupts);
                        completions += attr->src_nentries;
-                       pipe_info->num_sends_allowed = attr->src_nentries - 1;
                }
 
                if (attr->dest_nentries) {
@@ -1033,7 +1015,6 @@ static void ath10k_pci_process_ce(struct ath10k *ar)
                 */
                spin_lock_bh(&compl->pipe_info->pipe_lock);
                list_add_tail(&compl->list, &compl->pipe_info->compl_free);
-               compl->pipe_info->num_sends_allowed += send_done;
                spin_unlock_bh(&compl->pipe_info->pipe_lock);
        }
 
index 7c49f6f96f703993b45188171b82200a5792d7a4..52fb7b9735714ea3f2dbf3ed03936ac3ae11f5c7 100644 (file)
@@ -178,9 +178,6 @@ struct ath10k_pci_pipe {
        /* List of free CE completion slots */
        struct list_head compl_free;
 
-       /* Limit the number of outstanding send requests. */
-       int num_sends_allowed;
-
        struct ath10k_pci *ar_pci;
        struct tasklet_struct intr;
 };