aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c
diff options
context:
space:
mode:
authorSujith Manoharan <Sujith.Manoharan@atheros.com>2011-04-13 01:55:47 -0400
committerJohn W. Linville <linville@tuxdriver.com>2011-04-13 15:23:57 -0400
commit2c5d57f004673a9c8658e20b1fa3f992b5a10f70 (patch)
tree93576651f009819fa7b1160c9a2d567ee4284e94 /drivers/net/wireless/ath/ath9k/htc_drv_txrx.c
parent729bd3ab460d3bb8236cc8f6fd0289201124112d (diff)
ath9k_htc: Add TX slots
Maintain a bitmap of slots for transmission and update the cookie field for every packet with the slot value. This value would be used for matching packets when TX completion processing is added. Signed-off-by: Sujith Manoharan <Sujith.Manoharan@atheros.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/ath/ath9k/htc_drv_txrx.c')
-rw-r--r--drivers/net/wireless/ath/ath9k/htc_drv_txrx.c51
1 files changed, 45 insertions, 6 deletions
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c b/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c
index 7b218dad55d9..ee5b3e281cd3 100644
--- a/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c
@@ -76,6 +76,29 @@ void ath9k_htc_check_wake_queues(struct ath9k_htc_priv *priv)
76 spin_unlock_bh(&priv->tx.tx_lock); 76 spin_unlock_bh(&priv->tx.tx_lock);
77} 77}
78 78
79int ath9k_htc_tx_get_slot(struct ath9k_htc_priv *priv)
80{
81 int slot;
82
83 spin_lock_bh(&priv->tx.tx_lock);
84 slot = find_first_zero_bit(priv->tx.tx_slot, MAX_TX_BUF_NUM);
85 if (slot >= MAX_TX_BUF_NUM) {
86 spin_unlock_bh(&priv->tx.tx_lock);
87 return -ENOBUFS;
88 }
89 __set_bit(slot, priv->tx.tx_slot);
90 spin_unlock_bh(&priv->tx.tx_lock);
91
92 return slot;
93}
94
95void ath9k_htc_tx_clear_slot(struct ath9k_htc_priv *priv, int slot)
96{
97 spin_lock_bh(&priv->tx.tx_lock);
98 __clear_bit(slot, priv->tx.tx_slot);
99 spin_unlock_bh(&priv->tx.tx_lock);
100}
101
79static enum htc_endpoint_id get_htc_epid(struct ath9k_htc_priv *priv, 102static enum htc_endpoint_id get_htc_epid(struct ath9k_htc_priv *priv,
80 u16 qnum) 103 u16 qnum)
81{ 104{
@@ -104,28 +127,38 @@ static enum htc_endpoint_id get_htc_epid(struct ath9k_htc_priv *priv,
104 return epid; 127 return epid;
105} 128}
106 129
130/*
131 * Removes the driver header and returns the TX slot number
132 */
107static inline int strip_drv_header(struct ath9k_htc_priv *priv, 133static inline int strip_drv_header(struct ath9k_htc_priv *priv,
108 struct sk_buff *skb) 134 struct sk_buff *skb)
109{ 135{
110 struct ath_common *common = ath9k_hw_common(priv->ah); 136 struct ath_common *common = ath9k_hw_common(priv->ah);
111 struct ath9k_htc_tx_ctl *tx_ctl; 137 struct ath9k_htc_tx_ctl *tx_ctl;
138 int slot;
112 139
113 tx_ctl = HTC_SKB_CB(skb); 140 tx_ctl = HTC_SKB_CB(skb);
114 141
115 if (tx_ctl->epid == priv->mgmt_ep) { 142 if (tx_ctl->epid == priv->mgmt_ep) {
143 struct tx_mgmt_hdr *tx_mhdr =
144 (struct tx_mgmt_hdr *)skb->data;
145 slot = tx_mhdr->cookie;
116 skb_pull(skb, sizeof(struct tx_mgmt_hdr)); 146 skb_pull(skb, sizeof(struct tx_mgmt_hdr));
117 } else if ((tx_ctl->epid == priv->data_bk_ep) || 147 } else if ((tx_ctl->epid == priv->data_bk_ep) ||
118 (tx_ctl->epid == priv->data_be_ep) || 148 (tx_ctl->epid == priv->data_be_ep) ||
119 (tx_ctl->epid == priv->data_vi_ep) || 149 (tx_ctl->epid == priv->data_vi_ep) ||
120 (tx_ctl->epid == priv->data_vo_ep) || 150 (tx_ctl->epid == priv->data_vo_ep) ||
121 (tx_ctl->epid == priv->cab_ep)) { 151 (tx_ctl->epid == priv->cab_ep)) {
152 struct tx_frame_hdr *tx_fhdr =
153 (struct tx_frame_hdr *)skb->data;
154 slot = tx_fhdr->cookie;
122 skb_pull(skb, sizeof(struct tx_frame_hdr)); 155 skb_pull(skb, sizeof(struct tx_frame_hdr));
123 } else { 156 } else {
124 ath_err(common, "Unsupported EPID: %d\n", tx_ctl->epid); 157 ath_err(common, "Unsupported EPID: %d\n", tx_ctl->epid);
125 return -EINVAL; 158 slot = -EINVAL;
126 } 159 }
127 160
128 return 0; 161 return slot;
129} 162}
130 163
131int ath_htc_txq_update(struct ath9k_htc_priv *priv, int qnum, 164int ath_htc_txq_update(struct ath9k_htc_priv *priv, int qnum,
@@ -155,7 +188,8 @@ int ath_htc_txq_update(struct ath9k_htc_priv *priv, int qnum,
155} 188}
156 189
157int ath9k_htc_tx_start(struct ath9k_htc_priv *priv, 190int ath9k_htc_tx_start(struct ath9k_htc_priv *priv,
158 struct sk_buff *skb, bool is_cab) 191 struct sk_buff *skb,
192 u8 slot, bool is_cab)
159{ 193{
160 struct ieee80211_hdr *hdr; 194 struct ieee80211_hdr *hdr;
161 struct ieee80211_mgmt *mgmt; 195 struct ieee80211_mgmt *mgmt;
@@ -212,6 +246,7 @@ int ath9k_htc_tx_start(struct ath9k_htc_priv *priv,
212 246
213 tx_hdr.node_idx = sta_idx; 247 tx_hdr.node_idx = sta_idx;
214 tx_hdr.vif_idx = vif_idx; 248 tx_hdr.vif_idx = vif_idx;
249 tx_hdr.cookie = slot;
215 250
216 if (tx_info->flags & IEEE80211_TX_CTL_AMPDU) { 251 if (tx_info->flags & IEEE80211_TX_CTL_AMPDU) {
217 tx_ctl->type = ATH9K_HTC_AMPDU; 252 tx_ctl->type = ATH9K_HTC_AMPDU;
@@ -274,6 +309,7 @@ int ath9k_htc_tx_start(struct ath9k_htc_priv *priv,
274 mgmt_hdr.vif_idx = vif_idx; 309 mgmt_hdr.vif_idx = vif_idx;
275 mgmt_hdr.tidno = 0; 310 mgmt_hdr.tidno = 0;
276 mgmt_hdr.flags = 0; 311 mgmt_hdr.flags = 0;
312 mgmt_hdr.cookie = slot;
277 313
278 mgmt_hdr.key_type = ath9k_cmn_get_hw_crypto_keytype(skb); 314 mgmt_hdr.key_type = ath9k_cmn_get_hw_crypto_keytype(skb);
279 if (mgmt_hdr.key_type == ATH9K_KEY_TYPE_CLEAR) 315 if (mgmt_hdr.key_type == ATH9K_KEY_TYPE_CLEAR)
@@ -313,10 +349,12 @@ void ath9k_tx_tasklet(unsigned long data)
313 struct sk_buff *skb = NULL; 349 struct sk_buff *skb = NULL;
314 __le16 fc; 350 __le16 fc;
315 bool txok; 351 bool txok;
352 int slot;
316 353
317 while ((skb = skb_dequeue(&priv->tx.tx_queue)) != NULL) { 354 while ((skb = skb_dequeue(&priv->tx.tx_queue)) != NULL) {
318 355
319 if (strip_drv_header(priv, skb) < 0) { 356 slot = strip_drv_header(priv, skb);
357 if (slot < 0) {
320 dev_kfree_skb_any(skb); 358 dev_kfree_skb_any(skb);
321 continue; 359 continue;
322 } 360 }
@@ -347,8 +385,7 @@ void ath9k_tx_tasklet(unsigned long data)
347 sta = ieee80211_find_sta(vif, hdr->addr1); 385 sta = ieee80211_find_sta(vif, hdr->addr1);
348 if (!sta) { 386 if (!sta) {
349 rcu_read_unlock(); 387 rcu_read_unlock();
350 ieee80211_tx_status(priv->hw, skb); 388 goto send_mac80211;
351 continue;
352 } 389 }
353 390
354 /* Check if we need to start aggregation */ 391 /* Check if we need to start aggregation */
@@ -380,6 +417,8 @@ void ath9k_tx_tasklet(unsigned long data)
380 priv->tx.queued_cnt = 0; 417 priv->tx.queued_cnt = 0;
381 spin_unlock_bh(&priv->tx.tx_lock); 418 spin_unlock_bh(&priv->tx.tx_lock);
382 419
420 ath9k_htc_tx_clear_slot(priv, slot);
421
383 /* Send status to mac80211 */ 422 /* Send status to mac80211 */
384 ieee80211_tx_status(priv->hw, skb); 423 ieee80211_tx_status(priv->hw, skb);
385 } 424 }