ath9k_htc: Move TX specific stuff to a separate structure

Signed-off-by: Sujith Manoharan <Sujith.Manoharan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
This commit is contained in:
Sujith Manoharan 2011-04-13 11:25:00 +05:30 committed by John W. Linville
parent ee3fa1bdad
commit 658ef04fd4
5 changed files with 41 additions and 36 deletions

View File

@ -260,6 +260,13 @@ struct ath9k_htc_rx {
spinlock_t rxbuflock;
};
struct ath9k_htc_tx {
bool tx_queues_stop;
spinlock_t tx_lock;
struct sk_buff_head tx_queue;
};
struct ath9k_htc_tx_ctl {
u8 type; /* ATH9K_HTC_* */
};
@ -433,22 +440,20 @@ struct ath9k_htc_priv {
u16 nstations;
bool rearm_ani;
bool reconfig_beacon;
unsigned int rxfilter;
struct ath9k_hw_cal_data caldata;
struct ieee80211_supported_band sbands[IEEE80211_NUM_BANDS];
spinlock_t beacon_lock;
bool tx_queues_stop;
spinlock_t tx_lock;
struct htc_beacon_config cur_beacon_conf;
unsigned int rxfilter;
struct ath9k_htc_rx rx;
struct ath9k_htc_tx tx;
struct tasklet_struct swba_tasklet;
struct tasklet_struct rx_tasklet;
struct ieee80211_supported_band sbands[IEEE80211_NUM_BANDS];
struct ath9k_htc_rx rx;
struct tasklet_struct tx_tasklet;
struct sk_buff_head tx_queue;
struct delayed_work ani_work;
struct work_struct ps_work;
struct work_struct fatal_work;

View File

@ -398,9 +398,9 @@ void ath9k_htc_radio_enable(struct ieee80211_hw *hw)
/* Start TX */
htc_start(priv->htc);
spin_lock_bh(&priv->tx_lock);
priv->tx_queues_stop = false;
spin_unlock_bh(&priv->tx_lock);
spin_lock_bh(&priv->tx.tx_lock);
priv->tx.tx_queues_stop = false;
spin_unlock_bh(&priv->tx.tx_lock);
ieee80211_wake_queues(hw);
WMI_CMD(WMI_ENABLE_INTR_CMDID);
@ -431,7 +431,7 @@ void ath9k_htc_radio_disable(struct ieee80211_hw *hw)
ieee80211_stop_queues(hw);
htc_stop(priv->htc);
WMI_CMD(WMI_DRAIN_TXQ_ALL_CMDID);
skb_queue_purge(&priv->tx_queue);
skb_queue_purge(&priv->tx.tx_queue);
/* Stop RX */
WMI_CMD(WMI_STOP_RECV_CMDID);

View File

@ -673,7 +673,7 @@ static int ath9k_init_priv(struct ath9k_htc_priv *priv,
spin_lock_init(&priv->wmi->wmi_lock);
spin_lock_init(&priv->beacon_lock);
spin_lock_init(&priv->tx_lock);
spin_lock_init(&priv->tx.tx_lock);
mutex_init(&priv->mutex);
mutex_init(&priv->htc_pm_lock);
tasklet_init(&priv->rx_tasklet, ath9k_rx_tasklet,

View File

@ -707,9 +707,9 @@ static int ath9k_htc_tx_aggr_oper(struct ath9k_htc_priv *priv,
(aggr.aggr_enable) ? "Starting" : "Stopping",
sta->addr, tid);
spin_lock_bh(&priv->tx_lock);
spin_lock_bh(&priv->tx.tx_lock);
ista->tid_state[tid] = (aggr.aggr_enable && !ret) ? AGGR_START : AGGR_STOP;
spin_unlock_bh(&priv->tx_lock);
spin_unlock_bh(&priv->tx.tx_lock);
return ret;
}
@ -853,9 +853,9 @@ static void ath9k_htc_tx(struct ieee80211_hw *hw, struct sk_buff *skb)
ath_dbg(ath9k_hw_common(priv->ah), ATH_DBG_XMIT,
"Stopping TX queues\n");
ieee80211_stop_queues(hw);
spin_lock_bh(&priv->tx_lock);
priv->tx_queues_stop = true;
spin_unlock_bh(&priv->tx_lock);
spin_lock_bh(&priv->tx.tx_lock);
priv->tx.tx_queues_stop = true;
spin_unlock_bh(&priv->tx.tx_lock);
} else {
ath_dbg(ath9k_hw_common(priv->ah), ATH_DBG_XMIT,
"Tx failed\n");
@ -923,9 +923,9 @@ static int ath9k_htc_start(struct ieee80211_hw *hw)
priv->op_flags &= ~OP_INVALID;
htc_start(priv->htc);
spin_lock_bh(&priv->tx_lock);
priv->tx_queues_stop = false;
spin_unlock_bh(&priv->tx_lock);
spin_lock_bh(&priv->tx.tx_lock);
priv->tx.tx_queues_stop = false;
spin_unlock_bh(&priv->tx.tx_lock);
ieee80211_wake_queues(hw);
@ -965,7 +965,7 @@ static void ath9k_htc_stop(struct ieee80211_hw *hw)
tasklet_kill(&priv->rx_tasklet);
tasklet_kill(&priv->tx_tasklet);
skb_queue_purge(&priv->tx_queue);
skb_queue_purge(&priv->tx.tx_queue);
ath9k_wmi_event_drain(priv);
@ -1563,9 +1563,9 @@ static int ath9k_htc_ampdu_action(struct ieee80211_hw *hw,
break;
case IEEE80211_AMPDU_TX_OPERATIONAL:
ista = (struct ath9k_htc_sta *) sta->drv_priv;
spin_lock_bh(&priv->tx_lock);
spin_lock_bh(&priv->tx.tx_lock);
ista->tid_state[tid] = AGGR_OPERATIONAL;
spin_unlock_bh(&priv->tx_lock);
spin_unlock_bh(&priv->tx.tx_lock);
break;
default:
ath_err(ath9k_hw_common(priv->ah), "Unknown AMPDU action\n");

View File

@ -239,10 +239,10 @@ static bool ath9k_htc_check_tx_aggr(struct ath9k_htc_priv *priv,
{
bool ret = false;
spin_lock_bh(&priv->tx_lock);
spin_lock_bh(&priv->tx.tx_lock);
if ((tid < ATH9K_HTC_MAX_TID) && (ista->tid_state[tid] == AGGR_STOP))
ret = true;
spin_unlock_bh(&priv->tx_lock);
spin_unlock_bh(&priv->tx.tx_lock);
return ret;
}
@ -257,7 +257,7 @@ void ath9k_tx_tasklet(unsigned long data)
struct sk_buff *skb = NULL;
__le16 fc;
while ((skb = skb_dequeue(&priv->tx_queue)) != NULL) {
while ((skb = skb_dequeue(&priv->tx.tx_queue)) != NULL) {
hdr = (struct ieee80211_hdr *) skb->data;
fc = hdr->frame_control;
@ -292,9 +292,9 @@ void ath9k_tx_tasklet(unsigned long data)
if (ath9k_htc_check_tx_aggr(priv, ista, tid)) {
ieee80211_start_tx_ba_session(sta, tid, 0);
spin_lock_bh(&priv->tx_lock);
spin_lock_bh(&priv->tx.tx_lock);
ista->tid_state[tid] = AGGR_PROGRESS;
spin_unlock_bh(&priv->tx_lock);
spin_unlock_bh(&priv->tx.tx_lock);
}
}
}
@ -307,16 +307,16 @@ void ath9k_tx_tasklet(unsigned long data)
}
/* Wake TX queues if needed */
spin_lock_bh(&priv->tx_lock);
if (priv->tx_queues_stop) {
priv->tx_queues_stop = false;
spin_unlock_bh(&priv->tx_lock);
spin_lock_bh(&priv->tx.tx_lock);
if (priv->tx.tx_queues_stop) {
priv->tx.tx_queues_stop = false;
spin_unlock_bh(&priv->tx.tx_lock);
ath_dbg(ath9k_hw_common(priv->ah), ATH_DBG_XMIT,
"Waking up TX queues\n");
ieee80211_wake_queues(priv->hw);
return;
}
spin_unlock_bh(&priv->tx_lock);
spin_unlock_bh(&priv->tx.tx_lock);
}
void ath9k_htc_txep(void *drv_priv, struct sk_buff *skb,
@ -348,13 +348,13 @@ void ath9k_htc_txep(void *drv_priv, struct sk_buff *skb,
if (txok)
tx_info->flags |= IEEE80211_TX_STAT_ACK;
skb_queue_tail(&priv->tx_queue, skb);
skb_queue_tail(&priv->tx.tx_queue, skb);
tasklet_schedule(&priv->tx_tasklet);
}
int ath9k_tx_init(struct ath9k_htc_priv *priv)
{
skb_queue_head_init(&priv->tx_queue);
skb_queue_head_init(&priv->tx.tx_queue);
return 0;
}