Commit 04cf6824 authored by Emmanuel Grumbach's avatar Emmanuel Grumbach Committed by Wey-Yi Guy

iwlwifi: tid_data moves to iwl_priv

The transport doesn't need to access it any more.
Signed-off-by: default avatarEmmanuel Grumbach <emmanuel.grumbach@intel.com>
parent 97756fb1
...@@ -1158,7 +1158,7 @@ int iwlagn_suspend(struct iwl_priv *priv, ...@@ -1158,7 +1158,7 @@ int iwlagn_suspend(struct iwl_priv *priv,
* since the uCode will add 0x10 before using the value. * since the uCode will add 0x10 before using the value.
*/ */
for (i = 0; i < IWL_MAX_TID_COUNT; i++) { for (i = 0; i < IWL_MAX_TID_COUNT; i++) {
seq = priv->shrd->tid_data[IWL_AP_ID][i].seq_number; seq = priv->tid_data[IWL_AP_ID][i].seq_number;
seq -= 0x10; seq -= 0x10;
wakeup_filter_cmd.qos_seq[i] = cpu_to_le16(seq); wakeup_filter_cmd.qos_seq[i] = cpu_to_le16(seq);
} }
......
...@@ -2273,7 +2273,7 @@ static void rs_rate_scale_perform(struct iwl_priv *priv, ...@@ -2273,7 +2273,7 @@ static void rs_rate_scale_perform(struct iwl_priv *priv,
tid = rs_tl_add_packet(lq_sta, hdr); tid = rs_tl_add_packet(lq_sta, hdr);
if ((tid != IWL_MAX_TID_COUNT) && if ((tid != IWL_MAX_TID_COUNT) &&
(lq_sta->tx_agg_tid_en & (1 << tid))) { (lq_sta->tx_agg_tid_en & (1 << tid))) {
tid_data = &priv->shrd->tid_data[lq_sta->lq.sta_id][tid]; tid_data = &priv->tid_data[lq_sta->lq.sta_id][tid];
if (tid_data->agg.state == IWL_AGG_OFF) if (tid_data->agg.state == IWL_AGG_OFF)
lq_sta->is_agg = 0; lq_sta->is_agg = 0;
else else
...@@ -2645,8 +2645,7 @@ static void rs_rate_scale_perform(struct iwl_priv *priv, ...@@ -2645,8 +2645,7 @@ static void rs_rate_scale_perform(struct iwl_priv *priv,
(lq_sta->tx_agg_tid_en & (1 << tid)) && (lq_sta->tx_agg_tid_en & (1 << tid)) &&
(tid != IWL_MAX_TID_COUNT)) { (tid != IWL_MAX_TID_COUNT)) {
u8 sta_id = lq_sta->lq.sta_id; u8 sta_id = lq_sta->lq.sta_id;
tid_data = tid_data = &priv->tid_data[sta_id][tid];
&priv->shrd->tid_data[sta_id][tid];
if (tid_data->agg.state == IWL_AGG_OFF) { if (tid_data->agg.state == IWL_AGG_OFF) {
IWL_DEBUG_RATE(priv, IWL_DEBUG_RATE(priv,
"try to aggregate tid %d\n", "try to aggregate tid %d\n",
......
...@@ -375,7 +375,7 @@ int iwlagn_tx_skb(struct iwl_priv *priv, struct sk_buff *skb) ...@@ -375,7 +375,7 @@ int iwlagn_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
tid = qc[0] & IEEE80211_QOS_CTL_TID_MASK; tid = qc[0] & IEEE80211_QOS_CTL_TID_MASK;
if (WARN_ON_ONCE(tid >= IWL_MAX_TID_COUNT)) if (WARN_ON_ONCE(tid >= IWL_MAX_TID_COUNT))
goto drop_unlock_sta; goto drop_unlock_sta;
tid_data = &priv->shrd->tid_data[sta_id][tid]; tid_data = &priv->tid_data[sta_id][tid];
/* aggregation is on for this <sta,tid> */ /* aggregation is on for this <sta,tid> */
if (info->flags & IEEE80211_TX_CTL_AMPDU && if (info->flags & IEEE80211_TX_CTL_AMPDU &&
...@@ -403,8 +403,7 @@ int iwlagn_tx_skb(struct iwl_priv *priv, struct sk_buff *skb) ...@@ -403,8 +403,7 @@ int iwlagn_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
if (ieee80211_is_data_qos(fc) && !ieee80211_is_qos_nullfunc(fc) && if (ieee80211_is_data_qos(fc) && !ieee80211_is_qos_nullfunc(fc) &&
!ieee80211_has_morefrags(fc)) !ieee80211_has_morefrags(fc))
priv->shrd->tid_data[sta_id][tid].seq_number = priv->tid_data[sta_id][tid].seq_number = seq_number;
seq_number;
spin_unlock(&priv->shrd->sta_lock); spin_unlock(&priv->shrd->sta_lock);
spin_unlock_irqrestore(&priv->shrd->lock, flags); spin_unlock_irqrestore(&priv->shrd->lock, flags);
...@@ -447,9 +446,9 @@ int iwlagn_tx_agg_stop(struct iwl_priv *priv, struct ieee80211_vif *vif, ...@@ -447,9 +446,9 @@ int iwlagn_tx_agg_stop(struct iwl_priv *priv, struct ieee80211_vif *vif,
spin_lock_irqsave(&priv->shrd->sta_lock, flags); spin_lock_irqsave(&priv->shrd->sta_lock, flags);
tid_data = &priv->shrd->tid_data[sta_id][tid]; tid_data = &priv->tid_data[sta_id][tid];
switch (priv->shrd->tid_data[sta_id][tid].agg.state) { switch (priv->tid_data[sta_id][tid].agg.state) {
case IWL_EMPTYING_HW_QUEUE_ADDBA: case IWL_EMPTYING_HW_QUEUE_ADDBA:
/* /*
* This can happen if the peer stops aggregation * This can happen if the peer stops aggregation
...@@ -464,7 +463,7 @@ int iwlagn_tx_agg_stop(struct iwl_priv *priv, struct ieee80211_vif *vif, ...@@ -464,7 +463,7 @@ int iwlagn_tx_agg_stop(struct iwl_priv *priv, struct ieee80211_vif *vif,
default: default:
IWL_WARN(priv, "Stopping AGG while state not ON " IWL_WARN(priv, "Stopping AGG while state not ON "
"or starting for %d on %d (%d)\n", sta_id, tid, "or starting for %d on %d (%d)\n", sta_id, tid,
priv->shrd->tid_data[sta_id][tid].agg.state); priv->tid_data[sta_id][tid].agg.state);
spin_unlock_irqrestore(&priv->shrd->sta_lock, flags); spin_unlock_irqrestore(&priv->shrd->sta_lock, flags);
return 0; return 0;
} }
...@@ -477,7 +476,7 @@ int iwlagn_tx_agg_stop(struct iwl_priv *priv, struct ieee80211_vif *vif, ...@@ -477,7 +476,7 @@ int iwlagn_tx_agg_stop(struct iwl_priv *priv, struct ieee80211_vif *vif,
"next_recl = %d", "next_recl = %d",
tid_data->agg.ssn, tid_data->agg.ssn,
tid_data->next_reclaimed); tid_data->next_reclaimed);
priv->shrd->tid_data[sta_id][tid].agg.state = priv->tid_data[sta_id][tid].agg.state =
IWL_EMPTYING_HW_QUEUE_DELBA; IWL_EMPTYING_HW_QUEUE_DELBA;
spin_unlock_irqrestore(&priv->shrd->sta_lock, flags); spin_unlock_irqrestore(&priv->shrd->sta_lock, flags);
return 0; return 0;
...@@ -486,7 +485,7 @@ int iwlagn_tx_agg_stop(struct iwl_priv *priv, struct ieee80211_vif *vif, ...@@ -486,7 +485,7 @@ int iwlagn_tx_agg_stop(struct iwl_priv *priv, struct ieee80211_vif *vif,
IWL_DEBUG_TX_QUEUES(priv, "Can proceed: ssn = next_recl = %d", IWL_DEBUG_TX_QUEUES(priv, "Can proceed: ssn = next_recl = %d",
tid_data->agg.ssn); tid_data->agg.ssn);
turn_off: turn_off:
priv->shrd->tid_data[sta_id][tid].agg.state = IWL_AGG_OFF; priv->tid_data[sta_id][tid].agg.state = IWL_AGG_OFF;
/* do not restore/save irqs */ /* do not restore/save irqs */
spin_unlock(&priv->shrd->sta_lock); spin_unlock(&priv->shrd->sta_lock);
...@@ -521,7 +520,7 @@ int iwlagn_tx_agg_start(struct iwl_priv *priv, struct ieee80211_vif *vif, ...@@ -521,7 +520,7 @@ int iwlagn_tx_agg_start(struct iwl_priv *priv, struct ieee80211_vif *vif,
if (unlikely(tid >= IWL_MAX_TID_COUNT)) if (unlikely(tid >= IWL_MAX_TID_COUNT))
return -EINVAL; return -EINVAL;
if (priv->shrd->tid_data[sta_id][tid].agg.state != IWL_AGG_OFF) { if (priv->tid_data[sta_id][tid].agg.state != IWL_AGG_OFF) {
IWL_ERR(priv, "Start AGG when state is not IWL_AGG_OFF !\n"); IWL_ERR(priv, "Start AGG when state is not IWL_AGG_OFF !\n");
return -ENXIO; return -ENXIO;
} }
...@@ -532,7 +531,7 @@ int iwlagn_tx_agg_start(struct iwl_priv *priv, struct ieee80211_vif *vif, ...@@ -532,7 +531,7 @@ int iwlagn_tx_agg_start(struct iwl_priv *priv, struct ieee80211_vif *vif,
spin_lock_irqsave(&priv->shrd->sta_lock, flags); spin_lock_irqsave(&priv->shrd->sta_lock, flags);
tid_data = &priv->shrd->tid_data[sta_id][tid]; tid_data = &priv->tid_data[sta_id][tid];
tid_data->agg.ssn = SEQ_TO_SN(tid_data->seq_number); tid_data->agg.ssn = SEQ_TO_SN(tid_data->seq_number);
*ssn = tid_data->agg.ssn; *ssn = tid_data->agg.ssn;
...@@ -573,7 +572,7 @@ int iwlagn_tx_agg_oper(struct iwl_priv *priv, struct ieee80211_vif *vif, ...@@ -573,7 +572,7 @@ int iwlagn_tx_agg_oper(struct iwl_priv *priv, struct ieee80211_vif *vif,
buf_size = min_t(int, buf_size, LINK_QUAL_AGG_FRAME_LIMIT_DEF); buf_size = min_t(int, buf_size, LINK_QUAL_AGG_FRAME_LIMIT_DEF);
spin_lock_irqsave(&priv->shrd->sta_lock, flags); spin_lock_irqsave(&priv->shrd->sta_lock, flags);
ssn = priv->shrd->tid_data[sta_priv->sta_id][tid].agg.ssn; ssn = priv->tid_data[sta_priv->sta_id][tid].agg.ssn;
spin_unlock_irqrestore(&priv->shrd->sta_lock, flags); spin_unlock_irqrestore(&priv->shrd->sta_lock, flags);
iwl_trans_tx_agg_setup(trans(priv), ctx->ctxid, sta_priv->sta_id, tid, iwl_trans_tx_agg_setup(trans(priv), ctx->ctxid, sta_priv->sta_id, tid,
...@@ -625,11 +624,11 @@ int iwlagn_tx_agg_oper(struct iwl_priv *priv, struct ieee80211_vif *vif, ...@@ -625,11 +624,11 @@ int iwlagn_tx_agg_oper(struct iwl_priv *priv, struct ieee80211_vif *vif,
static void iwlagn_check_ratid_empty(struct iwl_priv *priv, int sta_id, u8 tid) static void iwlagn_check_ratid_empty(struct iwl_priv *priv, int sta_id, u8 tid)
{ {
struct iwl_tid_data *tid_data = &priv->shrd->tid_data[sta_id][tid]; struct iwl_tid_data *tid_data = &priv->tid_data[sta_id][tid];
lockdep_assert_held(&priv->shrd->sta_lock); lockdep_assert_held(&priv->shrd->sta_lock);
switch (priv->shrd->tid_data[sta_id][tid].agg.state) { switch (priv->tid_data[sta_id][tid].agg.state) {
case IWL_EMPTYING_HW_QUEUE_DELBA: case IWL_EMPTYING_HW_QUEUE_DELBA:
/* There are no packets for this RA / TID in the HW any more */ /* There are no packets for this RA / TID in the HW any more */
if (tid_data->agg.ssn == tid_data->next_reclaimed) { if (tid_data->agg.ssn == tid_data->next_reclaimed) {
...@@ -797,7 +796,7 @@ static void iwl_rx_reply_tx_agg(struct iwl_priv *priv, ...@@ -797,7 +796,7 @@ static void iwl_rx_reply_tx_agg(struct iwl_priv *priv,
IWLAGN_TX_RES_TID_POS; IWLAGN_TX_RES_TID_POS;
int sta_id = (tx_resp->ra_tid & IWLAGN_TX_RES_RA_MSK) >> int sta_id = (tx_resp->ra_tid & IWLAGN_TX_RES_RA_MSK) >>
IWLAGN_TX_RES_RA_POS; IWLAGN_TX_RES_RA_POS;
struct iwl_ht_agg *agg = &priv->shrd->tid_data[sta_id][tid].agg; struct iwl_ht_agg *agg = &priv->tid_data[sta_id][tid].agg;
u32 status = le16_to_cpu(tx_resp->status.status); u32 status = le16_to_cpu(tx_resp->status.status);
int i; int i;
...@@ -1028,8 +1027,7 @@ int iwlagn_rx_reply_tx(struct iwl_priv *priv, struct iwl_rx_mem_buffer *rxb, ...@@ -1028,8 +1027,7 @@ int iwlagn_rx_reply_tx(struct iwl_priv *priv, struct iwl_rx_mem_buffer *rxb,
} }
__skb_queue_head_init(&skbs); __skb_queue_head_init(&skbs);
priv->shrd->tid_data[sta_id][tid].next_reclaimed = priv->tid_data[sta_id][tid].next_reclaimed = next_reclaimed;
next_reclaimed;
IWL_DEBUG_TX_REPLY(priv, "Next reclaimed packet:%d", IWL_DEBUG_TX_REPLY(priv, "Next reclaimed packet:%d",
next_reclaimed); next_reclaimed);
...@@ -1132,7 +1130,7 @@ int iwlagn_rx_reply_compressed_ba(struct iwl_priv *priv, ...@@ -1132,7 +1130,7 @@ int iwlagn_rx_reply_compressed_ba(struct iwl_priv *priv,
sta_id = ba_resp->sta_id; sta_id = ba_resp->sta_id;
tid = ba_resp->tid; tid = ba_resp->tid;
agg = &priv->shrd->tid_data[sta_id][tid].agg; agg = &priv->tid_data[sta_id][tid].agg;
spin_lock_irqsave(&priv->shrd->sta_lock, flags); spin_lock_irqsave(&priv->shrd->sta_lock, flags);
...@@ -1182,7 +1180,7 @@ int iwlagn_rx_reply_compressed_ba(struct iwl_priv *priv, ...@@ -1182,7 +1180,7 @@ int iwlagn_rx_reply_compressed_ba(struct iwl_priv *priv,
IWL_DEBUG_HT(priv, "agg frames sent:%d, acked:%d\n", IWL_DEBUG_HT(priv, "agg frames sent:%d, acked:%d\n",
ba_resp->txed, ba_resp->txed_2_done); ba_resp->txed, ba_resp->txed_2_done);
priv->shrd->tid_data[sta_id][tid].next_reclaimed = ba_resp_scd_ssn; priv->tid_data[sta_id][tid].next_reclaimed = ba_resp_scd_ssn;
iwlagn_check_ratid_empty(priv, sta_id, tid); iwlagn_check_ratid_empty(priv, sta_id, tid);
freed = 0; freed = 0;
......
...@@ -375,7 +375,7 @@ static ssize_t iwl_dbgfs_stations_read(struct file *file, char __user *user_buf, ...@@ -375,7 +375,7 @@ static ssize_t iwl_dbgfs_stations_read(struct file *file, char __user *user_buf,
"TID\tseq_num\trate_n_flags\n"); "TID\tseq_num\trate_n_flags\n");
for (j = 0; j < IWL_MAX_TID_COUNT; j++) { for (j = 0; j < IWL_MAX_TID_COUNT; j++) {
tid_data = &priv->shrd->tid_data[i][j]; tid_data = &priv->tid_data[i][j];
pos += scnprintf(buf + pos, bufsz - pos, pos += scnprintf(buf + pos, bufsz - pos,
"%d:\t%#x\t%#x", "%d:\t%#x\t%#x",
j, tid_data->seq_number, j, tid_data->seq_number,
......
...@@ -189,6 +189,69 @@ struct iwl_qos_info { ...@@ -189,6 +189,69 @@ struct iwl_qos_info {
struct iwl_qosparam_cmd def_qos_parm; struct iwl_qosparam_cmd def_qos_parm;
}; };
/**
* enum iwl_agg_state
*
* The state machine of the BA agreement establishment / tear down.
* These states relate to a specific RA / TID.
*
* @IWL_AGG_OFF: aggregation is not used
* @IWL_AGG_ON: aggregation session is up
* @IWL_EMPTYING_HW_QUEUE_ADDBA: establishing a BA session - waiting for the
* HW queue to be empty from packets for this RA /TID.
* @IWL_EMPTYING_HW_QUEUE_DELBA: tearing down a BA session - waiting for the
* HW queue to be empty from packets for this RA /TID.
*/
enum iwl_agg_state {
IWL_AGG_OFF = 0,
IWL_AGG_ON,
IWL_EMPTYING_HW_QUEUE_ADDBA,
IWL_EMPTYING_HW_QUEUE_DELBA,
};
/**
* struct iwl_ht_agg - aggregation state machine
* This structs holds the states for the BA agreement establishment and tear
* down. It also holds the state during the BA session itself. This struct is
* duplicated for each RA / TID.
* @rate_n_flags: Rate at which Tx was attempted. Holds the data between the
* Tx response (REPLY_TX), and the block ack notification
* (REPLY_COMPRESSED_BA).
* @state: state of the BA agreement establishment / tear down.
* @txq_id: Tx queue used by the BA session - used by the transport layer.
* Needed by the upper layer for debugfs only.
* @ssn: the first packet to be sent in AGG HW queue in Tx AGG start flow, or
* the first packet to be sent in legacy HW queue in Tx AGG stop flow.
* Basically when next_reclaimed reaches ssn, we can tell mac80211 that
* we are ready to finish the Tx AGG stop / start flow.
* @wait_for_ba: Expect block-ack before next Tx reply
*/
struct iwl_ht_agg {
u32 rate_n_flags;
enum iwl_agg_state state;
u16 txq_id;
u16 ssn;
bool wait_for_ba;
};
/**
* struct iwl_tid_data - one for each RA / TID
* This structs holds the states for each RA / TID.
* @seq_number: the next WiFi sequence number to use
* @next_reclaimed: the WiFi sequence number of the next packet to be acked.
* This is basically (last acked packet++).
* @agg: aggregation state machine
*/
struct iwl_tid_data {
u16 seq_number;
u16 next_reclaimed;
struct iwl_ht_agg agg;
};
/* /*
* Structure should be accessed with sta_lock held. When station addition * Structure should be accessed with sta_lock held. When station addition
* is in progress (IWL_STA_UCODE_INPROGRESS) it is possible to access only * is in progress (IWL_STA_UCODE_INPROGRESS) it is possible to access only
...@@ -869,6 +932,7 @@ struct iwl_priv { ...@@ -869,6 +932,7 @@ struct iwl_priv {
int num_stations; int num_stations;
struct iwl_station_entry stations[IWLAGN_STATION_COUNT]; struct iwl_station_entry stations[IWLAGN_STATION_COUNT];
unsigned long ucode_key_table; unsigned long ucode_key_table;
struct iwl_tid_data tid_data[IWLAGN_STATION_COUNT][IWL_MAX_TID_COUNT];
u8 mac80211_registered; u8 mac80211_registered;
......
...@@ -198,66 +198,6 @@ struct iwl_hw_params { ...@@ -198,66 +198,6 @@ struct iwl_hw_params {
const struct iwl_sensitivity_ranges *sens; const struct iwl_sensitivity_ranges *sens;
}; };
/**
* enum iwl_agg_state
*
* The state machine of the BA agreement establishment / tear down.
* These states relate to a specific RA / TID.
*
* @IWL_AGG_OFF: aggregation is not used
* @IWL_AGG_ON: aggregation session is up
* @IWL_EMPTYING_HW_QUEUE_ADDBA: establishing a BA session - waiting for the
* HW queue to be empty from packets for this RA /TID.
* @IWL_EMPTYING_HW_QUEUE_DELBA: tearing down a BA session - waiting for the
* HW queue to be empty from packets for this RA /TID.
*/
enum iwl_agg_state {
IWL_AGG_OFF = 0,
IWL_AGG_ON,
IWL_EMPTYING_HW_QUEUE_ADDBA,
IWL_EMPTYING_HW_QUEUE_DELBA,
};
/**
* struct iwl_ht_agg - aggregation state machine
* This structs holds the states for the BA agreement establishment and tear
* down. It also holds the state during the BA session itself. This struct is
* duplicated for each RA / TID.
* @rate_n_flags: Rate at which Tx was attempted. Holds the data between the
* Tx response (REPLY_TX), and the block ack notification
* (REPLY_COMPRESSED_BA).
* @state: state of the BA agreement establishment / tear down.
* @ssn: the first packet to be sent in AGG HW queue in Tx AGG start flow, or
* the first packet to be sent in legacy HW queue in Tx AGG stop flow.
* Basically when next_reclaimed reaches ssn, we can tell mac80211 that
* we are ready to finish the Tx AGG stop / start flow.
* @wait_for_ba: Expect block-ack before next Tx reply
*/
struct iwl_ht_agg {
u32 rate_n_flags;
enum iwl_agg_state state;
u16 ssn;
bool wait_for_ba;
};
/**
* struct iwl_tid_data - one for each RA / TID
* This structs holds the states for each RA / TID.
* @seq_number: the next WiFi sequence number to use
* @next_reclaimed: the WiFi sequence number of the next packet to be acked.
* This is basically (last acked packet++).
* @agg: aggregation state machine
*/
struct iwl_tid_data {
u16 seq_number;
u16 next_reclaimed;
struct iwl_ht_agg agg;
};
/** /**
* enum iwl_ucode_type * enum iwl_ucode_type
* *
...@@ -448,8 +388,6 @@ struct iwl_shared { ...@@ -448,8 +388,6 @@ struct iwl_shared {
spinlock_t sta_lock; spinlock_t sta_lock;
struct mutex mutex; struct mutex mutex;
struct iwl_tid_data tid_data[IWLAGN_STATION_COUNT][IWL_MAX_TID_COUNT];
wait_queue_head_t wait_command_queue; wait_queue_head_t wait_command_queue;
/* eeprom -- this is in the card's little endian byte order */ /* eeprom -- this is in the card's little endian byte order */
......
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