aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/iwl-sta.c
diff options
context:
space:
mode:
authorEmmanuel Grumbach <emmanuel.grumbach@intel.com>2011-08-26 02:10:47 -0400
committerJohn W. Linville <linville@tuxdriver.com>2011-08-29 15:25:32 -0400
commitf39c95e8d7a152b409977687a999356f0e54bde6 (patch)
treec4863cd9a6449d7e61034ebf12b8417d40011fc4 /drivers/net/wireless/iwlwifi/iwl-sta.c
parent9ca06f0a3fbf57c672c7f2cdfc85747a0bbfaf28 (diff)
iwlagn: priv->sta_lock moves to iwl_shared
Since it is used by all the layers, it needs to move to iwl_shared. Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com> Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-sta.c')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-sta.c77
1 files changed, 41 insertions, 36 deletions
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}