Commit 5df6e131 authored by Erik Stromdahl's avatar Erik Stromdahl Committed by Kalle Valo

ath10k: add inlined wrappers for htt tx ops

These wrappers makes the HTT ops align better with the HIF ops
(where similar wrappers are used).

It also makes it easier for a target to have unsupported ops
(by letting the corresponding function pointer be NULL).
Signed-off-by: default avatarErik Stromdahl <erik.stromdahl@gmail.com>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
parent c8489668
...@@ -257,11 +257,11 @@ int ath10k_htt_setup(struct ath10k_htt *htt) ...@@ -257,11 +257,11 @@ int ath10k_htt_setup(struct ath10k_htt *htt)
return status; return status;
} }
status = htt->tx_ops->htt_send_frag_desc_bank_cfg(htt); status = ath10k_htt_send_frag_desc_bank_cfg(htt);
if (status) if (status)
return status; return status;
status = htt->tx_ops->htt_send_rx_ring_cfg(htt); status = ath10k_htt_send_rx_ring_cfg(htt);
if (status) { if (status) {
ath10k_warn(ar, "failed to setup rx ring: %d\n", ath10k_warn(ar, "failed to setup rx ring: %d\n",
status); status);
......
...@@ -1856,6 +1856,57 @@ struct ath10k_htt_tx_ops { ...@@ -1856,6 +1856,57 @@ struct ath10k_htt_tx_ops {
void (*htt_free_txbuff)(struct ath10k_htt *htt); void (*htt_free_txbuff)(struct ath10k_htt *htt);
}; };
static inline int ath10k_htt_send_rx_ring_cfg(struct ath10k_htt *htt)
{
if (!htt->tx_ops->htt_send_rx_ring_cfg)
return -EOPNOTSUPP;
return htt->tx_ops->htt_send_rx_ring_cfg(htt);
}
static inline int ath10k_htt_send_frag_desc_bank_cfg(struct ath10k_htt *htt)
{
if (!htt->tx_ops->htt_send_frag_desc_bank_cfg)
return -EOPNOTSUPP;
return htt->tx_ops->htt_send_frag_desc_bank_cfg(htt);
}
static inline int ath10k_htt_alloc_frag_desc(struct ath10k_htt *htt)
{
if (!htt->tx_ops->htt_alloc_frag_desc)
return -EOPNOTSUPP;
return htt->tx_ops->htt_alloc_frag_desc(htt);
}
static inline void ath10k_htt_free_frag_desc(struct ath10k_htt *htt)
{
if (htt->tx_ops->htt_free_frag_desc)
htt->tx_ops->htt_free_frag_desc(htt);
}
static inline int ath10k_htt_tx(struct ath10k_htt *htt,
enum ath10k_hw_txrx_mode txmode,
struct sk_buff *msdu)
{
return htt->tx_ops->htt_tx(htt, txmode, msdu);
}
static inline int ath10k_htt_alloc_txbuff(struct ath10k_htt *htt)
{
if (!htt->tx_ops->htt_alloc_txbuff)
return -EOPNOTSUPP;
return htt->tx_ops->htt_alloc_txbuff(htt);
}
static inline void ath10k_htt_free_txbuff(struct ath10k_htt *htt)
{
if (htt->tx_ops->htt_free_txbuff)
htt->tx_ops->htt_free_txbuff(htt);
}
struct ath10k_htt_rx_ops { struct ath10k_htt_rx_ops {
size_t (*htt_get_rx_ring_size)(struct ath10k_htt *htt); size_t (*htt_get_rx_ring_size)(struct ath10k_htt *htt);
void (*htt_config_paddrs_ring)(struct ath10k_htt *htt, void *vaddr); void (*htt_config_paddrs_ring)(struct ath10k_htt *htt, void *vaddr);
......
...@@ -443,13 +443,13 @@ static int ath10k_htt_tx_alloc_buf(struct ath10k_htt *htt) ...@@ -443,13 +443,13 @@ static int ath10k_htt_tx_alloc_buf(struct ath10k_htt *htt)
struct ath10k *ar = htt->ar; struct ath10k *ar = htt->ar;
int ret; int ret;
ret = htt->tx_ops->htt_alloc_txbuff(htt); ret = ath10k_htt_alloc_txbuff(htt);
if (ret) { if (ret) {
ath10k_err(ar, "failed to alloc cont tx buffer: %d\n", ret); ath10k_err(ar, "failed to alloc cont tx buffer: %d\n", ret);
return ret; return ret;
} }
ret = htt->tx_ops->htt_alloc_frag_desc(htt); ret = ath10k_htt_alloc_frag_desc(htt);
if (ret) { if (ret) {
ath10k_err(ar, "failed to alloc cont frag desc: %d\n", ret); ath10k_err(ar, "failed to alloc cont frag desc: %d\n", ret);
goto free_txbuf; goto free_txbuf;
...@@ -473,10 +473,10 @@ static int ath10k_htt_tx_alloc_buf(struct ath10k_htt *htt) ...@@ -473,10 +473,10 @@ static int ath10k_htt_tx_alloc_buf(struct ath10k_htt *htt)
ath10k_htt_tx_free_txq(htt); ath10k_htt_tx_free_txq(htt);
free_frag_desc: free_frag_desc:
htt->tx_ops->htt_free_frag_desc(htt); ath10k_htt_free_frag_desc(htt);
free_txbuf: free_txbuf:
htt->tx_ops->htt_free_txbuff(htt); ath10k_htt_free_txbuff(htt);
return ret; return ret;
} }
...@@ -530,9 +530,9 @@ void ath10k_htt_tx_destroy(struct ath10k_htt *htt) ...@@ -530,9 +530,9 @@ void ath10k_htt_tx_destroy(struct ath10k_htt *htt)
if (!htt->tx_mem_allocated) if (!htt->tx_mem_allocated)
return; return;
htt->tx_ops->htt_free_txbuff(htt); ath10k_htt_free_txbuff(htt);
ath10k_htt_tx_free_txq(htt); ath10k_htt_tx_free_txq(htt);
htt->tx_ops->htt_free_frag_desc(htt); ath10k_htt_free_frag_desc(htt);
ath10k_htt_tx_free_txdone_fifo(htt); ath10k_htt_tx_free_txdone_fifo(htt);
htt->tx_mem_allocated = false; htt->tx_mem_allocated = false;
} }
......
...@@ -3598,7 +3598,7 @@ static int ath10k_mac_tx_submit(struct ath10k *ar, ...@@ -3598,7 +3598,7 @@ static int ath10k_mac_tx_submit(struct ath10k *ar,
switch (txpath) { switch (txpath) {
case ATH10K_MAC_TX_HTT: case ATH10K_MAC_TX_HTT:
ret = htt->tx_ops->htt_tx(htt, txmode, skb); ret = ath10k_htt_tx(htt, txmode, skb);
break; break;
case ATH10K_MAC_TX_HTT_MGMT: case ATH10K_MAC_TX_HTT_MGMT:
ret = ath10k_htt_mgmt_tx(htt, skb); ret = ath10k_htt_mgmt_tx(htt, skb);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment