Skip to contentSkip to conversation

ath10k: HTT ops wrappers

PATCH In review Erik Stromdahl 2 participants 5 messages Apr 15, 2018 – Apr 19, 2018 Qualcomm Atheros ATH10K wireless driver

lore
Share & tools
lore
#0 lore raw

cover ath10k: HTT ops wrappers

These two patches were included in the High latency v4 RFC submitted a few months ago.

I think it would be appropriate to add them separately since they are not really related to the HL patches.

This will make the next HL patch set somewhat smaller.

Erik Stromdahl (2):
ath10k: add inlined wrappers for htt tx ops
ath10k: add inlined wrappers for htt rx ops

 drivers/net/wireless/ath/ath10k/htt.c    |  4 +-
 drivers/net/wireless/ath/ath10k/htt.h    | 88 ++++++++++++++++++++++++
 drivers/net/wireless/ath/ath10k/htt_rx.c | 14 ++--
 drivers/net/wireless/ath/ath10k/htt_tx.c | 12 ++--
 drivers/net/wireless/ath/ath10k/mac.c    |  2 +-
 5 files changed, 104 insertions(+), 16 deletions(-)
Signature · 1 line
2.17.0
#1 lore raw

PATCH 1/2 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).

---
 drivers/net/wireless/ath/ath10k/htt.c    |  4 +-
 drivers/net/wireless/ath/ath10k/htt.h    | 51 ++++++++++++++++++++++++
 drivers/net/wireless/ath/ath10k/htt_tx.c | 12 +++---
 drivers/net/wireless/ath/ath10k/mac.c    |  2 +-
 4 files changed, 60 insertions(+), 9 deletions(-)
drivers/net/wireless/ath/ath10k/htt.c +2 -2
index 625198dea18b..21a67f82f037 100644
@@ -257,11 +257,11 @@ int ath10k_htt_setup(struct ath10k_htt *htt)
 		return status;
 	}
 
-	status = htt->tx_ops->htt_send_frag_desc_bank_cfg(htt);
+	status = ath10k_htt_send_frag_desc_bank_cfg(htt);
 	if (status)
 		return status;
 
-	status = htt->tx_ops->htt_send_rx_ring_cfg(htt);
+	status = ath10k_htt_send_rx_ring_cfg(htt);
 	if (status) {
 		ath10k_warn(ar, "failed to setup rx ring: %d\n",
 			    status);
drivers/net/wireless/ath/ath10k/htt.h +51 -0

57 lines not on this page · raw message

drivers/net/wireless/ath/ath10k/htt_tx.c +6 -6
index d334b7be1fea..a086958c39b6 100644
@@ -443,13 +443,13 @@ static int ath10k_htt_tx_alloc_buf(struct ath10k_htt *htt)
 	struct ath10k *ar = htt->ar;
 	int ret;
 
-	ret = htt->tx_ops->htt_alloc_txbuff(htt);
+	ret = ath10k_htt_alloc_txbuff(htt);
 	if (ret) {
 		ath10k_err(ar, "failed to alloc cont tx buffer: %d\n", ret);
 		return ret;
 	}
 
-	ret = htt->tx_ops->htt_alloc_frag_desc(htt);
+	ret = ath10k_htt_alloc_frag_desc(htt);
 	if (ret) {
 		ath10k_err(ar, "failed to alloc cont frag desc: %d\n", ret);
 		goto free_txbuf;
@@ -473,10 +473,10 @@ static int ath10k_htt_tx_alloc_buf(struct ath10k_htt *htt)
 	ath10k_htt_tx_free_txq(htt);
 
 free_frag_desc:
-	htt->tx_ops->htt_free_frag_desc(htt);
+	ath10k_htt_free_frag_desc(htt);
 
 free_txbuf:
-	htt->tx_ops->htt_free_txbuff(htt);
+	ath10k_htt_free_txbuff(htt);
 
 	return ret;
 }
@@ -530,9 +530,9 @@ void ath10k_htt_tx_destroy(struct ath10k_htt *htt)
 	if (!htt->tx_mem_allocated)
 		return;
 
-	htt->tx_ops->htt_free_txbuff(htt);
+	ath10k_htt_free_txbuff(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);
 	htt->tx_mem_allocated = false;
 }
drivers/net/wireless/ath/ath10k/mac.c +1 -1
index bf05a3689558..fc3320f94f45 100644
@@ -3598,7 +3598,7 @@ static int ath10k_mac_tx_submit(struct ath10k *ar,
 
 	switch (txpath) {
 	case ATH10K_MAC_TX_HTT:
-		ret = htt->tx_ops->htt_tx(htt, txmode, skb);
+		ret = ath10k_htt_tx(htt, txmode, skb);
 		break;
 	case ATH10K_MAC_TX_HTT_MGMT:
 		ret = ath10k_htt_mgmt_tx(htt, skb);
Signature · 1 line
2.17.0
#2 lore raw

Re: [1/2] ath10k: add inlined wrappers for htt tx ops

Quoted 8 lines · Erik Stromdahl

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).

2 patches applied to ath-next branch of ath.git, thanks.

5df6e1313044 ath10k: add inlined wrappers for htt tx ops 9a5511d5f24f ath10k: add inlined wrappers for htt rx ops

Signature · 3 lines
https://patchwork.kernel.org/patch/10341545/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
#3 lore raw

Re: [1/2] ath10k: add inlined wrappers for htt tx ops

In reply to Erik Stromdahl
Quoted 8 lines · Erik Stromdahl

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).

2 patches applied to ath-next branch of ath.git, thanks.

5df6e1313044 ath10k: add inlined wrappers for htt tx ops 9a5511d5f24f ath10k: add inlined wrappers for htt rx ops

Signature · 9 lines
https://patchwork.kernel.org/patch/10341545/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches


_______________________________________________
ath10k mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/ath10k
#4 lore raw

PATCH 2/2 ath10k: add inlined wrappers for htt rx ops

In reply to Erik Stromdahl

Added for the same reason as the TX wrappers.

---
 drivers/net/wireless/ath/ath10k/htt.h    | 37 ++++++++++++++++++++++++
 drivers/net/wireless/ath/ath10k/htt_rx.c | 14 ++++-----
 2 files changed, 44 insertions(+), 7 deletions(-)
drivers/net/wireless/ath/ath10k/htt.h +37 -0
index c76f6daafe70..3fa1be7749b2 100644
@@ -1908,6 +1908,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
drivers/net/wireless/ath/ath10k/htt_rx.c +7 -7
index 5e02e26158f6..5e8a84fa5422 100644
@@ -181,7 +181,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) {
@@ -286,8 +286,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,
@@ -314,7 +314,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;
@@ -586,13 +586,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,
@@ -626,7 +626,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:
Signature · 1 line
2.17.0