This implements very basic support for software
queueing. It also contains some knobs that will be
patched later.
Signed-off-by: Michal Kazior
---
Notes:
v2:
- squashed with `ath10k: add txq placeholder`
- squashed with `ath10k: implement flushing of pending frames in txqs`
- reworked pending logic
drivers/net/wireless/ath/ath10k/core.c | 2 +
drivers/net/wireless/ath/ath10k/core.h | 7 ++
drivers/net/wireless/ath/ath10k/htt_rx.c | 3 +
drivers/net/wireless/ath/ath10k/mac.c| 144 +++
drivers/net/wireless/ath/ath10k/mac.h| 1 +
5 files changed, 157 insertions(+)
diff --git a/drivers/net/wireless/ath/ath10k/core.c
b/drivers/net/wireless/ath/ath10k/core.c
index 4d3176492ae7..6d02266ca615 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -2043,7 +2043,9 @@ struct ath10k *ath10k_core_create(size_t priv_size,
struct device *dev,
mutex_init(>conf_mutex);
spin_lock_init(>data_lock);
+ spin_lock_init(>txqs_lock);
+ INIT_LIST_HEAD(>txqs);
INIT_LIST_HEAD(>peers);
init_waitqueue_head(>peer_mapping_wq);
init_waitqueue_head(>htt.empty_tx_wq);
diff --git a/drivers/net/wireless/ath/ath10k/core.h
b/drivers/net/wireless/ath/ath10k/core.h
index 5f447444fe97..7df35628ca35 100644
--- a/drivers/net/wireless/ath/ath10k/core.h
+++ b/drivers/net/wireless/ath/ath10k/core.h
@@ -308,6 +308,10 @@ struct ath10k_peer {
struct ieee80211_key_conf *keys[WMI_MAX_KEY_INDEX + 1];
};
+struct ath10k_txq {
+ struct list_head list;
+};
+
struct ath10k_sta {
struct ath10k_vif *arvif;
@@ -791,7 +795,10 @@ struct ath10k {
/* protects shared structure data */
spinlock_t data_lock;
+ /* protects: ar->txqs, artxq->list */
+ spinlock_t txqs_lock;
+ struct list_head txqs;
struct list_head arvifs;
struct list_head peers;
struct ath10k_peer *peer_map[ATH10K_MAX_NUM_PEER_IDS];
diff --git a/drivers/net/wireless/ath/ath10k/htt_rx.c
b/drivers/net/wireless/ath/ath10k/htt_rx.c
index be7dc88b3316..6e3d95c95568 100644
--- a/drivers/net/wireless/ath/ath10k/htt_rx.c
+++ b/drivers/net/wireless/ath/ath10k/htt_rx.c
@@ -2244,6 +2244,7 @@ void ath10k_htt_t2h_msg_handler(struct ath10k *ar, struct
sk_buff *skb)
}
ath10k_txrx_tx_unref(htt, _done);
+ ath10k_mac_tx_push_pending(ar);
break;
}
case HTT_T2H_MSG_TYPE_TX_COMPL_IND:
@@ -2370,6 +2371,8 @@ static void ath10k_htt_txrx_compl_task(unsigned long ptr)
dev_kfree_skb_any(skb);
}
+ ath10k_mac_tx_push_pending(ar);
+
spin_lock_bh(>rx_ring.lock);
while ((skb = __skb_dequeue(>rx_compl_q))) {
resp = (struct htt_resp *)skb->data;
diff --git a/drivers/net/wireless/ath/ath10k/mac.c
b/drivers/net/wireless/ath/ath10k/mac.c
index 4b69a373382b..74a42e3465e4 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -3620,6 +3620,123 @@ void ath10k_mgmt_over_wmi_tx_work(struct work_struct
*work)
}
}
+static void ath10k_mac_txq_init(struct ieee80211_txq *txq)
+{
+ struct ath10k_txq *artxq = (void *)txq->drv_priv;
+
+ if (!txq)
+ return;
+
+ INIT_LIST_HEAD(>list);
+}
+
+static void ath10k_mac_txq_unref(struct ath10k *ar, struct ieee80211_txq *txq)
+{
+ struct ath10k_txq *artxq = (void *)txq->drv_priv;
+
+ if (!txq)
+ return;
+
+ spin_lock_bh(>txqs_lock);
+ if (!list_empty(>list))
+ list_del_init(>list);
+ spin_unlock_bh(>txqs_lock);
+}
+
+static bool ath10k_mac_tx_can_push(struct ieee80211_hw *hw,
+ struct ieee80211_txq *txq)
+{
+ return 1; /* TBD */
+}
+
+static int ath10k_mac_tx_push_txq(struct ieee80211_hw *hw,
+ struct ieee80211_txq *txq)
+{
+ const bool is_mgmt = false;
+ const bool is_presp = false;
+ struct ath10k *ar = hw->priv;
+ struct ath10k_htt *htt = >htt;
+ struct ieee80211_vif *vif = txq->vif;
+ struct ieee80211_sta *sta = txq->sta;
+ enum ath10k_hw_txrx_mode txmode;
+ enum ath10k_mac_tx_path txpath;
+ struct sk_buff *skb;
+ int ret;
+
+ spin_lock_bh(>htt.tx_lock);
+ ret = ath10k_htt_tx_inc_pending(htt, is_mgmt, is_presp);
+ spin_unlock_bh(>htt.tx_lock);
+
+ if (ret)
+ return ret;
+
+ skb = ieee80211_tx_dequeue(hw, txq);
+ if (!skb) {
+ spin_lock_bh(>htt.tx_lock);
+ ath10k_htt_tx_dec_pending(htt, is_mgmt);
+ spin_unlock_bh(>htt.tx_lock);
+
+ return -ENOENT;
+ }
+
+ ath10k_mac_tx_h_fill_cb(ar, vif, skb);
+
+ txmode = ath10k_mac_tx_h_get_txmode(ar, vif, sta, skb);
+ txpath =