Commit f2820f45 authored by Sujith Manoharan's avatar Sujith Manoharan Committed by John W. Linville

ath9k_htc: Use helper functions for TX processing

Signed-off-by: default avatarSujith Manoharan <Sujith.Manoharan@atheros.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 2c5d57f0
...@@ -325,7 +325,7 @@ int ath9k_htc_tx_start(struct ath9k_htc_priv *priv, ...@@ -325,7 +325,7 @@ int ath9k_htc_tx_start(struct ath9k_htc_priv *priv,
return htc_send(priv->htc, skb); return htc_send(priv->htc, skb);
} }
static bool ath9k_htc_check_tx_aggr(struct ath9k_htc_priv *priv, static inline bool __ath9k_htc_check_tx_aggr(struct ath9k_htc_priv *priv,
struct ath9k_htc_sta *ista, u8 tid) struct ath9k_htc_sta *ista, u8 tid)
{ {
bool ret = false; bool ret = false;
...@@ -338,58 +338,25 @@ static bool ath9k_htc_check_tx_aggr(struct ath9k_htc_priv *priv, ...@@ -338,58 +338,25 @@ static bool ath9k_htc_check_tx_aggr(struct ath9k_htc_priv *priv,
return ret; return ret;
} }
void ath9k_tx_tasklet(unsigned long data) static void ath9k_htc_check_tx_aggr(struct ath9k_htc_priv *priv,
struct ieee80211_vif *vif,
struct sk_buff *skb)
{ {
struct ath9k_htc_priv *priv = (struct ath9k_htc_priv *)data;
struct ath9k_htc_tx_ctl *tx_ctl;
struct ieee80211_vif *vif;
struct ieee80211_sta *sta; struct ieee80211_sta *sta;
struct ieee80211_hdr *hdr; struct ieee80211_hdr *hdr;
struct ieee80211_tx_info *tx_info;
struct sk_buff *skb = NULL;
__le16 fc; __le16 fc;
bool txok;
int slot;
while ((skb = skb_dequeue(&priv->tx.tx_queue)) != NULL) {
slot = strip_drv_header(priv, skb);
if (slot < 0) {
dev_kfree_skb_any(skb);
continue;
}
tx_ctl = HTC_SKB_CB(skb);
hdr = (struct ieee80211_hdr *) skb->data; hdr = (struct ieee80211_hdr *) skb->data;
fc = hdr->frame_control; fc = hdr->frame_control;
tx_info = IEEE80211_SKB_CB(skb);
vif = tx_info->control.vif;
txok = tx_ctl->txok;
memset(&tx_info->status, 0, sizeof(tx_info->status));
/*
* URB submission failed for this frame, it never reached
* the target.
*/
if (!txok)
goto send_mac80211;
tx_info->flags |= IEEE80211_TX_STAT_ACK;
if (!vif)
goto send_mac80211;
rcu_read_lock(); rcu_read_lock();
sta = ieee80211_find_sta(vif, hdr->addr1); sta = ieee80211_find_sta(vif, hdr->addr1);
if (!sta) { if (!sta) {
rcu_read_unlock(); rcu_read_unlock();
goto send_mac80211; return;
} }
/* Check if we need to start aggregation */
if (sta && conf_is_ht(&priv->hw->conf) && if (sta && conf_is_ht(&priv->hw->conf) &&
!(skb->protocol == cpu_to_be16(ETH_P_PAE))) { !(skb->protocol == cpu_to_be16(ETH_P_PAE))) {
if (ieee80211_is_data_qos(fc)) { if (ieee80211_is_data_qos(fc)) {
...@@ -399,8 +366,7 @@ void ath9k_tx_tasklet(unsigned long data) ...@@ -399,8 +366,7 @@ void ath9k_tx_tasklet(unsigned long data)
qc = ieee80211_get_qos_ctl(hdr); qc = ieee80211_get_qos_ctl(hdr);
tid = qc[0] & 0xf; tid = qc[0] & 0xf;
ista = (struct ath9k_htc_sta *)sta->drv_priv; ista = (struct ath9k_htc_sta *)sta->drv_priv;
if (__ath9k_htc_check_tx_aggr(priv, ista, tid)) {
if (ath9k_htc_check_tx_aggr(priv, ista, tid)) {
ieee80211_start_tx_ba_session(sta, tid, 0); ieee80211_start_tx_ba_session(sta, tid, 0);
spin_lock_bh(&priv->tx.tx_lock); spin_lock_bh(&priv->tx.tx_lock);
ista->tid_state[tid] = AGGR_PROGRESS; ista->tid_state[tid] = AGGR_PROGRESS;
...@@ -410,8 +376,42 @@ void ath9k_tx_tasklet(unsigned long data) ...@@ -410,8 +376,42 @@ void ath9k_tx_tasklet(unsigned long data)
} }
rcu_read_unlock(); rcu_read_unlock();
}
send_mac80211: static void ath9k_htc_tx_process(struct ath9k_htc_priv *priv,
struct sk_buff *skb)
{
struct ieee80211_vif *vif;
struct ath9k_htc_tx_ctl *tx_ctl;
struct ieee80211_tx_info *tx_info;
bool txok;
int slot;
slot = strip_drv_header(priv, skb);
if (slot < 0) {
dev_kfree_skb_any(skb);
return;
}
tx_ctl = HTC_SKB_CB(skb);
txok = tx_ctl->txok;
tx_info = IEEE80211_SKB_CB(skb);
vif = tx_info->control.vif;
memset(&tx_info->status, 0, sizeof(tx_info->status));
/*
* URB submission failed for this frame, it never reached
* the target.
*/
if (!txok || !vif)
goto send_mac80211;
tx_info->flags |= IEEE80211_TX_STAT_ACK;
ath9k_htc_check_tx_aggr(priv, vif, skb);
send_mac80211:
spin_lock_bh(&priv->tx.tx_lock); spin_lock_bh(&priv->tx.tx_lock);
if (WARN_ON(--priv->tx.queued_cnt < 0)) if (WARN_ON(--priv->tx.queued_cnt < 0))
priv->tx.queued_cnt = 0; priv->tx.queued_cnt = 0;
...@@ -421,6 +421,15 @@ void ath9k_tx_tasklet(unsigned long data) ...@@ -421,6 +421,15 @@ void ath9k_tx_tasklet(unsigned long data)
/* Send status to mac80211 */ /* Send status to mac80211 */
ieee80211_tx_status(priv->hw, skb); ieee80211_tx_status(priv->hw, skb);
}
void ath9k_tx_tasklet(unsigned long data)
{
struct ath9k_htc_priv *priv = (struct ath9k_htc_priv *)data;
struct sk_buff *skb = NULL;
while ((skb = skb_dequeue(&priv->tx.tx_queue)) != NULL) {
ath9k_htc_tx_process(priv, skb);
} }
/* Wake TX queues if needed */ /* Wake TX queues if needed */
......
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