ath10k: deduplicate htt rx dma unmapping
authorMichal Kazior <michal.kazior@tieto.com>
Thu, 23 Oct 2014 14:04:23 +0000 (17:04 +0300)
committerKalle Valo <kvalo@qca.qualcomm.com>
Fri, 24 Oct 2014 13:28:59 +0000 (16:28 +0300)
Treat non-chained and chained popping the same
way. Also this makes netbuf pop fully symmetrical
to (re)filling.

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

index a7d29c8..41a2803 100644 (file)
@@ -291,6 +291,15 @@ static inline struct sk_buff *ath10k_htt_rx_netbuf_pop(struct ath10k_htt *htt)
        htt->rx_ring.sw_rd_idx.msdu_payld = idx;
        htt->rx_ring.fill_cnt--;
 
        htt->rx_ring.sw_rd_idx.msdu_payld = idx;
        htt->rx_ring.fill_cnt--;
 
+       dma_unmap_single(htt->ar->dev,
+                        ATH10K_SKB_CB(msdu)->paddr,
+                        msdu->len + skb_tailroom(msdu),
+                        DMA_FROM_DEVICE);
+       ath10k_dbg_dump(ar, ATH10K_DBG_HTT_DUMP, NULL, "htt rx netbuf pop: ",
+                       msdu->data, msdu->len + skb_tailroom(msdu));
+       trace_ath10k_htt_rx_pop_msdu(ar, msdu->data, msdu->len +
+                                    skb_tailroom(msdu));
+
        return msdu;
 }
 
        return msdu;
 }
 
@@ -329,16 +338,6 @@ static int ath10k_htt_rx_amsdu_pop(struct ath10k_htt *htt,
        while (msdu) {
                int last_msdu, msdu_len_invalid, msdu_chained;
 
        while (msdu) {
                int last_msdu, msdu_len_invalid, msdu_chained;
 
-               dma_unmap_single(htt->ar->dev,
-                                ATH10K_SKB_CB(msdu)->paddr,
-                                msdu->len + skb_tailroom(msdu),
-                                DMA_FROM_DEVICE);
-
-               ath10k_dbg_dump(ar, ATH10K_DBG_HTT_DUMP, NULL, "htt rx pop: ",
-                               msdu->data, msdu->len + skb_tailroom(msdu));
-               trace_ath10k_htt_rx_pop_msdu(ar, msdu->data, msdu->len +
-                                            skb_tailroom(msdu));
-
                rx_desc = (struct htt_rx_desc *)msdu->data;
 
                /* FIXME: we must report msdu payload since this is what caller
                rx_desc = (struct htt_rx_desc *)msdu->data;
 
                /* FIXME: we must report msdu payload since this is what caller
@@ -429,17 +428,6 @@ static int ath10k_htt_rx_amsdu_pop(struct ath10k_htt *htt,
                while (msdu_chained--) {
                        struct sk_buff *next = ath10k_htt_rx_netbuf_pop(htt);
 
                while (msdu_chained--) {
                        struct sk_buff *next = ath10k_htt_rx_netbuf_pop(htt);
 
-                       dma_unmap_single(htt->ar->dev,
-                                        ATH10K_SKB_CB(next)->paddr,
-                                        next->len + skb_tailroom(next),
-                                        DMA_FROM_DEVICE);
-
-                       ath10k_dbg_dump(ar, ATH10K_DBG_HTT_DUMP, NULL,
-                                       "htt rx chained: ", next->data,
-                                       next->len + skb_tailroom(next));
-                       trace_ath10k_htt_rx_pop_msdu(ar, msdu->data, msdu->len +
-                                                    skb_tailroom(msdu));
-
                        skb_trim(next, 0);
                        skb_put(next, min(msdu_len, HTT_RX_BUF_SIZE));
                        msdu_len -= next->len;
                        skb_trim(next, 0);
                        skb_put(next, min(msdu_len, HTT_RX_BUF_SIZE));
                        msdu_len -= next->len;