mac80211: add pending ath9k/ath10k patches
[openwrt.git] / package / kernel / mac80211 / patches / 309-ath10k-remove-shadow-copy-of-CE-descriptors-for-sour.patch
1 From: Rajkumar Manoharan <rmanohar@qti.qualcomm.com>
2 Date: Fri, 23 Oct 2015 18:01:06 +0530
3 Subject: [PATCH] ath10k: remove shadow copy of CE descriptors for source
4  ring
5
6 For the messages from host to target, shadow copy of CE descriptors
7 are maintained in source ring. Before writing actual CE descriptor,
8 first shadow copy is filled and then it is copied to CE address space.
9 To optimize in download path and to reduce d-cache pressure, removing
10 shadow copy of CE descriptors. This will also reduce driver memory
11 consumption by 33KB during on device probing.
12
13 Signed-off-by: Rajkumar Manoharan <rmanohar@qti.qualcomm.com>
14 Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
15 ---
16
17 --- a/drivers/net/wireless/ath/ath10k/ce.c
18 +++ b/drivers/net/wireless/ath/ath10k/ce.c
19 @@ -921,27 +921,6 @@ ath10k_ce_alloc_src_ring(struct ath10k *
20                         src_ring->base_addr_ce_space_unaligned,
21                         CE_DESC_RING_ALIGN);
22  
23 -       /*
24 -        * Also allocate a shadow src ring in regular
25 -        * mem to use for faster access.
26 -        */
27 -       src_ring->shadow_base_unaligned =
28 -               kmalloc((nentries * sizeof(struct ce_desc) +
29 -                        CE_DESC_RING_ALIGN), GFP_KERNEL);
30 -       if (!src_ring->shadow_base_unaligned) {
31 -               dma_free_coherent(ar->dev,
32 -                                 (nentries * sizeof(struct ce_desc) +
33 -                                  CE_DESC_RING_ALIGN),
34 -                                 src_ring->base_addr_owner_space,
35 -                                 src_ring->base_addr_ce_space);
36 -               kfree(src_ring);
37 -               return ERR_PTR(-ENOMEM);
38 -       }
39 -
40 -       src_ring->shadow_base = PTR_ALIGN(
41 -                       src_ring->shadow_base_unaligned,
42 -                       CE_DESC_RING_ALIGN);
43 -
44         return src_ring;
45  }
46  
47 @@ -1120,7 +1099,6 @@ void ath10k_ce_free_pipe(struct ath10k *
48         struct ath10k_ce_pipe *ce_state = &ar_pci->ce_states[ce_id];
49  
50         if (ce_state->src_ring) {
51 -               kfree(ce_state->src_ring->shadow_base_unaligned);
52                 dma_free_coherent(ar->dev,
53                                   (ce_state->src_ring->nentries *
54                                    sizeof(struct ce_desc) +
55 --- a/drivers/net/wireless/ath/ath10k/ce.h
56 +++ b/drivers/net/wireless/ath/ath10k/ce.h
57 @@ -100,12 +100,6 @@ struct ath10k_ce_ring {
58  
59         /* CE address space */
60         u32 base_addr_ce_space;
61 -       /*
62 -        * Start of shadow copy of descriptors, within regular memory.
63 -        * Aligned to descriptor-size boundary.
64 -        */
65 -       void *shadow_base_unaligned;
66 -       struct ce_desc *shadow_base;
67  
68         /* keep last */
69         void *per_transfer_context[0];
70 --- a/drivers/net/wireless/ath/ath10k/pci.c
71 +++ b/drivers/net/wireless/ath/ath10k/pci.c
72 @@ -1594,7 +1594,6 @@ static void ath10k_pci_tx_pipe_cleanup(s
73         struct ath10k_pci *ar_pci;
74         struct ath10k_ce_pipe *ce_pipe;
75         struct ath10k_ce_ring *ce_ring;
76 -       struct ce_desc *ce_desc;
77         struct sk_buff *skb;
78         int i;
79  
80 @@ -1609,10 +1608,6 @@ static void ath10k_pci_tx_pipe_cleanup(s
81         if (!pci_pipe->buf_sz)
82                 return;
83  
84 -       ce_desc = ce_ring->shadow_base;
85 -       if (WARN_ON(!ce_desc))
86 -               return;
87 -
88         for (i = 0; i < ce_ring->nentries; i++) {
89                 skb = ce_ring->per_transfer_context[i];
90                 if (!skb)