aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/iwlwifi')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn-lib.c6
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn-sta.c50
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn-tx.c26
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn.c2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-dev.h3
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-shared.h3
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-sta.c77
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-sta.h4
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-trans-tx-pcie.c4
9 files changed, 90 insertions, 85 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-lib.c b/drivers/net/wireless/iwlwifi/iwl-agn-lib.c
index a604baa1383e..bf2ba98e767a 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-lib.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-lib.c
@@ -427,7 +427,7 @@ void iwlagn_rx_reply_tx(struct iwl_priv *priv, struct iwl_rx_mem_buffer *rxb)
427 sta_id = (tx_resp->ra_tid & IWLAGN_TX_RES_RA_MSK) >> 427 sta_id = (tx_resp->ra_tid & IWLAGN_TX_RES_RA_MSK) >>
428 IWLAGN_TX_RES_RA_POS; 428 IWLAGN_TX_RES_RA_POS;
429 429
430 spin_lock_irqsave(&priv->sta_lock, flags); 430 spin_lock_irqsave(&priv->shrd->sta_lock, flags);
431 431
432 hdr = (void *)txb->skb->data; 432 hdr = (void *)txb->skb->data;
433 if (!ieee80211_is_data_qos(hdr->frame_control)) 433 if (!ieee80211_is_data_qos(hdr->frame_control))
@@ -482,7 +482,7 @@ void iwlagn_rx_reply_tx(struct iwl_priv *priv, struct iwl_rx_mem_buffer *rxb)
482 iwlagn_txq_check_empty(priv, sta_id, tid, txq_id); 482 iwlagn_txq_check_empty(priv, sta_id, tid, txq_id);
483 483
484 iwl_check_abort_status(priv, tx_resp->frame_count, status); 484 iwl_check_abort_status(priv, tx_resp->frame_count, status);
485 spin_unlock_irqrestore(&priv->sta_lock, flags); 485 spin_unlock_irqrestore(&priv->shrd->sta_lock, flags);
486} 486}
487 487
488int iwlagn_hw_valid_rtc_data_addr(u32 addr) 488int iwlagn_hw_valid_rtc_data_addr(u32 addr)
@@ -1079,7 +1079,7 @@ int iwlagn_manage_ibss_station(struct iwl_priv *priv,
1079void iwl_free_tfds_in_queue(struct iwl_priv *priv, 1079void iwl_free_tfds_in_queue(struct iwl_priv *priv,
1080 int sta_id, int tid, int freed) 1080 int sta_id, int tid, int freed)
1081{ 1081{
1082 lockdep_assert_held(&priv->sta_lock); 1082 lockdep_assert_held(&priv->shrd->sta_lock);
1083 1083
1084 if (priv->stations[sta_id].tid[tid].tfds_in_queue >= freed) 1084 if (priv->stations[sta_id].tid[tid].tfds_in_queue >= freed)
1085 priv->stations[sta_id].tid[tid].tfds_in_queue -= freed; 1085 priv->stations[sta_id].tid[tid].tfds_in_queue -= freed;
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-sta.c b/drivers/net/wireless/iwlwifi/iwl-agn-sta.c
index c99e6cce0733..4b13bb9df999 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-sta.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-sta.c
@@ -116,9 +116,9 @@ int iwlagn_add_bssid_station(struct iwl_priv *priv, struct iwl_rxon_context *ctx
116 if (sta_id_r) 116 if (sta_id_r)
117 *sta_id_r = sta_id; 117 *sta_id_r = sta_id;
118 118
119 spin_lock_irqsave(&priv->sta_lock, flags); 119 spin_lock_irqsave(&priv->shrd->sta_lock, flags);
120 priv->stations[sta_id].used |= IWL_STA_LOCAL; 120 priv->stations[sta_id].used |= IWL_STA_LOCAL;
121 spin_unlock_irqrestore(&priv->sta_lock, flags); 121 spin_unlock_irqrestore(&priv->shrd->sta_lock, flags);
122 122
123 /* Set up default rate scaling table in device's station table */ 123 /* Set up default rate scaling table in device's station table */
124 link_cmd = iwl_sta_alloc_lq(priv, ctx, sta_id); 124 link_cmd = iwl_sta_alloc_lq(priv, ctx, sta_id);
@@ -132,9 +132,9 @@ int iwlagn_add_bssid_station(struct iwl_priv *priv, struct iwl_rxon_context *ctx
132 if (ret) 132 if (ret)
133 IWL_ERR(priv, "Link quality command failed (%d)\n", ret); 133 IWL_ERR(priv, "Link quality command failed (%d)\n", ret);
134 134
135 spin_lock_irqsave(&priv->sta_lock, flags); 135 spin_lock_irqsave(&priv->shrd->sta_lock, flags);
136 priv->stations[sta_id].lq = link_cmd; 136 priv->stations[sta_id].lq = link_cmd;
137 spin_unlock_irqrestore(&priv->sta_lock, flags); 137 spin_unlock_irqrestore(&priv->shrd->sta_lock, flags);
138 138
139 return 0; 139 return 0;
140} 140}
@@ -311,9 +311,9 @@ static int iwlagn_send_sta_key(struct iwl_priv *priv,
311 struct iwl_addsta_cmd sta_cmd; 311 struct iwl_addsta_cmd sta_cmd;
312 int i; 312 int i;
313 313
314 spin_lock_irqsave(&priv->sta_lock, flags); 314 spin_lock_irqsave(&priv->shrd->sta_lock, flags);
315 memcpy(&sta_cmd, &priv->stations[sta_id].sta, sizeof(sta_cmd)); 315 memcpy(&sta_cmd, &priv->stations[sta_id].sta, sizeof(sta_cmd));
316 spin_unlock_irqrestore(&priv->sta_lock, flags); 316 spin_unlock_irqrestore(&priv->shrd->sta_lock, flags);
317 317
318 key_flags = cpu_to_le16(keyconf->keyidx << STA_KEY_FLG_KEYID_POS); 318 key_flags = cpu_to_le16(keyconf->keyidx << STA_KEY_FLG_KEYID_POS);
319 key_flags |= STA_KEY_FLG_MAP_KEY_MSK; 319 key_flags |= STA_KEY_FLG_MAP_KEY_MSK;
@@ -388,11 +388,11 @@ int iwl_remove_dynamic_key(struct iwl_priv *priv,
388 if (sta_id == IWL_INVALID_STATION) 388 if (sta_id == IWL_INVALID_STATION)
389 return -ENOENT; 389 return -ENOENT;
390 390
391 spin_lock_irqsave(&priv->sta_lock, flags); 391 spin_lock_irqsave(&priv->shrd->sta_lock, flags);
392 memcpy(&sta_cmd, &priv->stations[sta_id].sta, sizeof(sta_cmd)); 392 memcpy(&sta_cmd, &priv->stations[sta_id].sta, sizeof(sta_cmd));
393 if (!(priv->stations[sta_id].used & IWL_STA_UCODE_ACTIVE)) 393 if (!(priv->stations[sta_id].used & IWL_STA_UCODE_ACTIVE))
394 sta_id = IWL_INVALID_STATION; 394 sta_id = IWL_INVALID_STATION;
395 spin_unlock_irqrestore(&priv->sta_lock, flags); 395 spin_unlock_irqrestore(&priv->shrd->sta_lock, flags);
396 396
397 if (sta_id == IWL_INVALID_STATION) 397 if (sta_id == IWL_INVALID_STATION)
398 return 0; 398 return 0;
@@ -493,18 +493,18 @@ int iwlagn_alloc_bcast_station(struct iwl_priv *priv,
493 unsigned long flags; 493 unsigned long flags;
494 u8 sta_id; 494 u8 sta_id;
495 495
496 spin_lock_irqsave(&priv->sta_lock, flags); 496 spin_lock_irqsave(&priv->shrd->sta_lock, flags);
497 sta_id = iwl_prep_station(priv, ctx, iwl_bcast_addr, false, NULL); 497 sta_id = iwl_prep_station(priv, ctx, iwl_bcast_addr, false, NULL);
498 if (sta_id == IWL_INVALID_STATION) { 498 if (sta_id == IWL_INVALID_STATION) {
499 IWL_ERR(priv, "Unable to prepare broadcast station\n"); 499 IWL_ERR(priv, "Unable to prepare broadcast station\n");
500 spin_unlock_irqrestore(&priv->sta_lock, flags); 500 spin_unlock_irqrestore(&priv->shrd->sta_lock, flags);
501 501
502 return -EINVAL; 502 return -EINVAL;
503 } 503 }
504 504
505 priv->stations[sta_id].used |= IWL_STA_DRIVER_ACTIVE; 505 priv->stations[sta_id].used |= IWL_STA_DRIVER_ACTIVE;
506 priv->stations[sta_id].used |= IWL_STA_BCAST; 506 priv->stations[sta_id].used |= IWL_STA_BCAST;
507 spin_unlock_irqrestore(&priv->sta_lock, flags); 507 spin_unlock_irqrestore(&priv->shrd->sta_lock, flags);
508 508
509 link_cmd = iwl_sta_alloc_lq(priv, ctx, sta_id); 509 link_cmd = iwl_sta_alloc_lq(priv, ctx, sta_id);
510 if (!link_cmd) { 510 if (!link_cmd) {
@@ -513,9 +513,9 @@ int iwlagn_alloc_bcast_station(struct iwl_priv *priv,
513 return -ENOMEM; 513 return -ENOMEM;
514 } 514 }
515 515
516 spin_lock_irqsave(&priv->sta_lock, flags); 516 spin_lock_irqsave(&priv->shrd->sta_lock, flags);
517 priv->stations[sta_id].lq = link_cmd; 517 priv->stations[sta_id].lq = link_cmd;
518 spin_unlock_irqrestore(&priv->sta_lock, flags); 518 spin_unlock_irqrestore(&priv->shrd->sta_lock, flags);
519 519
520 return 0; 520 return 0;
521} 521}
@@ -539,13 +539,13 @@ int iwl_update_bcast_station(struct iwl_priv *priv,
539 return -ENOMEM; 539 return -ENOMEM;
540 } 540 }
541 541
542 spin_lock_irqsave(&priv->sta_lock, flags); 542 spin_lock_irqsave(&priv->shrd->sta_lock, flags);
543 if (priv->stations[sta_id].lq) 543 if (priv->stations[sta_id].lq)
544 kfree(priv->stations[sta_id].lq); 544 kfree(priv->stations[sta_id].lq);
545 else 545 else
546 IWL_DEBUG_INFO(priv, "Bcast station rate scaling has not been initialized yet.\n"); 546 IWL_DEBUG_INFO(priv, "Bcast station rate scaling has not been initialized yet.\n");
547 priv->stations[sta_id].lq = link_cmd; 547 priv->stations[sta_id].lq = link_cmd;
548 spin_unlock_irqrestore(&priv->sta_lock, flags); 548 spin_unlock_irqrestore(&priv->shrd->sta_lock, flags);
549 549
550 return 0; 550 return 0;
551} 551}
@@ -575,12 +575,12 @@ int iwl_sta_tx_modify_enable_tid(struct iwl_priv *priv, int sta_id, int tid)
575 lockdep_assert_held(&priv->shrd->mutex); 575 lockdep_assert_held(&priv->shrd->mutex);
576 576
577 /* Remove "disable" flag, to enable Tx for this TID */ 577 /* Remove "disable" flag, to enable Tx for this TID */
578 spin_lock_irqsave(&priv->sta_lock, flags); 578 spin_lock_irqsave(&priv->shrd->sta_lock, flags);
579 priv->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_TID_DISABLE_TX; 579 priv->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_TID_DISABLE_TX;
580 priv->stations[sta_id].sta.tid_disable_tx &= cpu_to_le16(~(1 << tid)); 580 priv->stations[sta_id].sta.tid_disable_tx &= cpu_to_le16(~(1 << tid));
581 priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK; 581 priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK;
582 memcpy(&sta_cmd, &priv->stations[sta_id].sta, sizeof(struct iwl_addsta_cmd)); 582 memcpy(&sta_cmd, &priv->stations[sta_id].sta, sizeof(struct iwl_addsta_cmd));
583 spin_unlock_irqrestore(&priv->sta_lock, flags); 583 spin_unlock_irqrestore(&priv->shrd->sta_lock, flags);
584 584
585 return iwl_send_add_sta(priv, &sta_cmd, CMD_SYNC); 585 return iwl_send_add_sta(priv, &sta_cmd, CMD_SYNC);
586} 586}
@@ -598,14 +598,14 @@ int iwl_sta_rx_agg_start(struct iwl_priv *priv, struct ieee80211_sta *sta,
598 if (sta_id == IWL_INVALID_STATION) 598 if (sta_id == IWL_INVALID_STATION)
599 return -ENXIO; 599 return -ENXIO;
600 600
601 spin_lock_irqsave(&priv->sta_lock, flags); 601 spin_lock_irqsave(&priv->shrd->sta_lock, flags);
602 priv->stations[sta_id].sta.station_flags_msk = 0; 602 priv->stations[sta_id].sta.station_flags_msk = 0;
603 priv->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_ADDBA_TID_MSK; 603 priv->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_ADDBA_TID_MSK;
604 priv->stations[sta_id].sta.add_immediate_ba_tid = (u8)tid; 604 priv->stations[sta_id].sta.add_immediate_ba_tid = (u8)tid;
605 priv->stations[sta_id].sta.add_immediate_ba_ssn = cpu_to_le16(ssn); 605 priv->stations[sta_id].sta.add_immediate_ba_ssn = cpu_to_le16(ssn);
606 priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK; 606 priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK;
607 memcpy(&sta_cmd, &priv->stations[sta_id].sta, sizeof(struct iwl_addsta_cmd)); 607 memcpy(&sta_cmd, &priv->stations[sta_id].sta, sizeof(struct iwl_addsta_cmd));
608 spin_unlock_irqrestore(&priv->sta_lock, flags); 608 spin_unlock_irqrestore(&priv->shrd->sta_lock, flags);
609 609
610 return iwl_send_add_sta(priv, &sta_cmd, CMD_SYNC); 610 return iwl_send_add_sta(priv, &sta_cmd, CMD_SYNC);
611} 611}
@@ -625,13 +625,13 @@ int iwl_sta_rx_agg_stop(struct iwl_priv *priv, struct ieee80211_sta *sta,
625 return -ENXIO; 625 return -ENXIO;
626 } 626 }
627 627
628 spin_lock_irqsave(&priv->sta_lock, flags); 628 spin_lock_irqsave(&priv->shrd->sta_lock, flags);
629 priv->stations[sta_id].sta.station_flags_msk = 0; 629 priv->stations[sta_id].sta.station_flags_msk = 0;
630 priv->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_DELBA_TID_MSK; 630 priv->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_DELBA_TID_MSK;
631 priv->stations[sta_id].sta.remove_immediate_ba_tid = (u8)tid; 631 priv->stations[sta_id].sta.remove_immediate_ba_tid = (u8)tid;
632 priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK; 632 priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK;
633 memcpy(&sta_cmd, &priv->stations[sta_id].sta, sizeof(struct iwl_addsta_cmd)); 633 memcpy(&sta_cmd, &priv->stations[sta_id].sta, sizeof(struct iwl_addsta_cmd));
634 spin_unlock_irqrestore(&priv->sta_lock, flags); 634 spin_unlock_irqrestore(&priv->shrd->sta_lock, flags);
635 635
636 return iwl_send_add_sta(priv, &sta_cmd, CMD_SYNC); 636 return iwl_send_add_sta(priv, &sta_cmd, CMD_SYNC);
637} 637}
@@ -640,14 +640,14 @@ static void iwl_sta_modify_ps_wake(struct iwl_priv *priv, int sta_id)
640{ 640{
641 unsigned long flags; 641 unsigned long flags;
642 642
643 spin_lock_irqsave(&priv->sta_lock, flags); 643 spin_lock_irqsave(&priv->shrd->sta_lock, flags);
644 priv->stations[sta_id].sta.station_flags &= ~STA_FLG_PWR_SAVE_MSK; 644 priv->stations[sta_id].sta.station_flags &= ~STA_FLG_PWR_SAVE_MSK;
645 priv->stations[sta_id].sta.station_flags_msk = STA_FLG_PWR_SAVE_MSK; 645 priv->stations[sta_id].sta.station_flags_msk = STA_FLG_PWR_SAVE_MSK;
646 priv->stations[sta_id].sta.sta.modify_mask = 0; 646 priv->stations[sta_id].sta.sta.modify_mask = 0;
647 priv->stations[sta_id].sta.sleep_tx_count = 0; 647 priv->stations[sta_id].sta.sleep_tx_count = 0;
648 priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK; 648 priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK;
649 iwl_send_add_sta(priv, &priv->stations[sta_id].sta, CMD_ASYNC); 649 iwl_send_add_sta(priv, &priv->stations[sta_id].sta, CMD_ASYNC);
650 spin_unlock_irqrestore(&priv->sta_lock, flags); 650 spin_unlock_irqrestore(&priv->shrd->sta_lock, flags);
651 651
652} 652}
653 653
@@ -655,7 +655,7 @@ void iwl_sta_modify_sleep_tx_count(struct iwl_priv *priv, int sta_id, int cnt)
655{ 655{
656 unsigned long flags; 656 unsigned long flags;
657 657
658 spin_lock_irqsave(&priv->sta_lock, flags); 658 spin_lock_irqsave(&priv->shrd->sta_lock, flags);
659 priv->stations[sta_id].sta.station_flags |= STA_FLG_PWR_SAVE_MSK; 659 priv->stations[sta_id].sta.station_flags |= STA_FLG_PWR_SAVE_MSK;
660 priv->stations[sta_id].sta.station_flags_msk = STA_FLG_PWR_SAVE_MSK; 660 priv->stations[sta_id].sta.station_flags_msk = STA_FLG_PWR_SAVE_MSK;
661 priv->stations[sta_id].sta.sta.modify_mask = 661 priv->stations[sta_id].sta.sta.modify_mask =
@@ -663,7 +663,7 @@ void iwl_sta_modify_sleep_tx_count(struct iwl_priv *priv, int sta_id, int cnt)
663 priv->stations[sta_id].sta.sleep_tx_count = cpu_to_le16(cnt); 663 priv->stations[sta_id].sta.sleep_tx_count = cpu_to_le16(cnt);
664 priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK; 664 priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK;
665 iwl_send_add_sta(priv, &priv->stations[sta_id].sta, CMD_ASYNC); 665 iwl_send_add_sta(priv, &priv->stations[sta_id].sta, CMD_ASYNC);
666 spin_unlock_irqrestore(&priv->sta_lock, flags); 666 spin_unlock_irqrestore(&priv->shrd->sta_lock, flags);
667 667
668} 668}
669 669
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-tx.c b/drivers/net/wireless/iwlwifi/iwl-agn-tx.c
index 89d7b30525f9..d0d77106da9a 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-tx.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-tx.c
@@ -405,7 +405,7 @@ int iwlagn_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
405 txq_id = ctx->ac_to_queue[skb_get_queue_mapping(skb)]; 405 txq_id = ctx->ac_to_queue[skb_get_queue_mapping(skb)];
406 406
407 /* irqs already disabled/saved above when locking priv->shrd->lock */ 407 /* irqs already disabled/saved above when locking priv->shrd->lock */
408 spin_lock(&priv->sta_lock); 408 spin_lock(&priv->shrd->sta_lock);
409 409
410 if (ieee80211_is_data_qos(fc)) { 410 if (ieee80211_is_data_qos(fc)) {
411 u8 *qc = NULL; 411 u8 *qc = NULL;
@@ -460,7 +460,7 @@ int iwlagn_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
460 priv->stations[sta_id].tid[tid].seq_number = seq_number; 460 priv->stations[sta_id].tid[tid].seq_number = seq_number;
461 } 461 }
462 462
463 spin_unlock(&priv->sta_lock); 463 spin_unlock(&priv->shrd->sta_lock);
464 spin_unlock_irqrestore(&priv->shrd->lock, flags); 464 spin_unlock_irqrestore(&priv->shrd->lock, flags);
465 465
466 /* 466 /*
@@ -476,7 +476,7 @@ int iwlagn_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
476 return 0; 476 return 0;
477 477
478drop_unlock_sta: 478drop_unlock_sta:
479 spin_unlock(&priv->sta_lock); 479 spin_unlock(&priv->shrd->sta_lock);
480drop_unlock_priv: 480drop_unlock_priv:
481 spin_unlock_irqrestore(&priv->shrd->lock, flags); 481 spin_unlock_irqrestore(&priv->shrd->lock, flags);
482 return -1; 482 return -1;
@@ -534,19 +534,19 @@ int iwlagn_tx_agg_start(struct iwl_priv *priv, struct ieee80211_vif *vif,
534 return -ENXIO; 534 return -ENXIO;
535 } 535 }
536 536
537 spin_lock_irqsave(&priv->sta_lock, flags); 537 spin_lock_irqsave(&priv->shrd->sta_lock, flags);
538 tid_data = &priv->stations[sta_id].tid[tid]; 538 tid_data = &priv->stations[sta_id].tid[tid];
539 *ssn = SEQ_TO_SN(tid_data->seq_number); 539 *ssn = SEQ_TO_SN(tid_data->seq_number);
540 tid_data->agg.txq_id = txq_id; 540 tid_data->agg.txq_id = txq_id;
541 tid_data->agg.tx_fifo = tx_fifo; 541 tid_data->agg.tx_fifo = tx_fifo;
542 iwl_set_swq_id(&priv->txq[txq_id], get_ac_from_tid(tid), txq_id); 542 iwl_set_swq_id(&priv->txq[txq_id], get_ac_from_tid(tid), txq_id);
543 spin_unlock_irqrestore(&priv->sta_lock, flags); 543 spin_unlock_irqrestore(&priv->shrd->sta_lock, flags);
544 544
545 ret = iwlagn_txq_agg_enable(priv, txq_id, sta_id, tid); 545 ret = iwlagn_txq_agg_enable(priv, txq_id, sta_id, tid);
546 if (ret) 546 if (ret)
547 return ret; 547 return ret;
548 548
549 spin_lock_irqsave(&priv->sta_lock, flags); 549 spin_lock_irqsave(&priv->shrd->sta_lock, flags);
550 tid_data = &priv->stations[sta_id].tid[tid]; 550 tid_data = &priv->stations[sta_id].tid[tid];
551 if (tid_data->tfds_in_queue == 0) { 551 if (tid_data->tfds_in_queue == 0) {
552 IWL_DEBUG_HT(priv, "HW queue is empty\n"); 552 IWL_DEBUG_HT(priv, "HW queue is empty\n");
@@ -557,7 +557,7 @@ int iwlagn_tx_agg_start(struct iwl_priv *priv, struct ieee80211_vif *vif,
557 tid_data->tfds_in_queue); 557 tid_data->tfds_in_queue);
558 tid_data->agg.state = IWL_EMPTYING_HW_QUEUE_ADDBA; 558 tid_data->agg.state = IWL_EMPTYING_HW_QUEUE_ADDBA;
559 } 559 }
560 spin_unlock_irqrestore(&priv->sta_lock, flags); 560 spin_unlock_irqrestore(&priv->shrd->sta_lock, flags);
561 return ret; 561 return ret;
562} 562}
563 563
@@ -580,7 +580,7 @@ int iwlagn_tx_agg_stop(struct iwl_priv *priv, struct ieee80211_vif *vif,
580 return -ENXIO; 580 return -ENXIO;
581 } 581 }
582 582
583 spin_lock_irqsave(&priv->sta_lock, flags); 583 spin_lock_irqsave(&priv->shrd->sta_lock, flags);
584 584
585 tid_data = &priv->stations[sta_id].tid[tid]; 585 tid_data = &priv->stations[sta_id].tid[tid];
586 ssn = (tid_data->seq_number & IEEE80211_SCTL_SEQ) >> 4; 586 ssn = (tid_data->seq_number & IEEE80211_SCTL_SEQ) >> 4;
@@ -610,7 +610,7 @@ int iwlagn_tx_agg_stop(struct iwl_priv *priv, struct ieee80211_vif *vif,
610 IWL_DEBUG_HT(priv, "Stopping a non empty AGG HW QUEUE\n"); 610 IWL_DEBUG_HT(priv, "Stopping a non empty AGG HW QUEUE\n");
611 priv->stations[sta_id].tid[tid].agg.state = 611 priv->stations[sta_id].tid[tid].agg.state =
612 IWL_EMPTYING_HW_QUEUE_DELBA; 612 IWL_EMPTYING_HW_QUEUE_DELBA;
613 spin_unlock_irqrestore(&priv->sta_lock, flags); 613 spin_unlock_irqrestore(&priv->shrd->sta_lock, flags);
614 return 0; 614 return 0;
615 } 615 }
616 616
@@ -619,7 +619,7 @@ int iwlagn_tx_agg_stop(struct iwl_priv *priv, struct ieee80211_vif *vif,
619 priv->stations[sta_id].tid[tid].agg.state = IWL_AGG_OFF; 619 priv->stations[sta_id].tid[tid].agg.state = IWL_AGG_OFF;
620 620
621 /* do not restore/save irqs */ 621 /* do not restore/save irqs */
622 spin_unlock(&priv->sta_lock); 622 spin_unlock(&priv->shrd->sta_lock);
623 spin_lock(&priv->shrd->lock); 623 spin_lock(&priv->shrd->lock);
624 624
625 /* 625 /*
@@ -647,7 +647,7 @@ int iwlagn_txq_check_empty(struct iwl_priv *priv,
647 647
648 ctx = &priv->contexts[priv->stations[sta_id].ctxid]; 648 ctx = &priv->contexts[priv->stations[sta_id].ctxid];
649 649
650 lockdep_assert_held(&priv->sta_lock); 650 lockdep_assert_held(&priv->shrd->sta_lock);
651 651
652 switch (priv->stations[sta_id].tid[tid].agg.state) { 652 switch (priv->stations[sta_id].tid[tid].agg.state) {
653 case IWL_EMPTYING_HW_QUEUE_DELBA: 653 case IWL_EMPTYING_HW_QUEUE_DELBA:
@@ -890,7 +890,7 @@ void iwlagn_rx_reply_compressed_ba(struct iwl_priv *priv,
890 /* Find index just before block-ack window */ 890 /* Find index just before block-ack window */
891 index = iwl_queue_dec_wrap(ba_resp_scd_ssn & 0xff, txq->q.n_bd); 891 index = iwl_queue_dec_wrap(ba_resp_scd_ssn & 0xff, txq->q.n_bd);
892 892
893 spin_lock_irqsave(&priv->sta_lock, flags); 893 spin_lock_irqsave(&priv->shrd->sta_lock, flags);
894 894
895 IWL_DEBUG_TX_REPLY(priv, "REPLY_COMPRESSED_BA [%d] Received from %pM, " 895 IWL_DEBUG_TX_REPLY(priv, "REPLY_COMPRESSED_BA [%d] Received from %pM, "
896 "sta_id = %d\n", 896 "sta_id = %d\n",
@@ -927,7 +927,7 @@ void iwlagn_rx_reply_compressed_ba(struct iwl_priv *priv,
927 iwlagn_txq_check_empty(priv, sta_id, tid, scd_flow); 927 iwlagn_txq_check_empty(priv, sta_id, tid, scd_flow);
928 } 928 }
929 929
930 spin_unlock_irqrestore(&priv->sta_lock, flags); 930 spin_unlock_irqrestore(&priv->shrd->sta_lock, flags);
931} 931}
932 932
933#ifdef CONFIG_IWLWIFI_DEBUG 933#ifdef CONFIG_IWLWIFI_DEBUG
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c
index ef60120d9bb9..cab3f63f4e4e 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn.c
@@ -3416,7 +3416,7 @@ static int iwl_init_drv(struct iwl_priv *priv)
3416{ 3416{
3417 int ret; 3417 int ret;
3418 3418
3419 spin_lock_init(&priv->sta_lock); 3419 spin_lock_init(&priv->shrd->sta_lock);
3420 spin_lock_init(&priv->hcmd_lock); 3420 spin_lock_init(&priv->hcmd_lock);
3421 3421
3422 mutex_init(&priv->shrd->mutex); 3422 mutex_init(&priv->shrd->mutex);
diff --git a/drivers/net/wireless/iwlwifi/iwl-dev.h b/drivers/net/wireless/iwlwifi/iwl-dev.h
index 8ba2d94419e5..fa92975b6a89 100644
--- a/drivers/net/wireless/iwlwifi/iwl-dev.h
+++ b/drivers/net/wireless/iwlwifi/iwl-dev.h
@@ -1307,9 +1307,6 @@ struct iwl_priv {
1307 struct iwl_tt_mgmt thermal_throttle; 1307 struct iwl_tt_mgmt thermal_throttle;
1308 1308
1309 /* station table variables */ 1309 /* station table variables */
1310
1311 /* Note: if lock and sta_lock are needed, lock must be acquired first */
1312 spinlock_t sta_lock;
1313 int num_stations; 1310 int num_stations;
1314 struct iwl_station_entry stations[IWLAGN_STATION_COUNT]; 1311 struct iwl_station_entry stations[IWLAGN_STATION_COUNT];
1315 unsigned long ucode_key_table; 1312 unsigned long ucode_key_table;
diff --git a/drivers/net/wireless/iwlwifi/iwl-shared.h b/drivers/net/wireless/iwlwifi/iwl-shared.h
index 33953199ffc6..71496bf05104 100644
--- a/drivers/net/wireless/iwlwifi/iwl-shared.h
+++ b/drivers/net/wireless/iwlwifi/iwl-shared.h
@@ -150,6 +150,8 @@ struct iwl_hw_params {
150 * @hw_params: see struct iwl_hw_params 150 * @hw_params: see struct iwl_hw_params
151 * @workqueue: the workqueue used by all the layers of the driver 151 * @workqueue: the workqueue used by all the layers of the driver
152 * @lock: protect general shared data 152 * @lock: protect general shared data
153 * @sta_lock: protects the station table.
154 * If lock and sta_lock are needed, lock must be acquired first.
153 * @mutex: 155 * @mutex:
154 */ 156 */
155struct iwl_shared { 157struct iwl_shared {
@@ -166,6 +168,7 @@ struct iwl_shared {
166 168
167 struct workqueue_struct *workqueue; 169 struct workqueue_struct *workqueue;
168 spinlock_t lock; 170 spinlock_t lock;
171 spinlock_t sta_lock;
169 struct mutex mutex; 172 struct mutex mutex;
170}; 173};
171 174
diff --git a/drivers/net/wireless/iwlwifi/iwl-sta.c b/drivers/net/wireless/iwlwifi/iwl-sta.c
index 63b434b0948b..9424d79b9d65 100644
--- a/drivers/net/wireless/iwlwifi/iwl-sta.c
+++ b/drivers/net/wireless/iwlwifi/iwl-sta.c
@@ -38,7 +38,7 @@
38#include "iwl-trans.h" 38#include "iwl-trans.h"
39#include "iwl-agn.h" 39#include "iwl-agn.h"
40 40
41/* priv->sta_lock must be held */ 41/* priv->shrd->sta_lock must be held */
42static void iwl_sta_ucode_activate(struct iwl_priv *priv, u8 sta_id) 42static void iwl_sta_ucode_activate(struct iwl_priv *priv, u8 sta_id)
43{ 43{
44 44
@@ -75,7 +75,7 @@ static int iwl_process_add_sta_resp(struct iwl_priv *priv,
75 IWL_DEBUG_INFO(priv, "Processing response for adding station %u\n", 75 IWL_DEBUG_INFO(priv, "Processing response for adding station %u\n",
76 sta_id); 76 sta_id);
77 77
78 spin_lock_irqsave(&priv->sta_lock, flags); 78 spin_lock_irqsave(&priv->shrd->sta_lock, flags);
79 79
80 switch (pkt->u.add_sta.status) { 80 switch (pkt->u.add_sta.status) {
81 case ADD_STA_SUCCESS_MSK: 81 case ADD_STA_SUCCESS_MSK:
@@ -118,7 +118,7 @@ static int iwl_process_add_sta_resp(struct iwl_priv *priv,
118 priv->stations[sta_id].sta.mode == 118 priv->stations[sta_id].sta.mode ==
119 STA_CONTROL_MODIFY_MSK ? "Modified" : "Added", 119 STA_CONTROL_MODIFY_MSK ? "Modified" : "Added",
120 addsta->sta.addr); 120 addsta->sta.addr);
121 spin_unlock_irqrestore(&priv->sta_lock, flags); 121 spin_unlock_irqrestore(&priv->shrd->sta_lock, flags);
122 122
123 return ret; 123 return ret;
124} 124}
@@ -337,12 +337,12 @@ int iwl_add_station_common(struct iwl_priv *priv, struct iwl_rxon_context *ctx,
337 struct iwl_addsta_cmd sta_cmd; 337 struct iwl_addsta_cmd sta_cmd;
338 338
339 *sta_id_r = 0; 339 *sta_id_r = 0;
340 spin_lock_irqsave(&priv->sta_lock, flags_spin); 340 spin_lock_irqsave(&priv->shrd->sta_lock, flags_spin);
341 sta_id = iwl_prep_station(priv, ctx, addr, is_ap, sta); 341 sta_id = iwl_prep_station(priv, ctx, addr, is_ap, sta);
342 if (sta_id == IWL_INVALID_STATION) { 342 if (sta_id == IWL_INVALID_STATION) {
343 IWL_ERR(priv, "Unable to prepare station %pM for addition\n", 343 IWL_ERR(priv, "Unable to prepare station %pM for addition\n",
344 addr); 344 addr);
345 spin_unlock_irqrestore(&priv->sta_lock, flags_spin); 345 spin_unlock_irqrestore(&priv->shrd->sta_lock, flags_spin);
346 return -EINVAL; 346 return -EINVAL;
347 } 347 }
348 348
@@ -354,7 +354,7 @@ int iwl_add_station_common(struct iwl_priv *priv, struct iwl_rxon_context *ctx,
354 if (priv->stations[sta_id].used & IWL_STA_UCODE_INPROGRESS) { 354 if (priv->stations[sta_id].used & IWL_STA_UCODE_INPROGRESS) {
355 IWL_DEBUG_INFO(priv, "STA %d already in process of being added.\n", 355 IWL_DEBUG_INFO(priv, "STA %d already in process of being added.\n",
356 sta_id); 356 sta_id);
357 spin_unlock_irqrestore(&priv->sta_lock, flags_spin); 357 spin_unlock_irqrestore(&priv->shrd->sta_lock, flags_spin);
358 return -EEXIST; 358 return -EEXIST;
359 } 359 }
360 360
@@ -362,23 +362,23 @@ int iwl_add_station_common(struct iwl_priv *priv, struct iwl_rxon_context *ctx,
362 (priv->stations[sta_id].used & IWL_STA_UCODE_ACTIVE)) { 362 (priv->stations[sta_id].used & IWL_STA_UCODE_ACTIVE)) {
363 IWL_DEBUG_ASSOC(priv, "STA %d (%pM) already added, not adding again.\n", 363 IWL_DEBUG_ASSOC(priv, "STA %d (%pM) already added, not adding again.\n",
364 sta_id, addr); 364 sta_id, addr);
365 spin_unlock_irqrestore(&priv->sta_lock, flags_spin); 365 spin_unlock_irqrestore(&priv->shrd->sta_lock, flags_spin);
366 return -EEXIST; 366 return -EEXIST;
367 } 367 }
368 368
369 priv->stations[sta_id].used |= IWL_STA_UCODE_INPROGRESS; 369 priv->stations[sta_id].used |= IWL_STA_UCODE_INPROGRESS;
370 memcpy(&sta_cmd, &priv->stations[sta_id].sta, sizeof(struct iwl_addsta_cmd)); 370 memcpy(&sta_cmd, &priv->stations[sta_id].sta, sizeof(struct iwl_addsta_cmd));
371 spin_unlock_irqrestore(&priv->sta_lock, flags_spin); 371 spin_unlock_irqrestore(&priv->shrd->sta_lock, flags_spin);
372 372
373 /* Add station to device's station table */ 373 /* Add station to device's station table */
374 ret = iwl_send_add_sta(priv, &sta_cmd, CMD_SYNC); 374 ret = iwl_send_add_sta(priv, &sta_cmd, CMD_SYNC);
375 if (ret) { 375 if (ret) {
376 spin_lock_irqsave(&priv->sta_lock, flags_spin); 376 spin_lock_irqsave(&priv->shrd->sta_lock, flags_spin);
377 IWL_ERR(priv, "Adding station %pM failed.\n", 377 IWL_ERR(priv, "Adding station %pM failed.\n",
378 priv->stations[sta_id].sta.sta.addr); 378 priv->stations[sta_id].sta.sta.addr);
379 priv->stations[sta_id].used &= ~IWL_STA_DRIVER_ACTIVE; 379 priv->stations[sta_id].used &= ~IWL_STA_DRIVER_ACTIVE;
380 priv->stations[sta_id].used &= ~IWL_STA_UCODE_INPROGRESS; 380 priv->stations[sta_id].used &= ~IWL_STA_UCODE_INPROGRESS;
381 spin_unlock_irqrestore(&priv->sta_lock, flags_spin); 381 spin_unlock_irqrestore(&priv->shrd->sta_lock, flags_spin);
382 } 382 }
383 *sta_id_r = sta_id; 383 *sta_id_r = sta_id;
384 return ret; 384 return ret;
@@ -387,7 +387,7 @@ int iwl_add_station_common(struct iwl_priv *priv, struct iwl_rxon_context *ctx,
387/** 387/**
388 * iwl_sta_ucode_deactivate - deactivate ucode status for a station 388 * iwl_sta_ucode_deactivate - deactivate ucode status for a station
389 * 389 *
390 * priv->sta_lock must be held 390 * priv->shrd->sta_lock must be held
391 */ 391 */
392static void iwl_sta_ucode_deactivate(struct iwl_priv *priv, u8 sta_id) 392static void iwl_sta_ucode_deactivate(struct iwl_priv *priv, u8 sta_id)
393{ 393{
@@ -441,9 +441,11 @@ static int iwl_send_remove_station(struct iwl_priv *priv,
441 switch (pkt->u.rem_sta.status) { 441 switch (pkt->u.rem_sta.status) {
442 case REM_STA_SUCCESS_MSK: 442 case REM_STA_SUCCESS_MSK:
443 if (!temporary) { 443 if (!temporary) {
444 spin_lock_irqsave(&priv->sta_lock, flags_spin); 444 spin_lock_irqsave(&priv->shrd->sta_lock,
445 flags_spin);
445 iwl_sta_ucode_deactivate(priv, sta_id); 446 iwl_sta_ucode_deactivate(priv, sta_id);
446 spin_unlock_irqrestore(&priv->sta_lock, flags_spin); 447 spin_unlock_irqrestore(&priv->shrd->sta_lock,
448 flags_spin);
447 } 449 }
448 IWL_DEBUG_ASSOC(priv, "REPLY_REMOVE_STA PASSED\n"); 450 IWL_DEBUG_ASSOC(priv, "REPLY_REMOVE_STA PASSED\n");
449 break; 451 break;
@@ -484,7 +486,7 @@ int iwl_remove_station(struct iwl_priv *priv, const u8 sta_id,
484 if (WARN_ON(sta_id == IWL_INVALID_STATION)) 486 if (WARN_ON(sta_id == IWL_INVALID_STATION))
485 return -EINVAL; 487 return -EINVAL;
486 488
487 spin_lock_irqsave(&priv->sta_lock, flags); 489 spin_lock_irqsave(&priv->shrd->sta_lock, flags);
488 490
489 if (!(priv->stations[sta_id].used & IWL_STA_DRIVER_ACTIVE)) { 491 if (!(priv->stations[sta_id].used & IWL_STA_DRIVER_ACTIVE)) {
490 IWL_DEBUG_INFO(priv, "Removing %pM but non DRIVER active\n", 492 IWL_DEBUG_INFO(priv, "Removing %pM but non DRIVER active\n",
@@ -510,11 +512,11 @@ int iwl_remove_station(struct iwl_priv *priv, const u8 sta_id,
510 if (WARN_ON(priv->num_stations < 0)) 512 if (WARN_ON(priv->num_stations < 0))
511 priv->num_stations = 0; 513 priv->num_stations = 0;
512 514
513 spin_unlock_irqrestore(&priv->sta_lock, flags); 515 spin_unlock_irqrestore(&priv->shrd->sta_lock, flags);
514 516
515 return iwl_send_remove_station(priv, addr, sta_id, false); 517 return iwl_send_remove_station(priv, addr, sta_id, false);
516out_err: 518out_err:
517 spin_unlock_irqrestore(&priv->sta_lock, flags); 519 spin_unlock_irqrestore(&priv->shrd->sta_lock, flags);
518 return -EINVAL; 520 return -EINVAL;
519} 521}
520 522
@@ -535,7 +537,7 @@ void iwl_clear_ucode_stations(struct iwl_priv *priv,
535 537
536 IWL_DEBUG_INFO(priv, "Clearing ucode stations in driver\n"); 538 IWL_DEBUG_INFO(priv, "Clearing ucode stations in driver\n");
537 539
538 spin_lock_irqsave(&priv->sta_lock, flags_spin); 540 spin_lock_irqsave(&priv->shrd->sta_lock, flags_spin);
539 for (i = 0; i < hw_params(priv).max_stations; i++) { 541 for (i = 0; i < hw_params(priv).max_stations; i++) {
540 if (ctx && ctx->ctxid != priv->stations[i].ctxid) 542 if (ctx && ctx->ctxid != priv->stations[i].ctxid)
541 continue; 543 continue;
@@ -546,7 +548,7 @@ void iwl_clear_ucode_stations(struct iwl_priv *priv,
546 cleared = true; 548 cleared = true;
547 } 549 }
548 } 550 }
549 spin_unlock_irqrestore(&priv->sta_lock, flags_spin); 551 spin_unlock_irqrestore(&priv->shrd->sta_lock, flags_spin);
550 552
551 if (!cleared) 553 if (!cleared)
552 IWL_DEBUG_INFO(priv, "No active stations found to be cleared\n"); 554 IWL_DEBUG_INFO(priv, "No active stations found to be cleared\n");
@@ -576,7 +578,7 @@ void iwl_restore_stations(struct iwl_priv *priv, struct iwl_rxon_context *ctx)
576 } 578 }
577 579
578 IWL_DEBUG_ASSOC(priv, "Restoring all known stations ... start.\n"); 580 IWL_DEBUG_ASSOC(priv, "Restoring all known stations ... start.\n");
579 spin_lock_irqsave(&priv->sta_lock, flags_spin); 581 spin_lock_irqsave(&priv->shrd->sta_lock, flags_spin);
580 for (i = 0; i < hw_params(priv).max_stations; i++) { 582 for (i = 0; i < hw_params(priv).max_stations; i++) {
581 if (ctx->ctxid != priv->stations[i].ctxid) 583 if (ctx->ctxid != priv->stations[i].ctxid)
582 continue; 584 continue;
@@ -600,15 +602,18 @@ void iwl_restore_stations(struct iwl_priv *priv, struct iwl_rxon_context *ctx)
600 sizeof(struct iwl_link_quality_cmd)); 602 sizeof(struct iwl_link_quality_cmd));
601 send_lq = true; 603 send_lq = true;
602 } 604 }
603 spin_unlock_irqrestore(&priv->sta_lock, flags_spin); 605 spin_unlock_irqrestore(&priv->shrd->sta_lock,
606 flags_spin);
604 ret = iwl_send_add_sta(priv, &sta_cmd, CMD_SYNC); 607 ret = iwl_send_add_sta(priv, &sta_cmd, CMD_SYNC);
605 if (ret) { 608 if (ret) {
606 spin_lock_irqsave(&priv->sta_lock, flags_spin); 609 spin_lock_irqsave(&priv->shrd->sta_lock,
610 flags_spin);
607 IWL_ERR(priv, "Adding station %pM failed.\n", 611 IWL_ERR(priv, "Adding station %pM failed.\n",
608 priv->stations[i].sta.sta.addr); 612 priv->stations[i].sta.sta.addr);
609 priv->stations[i].used &= ~IWL_STA_DRIVER_ACTIVE; 613 priv->stations[i].used &= ~IWL_STA_DRIVER_ACTIVE;
610 priv->stations[i].used &= ~IWL_STA_UCODE_INPROGRESS; 614 priv->stations[i].used &= ~IWL_STA_UCODE_INPROGRESS;
611 spin_unlock_irqrestore(&priv->sta_lock, flags_spin); 615 spin_unlock_irqrestore(&priv->shrd->sta_lock,
616 flags_spin);
612 } 617 }
613 /* 618 /*
614 * Rate scaling has already been initialized, send 619 * Rate scaling has already been initialized, send
@@ -616,12 +621,12 @@ void iwl_restore_stations(struct iwl_priv *priv, struct iwl_rxon_context *ctx)
616 */ 621 */
617 if (send_lq) 622 if (send_lq)
618 iwl_send_lq_cmd(priv, ctx, &lq, CMD_SYNC, true); 623 iwl_send_lq_cmd(priv, ctx, &lq, CMD_SYNC, true);
619 spin_lock_irqsave(&priv->sta_lock, flags_spin); 624 spin_lock_irqsave(&priv->shrd->sta_lock, flags_spin);
620 priv->stations[i].used &= ~IWL_STA_UCODE_INPROGRESS; 625 priv->stations[i].used &= ~IWL_STA_UCODE_INPROGRESS;
621 } 626 }
622 } 627 }
623 628
624 spin_unlock_irqrestore(&priv->sta_lock, flags_spin); 629 spin_unlock_irqrestore(&priv->shrd->sta_lock, flags_spin);
625 if (!found) 630 if (!found)
626 IWL_DEBUG_INFO(priv, "Restoring all known stations .... no stations to be restored.\n"); 631 IWL_DEBUG_INFO(priv, "Restoring all known stations .... no stations to be restored.\n");
627 else 632 else
@@ -637,9 +642,9 @@ void iwl_reprogram_ap_sta(struct iwl_priv *priv, struct iwl_rxon_context *ctx)
637 struct iwl_link_quality_cmd lq; 642 struct iwl_link_quality_cmd lq;
638 bool active; 643 bool active;
639 644
640 spin_lock_irqsave(&priv->sta_lock, flags); 645 spin_lock_irqsave(&priv->shrd->sta_lock, flags);
641 if (!(priv->stations[sta_id].used & IWL_STA_DRIVER_ACTIVE)) { 646 if (!(priv->stations[sta_id].used & IWL_STA_DRIVER_ACTIVE)) {
642 spin_unlock_irqrestore(&priv->sta_lock, flags); 647 spin_unlock_irqrestore(&priv->shrd->sta_lock, flags);
643 return; 648 return;
644 } 649 }
645 650
@@ -649,7 +654,7 @@ void iwl_reprogram_ap_sta(struct iwl_priv *priv, struct iwl_rxon_context *ctx)
649 654
650 active = priv->stations[sta_id].used & IWL_STA_UCODE_ACTIVE; 655 active = priv->stations[sta_id].used & IWL_STA_UCODE_ACTIVE;
651 priv->stations[sta_id].used &= ~IWL_STA_DRIVER_ACTIVE; 656 priv->stations[sta_id].used &= ~IWL_STA_DRIVER_ACTIVE;
652 spin_unlock_irqrestore(&priv->sta_lock, flags); 657 spin_unlock_irqrestore(&priv->shrd->sta_lock, flags);
653 658
654 if (active) { 659 if (active) {
655 ret = iwl_send_remove_station( 660 ret = iwl_send_remove_station(
@@ -659,9 +664,9 @@ void iwl_reprogram_ap_sta(struct iwl_priv *priv, struct iwl_rxon_context *ctx)
659 IWL_ERR(priv, "failed to remove STA %pM (%d)\n", 664 IWL_ERR(priv, "failed to remove STA %pM (%d)\n",
660 priv->stations[sta_id].sta.sta.addr, ret); 665 priv->stations[sta_id].sta.sta.addr, ret);
661 } 666 }
662 spin_lock_irqsave(&priv->sta_lock, flags); 667 spin_lock_irqsave(&priv->shrd->sta_lock, flags);
663 priv->stations[sta_id].used |= IWL_STA_DRIVER_ACTIVE; 668 priv->stations[sta_id].used |= IWL_STA_DRIVER_ACTIVE;
664 spin_unlock_irqrestore(&priv->sta_lock, flags); 669 spin_unlock_irqrestore(&priv->shrd->sta_lock, flags);
665 670
666 ret = iwl_send_add_sta(priv, &sta_cmd, CMD_SYNC); 671 ret = iwl_send_add_sta(priv, &sta_cmd, CMD_SYNC);
667 if (ret) 672 if (ret)
@@ -686,7 +691,7 @@ void iwl_dealloc_bcast_stations(struct iwl_priv *priv)
686 unsigned long flags; 691 unsigned long flags;
687 int i; 692 int i;
688 693
689 spin_lock_irqsave(&priv->sta_lock, flags); 694 spin_lock_irqsave(&priv->shrd->sta_lock, flags);
690 for (i = 0; i < hw_params(priv).max_stations; i++) { 695 for (i = 0; i < hw_params(priv).max_stations; i++) {
691 if (!(priv->stations[i].used & IWL_STA_BCAST)) 696 if (!(priv->stations[i].used & IWL_STA_BCAST))
692 continue; 697 continue;
@@ -698,7 +703,7 @@ void iwl_dealloc_bcast_stations(struct iwl_priv *priv)
698 kfree(priv->stations[i].lq); 703 kfree(priv->stations[i].lq);
699 priv->stations[i].lq = NULL; 704 priv->stations[i].lq = NULL;
700 } 705 }
701 spin_unlock_irqrestore(&priv->sta_lock, flags); 706 spin_unlock_irqrestore(&priv->shrd->sta_lock, flags);
702} 707}
703 708
704#ifdef CONFIG_IWLWIFI_DEBUG 709#ifdef CONFIG_IWLWIFI_DEBUG
@@ -782,12 +787,12 @@ int iwl_send_lq_cmd(struct iwl_priv *priv, struct iwl_rxon_context *ctx,
782 return -EINVAL; 787 return -EINVAL;
783 788
784 789
785 spin_lock_irqsave(&priv->sta_lock, flags_spin); 790 spin_lock_irqsave(&priv->shrd->sta_lock, flags_spin);
786 if (!(priv->stations[lq->sta_id].used & IWL_STA_DRIVER_ACTIVE)) { 791 if (!(priv->stations[lq->sta_id].used & IWL_STA_DRIVER_ACTIVE)) {
787 spin_unlock_irqrestore(&priv->sta_lock, flags_spin); 792 spin_unlock_irqrestore(&priv->shrd->sta_lock, flags_spin);
788 return -EINVAL; 793 return -EINVAL;
789 } 794 }
790 spin_unlock_irqrestore(&priv->sta_lock, flags_spin); 795 spin_unlock_irqrestore(&priv->shrd->sta_lock, flags_spin);
791 796
792 iwl_dump_lq_cmd(priv, lq); 797 iwl_dump_lq_cmd(priv, lq);
793 if (WARN_ON(init && (cmd.flags & CMD_ASYNC))) 798 if (WARN_ON(init && (cmd.flags & CMD_ASYNC)))
@@ -804,9 +809,9 @@ int iwl_send_lq_cmd(struct iwl_priv *priv, struct iwl_rxon_context *ctx,
804 if (init) { 809 if (init) {
805 IWL_DEBUG_INFO(priv, "init LQ command complete, clearing sta addition status for sta %d\n", 810 IWL_DEBUG_INFO(priv, "init LQ command complete, clearing sta addition status for sta %d\n",
806 lq->sta_id); 811 lq->sta_id);
807 spin_lock_irqsave(&priv->sta_lock, flags_spin); 812 spin_lock_irqsave(&priv->shrd->sta_lock, flags_spin);
808 priv->stations[lq->sta_id].used &= ~IWL_STA_UCODE_INPROGRESS; 813 priv->stations[lq->sta_id].used &= ~IWL_STA_UCODE_INPROGRESS;
809 spin_unlock_irqrestore(&priv->sta_lock, flags_spin); 814 spin_unlock_irqrestore(&priv->shrd->sta_lock, flags_spin);
810 } 815 }
811 return ret; 816 return ret;
812} 817}
diff --git a/drivers/net/wireless/iwlwifi/iwl-sta.h b/drivers/net/wireless/iwlwifi/iwl-sta.h
index 9a6768d66851..9641eb6b1d0a 100644
--- a/drivers/net/wireless/iwlwifi/iwl-sta.h
+++ b/drivers/net/wireless/iwlwifi/iwl-sta.h
@@ -76,7 +76,7 @@ static inline void iwl_clear_driver_stations(struct iwl_priv *priv)
76 unsigned long flags; 76 unsigned long flags;
77 struct iwl_rxon_context *ctx; 77 struct iwl_rxon_context *ctx;
78 78
79 spin_lock_irqsave(&priv->sta_lock, flags); 79 spin_lock_irqsave(&priv->shrd->sta_lock, flags);
80 memset(priv->stations, 0, sizeof(priv->stations)); 80 memset(priv->stations, 0, sizeof(priv->stations));
81 priv->num_stations = 0; 81 priv->num_stations = 0;
82 82
@@ -94,7 +94,7 @@ static inline void iwl_clear_driver_stations(struct iwl_priv *priv)
94 ctx->key_mapping_keys = 0; 94 ctx->key_mapping_keys = 0;
95 } 95 }
96 96
97 spin_unlock_irqrestore(&priv->sta_lock, flags); 97 spin_unlock_irqrestore(&priv->shrd->sta_lock, flags);
98} 98}
99 99
100static inline int iwl_sta_id(struct ieee80211_sta *sta) 100static inline int iwl_sta_id(struct ieee80211_sta *sta)
diff --git a/drivers/net/wireless/iwlwifi/iwl-trans-tx-pcie.c b/drivers/net/wireless/iwlwifi/iwl-trans-tx-pcie.c
index e1130a745ab6..b0ad127715f6 100644
--- a/drivers/net/wireless/iwlwifi/iwl-trans-tx-pcie.c
+++ b/drivers/net/wireless/iwlwifi/iwl-trans-tx-pcie.c
@@ -435,12 +435,12 @@ void iwl_trans_txq_agg_setup(struct iwl_priv *priv, int sta_id, int tid,
435 if (WARN_ON(tid >= MAX_TID_COUNT)) 435 if (WARN_ON(tid >= MAX_TID_COUNT))
436 return; 436 return;
437 437
438 spin_lock_irqsave(&priv->sta_lock, flags); 438 spin_lock_irqsave(&priv->shrd->sta_lock, flags);
439 tid_data = &priv->stations[sta_id].tid[tid]; 439 tid_data = &priv->stations[sta_id].tid[tid];
440 ssn_idx = SEQ_TO_SN(tid_data->seq_number); 440 ssn_idx = SEQ_TO_SN(tid_data->seq_number);
441 txq_id = tid_data->agg.txq_id; 441 txq_id = tid_data->agg.txq_id;
442 tx_fifo = tid_data->agg.tx_fifo; 442 tx_fifo = tid_data->agg.tx_fifo;
443 spin_unlock_irqrestore(&priv->sta_lock, flags); 443 spin_unlock_irqrestore(&priv->shrd->sta_lock, flags);
444 444
445 ra_tid = BUILD_RAxTID(sta_id, tid); 445 ra_tid = BUILD_RAxTID(sta_id, tid);
446 446