mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2025-01-10 07:44:23 +08:00
ath10k: add inlined wrappers for htt rx ops
Added for the same reason as the TX wrappers. Signed-off-by: Erik Stromdahl <erik.stromdahl@gmail.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
This commit is contained in:
parent
5df6e13130
commit
9a5511d5f2
@ -1916,6 +1916,43 @@ struct ath10k_htt_rx_ops {
|
||||
void (*htt_reset_paddrs_ring)(struct ath10k_htt *htt, int idx);
|
||||
};
|
||||
|
||||
static inline size_t ath10k_htt_get_rx_ring_size(struct ath10k_htt *htt)
|
||||
{
|
||||
if (!htt->rx_ops->htt_get_rx_ring_size)
|
||||
return 0;
|
||||
|
||||
return htt->rx_ops->htt_get_rx_ring_size(htt);
|
||||
}
|
||||
|
||||
static inline void ath10k_htt_config_paddrs_ring(struct ath10k_htt *htt,
|
||||
void *vaddr)
|
||||
{
|
||||
if (htt->rx_ops->htt_config_paddrs_ring)
|
||||
htt->rx_ops->htt_config_paddrs_ring(htt, vaddr);
|
||||
}
|
||||
|
||||
static inline void ath10k_htt_set_paddrs_ring(struct ath10k_htt *htt,
|
||||
dma_addr_t paddr,
|
||||
int idx)
|
||||
{
|
||||
if (htt->rx_ops->htt_set_paddrs_ring)
|
||||
htt->rx_ops->htt_set_paddrs_ring(htt, paddr, idx);
|
||||
}
|
||||
|
||||
static inline void *ath10k_htt_get_vaddr_ring(struct ath10k_htt *htt)
|
||||
{
|
||||
if (!htt->rx_ops->htt_get_vaddr_ring)
|
||||
return NULL;
|
||||
|
||||
return htt->rx_ops->htt_get_vaddr_ring(htt);
|
||||
}
|
||||
|
||||
static inline void ath10k_htt_reset_paddrs_ring(struct ath10k_htt *htt, int idx)
|
||||
{
|
||||
if (htt->rx_ops->htt_reset_paddrs_ring)
|
||||
htt->rx_ops->htt_reset_paddrs_ring(htt, idx);
|
||||
}
|
||||
|
||||
#define RX_HTT_HDR_STATUS_LEN 64
|
||||
|
||||
/* This structure layout is programmed via rx ring setup
|
||||
|
@ -182,7 +182,7 @@ static int __ath10k_htt_rx_ring_fill_n(struct ath10k_htt *htt, int num)
|
||||
rxcb = ATH10K_SKB_RXCB(skb);
|
||||
rxcb->paddr = paddr;
|
||||
htt->rx_ring.netbufs_ring[idx] = skb;
|
||||
htt->rx_ops->htt_set_paddrs_ring(htt, paddr, idx);
|
||||
ath10k_htt_set_paddrs_ring(htt, paddr, idx);
|
||||
htt->rx_ring.fill_cnt++;
|
||||
|
||||
if (htt->rx_ring.in_ord_rx) {
|
||||
@ -287,8 +287,8 @@ void ath10k_htt_rx_free(struct ath10k_htt *htt)
|
||||
ath10k_htt_rx_ring_free(htt);
|
||||
|
||||
dma_free_coherent(htt->ar->dev,
|
||||
htt->rx_ops->htt_get_rx_ring_size(htt),
|
||||
htt->rx_ops->htt_get_vaddr_ring(htt),
|
||||
ath10k_htt_get_rx_ring_size(htt),
|
||||
ath10k_htt_get_vaddr_ring(htt),
|
||||
htt->rx_ring.base_paddr);
|
||||
|
||||
dma_free_coherent(htt->ar->dev,
|
||||
@ -315,7 +315,7 @@ static inline struct sk_buff *ath10k_htt_rx_netbuf_pop(struct ath10k_htt *htt)
|
||||
idx = htt->rx_ring.sw_rd_idx.msdu_payld;
|
||||
msdu = htt->rx_ring.netbufs_ring[idx];
|
||||
htt->rx_ring.netbufs_ring[idx] = NULL;
|
||||
htt->rx_ops->htt_reset_paddrs_ring(htt, idx);
|
||||
ath10k_htt_reset_paddrs_ring(htt, idx);
|
||||
|
||||
idx++;
|
||||
idx &= htt->rx_ring.size_mask;
|
||||
@ -587,13 +587,13 @@ int ath10k_htt_rx_alloc(struct ath10k_htt *htt)
|
||||
if (!htt->rx_ring.netbufs_ring)
|
||||
goto err_netbuf;
|
||||
|
||||
size = htt->rx_ops->htt_get_rx_ring_size(htt);
|
||||
size = ath10k_htt_get_rx_ring_size(htt);
|
||||
|
||||
vaddr_ring = dma_alloc_coherent(htt->ar->dev, size, &paddr, GFP_KERNEL);
|
||||
if (!vaddr_ring)
|
||||
goto err_dma_ring;
|
||||
|
||||
htt->rx_ops->htt_config_paddrs_ring(htt, vaddr_ring);
|
||||
ath10k_htt_config_paddrs_ring(htt, vaddr_ring);
|
||||
htt->rx_ring.base_paddr = paddr;
|
||||
|
||||
vaddr = dma_alloc_coherent(htt->ar->dev,
|
||||
@ -627,7 +627,7 @@ int ath10k_htt_rx_alloc(struct ath10k_htt *htt)
|
||||
|
||||
err_dma_idx:
|
||||
dma_free_coherent(htt->ar->dev,
|
||||
htt->rx_ops->htt_get_rx_ring_size(htt),
|
||||
ath10k_htt_get_rx_ring_size(htt),
|
||||
vaddr_ring,
|
||||
htt->rx_ring.base_paddr);
|
||||
err_dma_ring:
|
||||
|
Loading…
Reference in New Issue
Block a user