Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 265844
b: refs/heads/master
c: f39c95e
h: refs/heads/master
v: v3
  • Loading branch information
Emmanuel Grumbach authored and John W. Linville committed Aug 29, 2011
1 parent 4eab203 commit 6ceeb8b
Show file tree
Hide file tree
Showing 10 changed files with 91 additions and 86 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 9ca06f0a3fbf57c672c7f2cdfc85747a0bbfaf28
refs/heads/master: f39c95e8d7a152b409977687a999356f0e54bde6
6 changes: 3 additions & 3 deletions trunk/drivers/net/wireless/iwlwifi/iwl-agn-lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ void iwlagn_rx_reply_tx(struct iwl_priv *priv, struct iwl_rx_mem_buffer *rxb)
sta_id = (tx_resp->ra_tid & IWLAGN_TX_RES_RA_MSK) >>
IWLAGN_TX_RES_RA_POS;

spin_lock_irqsave(&priv->sta_lock, flags);
spin_lock_irqsave(&priv->shrd->sta_lock, flags);

hdr = (void *)txb->skb->data;
if (!ieee80211_is_data_qos(hdr->frame_control))
Expand Down Expand Up @@ -482,7 +482,7 @@ void iwlagn_rx_reply_tx(struct iwl_priv *priv, struct iwl_rx_mem_buffer *rxb)
iwlagn_txq_check_empty(priv, sta_id, tid, txq_id);

iwl_check_abort_status(priv, tx_resp->frame_count, status);
spin_unlock_irqrestore(&priv->sta_lock, flags);
spin_unlock_irqrestore(&priv->shrd->sta_lock, flags);
}

int iwlagn_hw_valid_rtc_data_addr(u32 addr)
Expand Down Expand Up @@ -1079,7 +1079,7 @@ int iwlagn_manage_ibss_station(struct iwl_priv *priv,
void iwl_free_tfds_in_queue(struct iwl_priv *priv,
int sta_id, int tid, int freed)
{
lockdep_assert_held(&priv->sta_lock);
lockdep_assert_held(&priv->shrd->sta_lock);

if (priv->stations[sta_id].tid[tid].tfds_in_queue >= freed)
priv->stations[sta_id].tid[tid].tfds_in_queue -= freed;
Expand Down
50 changes: 25 additions & 25 deletions trunk/drivers/net/wireless/iwlwifi/iwl-agn-sta.c
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,9 @@ int iwlagn_add_bssid_station(struct iwl_priv *priv, struct iwl_rxon_context *ctx
if (sta_id_r)
*sta_id_r = sta_id;

spin_lock_irqsave(&priv->sta_lock, flags);
spin_lock_irqsave(&priv->shrd->sta_lock, flags);
priv->stations[sta_id].used |= IWL_STA_LOCAL;
spin_unlock_irqrestore(&priv->sta_lock, flags);
spin_unlock_irqrestore(&priv->shrd->sta_lock, flags);

/* Set up default rate scaling table in device's station table */
link_cmd = iwl_sta_alloc_lq(priv, ctx, sta_id);
Expand All @@ -132,9 +132,9 @@ int iwlagn_add_bssid_station(struct iwl_priv *priv, struct iwl_rxon_context *ctx
if (ret)
IWL_ERR(priv, "Link quality command failed (%d)\n", ret);

spin_lock_irqsave(&priv->sta_lock, flags);
spin_lock_irqsave(&priv->shrd->sta_lock, flags);
priv->stations[sta_id].lq = link_cmd;
spin_unlock_irqrestore(&priv->sta_lock, flags);
spin_unlock_irqrestore(&priv->shrd->sta_lock, flags);

return 0;
}
Expand Down Expand Up @@ -311,9 +311,9 @@ static int iwlagn_send_sta_key(struct iwl_priv *priv,
struct iwl_addsta_cmd sta_cmd;
int i;

spin_lock_irqsave(&priv->sta_lock, flags);
spin_lock_irqsave(&priv->shrd->sta_lock, flags);
memcpy(&sta_cmd, &priv->stations[sta_id].sta, sizeof(sta_cmd));
spin_unlock_irqrestore(&priv->sta_lock, flags);
spin_unlock_irqrestore(&priv->shrd->sta_lock, flags);

key_flags = cpu_to_le16(keyconf->keyidx << STA_KEY_FLG_KEYID_POS);
key_flags |= STA_KEY_FLG_MAP_KEY_MSK;
Expand Down Expand Up @@ -388,11 +388,11 @@ int iwl_remove_dynamic_key(struct iwl_priv *priv,
if (sta_id == IWL_INVALID_STATION)
return -ENOENT;

spin_lock_irqsave(&priv->sta_lock, flags);
spin_lock_irqsave(&priv->shrd->sta_lock, flags);
memcpy(&sta_cmd, &priv->stations[sta_id].sta, sizeof(sta_cmd));
if (!(priv->stations[sta_id].used & IWL_STA_UCODE_ACTIVE))
sta_id = IWL_INVALID_STATION;
spin_unlock_irqrestore(&priv->sta_lock, flags);
spin_unlock_irqrestore(&priv->shrd->sta_lock, flags);

if (sta_id == IWL_INVALID_STATION)
return 0;
Expand Down Expand Up @@ -493,18 +493,18 @@ int iwlagn_alloc_bcast_station(struct iwl_priv *priv,
unsigned long flags;
u8 sta_id;

spin_lock_irqsave(&priv->sta_lock, flags);
spin_lock_irqsave(&priv->shrd->sta_lock, flags);
sta_id = iwl_prep_station(priv, ctx, iwl_bcast_addr, false, NULL);
if (sta_id == IWL_INVALID_STATION) {
IWL_ERR(priv, "Unable to prepare broadcast station\n");
spin_unlock_irqrestore(&priv->sta_lock, flags);
spin_unlock_irqrestore(&priv->shrd->sta_lock, flags);

return -EINVAL;
}

priv->stations[sta_id].used |= IWL_STA_DRIVER_ACTIVE;
priv->stations[sta_id].used |= IWL_STA_BCAST;
spin_unlock_irqrestore(&priv->sta_lock, flags);
spin_unlock_irqrestore(&priv->shrd->sta_lock, flags);

link_cmd = iwl_sta_alloc_lq(priv, ctx, sta_id);
if (!link_cmd) {
Expand All @@ -513,9 +513,9 @@ int iwlagn_alloc_bcast_station(struct iwl_priv *priv,
return -ENOMEM;
}

spin_lock_irqsave(&priv->sta_lock, flags);
spin_lock_irqsave(&priv->shrd->sta_lock, flags);
priv->stations[sta_id].lq = link_cmd;
spin_unlock_irqrestore(&priv->sta_lock, flags);
spin_unlock_irqrestore(&priv->shrd->sta_lock, flags);

return 0;
}
Expand All @@ -539,13 +539,13 @@ int iwl_update_bcast_station(struct iwl_priv *priv,
return -ENOMEM;
}

spin_lock_irqsave(&priv->sta_lock, flags);
spin_lock_irqsave(&priv->shrd->sta_lock, flags);
if (priv->stations[sta_id].lq)
kfree(priv->stations[sta_id].lq);
else
IWL_DEBUG_INFO(priv, "Bcast station rate scaling has not been initialized yet.\n");
priv->stations[sta_id].lq = link_cmd;
spin_unlock_irqrestore(&priv->sta_lock, flags);
spin_unlock_irqrestore(&priv->shrd->sta_lock, flags);

return 0;
}
Expand Down Expand Up @@ -575,12 +575,12 @@ int iwl_sta_tx_modify_enable_tid(struct iwl_priv *priv, int sta_id, int tid)
lockdep_assert_held(&priv->shrd->mutex);

/* Remove "disable" flag, to enable Tx for this TID */
spin_lock_irqsave(&priv->sta_lock, flags);
spin_lock_irqsave(&priv->shrd->sta_lock, flags);
priv->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_TID_DISABLE_TX;
priv->stations[sta_id].sta.tid_disable_tx &= cpu_to_le16(~(1 << tid));
priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK;
memcpy(&sta_cmd, &priv->stations[sta_id].sta, sizeof(struct iwl_addsta_cmd));
spin_unlock_irqrestore(&priv->sta_lock, flags);
spin_unlock_irqrestore(&priv->shrd->sta_lock, flags);

return iwl_send_add_sta(priv, &sta_cmd, CMD_SYNC);
}
Expand All @@ -598,14 +598,14 @@ int iwl_sta_rx_agg_start(struct iwl_priv *priv, struct ieee80211_sta *sta,
if (sta_id == IWL_INVALID_STATION)
return -ENXIO;

spin_lock_irqsave(&priv->sta_lock, flags);
spin_lock_irqsave(&priv->shrd->sta_lock, flags);
priv->stations[sta_id].sta.station_flags_msk = 0;
priv->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_ADDBA_TID_MSK;
priv->stations[sta_id].sta.add_immediate_ba_tid = (u8)tid;
priv->stations[sta_id].sta.add_immediate_ba_ssn = cpu_to_le16(ssn);
priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK;
memcpy(&sta_cmd, &priv->stations[sta_id].sta, sizeof(struct iwl_addsta_cmd));
spin_unlock_irqrestore(&priv->sta_lock, flags);
spin_unlock_irqrestore(&priv->shrd->sta_lock, flags);

return iwl_send_add_sta(priv, &sta_cmd, CMD_SYNC);
}
Expand All @@ -625,13 +625,13 @@ int iwl_sta_rx_agg_stop(struct iwl_priv *priv, struct ieee80211_sta *sta,
return -ENXIO;
}

spin_lock_irqsave(&priv->sta_lock, flags);
spin_lock_irqsave(&priv->shrd->sta_lock, flags);
priv->stations[sta_id].sta.station_flags_msk = 0;
priv->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_DELBA_TID_MSK;
priv->stations[sta_id].sta.remove_immediate_ba_tid = (u8)tid;
priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK;
memcpy(&sta_cmd, &priv->stations[sta_id].sta, sizeof(struct iwl_addsta_cmd));
spin_unlock_irqrestore(&priv->sta_lock, flags);
spin_unlock_irqrestore(&priv->shrd->sta_lock, flags);

return iwl_send_add_sta(priv, &sta_cmd, CMD_SYNC);
}
Expand All @@ -640,30 +640,30 @@ static void iwl_sta_modify_ps_wake(struct iwl_priv *priv, int sta_id)
{
unsigned long flags;

spin_lock_irqsave(&priv->sta_lock, flags);
spin_lock_irqsave(&priv->shrd->sta_lock, flags);
priv->stations[sta_id].sta.station_flags &= ~STA_FLG_PWR_SAVE_MSK;
priv->stations[sta_id].sta.station_flags_msk = STA_FLG_PWR_SAVE_MSK;
priv->stations[sta_id].sta.sta.modify_mask = 0;
priv->stations[sta_id].sta.sleep_tx_count = 0;
priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK;
iwl_send_add_sta(priv, &priv->stations[sta_id].sta, CMD_ASYNC);
spin_unlock_irqrestore(&priv->sta_lock, flags);
spin_unlock_irqrestore(&priv->shrd->sta_lock, flags);

}

void iwl_sta_modify_sleep_tx_count(struct iwl_priv *priv, int sta_id, int cnt)
{
unsigned long flags;

spin_lock_irqsave(&priv->sta_lock, flags);
spin_lock_irqsave(&priv->shrd->sta_lock, flags);
priv->stations[sta_id].sta.station_flags |= STA_FLG_PWR_SAVE_MSK;
priv->stations[sta_id].sta.station_flags_msk = STA_FLG_PWR_SAVE_MSK;
priv->stations[sta_id].sta.sta.modify_mask =
STA_MODIFY_SLEEP_TX_COUNT_MSK;
priv->stations[sta_id].sta.sleep_tx_count = cpu_to_le16(cnt);
priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK;
iwl_send_add_sta(priv, &priv->stations[sta_id].sta, CMD_ASYNC);
spin_unlock_irqrestore(&priv->sta_lock, flags);
spin_unlock_irqrestore(&priv->shrd->sta_lock, flags);

}

Expand Down
26 changes: 13 additions & 13 deletions trunk/drivers/net/wireless/iwlwifi/iwl-agn-tx.c
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ int iwlagn_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
txq_id = ctx->ac_to_queue[skb_get_queue_mapping(skb)];

/* irqs already disabled/saved above when locking priv->shrd->lock */
spin_lock(&priv->sta_lock);
spin_lock(&priv->shrd->sta_lock);

if (ieee80211_is_data_qos(fc)) {
u8 *qc = NULL;
Expand Down Expand Up @@ -460,7 +460,7 @@ int iwlagn_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
priv->stations[sta_id].tid[tid].seq_number = seq_number;
}

spin_unlock(&priv->sta_lock);
spin_unlock(&priv->shrd->sta_lock);
spin_unlock_irqrestore(&priv->shrd->lock, flags);

/*
Expand All @@ -476,7 +476,7 @@ int iwlagn_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
return 0;

drop_unlock_sta:
spin_unlock(&priv->sta_lock);
spin_unlock(&priv->shrd->sta_lock);
drop_unlock_priv:
spin_unlock_irqrestore(&priv->shrd->lock, flags);
return -1;
Expand Down Expand Up @@ -534,19 +534,19 @@ int iwlagn_tx_agg_start(struct iwl_priv *priv, struct ieee80211_vif *vif,
return -ENXIO;
}

spin_lock_irqsave(&priv->sta_lock, flags);
spin_lock_irqsave(&priv->shrd->sta_lock, flags);
tid_data = &priv->stations[sta_id].tid[tid];
*ssn = SEQ_TO_SN(tid_data->seq_number);
tid_data->agg.txq_id = txq_id;
tid_data->agg.tx_fifo = tx_fifo;
iwl_set_swq_id(&priv->txq[txq_id], get_ac_from_tid(tid), txq_id);
spin_unlock_irqrestore(&priv->sta_lock, flags);
spin_unlock_irqrestore(&priv->shrd->sta_lock, flags);

ret = iwlagn_txq_agg_enable(priv, txq_id, sta_id, tid);
if (ret)
return ret;

spin_lock_irqsave(&priv->sta_lock, flags);
spin_lock_irqsave(&priv->shrd->sta_lock, flags);
tid_data = &priv->stations[sta_id].tid[tid];
if (tid_data->tfds_in_queue == 0) {
IWL_DEBUG_HT(priv, "HW queue is empty\n");
Expand All @@ -557,7 +557,7 @@ int iwlagn_tx_agg_start(struct iwl_priv *priv, struct ieee80211_vif *vif,
tid_data->tfds_in_queue);
tid_data->agg.state = IWL_EMPTYING_HW_QUEUE_ADDBA;
}
spin_unlock_irqrestore(&priv->sta_lock, flags);
spin_unlock_irqrestore(&priv->shrd->sta_lock, flags);
return ret;
}

Expand All @@ -580,7 +580,7 @@ int iwlagn_tx_agg_stop(struct iwl_priv *priv, struct ieee80211_vif *vif,
return -ENXIO;
}

spin_lock_irqsave(&priv->sta_lock, flags);
spin_lock_irqsave(&priv->shrd->sta_lock, flags);

tid_data = &priv->stations[sta_id].tid[tid];
ssn = (tid_data->seq_number & IEEE80211_SCTL_SEQ) >> 4;
Expand Down Expand Up @@ -610,7 +610,7 @@ int iwlagn_tx_agg_stop(struct iwl_priv *priv, struct ieee80211_vif *vif,
IWL_DEBUG_HT(priv, "Stopping a non empty AGG HW QUEUE\n");
priv->stations[sta_id].tid[tid].agg.state =
IWL_EMPTYING_HW_QUEUE_DELBA;
spin_unlock_irqrestore(&priv->sta_lock, flags);
spin_unlock_irqrestore(&priv->shrd->sta_lock, flags);
return 0;
}

Expand All @@ -619,7 +619,7 @@ int iwlagn_tx_agg_stop(struct iwl_priv *priv, struct ieee80211_vif *vif,
priv->stations[sta_id].tid[tid].agg.state = IWL_AGG_OFF;

/* do not restore/save irqs */
spin_unlock(&priv->sta_lock);
spin_unlock(&priv->shrd->sta_lock);
spin_lock(&priv->shrd->lock);

/*
Expand Down Expand Up @@ -647,7 +647,7 @@ int iwlagn_txq_check_empty(struct iwl_priv *priv,

ctx = &priv->contexts[priv->stations[sta_id].ctxid];

lockdep_assert_held(&priv->sta_lock);
lockdep_assert_held(&priv->shrd->sta_lock);

switch (priv->stations[sta_id].tid[tid].agg.state) {
case IWL_EMPTYING_HW_QUEUE_DELBA:
Expand Down Expand Up @@ -890,7 +890,7 @@ void iwlagn_rx_reply_compressed_ba(struct iwl_priv *priv,
/* Find index just before block-ack window */
index = iwl_queue_dec_wrap(ba_resp_scd_ssn & 0xff, txq->q.n_bd);

spin_lock_irqsave(&priv->sta_lock, flags);
spin_lock_irqsave(&priv->shrd->sta_lock, flags);

IWL_DEBUG_TX_REPLY(priv, "REPLY_COMPRESSED_BA [%d] Received from %pM, "
"sta_id = %d\n",
Expand Down Expand Up @@ -927,7 +927,7 @@ void iwlagn_rx_reply_compressed_ba(struct iwl_priv *priv,
iwlagn_txq_check_empty(priv, sta_id, tid, scd_flow);
}

spin_unlock_irqrestore(&priv->sta_lock, flags);
spin_unlock_irqrestore(&priv->shrd->sta_lock, flags);
}

#ifdef CONFIG_IWLWIFI_DEBUG
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/net/wireless/iwlwifi/iwl-agn.c
Original file line number Diff line number Diff line change
Expand Up @@ -3416,7 +3416,7 @@ static int iwl_init_drv(struct iwl_priv *priv)
{
int ret;

spin_lock_init(&priv->sta_lock);
spin_lock_init(&priv->shrd->sta_lock);
spin_lock_init(&priv->hcmd_lock);

mutex_init(&priv->shrd->mutex);
Expand Down
3 changes: 0 additions & 3 deletions trunk/drivers/net/wireless/iwlwifi/iwl-dev.h
Original file line number Diff line number Diff line change
Expand Up @@ -1307,9 +1307,6 @@ struct iwl_priv {
struct iwl_tt_mgmt thermal_throttle;

/* station table variables */

/* Note: if lock and sta_lock are needed, lock must be acquired first */
spinlock_t sta_lock;
int num_stations;
struct iwl_station_entry stations[IWLAGN_STATION_COUNT];
unsigned long ucode_key_table;
Expand Down
3 changes: 3 additions & 0 deletions trunk/drivers/net/wireless/iwlwifi/iwl-shared.h
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,8 @@ struct iwl_hw_params {
* @hw_params: see struct iwl_hw_params
* @workqueue: the workqueue used by all the layers of the driver
* @lock: protect general shared data
* @sta_lock: protects the station table.
* If lock and sta_lock are needed, lock must be acquired first.
* @mutex:
*/
struct iwl_shared {
Expand All @@ -166,6 +168,7 @@ struct iwl_shared {

struct workqueue_struct *workqueue;
spinlock_t lock;
spinlock_t sta_lock;
struct mutex mutex;
};

Expand Down
Loading

0 comments on commit 6ceeb8b

Please sign in to comment.