Lines Matching refs:priv

37 static int iwl_sta_ucode_activate(struct iwl_priv *priv, u8 sta_id)  in iwl_sta_ucode_activate()  argument
39 lockdep_assert_held(&priv->sta_lock); in iwl_sta_ucode_activate()
42 IWL_ERR(priv, "invalid sta_id %u\n", sta_id); in iwl_sta_ucode_activate()
45 if (!(priv->stations[sta_id].used & IWL_STA_DRIVER_ACTIVE)) in iwl_sta_ucode_activate()
46 IWL_ERR(priv, "ACTIVATE a non DRIVER active station id %u " in iwl_sta_ucode_activate()
48 sta_id, priv->stations[sta_id].sta.sta.addr); in iwl_sta_ucode_activate()
50 if (priv->stations[sta_id].used & IWL_STA_UCODE_ACTIVE) { in iwl_sta_ucode_activate()
51 IWL_DEBUG_ASSOC(priv, in iwl_sta_ucode_activate()
54 sta_id, priv->stations[sta_id].sta.sta.addr); in iwl_sta_ucode_activate()
56 priv->stations[sta_id].used |= IWL_STA_UCODE_ACTIVE; in iwl_sta_ucode_activate()
57 IWL_DEBUG_ASSOC(priv, "Added STA id %u addr %pM to uCode\n", in iwl_sta_ucode_activate()
58 sta_id, priv->stations[sta_id].sta.sta.addr); in iwl_sta_ucode_activate()
63 static int iwl_process_add_sta_resp(struct iwl_priv *priv, in iwl_process_add_sta_resp() argument
72 IWL_ERR(priv, "Bad return from REPLY_ADD_STA (0x%08X)\n", in iwl_process_add_sta_resp()
77 IWL_DEBUG_INFO(priv, "Processing response for adding station %u\n", in iwl_process_add_sta_resp()
80 spin_lock_bh(&priv->sta_lock); in iwl_process_add_sta_resp()
84 IWL_DEBUG_INFO(priv, "REPLY_ADD_STA PASSED\n"); in iwl_process_add_sta_resp()
85 ret = iwl_sta_ucode_activate(priv, sta_id); in iwl_process_add_sta_resp()
88 IWL_ERR(priv, "Adding station %d failed, no room in table.\n", in iwl_process_add_sta_resp()
92 IWL_ERR(priv, "Adding station %d failed, no block ack " in iwl_process_add_sta_resp()
96 IWL_ERR(priv, "Attempting to modify non-existing station %d\n", in iwl_process_add_sta_resp()
100 IWL_DEBUG_ASSOC(priv, "Received REPLY_ADD_STA:(0x%08X)\n", in iwl_process_add_sta_resp()
105 IWL_DEBUG_INFO(priv, "%s station id %u addr %pM\n", in iwl_process_add_sta_resp()
106 priv->stations[sta_id].sta.mode == in iwl_process_add_sta_resp()
108 sta_id, priv->stations[sta_id].sta.sta.addr); in iwl_process_add_sta_resp()
118 IWL_DEBUG_INFO(priv, "%s station according to cmd buffer %pM\n", in iwl_process_add_sta_resp()
119 priv->stations[sta_id].sta.mode == in iwl_process_add_sta_resp()
122 spin_unlock_bh(&priv->sta_lock); in iwl_process_add_sta_resp()
127 int iwl_add_sta_callback(struct iwl_priv *priv, struct iwl_rx_cmd_buffer *rxb, in iwl_add_sta_callback() argument
135 return iwl_process_add_sta_resp(priv, (void *)cmd->payload, pkt); in iwl_add_sta_callback()
138 int iwl_send_add_sta(struct iwl_priv *priv, in iwl_send_add_sta() argument
150 IWL_DEBUG_INFO(priv, "Adding sta %u (%pM) %ssynchronously\n", in iwl_send_add_sta()
158 ret = iwl_dvm_send_cmd(priv, &cmd); in iwl_send_add_sta()
168 IWL_ERR(priv, "%s - error in the CMD response %d\n", __func__, in iwl_send_add_sta()
174 bool iwl_is_ht40_tx_allowed(struct iwl_priv *priv, in iwl_is_ht40_tx_allowed() argument
182 if (priv->disable_ht40) in iwl_is_ht40_tx_allowed()
193 static void iwl_sta_calc_ht_flags(struct iwl_priv *priv, in iwl_sta_calc_ht_flags() argument
210 IWL_DEBUG_INFO(priv, "STA %pM SM PS mode: %s\n", in iwl_sta_calc_ht_flags()
227 IWL_WARN(priv, "Invalid MIMO PS mode %d\n", sta->smps_mode); in iwl_sta_calc_ht_flags()
237 if (iwl_is_ht40_tx_allowed(priv, ctx, sta)) in iwl_sta_calc_ht_flags()
241 int iwl_sta_update_ht(struct iwl_priv *priv, struct iwl_rxon_context *ctx, in iwl_sta_update_ht() argument
251 iwl_sta_calc_ht_flags(priv, sta, ctx, &flags, &mask); in iwl_sta_update_ht()
253 spin_lock_bh(&priv->sta_lock); in iwl_sta_update_ht()
254 priv->stations[sta_id].sta.station_flags &= ~mask; in iwl_sta_update_ht()
255 priv->stations[sta_id].sta.station_flags |= flags; in iwl_sta_update_ht()
256 spin_unlock_bh(&priv->sta_lock); in iwl_sta_update_ht()
264 return iwl_send_add_sta(priv, &cmd, 0); in iwl_sta_update_ht()
267 static void iwl_set_ht_add_station(struct iwl_priv *priv, u8 index, in iwl_set_ht_add_station() argument
273 iwl_sta_calc_ht_flags(priv, sta, ctx, &flags, &mask); in iwl_set_ht_add_station()
275 lockdep_assert_held(&priv->sta_lock); in iwl_set_ht_add_station()
276 priv->stations[index].sta.station_flags &= ~mask; in iwl_set_ht_add_station()
277 priv->stations[index].sta.station_flags |= flags; in iwl_set_ht_add_station()
285 u8 iwl_prep_station(struct iwl_priv *priv, struct iwl_rxon_context *ctx, in iwl_prep_station() argument
298 if (ether_addr_equal(priv->stations[i].sta.sta.addr, in iwl_prep_station()
304 if (!priv->stations[i].used && in iwl_prep_station()
321 if (priv->stations[sta_id].used & IWL_STA_UCODE_INPROGRESS) { in iwl_prep_station()
322 IWL_DEBUG_INFO(priv, "STA %d already in process of being " in iwl_prep_station()
327 if ((priv->stations[sta_id].used & IWL_STA_DRIVER_ACTIVE) && in iwl_prep_station()
328 (priv->stations[sta_id].used & IWL_STA_UCODE_ACTIVE) && in iwl_prep_station()
329 ether_addr_equal(priv->stations[sta_id].sta.sta.addr, addr)) { in iwl_prep_station()
330 IWL_DEBUG_ASSOC(priv, "STA %d (%pM) already added, not " in iwl_prep_station()
335 station = &priv->stations[sta_id]; in iwl_prep_station()
337 IWL_DEBUG_ASSOC(priv, "Add STA to driver ID %d: %pM\n", in iwl_prep_station()
339 priv->num_stations++; in iwl_prep_station()
361 iwl_set_ht_add_station(priv, sta_id, sta, ctx); in iwl_prep_station()
372 int iwl_add_station_common(struct iwl_priv *priv, struct iwl_rxon_context *ctx, in iwl_add_station_common() argument
381 spin_lock_bh(&priv->sta_lock); in iwl_add_station_common()
382 sta_id = iwl_prep_station(priv, ctx, addr, is_ap, sta); in iwl_add_station_common()
384 IWL_ERR(priv, "Unable to prepare station %pM for addition\n", in iwl_add_station_common()
386 spin_unlock_bh(&priv->sta_lock); in iwl_add_station_common()
395 if (priv->stations[sta_id].used & IWL_STA_UCODE_INPROGRESS) { in iwl_add_station_common()
396 IWL_DEBUG_INFO(priv, "STA %d already in process of being " in iwl_add_station_common()
398 spin_unlock_bh(&priv->sta_lock); in iwl_add_station_common()
402 if ((priv->stations[sta_id].used & IWL_STA_DRIVER_ACTIVE) && in iwl_add_station_common()
403 (priv->stations[sta_id].used & IWL_STA_UCODE_ACTIVE)) { in iwl_add_station_common()
404 IWL_DEBUG_ASSOC(priv, "STA %d (%pM) already added, not " in iwl_add_station_common()
406 spin_unlock_bh(&priv->sta_lock); in iwl_add_station_common()
410 priv->stations[sta_id].used |= IWL_STA_UCODE_INPROGRESS; in iwl_add_station_common()
411 memcpy(&sta_cmd, &priv->stations[sta_id].sta, in iwl_add_station_common()
413 spin_unlock_bh(&priv->sta_lock); in iwl_add_station_common()
416 ret = iwl_send_add_sta(priv, &sta_cmd, 0); in iwl_add_station_common()
418 spin_lock_bh(&priv->sta_lock); in iwl_add_station_common()
419 IWL_ERR(priv, "Adding station %pM failed.\n", in iwl_add_station_common()
420 priv->stations[sta_id].sta.sta.addr); in iwl_add_station_common()
421 priv->stations[sta_id].used &= ~IWL_STA_DRIVER_ACTIVE; in iwl_add_station_common()
422 priv->stations[sta_id].used &= ~IWL_STA_UCODE_INPROGRESS; in iwl_add_station_common()
423 spin_unlock_bh(&priv->sta_lock); in iwl_add_station_common()
432 static void iwl_sta_ucode_deactivate(struct iwl_priv *priv, u8 sta_id) in iwl_sta_ucode_deactivate() argument
434 lockdep_assert_held(&priv->sta_lock); in iwl_sta_ucode_deactivate()
437 if ((priv->stations[sta_id].used & in iwl_sta_ucode_deactivate()
440 IWL_ERR(priv, "removed non active STA %u\n", sta_id); in iwl_sta_ucode_deactivate()
442 priv->stations[sta_id].used &= ~IWL_STA_UCODE_ACTIVE; in iwl_sta_ucode_deactivate()
444 memset(&priv->stations[sta_id], 0, sizeof(struct iwl_station_entry)); in iwl_sta_ucode_deactivate()
445 IWL_DEBUG_ASSOC(priv, "Removed STA %u\n", sta_id); in iwl_sta_ucode_deactivate()
448 static int iwl_send_remove_station(struct iwl_priv *priv, in iwl_send_remove_station() argument
468 ret = iwl_dvm_send_cmd(priv, &cmd); in iwl_send_remove_station()
475 IWL_ERR(priv, "Bad return from REPLY_REMOVE_STA (0x%08X)\n", in iwl_send_remove_station()
485 spin_lock_bh(&priv->sta_lock); in iwl_send_remove_station()
486 iwl_sta_ucode_deactivate(priv, sta_id); in iwl_send_remove_station()
487 spin_unlock_bh(&priv->sta_lock); in iwl_send_remove_station()
489 IWL_DEBUG_ASSOC(priv, "REPLY_REMOVE_STA PASSED\n"); in iwl_send_remove_station()
493 IWL_ERR(priv, "REPLY_REMOVE_STA failed\n"); in iwl_send_remove_station()
505 int iwl_remove_station(struct iwl_priv *priv, const u8 sta_id, in iwl_remove_station() argument
510 if (!iwl_is_ready(priv)) { in iwl_remove_station()
511 IWL_DEBUG_INFO(priv, in iwl_remove_station()
522 IWL_DEBUG_ASSOC(priv, "Removing STA from driver:%d %pM\n", in iwl_remove_station()
528 spin_lock_bh(&priv->sta_lock); in iwl_remove_station()
530 if (!(priv->stations[sta_id].used & IWL_STA_DRIVER_ACTIVE)) { in iwl_remove_station()
531 IWL_DEBUG_INFO(priv, "Removing %pM but non DRIVER active\n", in iwl_remove_station()
536 if (!(priv->stations[sta_id].used & IWL_STA_UCODE_ACTIVE)) { in iwl_remove_station()
537 IWL_DEBUG_INFO(priv, "Removing %pM but non UCODE active\n", in iwl_remove_station()
542 if (priv->stations[sta_id].used & IWL_STA_LOCAL) { in iwl_remove_station()
543 kfree(priv->stations[sta_id].lq); in iwl_remove_station()
544 priv->stations[sta_id].lq = NULL; in iwl_remove_station()
548 memset(&priv->tid_data[sta_id][tid], 0, in iwl_remove_station()
549 sizeof(priv->tid_data[sta_id][tid])); in iwl_remove_station()
551 priv->stations[sta_id].used &= ~IWL_STA_DRIVER_ACTIVE; in iwl_remove_station()
553 priv->num_stations--; in iwl_remove_station()
555 if (WARN_ON(priv->num_stations < 0)) in iwl_remove_station()
556 priv->num_stations = 0; in iwl_remove_station()
558 spin_unlock_bh(&priv->sta_lock); in iwl_remove_station()
560 return iwl_send_remove_station(priv, addr, sta_id, false); in iwl_remove_station()
562 spin_unlock_bh(&priv->sta_lock); in iwl_remove_station()
566 void iwl_deactivate_station(struct iwl_priv *priv, const u8 sta_id, in iwl_deactivate_station() argument
571 if (!iwl_is_ready(priv)) { in iwl_deactivate_station()
572 IWL_DEBUG_INFO(priv, in iwl_deactivate_station()
578 IWL_DEBUG_ASSOC(priv, "Deactivating STA: %pM (%d)\n", addr, sta_id); in iwl_deactivate_station()
583 spin_lock_bh(&priv->sta_lock); in iwl_deactivate_station()
585 WARN_ON_ONCE(!(priv->stations[sta_id].used & IWL_STA_DRIVER_ACTIVE)); in iwl_deactivate_station()
588 memset(&priv->tid_data[sta_id][tid], 0, in iwl_deactivate_station()
589 sizeof(priv->tid_data[sta_id][tid])); in iwl_deactivate_station()
591 priv->stations[sta_id].used &= ~IWL_STA_DRIVER_ACTIVE; in iwl_deactivate_station()
592 priv->stations[sta_id].used &= ~IWL_STA_UCODE_INPROGRESS; in iwl_deactivate_station()
594 priv->num_stations--; in iwl_deactivate_station()
596 if (WARN_ON_ONCE(priv->num_stations < 0)) in iwl_deactivate_station()
597 priv->num_stations = 0; in iwl_deactivate_station()
599 spin_unlock_bh(&priv->sta_lock); in iwl_deactivate_station()
602 static void iwl_sta_fill_lq(struct iwl_priv *priv, struct iwl_rxon_context *ctx, in iwl_sta_fill_lq() argument
609 lockdep_assert_held(&priv->mutex); in iwl_sta_fill_lq()
615 if (priv->band == IEEE80211_BAND_5GHZ) in iwl_sta_fill_lq()
625 rate_flags |= first_antenna(priv->nvm_data->valid_tx_ant) << in iwl_sta_fill_lq()
632 first_antenna(priv->nvm_data->valid_tx_ant); in iwl_sta_fill_lq()
635 priv->nvm_data->valid_tx_ant & in iwl_sta_fill_lq()
636 ~first_antenna(priv->nvm_data->valid_tx_ant); in iwl_sta_fill_lq()
639 } else if (num_of_ant(priv->nvm_data->valid_tx_ant) == 2) { in iwl_sta_fill_lq()
641 priv->nvm_data->valid_tx_ant; in iwl_sta_fill_lq()
660 void iwl_clear_ucode_stations(struct iwl_priv *priv, in iwl_clear_ucode_stations() argument
666 IWL_DEBUG_INFO(priv, "Clearing ucode stations in driver\n"); in iwl_clear_ucode_stations()
668 spin_lock_bh(&priv->sta_lock); in iwl_clear_ucode_stations()
670 if (ctx && ctx->ctxid != priv->stations[i].ctxid) in iwl_clear_ucode_stations()
673 if (priv->stations[i].used & IWL_STA_UCODE_ACTIVE) { in iwl_clear_ucode_stations()
674 IWL_DEBUG_INFO(priv, in iwl_clear_ucode_stations()
676 priv->stations[i].used &= ~IWL_STA_UCODE_ACTIVE; in iwl_clear_ucode_stations()
680 spin_unlock_bh(&priv->sta_lock); in iwl_clear_ucode_stations()
683 IWL_DEBUG_INFO(priv, in iwl_clear_ucode_stations()
695 void iwl_restore_stations(struct iwl_priv *priv, struct iwl_rxon_context *ctx) in iwl_restore_stations() argument
705 if (!iwl_is_ready(priv)) { in iwl_restore_stations()
706 IWL_DEBUG_INFO(priv, in iwl_restore_stations()
711 IWL_DEBUG_ASSOC(priv, "Restoring all known stations ... start.\n"); in iwl_restore_stations()
712 spin_lock_bh(&priv->sta_lock); in iwl_restore_stations()
714 if (ctx->ctxid != priv->stations[i].ctxid) in iwl_restore_stations()
716 if ((priv->stations[i].used & IWL_STA_DRIVER_ACTIVE) && in iwl_restore_stations()
717 !(priv->stations[i].used & IWL_STA_UCODE_ACTIVE)) { in iwl_restore_stations()
718 IWL_DEBUG_ASSOC(priv, "Restoring sta %pM\n", in iwl_restore_stations()
719 priv->stations[i].sta.sta.addr); in iwl_restore_stations()
720 priv->stations[i].sta.mode = 0; in iwl_restore_stations()
721 priv->stations[i].used |= IWL_STA_UCODE_INPROGRESS; in iwl_restore_stations()
727 if ((priv->stations[i].used & IWL_STA_UCODE_INPROGRESS)) { in iwl_restore_stations()
728 memcpy(&sta_cmd, &priv->stations[i].sta, in iwl_restore_stations()
731 if (priv->stations[i].lq) { in iwl_restore_stations()
732 if (priv->wowlan) in iwl_restore_stations()
733 iwl_sta_fill_lq(priv, ctx, i, &lq); in iwl_restore_stations()
735 memcpy(&lq, priv->stations[i].lq, in iwl_restore_stations()
741 spin_unlock_bh(&priv->sta_lock); in iwl_restore_stations()
742 ret = iwl_send_add_sta(priv, &sta_cmd, 0); in iwl_restore_stations()
744 spin_lock_bh(&priv->sta_lock); in iwl_restore_stations()
745 IWL_ERR(priv, "Adding station %pM failed.\n", in iwl_restore_stations()
746 priv->stations[i].sta.sta.addr); in iwl_restore_stations()
747 priv->stations[i].used &= in iwl_restore_stations()
749 priv->stations[i].used &= in iwl_restore_stations()
758 iwl_send_lq_cmd(priv, ctx, &lq, 0, true); in iwl_restore_stations()
759 spin_lock_bh(&priv->sta_lock); in iwl_restore_stations()
760 priv->stations[i].used &= ~IWL_STA_UCODE_INPROGRESS; in iwl_restore_stations()
764 spin_unlock_bh(&priv->sta_lock); in iwl_restore_stations()
766 IWL_DEBUG_INFO(priv, "Restoring all known stations .... " in iwl_restore_stations()
769 IWL_DEBUG_INFO(priv, "Restoring all known stations .... " in iwl_restore_stations()
773 int iwl_get_free_ucode_key_offset(struct iwl_priv *priv) in iwl_get_free_ucode_key_offset() argument
777 for (i = 0; i < priv->sta_key_max_num; i++) in iwl_get_free_ucode_key_offset()
778 if (!test_and_set_bit(i, &priv->ucode_key_table)) in iwl_get_free_ucode_key_offset()
784 void iwl_dealloc_bcast_stations(struct iwl_priv *priv) in iwl_dealloc_bcast_stations() argument
788 spin_lock_bh(&priv->sta_lock); in iwl_dealloc_bcast_stations()
790 if (!(priv->stations[i].used & IWL_STA_BCAST)) in iwl_dealloc_bcast_stations()
793 priv->stations[i].used &= ~IWL_STA_UCODE_ACTIVE; in iwl_dealloc_bcast_stations()
794 priv->num_stations--; in iwl_dealloc_bcast_stations()
795 if (WARN_ON(priv->num_stations < 0)) in iwl_dealloc_bcast_stations()
796 priv->num_stations = 0; in iwl_dealloc_bcast_stations()
797 kfree(priv->stations[i].lq); in iwl_dealloc_bcast_stations()
798 priv->stations[i].lq = NULL; in iwl_dealloc_bcast_stations()
800 spin_unlock_bh(&priv->sta_lock); in iwl_dealloc_bcast_stations()
804 static void iwl_dump_lq_cmd(struct iwl_priv *priv, in iwl_dump_lq_cmd() argument
808 IWL_DEBUG_RATE(priv, "lq station id 0x%x\n", lq->sta_id); in iwl_dump_lq_cmd()
809 IWL_DEBUG_RATE(priv, "lq ant 0x%X 0x%X\n", in iwl_dump_lq_cmd()
814 IWL_DEBUG_RATE(priv, "lq index %d 0x%X\n", in iwl_dump_lq_cmd()
818 static inline void iwl_dump_lq_cmd(struct iwl_priv *priv, in iwl_dump_lq_cmd() argument
835 static bool is_lq_table_valid(struct iwl_priv *priv, in is_lq_table_valid() argument
844 IWL_DEBUG_INFO(priv, "Channel %u is not an HT channel\n", in is_lq_table_valid()
849 IWL_DEBUG_INFO(priv, in is_lq_table_valid()
868 int iwl_send_lq_cmd(struct iwl_priv *priv, struct iwl_rxon_context *ctx, in iwl_send_lq_cmd() argument
883 spin_lock_bh(&priv->sta_lock); in iwl_send_lq_cmd()
884 if (!(priv->stations[lq->sta_id].used & IWL_STA_DRIVER_ACTIVE)) { in iwl_send_lq_cmd()
885 spin_unlock_bh(&priv->sta_lock); in iwl_send_lq_cmd()
888 spin_unlock_bh(&priv->sta_lock); in iwl_send_lq_cmd()
890 iwl_dump_lq_cmd(priv, lq); in iwl_send_lq_cmd()
894 if (is_lq_table_valid(priv, ctx, lq)) in iwl_send_lq_cmd()
895 ret = iwl_dvm_send_cmd(priv, &cmd); in iwl_send_lq_cmd()
903 IWL_DEBUG_INFO(priv, "init LQ command complete, " in iwl_send_lq_cmd()
906 spin_lock_bh(&priv->sta_lock); in iwl_send_lq_cmd()
907 priv->stations[lq->sta_id].used &= ~IWL_STA_UCODE_INPROGRESS; in iwl_send_lq_cmd()
908 spin_unlock_bh(&priv->sta_lock); in iwl_send_lq_cmd()
915 iwl_sta_alloc_lq(struct iwl_priv *priv, struct iwl_rxon_context *ctx, in iwl_sta_alloc_lq() argument
922 IWL_ERR(priv, "Unable to allocate memory for LQ cmd.\n"); in iwl_sta_alloc_lq()
926 iwl_sta_fill_lq(priv, ctx, sta_id, link_cmd); in iwl_sta_alloc_lq()
936 int iwlagn_add_bssid_station(struct iwl_priv *priv, in iwlagn_add_bssid_station() argument
947 ret = iwl_add_station_common(priv, ctx, addr, 0, NULL, &sta_id); in iwlagn_add_bssid_station()
949 IWL_ERR(priv, "Unable to add station %pM\n", addr); in iwlagn_add_bssid_station()
956 spin_lock_bh(&priv->sta_lock); in iwlagn_add_bssid_station()
957 priv->stations[sta_id].used |= IWL_STA_LOCAL; in iwlagn_add_bssid_station()
958 spin_unlock_bh(&priv->sta_lock); in iwlagn_add_bssid_station()
961 link_cmd = iwl_sta_alloc_lq(priv, ctx, sta_id); in iwlagn_add_bssid_station()
963 IWL_ERR(priv, in iwlagn_add_bssid_station()
969 ret = iwl_send_lq_cmd(priv, ctx, link_cmd, 0, true); in iwlagn_add_bssid_station()
971 IWL_ERR(priv, "Link quality command failed (%d)\n", ret); in iwlagn_add_bssid_station()
973 spin_lock_bh(&priv->sta_lock); in iwlagn_add_bssid_station()
974 priv->stations[sta_id].lq = link_cmd; in iwlagn_add_bssid_station()
975 spin_unlock_bh(&priv->sta_lock); in iwlagn_add_bssid_station()
988 static int iwl_send_static_wepkey_cmd(struct iwl_priv *priv, in iwl_send_static_wepkey_cmd() argument
1029 return iwl_dvm_send_cmd(priv, &cmd); in iwl_send_static_wepkey_cmd()
1034 int iwl_restore_default_wep_keys(struct iwl_priv *priv, in iwl_restore_default_wep_keys() argument
1037 lockdep_assert_held(&priv->mutex); in iwl_restore_default_wep_keys()
1039 return iwl_send_static_wepkey_cmd(priv, ctx, false); in iwl_restore_default_wep_keys()
1042 int iwl_remove_default_wep_key(struct iwl_priv *priv, in iwl_remove_default_wep_key() argument
1048 lockdep_assert_held(&priv->mutex); in iwl_remove_default_wep_key()
1050 IWL_DEBUG_WEP(priv, "Removing default WEP key: idx=%d\n", in iwl_remove_default_wep_key()
1054 if (iwl_is_rfkill(priv)) { in iwl_remove_default_wep_key()
1055 IWL_DEBUG_WEP(priv, in iwl_remove_default_wep_key()
1060 ret = iwl_send_static_wepkey_cmd(priv, ctx, 1); in iwl_remove_default_wep_key()
1061 IWL_DEBUG_WEP(priv, "Remove default WEP key: idx=%d ret=%d\n", in iwl_remove_default_wep_key()
1067 int iwl_set_default_wep_key(struct iwl_priv *priv, in iwl_set_default_wep_key() argument
1073 lockdep_assert_held(&priv->mutex); in iwl_set_default_wep_key()
1077 IWL_DEBUG_WEP(priv, in iwl_set_default_wep_key()
1088 ret = iwl_send_static_wepkey_cmd(priv, ctx, false); in iwl_set_default_wep_key()
1089 IWL_DEBUG_WEP(priv, "Set default WEP key: len=%d idx=%d ret=%d\n", in iwl_set_default_wep_key()
1110 static u8 iwlagn_key_sta_id(struct iwl_priv *priv, in iwlagn_key_sta_id() argument
1130 static int iwlagn_send_sta_key(struct iwl_priv *priv, in iwlagn_send_sta_key() argument
1139 spin_lock_bh(&priv->sta_lock); in iwlagn_send_sta_key()
1140 memcpy(&sta_cmd, &priv->stations[sta_id].sta, sizeof(sta_cmd)); in iwlagn_send_sta_key()
1141 spin_unlock_bh(&priv->sta_lock); in iwlagn_send_sta_key()
1180 return iwl_send_add_sta(priv, &sta_cmd, cmd_flags); in iwlagn_send_sta_key()
1183 void iwl_update_tkip_key(struct iwl_priv *priv, in iwl_update_tkip_key() argument
1188 u8 sta_id = iwlagn_key_sta_id(priv, vif, sta); in iwl_update_tkip_key()
1193 if (iwl_scan_cancel(priv)) { in iwl_update_tkip_key()
1199 iwlagn_send_sta_key(priv, keyconf, sta_id, in iwl_update_tkip_key()
1203 int iwl_remove_dynamic_key(struct iwl_priv *priv, in iwl_remove_dynamic_key() argument
1209 u8 sta_id = iwlagn_key_sta_id(priv, ctx->vif, sta); in iwl_remove_dynamic_key()
1216 spin_lock_bh(&priv->sta_lock); in iwl_remove_dynamic_key()
1217 memcpy(&sta_cmd, &priv->stations[sta_id].sta, sizeof(sta_cmd)); in iwl_remove_dynamic_key()
1218 if (!(priv->stations[sta_id].used & IWL_STA_UCODE_ACTIVE)) in iwl_remove_dynamic_key()
1220 spin_unlock_bh(&priv->sta_lock); in iwl_remove_dynamic_key()
1225 lockdep_assert_held(&priv->mutex); in iwl_remove_dynamic_key()
1229 IWL_DEBUG_WEP(priv, "Remove dynamic key: idx=%d sta=%d\n", in iwl_remove_dynamic_key()
1232 if (!test_and_clear_bit(keyconf->hw_key_idx, &priv->ucode_key_table)) in iwl_remove_dynamic_key()
1233 IWL_ERR(priv, "offset %d not used in uCode key table.\n", in iwl_remove_dynamic_key()
1248 return iwl_send_add_sta(priv, &sta_cmd, 0); in iwl_remove_dynamic_key()
1251 int iwl_set_dynamic_key(struct iwl_priv *priv, in iwl_set_dynamic_key() argument
1259 u8 sta_id = iwlagn_key_sta_id(priv, ctx->vif, sta); in iwl_set_dynamic_key()
1265 lockdep_assert_held(&priv->mutex); in iwl_set_dynamic_key()
1267 keyconf->hw_key_idx = iwl_get_free_ucode_key_offset(priv); in iwl_set_dynamic_key()
1283 ret = iwlagn_send_sta_key(priv, keyconf, sta_id, in iwl_set_dynamic_key()
1289 ret = iwlagn_send_sta_key(priv, keyconf, sta_id, in iwl_set_dynamic_key()
1293 IWL_ERR(priv, "Unknown cipher %x\n", keyconf->cipher); in iwl_set_dynamic_key()
1299 clear_bit(keyconf->hw_key_idx, &priv->ucode_key_table); in iwl_set_dynamic_key()
1302 IWL_DEBUG_WEP(priv, "Set dynamic key: cipher=%x len=%d idx=%d sta=%pM ret=%d\n", in iwl_set_dynamic_key()
1316 int iwlagn_alloc_bcast_station(struct iwl_priv *priv, in iwlagn_alloc_bcast_station() argument
1322 spin_lock_bh(&priv->sta_lock); in iwlagn_alloc_bcast_station()
1323 sta_id = iwl_prep_station(priv, ctx, iwl_bcast_addr, false, NULL); in iwlagn_alloc_bcast_station()
1325 IWL_ERR(priv, "Unable to prepare broadcast station\n"); in iwlagn_alloc_bcast_station()
1326 spin_unlock_bh(&priv->sta_lock); in iwlagn_alloc_bcast_station()
1331 priv->stations[sta_id].used |= IWL_STA_DRIVER_ACTIVE; in iwlagn_alloc_bcast_station()
1332 priv->stations[sta_id].used |= IWL_STA_BCAST; in iwlagn_alloc_bcast_station()
1333 spin_unlock_bh(&priv->sta_lock); in iwlagn_alloc_bcast_station()
1335 link_cmd = iwl_sta_alloc_lq(priv, ctx, sta_id); in iwlagn_alloc_bcast_station()
1337 IWL_ERR(priv, in iwlagn_alloc_bcast_station()
1342 spin_lock_bh(&priv->sta_lock); in iwlagn_alloc_bcast_station()
1343 priv->stations[sta_id].lq = link_cmd; in iwlagn_alloc_bcast_station()
1344 spin_unlock_bh(&priv->sta_lock); in iwlagn_alloc_bcast_station()
1355 int iwl_update_bcast_station(struct iwl_priv *priv, in iwl_update_bcast_station() argument
1361 link_cmd = iwl_sta_alloc_lq(priv, ctx, sta_id); in iwl_update_bcast_station()
1363 IWL_ERR(priv, "Unable to initialize rate scaling for bcast station.\n"); in iwl_update_bcast_station()
1367 spin_lock_bh(&priv->sta_lock); in iwl_update_bcast_station()
1368 if (priv->stations[sta_id].lq) in iwl_update_bcast_station()
1369 kfree(priv->stations[sta_id].lq); in iwl_update_bcast_station()
1371 IWL_DEBUG_INFO(priv, "Bcast station rate scaling has not been initialized yet.\n"); in iwl_update_bcast_station()
1372 priv->stations[sta_id].lq = link_cmd; in iwl_update_bcast_station()
1373 spin_unlock_bh(&priv->sta_lock); in iwl_update_bcast_station()
1378 int iwl_update_bcast_stations(struct iwl_priv *priv) in iwl_update_bcast_stations() argument
1383 for_each_context(priv, ctx) { in iwl_update_bcast_stations()
1384 ret = iwl_update_bcast_station(priv, ctx); in iwl_update_bcast_stations()
1395 int iwl_sta_tx_modify_enable_tid(struct iwl_priv *priv, int sta_id, int tid) in iwl_sta_tx_modify_enable_tid() argument
1399 lockdep_assert_held(&priv->mutex); in iwl_sta_tx_modify_enable_tid()
1402 spin_lock_bh(&priv->sta_lock); in iwl_sta_tx_modify_enable_tid()
1403 priv->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_TID_DISABLE_TX; in iwl_sta_tx_modify_enable_tid()
1404 priv->stations[sta_id].sta.tid_disable_tx &= cpu_to_le16(~(1 << tid)); in iwl_sta_tx_modify_enable_tid()
1405 priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK; in iwl_sta_tx_modify_enable_tid()
1406 memcpy(&sta_cmd, &priv->stations[sta_id].sta, sizeof(struct iwl_addsta_cmd)); in iwl_sta_tx_modify_enable_tid()
1407 spin_unlock_bh(&priv->sta_lock); in iwl_sta_tx_modify_enable_tid()
1409 return iwl_send_add_sta(priv, &sta_cmd, 0); in iwl_sta_tx_modify_enable_tid()
1412 int iwl_sta_rx_agg_start(struct iwl_priv *priv, struct ieee80211_sta *sta, in iwl_sta_rx_agg_start() argument
1418 lockdep_assert_held(&priv->mutex); in iwl_sta_rx_agg_start()
1424 spin_lock_bh(&priv->sta_lock); in iwl_sta_rx_agg_start()
1425 priv->stations[sta_id].sta.station_flags_msk = 0; in iwl_sta_rx_agg_start()
1426 priv->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_ADDBA_TID_MSK; in iwl_sta_rx_agg_start()
1427 priv->stations[sta_id].sta.add_immediate_ba_tid = (u8)tid; in iwl_sta_rx_agg_start()
1428 priv->stations[sta_id].sta.add_immediate_ba_ssn = cpu_to_le16(ssn); in iwl_sta_rx_agg_start()
1429 priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK; in iwl_sta_rx_agg_start()
1430 memcpy(&sta_cmd, &priv->stations[sta_id].sta, sizeof(struct iwl_addsta_cmd)); in iwl_sta_rx_agg_start()
1431 spin_unlock_bh(&priv->sta_lock); in iwl_sta_rx_agg_start()
1433 return iwl_send_add_sta(priv, &sta_cmd, 0); in iwl_sta_rx_agg_start()
1436 int iwl_sta_rx_agg_stop(struct iwl_priv *priv, struct ieee80211_sta *sta, in iwl_sta_rx_agg_stop() argument
1442 lockdep_assert_held(&priv->mutex); in iwl_sta_rx_agg_stop()
1446 IWL_ERR(priv, "Invalid station for AGG tid %d\n", tid); in iwl_sta_rx_agg_stop()
1450 spin_lock_bh(&priv->sta_lock); in iwl_sta_rx_agg_stop()
1451 priv->stations[sta_id].sta.station_flags_msk = 0; in iwl_sta_rx_agg_stop()
1452 priv->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_DELBA_TID_MSK; in iwl_sta_rx_agg_stop()
1453 priv->stations[sta_id].sta.remove_immediate_ba_tid = (u8)tid; in iwl_sta_rx_agg_stop()
1454 priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK; in iwl_sta_rx_agg_stop()
1455 memcpy(&sta_cmd, &priv->stations[sta_id].sta, sizeof(struct iwl_addsta_cmd)); in iwl_sta_rx_agg_stop()
1456 spin_unlock_bh(&priv->sta_lock); in iwl_sta_rx_agg_stop()
1458 return iwl_send_add_sta(priv, &sta_cmd, 0); in iwl_sta_rx_agg_stop()
1463 void iwl_sta_modify_sleep_tx_count(struct iwl_priv *priv, int sta_id, int cnt) in iwl_sta_modify_sleep_tx_count() argument
1474 iwl_send_add_sta(priv, &cmd, CMD_ASYNC); in iwl_sta_modify_sleep_tx_count()