Skip to content

Commit

Permalink
iwlwifi: map sw and hw ampdu queues
Browse files Browse the repository at this point in the history
This patch maps sw and hw queues (for aggregations), so the right
mac80211 queue will be waken when ieee80211_wake_queue is invoked.

Signed-off-by: Ron Rindjunsky <ron.rindjunsky@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Zhu Yi <yi.zhu@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
  • Loading branch information
Ron Rindjunsky authored and John W. Linville committed Jun 14, 2008
1 parent 203566f commit 7f3e4bb
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 11 deletions.
2 changes: 1 addition & 1 deletion drivers/net/wireless/iwlwifi/iwl-4965-hw.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
*/
#define IWL_CMD_QUEUE_NUM 4
#define IWL_CMD_FIFO_NUM 4
#define IWL_BACK_QUEUE_FIRST_ID 7
#define IWL49_FIRST_AMPDU_QUEUE 7

/* Tx rates */
#define IWL_CCK_RATES 4
Expand Down
17 changes: 9 additions & 8 deletions drivers/net/wireless/iwlwifi/iwl-4965.c
Original file line number Diff line number Diff line change
Expand Up @@ -913,6 +913,7 @@ int iwl4965_hw_set_hw_params(struct iwl_priv *priv)
}

priv->hw_params.max_txq_num = priv->cfg->mod_params->num_of_queues;
priv->hw_params.first_ampdu_q = IWL49_FIRST_AMPDU_QUEUE;
priv->hw_params.sw_crypto = priv->cfg->mod_params->sw_crypto;
priv->hw_params.max_rxq_size = RX_QUEUE_SIZE;
priv->hw_params.max_rxq_log = RX_QUEUE_SIZE_LOG;
Expand Down Expand Up @@ -2893,17 +2894,17 @@ static void iwl4965_tx_queue_stop_scheduler(struct iwl_priv *priv,
}

/**
* txq_id must be greater than IWL_BACK_QUEUE_FIRST_ID
* txq_id must be greater than IWL49_FIRST_AMPDU_QUEUE
* priv->lock must be held by the caller
*/
static int iwl4965_txq_agg_disable(struct iwl_priv *priv, u16 txq_id,
u16 ssn_idx, u8 tx_fifo)
{
int ret = 0;

if (IWL_BACK_QUEUE_FIRST_ID > txq_id) {
if (IWL49_FIRST_AMPDU_QUEUE > txq_id) {
IWL_WARNING("queue number too small: %d, must be > %d\n",
txq_id, IWL_BACK_QUEUE_FIRST_ID);
txq_id, IWL49_FIRST_AMPDU_QUEUE);
return -EINVAL;
}

Expand Down Expand Up @@ -2991,7 +2992,7 @@ static void iwl4965_rx_reply_compressed_ba(struct iwl_priv *priv,
if (txq->q.read_ptr != (ba_resp_scd_ssn & 0xff)) {
/* calculate mac80211 ampdu sw queue to wake */
int ampdu_q =
scd_flow - IWL_BACK_QUEUE_FIRST_ID + priv->hw->queues;
scd_flow - priv->hw_params.first_ampdu_q + priv->hw->queues;
int freed = iwl_tx_queue_reclaim(priv, scd_flow, index);
priv->stations[ba_resp->sta_id].
tid[ba_resp->tid].tfds_in_queue -= freed;
Expand Down Expand Up @@ -3036,7 +3037,7 @@ static int iwl4965_tx_queue_set_q2ratid(struct iwl_priv *priv, u16 ra_tid,
/**
* iwl4965_tx_queue_agg_enable - Set up & enable aggregation for selected queue
*
* NOTE: txq_id must be greater than IWL_BACK_QUEUE_FIRST_ID,
* NOTE: txq_id must be greater than IWL49_FIRST_AMPDU_QUEUE,
* i.e. it must be one of the higher queues used for aggregation
*/
static int iwl4965_txq_agg_enable(struct iwl_priv *priv, int txq_id,
Expand All @@ -3046,9 +3047,9 @@ static int iwl4965_txq_agg_enable(struct iwl_priv *priv, int txq_id,
int ret;
u16 ra_tid;

if (IWL_BACK_QUEUE_FIRST_ID > txq_id)
if (IWL49_FIRST_AMPDU_QUEUE > txq_id)
IWL_WARNING("queue number too small: %d, must be > %d\n",
txq_id, IWL_BACK_QUEUE_FIRST_ID);
txq_id, IWL49_FIRST_AMPDU_QUEUE);

ra_tid = BUILD_RAxTID(sta_id, tid);

Expand Down Expand Up @@ -3398,7 +3399,7 @@ static void iwl4965_rx_reply_tx(struct iwl_priv *priv,
txq_id >= 0 && priv->mac80211_registered &&
agg->state != IWL_EMPTYING_HW_QUEUE_DELBA) {
/* calculate mac80211 ampdu sw queue to wake */
ampdu_q = txq_id - IWL_BACK_QUEUE_FIRST_ID +
ampdu_q = txq_id - IWL49_FIRST_AMPDU_QUEUE +
priv->hw->queues;
if (agg->state == IWL_AGG_OFF)
ieee80211_wake_queue(priv->hw, txq_id);
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/wireless/iwlwifi/iwl-5000-hw.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
#define IWL50_QUEUE_SIZE 256
#define IWL50_CMD_FIFO_NUM 7
#define IWL50_NUM_QUEUES 20
#define IWL50_BACK_QUEUE_FIRST_ID 10
#define IWL50_FIRST_AMPDU_QUEUE 10

#define IWL_sta_id_POS 12
#define IWL_sta_id_LEN 4
Expand Down
3 changes: 2 additions & 1 deletion drivers/net/wireless/iwlwifi/iwl-5000.c
Original file line number Diff line number Diff line change
Expand Up @@ -825,6 +825,7 @@ static int iwl5000_hw_set_hw_params(struct iwl_priv *priv)
}

priv->hw_params.max_txq_num = priv->cfg->mod_params->num_of_queues;
priv->hw_params.first_ampdu_q = IWL50_FIRST_AMPDU_QUEUE;
priv->hw_params.sw_crypto = priv->cfg->mod_params->sw_crypto;
priv->hw_params.max_rxq_size = RX_QUEUE_SIZE;
priv->hw_params.max_rxq_log = RX_QUEUE_SIZE_LOG;
Expand Down Expand Up @@ -1183,7 +1184,7 @@ static void iwl5000_rx_reply_tx(struct iwl_priv *priv,
txq_id >= 0 && priv->mac80211_registered &&
agg->state != IWL_EMPTYING_HW_QUEUE_DELBA) {
/* calculate mac80211 ampdu sw queue to wake */
ampdu_q = txq_id - IWL_BACK_QUEUE_FIRST_ID +
ampdu_q = txq_id - IWL50_FIRST_AMPDU_QUEUE +
priv->hw->queues;
if (agg->state == IWL_AGG_OFF)
ieee80211_wake_queue(priv->hw, txq_id);
Expand Down
2 changes: 2 additions & 0 deletions drivers/net/wireless/iwlwifi/iwl-dev.h
Original file line number Diff line number Diff line change
Expand Up @@ -583,6 +583,7 @@ struct iwl_sensitivity_ranges {
* @max_xxx_size: for ucode uses
* @ct_kill_threshold: temperature threshold
* @struct iwl_sensitivity_ranges: range of sensitivity values
* @first_ampdu_q: first HW queue available for ampdu
*/
struct iwl_hw_params {
u16 max_txq_num;
Expand All @@ -603,6 +604,7 @@ struct iwl_hw_params {
u32 max_bsm_size;
u32 ct_kill_threshold; /* value in hw-dependent units */
const struct iwl_sensitivity_ranges *sens;
u8 first_ampdu_q;
};

#define HT_SHORT_GI_20MHZ (1 << 0)
Expand Down

0 comments on commit 7f3e4bb

Please sign in to comment.